mirror of
https://github.com/tmux/tmux.git
synced 2025-01-12 03:08:46 +00:00
Allow comments at EOL; count blank lines properly.
This commit is contained in:
parent
8731755ab4
commit
48490b14da
17
cfg.c
17
cfg.c
@ -1,4 +1,4 @@
|
||||
/* $Id: cfg.c,v 1.5 2008-06-02 21:36:51 nicm Exp $ */
|
||||
/* $Id: cfg.c,v 1.6 2008-06-02 22:16:27 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2008 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -76,12 +76,6 @@ load_cfg(const char *path, char **causep)
|
||||
line = 0;
|
||||
while ((ch = getc(f)) != EOF) {
|
||||
switch (ch) {
|
||||
case '#':
|
||||
/* Comment: discard until EOL. */
|
||||
while ((ch = getc(f)) != '\n' && ch != EOF)
|
||||
;
|
||||
line++;
|
||||
break;
|
||||
case '\'':
|
||||
if ((s = cfg_string(f, '\'', 0)) == NULL)
|
||||
goto error;
|
||||
@ -94,6 +88,11 @@ load_cfg(const char *path, char **causep)
|
||||
argv = xrealloc(argv, argc + 1, sizeof (char *));
|
||||
argv[argc++] = s;
|
||||
break;
|
||||
case '#':
|
||||
/* Comment: discard until EOL. */
|
||||
while ((ch = getc(f)) != '\n' && ch != EOF)
|
||||
;
|
||||
/* FALLTHROUGH */
|
||||
case '\n':
|
||||
case EOF:
|
||||
case ' ':
|
||||
@ -109,9 +108,11 @@ load_cfg(const char *path, char **causep)
|
||||
len = 0;
|
||||
}
|
||||
|
||||
if ((ch != '\n' && ch != EOF) || argc == 0)
|
||||
if (ch != '\n' && ch != EOF)
|
||||
break;
|
||||
line++;
|
||||
if (argc == 0)
|
||||
break;
|
||||
|
||||
if ((cmd = cmd_parse(argc, argv, &cause)) == NULL)
|
||||
goto error;
|
||||
|
Loading…
Reference in New Issue
Block a user