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 
57 int string_escape_chars( const char *s, char *t, const char *specials, int length );
58 
59 
60 void string_chomp(char *str);
61 int whole_string_match_regex(const char *text, const char *pattern);
62 int string_match_regex(const char *text, const char *pattern);
63 int string_match(const char *pattern, const char *text);
64 char *string_front(const char *str, int max);
65 const char *string_back(const char *str, int max);
66 char *string_metric(double value, int power_needed, char *buffer);
67 int64_t string_metric_parse(const char *str);
68 time_t string_time_parse(const char *str);
69 int string_split(char *str, int *argc, char ***argv);
70 int string_split_quotes(char *str, int *argc, char ***argv);
71 char *string_pad_right(char *str, unsigned int length);
72 char *string_pad_left(char *str, int length);
73 void string_cookie(char *str, int length);
74 char *string_subst(char *value, string_subst_lookup_t lookup, void *arg);
75 int string_prefix_is(const char *string, const char *prefix);
76 int string_suffix_is(const char *string, const char *suffix);
77 
84 char *string_combine(char *first, const char *second);
85 char *string_combine_multi(char *first, ...);
86 char *string_signal(int sig);
87 void string_tolower(char *str);
88 void string_toupper(char *str);
89 int string_isspace(const char *str);
90 int string_is_integer(const char *str, long long *integer_value );
91 int string_is_float(const char *str, double *double_value );
92 void string_replace_backslash_codes(const char *instr, char *outstr);
93 
104 char *string_replace_percents( const char *str, const char *replace );
105 int string_equal(const char *str1, const char *str2);
106 
107 int strpos(const char *str, char c);
108 int strrpos(const char *str, char c);
109 int getDateString(char *str);
110 int string_null_or_empty(const char *str);
111 
117 char *string_format (const char *fmt, ...)
118 __attribute__ (( format(printf,1,2) ));
119 
127 int string_nformat(char *str, const size_t max, const char *fmt, ...);
128 
129 char *string_trim(char *s, int(func)(int));
130 char *string_trim_spaces(char *s);
131 char *string_trim_quotes(char *s);
132 
138 int string_istrue(const char *str);
139 
155 char * string_wrap_command( const char *command, const char *wrapper_command );
156 
157 
158 #ifndef CCTOOLS_OPSYS_LINUX
159 char *strsep(char **stringp, const char *delim);
160 #endif
161 
162 char *strnchr (const char *s, int c);
163 
164 #endif
Definition: buffer.h:26