diff options
author | Roger Dingledine <arma@torproject.org> | 2008-10-01 03:41:33 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-10-01 03:41:33 +0000 |
commit | c7af43a62497fb3e10c8de9a5bb8cc8113efb99c (patch) | |
tree | 847f11b6f733a3aa4af359b8d77b56f359327bc2 /src/common/container.c | |
parent | 914086628776bf915f7359a6486427c74391134a (diff) | |
download | tor-c7af43a62497fb3e10c8de9a5bb8cc8113efb99c.tar.gz tor-c7af43a62497fb3e10c8de9a5bb8cc8113efb99c.zip |
Now NodeFamily and MyFamily config options allow spaces in
identity fingerprints, so it's easier to paste them in.
Suggested by Lucky Green.
svn:r17021
Diffstat (limited to 'src/common/container.c')
-rw-r--r-- | src/common/container.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/common/container.c b/src/common/container.c index 8021bd19c3..060615d1c3 100644 --- a/src/common/container.c +++ b/src/common/container.c @@ -324,12 +324,17 @@ smartlist_insert(smartlist_t *sl, int idx, void *val) /** * Split a string <b>str</b> along all occurrences of <b>sep</b>, - * adding the split strings, in order, to <b>sl</b>. If - * <b>flags</b>&SPLIT_SKIP_SPACE is true, remove initial and - * trailing space from each entry. If - * <b>flags</b>&SPLIT_IGNORE_BLANK is true, remove any entries of - * length 0. If max>0, divide the string into no more than <b>max</b> - * pieces. If <b>sep</b> is NULL, split on any sequence of horizontal space. + * adding the split strings, in order, to <b>sl</b>. + * + * If <b>flags</b>&SPLIT_SKIP_SPACE is true, remove initial and + * trailing space from each entry. + * If <b>flags</b>&SPLIT_IGNORE_BLANK is true, remove any entries + * of length 0. + * If <b>flags</b>&SPLIT_STRIP_SPACE is true, strip spaces from each + * split string. + * + * If max>0, divide the string into no more than <b>max</b> pieces. If + * <b>sep</b> is NULL, split on any sequence of horizontal space. */ int smartlist_split_string(smartlist_t *sl, const char *str, const char *sep, @@ -375,7 +380,10 @@ smartlist_split_string(smartlist_t *sl, const char *str, const char *sep, --end; } if (end != cp || !(flags&SPLIT_IGNORE_BLANK)) { - smartlist_add(sl, tor_strndup(cp, end-cp)); + char *string = tor_strndup(cp, end-cp); + if (flags&SPLIT_STRIP_SPACE) + tor_strstrip(string, " "); + smartlist_add(sl, string); ++n; } if (!next) |