aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2004-11-06 05:18:29 +0000
committerRoger Dingledine <arma@torproject.org>2004-11-06 05:18:29 +0000
commit865f3417082e2362af3be3fab5cc41fd3e1a7299 (patch)
tree17d8ab4769d25024fc78c485a18f76a382cfae2c /src
parent6c61ed4fb5d33a8c51ff342165a26ac70765dd26 (diff)
downloadtor-865f3417082e2362af3be3fab5cc41fd3e1a7299.tar
tor-865f3417082e2362af3be3fab5cc41fd3e1a7299.tar.gz
parse_line_from_file is obsolete.
svn:r2693
Diffstat (limited to 'src')
-rw-r--r--src/common/container.c2
-rw-r--r--src/common/util.c73
-rw-r--r--src/common/util.h1
3 files changed, 2 insertions, 74 deletions
diff --git a/src/common/container.c b/src/common/container.c
index d1cafd80b..29647c449 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -313,7 +313,7 @@ char *smartlist_join_strings(smartlist_t *sl, const char *join,
/** As smartlist_join_strings2, but instead of separating/terminated with a
* NUL-terminated string <b>join</b>, uses the <b>join_len</b>-byte sequence
- * at <b>join</b>. (Useful for generating a sequenct of NUL-terminated
+ * at <b>join</b>. (Useful for generating a sequence of NUL-terminated
* strings.)
*/
char *smartlist_join_strings2(smartlist_t *sl, const char *join,
diff --git a/src/common/util.c b/src/common/util.c
index 6cc7ddd33..fbe0902ce 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -871,77 +871,6 @@ char *read_file_to_str(const char *filename, int bin) {
return string;
}
-/** read lines from f (no more than maxlen-1 bytes each) until we
- * get a non-whitespace line. If it isn't of the form "key value"
- * (value can have spaces), return -1.
- * Point *key to the first word in line, point *value * to the second.
- * Put a \0 at the end of key, remove everything at the end of value
- * that is whitespace or comment.
- * Return 1 if success, 0 if no more lines, -1 if error.
- */
-int
-parse_line_from_file(char *line, size_t maxlen, FILE *f,
- char **key_out, char **value_out) {
- char *s;
-
-try_next_line:
- if(!fgets(line, maxlen, f)) {
- if(feof(f))
- return 0;
- return -1; /* real error */
- }
- line[maxlen-1] = '\0';
-
- s = parse_line_from_str(line, key_out, value_out);
- if (!s)
- return -1;
- if (!*key_out)
- goto try_next_line;
-
- return 1;
-
-#if 0
-
- if((s = strchr(line,'#'))) /* strip comments */
- *s = 0; /* stop the line there */
-
- /* remove end whitespace */
- s = strchr(line, 0); /* now we're at the null */
- do {
- *s = 0;
- s--;
- } while (s >= line && isspace((int)*s));
-
- key = line;
- while(isspace((int)*key))
- key++;
- if(*key == 0)
- goto try_next_line; /* this line has nothing on it */
- end = key;
- while(*end && !isspace((int)*end))
- end++;
- value = end;
- while(*value && isspace((int)*value))
- value++;
-
-#if 0
- if(!*end || !*value) { /* only a key on this line. no value. */
- *end = 0;
- log_fn(LOG_WARN,"Line has keyword '%s' but no value. Failing.",key);
- return -1;
- }
-#endif
- *end = 0; /* null it out */
-
- tor_assert(key);
- tor_assert(value);
- log_fn(LOG_DEBUG,"got keyword '%s', value '%s'", key, value);
- *key_out = key, *value_out = value;
- return 1;
-#endif
-}
-
-
/** DOCDOC.
*
* Return next line or end of string on success, NULL on failure.
@@ -1149,7 +1078,7 @@ parse_addr_port(const char *addrport, char **address, uint32_t *addr,
tor_free(_address);
}
if (port)
- *port = ok ? ((uint16_t) _port) : 0;
+ *port = ok ? ((uint16_t) _port) : 0;
return ok ? 0 : -1;
}
diff --git a/src/common/util.h b/src/common/util.h
index 128eeaf7b..c925834da 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -93,7 +93,6 @@ int write_str_to_file(const char *fname, const char *str, int bin);
int write_bytes_to_file(const char *fname, const char *str, size_t len,
int bin);
char *read_file_to_str(const char *filename, int bin);
-int parse_line_from_file(char *line, size_t maxlen, FILE *f, char **key_out, char **value_out);
char *parse_line_from_str(char *line, char **key_out, char **value_out);
char *expand_filename(const char *filename);