summaryrefslogtreecommitdiff
path: root/source4/lib/util_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/util_file.c')
-rw-r--r--source4/lib/util_file.c90
1 files changed, 1 insertions, 89 deletions
diff --git a/source4/lib/util_file.c b/source4/lib/util_file.c
index 338b9547a5..156d09aaf5 100644
--- a/source4/lib/util_file.c
+++ b/source4/lib/util_file.c
@@ -22,94 +22,6 @@
#include "system/shmem.h"
#include "system/filesys.h"
-/*************************************************************************
- gets a line out of a file.
- line is of format "xxxx:xxxxxx:xxxxx:".
- lines with "#" at the front are ignored.
-*************************************************************************/
-int getfileline(void *vp, char *linebuf, int linebuf_size)
-{
- /* Static buffers we will return. */
- FILE *fp = (FILE *)vp;
- uint8_t c;
- uint8_t *p;
- size_t linebuf_len;
-
- if (fp == NULL)
- {
- DEBUG(0,("getfileline: Bad file pointer.\n"));
- return -1;
- }
-
- /*
- * Scan the file, a line at a time.
- */
- while (!feof(fp))
- {
- linebuf[0] = '\0';
-
- fgets(linebuf, linebuf_size, fp);
- if (ferror(fp))
- {
- return -1;
- }
-
- /*
- * Check if the string is terminated with a newline - if not
- * then we must keep reading and discard until we get one.
- */
-
- linebuf_len = strlen(linebuf);
- if (linebuf_len == 0)
- {
- linebuf[0] = '\0';
- return 0;
- }
-
- if (linebuf[linebuf_len - 1] != '\n')
- {
- c = '\0';
- while (!ferror(fp) && !feof(fp))
- {
- c = fgetc(fp);
- if (c == '\n')
- {
- break;
- }
- }
- }
- else
- {
- linebuf[linebuf_len - 1] = '\0';
- }
-
-#ifdef DEBUG_PASSWORD
- DEBUG(100, ("getfileline: got line |%s|\n", linebuf));
-#endif
- if ((linebuf[0] == 0) && feof(fp))
- {
- DEBUG(4, ("getfileline: end of file reached\n"));
- return 0;
- }
-
- if (linebuf[0] == '#' || linebuf[0] == '\0')
- {
- DEBUG(6, ("getfileline: skipping comment or blank line\n"));
- continue;
- }
-
- p = (uint8_t *) strchr_m(linebuf, ':');
- if (p == NULL)
- {
- DEBUG(0, ("getfileline: malformed line entry (no :)\n"));
- continue;
- }
- return linebuf_len;
- }
- return -1;
-}
-
-
/****************************************************************************
read a line from a file with possible \ continuation chars.
Blanks at the start or end of a line are stripped.
@@ -350,7 +262,7 @@ char **fd_lines_load(int fd, int *numlines, TALLOC_CTX *mem_ctx)
/****************************************************************************
-take a lislist of lines and modify them to produce a list where \ continues
+take a list of lines and modify them to produce a list where \ continues
a line
****************************************************************************/
void file_lines_slashcont(char **lines)