version 1.17, 1998/11/06 23:31:09 |
version 1.18, 2002/06/15 18:24:57 |
Line 62 __RCSID("$NetBSD$"); |
|
Line 62 __RCSID("$NetBSD$"); |
|
* the resulting string in allocated space. |
* the resulting string in allocated space. |
*/ |
*/ |
char * |
char * |
str_concat(s1, s2, flags) |
str_concat(char *s1, char *s2, int flags) |
char *s1, *s2; |
|
int flags; |
|
{ |
{ |
register int len1, len2; |
int len1, len2; |
register char *result; |
char *result; |
|
|
/* get the length of both strings */ |
/* get the length of both strings */ |
len1 = strlen(s1); |
len1 = strlen(s1); |
Line 110 str_concat(s1, s2, flags) |
|
Line 108 str_concat(s1, s2, flags) |
|
* the first word is always the value of the .MAKE variable. |
* the first word is always the value of the .MAKE variable. |
*/ |
*/ |
char ** |
char ** |
brk_string(str, store_argc, expand, buffer) |
brk_string(char *str, int *store_argc, Boolean expand, char **buffer) |
register char *str; |
|
int *store_argc; |
|
Boolean expand; |
|
char **buffer; |
|
{ |
{ |
register int argc, ch; |
int argc, ch; |
register char inquote, *p, *start, *t; |
char inquote, *p, *start, *t; |
int len; |
int len; |
int argmax = 50, curlen = 0; |
int argmax = 50, curlen = 0; |
char **argv = (char **)emalloc((argmax + 1) * sizeof(char *)); |
char **argv = (char **)emalloc((argmax + 1) * sizeof(char *)); |
Line 233 done: argv[argc] = (char *)NULL; |
|
Line 227 done: argv[argc] = (char *)NULL; |
|
/* |
/* |
* Str_FindSubstring -- See if a string contains a particular substring. |
* Str_FindSubstring -- See if a string contains a particular substring. |
* |
* |
|
* Input: |
|
* string String to search. |
|
* substring Substring to find in string. |
|
* |
* 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 |
Line 241 done: argv[argc] = (char *)NULL; |
|
Line 239 done: argv[argc] = (char *)NULL; |
|
* Side effects: None. |
* Side effects: None. |
*/ |
*/ |
char * |
char * |
Str_FindSubstring(string, substring) |
Str_FindSubstring(char *string, char *substring) |
register char *string; /* String to search. */ |
|
char *substring; /* Substring to find in string */ |
|
{ |
{ |
register char *a, *b; |
char *a, *b; |
|
|
/* |
/* |
* First scan quickly through the two strings looking for a single- |
* First scan quickly through the two strings looking for a single- |
Line 280 Str_FindSubstring(string, substring) |
|
Line 276 Str_FindSubstring(string, substring) |
|
* Side effects: None. |
* Side effects: None. |
*/ |
*/ |
int |
int |
Str_Match(string, pattern) |
Str_Match(char *string, char *pattern) |
register char *string; /* String */ |
|
register char *pattern; /* Pattern */ |
|
{ |
{ |
char c2; |
char c2; |
|
|
Line 375 thisCharOK: ++pattern; |
|
Line 369 thisCharOK: ++pattern; |
|
* Str_SYSVMatch -- |
* Str_SYSVMatch -- |
* Check word against pattern for a match (% is wild), |
* Check word against pattern for a match (% is wild), |
* |
* |
|
* Input: |
|
* word Word to examine |
|
* pattern Pattern to examine against |
|
* len Number of characters to substitute |
|
* |
* 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. |
Line 385 thisCharOK: ++pattern; |
|
Line 384 thisCharOK: ++pattern; |
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
char * |
char * |
Str_SYSVMatch(word, pattern, len) |
Str_SYSVMatch(char *word, char *pattern, int *len) |
char *word; /* Word to examine */ |
|
char *pattern; /* Pattern to examine against */ |
|
int *len; /* Number of characters to substitute */ |
|
{ |
{ |
char *p = pattern; |
char *p = pattern; |
char *w = word; |
char *w = word; |
Line 445 Str_SYSVMatch(word, pattern, len) |
|
Line 441 Str_SYSVMatch(word, pattern, len) |
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
void |
void |
Str_SYSVSubst(buf, pat, src, len) |
Str_SYSVSubst(Buffer buf, char *pat, char *src, int len) |
Buffer buf; |
|
char *pat; |
|
char *src; |
|
int len; |
|
{ |
{ |
char *m; |
char *m; |
|
|