version 1.12, 2000/06/23 16:41:53 |
version 1.13, 2000/07/17 22:57:37 |
|
|
*/ |
*/ |
char ** |
char ** |
brk_string(str, store_argc, expand, buffer) |
brk_string(str, store_argc, expand, buffer) |
register char *str; |
const char *str; |
int *store_argc; |
int *store_argc; |
Boolean expand; |
Boolean expand; |
char **buffer; |
char **buffer; |
{ |
{ |
register int argc, ch; |
register int argc, ch; |
register char inquote, *p, *start, *t; |
char inquote; |
int len; |
const char *p; |
int argmax = 50, curlen = 0; |
char *start, *t; |
|
size_t len; |
|
int argmax = 50; |
|
size_t curlen = 0; |
char **argv = (char **)emalloc((argmax + 1) * sizeof(char *)); |
char **argv = (char **)emalloc((argmax + 1) * sizeof(char *)); |
|
|
/* skip leading space chars. */ |
/* skip leading space chars. */ |
|
|
*/ |
*/ |
int |
int |
Str_Match(string, pattern) |
Str_Match(string, pattern) |
register char *string; /* String */ |
const char *string; /* String */ |
register char *pattern; /* Pattern */ |
const char *pattern; /* Pattern */ |
{ |
{ |
char c2; |
char c2; |
|
|
|
|
* 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. |
* |
|
* Side Effects: |
|
* None |
|
* |
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
char * |
const char * |
Str_SYSVMatch(word, pattern, len) |
Str_SYSVMatch(word, pattern, len) |
char *word; /* Word to examine */ |
const char *word; /* Word to examine */ |
char *pattern; /* Pattern to examine against */ |
const char *pattern; /* Pattern to examine against */ |
int *len; /* Number of characters to substitute */ |
size_t *len; /* Number of characters to substitute */ |
{ |
{ |
char *p = pattern; |
const char *p = pattern; |
char *w = word; |
const char *w = word; |
char *m; |
const char *m; |
|
|
if (*p == '\0') { |
if (*p == '\0') { |
/* Null pattern is the whole string */ |
/* Null pattern is the whole string */ |
|
|
* 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: |
|
* None |
|
* |
|
* Side Effects: |
* Side Effects: |
* Places result on buf |
* Places result on buf |
* |
|
*----------------------------------------------------------------------- |
*----------------------------------------------------------------------- |
*/ |
*/ |
void |
void |
Str_SYSVSubst(buf, pat, src, len) |
Str_SYSVSubst(buf, pat, src, len) |
Buffer buf; |
Buffer buf; |
char *pat; |
const char *pat; |
char *src; |
const char *src; |
int len; |
size_t len; |
{ |
{ |
char *m; |
const char *m; |
|
|
if ((m = strchr(pat, '%')) != NULL) { |
if ((m = strchr(pat, '%')) != NULL) { |
/* Copy the prefix */ |
/* Copy the prefix */ |