home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-09-30 | 1.1 KB | 46 lines | [TEXT/R*ch] |
- // os_mac_str.c
- // 30Sep94 e (from os_mac.c originally by Marc Feeley)
- // portions Copyright © 1992 Marc Feeley and Douglas H. Currie, Jr.
-
- #include <Types.h>
- #include "os_mac_str.h"
-
- void c_to_p( char * c_str, Str255 p_str )
- { short i = 0;
- while (c_str[i] != '\0') { p_str[i+1] = c_str[i]; i++; }
- p_str[0] = i;
- }
-
- void p_to_p( Str255 p1, Str255 p2 )
- { short len = (unsigned char)*p1++;
- *p2++ = len;
- while (len>0) { *p2++ = *p1++; len--; }
- }
-
- void buf_to_p( unsigned short len, char *p1, Str255 p2 )
- { if( len > 255 ) len = 255;
- *p2++ = len;
- while (len>0) { *p2++ = *p1++; len--; }
- }
-
- void p_to_c( Str255 p_str, char *c_str )
- { short len = (unsigned char)*p_str++, i = 0;
- while (i<len) { *c_str++ = *p_str++; i++; }
- *c_str++ = '\0';
- }
-
- short compare_p_to_p( Str255 p1, Str255 p2 )
- { short len1 = (unsigned char)*p1++, len2 = (unsigned char)*p2++;
- if (len1 < len2) return -1;
- if (len1 > len2) return 1;
- while (len1>0)
- { short c1 = (unsigned char)*p1++, c2 = (unsigned char)*p2++;
- if (c1 < c2) return -1;
- if (c1 > c2) return 1;
- len1--;
- }
- return 0;
- }
-
- // end
-