diff options
author | Theodore Ts'o <tytso@mit.edu> | 2003-01-22 19:55:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2003-01-22 19:55:59 -0500 |
commit | 76ea3a2c7fc1b6ff03d566af66c971dbf867be45 (patch) | |
tree | b2bfea10a507ed2a156c6921d408eb4ac0c91688 /misc/fsck.c | |
parent | 23b7c8b88673248b1f93abc717943867ad037bb4 (diff) | |
download | e2fsprogs-76ea3a2c7fc1b6ff03d566af66c971dbf867be45.tar.gz |
fsck.c (parse_fstab_line, parse_escape): Add support for
backslash escaping in /etc/fstab. (i.e., so that \040
will work.)
Diffstat (limited to 'misc/fsck.c')
-rw-r--r-- | misc/fsck.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/misc/fsck.c b/misc/fsck.c index ac54d2e4..c6df8451 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -153,6 +153,41 @@ static char *parse_word(char **buf) return word; } +static void parse_escape(char *word) +{ + char *p, *q; + int ac, i; + + for (p = word, q = word; *p; p++, q++) { + *q = *p; + if (*p != '\\') + continue; + if (*++p == 0) + break; + if (*p == 't') { + *q = '\t'; + continue; + } + if (*p == 'n') { + *q = '\n'; + continue; + } + if (!isdigit(*p)) { + *q = *p; + continue; + } + ac = 0; + for (i = 0; i < 3; i++, p++) { + if (!isdigit(*p)) + break; + ac = (ac * 8) + (*p - '0'); + } + *q = ac; + p--; + } + *q = 0; +} + static void free_instance(struct fsck_instance *i) { if (i->prog) @@ -183,6 +218,13 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) freq = parse_word(&cp); passno = parse_word(&cp); + parse_escape(device); + parse_escape(mntpnt); + parse_escape(type); + parse_escape(opts); + parse_escape(freq); + parse_escape(passno); + if (!device) return 0; /* Allow blank lines */ |