Tor  0.4.7.0-alpha-dev
Functions
smartlist_split.c File Reference

Split a string into a smartlist_t of substrings. More...

#include "lib/smartlist_core/smartlist_core.h"
#include "lib/smartlist_core/smartlist_split.h"
#include "lib/err/torerr.h"
#include "lib/string/util_string.h"
#include "lib/string/compat_ctype.h"
#include "lib/malloc/malloc.h"
#include <string.h>

Go to the source code of this file.

Functions

int smartlist_split_string (smartlist_t *sl, const char *str, const char *sep, int flags, int max)
 

Detailed Description

Split a string into a smartlist_t of substrings.

Definition in file smartlist_split.c.

Function Documentation

◆ smartlist_split_string()

int smartlist_split_string ( smartlist_t sl,
const char *  str,
const char *  sep,
int  flags,
int  max 
)

Split a string str along all occurrences of sep, appending the (newly allocated) split strings, in order, to sl. Return the number of strings added to sl.

If flags&SPLIT_SKIP_SPACE is true, remove initial and trailing space from each entry. If flags&SPLIT_IGNORE_BLANK is true, remove any entries of length 0. If flags&SPLIT_STRIP_SPACE is true, strip spaces from each split string.

If max>0, divide the string into no more than max pieces. If sep is NULL, split on any sequence of horizontal space.

Definition at line 37 of file smartlist_split.c.

Referenced by add_onion_helper_keyarg(), config_register_addressmaps(), decode_auth_type(), decode_create2_list(), decode_intro_points(), dir_split_resource_into_fingerprint_pairs(), disk_state_parse_srv(), format_recommended_version_list(), get_bindaddr_from_transport_listen_line(), get_options_from_transport_options_line(), get_transport_in_state_by_name(), hs_parse_port_config(), metrics_parse_ports(), nodefamily_canonicalize(), normalize_nickname_list(), parse_addr_policy(), parse_auth_file_content(), parse_authorized_client(), parse_dir_fallback_line(), parse_from_state_set_vals(), parse_private_key_from_control_port(), parse_tcp_proxy_line(), routerset_parse(), state_transport_line_is_valid(), string_is_valid_nonrfc_hostname(), and tor_inet_aton().