http://se.aminet.net/pub/X11/ftp.x.org/contrib/vms/xscreensaver-124.zip
[xscreensaver] / utils / strings.c
1 \ 2\0/**\0 *        STRINGS.C       (C adaptation of STRINGS.MAR)\ 3\0 */\0\0\0\ 2\0/*
2 \0 * bcopy()\ 2\0 *)\0 * copies length of source to destination\0\ 3\0 */\0\1e\0void bcopy (src, dest, length)\11\0char *src, *dest;\0\19\0unsigned long int length;\0\ 1\0{\0\1c\0  memcpy(dest, src, length);\ 1\0}\0\0\0\ 2\0/*   \0 * bcmp()\0\ 2\0 *5\0 * compare src againist destination for length bytes.\0\ 2\0 *<\0 * return -1 if src < dest, 0 if src = dest, 1 if src > dest\ 3\0 */\0\e\0int bcmp(src, dest, length)\0\11\0char *src, *dest;\0\19\0unsigned long int length;\0\ 1\0{\0*\0   return((int)memcmp(src, dest, length));\ 1\0}\0\0\0\ 2\0/*
3 \0 * bzero()\ 2\0 *#\0 * zero out source for length bytes\0\ 3\0 */\0\17\0void bzero(src, length)\0
4 \0char *src;\19\0unsigned long int length;\0\ 1\0{\0\1a\0   memset(src, 0, length);\ 1\0}\0\0\0\ 2\0/*\b\0 * ffs()\ 2\0 *@\0 * finds the first bit set in the argument and returns the index\1f\0 * of that bit (starting at 1).\0\ 3\0 */\0\r\0int ffs(mask)\0\17\0unsigned long int mask;\0\ 1\0{\0\12\0   register int i;\0\0%\0   for (i = 0; i < sizeof(mask); i++)\0#\0 if (mask & (1 << i)) return (i+1);\0\0\0\ e\0   return(-1);\ 1\0}\0\0\0\ 2\0/*
5 \0 * index()\ 2\0 *B\0 * returns a pointer to the first occurrence of a character within\v\0 * a string\0\ 3\0 */\0\0\0\16\0char *index(string, c)\10\0char *string, c;\ 1\0{\0\1c\0   return(strchr(string,c));\ 1\0}\0\0\0\ 2\0/* \0 * rindex\0\ 2\0 *A\0 * returns a pointer to the last occurrence of a character within\0\v\0 * a string\0\ 3\0 */\0\0\0\17\0char *rindex(string, c)\0\10\0char *string, c;\ 1\0{\0\1e\0   return (strrchr(string,c));\ 1\0}\0