19 |
|
|
20 |
#include <config.h> |
#include <config.h> |
21 |
|
|
22 |
|
#ifdef HAVE_STDIO_H |
23 |
#include <stdio.h> |
#include <stdio.h> |
24 |
|
#endif |
25 |
|
|
26 |
|
#ifdef HAVE_STDARG_H |
27 |
#include <stdarg.h> |
#include <stdarg.h> |
28 |
|
#endif |
29 |
|
|
30 |
|
#ifdef HAVE_ERRNO_H |
31 |
#include <errno.h> |
#include <errno.h> |
32 |
|
#endif |
33 |
|
|
34 |
|
#ifdef HAVE_CTYPE_H |
35 |
#include <ctype.h> |
#include <ctype.h> |
36 |
|
#endif |
37 |
|
|
38 |
|
#ifdef HAVE_SIGNAL_H |
39 |
#include <signal.h> |
#include <signal.h> |
40 |
#include <time.h> |
#endif |
41 |
|
|
42 |
|
#if TIME_WITH_SYS_TIME |
43 |
|
# include <sys/time.h> |
44 |
|
# include <time.h> |
45 |
|
#else |
46 |
|
# if HAVE_SYS_TIME_H |
47 |
|
# include <sys/time.h> |
48 |
|
# else |
49 |
|
# include <time.h> |
50 |
|
# endif |
51 |
|
#endif |
52 |
|
|
53 |
|
#ifdef HAVE_STDLIB_H |
54 |
#include <stdlib.h> |
#include <stdlib.h> |
55 |
|
#endif |
56 |
|
|
57 |
|
#ifdef HAVE_SYS_SOCKET_H |
58 |
#include <sys/socket.h> |
#include <sys/socket.h> |
59 |
|
#endif |
60 |
|
|
61 |
|
#ifdef HAVE_FCNTL_H |
62 |
#include <fcntl.h> |
#include <fcntl.h> |
63 |
|
#endif |
64 |
|
|
65 |
#ifdef HAVE_UNISTD_H |
#ifdef HAVE_UNISTD_H |
66 |
#include <unistd.h> |
#include <unistd.h> |
953 |
char *p= buf; |
char *p= buf; |
954 |
|
|
955 |
*buf= 0; |
*buf= 0; |
956 |
|
|
957 |
if((rest_d= delta/day)>0) { |
if((rest_d= delta/day)>0) { |
958 |
p+= sprintf(p, "%ldd ", rest_d); |
p+= snprintf(p, STRLEN-(p-buf), "%ldd ", rest_d); |
959 |
delta-= rest_d*day; |
delta-= rest_d*day; |
960 |
} |
} |
961 |
if((rest_h= delta/hour)>0 || (rest_d > 0)) { |
if((rest_h= delta/hour)>0 || (rest_d > 0)) { |
962 |
p+= sprintf(p, "%ldh ", rest_h); |
p+= snprintf(p, STRLEN-(p-buf),"%ldh ", rest_h); |
963 |
delta-= rest_h*hour; |
delta-= rest_h*hour; |
964 |
} |
} |
965 |
|
|
966 |
rest_m= delta/min; |
rest_m= delta/min; |
967 |
p+= sprintf(p, "%ldm ", rest_m); |
p+= snprintf(p, STRLEN-(p-buf),"%ldm ", rest_m); |
968 |
delta-= rest_m*min; |
delta-= rest_m*min; |
969 |
|
|
970 |
return xstrdup(buf); |
return xstrdup(buf); |
989 |
unsigned char md5buf[16]; |
unsigned char md5buf[16]; |
990 |
char result[STRLEN]; |
char result[STRLEN]; |
991 |
char *r= result; |
char *r= result; |
992 |
|
|
993 |
|
*result=0; |
994 |
|
|
995 |
if(md5_stream(f, md5buf)) { |
if(md5_stream(f, md5buf)) { |
996 |
|
|
1003 |
fclose(f); |
fclose(f); |
1004 |
|
|
1005 |
for(i= 0; i < 16; ++i) |
for(i= 0; i < 16; ++i) |
1006 |
r+= sprintf(r, "%02x", md5buf[i]); |
r+= snprintf(r, STRLEN-(r-result) ,"%02x", md5buf[i]); |
1007 |
|
|
1008 |
return (xstrdup(result)); |
return (xstrdup(result)); |
1009 |
|
|