5759899 [rkeene@sledge /home/rkeene/devel/backuppcd/all/backuppcd-200601171056]$ cat -n compat.h
  1 /*
  2  * Copyright (C) 2005  Roy Keene
  3  *
  4  * This program is free software; you can redistribute it and/or
  5  * modify it under the terms of the GNU General Public License
  6  * as published by the Free Software Foundation; either version 2
  7  * of the License, or (at your option) any later version.
  8  *
  9  * This program is distributed in the hope that it will be useful,
 10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 12  * GNU General Public License for more details.
 13  *
 14  * You should have received a copy of the GNU General Public License
 15  * along with this program; if not, write to the Free Software
 16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 17  *
 18  * Author Information
 19  *      Roy Keene
 20  *      Planning Systems Inc
 21  *      Slidell, LA
 22  *      backuppcd-bugs@psislidell.com
 23  */
 24 
 25 
 26 #ifndef RSK_COMPAT_H
 27 #define RSK_COMPAT_H
 28 
 29 #ifdef HAVE_CONFIG_H
 30 #include "config.h"
 31 #endif
 32 #ifdef __WIN32__
 33 #include "win32.h"
 34 #endif
 35 
 36 #ifdef HAVE_INTTYPES_H
 37 #include <inttypes.h>
 38 #endif
 39 #ifdef HAVE_MEMORY_H
 40 #include <memory.h>
 41 #endif
 42 #ifdef HAVE_STDINT_H
 43 #include <stdint.h>
 44 #endif
 45 #ifdef HAVE_STDLIB_H
 46 #include <stdlib.h>
 47 #endif
 48 #ifdef HAVE_STRINGS_H
 49 #include <strings.h>
 50 #endif
 51 #ifdef HAVE_STRING_H
 52 #include <string.h>
 53 #endif
 54 #ifdef HAVE_SYS_STAT_H
 55 #include <sys/stat.h>
 56 #endif
 57 #ifdef HAVE_SYS_TYPES_H
 58 #include <sys/types.h>
 59 #endif
 60 #ifdef HAVE_UNISTD_H
 61 #include <unistd.h>
 62 #endif
 63 #ifdef HAVE_ERRNO_H
 64 #include <errno.h>
 65 #endif
 66 #ifdef HAVE_FCNTL_H
 67 #include <fcntl.h>
 68 #endif
 69 #ifdef HAVE_NETDB_H
 70 #include <netdb.h>
 71 #endif
 72 #ifdef HAVE_NETINET_IN_H
 73 #include <netinet/in.h>
 74 #endif
 75 #ifdef HAVE_STDARG_H
 76 #include <stdarg.h>
 77 #endif
 78 #ifdef HAVE_STDIO_H
 79 #include <stdio.h>
 80 #endif
 81 #ifdef HAVE_SYS_SOCKET_H
 82 #include <sys/socket.h>
 83 #endif
 84 #ifdef HAVE_SYS_VFS_H
 85 #include <sys/vfs.h>
 86 #endif
 87 #ifdef HAVE_SYS_STATFS_H
 88 #include <sys/statfs.h>
 89 #endif
 90 #ifdef HAVE_SYS_RESOURCE_H
 91 #include <sys/resource.h>
 92 #endif
 93 #ifdef TIME_WITH_SYS_TIME
 94 #include <sys/time.h>
 95 #include <time.h>
 96 #else
 97 #ifdef HAVE_SYS_TIME_H
 98 #include <sys/time.h>
 99 #else
100 #include <time.h>
101 #endif
102 #endif
103 
104 #ifndef HAVE_SOCKLEN_T
105 #ifdef NEED_SOCKLEN_T
106 typedef int socklen_t;
107 #endif
108 #endif
109 
110 #ifndef HAVE_HTONLL
111 #include "htonll.h"
112 #endif
113 #ifndef HAVE_NTOHLL
114 #include "ntohll.h"
115 #endif
116 
117 
118 #ifdef HAVE_STATFS
119 /*
120  * These constants are used to determine the filesystem type from statfs().
121  * Only used under Linux as other statfs() implementations return ftype == 0.
122  */
123 #ifndef NFS_SUPER_MAGIC
124 #define NFS_SUPER_MAGIC   0x6969
125 #endif
126 #ifndef PROC_SUPER_MAGIC
127 #define PROC_SUPER_MAGIC  0x9fa0
128 #endif
129 #ifndef DEVFS_SUPER_MAGIC
130 #define DEVFS_SUPER_MAGIC 0x1373
131 #endif
132 #ifndef ISOFS_SUPER_MAGIC
133 #define ISOFS_SUPER_MAGIC 0x9660
134 #endif
135 #ifndef NCP_SUPER_MAGIC
136 #define NCP_SUPER_MAGIC   0x564c
137 #endif
138 #ifndef SMB_SUPER_MAGIC
139 #define SMB_SUPER_MAGIC   0x517B
140 #endif
141 #ifndef TMPFS_MAGIC
142 #define TMPFS_MAGIC       0x01021994
143 #endif
144 #endif
145 
146 
147 
148 #ifdef DEBUG
149 #define PRINT_LINE fprintf(stderr, "%lu:%s:%i:%s(): ", (unsigned long) time(NULL), __FILE__, __LINE__, __func__); 
150 #define PRINTERR_D(x...) { PRINT_LINE; fprintf(stderr, x); fprintf(stderr, "\n"); }
151 #define PERROR(x) { PRINT_LINE; perror(x); }
152 #define DPERROR(x) PERROR(x)
153 #define DPRINTF(x...) { PRINT_LINE; fprintf(stderr, x); fprintf(stderr, "\n"); }
154 #else
155 #define PRINT_LINE /**/
156 #define PRINTERR_D(x...) /**/
157 #define PERROR(x) perror(x);
158 #define DPERROR(x) /**/
159 #endif
160 #define CHECKPOINT PRINTERR_D("*** CHECKPOINT REACHED ***")
161 #define SPOTVAR_LLX(x) PRINTERR_D(#x " = %llx", (unsigned long long) x)
162 #define SPOTVAR_LLU(x) PRINTERR_D(#x " = %llu", (unsigned long long) x)
163 #define SPOTVAR_LU(x) PRINTERR_D(#x " = %lu", (unsigned long) x)
164 #define SPOTVAR_D(x) PRINTERR_D(#x " = %lf", x)
165 #define SPOTVAR_X(x) PRINTERR_D(#x " = 0x%x", (unsigned int) x)
166 #define SPOTVAR_I(x) PRINTERR_D(#x " = %i", (int) x)
167 #define SPOTVAR_P(x) PRINTERR_D(#x " = %p", x)
168 #define SPOTVAR_S(x) PRINTERR_D(#x " = \"%s\"", x)
169 #define PRINTERR(x...) { PRINT_LINE; fprintf(stderr, x); fprintf(stderr, "\n"); fflush(stderr); }
170 #define LOG(x...) { PRINT_LINE; fprintf(stderr, "LOG: " x); fprintf(stderr, "\n"); }
171 
172 #endif
5759900 [rkeene@sledge /home/rkeene/devel/backuppcd/all/backuppcd-200601171056]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2006-01-17 04:53:23