|
Last change
on this file was
2,
checked in by oldcode, 25 years ago
|
|
Initial revision
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
|
File size:
1.4 KB
|
| Line | |
|---|
| 1 | /* |
|---|
| 2 | * TransFig: Facility for Translating Fig code |
|---|
| 3 | * Copyright (c) 1985 Supoj Sutantavibul |
|---|
| 4 | * Copyright (c) 1991 Micah Beck |
|---|
| 5 | * |
|---|
| 6 | * Permission to use, copy, modify, distribute, and sell this software and its |
|---|
| 7 | * documentation for any purpose is hereby granted without fee, provided that |
|---|
| 8 | * the above copyright notice appear in all copies and that both that |
|---|
| 9 | * copyright notice and this permission notice appear in supporting |
|---|
| 10 | * documentation. The authors make no representations about the suitability |
|---|
| 11 | * of this software for any purpose. It is provided "as is" without express |
|---|
| 12 | * or implied warranty. |
|---|
| 13 | * |
|---|
| 14 | * THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, |
|---|
| 15 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO |
|---|
| 16 | * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR |
|---|
| 17 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, |
|---|
| 18 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
|---|
| 19 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
|---|
| 20 | * PERFORMANCE OF THIS SOFTWARE. |
|---|
| 21 | * |
|---|
| 22 | */ |
|---|
| 23 | |
|---|
| 24 | #define NULL 0 |
|---|
| 25 | |
|---|
| 26 | /* |
|---|
| 27 | * Find the first occurrence of s2 in s1. |
|---|
| 28 | */ |
|---|
| 29 | char * |
|---|
| 30 | strstr(s1, s2) |
|---|
| 31 | register char *s1, *s2; |
|---|
| 32 | { |
|---|
| 33 | register int i, len, n; |
|---|
| 34 | |
|---|
| 35 | if (s2[0] == '\0') |
|---|
| 36 | return(s1); |
|---|
| 37 | len = strlen(s2); |
|---|
| 38 | n = strlen(s1) - len; |
|---|
| 39 | for (i = 0; i <= n; i++) |
|---|
| 40 | if (strcmp(s1 + i, s2) == 0) |
|---|
| 41 | return(s1 + i); |
|---|
| 42 | return(NULL); |
|---|
| 43 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.