version 1.95, 2010/07/21 09:15:48 |
version 1.96, 2010/07/27 13:16:00 |
Line 969 roff_cond(ROFF_ARGS) |
|
Line 969 roff_cond(ROFF_ARGS) |
|
static enum rofferr |
static enum rofferr |
roff_ds(ROFF_ARGS) |
roff_ds(ROFF_ARGS) |
{ |
{ |
char *name, *string, *end; |
char *name, *string; |
|
|
|
/* |
|
* A symbol is named by the first word following the macro |
|
* invocation up to a space. Its value is anything after the |
|
* name's trailing whitespace and optional double-quote. Thus, |
|
* |
|
* [.ds foo "bar " ] |
|
* |
|
* will have `bar " ' as its value. |
|
*/ |
|
|
name = *bufp + pos; |
name = *bufp + pos; |
if ('\0' == *name) |
if ('\0' == *name) |
return(ROFF_IGN); |
return(ROFF_IGN); |
|
|
string = name; |
string = name; |
|
/* Read until end of name. */ |
while (*string && ' ' != *string) |
while (*string && ' ' != *string) |
string++; |
string++; |
|
|
|
/* Nil-terminate name. */ |
if (*string) |
if (*string) |
*(string++) = NULL; |
*(string++) = '\0'; |
if (*string && '"' == *string) |
|
string++; |
/* Read past spaces. */ |
while (*string && ' ' == *string) |
while (*string && ' ' == *string) |
string++; |
string++; |
end = string; |
|
while (*end) |
|
end++; |
|
if (string < end) { |
|
end--; |
|
if (*end == '"') |
|
*end = '\0'; |
|
} |
|
|
|
|
/* Read passed initial double-quote. */ |
|
if (*string && '"' == *string) |
|
string++; |
|
|
|
/* The rest is the value. */ |
roff_setstr(r, name, string); |
roff_setstr(r, name, string); |
return(ROFF_IGN); |
return(ROFF_IGN); |
} |
} |
Line 1060 roff_setstr(struct roff *r, const char *name, const ch |
|
Line 1070 roff_setstr(struct roff *r, const char *name, const ch |
|
} else |
} else |
free(n->string); |
free(n->string); |
|
|
|
ROFF_DEBUG("roff: new symbol: [%s] = [%s]\n", name, string); |
n->string = string ? strdup(string) : NULL; |
n->string = string ? strdup(string) : NULL; |
} |
} |
|
|