Quotes are needed for talking about too many interesting files. In
particular, it's nice to be able to refer to, say, /tmp/.X11-unix/X0
from the command-line without quotes.
This change introduces a new function conf_fname which extends the word
characters appropriately during a read, and makes the various clients --
file, un, and exec -- actually use it rather than calling conf_name
directly.
+/* --- @conf_fname@ --- *
+ *
+ * Arguments: @scanner *sc@ = pointer to scanner
+ * @dstr *d@ = pointer to dynamic string for output
+ *
+ * Returns: ---
+ *
+ * Use: Reads a file name from the input and stores it in @d@.
+ */
+
+void conf_fname(scanner *sc, dstr *d)
+{
+ const char fnchars[] = ".-+,";
+ conf_undelim(sc, fnchars, fnchars);
+ conf_name(sc, '/', d);
+ conf_undelim(sc, 0, 0);
+}
+
/*----- That's all, folks -------------------------------------------------*/
/*----- That's all, folks -------------------------------------------------*/
+fwd (1.3.5interim) experimental; urgency=low
+
+ * Improve filename syntax.
+
+ -- Mark Wooding <mdw@distorted.org.uk> Tue, 08 Apr 2008 12:42:21 +0100
+
fwd (1.3.5) experimental; urgency=low
* Rename package to fwd.
fwd (1.3.5) experimental; urgency=low
* Rename package to fwd.
token(sc);
if (sc->t == '=')
token(sc);
token(sc);
if (sc->t == '=')
token(sc);
- conf_name(sc, '/', &d);
xo->dir = xstrdup(d.buf);
dstr_destroy(&d);
CONF_ACCEPT;
xo->dir = xstrdup(d.buf);
dstr_destroy(&d);
CONF_ACCEPT;
token(sc);
if (sc->t == '=')
token(sc);
token(sc);
if (sc->t == '=')
token(sc);
- conf_name(sc, '/', &d);
xo->root = xstrdup(d.buf);
dstr_destroy(&d);
CONF_ACCEPT;
xo->root = xstrdup(d.buf);
dstr_destroy(&d);
CONF_ACCEPT;
error(sc, "parse error, expected file descriptor");
} else {
dstr d = DSTR_INIT;
error(sc, "parse error, expected file descriptor");
} else {
dstr d = DSTR_INIT;
- conf_name(sc, '/', &d);
f->type = FTYPE_NAME;
f->u.name = xstrdup(d.buf);
dstr_destroy(&d);
f->type = FTYPE_NAME;
f->u.name = xstrdup(d.buf);
dstr_destroy(&d);
.\"--------------------------------------------------------------------------
.SH "BUGS"
.
.\"--------------------------------------------------------------------------
.SH "BUGS"
.
-The syntax for IP addresses and filenames is nasty.
+The syntax for IP addresses and filenames is nasty. (The filename
+syntax used to be even nastier, though.)
.PP
IPv6 is not supported yet. Because of
.BR fwd 's
.PP
IPv6 is not supported yet. Because of
.BR fwd 's
extern void conf_name(scanner */*sc*/, char /*delim*/, dstr */*d*/);
extern void conf_name(scanner */*sc*/, char /*delim*/, dstr */*d*/);
+/* --- @conf_fname@ --- *
+ *
+ * Arguments: @scanner *sc@ = pointer to scanner
+ * @dstr *d@ = pointer to dynamic string for output
+ *
+ * Returns: ---
+ *
+ * Use: Reads a file name from the input and stores it in @d@.
+ */
+
+extern void conf_fname(scanner */*sc*/, dstr */*d*/);
+
/*----- Reference-counted file descriptors --------------------------------*/
typedef struct reffd {
/*----- Reference-counted file descriptors --------------------------------*/
typedef struct reffd {
dstr d = DSTR_INIT;
un_addr *ua;
dstr d = DSTR_INIT;
un_addr *ua;
- conf_name(sc, '/', &d);
ua = xmalloc(sizeof(addr) +
offsetof(struct sockaddr_un, sun_path) +
d.len + 1);
ua = xmalloc(sizeof(addr) +
offsetof(struct sockaddr_un, sun_path) +
d.len + 1);