| Last change
 on this file since 100 was             73, checked in by vladest, 20 years ago | 
        
          | 
Fixed compile issuesFixed SB128 driver
 
 | 
        
          | File size:
            1010 bytes | 
      
      
| Line |  | 
|---|
| 1 | /* strstr.c (emx+gcc) -- Copyright (c) 1990-1995 by Eberhard Mattes */ | 
|---|
| 2 |  | 
|---|
| 3 | #include <string.h> | 
|---|
| 4 | #if 1 | 
|---|
| 5 | char *strstr1 (const char *string1, const char *string2) | 
|---|
| 6 | { | 
|---|
| 7 | int len1, len2, i; | 
|---|
| 8 | char first; | 
|---|
| 9 |  | 
|---|
| 10 | if (*string2 == 0) | 
|---|
| 11 | return (char *)string1; | 
|---|
| 12 | len1 = 0; | 
|---|
| 13 | while (string1[len1] != 0) ++len1; | 
|---|
| 14 | len2 = 0; | 
|---|
| 15 | while (string2[len2] != 0) ++len2; | 
|---|
| 16 | if (len2 == 0) | 
|---|
| 17 | return (char *)(string1+len1); | 
|---|
| 18 | first = *string2; | 
|---|
| 19 | while (len1 >= len2) | 
|---|
| 20 | { | 
|---|
| 21 | if (*string1 == first) | 
|---|
| 22 | { | 
|---|
| 23 | for (i = 1; i < len2; ++i) | 
|---|
| 24 | if (string1[i] != string2[i]) | 
|---|
| 25 | break; | 
|---|
| 26 | if (i >= len2) | 
|---|
| 27 | return (char *)string1; | 
|---|
| 28 | } | 
|---|
| 29 | ++string1; --len1; | 
|---|
| 30 | } | 
|---|
| 31 | return NULL; | 
|---|
| 32 | } | 
|---|
| 33 | #endif | 
|---|
| 34 | #if 0 | 
|---|
| 35 | size_t strlcpy(char *dst, const char *src, size_t size) | 
|---|
| 36 | { | 
|---|
| 37 | if(size) { | 
|---|
| 38 | strncpy(dst, src, size-1); | 
|---|
| 39 | dst[size-1] = '\0'; | 
|---|
| 40 | } else { | 
|---|
| 41 | dst[0] = '\0'; | 
|---|
| 42 | } | 
|---|
| 43 | return strlen(src); | 
|---|
| 44 | } | 
|---|
| 45 |  | 
|---|
| 46 | #endif | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.