home *** CD-ROM | disk | FTP | other *** search
- From: lwall@netlabs.com (Larry Wall)
- Newsgroups: comp.sources.misc
- Subject: v18i041: perl - The perl programming language, Part23/36
- Message-ID: <1991Apr16.185605.1295@sparky.IMD.Sterling.COM>
- Date: 16 Apr 91 18:56:05 GMT
- Approved: kent@sparky.imd.sterling.com
- X-Checksum-Snefru: afd9e8ac ccc0b5cb ab2afe74 4c672184
-
- Submitted-by: Larry Wall <lwall@netlabs.com>
- Posting-number: Volume 18, Issue 41
- Archive-name: perl/part23
-
- [There are 36 kits for perl version 4.0.]
-
- #! /bin/sh
-
- # Make a new directory for the perl sources, cd to it, and run kits 1
- # thru 36 through sh. When all 36 kits have been run, read README.
-
- echo "This is perl 4.0 kit 23 (of 36). If kit 23 is complete, the line"
- echo '"'"End of kit 23 (of 36)"'" will echo at the end.'
- echo ""
- export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
- mkdir lib 2>/dev/null
- echo Extracting config_h.SH
- sed >config_h.SH <<'!STUFFY!FUNK!' -e 's/X//'
- X: make config.h.SH
- Xcase $CONFIG in
- X'')
- X if test ! -f config.sh; then
- X ln ../config.sh . || \
- X ln ../../config.sh . || \
- X ln ../../../config.sh . || \
- X (echo "Can't find config.sh."; exit 1)
- X echo "Using config.sh from above..."
- X fi 2>/dev/null
- X . ./config.sh
- X ;;
- Xesac
- Xecho "Extracting config.h (with variable substitutions)"
- Xsed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!'
- X#ifndef config_h
- X#define config_h
- X/* config.h
- X * This file was produced by running the config.h.SH script, which
- X * gets its values from config.sh, which is generally produced by
- X * running Configure.
- X *
- X * Feel free to modify any of this as the need arises. Note, however,
- X * that running config.h.SH again will wipe out any changes you've made.
- X * For a more permanent change edit config.sh and rerun config.h.SH.
- X */
- X
- X
- X/* EUNICE
- X * This symbol, if defined, indicates that the program is being compiled
- X * under the EUNICE package under VMS. The program will need to handle
- X * things like files that don't go away the first time you unlink them,
- X * due to version numbering. It will also need to compensate for lack
- X * of a respectable link() command.
- X */
- X/* VMS
- X * This symbol, if defined, indicates that the program is running under
- X * VMS. It is currently only set in conjunction with the EUNICE symbol.
- X */
- X#$d_eunice EUNICE /**/
- X#$d_eunice VMS /**/
- X
- X/* ALIGNBYTES
- X * This symbol contains the number of bytes required to align a double.
- X * Usual values are 2, 4, and 8.
- X */
- X#define ALIGNBYTES $alignbytes /**/
- X
- X/* BIN
- X * This symbol holds the name of the directory in which the user wants
- X * to keep publicly executable images for the package in question. It
- X * is most often a local directory such as /usr/local/bin.
- X */
- X#define BIN "$bin" /**/
- X
- X/* BYTEORDER
- X * This symbol contains an encoding of the order of bytes in a long.
- X * Usual values (in octal) are 01234, 04321, 02143, 03412...
- X */
- X#define BYTEORDER 0x$byteorder /**/
- X
- X/* CPPSTDIN
- X * This symbol contains the first part of the string which will invoke
- X * the C preprocessor on the standard input and produce to standard
- X * output. Typical value of "cc -E" or "/lib/cpp".
- X */
- X/* CPPMINUS
- X * This symbol contains the second part of the string which will invoke
- X * the C preprocessor on the standard input and produce to standard
- X * output. This symbol will have the value "-" if CPPSTDIN needs a minus
- X * to specify standard input, otherwise the value is "".
- X */
- X#define CPPSTDIN "$cppstdin"
- X#define CPPMINUS "$cppminus"
- X
- X/* HAS_BCMP
- X * This symbol, if defined, indicates that the bcmp routine is available
- X * to compare blocks of memory. If undefined, use memcmp. If that's
- X * not available, roll your own.
- X */
- X#$d_bcmp HAS_BCMP /**/
- X
- X/* HAS_BCOPY
- X * This symbol, if defined, indicates that the bcopy routine is available
- X * to copy blocks of memory. Otherwise you should probably use memcpy().
- X */
- X#$d_bcopy HAS_BCOPY /**/
- X
- X/* HAS_BZERO
- X * This symbol, if defined, indicates that the bzero routine is available
- X * to zero blocks of memory. Otherwise you should probably use memset()
- X * or roll your own.
- X */
- X#$d_bzero HAS_BZERO /**/
- X
- X/* CASTNEGFLOAT
- X * This symbol, if defined, indicates that this C compiler knows how to
- X * cast negative or large floating point numbers to unsigned longs, ints
- X * and shorts.
- X */
- X/* CASTFLAGS
- X * This symbol contains flags that say what difficulties the compiler
- X * has casting odd floating values to unsigned long:
- X * 1 = couldn't cast < 0
- X * 2 = couldn't cast >= 0x80000000
- X */
- X#$d_castneg CASTNEGFLOAT /**/
- X#define CASTFLAGS $castflags /**/
- X
- X/* CHARSPRINTF
- X * This symbol is defined if this system declares "char *sprintf()" in
- X * stdio.h. The trend seems to be to declare it as "int sprintf()". It
- X * is up to the package author to declare sprintf correctly based on the
- X * symbol.
- X */
- X#$d_charsprf CHARSPRINTF /**/
- X
- X/* HAS_CHSIZE
- X * This symbol, if defined, indicates that the chsize routine is available
- X * to truncate files. You might need a -lx to get this routine.
- X */
- X#$d_chsize HAS_CHSIZE /**/
- X
- X/* HAS_CRYPT
- X * This symbol, if defined, indicates that the crypt routine is available
- X * to encrypt passwords and the like.
- X */
- X#$d_crypt HAS_CRYPT /**/
- X
- X/* CSH
- X * This symbol, if defined, indicates that the C-shell exists.
- X * If defined, contains the full pathname of csh.
- X */
- X#$d_csh CSH "$csh" /**/
- X
- X/* DOSUID
- X * This symbol, if defined, indicates that the C program should
- X * check the script that it is executing for setuid/setgid bits, and
- X * attempt to emulate setuid/setgid on systems that have disabled
- X * setuid #! scripts because the kernel can't do it securely.
- X * It is up to the package designer to make sure that this emulation
- X * is done securely. Among other things, it should do an fstat on
- X * the script it just opened to make sure it really is a setuid/setgid
- X * script, it should make sure the arguments passed correspond exactly
- X * to the argument on the #! line, and it should not trust any
- X * subprocesses to which it must pass the filename rather than the
- X * file descriptor of the script to be executed.
- X */
- X#$d_dosuid DOSUID /**/
- X
- X/* HAS_DUP2
- X * This symbol, if defined, indicates that the dup2 routine is available
- X * to dup file descriptors. Otherwise you should use dup().
- X */
- X#$d_dup2 HAS_DUP2 /**/
- X
- X/* HAS_FCHMOD
- X * This symbol, if defined, indicates that the fchmod routine is available
- X * to change mode of opened files. If unavailable, use chmod().
- X */
- X#$d_fchmod HAS_FCHMOD /**/
- X
- X/* HAS_FCHOWN
- X * This symbol, if defined, indicates that the fchown routine is available
- X * to change ownership of opened files. If unavailable, use chown().
- X */
- X#$d_fchown HAS_FCHOWN /**/
- X
- X/* HAS_FCNTL
- X * This symbol, if defined, indicates to the C program that
- X * the fcntl() function exists.
- X */
- X#$d_fcntl HAS_FCNTL /**/
- X
- X/* FLEXFILENAMES
- X * This symbol, if defined, indicates that the system supports filenames
- X * longer than 14 characters.
- X */
- X#$d_flexfnam FLEXFILENAMES /**/
- X
- X/* HAS_FLOCK
- X * This symbol, if defined, indicates that the flock() routine is
- X * available to do file locking.
- X */
- X#$d_flock HAS_FLOCK /**/
- X
- X/* HAS_GETGROUPS
- X * This symbol, if defined, indicates that the getgroups() routine is
- X * available to get the list of process groups. If unavailable, multiple
- X * groups are probably not supported.
- X */
- X#$d_getgrps HAS_GETGROUPS /**/
- X
- X/* HAS_GETHOSTENT
- X * This symbol, if defined, indicates that the gethostent() routine is
- X * available to lookup host names in some data base or other.
- X */
- X#$d_gethent HAS_GETHOSTENT /**/
- X
- X/* HAS_GETPGRP
- X * This symbol, if defined, indicates that the getpgrp() routine is
- X * available to get the current process group.
- X */
- X#$d_getpgrp HAS_GETPGRP /**/
- X
- X/* HAS_GETPGRP2
- X * This symbol, if defined, indicates that the getpgrp2() (as in DG/UX)
- X * routine is available to get the current process group.
- X */
- X#$d_getpgrp2 HAS_GETPGRP2 /**/
- X
- X/* HAS_GETPRIORITY
- X * This symbol, if defined, indicates that the getpriority() routine is
- X * available to get a process's priority.
- X */
- X#$d_getprior HAS_GETPRIORITY /**/
- X
- X/* HAS_HTONS
- X * This symbol, if defined, indicates that the htons routine (and friends)
- X * are available to do network order byte swapping.
- X */
- X/* HAS_HTONL
- X * This symbol, if defined, indicates that the htonl routine (and friends)
- X * are available to do network order byte swapping.
- X */
- X/* HAS_NTOHS
- X * This symbol, if defined, indicates that the ntohs routine (and friends)
- X * are available to do network order byte swapping.
- X */
- X/* HAS_NTOHL
- X * This symbol, if defined, indicates that the ntohl routine (and friends)
- X * are available to do network order byte swapping.
- X */
- X#$d_htonl HAS_HTONS /**/
- X#$d_htonl HAS_HTONL /**/
- X#$d_htonl HAS_NTOHS /**/
- X#$d_htonl HAS_NTOHL /**/
- X
- X/* index
- X * This preprocessor symbol is defined, along with rindex, if the system
- X * uses the strchr and strrchr routines instead.
- X */
- X/* rindex
- X * This preprocessor symbol is defined, along with index, if the system
- X * uses the strchr and strrchr routines instead.
- X */
- X#$d_index index strchr /* cultural */
- X#$d_index rindex strrchr /* differences? */
- X
- X/* HAS_KILLPG
- X * This symbol, if defined, indicates that the killpg routine is available
- X * to kill process groups. If unavailable, you probably should use kill
- X * with a negative process number.
- X */
- X#$d_killpg HAS_KILLPG /**/
- X
- X/* HAS_LSTAT
- X * This symbol, if defined, indicates that the lstat() routine is
- X * available to stat symbolic links.
- X */
- X#$d_lstat HAS_LSTAT /**/
- X
- X/* HAS_MEMCMP
- X * This symbol, if defined, indicates that the memcmp routine is available
- X * to compare blocks of memory. If undefined, roll your own.
- X */
- X#$d_memcmp HAS_MEMCMP /**/
- X
- X/* HAS_MEMCPY
- X * This symbol, if defined, indicates that the memcpy routine is available
- X * to copy blocks of memory. Otherwise you should probably use bcopy().
- X * If neither is defined, roll your own.
- X */
- X#$d_memcpy HAS_MEMCPY /**/
- X
- X/* HAS_MKDIR
- X * This symbol, if defined, indicates that the mkdir routine is available
- X * to create directories. Otherwise you should fork off a new process to
- X * exec /bin/mkdir.
- X */
- X#$d_mkdir HAS_MKDIR /**/
- X
- X/* HAS_MSG
- X * This symbol, if defined, indicates that the entire msg*(2) library is
- X * supported.
- X */
- X#$d_msg HAS_MSG /**/
- X
- X/* HAS_MSGCTL
- X * This symbol, if defined, indicates that the msgctl() routine is
- X * available to stat symbolic links.
- X */
- X#$d_msgctl HAS_MSGCTL /**/
- X
- X/* HAS_MSGGET
- X * This symbol, if defined, indicates that the msgget() routine is
- X * available to stat symbolic links.
- X */
- X#$d_msgget HAS_MSGGET /**/
- X
- X/* HAS_MSGRCV
- X * This symbol, if defined, indicates that the msgrcv() routine is
- X * available to stat symbolic links.
- X */
- X#$d_msgrcv HAS_MSGRCV /**/
- X
- X/* HAS_MSGSND
- X * This symbol, if defined, indicates that the msgsnd() routine is
- X * available to stat symbolic links.
- X */
- X#$d_msgsnd HAS_MSGSND /**/
- X
- X/* HAS_NDBM
- X * This symbol, if defined, indicates that ndbm.h exists and should
- X * be included.
- X */
- X#$d_ndbm HAS_NDBM /**/
- X
- X/* HAS_ODBM
- X * This symbol, if defined, indicates that dbm.h exists and should
- X * be included.
- X */
- X#$d_odbm HAS_ODBM /**/
- X
- X/* HAS_OPEN3
- X * This manifest constant lets the C program know that the three
- X * argument form of open(2) is available.
- X */
- X#$d_open3 HAS_OPEN3 /**/
- X
- X/* HAS_READDIR
- X * This symbol, if defined, indicates that the readdir routine is available
- X * from the C library to read directories.
- X */
- X#$d_readdir HAS_READDIR /**/
- X
- X/* HAS_RENAME
- X * This symbol, if defined, indicates that the rename routine is available
- X * to rename files. Otherwise you should do the unlink(), link(), unlink()
- X * trick.
- X */
- X#$d_rename HAS_RENAME /**/
- X
- X/* HAS_RMDIR
- X * This symbol, if defined, indicates that the rmdir routine is available
- X * to remove directories. Otherwise you should fork off a new process to
- X * exec /bin/rmdir.
- X */
- X#$d_rmdir HAS_RMDIR /**/
- X
- X/* HAS_SELECT
- X * This symbol, if defined, indicates that the select() subroutine
- X * exists.
- X */
- X#$d_select HAS_SELECT /**/
- X
- X/* HAS_SEM
- X * This symbol, if defined, indicates that the entire sem*(2) library is
- X * supported.
- X */
- X#$d_sem HAS_SEM /**/
- X
- X/* HAS_SEMCTL
- X * This symbol, if defined, indicates that the semctl() routine is
- X * available to stat symbolic links.
- X */
- X#$d_semctl HAS_SEMCTL /**/
- X
- X/* HAS_SEMGET
- X * This symbol, if defined, indicates that the semget() routine is
- X * available to stat symbolic links.
- X */
- X#$d_semget HAS_SEMGET /**/
- X
- X/* HAS_SEMOP
- X * This symbol, if defined, indicates that the semop() routine is
- X * available to stat symbolic links.
- X */
- X#$d_semop HAS_SEMOP /**/
- X
- X/* HAS_SETEGID
- X * This symbol, if defined, indicates that the setegid routine is available
- X * to change the effective gid of the current program.
- X */
- X#$d_setegid HAS_SETEGID /**/
- X
- X/* HAS_SETEUID
- X * This symbol, if defined, indicates that the seteuid routine is available
- X * to change the effective uid of the current program.
- X */
- X#$d_seteuid HAS_SETEUID /**/
- X
- X/* HAS_SETPGRP
- X * This symbol, if defined, indicates that the setpgrp() routine is
- X * available to set the current process group.
- X */
- X#$d_setpgrp HAS_SETPGRP /**/
- X
- X/* HAS_SETPGRP2
- X * This symbol, if defined, indicates that the setpgrp2() (as in DG/UX)
- X * routine is available to set the current process group.
- X */
- X#$d_setpgrp2 HAS_SETPGRP2 /**/
- X
- X/* HAS_SETPRIORITY
- X * This symbol, if defined, indicates that the setpriority() routine is
- X * available to set a process's priority.
- X */
- X#$d_setprior HAS_SETPRIORITY /**/
- X
- X/* HAS_SETREGID
- X * This symbol, if defined, indicates that the setregid routine is
- X * available to change the real and effective gid of the current program.
- X */
- X/* HAS_SETRESGID
- X * This symbol, if defined, indicates that the setresgid routine is
- X * available to change the real, effective and saved gid of the current
- X * program.
- X */
- X#$d_setregid HAS_SETREGID /**/
- X#$d_setresgid HAS_SETRESGID /**/
- X
- X/* HAS_SETREUID
- X * This symbol, if defined, indicates that the setreuid routine is
- X * available to change the real and effective uid of the current program.
- X */
- X/* HAS_SETRESUID
- X * This symbol, if defined, indicates that the setresuid routine is
- X * available to change the real, effective and saved uid of the current
- X * program.
- X */
- X#$d_setreuid HAS_SETREUID /**/
- X#$d_setresuid HAS_SETRESUID /**/
- X
- X/* HAS_SETRGID
- X * This symbol, if defined, indicates that the setrgid routine is available
- X * to change the real gid of the current program.
- X */
- X#$d_setrgid HAS_SETRGID /**/
- X
- X/* HAS_SETRUID
- X * This symbol, if defined, indicates that the setruid routine is available
- X * to change the real uid of the current program.
- X */
- X#$d_setruid HAS_SETRUID /**/
- X
- X/* HAS_SHM
- X * This symbol, if defined, indicates that the entire shm*(2) library is
- X * supported.
- X */
- X#$d_shm HAS_SHM /**/
- X
- X/* HAS_SHMAT
- X * This symbol, if defined, indicates that the shmat() routine is
- X * available to stat symbolic links.
- X */
- X#$d_shmat HAS_SHMAT /**/
- X
- X/* HAS_SHMCTL
- X * This symbol, if defined, indicates that the shmctl() routine is
- X * available to stat symbolic links.
- X */
- X#$d_shmctl HAS_SHMCTL /**/
- X
- X/* HAS_SHMDT
- X * This symbol, if defined, indicates that the shmdt() routine is
- X * available to stat symbolic links.
- X */
- X#$d_shmdt HAS_SHMDT /**/
- X
- X/* HAS_SHMGET
- X * This symbol, if defined, indicates that the shmget() routine is
- X * available to stat symbolic links.
- X */
- X#$d_shmget HAS_SHMGET /**/
- X
- X/* HAS_SOCKET
- X * This symbol, if defined, indicates that the BSD socket interface is
- X * supported.
- X */
- X/* HAS_SOCKETPAIR
- X * This symbol, if defined, indicates that the BSD socketpair call is
- X * supported.
- X */
- X/* OLDSOCKET
- X * This symbol, if defined, indicates that the 4.1c BSD socket interface
- X * is supported instead of the 4.2/4.3 BSD socket interface.
- X */
- X#$d_socket HAS_SOCKET /**/
- X
- X#$d_sockpair HAS_SOCKETPAIR /**/
- X
- X#$d_oldsock OLDSOCKET /**/
- X
- X/* STATBLOCKS
- X * This symbol is defined if this system has a stat structure declaring
- X * st_blksize and st_blocks.
- X */
- X#$d_statblks STATBLOCKS /**/
- X
- X/* STDSTDIO
- X * This symbol is defined if this system has a FILE structure declaring
- X * _ptr and _cnt in stdio.h.
- X */
- X#$d_stdstdio STDSTDIO /**/
- X
- X/* STRUCTCOPY
- X * This symbol, if defined, indicates that this C compiler knows how
- X * to copy structures. If undefined, you'll need to use a block copy
- X * routine of some sort instead.
- X */
- X#$d_strctcpy STRUCTCOPY /**/
- X
- X/* HAS_STRERROR
- X * This symbol, if defined, indicates that the strerror() routine is
- X * available to translate error numbers to strings.
- X */
- X#$d_strerror HAS_STRERROR /**/
- X
- X/* HAS_SYMLINK
- X * This symbol, if defined, indicates that the symlink routine is available
- X * to create symbolic links.
- X */
- X#$d_symlink HAS_SYMLINK /**/
- X
- X/* HAS_SYSCALL
- X * This symbol, if defined, indicates that the syscall routine is available
- X * to call arbitrary system calls. If undefined, that's tough.
- X */
- X#$d_syscall HAS_SYSCALL /**/
- X
- X/* HAS_TRUNCATE
- X * This symbol, if defined, indicates that the truncate routine is
- X * available to truncate files.
- X */
- X#$d_truncate HAS_TRUNCATE /**/
- X
- X/* HAS_VFORK
- X * This symbol, if defined, indicates that vfork() exists.
- X */
- X#$d_vfork HAS_VFORK /**/
- X
- X/* VOIDSIG
- X * This symbol is defined if this system declares "void (*signal())()" in
- X * signal.h. The old way was to declare it as "int (*signal())()". It
- X * is up to the package author to declare things correctly based on the
- X * symbol.
- X */
- X/* TO_SIGNAL
- X * This symbol's value is either "void" or "int", corresponding to the
- X * appropriate return "type" of a signal handler. Thus, one can declare
- X * a signal handler using "TO_SIGNAL (*handler())()", and define the
- X * handler using "TO_SIGNAL handler(sig)".
- X */
- X#$d_voidsig VOIDSIG /**/
- X#$define TO_SIGNAL $d_tosignal /**/
- X
- X/* HASVOLATILE
- X * This symbol, if defined, indicates that this C compiler knows about
- X * the volatile declaration.
- X */
- X#$d_volatile HASVOLATILE /**/
- X
- X/* HAS_VPRINTF
- X * This symbol, if defined, indicates that the vprintf routine is available
- X * to printf with a pointer to an argument list. If unavailable, you
- X * may need to write your own, probably in terms of _doprnt().
- X */
- X/* CHARVSPRINTF
- X * This symbol is defined if this system has vsprintf() returning type
- X * (char*). The trend seems to be to declare it as "int vsprintf()". It
- X * is up to the package author to declare vsprintf correctly based on the
- X * symbol.
- X */
- X#$d_vprintf HAS_VPRINTF /**/
- X#$d_charvspr CHARVSPRINTF /**/
- X
- X/* HAS_WAIT4
- X * This symbol, if defined, indicates that wait4() exists.
- X */
- X#$d_wait4 HAS_WAIT4 /**/
- X
- X/* HAS_WAITPID
- X * This symbol, if defined, indicates that waitpid() exists.
- X */
- X#$d_waitpid HAS_WAITPID /**/
- X
- X/* GIDTYPE
- X * This symbol has a value like gid_t, int, ushort, or whatever type is
- X * used to declare group ids in the kernel.
- X */
- X#define GIDTYPE $gidtype /**/
- X
- X/* GROUPSTYPE
- X * This symbol has a value like gid_t, int, ushort, or whatever type is
- X * used in the return value of getgroups().
- X */
- X#define GROUPSTYPE $groupstype /**/
- X
- X/* I_FCNTL
- X * This manifest constant tells the C program to include <fcntl.h>.
- X */
- X#$i_fcntl I_FCNTL /**/
- X
- X/* I_GDBM
- X * This symbol, if defined, indicates that gdbm.h exists and should
- X * be included.
- X */
- X#$i_gdbm I_GDBM /**/
- X
- X/* I_GRP
- X * This symbol, if defined, indicates to the C program that it should
- X * include grp.h.
- X */
- X#$i_grp I_GRP /**/
- X
- X/* I_NETINET_IN
- X * This symbol, if defined, indicates to the C program that it should
- X * include netinet/in.h.
- X */
- X/* I_SYS_IN
- X * This symbol, if defined, indicates to the C program that it should
- X * include sys/in.h.
- X */
- X#$i_niin I_NETINET_IN /**/
- X#$i_sysin I_SYS_IN /**/
- X
- X/* I_PWD
- X * This symbol, if defined, indicates to the C program that it should
- X * include pwd.h.
- X */
- X/* PWQUOTA
- X * This symbol, if defined, indicates to the C program that struct passwd
- X * contains pw_quota.
- X */
- X/* PWAGE
- X * This symbol, if defined, indicates to the C program that struct passwd
- X * contains pw_age.
- X */
- X/* PWCHANGE
- X * This symbol, if defined, indicates to the C program that struct passwd
- X * contains pw_change.
- X */
- X/* PWCLASS
- X * This symbol, if defined, indicates to the C program that struct passwd
- X * contains pw_class.
- X */
- X/* PWEXPIRE
- X * This symbol, if defined, indicates to the C program that struct passwd
- X * contains pw_expire.
- X */
- X/* PWCOMMENT
- X * This symbol, if defined, indicates to the C program that struct passwd
- X * contains pw_comment.
- X */
- X#$i_pwd I_PWD /**/
- X#$d_pwquota PWQUOTA /**/
- X#$d_pwage PWAGE /**/
- X#$d_pwchange PWCHANGE /**/
- X#$d_pwclass PWCLASS /**/
- X#$d_pwexpire PWEXPIRE /**/
- X#$d_pwcomment PWCOMMENT /**/
- X
- X/* I_SYS_FILE
- X * This manifest constant tells the C program to include <sys/file.h>.
- X */
- X#$i_sys_file I_SYS_FILE /**/
- X
- X/* I_SYSIOCTL
- X * This symbol, if defined, indicates that sys/ioctl.h exists and should
- X * be included.
- X */
- X#$i_sysioctl I_SYSIOCTL /**/
- X
- X/* I_TIME
- X * This symbol is defined if the program should include <time.h>.
- X */
- X/* I_SYS_TIME
- X * This symbol is defined if the program should include <sys/time.h>.
- X */
- X/* SYSTIMEKERNEL
- X * This symbol is defined if the program should include <sys/time.h>
- X * with KERNEL defined.
- X */
- X/* I_SYS_SELECT
- X * This symbol is defined if the program should include <sys/select.h>.
- X */
- X#$i_time I_TIME /**/
- X#$i_sys_time I_SYS_TIME /**/
- X#$d_systimekernel SYSTIMEKERNEL /**/
- X#$i_sys_select I_SYS_SELECT /**/
- X
- X/* I_UTIME
- X * This symbol, if defined, indicates to the C program that it should
- X * include utime.h.
- X */
- X#$i_utime I_UTIME /**/
- X
- X/* I_VARARGS
- X * This symbol, if defined, indicates to the C program that it should
- X * include varargs.h.
- X */
- X#$i_varargs I_VARARGS /**/
- X
- X/* I_VFORK
- X * This symbol, if defined, indicates to the C program that it should
- X * include vfork.h.
- X */
- X#$i_vfork I_VFORK /**/
- X
- X/* INTSIZE
- X * This symbol contains the size of an int, so that the C preprocessor
- X * can make decisions based on it.
- X */
- X#define INTSIZE $intsize /**/
- X
- X/* I_DIRENT
- X * This symbol, if defined, indicates that the program should use the
- X * P1003-style directory routines, and include <dirent.h>.
- X */
- X/* I_SYS_DIR
- X * This symbol, if defined, indicates that the program should use the
- X * directory functions by including <sys/dir.h>.
- X */
- X/* I_NDIR
- X * This symbol, if defined, indicates that the program should include the
- X * system's version of ndir.h, rather than the one with this package.
- X */
- X/* I_SYS_NDIR
- X * This symbol, if defined, indicates that the program should include the
- X * system's version of sys/ndir.h, rather than the one with this package.
- X */
- X/* I_MY_DIR
- X * This symbol, if defined, indicates that the program should compile
- X * the ndir.c code provided with the package.
- X */
- X/* DIRNAMLEN
- X * This symbol, if defined, indicates to the C program that the length
- X * of directory entry names is provided by a d_namlen field. Otherwise
- X * you need to do strlen() on the d_name field.
- X */
- X#$i_dirent I_DIRENT /**/
- X#$i_sys_dir I_SYS_DIR /**/
- X#$i_ndir I_NDIR /**/
- X#$i_sys_ndir I_SYS_NDIR /**/
- X#$i_my_dir I_MY_DIR /**/
- X#$d_dirnamlen DIRNAMLEN /**/
- X
- X/* MALLOCPTRTYPE
- X * This symbol defines the kind of ptr returned by malloc and realloc.
- X */
- X#define MALLOCPTRTYPE $mallocptrtype /**/
- X
- X
- X/* RANDBITS
- X * This symbol contains the number of bits of random number the rand()
- X * function produces. Usual values are 15, 16, and 31.
- X */
- X#define RANDBITS $randbits /**/
- X
- X/* SCRIPTDIR
- X * This symbol holds the name of the directory in which the user wants
- X * to put publicly executable scripts for the package in question. It
- X * is often a directory that is mounted across diverse architectures.
- X */
- X#define SCRIPTDIR "$scriptdir" /**/
- X
- X/* SIG_NAME
- X * This symbol contains an list of signal names in order.
- X */
- X#define SIG_NAME "`echo $sig_name | sed 's/ /","/g'`" /**/
- X
- X/* STDCHAR
- X * This symbol is defined to be the type of char used in stdio.h.
- X * It has the values "unsigned char" or "char".
- X */
- X#define STDCHAR $stdchar /**/
- X
- X/* UIDTYPE
- X * This symbol has a value like uid_t, int, ushort, or whatever type is
- X * used to declare user ids in the kernel.
- X */
- X#define UIDTYPE $uidtype /**/
- X
- X/* VOIDHAVE
- X * This symbol indicates how much support of the void type is given by this
- X * compiler. What various bits mean:
- X *
- X * 1 = supports declaration of void
- X * 2 = supports arrays of pointers to functions returning void
- X * 4 = supports comparisons between pointers to void functions and
- X * addresses of void functions
- X *
- X * The package designer should define VOIDWANT to indicate the requirements
- X * of the package. This can be done either by #defining VOIDWANT before
- X * including config.h, or by defining voidwant in Myinit.U. If the level
- X * of void support necessary is not present, config.h defines void to "int",
- X * VOID to the empty string, and VOIDP to "char *".
- X */
- X/* void
- X * This symbol is used for void casts. On implementations which support
- X * void appropriately, its value is "void". Otherwise, its value maps
- X * to "int".
- X */
- X/* VOID
- X * This symbol's value is "void" if the implementation supports void
- X * appropriately. Otherwise, its value is the empty string. The primary
- X * use of this symbol is in specifying void parameter lists for function
- X * prototypes.
- X */
- X/* VOIDP
- X * This symbol is used for casting generic pointers. On implementations
- X * which support void appropriately, its value is "void *". Otherwise,
- X * its value is "char *".
- X */
- X#ifndef VOIDWANT
- X#define VOIDWANT $voidwant
- X#endif
- X#define VOIDHAVE $voidhave
- X#if (VOIDHAVE & VOIDWANT) != VOIDWANT
- X#define void int /* is void to be avoided? */
- X#define VOID
- X#define VOIDP (char *)
- X#define M_VOID /* Xenix strikes again */
- X#else
- X#define VOID void
- X#define VOIDP (void *)
- X#endif
- X
- X/* PRIVLIB
- X * This symbol contains the name of the private library for this package.
- X * The library is private in the sense that it needn't be in anyone's
- X * execution path, but it should be accessible by the world. The program
- X * should be prepared to do ~ expansion.
- X */
- X#define PRIVLIB "$privlib" /**/
- X
- X#endif
- X!GROK!THIS!
- !STUFFY!FUNK!
- echo Extracting eval.c:AB
- sed >eval.c:AB <<'!STUFFY!FUNK!' -e 's/X//'
- X anum = sp - arglast[0];
- X switch (anum) {
- X case 0:
- X deb("%s RETURNS ()\n",opname[optype]);
- X break;
- X case 1:
- X deb("%s RETURNS (\"%s\")\n",opname[optype],str_get(st[1]));
- X break;
- X default:
- X tmps = str_get(st[1]);
- X deb("%s RETURNS %d ARGS (\"%s\",%s\"%s\")\n",opname[optype],
- X anum,tmps,anum==2?"":"...,",str_get(st[anum]));
- X break;
- X }
- X }
- X }
- X#endif
- X return sp;
- X
- Xsay_yes:
- X str = &str_yes;
- X goto normal_return;
- X
- Xsay_no:
- X str = &str_no;
- X goto normal_return;
- X
- Xsay_undef:
- X str = &str_undef;
- X goto normal_return;
- X
- Xsay_zero:
- X value = 0.0;
- X /* FALL THROUGH */
- X
- Xdonumset:
- X str_numset(str,value);
- X STABSET(str);
- X st[1] = str;
- X#ifdef DEBUGGING
- X if (debug) {
- X dlevel--;
- X if (debug & 8)
- X deb("%s RETURNS \"%f\"\n",opname[optype],value);
- X }
- X#endif
- X return arglast[0] + 1;
- X#ifdef SMALLSWITCHES
- X }
- X else
- X switch (optype) {
- X#endif
- X case O_CHOWN:
- X#ifdef HAS_CHOWN
- X value = (double)apply(optype,arglast);
- X goto donumset;
- X#else
- X fatal("Unsupported function chown");
- X break;
- X#endif
- X case O_KILL:
- X#ifdef HAS_KILL
- X value = (double)apply(optype,arglast);
- X goto donumset;
- X#else
- X fatal("Unsupported function kill");
- X break;
- X#endif
- X case O_UNLINK:
- X case O_CHMOD:
- X case O_UTIME:
- X value = (double)apply(optype,arglast);
- X goto donumset;
- X case O_UMASK:
- X#ifdef HAS_UMASK
- X if (maxarg < 1) {
- X anum = umask(0);
- X (void)umask(anum);
- X }
- X else
- X anum = umask((int)str_gnum(st[1]));
- X value = (double)anum;
- X#ifdef TAINT
- X taintproper("Insecure dependency in umask");
- X#endif
- X goto donumset;
- X#else
- X fatal("Unsupported function umask");
- X break;
- X#endif
- X#if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
- X case O_MSGGET:
- X case O_SHMGET:
- X case O_SEMGET:
- X if ((anum = do_ipcget(optype, arglast)) == -1)
- X goto say_undef;
- X value = (double)anum;
- X goto donumset;
- X case O_MSGCTL:
- X case O_SHMCTL:
- X case O_SEMCTL:
- X anum = do_ipcctl(optype, arglast);
- X if (anum == -1)
- X goto say_undef;
- X if (anum != 0) {
- X value = (double)anum;
- X goto donumset;
- X }
- X str_set(str,"0 but true");
- X STABSET(str);
- X break;
- X case O_MSGSND:
- X value = (double)(do_msgsnd(arglast) >= 0);
- X goto donumset;
- X case O_MSGRCV:
- X value = (double)(do_msgrcv(arglast) >= 0);
- X goto donumset;
- X case O_SEMOP:
- X value = (double)(do_semop(arglast) >= 0);
- X goto donumset;
- X case O_SHMREAD:
- X case O_SHMWRITE:
- X value = (double)(do_shmio(optype, arglast) >= 0);
- X goto donumset;
- X#else /* not SYSVIPC */
- X case O_MSGGET:
- X case O_MSGCTL:
- X case O_MSGSND:
- X case O_MSGRCV:
- X case O_SEMGET:
- X case O_SEMCTL:
- X case O_SEMOP:
- X case O_SHMGET:
- X case O_SHMCTL:
- X case O_SHMREAD:
- X case O_SHMWRITE:
- X fatal("System V IPC is not implemented on this machine");
- X#endif /* not SYSVIPC */
- X case O_RENAME:
- X tmps = str_get(st[1]);
- X tmps2 = str_get(st[2]);
- X#ifdef TAINT
- X taintproper("Insecure dependency in rename");
- X#endif
- X#ifdef HAS_RENAME
- X value = (double)(rename(tmps,tmps2) >= 0);
- X#else
- X if (same_dirent(tmps2, tmps)) /* can always rename to same name */
- X anum = 1;
- X else {
- X if (euid || stat(tmps2,&statbuf) < 0 || !S_ISDIR(statbuf.st_mode))
- X (void)UNLINK(tmps2);
- X if (!(anum = link(tmps,tmps2)))
- X anum = UNLINK(tmps);
- X }
- X value = (double)(anum >= 0);
- X#endif
- X goto donumset;
- X case O_LINK:
- X#ifdef HAS_LINK
- X tmps = str_get(st[1]);
- X tmps2 = str_get(st[2]);
- X#ifdef TAINT
- X taintproper("Insecure dependency in link");
- X#endif
- X value = (double)(link(tmps,tmps2) >= 0);
- X goto donumset;
- X#else
- X fatal("Unsupported function link");
- X break;
- X#endif
- X case O_MKDIR:
- X tmps = str_get(st[1]);
- X anum = (int)str_gnum(st[2]);
- X#ifdef TAINT
- X taintproper("Insecure dependency in mkdir");
- X#endif
- X#ifdef HAS_MKDIR
- X value = (double)(mkdir(tmps,anum) >= 0);
- X goto donumset;
- X#else
- X (void)strcpy(buf,"mkdir ");
- X#endif
- X#if !defined(HAS_MKDIR) || !defined(HAS_RMDIR)
- X one_liner:
- X for (tmps2 = buf+6; *tmps; ) {
- X *tmps2++ = '\\';
- X *tmps2++ = *tmps++;
- X }
- X (void)strcpy(tmps2," 2>&1");
- X rsfp = mypopen(buf,"r");
- X if (rsfp) {
- X *buf = '\0';
- X tmps2 = fgets(buf,sizeof buf,rsfp);
- X (void)mypclose(rsfp);
- X if (tmps2 != Nullch) {
- X for (errno = 1; errno < sys_nerr; errno++) {
- X if (instr(buf,sys_errlist[errno])) /* you don't see this */
- X goto say_zero;
- X }
- X errno = 0;
- X#ifndef EACCES
- X#define EACCES EPERM
- X#endif
- X if (instr(buf,"cannot make"))
- X errno = EEXIST;
- X else if (instr(buf,"existing file"))
- X errno = EEXIST;
- X else if (instr(buf,"ile exists"))
- X errno = EEXIST;
- X else if (instr(buf,"non-exist"))
- X errno = ENOENT;
- X else if (instr(buf,"does not exist"))
- X errno = ENOENT;
- X else if (instr(buf,"not empty"))
- X errno = EBUSY;
- X else if (instr(buf,"cannot access"))
- X errno = EACCES;
- X else
- X errno = EPERM;
- X goto say_zero;
- X }
- X else { /* some mkdirs return no failure indication */
- X tmps = str_get(st[1]);
- X anum = (stat(tmps,&statbuf) >= 0);
- X if (optype == O_RMDIR)
- X anum = !anum;
- X if (anum)
- X errno = 0;
- X else
- X errno = EACCES; /* a guess */
- X value = (double)anum;
- X }
- X goto donumset;
- X }
- X else
- X goto say_zero;
- X#endif
- X case O_RMDIR:
- X if (maxarg < 1)
- X tmps = str_get(stab_val(defstab));
- X else
- X tmps = str_get(st[1]);
- X#ifdef TAINT
- X taintproper("Insecure dependency in rmdir");
- X#endif
- X#ifdef HAS_RMDIR
- X value = (double)(rmdir(tmps) >= 0);
- X goto donumset;
- X#else
- X (void)strcpy(buf,"rmdir ");
- X goto one_liner; /* see above in HAS_MKDIR */
- X#endif
- X case O_GETPPID:
- X#ifdef HAS_GETPPID
- X value = (double)getppid();
- X goto donumset;
- X#else
- X fatal("Unsupported function getppid");
- X break;
- X#endif
- X case O_GETPGRP:
- X#ifdef HAS_GETPGRP
- X if (maxarg < 1)
- X anum = 0;
- X else
- X anum = (int)str_gnum(st[1]);
- X value = (double)getpgrp(anum);
- X goto donumset;
- X#else
- X fatal("The getpgrp() function is unimplemented on this machine");
- X break;
- X#endif
- X case O_SETPGRP:
- X#ifdef HAS_SETPGRP
- X argtype = (int)str_gnum(st[1]);
- X anum = (int)str_gnum(st[2]);
- X#ifdef TAINT
- X taintproper("Insecure dependency in setpgrp");
- X#endif
- X value = (double)(setpgrp(argtype,anum) >= 0);
- X goto donumset;
- X#else
- X fatal("The setpgrp() function is unimplemented on this machine");
- X break;
- X#endif
- X case O_GETPRIORITY:
- X#ifdef HAS_GETPRIORITY
- X argtype = (int)str_gnum(st[1]);
- X anum = (int)str_gnum(st[2]);
- X value = (double)getpriority(argtype,anum);
- X goto donumset;
- X#else
- X fatal("The getpriority() function is unimplemented on this machine");
- X break;
- X#endif
- X case O_SETPRIORITY:
- X#ifdef HAS_SETPRIORITY
- X argtype = (int)str_gnum(st[1]);
- X anum = (int)str_gnum(st[2]);
- X optype = (int)str_gnum(st[3]);
- X#ifdef TAINT
- X taintproper("Insecure dependency in setpriority");
- X#endif
- X value = (double)(setpriority(argtype,anum,optype) >= 0);
- X goto donumset;
- X#else
- X fatal("The setpriority() function is unimplemented on this machine");
- X break;
- X#endif
- X case O_CHROOT:
- X#ifdef HAS_CHROOT
- X if (maxarg < 1)
- X tmps = str_get(stab_val(defstab));
- X else
- X tmps = str_get(st[1]);
- X#ifdef TAINT
- X taintproper("Insecure dependency in chroot");
- X#endif
- X value = (double)(chroot(tmps) >= 0);
- X goto donumset;
- X#else
- X fatal("Unsupported function chroot");
- X break;
- X#endif
- X case O_FCNTL:
- X case O_IOCTL:
- X if (maxarg <= 0)
- X stab = last_in_stab;
- X else if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X argtype = U_I(str_gnum(st[2]));
- X#ifdef TAINT
- X taintproper("Insecure dependency in ioctl");
- X#endif
- X anum = do_ctl(optype,stab,argtype,st[3]);
- X if (anum == -1)
- X goto say_undef;
- X if (anum != 0) {
- X value = (double)anum;
- X goto donumset;
- X }
- X str_set(str,"0 but true");
- X STABSET(str);
- X break;
- X case O_FLOCK:
- X#ifdef HAS_FLOCK
- X if (maxarg <= 0)
- X stab = last_in_stab;
- X else if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X if (stab && stab_io(stab))
- X fp = stab_io(stab)->ifp;
- X else
- X fp = Nullfp;
- X if (fp) {
- X argtype = (int)str_gnum(st[2]);
- X value = (double)(flock(fileno(fp),argtype) >= 0);
- X }
- X else
- X value = 0;
- X goto donumset;
- X#else
- X fatal("The flock() function is unimplemented on this machine");
- X break;
- X#endif
- X case O_UNSHIFT:
- X ary = stab_array(arg[1].arg_ptr.arg_stab);
- X if (arglast[2] - arglast[1] != 1)
- X do_unshift(ary,arglast);
- X else {
- X STR *tmpstr = Str_new(52,0); /* must copy the STR */
- X str_sset(tmpstr,st[2]);
- X aunshift(ary,1);
- X (void)astore(ary,0,tmpstr);
- X }
- X value = (double)(ary->ary_fill + 1);
- X goto donumset;
- X
- X case O_REQUIRE:
- X case O_DOFILE:
- X case O_EVAL:
- X if (maxarg < 1)
- X tmpstr = stab_val(defstab);
- X else
- X tmpstr =
- X (arg[1].arg_type & A_MASK) != A_NULL ? st[1] : stab_val(defstab);
- X#ifdef TAINT
- X tainted |= tmpstr->str_tainted;
- X taintproper("Insecure dependency in eval");
- X#endif
- X sp = do_eval(tmpstr, optype, curcmd->c_stash,
- X gimme,arglast);
- X goto array_return;
- X
- X case O_FTRREAD:
- X argtype = 0;
- X anum = S_IRUSR;
- X goto check_perm;
- X case O_FTRWRITE:
- X argtype = 0;
- X anum = S_IWUSR;
- X goto check_perm;
- X case O_FTREXEC:
- X argtype = 0;
- X anum = S_IXUSR;
- X goto check_perm;
- X case O_FTEREAD:
- X argtype = 1;
- X anum = S_IRUSR;
- X goto check_perm;
- X case O_FTEWRITE:
- X argtype = 1;
- X anum = S_IWUSR;
- X goto check_perm;
- X case O_FTEEXEC:
- X argtype = 1;
- X anum = S_IXUSR;
- X check_perm:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (cando(anum,argtype,&statcache))
- X goto say_yes;
- X goto say_no;
- X
- X case O_FTIS:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X goto say_yes;
- X case O_FTEOWNED:
- X case O_FTROWNED:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (statcache.st_uid == (optype == O_FTEOWNED ? euid : uid) )
- X goto say_yes;
- X goto say_no;
- X case O_FTZERO:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (!statcache.st_size)
- X goto say_yes;
- X goto say_no;
- X case O_FTSIZE:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X value = (double)statcache.st_size;
- X goto donumset;
- X
- X case O_FTMTIME:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X value = (double)(basetime - statcache.st_mtime) / 86400.0;
- X goto donumset;
- X case O_FTATIME:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X value = (double)(basetime - statcache.st_atime) / 86400.0;
- X goto donumset;
- X case O_FTCTIME:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X value = (double)(basetime - statcache.st_ctime) / 86400.0;
- X goto donumset;
- X
- X case O_FTSOCK:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (S_ISSOCK(statcache.st_mode))
- X goto say_yes;
- X goto say_no;
- X case O_FTCHR:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (S_ISCHR(statcache.st_mode))
- X goto say_yes;
- X goto say_no;
- X case O_FTBLK:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (S_ISBLK(statcache.st_mode))
- X goto say_yes;
- X goto say_no;
- X case O_FTFILE:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (S_ISREG(statcache.st_mode))
- X goto say_yes;
- X goto say_no;
- X case O_FTDIR:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (S_ISDIR(statcache.st_mode))
- X goto say_yes;
- X goto say_no;
- X case O_FTPIPE:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (S_ISFIFO(statcache.st_mode))
- X goto say_yes;
- X goto say_no;
- X case O_FTLINK:
- X if (mylstat(arg,st[1]) < 0)
- X goto say_undef;
- X if (S_ISLNK(statcache.st_mode))
- X goto say_yes;
- X goto say_no;
- X case O_SYMLINK:
- X#ifdef HAS_SYMLINK
- X tmps = str_get(st[1]);
- X tmps2 = str_get(st[2]);
- X#ifdef TAINT
- X taintproper("Insecure dependency in symlink");
- X#endif
- X value = (double)(symlink(tmps,tmps2) >= 0);
- X goto donumset;
- X#else
- X fatal("Unsupported function symlink");
- X#endif
- X case O_READLINK:
- X#ifdef HAS_SYMLINK
- X if (maxarg < 1)
- X tmps = str_get(stab_val(defstab));
- X else
- X tmps = str_get(st[1]);
- X anum = readlink(tmps,buf,sizeof buf);
- X if (anum < 0)
- X goto say_undef;
- X str_nset(str,buf,anum);
- X break;
- X#else
- X goto say_undef; /* just pretend it's a normal file */
- X#endif
- X case O_FTSUID:
- X#ifdef S_ISUID
- X anum = S_ISUID;
- X goto check_xid;
- X#else
- X goto say_no;
- X#endif
- X case O_FTSGID:
- X#ifdef S_ISGID
- X anum = S_ISGID;
- X goto check_xid;
- X#else
- X goto say_no;
- X#endif
- X case O_FTSVTX:
- X#ifdef S_ISVTX
- X anum = S_ISVTX;
- X#else
- X goto say_no;
- X#endif
- X check_xid:
- X if (mystat(arg,st[1]) < 0)
- X goto say_undef;
- X if (statcache.st_mode & anum)
- X goto say_yes;
- X goto say_no;
- X case O_FTTTY:
- X if (arg[1].arg_type & A_DONT) {
- X stab = arg[1].arg_ptr.arg_stab;
- X tmps = "";
- X }
- X else
- X stab = stabent(tmps = str_get(st[1]),FALSE);
- X if (stab && stab_io(stab) && stab_io(stab)->ifp)
- X anum = fileno(stab_io(stab)->ifp);
- X else if (isdigit(*tmps))
- X anum = atoi(tmps);
- X else
- X goto say_undef;
- X if (isatty(anum))
- X goto say_yes;
- X goto say_no;
- X case O_FTTEXT:
- X case O_FTBINARY:
- X str = do_fttext(arg,st[1]);
- X break;
- X#ifdef HAS_SOCKET
- X case O_SOCKET:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X#ifndef lint
- X value = (double)do_socket(stab,arglast);
- X#else
- X (void)do_socket(stab,arglast);
- X#endif
- X goto donumset;
- X case O_BIND:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X#ifndef lint
- X value = (double)do_bind(stab,arglast);
- X#else
- X (void)do_bind(stab,arglast);
- X#endif
- X goto donumset;
- X case O_CONNECT:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X#ifndef lint
- X value = (double)do_connect(stab,arglast);
- X#else
- X (void)do_connect(stab,arglast);
- X#endif
- X goto donumset;
- X case O_LISTEN:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X#ifndef lint
- X value = (double)do_listen(stab,arglast);
- X#else
- X (void)do_listen(stab,arglast);
- X#endif
- X goto donumset;
- X case O_ACCEPT:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X if ((arg[2].arg_type & A_MASK) == A_WORD)
- X stab2 = arg[2].arg_ptr.arg_stab;
- X else
- X stab2 = stabent(str_get(st[2]),TRUE);
- X do_accept(str,stab,stab2);
- X STABSET(str);
- X break;
- X case O_GHBYNAME:
- X if (maxarg < 1)
- X goto say_undef;
- X case O_GHBYADDR:
- X case O_GHOSTENT:
- X sp = do_ghent(optype,
- X gimme,arglast);
- X goto array_return;
- X case O_GNBYNAME:
- X if (maxarg < 1)
- X goto say_undef;
- X case O_GNBYADDR:
- X case O_GNETENT:
- X sp = do_gnent(optype,
- X gimme,arglast);
- X goto array_return;
- X case O_GPBYNAME:
- X if (maxarg < 1)
- X goto say_undef;
- X case O_GPBYNUMBER:
- X case O_GPROTOENT:
- X sp = do_gpent(optype,
- X gimme,arglast);
- X goto array_return;
- X case O_GSBYNAME:
- X if (maxarg < 1)
- X goto say_undef;
- X case O_GSBYPORT:
- X case O_GSERVENT:
- X sp = do_gsent(optype,
- X gimme,arglast);
- X goto array_return;
- X case O_SHOSTENT:
- X value = (double) sethostent((int)str_gnum(st[1]));
- X goto donumset;
- X case O_SNETENT:
- X value = (double) setnetent((int)str_gnum(st[1]));
- X goto donumset;
- X case O_SPROTOENT:
- X value = (double) setprotoent((int)str_gnum(st[1]));
- X goto donumset;
- X case O_SSERVENT:
- X value = (double) setservent((int)str_gnum(st[1]));
- X goto donumset;
- X case O_EHOSTENT:
- X value = (double) endhostent();
- X goto donumset;
- X case O_ENETENT:
- X value = (double) endnetent();
- X goto donumset;
- X case O_EPROTOENT:
- X value = (double) endprotoent();
- X goto donumset;
- X case O_ESERVENT:
- X value = (double) endservent();
- X goto donumset;
- X case O_SOCKPAIR:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X if ((arg[2].arg_type & A_MASK) == A_WORD)
- X stab2 = arg[2].arg_ptr.arg_stab;
- X else
- X stab2 = stabent(str_get(st[2]),TRUE);
- X#ifndef lint
- X value = (double)do_spair(stab,stab2,arglast);
- X#else
- X (void)do_spair(stab,stab2,arglast);
- X#endif
- X goto donumset;
- X case O_SHUTDOWN:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X#ifndef lint
- X value = (double)do_shutdown(stab,arglast);
- X#else
- X (void)do_shutdown(stab,arglast);
- X#endif
- X goto donumset;
- X case O_GSOCKOPT:
- X case O_SSOCKOPT:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X sp = do_sopt(optype,stab,arglast);
- X goto array_return;
- X case O_GETSOCKNAME:
- X case O_GETPEERNAME:
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X if (!stab)
- X goto say_undef;
- X sp = do_getsockname(optype,stab,arglast);
- X goto array_return;
- X
- X#else /* HAS_SOCKET not defined */
- X case O_SOCKET:
- X case O_BIND:
- X case O_CONNECT:
- X case O_LISTEN:
- X case O_ACCEPT:
- X case O_SOCKPAIR:
- X case O_GHBYNAME:
- X case O_GHBYADDR:
- X case O_GHOSTENT:
- X case O_GNBYNAME:
- X case O_GNBYADDR:
- X case O_GNETENT:
- X case O_GPBYNAME:
- X case O_GPBYNUMBER:
- X case O_GPROTOENT:
- X case O_GSBYNAME:
- X case O_GSBYPORT:
- X case O_GSERVENT:
- X case O_SHOSTENT:
- X case O_SNETENT:
- X case O_SPROTOENT:
- X case O_SSERVENT:
- X case O_EHOSTENT:
- X case O_ENETENT:
- X case O_EPROTOENT:
- X case O_ESERVENT:
- X case O_SHUTDOWN:
- X case O_GSOCKOPT:
- X case O_SSOCKOPT:
- X case O_GETSOCKNAME:
- X case O_GETPEERNAME:
- X badsock:
- X fatal("Unsupported socket function");
- X#endif /* HAS_SOCKET */
- X case O_SSELECT:
- X#ifdef HAS_SELECT
- X sp = do_select(gimme,arglast);
- X goto array_return;
- X#else
- X fatal("select not implemented");
- X#endif
- X case O_FILENO:
- X if (maxarg < 1)
- X goto say_undef;
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X if (!stab || !(stio = stab_io(stab)) || !(fp = stio->ifp))
- X goto say_undef;
- X value = fileno(fp);
- X goto donumset;
- X case O_BINMODE:
- X if (maxarg < 1)
- X goto say_undef;
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X if (!stab || !(stio = stab_io(stab)) || !(fp = stio->ifp))
- X goto say_undef;
- X#ifdef MSDOS
- X str_set(str, (setmode(fileno(fp), O_BINARY) != -1) ? Yes : No);
- X#else
- X str_set(str, Yes);
- X#endif
- X STABSET(str);
- X break;
- X case O_VEC:
- X sp = do_vec(str == st[1], arg->arg_ptr.arg_str, arglast);
- X goto array_return;
- X case O_GPWNAM:
- X case O_GPWUID:
- X case O_GPWENT:
- X#ifdef HAS_PASSWD
- X sp = do_gpwent(optype,
- X gimme,arglast);
- X goto array_return;
- X case O_SPWENT:
- X value = (double) setpwent();
- X goto donumset;
- X case O_EPWENT:
- X value = (double) endpwent();
- X goto donumset;
- X#else
- X case O_EPWENT:
- X case O_SPWENT:
- X fatal("Unsupported password function");
- X break;
- X#endif
- X case O_GGRNAM:
- X case O_GGRGID:
- X case O_GGRENT:
- X#ifdef HAS_GROUP
- X sp = do_ggrent(optype,
- X gimme,arglast);
- X goto array_return;
- X case O_SGRENT:
- X value = (double) setgrent();
- X goto donumset;
- X case O_EGRENT:
- X value = (double) endgrent();
- X goto donumset;
- X#else
- X case O_EGRENT:
- X case O_SGRENT:
- X fatal("Unsupported group function");
- X break;
- X#endif
- X case O_GETLOGIN:
- X#ifdef HAS_GETLOGIN
- X if (!(tmps = getlogin()))
- X goto say_undef;
- X str_set(str,tmps);
- X#else
- X fatal("Unsupported function getlogin");
- X#endif
- X break;
- X case O_OPENDIR:
- X case O_READDIR:
- X case O_TELLDIR:
- X case O_SEEKDIR:
- X case O_REWINDDIR:
- X case O_CLOSEDIR:
- X if (maxarg < 1)
- X goto say_undef;
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X if (!stab)
- X goto say_undef;
- X sp = do_dirop(optype,stab,gimme,arglast);
- X goto array_return;
- X case O_SYSCALL:
- X value = (double)do_syscall(arglast);
- X goto donumset;
- X case O_PIPE:
- X#ifdef HAS_PIPE
- X if ((arg[1].arg_type & A_MASK) == A_WORD)
- X stab = arg[1].arg_ptr.arg_stab;
- X else
- X stab = stabent(str_get(st[1]),TRUE);
- X if ((arg[2].arg_type & A_MASK) == A_WORD)
- X stab2 = arg[2].arg_ptr.arg_stab;
- X else
- X stab2 = stabent(str_get(st[2]),TRUE);
- X do_pipe(str,stab,stab2);
- X STABSET(str);
- X#else
- X fatal("Unsupported function pipe");
- X#endif
- X break;
- X }
- X
- X normal_return:
- X st[1] = str;
- X#ifdef DEBUGGING
- X if (debug) {
- X dlevel--;
- X if (debug & 8)
- X deb("%s RETURNS \"%s\"\n",opname[optype],str_get(str));
- X }
- X#endif
- X return arglast[0] + 1;
- X}
- !STUFFY!FUNK!
- echo Extracting lib/ctime.pl
- sed >lib/ctime.pl <<'!STUFFY!FUNK!' -e 's/X//'
- X;# ctime.pl is a simple Perl emulation for the well known ctime(3C) function.
- X;#
- X;# Waldemar Kebsch, Federal Republic of Germany, November 1988
- X;# kebsch.pad@nixpbe.UUCP
- X;# Modified March 1990, Feb 1991 to properly handle timezones
- X;# $Id: ctime.pl,v 1.8 91/02/04 18:28:12 hakanson Exp $
- X;# Marion Hakanson (hakanson@cse.ogi.edu)
- X;# Oregon Graduate Institute of Science and Technology
- X;#
- X;# usage:
- X;#
- X;# #include <ctime.pl> # see the -P and -I option in perl.man
- X;# $Date = &ctime(time);
- X
- XCONFIG: {
- X package ctime;
- X
- X @DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
- X @MoY = ('Jan','Feb','Mar','Apr','May','Jun',
- X 'Jul','Aug','Sep','Oct','Nov','Dec');
- X}
- X
- Xsub ctime {
- X package ctime;
- X
- X local($time) = @_;
- X local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
- X
- X # Determine what time zone is in effect.
- X # Use GMT if TZ is defined as null, local time if TZ undefined.
- X # There's no portable way to find the system default timezone.
- X
- X $TZ = defined($ENV{'TZ'}) ? ( $ENV{'TZ'} ? $ENV{'TZ'} : 'GMT' ) : '';
- X ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
- X ($TZ eq 'GMT') ? gmtime($time) : localtime($time);
- X
- X # Hack to deal with 'PST8PDT' format of TZ
- X # Note that this can't deal with all the esoteric forms, but it
- X # does recognize the most common: [:]STDoff[DST[off][,rule]]
- X
- X if($TZ=~/^([^:\d+\-,]{3,})([+-]?\d{1,2}(:\d{1,2}){0,2})([^\d+\-,]{3,})?/){
- X $TZ = $isdst ? $4 : $1;
- X }
- X $TZ .= ' ' unless $TZ eq '';
- X
- X $year += ($year < 70) ? 2000 : 1900;
- X sprintf("%s %s %2d %2d:%02d:%02d %s%4d\n",
- X $DoW[$wday], $MoY[$mon], $mday, $hour, $min, $sec, $TZ, $year);
- X}
- X1;
- !STUFFY!FUNK!
- echo " "
- echo "End of kit 23 (of 36)"
- cat /dev/null >kit23isdone
- run=''
- config=''
- for iskit in 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; do
- if test -f kit${iskit}isdone; then
- run="$run $iskit"
- else
- todo="$todo $iskit"
- fi
- done
- case $todo in
- '')
- echo "You have run all your kits. Please read README and then type Configure."
- for combo in *:AA; do
- if test -f "$combo"; then
- realfile=`basename $combo :AA`
- cat $realfile:[A-Z][A-Z] >$realfile
- rm -rf $realfile:[A-Z][A-Z]
- fi
- done
- rm -rf kit*isdone
- chmod 755 Configure
- ;;
- *) echo "You have run$run."
- echo "You still need to run$todo."
- ;;
- esac
- : Someone might mail this, so...
- exit
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-