char *strcpy(s, t) char *s, *t; { char *p; p = s; while (*p++ = *t++); return s; } char *strncpy(s, t, n) char *s, *t; { char *p; p = s; while (n-- > 0) if (!(*p++ = *t++)) return s; *p = '\0'; return s; } char *strcat(s, t) char *s, *t; { char *p; p = s; while (*p) p++; while (*p++ = *t++); return s; } char *strncat(s, t, n) char *s, *t; { char *p; p = s; while (*p) p++; while (n-- > 0) if (!(*p++ = *t++)) return s; *p = '\0'; return s; } strcmp(s, t) char *s, *t; { while (*s == *t) { if (!*s++) return 0; t++; } return *s - *t; } strncmp(s, t, n) char *s, *t; { while (*s == *t) { if (!*s++ || --n <= 0) return 0; t++; } return *s - *t; } char *strchr(s, c) char *s, c; { while (*s != c) if (!*s++) return NULL; return s; } char *strrchr(s, c) char *s, c; { char *p; p = NULL; while (*s) { if (*s == c) p = s; s++; } return p; } strspn(s, t) char *s, *t; { int n; n = 0; while (*s) if (strchr(t, *s++) == NULL) return n; else n++; return n; } strcspn(s, t) char *s, *t; { int n; n = 0; while (*s) if (strchr(t, *s++) != NULL) return n; else n++; return n; } char *strpbrk(s, t) char *s, *t; { while (*s) { if (strchr(t, *s) != NULL) return s; s++; } return NULL; } char *strstr(s, t) char *s, *t; { int n; if ((n = strlen(t)) == 0) return s; while ((s = strchr(s, *t)) != NULL) if (memcmp(s, t, n) == 0) return s; return NULL; } strlen(s) char *s; { char *p; p = s; while (*p++); return p - s - 1; } char *strtok(s, t) char *s, *t; { if (s != NULL) p = s; if (!*p) return NULL; p += strspn(p, t); if (!*p) return NULL; s = p; p += strcspn(p, t); if (!*p) return s; *p++ = '\0'; return s; } char *memcpy(s, t, n) char *s, *t; { static char *a, *b; static int i; a = s; b = t; i = n; inline(42, &b, 237, 91, &a, 237, 75, &i, 237, 176); return s; } char *memmove(s, t, n) char *s, *t; { move(s, t, n); return s; } memcmp(s, t, n) char *s, *t; { static char *a, *b; static int i; a = s; b = t; i = n; if (i <= 0) return 0; inline(42, &b, 237, 91, &a, 237, 75, &i, 26, 150, 32, 13, 26); inline(167, 40, 9, 11, 120, 177, 40, 4, 35, 19, 24, 239); inline(33, &i, 119, 48, 4, 35, 62, 255, 119); return i; } char *memchr(s, c, n) char *s, c; { static char *a, chr; static int i; a = s; chr = c; i = n; inline(42, &a, 58, &chr, 237, 75, &i, 237, 177, 40, 3, 33, 1); inline(0, 43, 34, &a); return a; } char *memset(s, c, n) char *s, c; { static char *a, chr; static int i; a = s; chr = c; i = n - 1; inline(42, &a, 237, 91, &a, 19, 237, 75, &i, 58, &chr, 119); inline(237, 176); return s; }