1 2 /* 3 * (c); Oleg Puchinin 2006 4 * graycardinalster@gmail.com 5 * 6 */ 7 8 #ifndef DEFINE_GCLIBC_H 9 #define DEFINE_GCLIBC_H 10 11 #include <stdio.h> 12 #include <stdlib.h> 13 #include <unistd.h> 14 #include <string.h> 15 #include <stdint.h> 16 #include <netinet/in.h> 17 #include <arpa/inet.h> 18 #include <sys/poll.h> 19 20 #include "djob_t.h" 21 #include "dexec.h" 22 23 void print_the_time (FILE * file_my); 24 int close_pipe (int *fds); 25 void Dfastsort_s(char ** a, long N); 26 void Dtimer (); 27 struct timeval *the_time (); 28 int Dterm_one_kick (int fd); 29 char *Dversion (); 30 int Dfnwrite (char * p_lpsz_filename, void * p_lp_buffer,int int_size); 31 int Dfnread (char * f_name, void * p_lp_buffer, int int_size); 32 int Dselect (int FILENO, int SEC, int USEC); 33 char * DFILE (const char * m_filename, int *rsize); 34 struct stat * DSTAT (const char * S); 35 struct stat * DLSTAT (const char * S); 36 int DIONREAD (int fd); 37 int fsize (const char * S); 38 int fdsize (int fd); 39 char * DFDMAP (int fd); 40 char * DFMAP (const char *d_file, int *out_fd, int *d_out_size); 41 char * Dread_to_eof (int fd, int *d_out_size); 42 int move_stream (int fd_in, int fd_out); 43 int Dnonblock(int fd); 44 char * gc_realloc (char * PTR, int old_size, int new_size); 45 void * memdup (void * PTR, int size); 46 char * Dstrmid(char * lpsz_string,char * param1, char * param2); 47 char * chomp (char * S); 48 char * DSTR (FILE * m_file); 49 char * strchr_r (char * S, char ch, int d_len); 50 char * strchrs (char *S, char ch, char ch2, char ch3, char ch4); 51 char * Dstrstr_r (char *where, char * str); 52 char * Dstrndup (char *ptr, int n); 53 char * Dtimestr (char * buf, int max); 54 int Dsyms (char * from, char * to, char sym); 55 char * Dmemchr (char *from, int n, char ch); 56 char * Dmid_strchr (char *ptr, char *end, char ch); 57 char * Dmid_getstr (char *buf, char *end); 58 char * Drand_str (char * buf, int count); 59 char * int2str (int i); 60 char * Dprogram_read (char *EXEC, int * len_out); 61 char * stail (char *S); 62 char * strmov (char *buf, char * S); 63 char * strip (char *str) ; 64 char * strip2 (char *str) ; 65 char * Dmemmem (char *haystack, size_t haystacklen, char *needle, size_t needlelen) ; 66 char * Dmid_memmem (char * begin, char * last, char * needle, size_t needlelen) ; 67 int Dtmpfd (char *name) ; 68 int fdclose (int * fd) ; 69 char * fext (char *name) ; 70 char * Dsprintf (char * fmt, ...) ; 71 int logToFile (char * fileName, char * fmt, ...) ; 72 int copyFile (char * sourceName, char * destName) ; 73 74 #define if_digit(S) ((*S >= '0') && (*S <= '9')) 75 #define if_abc(S) ((*S >= 'a' && *S <= 'z') || (*S >= 'A' && *S <= 'Z')) 76 #define OR(var,val1,val2) ((var == val1) || (var == val2)) 77 78 #ifndef EQ 79 #define EQ(arga, argb) (!strcmp ((char *) arga, (char *) argb)) 80 #endif 81 82 #ifndef NE 83 #define NE(arga, argb) (strcmp ((char *) arga, (char *) argb)) 84 #endif 85 86 #ifndef chop 87 #define chop(arg1) arg1[strlen(arg1) - 1] = 0 88 #endif 89 90 #define DROP(arga) if (arga) { free (arga); arga = NULL; } 91 #define CNEW(arga,argb) (arga *)malloc (sizeof (arga)*(argb)) 92 93 #undef gclib_c__export 94 #endif 95 96