![]() |
Macintosh Development |
[Home]
[About Us]
[People]
[Information Systems]
[Kerberos for Macintosh]
[Applications]
[Miscellaneous Documentation]
![]() |
Utilities Library API Functions |
int strcasecmp (const char *s1, const char *s2);
int strncasecmp (const char *s1, const char *s2, int n);strcasecmp and strncasecmp compare C strings case-insensitively. strcasecmp compares the entire string and strncasecmp comparesncharacters of each string.If the strings are equal, both functions return 0. If
s1is greater thans2then both functions return a number greater than 0. Ifs1is less thans2then both functions return a number less than 0.char *strtoken (const char *s, const char *delim, int index);strtoken allows you to break the stringsinto a sequence of tokens delimited by the stringdelim.indexis the index of the token you want (ie: ifindexis 2, you will get the second token). Ifsstarts withdelim, the first token will be an empty string. If there is no token at the index you provide, strtoken will return NULL.char *strdup (const char *s);strdup duplicates a string and returns a pointer to the copy. It allocates memory for the new string usingmalloc(), so use the MIT Support Libraryfree()function to dispose of the duplicated string.void swab (register char *src, register char *dest, register int n);
swab is a byte manipulation function. It copiesnbytes fromsrctodest, exchanging adjacent bytes.nshould be even. If it is odd, swab copies and exchangesn - 1bytes and the disposition of the last byte is undefined.srcanddestshould not overlap.int gettimeofday (struct timeval *tp, struct timezone *tz);
int settimeofday (struct timeval *tp, struct timezone *tz);gettimeofday returns the current time of day in Unix time. settimeofday sets the time on the Macintosh, giventpin Unix time. Both functions properly convert between Macintosh and Unix time.Currently neither function gets or sets
tz, the timezone structure.void mac_time_to_unix_time (time_t *time);
void unix_time_to_mac_time (time_t *time);mac_time_to_unix_time and unix_time_to_mac_time converttimebetween Mac and Unix time. (The Unix epoch is 1/1/1970, the Mac epoch is 1/1/1904.)void msl_time_to_unix_time (time_t *time);
void unix_time_to_msl_time (time_t *time);msl_time_to_unix_time and unix_time_to_msl_time converttimebetween MSL and Unix time. (The Unix epoch is 1/1/1970, the MSL epoch is 1/1/1900.)
Questions or comments? Send mail to macdev@mit.edu
Last updated on $Date: 2003/11/19 20:50:38 $
Last modified by $Author: smcguire $