asn1: Allow comments and leading ws in opt files
This commit is contained in:
@@ -330,6 +330,11 @@ to form the names of the files generated.
|
||||
.It Fl Fl option-file=FILE
|
||||
Take additional command-line options from
|
||||
.Ar FILE .
|
||||
The options file must have one command-line option per-line, but
|
||||
leading whitespace is ignored, and lines that start with a hash
|
||||
symbol
|
||||
.Sq ( # )
|
||||
are comments and are ignored.
|
||||
.It Fl Fl original-order
|
||||
Attempt to preserve the original order of type definition in the
|
||||
ASN.1 module.
|
||||
|
@@ -409,8 +409,16 @@ main(int argc, char **argv)
|
||||
sz = 2;
|
||||
|
||||
while (fgets(buf, sizeof(buf), opt) != NULL) {
|
||||
size_t buflen, ws;
|
||||
|
||||
buf[strcspn(buf, "\n\r")] = '\0';
|
||||
|
||||
buflen = strlen(buf);
|
||||
if ((ws = strspn(buf, " \t")))
|
||||
memmove(buf, buf + ws, buflen -= ws);
|
||||
if (buf[0] == '\0' || buf[0] == '#')
|
||||
continue;
|
||||
|
||||
if (len + 1 >= sz) {
|
||||
arg = realloc(arg, (sz + (sz>>1) + 2) * sizeof(arg[0]));
|
||||
if (arg == NULL) {
|
||||
|
Reference in New Issue
Block a user