rtl433  UNKNOWN
RTL-433 utility
optparse.h
Go to the documentation of this file.
1 
12 #ifndef INCLUDE_OPTPARSE_H_
13 #define INCLUDE_OPTPARSE_H_
14 
15 #include <stdint.h>
16 
17 // makes strcasecmp() and strncasecmp() available when including optparse.h
18 #ifdef _MSC_VER
19  #include <string.h>
20  #define strcasecmp(s1,s2) _stricmp(s1,s2)
21  #define strncasecmp(s1,s2,n) _strnicmp(s1,s2,n)
22 #else
23  #include <strings.h>
24 #endif
25 
28 int atobv(char *arg, int def);
29 
31 int atoiv(char *arg, int def);
32 
36 char *arg_param(char *arg);
37 
43 char *hostport_param(char *param, char **host, char **port);
44 
53 uint32_t atouint32_metric(const char *str, const char *error_hint);
54 
64 int atoi_time(const char *str, const char *error_hint);
65 
71 char *asepc(char **stringp, char delim);
72 
82 char *getkwargs(char **s, char **key, char **val);
83 
88 char *trim_ws(char *str);
89 
94 char *remove_ws(char *str);
95 
96 #endif /* INCLUDE_OPTPARSE_H_ */
char * trim_ws(char *str)
Trim left and right whitespace in string.
Definition: optparse.c:261
int atoiv(char *arg, int def)
Convert string to int with fallback default.
Definition: optparse.c:27
int atobv(char *arg, int def)
Convert string to bool with fallback default.
Definition: optparse.c:18
char * remove_ws(char *str)
Remove all whitespace from string.
Definition: optparse.c:279
char * hostport_param(char *param, char **host, char **port)
Parse param string to host and port.
Definition: optparse.c:52
unsigned int uint32_t
Definition: mongoose.h:269
char * getkwargs(char **s, char **key, char **val)
Parse a comma-separated list of key/value pairs into kwargs.
Definition: optparse.c:252
char * arg_param(char *arg)
Get the next colon or comma separated arg, NULL otherwise.
Definition: optparse.c:38
char * asepc(char **stringp, char delim)
Similar to strsep.
Definition: optparse.c:242
uint32_t atouint32_metric(const char *str, const char *error_hint)
Convert a string to an unsigned integer, uses strtod() and accepts metric suffixes of &#39;k&#39;...
Definition: optparse.c:86
int atoi_time(const char *str, const char *error_hint)
Convert a string to an integer, uses strtod() and accepts time suffixes of &#39;d&#39;, &#39;h&#39;, &#39;m&#39;, and &#39;s&#39; (also &#39;D&#39;, &#39;H&#39;, &#39;M&#39;, and &#39;S&#39;), or the form hours:minutes[:seconds].
Definition: optparse.c:147