version 1.4, 1996/06/26 05:36:37 |
version 1.5, 1996/11/30 21:09:04 |
|
|
/* $OpenBSD$ */ |
/* $OpenBSD$ */ |
/* $NetBSD: str.c,v 1.12 1996/03/29 02:17:34 jtc Exp $ */ |
/* $NetBSD: str.c,v 1.13 1996/11/06 17:59:23 christos Exp $ */ |
|
|
/*- |
/*- |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
* Copyright (c) 1988, 1989, 1990, 1993 |
* Copyright (c) 1988, 1989 by Adam de Boor |
* The Regents of the University of California. All rights reserved. |
* Copyright (c) 1989 by Berkeley Softworks |
* Copyright (c) 1989 by Berkeley Softworks |
* All rights reserved. |
* All rights reserved. |
* |
* |
|
|
void |
void |
str_end() |
str_end() |
{ |
{ |
if (argv[0]) { |
if (argv) { |
free(argv[0]); |
if (argv[0]) |
|
free(argv[0]); |
free((Address) argv); |
free((Address) argv); |
} |
} |
if (buffer) |
if (buffer) |
|
|
ch = *++p; |
ch = *++p; |
break; |
break; |
} |
} |
|
|
switch (ch = *++p) { |
switch (ch = *++p) { |
case '\0': |
case '\0': |
case '\n': |
case '\n': |
|
|
|
|
/* |
/* |
* Str_FindSubstring -- See if a string contains a particular substring. |
* Str_FindSubstring -- See if a string contains a particular substring. |
* |
* |
* Results: If string contains substring, the return value is the location of |
* Results: If string contains substring, the return value is the location of |
* the first matching instance of substring in string. If string doesn't |
* the first matching instance of substring in string. If string doesn't |
* contain substring, the return value is NULL. Matching is done on an exact |
* contain substring, the return value is NULL. Matching is done on an exact |
* character-for-character basis with no wildcards or special characters. |
* character-for-character basis with no wildcards or special characters. |
* |
* |
* Side effects: None. |
* Side effects: None. |
*/ |
*/ |
char * |
char * |
|
|
|
|
/* |
/* |
* Str_Match -- |
* Str_Match -- |
* |
* |
* See if a particular string matches a particular pattern. |
* See if a particular string matches a particular pattern. |
* |
* |
* Results: Non-zero is returned if string matches pattern, 0 otherwise. The |
* Results: Non-zero is returned if string matches pattern, 0 otherwise. The |
* matching operation permits the following special characters in the |
* matching operation permits the following special characters in the |
* pattern: *?\[] (see the man page for details on what these mean). |
* pattern: *?\[] (see the man page for details on what these mean). |
* |
* |
* Side effects: None. |
* Side effects: None. |
*/ |
*/ |
int |
int |
|
|
/*- |
/*- |
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
* Str_SYSVMatch -- |
* Str_SYSVMatch -- |
* Check word against pattern for a match (% is wild), |
* Check word against pattern for a match (% is wild), |
* |
* |
* Results: |
* Results: |
* Returns the beginning position of a match or null. The number |
* Returns the beginning position of a match or null. The number |
* of characters matched is returned in len. |
* of characters matched is returned in len. |
|
|
return m; |
return m; |
} |
} |
while (*w++ != '\0'); |
while (*w++ != '\0'); |
|
|
return NULL; |
return NULL; |
} |
} |
|
|
|
|
* Substitute '%' on the pattern with len characters from src. |
* Substitute '%' on the pattern with len characters from src. |
* If the pattern does not contain a '%' prepend len characters |
* If the pattern does not contain a '%' prepend len characters |
* from src. |
* from src. |
* |
* |
* Results: |
* Results: |
* None |
* None |
* |
* |