86 |
|
|
87 |
char msg[1024]; |
char msg[1024]; |
88 |
va_list ap; |
va_list ap; |
89 |
|
|
90 |
|
ASSERT(format); |
91 |
|
|
92 |
va_start(ap,format); |
va_start(ap,format); |
93 |
vsnprintf(msg, 1024, format, ap); |
vsnprintf(msg, 1024, format, ap); |
125 |
*/ |
*/ |
126 |
char *stripfilename(char* path) { |
char *stripfilename(char* path) { |
127 |
|
|
128 |
char *fname= strrchr(path, '/'); |
char *fname; |
129 |
|
|
130 |
|
ASSERT(path); |
131 |
|
|
132 |
|
fname= strrchr(path, '/'); |
133 |
|
|
134 |
return (fname ? ++fname : path); |
return (fname ? ++fname : path); |
135 |
|
|
144 |
|
|
145 |
char *p; |
char *p; |
146 |
|
|
147 |
|
ASSERT(chomp); |
148 |
|
|
149 |
if ((p= strchr(string, '\r')) || |
if ((p= strchr(string, '\r')) || |
150 |
(p= strchr(string, '\n'))) { |
(p= strchr(string, '\n'))) { |
151 |
|
|
162 |
* @return s with leading and trailing spaces removed |
* @return s with leading and trailing spaces removed |
163 |
*/ |
*/ |
164 |
char *trim(char *s) { |
char *trim(char *s) { |
165 |
|
|
166 |
|
ASSERT(s); |
167 |
|
|
168 |
ltrim(s); |
ltrim(s); |
169 |
rtrim(s); |
rtrim(s); |
182 |
|
|
183 |
char *t= s; |
char *t= s; |
184 |
|
|
185 |
|
ASSERT(s); |
186 |
|
|
187 |
while (*t==' ' || *t=='\t' || *t=='\r' || *t=='\n') t++; |
while (*t==' ' || *t=='\t' || *t=='\r' || *t=='\n') t++; |
188 |
|
|
189 |
return strcpy(s, t); |
return strcpy(s, t); |
200 |
|
|
201 |
char *t= s; |
char *t= s; |
202 |
|
|
203 |
|
ASSERT(s); |
204 |
|
|
205 |
while (*s) s++; |
while (*s) s++; |
206 |
while (*--s==' ' || *s=='\t' || *s=='\r' || *s=='\n') *s= '\0'; |
while (*--s==' ' || *s=='\t' || *s=='\r' || *s=='\n') *s= '\0'; |
207 |
|
|
221 |
char *t= s; |
char *t= s; |
222 |
char tmp=0; |
char tmp=0; |
223 |
|
|
224 |
|
ASSERT(s); |
225 |
|
|
226 |
while (*t==39 || *t==34 ) { |
while (*t==39 || *t==34 ) { |
227 |
|
|
228 |
tmp=*t; |
tmp=*t; |
269 |
int editpos; |
int editpos; |
270 |
int insertpos; |
int insertpos; |
271 |
|
|
272 |
|
ASSERT(buf); |
273 |
|
|
274 |
for(editpos=insertpos=0; *(buf+editpos)!='\0'; editpos++, insertpos++) { |
for(editpos=insertpos=0; *(buf+editpos)!='\0'; editpos++, insertpos++) { |
275 |
|
|
276 |
if(*(buf+editpos) == '\\' ) { |
if(*(buf+editpos) == '\\' ) { |
327 |
|
|
328 |
Process_T p; |
Process_T p; |
329 |
|
|
330 |
|
ASSERT(name); |
331 |
|
|
332 |
for (p= processlist; p; p= p->next) |
for (p= processlist; p; p= p->next) |
333 |
if (is(p->name, name)) return p; |
if (is(p->name, name)) return p; |
334 |
|
|
346 |
|
|
347 |
Process_T p; |
Process_T p; |
348 |
|
|
349 |
|
ASSERT(name); |
350 |
|
|
351 |
for (p= processlist; p; p= p->next) |
for (p= processlist; p; p= p->next) |
352 |
if (is(p->name, name)) return TRUE; |
if (is(p->name, name)) return TRUE; |
353 |
|
|
617 |
FILE *file= NULL; |
FILE *file= NULL; |
618 |
int pid= -1; |
int pid= -1; |
619 |
|
|
620 |
|
ASSERT(pidfile); |
621 |
|
|
622 |
if (! exist_file(pidfile)) { |
if (! exist_file(pidfile)) { |
623 |
|
|
624 |
return(FALSE); |
return(FALSE); |
750 |
*/ |
*/ |
751 |
char *get_process_uptime(char *pidfile) { |
char *get_process_uptime(char *pidfile) { |
752 |
|
|
753 |
time_t ctime= (pidfile?file_changedtime(pidfile):0); |
time_t ctime; |
754 |
|
|
755 |
|
ASSERT(pidfile); |
756 |
|
|
757 |
|
ctime = (pidfile?file_changedtime(pidfile):0); |
758 |
|
|
759 |
if(ctime) { |
if(ctime) { |
760 |
|
|
761 |
time_t now= time(&now); |
time_t now= time(&now); |
817 |
*/ |
*/ |
818 |
int set_md5sum(char **dest, char *file) { |
int set_md5sum(char **dest, char *file) { |
819 |
|
|
820 |
|
ASSERT(dest); |
821 |
|
ASSERT(*dest); |
822 |
|
ASSERT(file); |
823 |
|
|
824 |
if (! (*dest= get_md5sum(file))) { |
if (! (*dest= get_md5sum(file))) { |
825 |
|
|
826 |
return FALSE; |
return FALSE; |
837 |
*/ |
*/ |
838 |
char *get_md5sum(char *file) { |
char *get_md5sum(char *file) { |
839 |
|
|
840 |
|
ASSERT(file); |
841 |
|
|
842 |
if (isreg_file(file)) { |
if (isreg_file(file)) { |
843 |
|
|
844 |
FILE *f= fopen(file, "r"); |
FILE *f= fopen(file, "r"); |
886 |
*/ |
*/ |
887 |
int check_md5(char *file, char *sum) { |
int check_md5(char *file, char *sum) { |
888 |
|
|
889 |
char *newSum= get_md5sum(file); |
char *newSum; |
890 |
|
|
891 |
|
ASSERT(file); |
892 |
|
ASSERT(sum); |
893 |
|
|
894 |
|
newSum= get_md5sum(file); |
895 |
|
|
896 |
if (newSum) { |
if (newSum) { |
897 |
|
|
898 |
int rv; |
int rv; |
921 |
register int x, y; |
register int x, y; |
922 |
unsigned char *str; |
unsigned char *str; |
923 |
|
|
924 |
|
ASSERT(uri); |
925 |
|
|
926 |
str= (unsigned char *)xmalloc(3 * strlen(uri) + 1); |
str= (unsigned char *)xmalloc(3 * strlen(uri) + 1); |
927 |
|
|
928 |
for (x = 0, y = 0; uri[x]; x++, y++) { |
for (x = 0, y = 0; uri[x]; x++, y++) { |
980 |
int n; |
int n; |
981 |
int size= STRLEN; |
int size= STRLEN; |
982 |
char *buf= xmalloc(size); |
char *buf= xmalloc(size); |
983 |
|
|
984 |
|
ASSERT(s); |
985 |
|
|
986 |
while(TRUE) { |
while(TRUE) { |
987 |
|
|
1038 |
|
|
1039 |
int i; |
int i; |
1040 |
static unsigned char unsafe[]= "<>\"#{}|\\^~[]`"; |
static unsigned char unsafe[]= "<>\"#{}|\\^~[]`"; |
1041 |
|
|
1042 |
|
ASSERT(c); |
1043 |
|
|
1044 |
if(33>*c || *c>176) |
if(33>*c || *c>176) |
1045 |
return TRUE; |
return TRUE; |