* about m4 quoting &c., but we have to #include it so that the C
* objects from the lexer are available.
*
- * Copyright (C)1996-1999 Ian Jackson
+ * userv is copyright Ian Jackson and other contributors.
+ * See README for full authorship information.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with userv; if not, write to the Free Software
- * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * along with userv; if not, see <http://www.gnu.org/licenses/>.
*/
static int parse_file(const char *string, int *didexist);
int v;
p=q=inplace;
- assert(*p++ = '"');
+ assert(*p=='"'); p++;
while (*p && *p != '"') {
if (*p != '\\') { *q++= *p++; continue; }
switch (*++p) {
}
}
}
- assert(*p); assert(!*++p);
+ assert(*p); p++; assert(!*p);
*q++= 0;
return tokv_quotedstring;
}
return buf;
} else if (token & tokt_number) {
snyprintf(buf,sizeof(buf),"number %d",lr_min); return buf;
+ } else if (token & tokt_fdrange && token & tokr_word) {
+ snyprintf(buf,sizeof(buf),"fd %s",buf); return buf;
} else if (token & tokt_fdrange && lr_max==-1) {
snyprintf(buf,sizeof(buf),"fdrange %d-",lr_min); return buf;
} else if (token & tokt_fdrange) {
for (;;) { /* loop over lines */
cstate->reportlineno= cstate->lineno;
- do { token= yylex(); } while (token == tokv_lwsp);
+ do { token= yylex(); } while (token == tokv_lwsp || token == tokv_newline);
if (token & tokt_exception) {
return token;
} else if (token & tokt_controlend) {
char *ep;
unsigned long v;
- r= pa_mwsp(); if (r) return r;
mintoken= pa_numberdollar(&min); if (mintoken == tokv_error) return mintoken;
- r= pa_mwsp(); if (r) return r;
maxtoken= pa_numberdollar(&max); if (maxtoken == tokv_error) return maxtoken;
r= pa_mnl(); if (r) return r;
for (pp= pv; *pp; pp++) {
return parseerrprint("unable to open directory `%s': %s",cpget,strerror(errno));
cp= xstrsave(cpget);
cpl= strlen(cp);
- while ((de= readdir(d))) {
+ while ((errno=0, de= readdir(d))) {
tel= strlen(de->d_name);
if (!tel) continue;
p= de->d_name;
goto x_err;
}
}
+ if (errno) {
+ parseerrprint("error reading directory `%s': %s",cp,strerror(errno));
+ closedir(d);
+ free(cp);
+ return tokv_error;
+ }
if (closedir(d)) {
parseerrprint("error closing directory `%s': %s",cp,strerror(errno));
free(cp);
return r;
}
+static int oldquote = 0;
+
+int dfg_lookupquotemode(int dtoken) {
+ int r;
+ r= pa_mnl(); if (r) return r;
+ oldquote = dtoken == tokv_word_includelookupquoteold;
+ return r;
+}
+
int df_includelookup(int dtoken) {
static char *buildbuf=0;
int buildbuflen=0;
if (c=='/') {
*q++= ':';
c= '-';
- } else if (!((c >= '0' && c <= '9') ||
+ } else if (oldquote ?
+ !((c >= '0' && c <= '9') ||
(c >= 'a' && c <= 'z') ||
- c == '-' || c == '_')) {
+ c == '-' || c == '_') :
+ (c==':')) {
*q++= ':';
}
*q++= c;