be quoted any more.
/* -*-c-*-
*
- * $Id: conf.c,v 1.2 1999/07/26 23:28:39 mdw Exp $
+ * $Id: conf.c,v 1.3 1999/08/19 18:32:48 mdw Exp $
*
* Configuration parsing
*
/*----- Revision history --------------------------------------------------*
*
* $Log: conf.c,v $
+ * Revision 1.3 1999/08/19 18:32:48 mdw
+ * Improve lexical analysis. In particular, `chmod' patterns don't have to
+ * be quoted any more.
+ *
* Revision 1.2 1999/07/26 23:28:39 mdw
* Major reconstruction work for new design.
*
static source_ops *sources[] = { &xsource_ops, &fsource_ops, &ssource_ops };
static target_ops *targets[] = { &xtarget_ops, &ftarget_ops, &starget_ops };
+static const char *notword = 0;
+static const char *notdelim = 0;
+
/*----- Main code ---------------------------------------------------------*/
+/* --- @undelim@ --- *
+ *
+ * Arguments: @const char *d, dd@ = pointer to characters to escape
+ *
+ * Returns: ---
+ *
+ * Use: Modifies the tokenizer. Characters in the first list will
+ * always be considered to begin a word. Characters in the
+ * second list will always be allowed to continue a word.
+ */
+
+void undelim(const char *d, const char *dd) { notword = d; notdelim = dd; }
+
/* --- @token@ --- *
*
* Arguments: @scanner *sc@ = pointer to scanner definition
/* --- Various self-delimiting characters --- */
case SELFDELIM:
- dstr_putc(&sc->d, ch);
- dstr_putz(&sc->d);
- sc->t = ch;
- goto done;
+ if (!notword || strchr(notword, ch) == 0) {
+ dstr_putc(&sc->d, ch);
+ dstr_putz(&sc->d);
+ sc->t = ch;
+ goto done;
+ }
/* --- Bare words --- *
*
q = !q;
break;
case SELFDELIM:
- if (q)
+ if (q || (notdelim && strchr(notdelim, ch)))
goto insert;
goto word;
default:
/* -*-c-*-
*
- * $Id: conf.h,v 1.3 1999/07/27 18:30:14 mdw Exp $
+ * $Id: conf.h,v 1.4 1999/08/19 18:32:48 mdw Exp $
*
* Configuration parsing
*
/*----- Revision history --------------------------------------------------*
*
* $Log: conf.h,v $
+ * Revision 1.4 1999/08/19 18:32:48 mdw
+ * Improve lexical analysis. In particular, `chmod' patterns don't have to
+ * be quoted any more.
+ *
* Revision 1.3 1999/07/27 18:30:14 mdw
* Improve documentation and layout for @CONF_BEGIN@ and friends. Remove
* irritating warning about unused label by introducing a spurious `goto'.
/*----- Functions provided ------------------------------------------------*/
+/* --- @undelim@ --- *
+ *
+ * Arguments: @const char *d, dd@ = pointer to characters to escape
+ *
+ * Returns: ---
+ *
+ * Use: Modifies the tokenizer. Characters in the first list will
+ * always be considered to begin a word. Characters in the
+ * second list will always be allowed to continue a word.
+ */
+
+extern void undelim(const char */*d*/, const char */*dd*/);
+
/* --- @token@ --- *
*
* Arguments: @scanner *sc@ = pointer to scanner definition
/* -*-c-*-
*
- * $Id: fattr.c,v 1.1 1999/07/26 23:33:56 mdw Exp $
+ * $Id: fattr.c,v 1.2 1999/08/19 18:32:48 mdw Exp $
*
* Handling of file attributes
*
/*----- Revision history --------------------------------------------------*
*
* $Log: fattr.c,v $
+ * Revision 1.2 1999/08/19 18:32:48 mdw
+ * Improve lexical analysis. In particular, `chmod' patterns don't have to
+ * be quoted any more.
+ *
* Revision 1.1 1999/07/26 23:33:56 mdw
* Support code for new design.
*
/* --- Gobble an optional `=' sign --- */
+ undelim(0, ",=+-");
token(sc);
if (sc->t == '=')
token(sc);
if (sc->t != CTOK_WORD)
error(sc, "parse error, expected file mode");
+ undelim(0, 0);
/* --- If it looks digitlike, read as octal --- */
else {
const char *p;
- unsigned mask = 07777;
+ unsigned mask = 04700;
+ unsigned state = 0;
unsigned or = 1;
/* --- Set the default from the umask --- */
switch (*p) {
case ',': break;
- case 'a': mask = 07777; break;
- case 'u': mask = 04700; break;
- case 'g': mask = 02070; break;
- case 'o': mask = 01007; break;
+ case 'a': mask = (mask & state) | 07777; state = 07777; break;
+ case 'u': mask = (mask & state) | 04700; state = 07777; break;
+ case 'g': mask = (mask & state) | 02070; state = 07777; break;
+ case 'o': mask = (mask & state) | 01007; state = 07777; break;
- case '=': mode &= ~mask; break;
- case '-': or = 0; break;
- case '+': or = 1; break;
+ case '=': mode &= ~mask; /* Drop through */
+ case '+': state = 0; or = 1; break;
+ case '-': state = 0; or = 0; break;
#define APPLY(m) if (or) mode |= ((m) & mask); else mode &= ~((m) & mask);
- case 'r': APPLY(00444); break;
- case 'w': APPLY(00222); break;
- case 'x': APPLY(00111); break;
- case 's': APPLY(06000); break;
- case 't': APPLY(01000); break;
+ case 'r': state = 0; APPLY(00444); break;
+ case 'w': state = 0; APPLY(00222); break;
+ case 'x': state = 0; APPLY(00111); break;
+ case 's': state = 0; APPLY(06000); break;
+ case 't': state = 0; APPLY(01000); break;
#undef APPLY
default: error(sc, "unknown mode character `%c'", *p);
.\" -*-nroff-*-
.\"
-.\" $Id: fw.1,v 1.3 1999/07/30 06:49:00 mdw Exp $
+.\" $Id: fw.1,v 1.4 1999/08/19 18:32:48 mdw Exp $
.\"
.\" Manual page for fw
.\"
.\" ---- Revision history ---------------------------------------------------
.\"
.\" $Log: fw.1,v $
+.\" Revision 1.4 1999/08/19 18:32:48 mdw
+.\" Improve lexical analysis. In particular, `chmod' patterns don't have to
+.\" be quoted any more.
+.\"
.\" Revision 1.3 1999/07/30 06:49:00 mdw
.\" Minor tidying and typo correction.
.\"
.br
.I null-spec
::=
-.RB [[ : ] null [ : ]]
+.RB [ : ] null [ : ]
.PP
The
.I file
string which acts on the default permissions established by the
prevailing
.BR umask (2)
-setting. Note that
-.BR chmod -style
-strings may contain
+setting. The characters
.RB ` = '
and
.RB ` , '
-characters that will need to be escaped or quoted.
-.RE
+do not have to be quoted within the mode string.
.PP
.IB prefix .fattr.owner
.RB [ = ]