X-Git-Url: https://git.distorted.org.uk/~mdw/fwd/blobdiff_plain/206212ca161b23aece16795f0b4e61a133ba7a6a..e9940d072c811c67f2b3a13782fc40bf591491b7:/file.c diff --git a/file.c b/file.c index 914edd8..88b7666 100644 --- a/file.c +++ b/file.c @@ -7,52 +7,24 @@ /*----- Licensing notice --------------------------------------------------* * - * This file is part of the `fw' port forwarder. + * This file is part of the `fwd' port forwarder. * - * `fw' is free software; you can redistribute it and/or modify + * `fwd' 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 * (at your option) any later version. * - * `fw' is distributed in the hope that it will be useful, + * `fwd' is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with `fw'; if not, write to the Free Software Foundation, + * along with `fwd'; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*----- Header files ------------------------------------------------------*/ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "conf.h" -#include "endpt.h" -#include "fattr.h" -#include "file.h" -#include "fw.h" -#include "reffd.h" -#include "scan.h" -#include "source.h" -#include "target.h" +#include "fwd.h" /*----- Data structures ---------------------------------------------------*/ @@ -258,7 +230,7 @@ static void file_fspec(fspec *f, scanner *sc) error(sc, "parse error, expected file descriptor"); } else { dstr d = DSTR_INIT; - conf_name(sc, '/', &d); + conf_fname(sc, &d); f->type = FTYPE_NAME; f->u.name = xstrdup(d.buf); dstr_destroy(&d); @@ -270,13 +242,15 @@ static void file_fspec(fspec *f, scanner *sc) static void file_read(fdata *f, scanner *sc) { file_fspec(&f->in, sc); - if (sc->t != ',') { + if (sc->t == ',') { + token(sc); + file_fspec(&f->out, sc); + } else { f->out = f->in; if (f->out.type == FTYPE_FD && f->out.u.fd == rstdin) f->out.u.fd = rstdout; - } else { - token(sc); - file_fspec(&f->out, sc); + else if (f->out.type == FTYPE_NAME) + f->out.u.name = xstrdup(f->in.u.name); } f->fa = fattr_global; f->fo = file_opts; @@ -516,7 +490,7 @@ static void fsource_attach(source *s, scanner *sc, target *t) ee->ops->close(ee); goto tidy; } - endpt_join(e, ee); + endpt_join(e, ee, fs->s.desc); /* --- Dispose of the source and target now --- */