+#define l_isspace(c) ((c) == '\t' || (c) == ' ' || (c) == '\n' || (c) == '\r')
+
+int read_absyn_line(FILE *f, int *lineno, char *line, int len,
+ char *argv[], int num)
+{
+ char *p;
+ int argc;
+ int quoted = 0;
+
+ while ((p = fgets(line, len, f)))
+ {
+ (*lineno)++;
+ while (*p && l_isspace(*p))
+ p++;
+ if (*p && *p != '#')
+ break;
+ }
+ if (!p)
+ return 0;
+
+ for (argc = 0; *p ; argc++)
+ {
+ if (*p == '#') /* trailing comment */
+ break;
+ argv[argc] = p;
+ while (*p && !(l_isspace(*p) && !quoted)) {
+ if (*p =='"') quoted = 1 - quoted;
+ if (*p =='[') quoted = 1;
+ if (*p ==']') quoted = 0;
+ p++;
+ }
+ if (*p)
+ {
+ *(p++) = '\0';
+ while (*p && l_isspace(*p))
+ p++;
+ }
+ }
+ return argc;
+}
+
+