cleaned up string functions

This commit is contained in:
Olof hagsand 2017-04-04 17:11:21 +02:00
parent 75e1ea7c1c
commit 236b661e43
18 changed files with 245 additions and 427 deletions

View file

@ -42,8 +42,11 @@
* Types
*/
enum format_enum{
MSG_NOTIFY_TXT, /* means filter works on strings */
MSG_NOTIFY_XML, /* means filter works on xml */
FORMAT_XML,
FORMAT_JSON,
FORMAT_TEXT,
FORMAT_CLI,
FORMAT_NETCONF
};
/* Protocol message header */
@ -55,6 +58,9 @@ struct clicon_msg {
/*
* Prototypes
*/
char *format_int2str(enum format_enum showas);
enum format_enum format_str2int(char *str);
struct clicon_msg *clicon_msg_encode(char *format, ...);
int clicon_msg_decode(struct clicon_msg *msg, cxobj **xml);

View file

@ -54,17 +54,10 @@ static inline char * strdup4(char *str)
/*
* Prototypes
*/
char **clicon_sepsplit (char *string, char *delim, int *nvec, const char *label);
char **clicon_strsplit (char *string, char *delim, int *nvec, const char *label);
char **clicon_strsep(char *string, char *delim, int *nvec0);
char *clicon_strjoin (int argc, char **argv, char *delim, const char *label);
char *clicon_strtrim(char *str, const char *label);
int clicon_sep(char *s, const char sep[2], const char *label, char**a0, char **b0);
char *clicon_strjoin (int argc, char **argv, char *delim);
#ifndef HAVE_STRNDUP
char *clicon_strndup (const char *, size_t);
#endif /* ! HAVE_STRNDUP */
int clicon_strmatch(const char *str, const char *regexp, char **match);
char *clicon_strsub(char *str, char *from, char *to);
#endif /* _CLIXON_STRING_H_ */