Changeset 825 in openpam
- Timestamp:
- Oct 18, 2014, 10:38:31 PM (7 years ago)
- Location:
- branches/nooath
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/nooath
-
branches/nooath/lib/libpam/openpam_readword.c
r648 r825 56 56 char *word; 57 57 size_t size, len; 58 int ch, comment,escape, quote;58 int ch, escape, quote; 59 59 int serrno; 60 60 … … 62 62 63 63 /* skip initial whitespace */ 64 comment = 0; 65 while ((ch = getc(f)) != EOF && ch != '\n') { 66 if (ch == '#') 67 comment = 1; 68 if (!is_lws(ch) && !comment) 64 escape = quote = 0; 65 while ((ch = getc(f)) != EOF) { 66 if (ch == '\n') { 67 /* either EOL or line continuation */ 68 if (!escape) 69 break; 70 if (lineno != NULL) 71 ++*lineno; 72 escape = 0; 73 } else if (escape) { 74 /* escaped something else */ 69 75 break; 76 } else if (ch == '#') { 77 /* comment: until EOL, no continuation */ 78 while ((ch = getc(f)) != EOF) 79 if (ch == '\n') 80 break; 81 break; 82 } else if (ch == '\\') { 83 escape = 1; 84 } else if (!is_ws(ch)) { 85 break; 86 } 70 87 } 71 88 if (ch == EOF) … … 77 94 word = NULL; 78 95 size = len = 0; 79 escape = quote = 0;80 96 while ((ch = fgetc(f)) != EOF && (!is_ws(ch) || quote || escape)) { 81 97 if (ch == '\\' && !escape && quote != '\'') { … … 91 107 /* end quote */ 92 108 quote = 0; 93 } else if (ch == '\n' && escape && quote != '\'') {109 } else if (ch == '\n' && escape) { 94 110 /* line continuation */ 95 111 escape = 0;
Note: See TracChangeset
for help on using the changeset viewer.