home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / stdwin / Ports / mac / pstring.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-03-26  |  526 b   |  26 lines  |  [TEXT/????]

  1. /* Function to convert a C string to a Pascal string.
  2.    The conversion is not in-line, but returns a pointer to a static buffer.
  3.    This is needed when calling some toolbox routines.
  4.    MPW does the conversion in the glue.
  5. */
  6.  
  7. #include "macwin.h"
  8.  
  9. #ifndef CLEVERGLUE
  10.  
  11. char *
  12. PSTRING(src)
  13.     register char *src;
  14. {
  15.     static char buf[256];
  16.     register char *dst;
  17.     
  18.     dst = &buf[1];
  19.     while ((*dst++ = *src++) != '\0' && dst < &buf[256])
  20.         ;
  21.     buf[0] = dst - &buf[1] - 1; /* XXX Recent bugfix! */
  22.     return buf;
  23. }
  24.  
  25. #endif /* CLEVERGLUE */
  26.