forked from aniani/vim
updated for version 7.0114
This commit is contained in:
74
src/misc2.c
74
src/misc2.c
@@ -5557,80 +5557,6 @@ pathcmp(p, q, maxlen)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FEAT_PRINTER) || defined(PROTO)
|
||||
/*
|
||||
* Parse a list of options in the form
|
||||
* option:value,option:value,option:value
|
||||
*
|
||||
* "value" can start with a number which is parsed out, e.g.
|
||||
* margin:12mm
|
||||
*
|
||||
* Returns error message for an illegal option, NULL otherwise.
|
||||
* Only used for the printer at the moment...
|
||||
*/
|
||||
char_u *
|
||||
parse_list_options(option_str, table, table_size)
|
||||
char_u *option_str;
|
||||
option_table_T *table;
|
||||
int table_size;
|
||||
{
|
||||
char_u *stringp;
|
||||
char_u *colonp;
|
||||
char_u *commap;
|
||||
char_u *p;
|
||||
int idx = 0; /* init for GCC */
|
||||
int len;
|
||||
|
||||
for (idx = 0; idx < table_size; ++idx)
|
||||
table[idx].present = FALSE;
|
||||
|
||||
/*
|
||||
* Repeat for all comma separated parts.
|
||||
*/
|
||||
stringp = option_str;
|
||||
while (*stringp)
|
||||
{
|
||||
colonp = vim_strchr(stringp, ':');
|
||||
if (colonp == NULL)
|
||||
return (char_u *)N_("E550: Missing colon");
|
||||
commap = vim_strchr(stringp, ',');
|
||||
if (commap == NULL)
|
||||
commap = option_str + STRLEN(option_str);
|
||||
|
||||
len = (int)(colonp - stringp);
|
||||
|
||||
for (idx = 0; idx < table_size; ++idx)
|
||||
if (STRNICMP(stringp, table[idx].name, len) == 0)
|
||||
break;
|
||||
|
||||
if (idx == table_size)
|
||||
return (char_u *)N_("E551: Illegal component");
|
||||
|
||||
p = colonp + 1;
|
||||
table[idx].present = TRUE;
|
||||
|
||||
if (table[idx].hasnum)
|
||||
{
|
||||
if (!VIM_ISDIGIT(*p))
|
||||
return (char_u *)N_("E552: digit expected");
|
||||
|
||||
table[idx].number = getdigits(&p); /*advances p*/
|
||||
}
|
||||
|
||||
table[idx].string = p;
|
||||
table[idx].strlen = (int)(commap - p);
|
||||
|
||||
stringp = commap;
|
||||
if (*stringp == ',')
|
||||
++stringp;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#endif /*FEAT_PRINTER*/
|
||||
|
||||
/*
|
||||
* The putenv() implementation below comes from the "screen" program.
|
||||
* Included with permission from Juergen Weigert.
|
||||
|
Reference in New Issue
Block a user