1/* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License as 4 * published by the Free Software Foundation; either version 2 of 5 * the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 15 * MA 02111-1307 USA 16 */ 17/*************************************************************************** 18 * LPRng - An Extended Print Spooler System 19 * 20 * Copyright 1988-2003, Patrick Powell, San Diego, CA 21 * papowell@lprng.com 22 * See LICENSE for conditions of use. 23 * $Id: portable.h,v 1.1.1.1 2008/10/15 03:28:27 james26_jang Exp $ 24 ***************************************************************************/ 25 26#ifndef _PLP_PORTABLE_H 27#define _PLP_PORTABLE_H 1 28 29/*************************************************************************** 30 * MODULE: portable.h 31 * PURPOSE: 32 * The configure program generates config.h, which defines various 33 * macros indicating the presence or abscence of include files, etc. 34 * However, there are some systems which pass the tests, but things 35 * do not work correctly on them. This file will try and fix 36 * these things up for the user. 37 * 38 * NOTE: if there were no problems, this file would be: 39 * #include "config.h" 40 * 41 * Sigh. Patrick Powell Thu Apr 6 07:00:48 PDT 1995 <papowell@sdsu.edu> 42 * NOTE: thanks to all the folks who worked on the PLP software, 43 * Justin Mason <jmason@iona.ie> especially. Some of the things 44 * that you have to do to get portability are truely bizzare. 45 * 46 * portable.h,v 3.14 1998/03/24 02:43:22 papowell Exp 47 **************************************************************************/ 48 49#if !defined(EXTERN) 50#define EXTERN extern 51#define DEFINE(X) 52#undef DEFS 53#endif 54 55#ifndef __STDC__ 56LPRng requires ANSI Standard C compiler 57#endif 58 59#include "config.h" 60 61#ifdef HAVE_CTYPE_H 62#include <ctype.h> 63#endif 64 65/************************************************************************* 66 * ARGH: some things that "configure" can't get right. 67*************************************************************************/ 68 69/*************************************************************************** 70 * porting note: if you port PLP and you get some errors 71 * caused by autoconf guessing the wrong set of functions/headers/structs, 72 * add or change the entry for your system in the ARGH section below. 73 * You might want to try and determine how your system is identified 74 * by the C preprocessor and use this informaton rather than trying 75 * to look for information in various f1les. 76 * Patrick Powell and Justin Mason 77 ***************************************************************************/ 78 79/************************************************************************* 80 * APOLLO Ports 81 * Thu Apr 6 07:01:51 PDT 1995 Patrick Powell 82 * This appears to be historical. 83 *************************************************************************/ 84#ifdef apollo 85# define IS_APOLLO OSVERSION 86/* #undef __STDC__ */ 87/* # define CONFLICTING_PROTOS */ 88#endif 89 90/************************************************************************* 91 * ULTRIX. 92 * Patrick Powell Thu Apr 6 07:17:34 PDT 1995 93 * 94 * Take a chance on using the standard calls 95 *************************************************************************/ 96#ifdef ultrix 97# define IS_ULTRIX OSVERSION 98#endif 99 100 101/************************************************************************* 102 * AIX. 103 *************************************************************************/ 104#ifdef _AIX32 105# define IS_AIX32 OSVERSION 106#endif 107 108/************************************************************************* 109 * Sun 110 *************************************************************************/ 111 112#if defined(sun) 113#endif 114 115/************************************************************************* 116 * SCO OpenServer 5.0.5 117 *************************************************************************/ 118/* normal include files do not define MAXPATHLEN - rather PATHSIZE in 119 sys/param.h */ 120#ifdef sco 121#ifndef MAXPATHLEN 122#define MAXPATHLEN PATHSIZE 123#endif 124/* SCO doesn't define the S_ISSOCK POSIX macro to use in testing the 125 stat.st_mode structure member - it appears as though a socket has 126 st_mode = 0020000 (same as character special) */ 127#ifndef S_ISSOCK 128#define S_IFSOCK 0020000 129#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) 130#endif 131#endif 132 133/************************************************************************* 134 * Cray 135 *************************************************************************/ 136 137#if defined(cray) 138#define MAXPATHLEN 1023 139#define HAVE_SIGLONGJMP 1 140 141/* configure incorrectly chooses STATVFS */ 142#if defined(USE_STATFS_TYPE) 143#undef USE_STATFS_TYPE 144#endif 145 146#define USE_STATFS_TYPE SRV3_STATFS 147#endif 148 149 150/*************************************************************************/ 151#if defined(NeXT) 152# define IS_NEXT OSVERSION 153# define __STRICT_BSD__ 154#endif 155 156/*************************************************************************/ 157#if defined(__sgi) && defined(_SYSTYPE_SVR4) 158# define IS_IRIX5 OSVERSION 159#endif 160 161/*************************************************************************/ 162#if defined(__sgi) && defined(_SYSTYPE_SYSV) 163#define IS_IRIX4 OSVERSION 164#endif 165 166/*************************************************************************/ 167#if defined(__linux__) || defined (__linux) || defined (LINUX) 168# define IS_LINUX OSVERSION 169#endif 170 171/*************************************************************************/ 172 173#if defined(__convex__) /* Convex OS 11.0 - from w_stef */ 174# define IS_CONVEX OSVERSION 175# define LPASS8 (L004000>>16) 176#endif 177 178/*************************************************************************/ 179 180#ifdef _AUX_SOURCE 181# define IS_AUX OSVERSION 182# define _POSIX_SOURCE 183 184# undef SETPROCTITLE 185 186#endif 187 188/*************************************************************************/ 189 190#if defined(SNI) && defined(sinix) 191# define IS_SINIX OSVERSION 192#endif 193 194 195/*************************************************************************/ 196#if defined(__svr4__) && !defined(SVR4) 197# define SVR4 __svr4__ 198#endif 199 200/*************************************************************************** 201 * Solaris SUNWorks CC compiler 202 * man page indicates __SVR4 is defined, as is __unix, __sun 203 ***************************************************************************/ 204#if (defined(__SVR4) || defined(_SVR4_)) && !defined(SVR4) 205# define SVR4 1 206#endif 207 208/*************************************************************************/ 209#if defined(__bsdi__) 210# define IS_BSDI OSVERSION 211#endif 212 213/*************************************************************************/ 214 215/************************************************************************* 216 * we also need some way of spotting IS_DATAGEN (Data Generals), 217 * and IS_SEQUENT (Sequent machines). Any suggestions? 218 * these ports probably don't work anymore... 219 *************************************************************************/ 220 221/************************************************************************* 222 * END OF ARGH SECTION; next: overrides from the Makefile. 223 *************************************************************************/ 224/************************* 225 * STTY functions to use * 226 *************************/ 227#define SGTTYB 0 228#define TERMIO 1 229#define TERMIOS 2 230 231/************************* 232 * FSTYPE functions to use * 233 *************************/ 234 235#define SVR3_STATFS 0 236#define ULTRIX_STATFS 1 237#define STATFS 2 238#define STATVFS 3 239 240#if defined(MAKE_USE_STATFS) 241# undef USE_STATFS 242# define USE_STATFS MAKE_USE_STATFS 243#endif 244 245#if defined(MAKE_USE_STTY) 246# undef USE_STTY 247# define USE_STTY MAKE_USE_STTY 248#endif 249 250 251/********************************************************************* 252 * GET STANDARD INCLUDE FILES 253 * This is the one-size-fits-all include that should grab everthing. 254 * This has a horrible impact on compilation speed, but then, do you 255 * want compilation speed or portability? 256 * 257 * Patrick Powell Thu Apr 6 07:21:10 PDT 1995 258 ********************************************************************* 259 * If you do not have the following, you are doomed. Or at least 260 * going to have an uphill hard time. 261 * NOTE: string.h might also be strings.h on some very very odd systems 262 * 263 * Patrick Powell Thu Apr 6 07:21:10 PDT 1995 264 *********************************************************************/ 265 266/********************************************************************* 267 * yuck -- this is a nightmare! half-baked-ANSI systems are poxy (jm) 268 * 269 * Note that configure checks for absolute compliance, i.e.- 270 * older versions of SUNOS, HP-UX, do not meet this. 271 * 272 * Patrick Powell Thu Apr 6 07:21:10 PDT 1995 273 *********************************************************************/ 274 275 276#ifdef HAVE_UNISTD_H 277# include <unistd.h> 278#else 279 extern int dup2 (); 280 extern int execve (); 281 extern uid_t geteuid (), getegid (); 282 extern int setgid (), getgid (); 283#endif 284 285 286#ifdef HAVE_STDLIB_H 287# include <stdlib.h> 288#else 289 char *getenv( char * ); 290 void abort(void); 291#endif 292 293#include <sys/types.h> 294#include <stdio.h> 295#include <string.h> 296#if defined(HAVE_STRINGS_H) 297# include <strings.h> 298#endif 299#include <sys/param.h> 300#include <sys/socket.h> 301#include <netinet/in.h> 302#include <netdb.h> 303#include <arpa/inet.h> 304#include <sys/un.h> 305 306#include <sys/stat.h> 307#include <pwd.h> 308#if defined(HAVE_SYS_SIGNAL_H) 309# include <sys/signal.h> 310#endif 311#include <signal.h> 312#include <sys/wait.h> 313#include <ctype.h> 314 315#include <errno.h> 316#include <grp.h> 317 318#ifdef HAVE_MEMORY_H 319#include <memory.h> 320#endif 321 322#ifndef HAVE_STRCHR 323# define strchr index 324# define strrchr rindex 325#endif 326 327/* case insensitive compare for OS without it */ 328#if !defined(HAVE_STRCASECMP) 329 int strcasecmp (const char *s1, const char *s2); 330#endif 331#if !defined(HAVE_STRNCASECMP) 332 int strncasecmp (const char *s1, const char *s2, int len ); 333#endif 334#if !defined(HAVE_STRCASECMP_DEF) 335 int strcasecmp (const char *s1, const char *s2 ); 336#endif 337 338 339/********************************************************************* 340 * directory management is nasty. There are two standards: 341 * struct directory and struct dirent. 342 * Solution: macros + a typedef. 343 * Patrick Powell Thu Apr 6 07:44:50 PDT 1995 344 * 345 *See GNU autoconf documentation for this little AHEM gem... and others 346 * too obnoxious to believe 347 *********************************************************************/ 348 349#if HAVE_DIRENT_H 350# include <dirent.h> 351# define NLENGTH(dirent) strlen((dirent)->d_name) 352#else 353# define dirent direct 354# define NLENGTH(dirent) (dirent)->d_namlen 355# if HAVE_SYS_NDIR_H 356# include <sys/ndir.h> 357# endif 358# if HAVE_SYS_DIR_H 359# include <sys/dir.h> 360# endif 361# if HAVE_NDIR_H 362# include <ndir.h> 363# endif 364#endif 365 366typedef struct dirent plp_dir_t; 367 368/********************************************************************* 369 * malloc strikes again. Definition is a la ANSI C. However, 370 * You may need to edit this on historical systems. 371 * Patrick Powell Thu Apr 6 07:47:54 PDT 1995 372 *********************************************************************/ 373 374#if !defined(HAVE_STDLIB_H) 375# ifdef HAVE_MALLOC_H 376# include <malloc.h> 377# else 378 void *malloc(size_t); 379 void free(void *); 380# endif 381#endif 382 383#ifndef HAVE_ERRNO_DECL 384 extern int errno; 385#endif 386 387/********************************************************************* 388 * Note the <time.h> may already be included by some previous 389 * lines. You may need to edit this by hand. 390 * Better solution is to put include guards in all of the include files. 391 * Patrick Powell Thu Apr 6 07:55:58 PDT 1995 392 *********************************************************************/ 393 394#ifdef TIME_WITH_SYS_TIME 395# include <sys/time.h> 396# include <time.h> 397#else 398# ifdef HAVE_SYS_TIME_H 399# include <sys/time.h> 400# else 401# include <time.h> 402# endif 403#endif 404 405#ifdef HAVE_SYS_FILE_H 406# include <sys/file.h> 407#endif 408 409#ifdef HAVE_SYS_RESOURCE_H 410# include <sys/resource.h> 411#endif 412 413#ifdef HAVE_SYS_FCNTL_H 414# include <sys/fcntl.h> 415#endif 416#ifdef HAVE_FCNTL_H 417# include <fcntl.h> 418#endif 419 420/* 421 * we use the FCNTL code if we have it 422 * We want you to define F_SETLK, etc. If they are not defined, 423 * Then you better put a system dependent configuration 424 * in and define them. 425 */ 426#if defined(HAVE_FCNTL) && ! defined(F_SETLK) 427/*ABORT: "defined(HAVE_FCNTL) && ! defined(F_SETLK)"*/ 428#undef HAVE_FCNTL 429#endif 430 431#if defined(HAVE_LOCKF) && ! defined(F_LOCK) 432/*ABORT: "defined(HAVE_LOCKF) && ! defined(F_LOCK)"*/ 433/* You must fix this up */ 434#undef HAVE_LOCKF 435#endif 436 437#if defined(HAVE_FLOCK) && ! defined(LOCK_EX) 438/*AB0RT: "defined(HAVE_FLOCK) && ! defined(LOCK_EX)"*/ 439/* You must fix this up */ 440#undef HAVE_FLOCK 441#endif 442 443#ifdef HAVE_LIMITS_H 444#include <limits.h> 445#endif 446 447/* 4.2 BSD systems */ 448#ifndef S_IRUSR 449# define S_IRUSR S_IREAD 450# define S_IWUSR S_IWRITE 451# define S_IXUSR S_IEXEC 452# define S_IXGRP (S_IEXEC >> 3) 453# define S_IXOTH (S_IEXEC >> 6) 454#endif 455 456#ifndef S_ISLNK 457# define S_ISLNK(mode) (((mode) & S_IFLNK) == S_IFLNK) 458#endif 459#ifndef S_ISREG 460# define S_ISREG(mode) (((mode) & S_IFREG) == S_IFREG) 461#endif 462#ifndef S_ISDIR 463# define S_ISDIR(mode) (((mode) & S_IFDIR) == S_IFDIR) 464#endif 465 466 467/* 4.2 BSD systems */ 468#ifndef SEEK_SET 469# define SEEK_SET 0 470# define SEEK_CUR 1 471# define SEEK_END 2 472#endif 473 474#ifndef HAVE_KILLPG 475# define killpg(pg,sig) ((int) kill ((pid_t)(-(pg)), (sig))) 476#else 477extern int killpg(pid_t pgrp, int sig); 478#endif 479 480/*********************************************************************** 481 * wait() stuff: most recent systems support a compatability version 482 * of "union wait", but it's not as fully-featured as the recent stuff 483 * that uses an "int *". However, we want to keep support for the 484 * older BSD systems as much as possible, so it's still supported; 485 * however, if waitpid() exists, we're POSIX.1 compliant, and we should 486 * not use "union wait". (hack hack hack) (jm) 487 * 488 * I agree. See the waitchild.c code for a tour through the depths of 489 * portability hell. 490 * 491 * Patrick Powell Thu Apr 6 08:03:58 PDT 1995 492 * 493 ***********************************************************************/ 494 495#ifdef HAVE_WAITPID 496# undef HAVE_UNION_WAIT /* and good riddance */ 497#endif 498 499/*************************************************************************** 500 * HAVE_UNION_WAIT will be def'd by configure if it's in <sys/wait.h>, 501 * and isn't just there for compatibility (like it is on HP/UX). 502 ***************************************************************************/ 503 504#ifdef HAVE_UNION_WAIT 505typedef union wait plp_status_t; 506/* 507 * with some BSDish systems, there are already #defines for this, 508 * so we should use them if they're there. 509 */ 510# ifndef WCOREDUMP 511# define WCOREDUMP(x) ((x).w_coredump) 512# endif 513# ifndef WEXITSTATUS 514# define WEXITSTATUS(x) ((x).w_retcode) 515# endif 516# ifndef WTERMSIG 517# define WTERMSIG(x) ((x).w_termsig) 518# endif 519# ifndef WIFSTOPPED 520# define WIFSTOPPED(x) ((x).w_stopval == WSTOPPED) 521# endif 522# ifndef WIFEXITED 523# define WIFEXITED(x) ((x).w_stopval == WEXITED) 524# endif 525 526#else 527 typedef int plp_status_t; 528/* The POSIX defaults for these macros. (this is cheating!) */ 529# ifndef WTERMSIG 530# define WTERMSIG(x) ((x) & 0x7f) 531# endif 532# ifndef WCOREDUMP 533# define WCOREDUMP(x) ((x) & 0x80) 534# endif 535# ifndef WEXITSTATUS 536# define WEXITSTATUS(x) ((((unsigned) x) >> 8) & 0xff) 537# endif 538# ifndef WIFSIGNALED 539# define WIFSIGNALED(x) (WTERMSIG (x) != 0) 540# endif 541# ifndef WIFEXITED 542# define WIFEXITED(x) (WTERMSIG (x) == 0) 543# endif 544#endif /* HAVE_UNION_WAIT */ 545 546/*********************************************************************** 547 * SVR4: SIGCHLD is really SIGCLD; #define it here. 548 * PLP lpd _does_ handle the compatibility semantics properly 549 * (Advanced UNIX Programming p. 281). 550 ***********************************************************************/ 551 552#if !defined(SIGCHLD) && defined(SIGCLD) 553# define SIGCHLD SIGCLD 554#endif 555 556 557/*********************************************************************** 558 * configure will set RETSIGTYPE to the type returned by signal() 559 ***********************************************************************/ 560 561typedef RETSIGTYPE plp_signal_t; 562typedef plp_signal_t (*plp_sigfunc_t)(int) ; 563 564#ifndef HAVE_GETDTABLESIZE 565# ifdef NOFILE 566# define getdtablesize() NOFILE 567# else 568# ifdef NOFILES_MAX 569# define getdtablesize() NOFILES_MAX 570# endif 571# endif 572#endif 573 574#ifndef HAVE_STRDUP 575# ifdef __STDC__ 576 char *strdup(const char*); 577# else 578 char *strdup(); 579# endif 580#endif 581 582#ifndef IPPORT_RESERVED 583#define IPPORT_RESERVED 1024 584#endif 585 586 587/* varargs declarations: */ 588 589#if defined(HAVE_STDARG_H) 590# include <stdarg.h> 591# define HAVE_STDARGS /* let's hope that works everywhere (mj) */ 592# define VA_LOCAL_DECL va_list ap; 593# define VA_START(f) va_start(ap, f) 594# define VA_SHIFT(v,t) ; /* no-op for ANSI */ 595# define VA_END va_end(ap) 596#else 597# if defined(HAVE_VARARGS_H) 598# include <varargs.h> 599# undef HAVE_STDARGS 600# define VA_LOCAL_DECL va_list ap; 601# define VA_START(f) va_start(ap) /* f is ignored! */ 602# define VA_SHIFT(v,t) v = va_arg(ap,t) 603# define VA_END va_end(ap) 604# else 605XX ** NO VARARGS ** XX 606# endif 607#endif 608 609#if !defined(IS_ULTRIX) && defined(HAVE_SYSLOG_H) 610# include <syslog.h> 611#endif 612#if defined(HAVE_SYS_SYSLOG_H) 613# include <syslog.h> 614#endif 615# if !(defined(LOG_PID) && defined(LOG_NOWAIT) && defined(HAVE_OPENLOG)) 616# undef HAVE_OPENLOG 617# endif /* LOG_PID && LOG_NOWAIT */ 618 619/* 620 * Priorities (these are ordered) 621 */ 622#ifndef LOG_ERR 623# define LOG_EMERG 0 /* system is unusable */ 624# define LOG_ALERT 1 /* action must be taken immediately */ 625# define LOG_CRIT 2 /* critical conditions */ 626# define LOG_ERR 3 /* error conditions */ 627# define LOG_WARNING 4 /* warning conditions */ 628# define LOG_NOTICE 5 /* normal but signification condition */ 629# define LOG_INFO 6 /* informational */ 630# define LOG_DEBUG 7 /* debug-level messages */ 631#endif 632 633#ifdef LOG_LPR 634# define SYSLOG_FACILITY LOG_LPR 635#else 636# ifdef LOG_LOCAL0 637# define SYSLOG_FACILITY LOCAL0 638# else 639# define SYSLOG_FACILITY (0) /* for Ultrix -- facilities aren't supported */ 640# endif 641#endif 642 643/************************************************************************* 644 * If we have SVR4 and no setpgid() then we need getpgrp() 645 *************************************************************************/ 646#if defined(SVR4) || defined(__alpha__) 647# undef HAVE_SETPGRP_0 648#endif 649 650/* 651 * NONBLOCKING Open and IO - different flags for 652 * different systems 653 */ 654 655#define NONBLOCK (O_NDELAY|O_NONBLOCK) 656#if defined(HPUX) && HPUX<110 657# undef NONBLOCK 658# define NONBLOCK (O_NONBLOCK) 659#endif 660 661/* fix for HPUX systems with no fd_set values */ 662#undef FD_SET_FIX 663#if !defined(HAVE_FD_SET) && defined(HPUX) 664# define FD_SET_FIX(X) (int *) 665#endif 666 667 668/********************************************************************* 669 * AIX systems need this 670 *********************************************************************/ 671 672#if defined(HAVE_SYS_SELECT_H) 673# include <sys/select.h> 674#endif 675 676/********************************************************************** 677 * Signal blocking 678 **********************************************************************/ 679#ifdef HAVE_SIGPROCMASK 680/* a signal set */ 681#define plp_block_mask sigset_t 682#else 683/* an integer */ 684#define plp_block_mask int 685#endif 686 687/********************************************************************** 688 * Select() problems 689 **********************************************************************/ 690#ifdef HAVE_SELECT_H 691#include <select.h> 692#endif 693#if !defined(FD_SET_FIX) 694# define FD_SET_FIX(X) X 695#endif 696 697/********************************************************************** 698 * IPV6 and newer versions 699 **********************************************************************/ 700#if !defined(HAVE_INET_PTON) 701int inet_pton( int family, const char *strptr, void *addr ); 702#endif 703#if !defined(HAVE_INET_NTOP) 704const char *inet_ntop( int family, const void *addr, char *strptr, size_t len ); 705#endif 706 707 708/***************************************************** 709 * Internationalisation of messages, using GNU gettext 710 *****************************************************/ 711 712#if HAVE_LOCALE_H 713# include <locale.h> 714#endif 715 716#if ENABLE_NLS 717# include <libintl.h> 718# define _(Text) gettext(Text) 719# ifdef gettext_noop 720# define N_(Text) gettext_noop(Text) 721# else 722# define N_(Text) Text 723# endif 724#else 725# define _(Text) Text 726# define N_(Text) Text 727# define textdomain(Domain) 728# define bindtextdomain(Package, Directory) 729#endif 730 731 732/********************************************************************** 733 * Cygwin Definitions 734 **********************************************************************/ 735#ifdef __CYGWIN__ 736#define ROOTUID 18 737#else 738#define ROOTUID 0 739#endif 740 741#ifndef HAVE_FLOCK_DEF 742extern int flock( int fd, int operation ); 743#endif 744 745/********************************************************************** 746 * SUNOS Definitions 747 **********************************************************************/ 748#ifdef SUNOS 749extern int _flsbuf(int, FILE *); 750extern int _filbuf(FILE *); 751extern int accept(int s, struct sockaddr *name, int *namelen); 752extern int bind(int s, struct sockaddr *name, int namelen); 753extern int connect(int s, struct sockaddr *name, int namelen); 754extern void bzero(void *s, size_t n); 755extern void endgrent( void ); 756extern int fflush( FILE *stream ); 757extern int fclose( FILE *stream ); 758extern int flock( int fd, int operation ); 759extern int fprintf(FILE *, const char *, ...); 760extern int fputs( const char *, FILE *stream ); 761extern int fstat(int fd, struct stat *buf ); 762extern int fseek( FILE *stream, long offset, int ptrname ); 763extern int ftruncate( int fd, off_t length ); 764extern int fwrite( char *ptr, int size, int nitems, FILE *stream); 765extern int getdtablesize( void ); 766extern int getpeername(int s, struct sockaddr *name, int *namelen); 767extern int getsockname(int s, struct sockaddr *name, int *namelen); 768extern int getsockopt(int s, int level, int optname, char *optval,int *optlen); 769extern int ioctl(int fd, int request, caddr_t arg ); 770extern int killpg(int pgrp, int sig ); 771extern int listen(int s, int backlog ); 772extern int lockf(int fd, int cmd, long size ); 773/*extern int lseek(int fd, off_t pos, int how ); */ 774extern int lstat(const char *path, struct stat *buf ); 775#define memmove(dest,src,len) bcopy(src,dest,len) 776extern void bcopy(const void *src,void *dest,size_t len); 777extern int mkstemp(char *s ); 778extern int openlog( const char *ident, int logopt, int facility ); 779extern int perror(const char *); 780extern int printf( const char *, ...); 781extern int rename(const char *, const char *); 782extern int select (int width, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); 783extern void setgrent(void); 784extern int seteuid( int euid ); 785extern int setreuid( int ruid, int euid ); 786extern int setsockopt(int s, int level, int optname, const char *optval,int optlen); 787extern int socket( int domain, int type, int protocol ); 788extern int socketpair(int, int, int, int *); 789extern int sscanf( char *s, char *format, ... ); 790extern int stat(const char *path, struct stat *buf ); 791extern int strcasecmp( const char *, const char * ); 792extern char *strerror( int ); 793extern int strncasecmp( const char *, const char *, int n ); 794extern long strtol( const char *str, char **ptr, int base ); 795extern double strtod( const char *str, char **ptr ); 796extern int shutdown( int sock, int how ); 797extern int gettimeofday(struct timeval *tp, struct timezone *tzp); 798extern int getrlimit(int resource, struct rlimit *rlp); 799extern char * sbrk(int incr); 800extern int fchmod(int fd, int mode); 801extern int strftime(char *buf, int bufsize, const char *fmt, struct tm *tm); 802extern void syslog(int, const char *, ...); 803extern int system( const char *str ); 804extern time_t time( time_t *t ); 805extern int tolower( int ); 806extern int toupper( int ); 807extern int tputs( const char *cp, int affcnt, int (*outc)() ); 808extern int vfprintf(FILE *, const char *, ...); 809extern int vprintf(FILE *, const char *, va_list ap); 810#endif 811 812 813#ifdef SOLARIS 814extern int setreuid( uid_t ruid, uid_t euid ); 815extern int mkstemp(char *s ); 816#ifdef HAVE_GETDTABLESIZE 817extern int getdtablesize(void); 818#endif 819#endif 820 821#if !defined(HAVE_SYSLOG_DEF) 822extern void syslog(int, const char *, ...); 823#endif 824#if !defined(HAVE_OPENLOG_DEF) 825extern int openlog( const char *ident, int logopt, int facility ); 826#endif 827 828#ifdef IS_AIX32 829extern int seteuid(uid_t); 830extern int setruid(uid_t); 831extern int setenv(char *, char *, int); 832#endif 833 834 835/* IPV6 structures define */ 836 837#if defined(AF_INET6) 838# if defined(IN_ADDR6) 839# define in6_addr in_addr6 840# endif 841#endif 842 843#if defined(HAVE_ARPA_NAMESER_H) 844# include <arpa/nameser.h> 845#endif 846#if defined(HAVE_RESOLV_H) 847# include <resolv.h> 848#endif 849 850#ifdef HAVE_INNETGR 851#if !defined(HAVE_INNETGR_DEF) 852extern int innetgr(const char *netgroup, 853 const char *machine, const char *user, const char *domain); 854#endif 855#endif 856 857 858#define Cast_int_to_voidstar(v) ((void *)(long)(v)) 859#define Cast_ptr_to_int(v) ((int)(long)(v)) 860#define Cast_ptr_to_long(v) ((long)(v)) 861 862/* for testing, set -Wall -Wformat and then make */ 863 864#if defined(FORMAT_TEST) 865# define FPRINTF fprintf 866# define PRINTF printf 867# define STDOUT stdout 868# define STDERR stderr 869# define SNPRINTF(X,Y) printf( 870# define VSNPRINTF(X,Y) vprintf( 871# define SETSTATUS(X) printf( 872#else 873# define FPRINTF safefprintf 874# define PRINTF safeprintf 875# define STDOUT 1 876# define STDERR 2 877# define SNPRINTF(X,Y) plp_snprintf(X,Y, 878# define VSNPRINTF(X,Y) plp_vsnprintf(X,Y, 879# define SETSTATUS(X) setstatus(X, 880#endif 881 882#endif 883 884#ifdef JYDEBUG//JYWeng 885FILE *aaaaaa; 886#endif 887