diff options
author | Andrew Tridgell <tridge@samba.org> | 2000-04-16 11:17:19 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2000-04-16 11:17:19 +0000 |
commit | 8d7e498db160f9a366400fc1c55dacbcffaf4196 (patch) | |
tree | 9db7c7c562d4694b9e03af5d1e86d933e0084f6a /source3/lib | |
parent | 19f946ba6fe442544ac9b0f71bcd33112fc79995 (diff) | |
download | samba-8d7e498db160f9a366400fc1c55dacbcffaf4196.tar.gz samba-8d7e498db160f9a366400fc1c55dacbcffaf4196.tar.bz2 samba-8d7e498db160f9a366400fc1c55dacbcffaf4196.zip |
converted a couple more functions to use a fd instead of a FILE*
added a new utility fn file_lines_slashcont() which is used to handle
files that treat a \ followed by a newline as a blank
(This used to be commit 384ecd9d66ccd31ee85000c0ca55d413d8f2cc53)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_file.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/source3/lib/util_file.c b/source3/lib/util_file.c index 1ef713b105..f3e2879587 100644 --- a/source3/lib/util_file.c +++ b/source3/lib/util_file.c @@ -473,3 +473,26 @@ void file_lines_free(char **lines) free(lines); } + +/**************************************************************************** +take a lislist of lines and modify them to produce a list where \ continues +a line +****************************************************************************/ +void file_lines_slashcont(char **lines) +{ + int i, j; + + for (i=0; lines[i];) { + int len = strlen(lines[i]); + if (lines[i][len-1] == '\\') { + lines[i][len-1] = ' '; + if (lines[i+1]) { + char *p = &lines[i][len]; + while (p < lines[i+1]) *p++ = ' '; + for (j = i+1; lines[j]; j++) lines[j] = lines[j+1]; + } + } else { + i++; + } + } +} |