📄 conf.sh
字号:
#else/*VARARGS1*/ int p(format, va_alist) char *format; va_dcl#endif{ int r; va_list args; vararg_start(args, format); r = vfprintf(stderr, format, args); va_end(args); return r;}int main() { exitmain(p("") != 0); }EOF$RM || exitif ($CL a.c $L && ./a.out) >&2then h=1else h=0fiecho "#define has_vfprintf $h /* Does vfprintf() work? */": has__doprintf, has__doprntcase $h in1) h=? a='/* ' z='*/ ';;*) a= z= cat >a.c <<'EOF'#include "a.h"#if has_prototypesint p(char const*format,...)#else/*VARARGS1*/ int p(format, va_alist) char *format; va_dcl#endif{ va_list args; vararg_start(args, format);# if TRY__DOPRINTF _doprintf(stderr, format, args);# else _doprnt(format, args, stderr);# endif va_end(args);}int main() { p(""); exitmain(ferror(stderr) != 0); }EOF $RM || exit if ($CL -DTRY__DOPRINTF=1 a.c $L && ./a.out) >&2 then h=1 else h=0 fiesacecho "$a#define has__doprintf $h $z/* Does _doprintf() work? */"case $h in0) $RM || exit if ($CL a.c $L && ./a.out) >&2 then h=1 else h=0 fi a= z=;;*) h=? a='/* ' z='*/ 'esacecho "$a#define has__doprnt $h $z/* Does _doprnt() work? */": EXIT_FAILUREcat >a.c <<'EOF'#include "a.h"int main() { exitmain(EXIT_FAILURE); }EOF$RM || exitif $CL a.c $L >&2 && ./a.outthen a= z=else a='/* ' z='*/ 'fiecho "$a#undef EXIT_FAILURE $z/* Uncomment this if EXIT_FAILURE is broken. */": large_memoryecho "#define large_memory $has_mmap /* Can main memory hold entire RCS files? */": ULONG_MAXcat >a.c <<'EOF'#include "a.h"#ifdef ULONG_MAX /* * "#if ULONG_MAX/10 <= 0" does not always work, * because some buggy implementations put casts in ULONG_MAX. */ int main() { exitmain(ULONG_MAX/10 <= 0); }#else int main() { exitmain(1); }#endifEOF$RM || exitif $CL a.c $L >&2 && ./a.outthen a='/* ' z='*/ 'else a= z=fiecho "$a#undef ULONG_MAX $z/* Uncomment this if ULONG_MAX is broken (e.g. < 0). */": struct utimbufcat >a.c <<'EOF'#include "a.h"struct utimbuf s;int main() { s.actime = s.modtime = 1; exitmain(utime("a.c", &s) != 0); }EOF$RM || exitif ($CL a.c $L && ./a.out) >&2then a='/* ' z=' */'else a= z=fiecho "${a}struct utimbuf { time_t actime, modtime; };$z /* Uncomment this if needed. */": COecho "#define CO \"${RCSPREFIX}co\" /* name of 'co' program */": COMPAT2echo "#define COMPAT2 $COMPAT2 /* Are version 2 files supported? */": DATEFORMcat >a.c <<'EOF'#include "a.h"int main() { printf("%.2d", 1); exitmain(0); }EOF$RM && $CL a.c $L >&2 && r=`./a.out` || exitcase $r in01) f=%.2d;;*) f=%02desacecho "#define DATEFORM \"$f.$f.$f.$f.$f.${f}\" /* e.g. 01.01.01.01.01.01 */": DIFFecho "#define DIFF \"${DIFF}\" /* name of 'diff' program */": DIFF3echo "#define DIFF3 \"${DIFF3}\" /* name of 'diff3' program */"echo "#define DIFF3_BIN $DIFF3_BIN /* Is diff3 user-visible (not the /usr/lib auxiliary)? */": DIFF_FLAGSdfs=for df in $DIFF_FLAGSdo dfs="$dfs, \"${df}\""doneecho "#define DIFF_FLAGS $dfs /* Make diff output suitable for RCS. */": DIFF_Lecho "#define DIFF_L $DIFF_L /* Does diff -L work? */": DIFF_SUCCESS, DIFF_FAILURE, DIFF_TROUBLEcat <<EOF#define DIFF_SUCCESS $DIFF_SUCCESS /* DIFF status if no differences are found */#define DIFF_FAILURE $DIFF_FAILURE /* DIFF status if differences are found */#define DIFF_TROUBLE $DIFF_TROUBLE /* DIFF status if trouble */EOF: EDecho "#define ED \"${ED}\" /* name of 'ed' program (used only if !DIFF3_BIN) */": MERGEecho "#define MERGE \"${RCSPREFIX}merge\" /* name of 'merge' program */": '*SLASH*', ROOTPATH, TMPDIR, X_DEFAULTcase ${PWD-`pwd`} in/*) # Posix SLASH=/ qSLASH="'/'" SLASHes=$qSLASH isSLASH='#define isSLASH(c) ((c) == SLASH)' ROOTPATH='isSLASH((p)[0])' X_DEFAULT=",v$SLASH";;?:[/\\]*) # MS-DOS SLASH='\' qSLASH="'\\\\'" SLASHes="$qSLASH: case '/': case ':'" isSLASH='int isSLASH P((int));' ROOTPATH='((p)[0] && (p)[1]==':' && isSLASH((p)[2]))' X_DEFAULT="$SLASH,v";;*) echo >&2 "cannot deduce SLASH"; exit 1esaccat <<EOF#define TMPDIR "${SLASH}tmp" /* default directory for temporary files */#define SLASH $qSLASH /* principal pathname separator */#define SLASHes $SLASHes /* \`case SLASHes:' labels all pathname separators */$isSLASH /* Is arg a pathname separator? */#define ROOTPATH(p) $ROOTPATH /* Is p an absolute pathname? */#define X_DEFAULT "$X_DEFAULT" /* default value for -x option */EOF: DIFF_ABSOLUTEcase $DIFF in"$SLASH"*) a=1;;*) a=0esacecho "#define DIFF_ABSOLUTE $a /* Is ROOTPATH(DIFF) true? */": ALL_ABSOLUTEa=1for i in "$DIFF" "$DIFF3" "$ED" "$RCSPREFIX" "$SENDMAIL"/do case $i in "$SLASH"* | "\"$SLASH"*) ;; *) a=0 break esacdoneecho "#define ALL_ABSOLUTE $a /* Are all subprograms absolute pathnames? */": SENDMAILcase $SENDMAIL in'') a='/* ' z='*/ ';;*) a= z=esacecho "$a#define SENDMAIL $SENDMAIL $z/* how to send mail */": TZ_must_be_setecho "#define TZ_must_be_set 0 /* Must TZ be set for gmtime() to work? */": standard function declarationscat <<'EOF'/* Adjust the following declarations as needed. */#if __GNUC__ && !__STRICT_ANSI__# define exiting volatile /* GCC extension: function cannot return */#else# define exiting#endifEOFcat >a.ha <<EOF#if has_ftruncate int ftruncate P((int,off_t));#endif/* <sys/mman.h> */#if has_madvise int madvise P((caddr_t,size_t,int));#endif#if has_mmap caddr_t mmap P((caddr_t,size_t,int,int,int,off_t)); int munmap P((caddr_t,size_t));#endif/* Posix (ISO/IEC 9945-1: 1990 / IEEE Std 1003.1-1990) *//* These definitions are for the benefit of non-Posix hosts, and *//* Posix hosts that have Standard C compilers but traditional include files. *//* Unfortunately, mixed-up hosts are all too common. *//* <fcntl.h> */#ifdef F_DUPFD int fcntl P((int,int,...));#else int dup2 P((int,int));#endif#ifndef O_BINARY /* some non-Posix hosts need O_BINARY */# define O_BINARY 0 /* no effect on Posix */#endif#ifdef O_CREAT# define open_can_creat 1#else# define open_can_creat 0# define O_RDONLY 0# define O_WRONLY 1# define O_RDWR 2# define O_CREAT 01000# define O_TRUNC 02000 int creat P((char const*,mode_t));#endif#ifndef O_EXCL# define O_EXCL 0#endif/* <pwd.h> */#if has_getpwuid struct passwd *getpwuid P((uid_t));#endif/* <signal.h> */#if has_sigaction int sigaction P((int,struct sigaction const*,struct sigaction*)); int sigaddset P((sigset_t*,int)); int sigemptyset P((sigset_t*));#else#if has_sigblock /* BSD */ int sigblock P((int)); int sigmask P((int)); int sigsetmask P((int));#endif#endif/* <stdio.h> */FILE *fdopen P((int,char const*));int fileno P((FILE*));/* <sys/stat.h> */int chmod P((char const*,mode_t));int fstat P((int,struct stat*));int stat P((char const*,struct stat*));mode_t umask P((mode_t));#if has_fchmod int fchmod P((int,mode_t));#endif#ifndef S_IRUSR# ifdef S_IREAD# define S_IRUSR S_IREAD# else# define S_IRUSR 0400# endif# ifdef S_IWRITE# define S_IWUSR S_IWRITE# else# define S_IWUSR (S_IRUSR/2)# endif#endif#ifndef S_IRGRP# if has_getuid# define S_IRGRP (S_IRUSR / 0010)# define S_IWGRP (S_IWUSR / 0010)# define S_IROTH (S_IRUSR / 0100)# define S_IWOTH (S_IWUSR / 0100)# else /* single user OS -- not Posix or Unix */# define S_IRGRP 0# define S_IWGRP 0# define S_IROTH 0# define S_IWOTH 0# endif#endif#ifndef S_ISREG# define S_ISREG(n) (((n) & S_IFMT) == S_IFREG)#endif/* <sys/wait.h> */#if has_wait pid_t wait P((int*));#endif#ifndef WEXITSTATUS# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)# undef WIFEXITED /* Avoid 4.3BSD incompatibility with Posix. */#endif#ifndef WIFEXITED# define WIFEXITED(stat_val) (!((stat_val) & 255))#endif/* <unistd.h> */char *getlogin P((void));int close P((int));int isatty P((int));int link P((char const*,char const*));int open P((char const*,int,...));int unlink P((char const*));int _filbuf P((FILE*)); /* keeps lint quiet in traditional C */int _flsbuf P((int,FILE*)); /* keeps lint quiet in traditional C */long pathconf P((char const*,int));ssize_t write P((int,void const*,size_t));#ifndef STDIN_FILENO# define STDIN_FILENO 0# define STDOUT_FILENO 1# define STDERR_FILENO 2#endif#if has_fork# if !has_vfork# undef vfork# define vfork fork# endif pid_t vfork P((void)); /* vfork is nonstandard but faster */#endif#if has_getcwd || !has_getwd char *getcwd P((char*,size_t));#else char *getwd P((char*));#endif#if has_getuid uid_t getuid P((void));#endif#if has_readlink ssize_t readlink P((char const*,char*,size_t)); /* BSD; not standard yet */#endif#if has_setuid# if !has_seteuid# undef seteuid# define seteuid setuid# endif int seteuid P((uid_t)); uid_t geteuid P((void));#endif#if has_spawn int spawnv P((int,char const*,char*const*));# if ALL_ABSOLUTE# define spawn_RCS spawnv# else# define spawn_RCS spawnvp int spawnvp P((int,char const*,char*const*));# endif#else int execv P((char const*,char*const*));# if ALL_ABSOLUTE# define exec_RCS execv# else# define exec_RCS execvp int execvp P((char const*,char*const*));# endif#endif/* utime.h */int utime P((char const*,struct utimbuf const*));/* Standard C library *//* These definitions are for the benefit of hosts that have *//* traditional C include files, possibly with Standard C compilers. *//* Unfortunately, mixed-up hosts are all too common. *//* <errno.h> */extern int errno;/* <limits.h> */#ifndef ULONG_MAX /* This does not work in #ifs, but it's good enough for us. */# define ULONG_MAX ((unsigned long)-1)#endif/* <signal.h> */#if has_signal signal_type (*signal P((int,signal_type(*)signal_args)))signal_args;#endif/* <stdio.h> */FILE *fopen P((char const*,char const*));fread_type fread P((void*,freadarg_type,freadarg_type,FILE*));fread_type fwrite P((void const*,freadarg_type,freadarg_type,FILE*));int fclose P((FILE*));int feof P((FILE*));int ferror P((FILE*));int fflush P((FILE*));int fprintf P((FILE*,char const*,...));int fputs P((char const*,FILE*));int fseek P((FILE*,long,int));int printf P((char const*,...));int rename P((char const*,char const*));int sprintf P((char*,char const*,...));long ftell P((FILE*));void clearerr P((FILE*));void perror P((char const*));#ifndef L_tmpnam# define L_tmpnam 32 /* power of 2 > sizeof("/usr/tmp/xxxxxxxxxxxxxxx") */#endif#ifndef SEEK_SET# define SEEK_SET 0#endif#if has_mktemp char *mktemp P((char*)); /* traditional */#else char *tmpnam P((char*));#endif#if has_vfprintf int vfprintf P((FILE*,char const*,va_list));#else#if has__doprintf void _doprintf P((FILE*,char const*,va_list)); /* Minix */#else void _doprnt P((char const*,va_list,FILE*)); /* BSD */#endif#endif/* <stdlib.h> */char *getenv P((char const*));exiting void _exit P((int));exiting void exit P((int));malloc_type malloc P((size_t));malloc_type realloc P((malloc_type,size_t));void free P((malloc_type));#ifndef EXIT_FAILURE# define EXIT_FAILURE 1#endif#ifndef EXIT_SUCCESS# define EXIT_SUCCESS 0#endif#if !has_fork && !has_spawn int system P((char const*));#endif/* <string.h> */char *strcpy P((char*,char const*));char *strchr P((char const*,int));char *strrchr P((char const*,int));int memcmp P((void const*,void const*,size_t));int strcmp P((char const*,char const*));size_t strlen P((char const*));void *memcpy P((void*,void const*,size_t));#if has_memmove void *memmove P((void*,void const*,size_t));#endif/* <time.h> */time_t time P((time_t*));EOFcat >a.c <<'EOF'#include "a.h"#define a 0#define b 1#if h==a# include "a.ha"#else# include "a.hb"#endifint main() { exitmain(0); }EOF# Comment out lines in a.ha that the compiler rejects.# a.ha may not contain comments that cross line boundaries.# Leave the result in a.h$h.h=a l=1U=`wc -l <a.ha | sed 's| ||g'`commentOut='s|^[^#/][^/]*|/* & */|'until test $U -lt $l || $CS -Dh=$h a.c $LS >&2do case $h in a) i=b;; *) i=a esac # The compiler rejects some line in l..U. # Use binary search to set l to be the index of the first bad line in l..U. u=$U while test $l -lt $u do M=`expr '(' $l + $u ')' / 2` M1=`expr $M + 1` sed "$M1,\$$commentOut" a.h$h >a.h$i || exit if $CS -Dh=$i a.c $LS >&2 then l=$M1 else u=$M fi done # Comment out the bad line. sed "$l$commentOut" a.h$h >a.h$i || exit h=$i l=`expr $l + 1`donecat a.h$h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -