[Libsysio-commit] HEAD: libsysio/src init.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2006-01-18 00:48:01
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11788 Modified Files: init.c Log Message: Add comments to init files; From Cray. A hash, '#', symbol begins a comment that reads to the end of the line. Since the init configuration language is not line-based, though, this is dangerous. Just be *real* careful to terminate with a newline. Also, this only works *outside* a specification -- The '{' to '}' groupings. Used inside, it's a parsed character and would almost certainly err. Unfortunately, the precedent is set and it's too difficult to back out now. Beware! Index: init.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/init.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -w -b -B -p -r1.24 -r1.25 --- init.c 18 Sep 2005 17:44:45 -0000 1.24 +++ init.c 18 Jan 2006 00:47:41 -0000 1.25 @@ -128,6 +128,12 @@ void *_sysio_exit_trace_q = &_sysio_exit #endif /* + * In sysio_init we'll allow simple comments, strings outside {} + * delimited by COMMENT_INTRO, and '\n' or '\0' + */ +#define COMMENT_INTRO '#' + +/* * Sysio library initialization. Must be called before anything else in the * library. */ @@ -958,6 +964,16 @@ _sysio_boot_namespace(const char *arg) while ((c = *arg) != '\0' && !(c == '{' || strchr(IGNORE_WHITE, c) == NULL)) arg++; + if (COMMENT_INTRO == c) { + /* + * Discard comment. + */ + while (*arg && (*arg != '\n')) { + ++arg; + } + continue; + } + if (c == '\0') break; if (c != '{') { |