1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347
|
/* syshdrs.h
*
* Copyright (c) 1996-2004 Mike Gleason, NcFTP Software.
* All rights reserved.
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#if defined(AIX) || defined(_AIX) || defined(__HOS_AIX__)
# define _ALL_SOURCE 1
#endif
#ifdef LINUX
# define _GNU_SOURCE 1
#endif
#if defined(DIGITAL_UNIX) || defined(TRU64UNIX)
# define _OSF_SOURCE 1
# define _XOPEN_SOURCE 500
# define _XOPEN_SOURCE_EXTENDED 1
#endif
#ifdef HPUX
# define _HPUX_SOURCE 1
# define _XOPEN_SOURCE 500
# define _XOPEN_SOURCE_EXTENDED 1
#endif
#ifdef IRIX
# define _SGI_SOURCE 1
#endif
#ifdef SOLARIS
/* #define __EXTENSIONS__ 1 */
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
#ifdef CAN_USE_SYS_SELECT_H
# include <sys/select.h>
#endif
#if defined(HAVE_SYS_UTSNAME_H) && defined(HAVE_UNAME)
# include <sys/utsname.h>
#endif
/* The only reason we need to include this junk, is because on some systems
* the function killchar() is actually a macro that uses definitions in
* termios.h. Example: #define killchar() (__baset.c_cc[VKILL])
*/
#ifdef HAVE_TERMIOS_H
# include <termios.h>
#else
# ifdef HAVE_TERMIO_H
# include <termio.h>
# else
# ifdef HAVE_SYS_IOCTL_H
# include <sys/ioctl.h> /* For TIOxxxx constants. */
# endif
# ifdef HAVE_SGTTY_H
# include <sgtty.h>
# endif
# endif
#endif /* !HAVE_TERMIOS_H */
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stddef.h>
#include <stdlib.h>
#include <ctype.h>
#include <signal.h>
#include <setjmp.h>
#include <stdarg.h>
#include <assert.h>
#include <time.h>
#include <pwd.h>
#include <fcntl.h>
#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif
#ifdef NEED_GETOPT_H
# include <getopt.h>
#elif defined(NEED_GETOPT_EXTERN_DECLS)
extern int optind, opterr, optopt;
extern char *optarg;
#endif
#ifdef __CYGWIN__
# ifndef FOPEN_READ_TEXT
# define FOPEN_READ_TEXT "rt"
# define FOPEN_WRITE_TEXT "wt"
# define FOPEN_APPEND_TEXT "at"
# endif
# ifndef FOPEN_READ_BINARY
# define FOPEN_READ_BINARY "rb"
# define FOPEN_WRITE_BINARY "wb"
# define FOPEN_APPEND_BINARY "ab"
# endif
#else
# ifndef FOPEN_READ_TEXT
# define FOPEN_READ_TEXT "r"
# define FOPEN_WRITE_TEXT "w"
# define FOPEN_APPEND_TEXT "a"
# endif
# ifndef FOPEN_READ_BINARY
# define FOPEN_READ_BINARY "r"
# define FOPEN_WRITE_BINARY "w"
# define FOPEN_APPEND_BINARY "a"
# endif
#endif
#if defined(MACOSX) || defined(BSDOS)
# undef SIG_DFL
# undef SIG_IGN
# undef SIG_ERR
# define SIG_DFL (void (*)(int))0
# define SIG_IGN (void (*)(int))1
# define SIG_ERR (void (*)(int))-1
#endif
#ifdef HAVE_NCURSES_H
# include <ncurses.h>
#else
# ifdef HAVE_CURSES_H
# include <curses.h>
# endif
#endif
/* These next three sections are mostly for HP-UX 10. */
#if defined(HAVE___GETCURX) && defined(HAVE___GETCURY)
# ifndef HAVE_GETYX
# define HAVE_GETYX 1
# endif
# undef getyx
# define getyx(w,y,x) (y) = __getcury((w)); (x) = __getcurx((w))
#endif
#if defined(HAVE___GETMAXX) && !defined(HAVE_GETMAXX)
# define HAVE_GETMAXX 1
# undef getmaxx
# define getmaxx __getmaxx
#endif
#if defined(HAVE___GETMAXY) && !defined(HAVE_GETMAXY)
# define HAVE_GETMAXY 1
# undef getmaxy
# define getmaxy __getmaxy
#endif
#if defined(HAVE___GETMAXY) && defined(HAVE___GETMAXX) && !defined(HAVE_GETMAXYX)
# define HAVE_GETMAXYX 1
# undef getmaxyx
# define getmaxyx(w,y,x) (y) = __getmaxy((w)); (x) = __getmaxx((w))
#endif
#if defined(HAVE___GETBEGX) && !defined(HAVE_GETBEGX)
# define HAVE_GETBEGX 1
# undef getbegx
# define getbegx __getbegx
#endif
#if defined(HAVE___GETBEGY) && !defined(HAVE_GETBEGY)
# define HAVE_GETBEGY 1
# undef getbegy
# define getbegy __getbegy
#endif
#if defined(HAVE___GETBEGY) && defined(HAVE___GETBEGX) && !defined(HAVE_GETBEGYX)
# define HAVE_GETBEGYX 1
# undef getbegyx
# define getbegyx(w,y,x) (y) = __getbegy((w)); (x) = __getbegx((w))
#endif
/* Otherwise, try accessing the structure directly. */
#ifndef HAVE_GETMAXYX
# ifdef HAVE__MAXX
# ifndef getmaxyx
# define getmaxyx(w,y,x) y = w->_maxy; x = w->_maxx
# endif
# ifndef getbegyx
# define getbegyx(w,y,x) y = w->_begy; x = w->_begx
# endif
# else
# ifndef getmaxyx
# define getmaxyx(w,y,x) y = w->maxy; x = w->maxx
# endif
# ifndef getbegyx
# define getbegyx(w,y,x) y = w->begy; x = w->begx
# endif
# endif
#endif
#ifndef HAVE_GETMAXX
# ifdef HAVE__MAXX
# ifndef getmaxy
# define getmaxy(win) ((win)->_maxy)
# endif
# ifndef getmaxx
# define getmaxx(win) ((win)->_maxx)
# endif
# else
# ifndef getmaxy
# define getmaxy(win) ((win)->maxy)
# endif
# ifndef getmaxx
# define getmaxx(win) ((win)->maxx)
# endif
# endif
#endif
#ifndef HAVE_GETBEGX
# ifdef HAVE__MAXX
# ifndef getbegy
# define getbegy(win) ((win)->_begy)
# endif
# ifndef getbegx
# define getbegx(win) ((win)->_begx)
# endif
# else
# ifndef getbegy
# define getbegy(win) ((win)->begy)
# endif
# ifndef getbegx
# define getbegx(win) ((win)->begx)
# endif
# endif
#endif
#ifndef HAVE_TOUCHWIN
# ifdef HAVE__MAXX
# ifndef touchwin
# define touchwin(win) wtouchln((win), 0, (win)->_maxy, 1)
# endif
# else
# ifndef touchwin
# define touchwin(win) wtouchln((win), 0, (win)->maxy, 1)
# endif
# endif
#endif
#ifndef HAVE_CURS_SET
# ifndef curs_set
# define curs_set(a)
# endif
#endif
#ifdef HAVE_DOUPDATE
# define DOUPDATE(a) doupdate()
#else
# define DOUPDATE(a)
#endif
#ifndef HAVE_NODELAY
# ifndef nodelay
# define nodelay(win,boolval)
# endif
#endif
#ifndef HAVE_WNOUTREFRESH
# ifndef wnoutrefresh
# define wnoutrefresh wrefresh
# endif
#endif
#ifndef HAVE_KEYPAD
# ifndef keypad
# define keypad(win,boolval)
# endif
#endif
#ifdef HAVE_BEEP
# define BEEP(a) beep()
#else
# define BEEP(a)
#endif
#define NDEBUG 1 /* For assertions. */
#if ((defined(HAVE_LONG_LONG)) && (defined(_LARGEFILE64_SOURCE)) && (defined(HAVE_OPEN64)))
# define Open open64
#else
# define Open open
#endif
#if (defined(WIN32) || defined(_WINDOWS)) && !defined(__CYGWIN__)
# define Stat WinStat64
# define Lstat WinStat64
# define Fstat WinFStat64
#elif ((defined(HAVE_LONG_LONG)) && (defined(_LARGEFILE64_SOURCE)) && (defined(HAVE_STAT64)) && (defined(HAVE_STRUCT_STAT64)))
# define Stat stat64
# ifdef HAVE_FSTAT64
# define Fstat fstat64
# else
# define Fstat fstat
# endif
# ifdef HAVE_LSTAT64
# define Lstat lstat64
# else
# define Lstat lstat
# endif
#else
# define Stat stat
# define Fstat fstat
# define Lstat lstat
#endif
#if (((defined(_FILE_OFFSET_BITS)) && (_FILE_OFFSET_BITS > 32)) || ((defined(SIZEOF_OFF_T)) && (SIZEOF_OFF_T > 4)))
# define Lseek(a,b,c) lseek(a, (off_t) b, c)
#elif ((defined(HAVE_LONG_LONG)) && (defined(_LARGEFILE64_SOURCE)) && (defined(HAVE_LSEEK64)))
# define Lseek(a,b,c) lseek64(a, (longest_int) b, c)
#else
# define Lseek(a,b,c) lseek(a, (off_t) b, c)
#endif
#if (defined(SOCKS)) && (SOCKS >= 5)
# ifdef HAVE_SOCKS_H
# ifdef HAVE_SOCKS5P_H
# define INCLUDE_PROTOTYPES 1
# endif
# include <socks.h>
# endif
#endif /* SOCKS */
#include <Strn.h> /* Library header. */
#include <sio.h> /* Because ../ncftp/util.c needs it. */
#include <ncftp.h> /* Mostly for utility routines it has. */
#ifdef DNSSEC_LOCAL_VALIDATION
#include <validator/validator.h>
#endif
|