if (flags & PREFIX)
fputs("halibut: ", stderr);
if (flags & FILEPOS) {
- fprintf(stderr, "%s:%d:", fpos.filename, fpos.line);
+ fprintf(stderr, "%s:", fpos.filename);
+ if (fpos.line > 0)
+ fprintf(stderr, "%d:", fpos.line);
if (fpos.col > 0)
fprintf(stderr, "%d:", fpos.col);
fputc(' ', stderr);
int debug;
int backendbits;
int k, b;
+ paragraph *cfg, *cfg_tail;
/*
* Set up initial (default) parameters.
reportcols = 0;
debug = 0;
backendbits = 0;
+ cfg = cfg_tail = NULL;
if (argc == 1) {
usage();
break;
}
break;
-#if 0
- case 'o':
+ case 'C':
/*
* Option requiring parameter.
*/
* Now c is the option and p is the parameter.
*/
switch (c) {
- case 'o':
- outfile = p;
+ case 'C':
+ /*
+ * -C means we split our argument up into
+ * colon-separated chunks and assemble them
+ * into a config paragraph.
+ */
+ {
+ wchar_t *keywords;
+ char *q;
+ wchar_t *u;
+ paragraph *para;
+
+ keywords = mknewa(wchar_t, 2+strlen(p));
+
+ u = keywords;
+ q = p;
+
+ while (*q) {
+ if (*q == ':') {
+ *u++ = L'\0';
+ } else {
+ if (*q == '\\' && q[1])
+ q++;
+ /* FIXME: lacks charset flexibility */
+ *u++ = *q;
+ }
+ q++;
+ }
+ *u = L'\0';
+
+ para = mknew(paragraph);
+ memset(para, 0, sizeof(*para));
+ para->type = para_Config;
+ para->keyword = keywords;
+ para->next = NULL;
+ para->fpos.filename = "<command line>";
+ para->fpos.line = para->fpos.col = -1;
+
+ if (cfg_tail)
+ cfg_tail->next = para;
+ else
+ cfg = para;
+ cfg_tail = para;
+ }
break;
}
p = NULL; /* prevent continued processing */
break;
-#endif
default:
/*
* Unrecognised option.
if (!sourceform)
exit(EXIT_FAILURE);
+ /*
+ * Append the config directives acquired from the command
+ * line.
+ */
+ {
+ paragraph *end;
+
+ end = sourceform;
+ while (end && end->next)
+ end = end->next;
+ assert(end);
+
+ end->next = cfg;
+ }
+
sfree(in.pushback);
mark_attr_ends(sourceform);