cctools
stringtools.h
1 /*
2 Copyright (C) 2003-2004 Douglas Thain and the University of Wisconsin
3 Copyright (C) 2005- The University of Notre Dame
4 This software is distributed under the GNU General Public License.
5 See the file COPYING for details.
6 */
7 
8 #ifndef STRINGTOOLS_H
9 #define STRINGTOOLS_H
10 
11 #include <stdint.h>
12 #include <stdlib.h>
13 #include <time.h>
14 #include <stdarg.h>
15 
16 typedef char *(*string_subst_lookup_t) (const char *name, void *arg);
17 
21 int string_compare(const void *p1, const void *p2);
22 
30 char *string_escape_shell (const char *str);
31 
39 char *string_quote_shell (const char *str);
40 
47 char *string_escape_condor( const char *str);
48 void string_chomp(char *str);
49 int whole_string_match_regex(const char *text, const char *pattern);
50 int string_match_regex(const char *text, const char *pattern);
51 int string_match(const char *pattern, const char *text);
52 char *string_front(const char *str, int max);
53 const char *string_back(const char *str, int max);
54 char *string_metric(double value, int power_needed, char *buffer);
55 int64_t string_metric_parse(const char *str);
56 time_t string_time_parse(const char *str);
57 int string_split(char *str, int *argc, char ***argv);
58 int string_split_quotes(char *str, int *argc, char ***argv);
59 char *string_pad_right(char *str, unsigned int length);
60 char *string_pad_left(char *str, int length);
61 void string_cookie(char *str, int length);
62 char *string_subst(char *value, string_subst_lookup_t lookup, void *arg);
63 int string_prefix_is(const char *string, const char *prefix);
64 int string_suffix_is(const char *string, const char *suffix);
65 
72 char *string_combine(char *first, const char *second);
73 char *string_combine_multi(char *first, ...);
74 char *string_signal(int sig);
75 void string_tolower(char *str);
76 void string_toupper(char *str);
77 int string_isspace(const char *str);
78 int string_is_integer(const char *str, long long *integer_value );
79 int string_is_float(const char *str, double *double_value );
80 void string_replace_backslash_codes(const char *instr, char *outstr);
81 
92 char *string_replace_percents( const char *str, const char *replace );
93 int string_equal(const char *str1, const char *str2);
94 
95 int strpos(const char *str, char c);
96 int strrpos(const char *str, char c);
97 int getDateString(char *str);
98 int string_null_or_empty(const char *str);
99 
105 char *string_format (const char *fmt, ...)
106 __attribute__ (( format(printf,1,2) ));
107 
115 int string_nformat(char *str, const size_t max, const char *fmt, ...);
116 
117 char *string_trim(char *s, int(func)(int));
118 char *string_trim_spaces(char *s);
119 char *string_trim_quotes(char *s);
120 
126 int string_istrue(const char *str);
127 
143 char * string_wrap_command( const char *command, const char *wrapper_command );
144 
145 
146 #ifndef CCTOOLS_OPSYS_LINUX
147 char *strsep(char **stringp, const char *delim);
148 #endif
149 
150 char *strnchr (const char *s, int c);
151 
152 #endif
Definition: buffer.h:26