home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume18 / perl / part23 < prev    next >
Encoding:
Internet Message Format  |  1991-04-16  |  49.4 KB

  1. From: lwall@netlabs.com (Larry Wall)
  2. Newsgroups: comp.sources.misc
  3. Subject: v18i041:  perl - The perl programming language, Part23/36
  4. Message-ID: <1991Apr16.185605.1295@sparky.IMD.Sterling.COM>
  5. Date: 16 Apr 91 18:56:05 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: afd9e8ac ccc0b5cb ab2afe74 4c672184
  8.  
  9. Submitted-by: Larry Wall <lwall@netlabs.com>
  10. Posting-number: Volume 18, Issue 41
  11. Archive-name: perl/part23
  12.  
  13. [There are 36 kits for perl version 4.0.]
  14.  
  15. #! /bin/sh
  16.  
  17. # Make a new directory for the perl sources, cd to it, and run kits 1
  18. # thru 36 through sh.  When all 36 kits have been run, read README.
  19.  
  20. echo "This is perl 4.0 kit 23 (of 36).  If kit 23 is complete, the line"
  21. echo '"'"End of kit 23 (of 36)"'" will echo at the end.'
  22. echo ""
  23. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  24. mkdir lib 2>/dev/null
  25. echo Extracting config_h.SH
  26. sed >config_h.SH <<'!STUFFY!FUNK!' -e 's/X//'
  27. X: make config.h.SH
  28. Xcase $CONFIG in
  29. X'')
  30. X    if test ! -f config.sh; then
  31. X    ln ../config.sh . || \
  32. X    ln ../../config.sh . || \
  33. X    ln ../../../config.sh . || \
  34. X    (echo "Can't find config.sh."; exit 1)
  35. X    echo "Using config.sh from above..."
  36. X    fi 2>/dev/null
  37. X    . ./config.sh
  38. X    ;;
  39. Xesac
  40. Xecho "Extracting config.h (with variable substitutions)"
  41. Xsed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!'
  42. X#ifndef config_h
  43. X#define config_h
  44. X/* config.h
  45. X * This file was produced by running the config.h.SH script, which
  46. X * gets its values from config.sh, which is generally produced by
  47. X * running Configure.
  48. X *
  49. X * Feel free to modify any of this as the need arises.  Note, however,
  50. X * that running config.h.SH again will wipe out any changes you've made.
  51. X * For a more permanent change edit config.sh and rerun config.h.SH.
  52. X */
  53. X
  54. X
  55. X/* EUNICE
  56. X *    This symbol, if defined, indicates that the program is being compiled
  57. X *    under the EUNICE package under VMS.  The program will need to handle
  58. X *    things like files that don't go away the first time you unlink them,
  59. X *    due to version numbering.  It will also need to compensate for lack
  60. X *    of a respectable link() command.
  61. X */
  62. X/* VMS
  63. X *    This symbol, if defined, indicates that the program is running under
  64. X *    VMS.  It is currently only set in conjunction with the EUNICE symbol.
  65. X */
  66. X#$d_eunice    EUNICE        /**/
  67. X#$d_eunice    VMS        /**/
  68. X
  69. X/* ALIGNBYTES
  70. X *    This symbol contains the number of bytes required to align a double.
  71. X *    Usual values are 2, 4, and 8.
  72. X */
  73. X#define ALIGNBYTES $alignbytes        /**/
  74. X
  75. X/* BIN
  76. X *    This symbol holds the name of the directory in which the user wants
  77. X *    to keep publicly executable images for the package in question.  It
  78. X *    is most often a local directory such as /usr/local/bin.
  79. X */
  80. X#define BIN "$bin"             /**/
  81. X
  82. X/* BYTEORDER
  83. X *    This symbol contains an encoding of the order of bytes in a long.
  84. X *    Usual values (in octal) are 01234, 04321, 02143, 03412...
  85. X */
  86. X#define BYTEORDER 0x$byteorder        /**/
  87. X
  88. X/* CPPSTDIN
  89. X *    This symbol contains the first part of the string which will invoke
  90. X *    the C preprocessor on the standard input and produce to standard
  91. X *    output.     Typical value of "cc -E" or "/lib/cpp".
  92. X */
  93. X/* CPPMINUS
  94. X *    This symbol contains the second part of the string which will invoke
  95. X *    the C preprocessor on the standard input and produce to standard
  96. X *    output.  This symbol will have the value "-" if CPPSTDIN needs a minus
  97. X *    to specify standard input, otherwise the value is "".
  98. X */
  99. X#define CPPSTDIN "$cppstdin"
  100. X#define CPPMINUS "$cppminus"
  101. X
  102. X/* HAS_BCMP
  103. X *    This symbol, if defined, indicates that the bcmp routine is available
  104. X *    to compare blocks of memory.  If undefined, use memcmp.  If that's
  105. X *    not available, roll your own.
  106. X */
  107. X#$d_bcmp    HAS_BCMP        /**/
  108. X
  109. X/* HAS_BCOPY
  110. X *    This symbol, if defined, indicates that the bcopy routine is available
  111. X *    to copy blocks of memory.  Otherwise you should probably use memcpy().
  112. X */
  113. X#$d_bcopy    HAS_BCOPY        /**/
  114. X
  115. X/* HAS_BZERO
  116. X *    This symbol, if defined, indicates that the bzero routine is available
  117. X *    to zero blocks of memory.  Otherwise you should probably use memset()
  118. X *    or roll your own.
  119. X */
  120. X#$d_bzero    HAS_BZERO        /**/
  121. X
  122. X/* CASTNEGFLOAT
  123. X *    This symbol, if defined, indicates that this C compiler knows how to
  124. X *    cast negative or large floating point numbers to unsigned longs, ints
  125. X *    and shorts.
  126. X */
  127. X/* CASTFLAGS
  128. X *    This symbol contains flags that say what difficulties the compiler
  129. X *    has casting odd floating values to unsigned long:
  130. X *        1 = couldn't cast < 0
  131. X *        2 = couldn't cast >= 0x80000000
  132. X */
  133. X#$d_castneg    CASTNEGFLOAT    /**/
  134. X#define    CASTFLAGS $castflags    /**/
  135. X
  136. X/* CHARSPRINTF
  137. X *    This symbol is defined if this system declares "char *sprintf()" in
  138. X *    stdio.h.  The trend seems to be to declare it as "int sprintf()".  It
  139. X *    is up to the package author to declare sprintf correctly based on the
  140. X *    symbol.
  141. X */
  142. X#$d_charsprf    CHARSPRINTF     /**/
  143. X
  144. X/* HAS_CHSIZE
  145. X *    This symbol, if defined, indicates that the chsize routine is available
  146. X *    to truncate files.  You might need a -lx to get this routine.
  147. X */
  148. X#$d_chsize    HAS_CHSIZE        /**/
  149. X
  150. X/* HAS_CRYPT
  151. X *    This symbol, if defined, indicates that the crypt routine is available
  152. X *    to encrypt passwords and the like.
  153. X */
  154. X#$d_crypt    HAS_CRYPT        /**/
  155. X
  156. X/* CSH
  157. X *    This symbol, if defined, indicates that the C-shell exists.
  158. X *    If defined, contains the full pathname of csh.
  159. X */
  160. X#$d_csh CSH "$csh"        /**/
  161. X
  162. X/* DOSUID
  163. X *    This symbol, if defined, indicates that the C program should
  164. X *    check the script that it is executing for setuid/setgid bits, and
  165. X *    attempt to emulate setuid/setgid on systems that have disabled
  166. X *    setuid #! scripts because the kernel can't do it securely.
  167. X *    It is up to the package designer to make sure that this emulation
  168. X *    is done securely.  Among other things, it should do an fstat on
  169. X *    the script it just opened to make sure it really is a setuid/setgid
  170. X *    script, it should make sure the arguments passed correspond exactly
  171. X *    to the argument on the #! line, and it should not trust any
  172. X *    subprocesses to which it must pass the filename rather than the
  173. X *    file descriptor of the script to be executed.
  174. X */
  175. X#$d_dosuid DOSUID        /**/
  176. X
  177. X/* HAS_DUP2
  178. X *    This symbol, if defined, indicates that the dup2 routine is available
  179. X *    to dup file descriptors.  Otherwise you should use dup().
  180. X */
  181. X#$d_dup2    HAS_DUP2        /**/
  182. X
  183. X/* HAS_FCHMOD
  184. X *    This symbol, if defined, indicates that the fchmod routine is available
  185. X *    to change mode of opened files.  If unavailable, use chmod().
  186. X */
  187. X#$d_fchmod    HAS_FCHMOD        /**/
  188. X
  189. X/* HAS_FCHOWN
  190. X *    This symbol, if defined, indicates that the fchown routine is available
  191. X *    to change ownership of opened files.  If unavailable, use chown().
  192. X */
  193. X#$d_fchown    HAS_FCHOWN        /**/
  194. X
  195. X/* HAS_FCNTL
  196. X *    This symbol, if defined, indicates to the C program that
  197. X *    the fcntl() function exists.
  198. X */
  199. X#$d_fcntl    HAS_FCNTL        /**/
  200. X
  201. X/* FLEXFILENAMES
  202. X *    This symbol, if defined, indicates that the system supports filenames
  203. X *    longer than 14 characters.
  204. X */
  205. X#$d_flexfnam    FLEXFILENAMES        /**/
  206. X
  207. X/* HAS_FLOCK
  208. X *    This symbol, if defined, indicates that the flock() routine is
  209. X *    available to do file locking.
  210. X */
  211. X#$d_flock    HAS_FLOCK        /**/
  212. X
  213. X/* HAS_GETGROUPS
  214. X *    This symbol, if defined, indicates that the getgroups() routine is
  215. X *    available to get the list of process groups.  If unavailable, multiple
  216. X *    groups are probably not supported.
  217. X */
  218. X#$d_getgrps    HAS_GETGROUPS        /**/
  219. X
  220. X/* HAS_GETHOSTENT
  221. X *    This symbol, if defined, indicates that the gethostent() routine is
  222. X *    available to lookup host names in some data base or other.
  223. X */
  224. X#$d_gethent    HAS_GETHOSTENT        /**/
  225. X
  226. X/* HAS_GETPGRP
  227. X *    This symbol, if defined, indicates that the getpgrp() routine is
  228. X *    available to get the current process group.
  229. X */
  230. X#$d_getpgrp    HAS_GETPGRP        /**/
  231. X
  232. X/* HAS_GETPGRP2
  233. X *    This symbol, if defined, indicates that the getpgrp2() (as in DG/UX)
  234. X *    routine is available to get the current process group.
  235. X */
  236. X#$d_getpgrp2    HAS_GETPGRP2        /**/
  237. X
  238. X/* HAS_GETPRIORITY
  239. X *    This symbol, if defined, indicates that the getpriority() routine is
  240. X *    available to get a process's priority.
  241. X */
  242. X#$d_getprior    HAS_GETPRIORITY        /**/
  243. X
  244. X/* HAS_HTONS
  245. X *    This symbol, if defined, indicates that the htons routine (and friends)
  246. X *    are available to do network order byte swapping.
  247. X */
  248. X/* HAS_HTONL
  249. X *    This symbol, if defined, indicates that the htonl routine (and friends)
  250. X *    are available to do network order byte swapping.
  251. X */
  252. X/* HAS_NTOHS
  253. X *    This symbol, if defined, indicates that the ntohs routine (and friends)
  254. X *    are available to do network order byte swapping.
  255. X */
  256. X/* HAS_NTOHL
  257. X *    This symbol, if defined, indicates that the ntohl routine (and friends)
  258. X *    are available to do network order byte swapping.
  259. X */
  260. X#$d_htonl    HAS_HTONS    /**/
  261. X#$d_htonl    HAS_HTONL    /**/
  262. X#$d_htonl    HAS_NTOHS    /**/
  263. X#$d_htonl    HAS_NTOHL    /**/
  264. X
  265. X/* index
  266. X *    This preprocessor symbol is defined, along with rindex, if the system
  267. X *    uses the strchr and strrchr routines instead.
  268. X */
  269. X/* rindex
  270. X *    This preprocessor symbol is defined, along with index, if the system
  271. X *    uses the strchr and strrchr routines instead.
  272. X */
  273. X#$d_index    index strchr    /* cultural */
  274. X#$d_index    rindex strrchr    /*  differences? */
  275. X
  276. X/* HAS_KILLPG
  277. X *    This symbol, if defined, indicates that the killpg routine is available
  278. X *    to kill process groups.  If unavailable, you probably should use kill
  279. X *    with a negative process number.
  280. X */
  281. X#$d_killpg    HAS_KILLPG        /**/
  282. X
  283. X/* HAS_LSTAT
  284. X *    This symbol, if defined, indicates that the lstat() routine is
  285. X *    available to stat symbolic links.
  286. X */
  287. X#$d_lstat    HAS_LSTAT        /**/
  288. X
  289. X/* HAS_MEMCMP
  290. X *    This symbol, if defined, indicates that the memcmp routine is available
  291. X *    to compare blocks of memory.  If undefined, roll your own.
  292. X */
  293. X#$d_memcmp    HAS_MEMCMP        /**/
  294. X
  295. X/* HAS_MEMCPY
  296. X *    This symbol, if defined, indicates that the memcpy routine is available
  297. X *    to copy blocks of memory.  Otherwise you should probably use bcopy().
  298. X *    If neither is defined, roll your own.
  299. X */
  300. X#$d_memcpy    HAS_MEMCPY        /**/
  301. X
  302. X/* HAS_MKDIR
  303. X *    This symbol, if defined, indicates that the mkdir routine is available
  304. X *    to create directories.  Otherwise you should fork off a new process to
  305. X *    exec /bin/mkdir.
  306. X */
  307. X#$d_mkdir    HAS_MKDIR        /**/
  308. X
  309. X/* HAS_MSG
  310. X *    This symbol, if defined, indicates that the entire msg*(2) library is
  311. X *    supported.
  312. X */
  313. X#$d_msg    HAS_MSG        /**/
  314. X
  315. X/* HAS_MSGCTL
  316. X *    This symbol, if defined, indicates that the msgctl() routine is
  317. X *    available to stat symbolic links.
  318. X */
  319. X#$d_msgctl    HAS_MSGCTL        /**/
  320. X
  321. X/* HAS_MSGGET
  322. X *    This symbol, if defined, indicates that the msgget() routine is
  323. X *    available to stat symbolic links.
  324. X */
  325. X#$d_msgget    HAS_MSGGET        /**/
  326. X
  327. X/* HAS_MSGRCV
  328. X *    This symbol, if defined, indicates that the msgrcv() routine is
  329. X *    available to stat symbolic links.
  330. X */
  331. X#$d_msgrcv    HAS_MSGRCV        /**/
  332. X
  333. X/* HAS_MSGSND
  334. X *    This symbol, if defined, indicates that the msgsnd() routine is
  335. X *    available to stat symbolic links.
  336. X */
  337. X#$d_msgsnd    HAS_MSGSND        /**/
  338. X
  339. X/* HAS_NDBM
  340. X *    This symbol, if defined, indicates that ndbm.h exists and should
  341. X *    be included.
  342. X */
  343. X#$d_ndbm    HAS_NDBM        /**/
  344. X
  345. X/* HAS_ODBM
  346. X *    This symbol, if defined, indicates that dbm.h exists and should
  347. X *    be included.
  348. X */
  349. X#$d_odbm    HAS_ODBM        /**/
  350. X
  351. X/* HAS_OPEN3
  352. X *    This manifest constant lets the C program know that the three
  353. X *    argument form of open(2) is available.
  354. X */
  355. X#$d_open3    HAS_OPEN3        /**/
  356. X
  357. X/* HAS_READDIR
  358. X *    This symbol, if defined, indicates that the readdir routine is available
  359. X *    from the C library to read directories.
  360. X */
  361. X#$d_readdir    HAS_READDIR        /**/
  362. X
  363. X/* HAS_RENAME
  364. X *    This symbol, if defined, indicates that the rename routine is available
  365. X *    to rename files.  Otherwise you should do the unlink(), link(), unlink()
  366. X *    trick.
  367. X */
  368. X#$d_rename    HAS_RENAME        /**/
  369. X
  370. X/* HAS_RMDIR
  371. X *    This symbol, if defined, indicates that the rmdir routine is available
  372. X *    to remove directories.  Otherwise you should fork off a new process to
  373. X *    exec /bin/rmdir.
  374. X */
  375. X#$d_rmdir    HAS_RMDIR        /**/
  376. X
  377. X/* HAS_SELECT
  378. X *    This symbol, if defined, indicates that the select() subroutine
  379. X *    exists.
  380. X */
  381. X#$d_select    HAS_SELECT    /**/
  382. X
  383. X/* HAS_SEM
  384. X *    This symbol, if defined, indicates that the entire sem*(2) library is
  385. X *    supported.
  386. X */
  387. X#$d_sem    HAS_SEM        /**/
  388. X
  389. X/* HAS_SEMCTL
  390. X *    This symbol, if defined, indicates that the semctl() routine is
  391. X *    available to stat symbolic links.
  392. X */
  393. X#$d_semctl    HAS_SEMCTL        /**/
  394. X
  395. X/* HAS_SEMGET
  396. X *    This symbol, if defined, indicates that the semget() routine is
  397. X *    available to stat symbolic links.
  398. X */
  399. X#$d_semget    HAS_SEMGET        /**/
  400. X
  401. X/* HAS_SEMOP
  402. X *    This symbol, if defined, indicates that the semop() routine is
  403. X *    available to stat symbolic links.
  404. X */
  405. X#$d_semop    HAS_SEMOP        /**/
  406. X
  407. X/* HAS_SETEGID
  408. X *    This symbol, if defined, indicates that the setegid routine is available
  409. X *    to change the effective gid of the current program.
  410. X */
  411. X#$d_setegid    HAS_SETEGID        /**/
  412. X
  413. X/* HAS_SETEUID
  414. X *    This symbol, if defined, indicates that the seteuid routine is available
  415. X *    to change the effective uid of the current program.
  416. X */
  417. X#$d_seteuid    HAS_SETEUID        /**/
  418. X
  419. X/* HAS_SETPGRP
  420. X *    This symbol, if defined, indicates that the setpgrp() routine is
  421. X *    available to set the current process group.
  422. X */
  423. X#$d_setpgrp    HAS_SETPGRP        /**/
  424. X
  425. X/* HAS_SETPGRP2
  426. X *    This symbol, if defined, indicates that the setpgrp2() (as in DG/UX)
  427. X *    routine is available to set the current process group.
  428. X */
  429. X#$d_setpgrp2    HAS_SETPGRP2        /**/
  430. X
  431. X/* HAS_SETPRIORITY
  432. X *    This symbol, if defined, indicates that the setpriority() routine is
  433. X *    available to set a process's priority.
  434. X */
  435. X#$d_setprior    HAS_SETPRIORITY        /**/
  436. X
  437. X/* HAS_SETREGID
  438. X *    This symbol, if defined, indicates that the setregid routine is
  439. X *    available to change the real and effective gid of the current program.
  440. X */
  441. X/* HAS_SETRESGID
  442. X *    This symbol, if defined, indicates that the setresgid routine is
  443. X *    available to change the real, effective and saved gid of the current
  444. X *    program.
  445. X */
  446. X#$d_setregid    HAS_SETREGID        /**/
  447. X#$d_setresgid    HAS_SETRESGID        /**/
  448. X
  449. X/* HAS_SETREUID
  450. X *    This symbol, if defined, indicates that the setreuid routine is
  451. X *    available to change the real and effective uid of the current program.
  452. X */
  453. X/* HAS_SETRESUID
  454. X *    This symbol, if defined, indicates that the setresuid routine is
  455. X *    available to change the real, effective and saved uid of the current
  456. X *    program.
  457. X */
  458. X#$d_setreuid    HAS_SETREUID        /**/
  459. X#$d_setresuid    HAS_SETRESUID        /**/
  460. X
  461. X/* HAS_SETRGID
  462. X *    This symbol, if defined, indicates that the setrgid routine is available
  463. X *    to change the real gid of the current program.
  464. X */
  465. X#$d_setrgid    HAS_SETRGID        /**/
  466. X
  467. X/* HAS_SETRUID
  468. X *    This symbol, if defined, indicates that the setruid routine is available
  469. X *    to change the real uid of the current program.
  470. X */
  471. X#$d_setruid    HAS_SETRUID        /**/
  472. X
  473. X/* HAS_SHM
  474. X *    This symbol, if defined, indicates that the entire shm*(2) library is
  475. X *    supported.
  476. X */
  477. X#$d_shm    HAS_SHM        /**/
  478. X
  479. X/* HAS_SHMAT
  480. X *    This symbol, if defined, indicates that the shmat() routine is
  481. X *    available to stat symbolic links.
  482. X */
  483. X#$d_shmat    HAS_SHMAT        /**/
  484. X
  485. X/* HAS_SHMCTL
  486. X *    This symbol, if defined, indicates that the shmctl() routine is
  487. X *    available to stat symbolic links.
  488. X */
  489. X#$d_shmctl    HAS_SHMCTL        /**/
  490. X
  491. X/* HAS_SHMDT
  492. X *    This symbol, if defined, indicates that the shmdt() routine is
  493. X *    available to stat symbolic links.
  494. X */
  495. X#$d_shmdt    HAS_SHMDT        /**/
  496. X
  497. X/* HAS_SHMGET
  498. X *    This symbol, if defined, indicates that the shmget() routine is
  499. X *    available to stat symbolic links.
  500. X */
  501. X#$d_shmget    HAS_SHMGET        /**/
  502. X
  503. X/* HAS_SOCKET
  504. X *    This symbol, if defined, indicates that the BSD socket interface is
  505. X *    supported.
  506. X */
  507. X/* HAS_SOCKETPAIR
  508. X *    This symbol, if defined, indicates that the BSD socketpair call is
  509. X *    supported.
  510. X */
  511. X/* OLDSOCKET
  512. X *    This symbol, if defined, indicates that the 4.1c BSD socket interface
  513. X *    is supported instead of the 4.2/4.3 BSD socket interface.
  514. X */
  515. X#$d_socket    HAS_SOCKET        /**/
  516. X
  517. X#$d_sockpair    HAS_SOCKETPAIR    /**/
  518. X
  519. X#$d_oldsock    OLDSOCKET    /**/
  520. X
  521. X/* STATBLOCKS
  522. X *    This symbol is defined if this system has a stat structure declaring
  523. X *    st_blksize and st_blocks.
  524. X */
  525. X#$d_statblks    STATBLOCKS     /**/
  526. X
  527. X/* STDSTDIO
  528. X *    This symbol is defined if this system has a FILE structure declaring
  529. X *    _ptr and _cnt in stdio.h.
  530. X */
  531. X#$d_stdstdio    STDSTDIO     /**/
  532. X
  533. X/* STRUCTCOPY
  534. X *    This symbol, if defined, indicates that this C compiler knows how
  535. X *    to copy structures.  If undefined, you'll need to use a block copy
  536. X *    routine of some sort instead.
  537. X */
  538. X#$d_strctcpy    STRUCTCOPY    /**/
  539. X
  540. X/* HAS_STRERROR
  541. X *    This symbol, if defined, indicates that the strerror() routine is
  542. X *    available to translate error numbers to strings.
  543. X */
  544. X#$d_strerror    HAS_STRERROR        /**/
  545. X
  546. X/* HAS_SYMLINK
  547. X *    This symbol, if defined, indicates that the symlink routine is available
  548. X *    to create symbolic links.
  549. X */
  550. X#$d_symlink    HAS_SYMLINK        /**/
  551. X
  552. X/* HAS_SYSCALL
  553. X *    This symbol, if defined, indicates that the syscall routine is available
  554. X *    to call arbitrary system calls.  If undefined, that's tough.
  555. X */
  556. X#$d_syscall    HAS_SYSCALL        /**/
  557. X
  558. X/* HAS_TRUNCATE
  559. X *    This symbol, if defined, indicates that the truncate routine is
  560. X *    available to truncate files.
  561. X */
  562. X#$d_truncate    HAS_TRUNCATE        /**/
  563. X
  564. X/* HAS_VFORK
  565. X *    This symbol, if defined, indicates that vfork() exists.
  566. X */
  567. X#$d_vfork    HAS_VFORK    /**/
  568. X
  569. X/* VOIDSIG
  570. X *    This symbol is defined if this system declares "void (*signal())()" in
  571. X *    signal.h.  The old way was to declare it as "int (*signal())()".  It
  572. X *    is up to the package author to declare things correctly based on the
  573. X *    symbol.
  574. X */
  575. X/* TO_SIGNAL
  576. X *    This symbol's value is either "void" or "int", corresponding to the
  577. X *    appropriate return "type" of a signal handler.  Thus, one can declare
  578. X *    a signal handler using "TO_SIGNAL (*handler())()", and define the
  579. X *    handler using "TO_SIGNAL handler(sig)".
  580. X */
  581. X#$d_voidsig    VOIDSIG     /**/
  582. X#$define    TO_SIGNAL    $d_tosignal     /**/
  583. X
  584. X/* HASVOLATILE
  585. X *    This symbol, if defined, indicates that this C compiler knows about
  586. X *    the volatile declaration.
  587. X */
  588. X#$d_volatile    HASVOLATILE    /**/
  589. X
  590. X/* HAS_VPRINTF
  591. X *    This symbol, if defined, indicates that the vprintf routine is available
  592. X *    to printf with a pointer to an argument list.  If unavailable, you
  593. X *    may need to write your own, probably in terms of _doprnt().
  594. X */
  595. X/* CHARVSPRINTF
  596. X *    This symbol is defined if this system has vsprintf() returning type
  597. X *    (char*).  The trend seems to be to declare it as "int vsprintf()".  It
  598. X *    is up to the package author to declare vsprintf correctly based on the
  599. X *    symbol.
  600. X */
  601. X#$d_vprintf    HAS_VPRINTF    /**/
  602. X#$d_charvspr    CHARVSPRINTF     /**/
  603. X
  604. X/* HAS_WAIT4
  605. X *    This symbol, if defined, indicates that wait4() exists.
  606. X */
  607. X#$d_wait4    HAS_WAIT4    /**/
  608. X
  609. X/* HAS_WAITPID
  610. X *    This symbol, if defined, indicates that waitpid() exists.
  611. X */
  612. X#$d_waitpid    HAS_WAITPID    /**/
  613. X
  614. X/* GIDTYPE
  615. X *    This symbol has a value like gid_t, int, ushort, or whatever type is
  616. X *    used to declare group ids in the kernel.
  617. X */
  618. X#define GIDTYPE $gidtype        /**/
  619. X
  620. X/* GROUPSTYPE
  621. X *    This symbol has a value like gid_t, int, ushort, or whatever type is
  622. X *    used in the return value of getgroups().
  623. X */
  624. X#define GROUPSTYPE $groupstype        /**/
  625. X
  626. X/* I_FCNTL
  627. X *    This manifest constant tells the C program to include <fcntl.h>.
  628. X */
  629. X#$i_fcntl    I_FCNTL    /**/
  630. X
  631. X/* I_GDBM
  632. X *    This symbol, if defined, indicates that gdbm.h exists and should
  633. X *    be included.
  634. X */
  635. X#$i_gdbm    I_GDBM        /**/
  636. X
  637. X/* I_GRP
  638. X *    This symbol, if defined, indicates to the C program that it should
  639. X *    include grp.h.
  640. X */
  641. X#$i_grp    I_GRP        /**/
  642. X
  643. X/* I_NETINET_IN
  644. X *    This symbol, if defined, indicates to the C program that it should
  645. X *    include netinet/in.h.
  646. X */
  647. X/* I_SYS_IN
  648. X *    This symbol, if defined, indicates to the C program that it should
  649. X *    include sys/in.h.
  650. X */
  651. X#$i_niin    I_NETINET_IN        /**/
  652. X#$i_sysin    I_SYS_IN        /**/
  653. X
  654. X/* I_PWD
  655. X *    This symbol, if defined, indicates to the C program that it should
  656. X *    include pwd.h.
  657. X */
  658. X/* PWQUOTA
  659. X *    This symbol, if defined, indicates to the C program that struct passwd
  660. X *    contains pw_quota.
  661. X */
  662. X/* PWAGE
  663. X *    This symbol, if defined, indicates to the C program that struct passwd
  664. X *    contains pw_age.
  665. X */
  666. X/* PWCHANGE
  667. X *    This symbol, if defined, indicates to the C program that struct passwd
  668. X *    contains pw_change.
  669. X */
  670. X/* PWCLASS
  671. X *    This symbol, if defined, indicates to the C program that struct passwd
  672. X *    contains pw_class.
  673. X */
  674. X/* PWEXPIRE
  675. X *    This symbol, if defined, indicates to the C program that struct passwd
  676. X *    contains pw_expire.
  677. X */
  678. X/* PWCOMMENT
  679. X *    This symbol, if defined, indicates to the C program that struct passwd
  680. X *    contains pw_comment.
  681. X */
  682. X#$i_pwd    I_PWD        /**/
  683. X#$d_pwquota    PWQUOTA        /**/
  684. X#$d_pwage    PWAGE        /**/
  685. X#$d_pwchange    PWCHANGE    /**/
  686. X#$d_pwclass    PWCLASS        /**/
  687. X#$d_pwexpire    PWEXPIRE    /**/
  688. X#$d_pwcomment    PWCOMMENT    /**/
  689. X
  690. X/* I_SYS_FILE
  691. X *    This manifest constant tells the C program to include <sys/file.h>.
  692. X */
  693. X#$i_sys_file    I_SYS_FILE    /**/
  694. X
  695. X/* I_SYSIOCTL
  696. X *    This symbol, if defined, indicates that sys/ioctl.h exists and should
  697. X *    be included.
  698. X */
  699. X#$i_sysioctl    I_SYSIOCTL        /**/
  700. X
  701. X/* I_TIME
  702. X *    This symbol is defined if the program should include <time.h>.
  703. X */
  704. X/* I_SYS_TIME
  705. X *    This symbol is defined if the program should include <sys/time.h>.
  706. X */
  707. X/* SYSTIMEKERNEL
  708. X *    This symbol is defined if the program should include <sys/time.h>
  709. X *    with KERNEL defined.
  710. X */
  711. X/* I_SYS_SELECT
  712. X *    This symbol is defined if the program should include <sys/select.h>.
  713. X */
  714. X#$i_time    I_TIME         /**/
  715. X#$i_sys_time    I_SYS_TIME     /**/
  716. X#$d_systimekernel    SYSTIMEKERNEL     /**/
  717. X#$i_sys_select    I_SYS_SELECT     /**/
  718. X
  719. X/* I_UTIME
  720. X *    This symbol, if defined, indicates to the C program that it should
  721. X *    include utime.h.
  722. X */
  723. X#$i_utime    I_UTIME        /**/
  724. X
  725. X/* I_VARARGS
  726. X *    This symbol, if defined, indicates to the C program that it should
  727. X *    include varargs.h.
  728. X */
  729. X#$i_varargs    I_VARARGS        /**/
  730. X
  731. X/* I_VFORK
  732. X *    This symbol, if defined, indicates to the C program that it should
  733. X *    include vfork.h.
  734. X */
  735. X#$i_vfork    I_VFORK        /**/
  736. X
  737. X/* INTSIZE
  738. X *    This symbol contains the size of an int, so that the C preprocessor
  739. X *    can make decisions based on it.
  740. X */
  741. X#define INTSIZE $intsize        /**/
  742. X
  743. X/* I_DIRENT
  744. X *    This symbol, if defined, indicates that the program should use the
  745. X *    P1003-style directory routines, and include <dirent.h>.
  746. X */
  747. X/* I_SYS_DIR
  748. X *    This symbol, if defined, indicates that the program should use the
  749. X *    directory functions by including <sys/dir.h>.
  750. X */
  751. X/* I_NDIR
  752. X *    This symbol, if defined, indicates that the program should include the
  753. X *    system's version of ndir.h, rather than the one with this package.
  754. X */
  755. X/* I_SYS_NDIR
  756. X *    This symbol, if defined, indicates that the program should include the
  757. X *    system's version of sys/ndir.h, rather than the one with this package.
  758. X */
  759. X/* I_MY_DIR
  760. X *    This symbol, if defined, indicates that the program should compile
  761. X *    the ndir.c code provided with the package.
  762. X */
  763. X/* DIRNAMLEN
  764. X *    This symbol, if defined, indicates to the C program that the length
  765. X *    of directory entry names is provided by a d_namlen field.  Otherwise
  766. X *    you need to do strlen() on the d_name field.
  767. X */
  768. X#$i_dirent    I_DIRENT    /**/
  769. X#$i_sys_dir    I_SYS_DIR    /**/
  770. X#$i_ndir    I_NDIR        /**/
  771. X#$i_sys_ndir    I_SYS_NDIR    /**/
  772. X#$i_my_dir    I_MY_DIR    /**/
  773. X#$d_dirnamlen    DIRNAMLEN    /**/
  774. X
  775. X/* MALLOCPTRTYPE
  776. X *    This symbol defines the kind of ptr returned by malloc and realloc.
  777. X */
  778. X#define MALLOCPTRTYPE $mallocptrtype         /**/
  779. X
  780. X
  781. X/* RANDBITS
  782. X *    This symbol contains the number of bits of random number the rand()
  783. X *    function produces.  Usual values are 15, 16, and 31.
  784. X */
  785. X#define RANDBITS $randbits        /**/
  786. X
  787. X/* SCRIPTDIR
  788. X *    This symbol holds the name of the directory in which the user wants
  789. X *    to put publicly executable scripts for the package in question.  It
  790. X *    is often a directory that is mounted across diverse architectures.
  791. X */
  792. X#define SCRIPTDIR "$scriptdir"             /**/
  793. X
  794. X/* SIG_NAME
  795. X *    This symbol contains an list of signal names in order.
  796. X */
  797. X#define SIG_NAME "`echo $sig_name | sed 's/ /","/g'`"        /**/
  798. X
  799. X/* STDCHAR
  800. X *    This symbol is defined to be the type of char used in stdio.h.
  801. X *    It has the values "unsigned char" or "char".
  802. X */
  803. X#define STDCHAR $stdchar    /**/
  804. X
  805. X/* UIDTYPE
  806. X *    This symbol has a value like uid_t, int, ushort, or whatever type is
  807. X *    used to declare user ids in the kernel.
  808. X */
  809. X#define UIDTYPE $uidtype        /**/
  810. X
  811. X/* VOIDHAVE
  812. X *    This symbol indicates how much support of the void type is given by this
  813. X *    compiler.  What various bits mean:
  814. X *
  815. X *        1 = supports declaration of void
  816. X *        2 = supports arrays of pointers to functions returning void
  817. X *        4 = supports comparisons between pointers to void functions and
  818. X *            addresses of void functions
  819. X *
  820. X *    The package designer should define VOIDWANT to indicate the requirements
  821. X *    of the package.  This can be done either by #defining VOIDWANT before
  822. X *    including config.h, or by defining voidwant in Myinit.U.  If the level
  823. X *    of void support necessary is not present, config.h defines void to "int",
  824. X *    VOID to the empty string, and VOIDP to "char *".
  825. X */
  826. X/* void
  827. X *    This symbol is used for void casts.  On implementations which support
  828. X *    void appropriately, its value is "void".  Otherwise, its value maps
  829. X *    to "int".
  830. X */
  831. X/* VOID
  832. X *    This symbol's value is "void" if the implementation supports void
  833. X *    appropriately.  Otherwise, its value is the empty string.  The primary
  834. X *    use of this symbol is in specifying void parameter lists for function
  835. X *    prototypes.
  836. X */
  837. X/* VOIDP
  838. X *    This symbol is used for casting generic pointers.  On implementations
  839. X *    which support void appropriately, its value is "void *".  Otherwise,
  840. X *    its value is "char *".
  841. X */
  842. X#ifndef VOIDWANT
  843. X#define VOIDWANT $voidwant
  844. X#endif
  845. X#define VOIDHAVE $voidhave
  846. X#if (VOIDHAVE & VOIDWANT) != VOIDWANT
  847. X#define void int        /* is void to be avoided? */
  848. X#define VOID
  849. X#define VOIDP (char *)
  850. X#define M_VOID        /* Xenix strikes again */
  851. X#else
  852. X#define VOID void
  853. X#define VOIDP (void *)
  854. X#endif
  855. X
  856. X/* PRIVLIB
  857. X *    This symbol contains the name of the private library for this package.
  858. X *    The library is private in the sense that it needn't be in anyone's
  859. X *    execution path, but it should be accessible by the world.  The program
  860. X *    should be prepared to do ~ expansion.
  861. X */
  862. X#define PRIVLIB "$privlib"        /**/
  863. X
  864. X#endif
  865. X!GROK!THIS!
  866. !STUFFY!FUNK!
  867. echo Extracting eval.c:AB
  868. sed >eval.c:AB <<'!STUFFY!FUNK!' -e 's/X//'
  869. X        anum = sp - arglast[0];
  870. X        switch (anum) {
  871. X        case 0:
  872. X        deb("%s RETURNS ()\n",opname[optype]);
  873. X        break;
  874. X        case 1:
  875. X        deb("%s RETURNS (\"%s\")\n",opname[optype],str_get(st[1]));
  876. X        break;
  877. X        default:
  878. X        tmps = str_get(st[1]);
  879. X        deb("%s RETURNS %d ARGS (\"%s\",%s\"%s\")\n",opname[optype],
  880. X          anum,tmps,anum==2?"":"...,",str_get(st[anum]));
  881. X        break;
  882. X        }
  883. X    }
  884. X    }
  885. X#endif
  886. X    return sp;
  887. X
  888. Xsay_yes:
  889. X    str = &str_yes;
  890. X    goto normal_return;
  891. X
  892. Xsay_no:
  893. X    str = &str_no;
  894. X    goto normal_return;
  895. X
  896. Xsay_undef:
  897. X    str = &str_undef;
  898. X    goto normal_return;
  899. X
  900. Xsay_zero:
  901. X    value = 0.0;
  902. X    /* FALL THROUGH */
  903. X
  904. Xdonumset:
  905. X    str_numset(str,value);
  906. X    STABSET(str);
  907. X    st[1] = str;
  908. X#ifdef DEBUGGING
  909. X    if (debug) {
  910. X    dlevel--;
  911. X    if (debug & 8)
  912. X        deb("%s RETURNS \"%f\"\n",opname[optype],value);
  913. X    }
  914. X#endif
  915. X    return arglast[0] + 1;
  916. X#ifdef SMALLSWITCHES
  917. X    }
  918. X    else
  919. X    switch (optype) {
  920. X#endif
  921. X    case O_CHOWN:
  922. X#ifdef HAS_CHOWN
  923. X    value = (double)apply(optype,arglast);
  924. X    goto donumset;
  925. X#else
  926. X    fatal("Unsupported function chown");
  927. X    break;
  928. X#endif
  929. X    case O_KILL:
  930. X#ifdef HAS_KILL
  931. X    value = (double)apply(optype,arglast);
  932. X    goto donumset;
  933. X#else
  934. X    fatal("Unsupported function kill");
  935. X    break;
  936. X#endif
  937. X    case O_UNLINK:
  938. X    case O_CHMOD:
  939. X    case O_UTIME:
  940. X    value = (double)apply(optype,arglast);
  941. X    goto donumset;
  942. X    case O_UMASK:
  943. X#ifdef HAS_UMASK
  944. X    if (maxarg < 1) {
  945. X        anum = umask(0);
  946. X        (void)umask(anum);
  947. X    }
  948. X    else
  949. X        anum = umask((int)str_gnum(st[1]));
  950. X    value = (double)anum;
  951. X#ifdef TAINT
  952. X    taintproper("Insecure dependency in umask");
  953. X#endif
  954. X    goto donumset;
  955. X#else
  956. X    fatal("Unsupported function umask");
  957. X    break;
  958. X#endif
  959. X#if defined(HAS_MSG) || defined(HAS_SEM) || defined(HAS_SHM)
  960. X    case O_MSGGET:
  961. X    case O_SHMGET:
  962. X    case O_SEMGET:
  963. X    if ((anum = do_ipcget(optype, arglast)) == -1)
  964. X        goto say_undef;
  965. X    value = (double)anum;
  966. X    goto donumset;
  967. X    case O_MSGCTL:
  968. X    case O_SHMCTL:
  969. X    case O_SEMCTL:
  970. X    anum = do_ipcctl(optype, arglast);
  971. X    if (anum == -1)
  972. X        goto say_undef;
  973. X    if (anum != 0) {
  974. X        value = (double)anum;
  975. X        goto donumset;
  976. X    }
  977. X    str_set(str,"0 but true");
  978. X    STABSET(str);
  979. X    break;
  980. X    case O_MSGSND:
  981. X    value = (double)(do_msgsnd(arglast) >= 0);
  982. X    goto donumset;
  983. X    case O_MSGRCV:
  984. X    value = (double)(do_msgrcv(arglast) >= 0);
  985. X    goto donumset;
  986. X    case O_SEMOP:
  987. X    value = (double)(do_semop(arglast) >= 0);
  988. X    goto donumset;
  989. X    case O_SHMREAD:
  990. X    case O_SHMWRITE:
  991. X    value = (double)(do_shmio(optype, arglast) >= 0);
  992. X    goto donumset;
  993. X#else /* not SYSVIPC */
  994. X    case O_MSGGET:
  995. X    case O_MSGCTL:
  996. X    case O_MSGSND:
  997. X    case O_MSGRCV:
  998. X    case O_SEMGET:
  999. X    case O_SEMCTL:
  1000. X    case O_SEMOP:
  1001. X    case O_SHMGET:
  1002. X    case O_SHMCTL:
  1003. X    case O_SHMREAD:
  1004. X    case O_SHMWRITE:
  1005. X    fatal("System V IPC is not implemented on this machine");
  1006. X#endif /* not SYSVIPC */
  1007. X    case O_RENAME:
  1008. X    tmps = str_get(st[1]);
  1009. X    tmps2 = str_get(st[2]);
  1010. X#ifdef TAINT
  1011. X    taintproper("Insecure dependency in rename");
  1012. X#endif
  1013. X#ifdef HAS_RENAME
  1014. X    value = (double)(rename(tmps,tmps2) >= 0);
  1015. X#else
  1016. X    if (same_dirent(tmps2, tmps))    /* can always rename to same name */
  1017. X        anum = 1;
  1018. X    else {
  1019. X        if (euid || stat(tmps2,&statbuf) < 0 || !S_ISDIR(statbuf.st_mode))
  1020. X        (void)UNLINK(tmps2);
  1021. X        if (!(anum = link(tmps,tmps2)))
  1022. X        anum = UNLINK(tmps);
  1023. X    }
  1024. X    value = (double)(anum >= 0);
  1025. X#endif
  1026. X    goto donumset;
  1027. X    case O_LINK:
  1028. X#ifdef HAS_LINK
  1029. X    tmps = str_get(st[1]);
  1030. X    tmps2 = str_get(st[2]);
  1031. X#ifdef TAINT
  1032. X    taintproper("Insecure dependency in link");
  1033. X#endif
  1034. X    value = (double)(link(tmps,tmps2) >= 0);
  1035. X    goto donumset;
  1036. X#else
  1037. X    fatal("Unsupported function link");
  1038. X    break;
  1039. X#endif
  1040. X    case O_MKDIR:
  1041. X    tmps = str_get(st[1]);
  1042. X    anum = (int)str_gnum(st[2]);
  1043. X#ifdef TAINT
  1044. X    taintproper("Insecure dependency in mkdir");
  1045. X#endif
  1046. X#ifdef HAS_MKDIR
  1047. X    value = (double)(mkdir(tmps,anum) >= 0);
  1048. X    goto donumset;
  1049. X#else
  1050. X    (void)strcpy(buf,"mkdir ");
  1051. X#endif
  1052. X#if !defined(HAS_MKDIR) || !defined(HAS_RMDIR)
  1053. X      one_liner:
  1054. X    for (tmps2 = buf+6; *tmps; ) {
  1055. X        *tmps2++ = '\\';
  1056. X        *tmps2++ = *tmps++;
  1057. X    }
  1058. X    (void)strcpy(tmps2," 2>&1");
  1059. X    rsfp = mypopen(buf,"r");
  1060. X    if (rsfp) {
  1061. X        *buf = '\0';
  1062. X        tmps2 = fgets(buf,sizeof buf,rsfp);
  1063. X        (void)mypclose(rsfp);
  1064. X        if (tmps2 != Nullch) {
  1065. X        for (errno = 1; errno < sys_nerr; errno++) {
  1066. X            if (instr(buf,sys_errlist[errno]))    /* you don't see this */
  1067. X            goto say_zero;
  1068. X        }
  1069. X        errno = 0;
  1070. X#ifndef EACCES
  1071. X#define EACCES EPERM
  1072. X#endif
  1073. X        if (instr(buf,"cannot make"))
  1074. X            errno = EEXIST;
  1075. X        else if (instr(buf,"existing file"))
  1076. X            errno = EEXIST;
  1077. X        else if (instr(buf,"ile exists"))
  1078. X            errno = EEXIST;
  1079. X        else if (instr(buf,"non-exist"))
  1080. X            errno = ENOENT;
  1081. X        else if (instr(buf,"does not exist"))
  1082. X            errno = ENOENT;
  1083. X        else if (instr(buf,"not empty"))
  1084. X            errno = EBUSY;
  1085. X        else if (instr(buf,"cannot access"))
  1086. X            errno = EACCES;
  1087. X        else
  1088. X            errno = EPERM;
  1089. X        goto say_zero;
  1090. X        }
  1091. X        else {    /* some mkdirs return no failure indication */
  1092. X        tmps = str_get(st[1]);
  1093. X        anum = (stat(tmps,&statbuf) >= 0);
  1094. X        if (optype == O_RMDIR)
  1095. X            anum = !anum;
  1096. X        if (anum)
  1097. X            errno = 0;
  1098. X        else
  1099. X            errno = EACCES;    /* a guess */
  1100. X        value = (double)anum;
  1101. X        }
  1102. X        goto donumset;
  1103. X    }
  1104. X    else
  1105. X        goto say_zero;
  1106. X#endif
  1107. X    case O_RMDIR:
  1108. X    if (maxarg < 1)
  1109. X        tmps = str_get(stab_val(defstab));
  1110. X    else
  1111. X        tmps = str_get(st[1]);
  1112. X#ifdef TAINT
  1113. X    taintproper("Insecure dependency in rmdir");
  1114. X#endif
  1115. X#ifdef HAS_RMDIR
  1116. X    value = (double)(rmdir(tmps) >= 0);
  1117. X    goto donumset;
  1118. X#else
  1119. X    (void)strcpy(buf,"rmdir ");
  1120. X    goto one_liner;        /* see above in HAS_MKDIR */
  1121. X#endif
  1122. X    case O_GETPPID:
  1123. X#ifdef HAS_GETPPID
  1124. X    value = (double)getppid();
  1125. X    goto donumset;
  1126. X#else
  1127. X    fatal("Unsupported function getppid");
  1128. X    break;
  1129. X#endif
  1130. X    case O_GETPGRP:
  1131. X#ifdef HAS_GETPGRP
  1132. X    if (maxarg < 1)
  1133. X        anum = 0;
  1134. X    else
  1135. X        anum = (int)str_gnum(st[1]);
  1136. X    value = (double)getpgrp(anum);
  1137. X    goto donumset;
  1138. X#else
  1139. X    fatal("The getpgrp() function is unimplemented on this machine");
  1140. X    break;
  1141. X#endif
  1142. X    case O_SETPGRP:
  1143. X#ifdef HAS_SETPGRP
  1144. X    argtype = (int)str_gnum(st[1]);
  1145. X    anum = (int)str_gnum(st[2]);
  1146. X#ifdef TAINT
  1147. X    taintproper("Insecure dependency in setpgrp");
  1148. X#endif
  1149. X    value = (double)(setpgrp(argtype,anum) >= 0);
  1150. X    goto donumset;
  1151. X#else
  1152. X    fatal("The setpgrp() function is unimplemented on this machine");
  1153. X    break;
  1154. X#endif
  1155. X    case O_GETPRIORITY:
  1156. X#ifdef HAS_GETPRIORITY
  1157. X    argtype = (int)str_gnum(st[1]);
  1158. X    anum = (int)str_gnum(st[2]);
  1159. X    value = (double)getpriority(argtype,anum);
  1160. X    goto donumset;
  1161. X#else
  1162. X    fatal("The getpriority() function is unimplemented on this machine");
  1163. X    break;
  1164. X#endif
  1165. X    case O_SETPRIORITY:
  1166. X#ifdef HAS_SETPRIORITY
  1167. X    argtype = (int)str_gnum(st[1]);
  1168. X    anum = (int)str_gnum(st[2]);
  1169. X    optype = (int)str_gnum(st[3]);
  1170. X#ifdef TAINT
  1171. X    taintproper("Insecure dependency in setpriority");
  1172. X#endif
  1173. X    value = (double)(setpriority(argtype,anum,optype) >= 0);
  1174. X    goto donumset;
  1175. X#else
  1176. X    fatal("The setpriority() function is unimplemented on this machine");
  1177. X    break;
  1178. X#endif
  1179. X    case O_CHROOT:
  1180. X#ifdef HAS_CHROOT
  1181. X    if (maxarg < 1)
  1182. X        tmps = str_get(stab_val(defstab));
  1183. X    else
  1184. X        tmps = str_get(st[1]);
  1185. X#ifdef TAINT
  1186. X    taintproper("Insecure dependency in chroot");
  1187. X#endif
  1188. X    value = (double)(chroot(tmps) >= 0);
  1189. X    goto donumset;
  1190. X#else
  1191. X    fatal("Unsupported function chroot");
  1192. X    break;
  1193. X#endif
  1194. X    case O_FCNTL:
  1195. X    case O_IOCTL:
  1196. X    if (maxarg <= 0)
  1197. X        stab = last_in_stab;
  1198. X    else if ((arg[1].arg_type & A_MASK) == A_WORD)
  1199. X        stab = arg[1].arg_ptr.arg_stab;
  1200. X    else
  1201. X        stab = stabent(str_get(st[1]),TRUE);
  1202. X    argtype = U_I(str_gnum(st[2]));
  1203. X#ifdef TAINT
  1204. X    taintproper("Insecure dependency in ioctl");
  1205. X#endif
  1206. X    anum = do_ctl(optype,stab,argtype,st[3]);
  1207. X    if (anum == -1)
  1208. X        goto say_undef;
  1209. X    if (anum != 0) {
  1210. X        value = (double)anum;
  1211. X        goto donumset;
  1212. X    }
  1213. X    str_set(str,"0 but true");
  1214. X    STABSET(str);
  1215. X    break;
  1216. X    case O_FLOCK:
  1217. X#ifdef HAS_FLOCK
  1218. X    if (maxarg <= 0)
  1219. X        stab = last_in_stab;
  1220. X    else if ((arg[1].arg_type & A_MASK) == A_WORD)
  1221. X        stab = arg[1].arg_ptr.arg_stab;
  1222. X    else
  1223. X        stab = stabent(str_get(st[1]),TRUE);
  1224. X    if (stab && stab_io(stab))
  1225. X        fp = stab_io(stab)->ifp;
  1226. X    else
  1227. X        fp = Nullfp;
  1228. X    if (fp) {
  1229. X        argtype = (int)str_gnum(st[2]);
  1230. X        value = (double)(flock(fileno(fp),argtype) >= 0);
  1231. X    }
  1232. X    else
  1233. X        value = 0;
  1234. X    goto donumset;
  1235. X#else
  1236. X    fatal("The flock() function is unimplemented on this machine");
  1237. X    break;
  1238. X#endif
  1239. X    case O_UNSHIFT:
  1240. X    ary = stab_array(arg[1].arg_ptr.arg_stab);
  1241. X    if (arglast[2] - arglast[1] != 1)
  1242. X        do_unshift(ary,arglast);
  1243. X    else {
  1244. X        STR *tmpstr = Str_new(52,0);    /* must copy the STR */
  1245. X        str_sset(tmpstr,st[2]);
  1246. X        aunshift(ary,1);
  1247. X        (void)astore(ary,0,tmpstr);
  1248. X    }
  1249. X    value = (double)(ary->ary_fill + 1);
  1250. X    goto donumset;
  1251. X
  1252. X    case O_REQUIRE:
  1253. X    case O_DOFILE:
  1254. X    case O_EVAL:
  1255. X    if (maxarg < 1)
  1256. X        tmpstr = stab_val(defstab);
  1257. X    else
  1258. X        tmpstr =
  1259. X          (arg[1].arg_type & A_MASK) != A_NULL ? st[1] : stab_val(defstab);
  1260. X#ifdef TAINT
  1261. X    tainted |= tmpstr->str_tainted;
  1262. X    taintproper("Insecure dependency in eval");
  1263. X#endif
  1264. X    sp = do_eval(tmpstr, optype, curcmd->c_stash,
  1265. X        gimme,arglast);
  1266. X    goto array_return;
  1267. X
  1268. X    case O_FTRREAD:
  1269. X    argtype = 0;
  1270. X    anum = S_IRUSR;
  1271. X    goto check_perm;
  1272. X    case O_FTRWRITE:
  1273. X    argtype = 0;
  1274. X    anum = S_IWUSR;
  1275. X    goto check_perm;
  1276. X    case O_FTREXEC:
  1277. X    argtype = 0;
  1278. X    anum = S_IXUSR;
  1279. X    goto check_perm;
  1280. X    case O_FTEREAD:
  1281. X    argtype = 1;
  1282. X    anum = S_IRUSR;
  1283. X    goto check_perm;
  1284. X    case O_FTEWRITE:
  1285. X    argtype = 1;
  1286. X    anum = S_IWUSR;
  1287. X    goto check_perm;
  1288. X    case O_FTEEXEC:
  1289. X    argtype = 1;
  1290. X    anum = S_IXUSR;
  1291. X      check_perm:
  1292. X    if (mystat(arg,st[1]) < 0)
  1293. X        goto say_undef;
  1294. X    if (cando(anum,argtype,&statcache))
  1295. X        goto say_yes;
  1296. X    goto say_no;
  1297. X
  1298. X    case O_FTIS:
  1299. X    if (mystat(arg,st[1]) < 0)
  1300. X        goto say_undef;
  1301. X    goto say_yes;
  1302. X    case O_FTEOWNED:
  1303. X    case O_FTROWNED:
  1304. X    if (mystat(arg,st[1]) < 0)
  1305. X        goto say_undef;
  1306. X    if (statcache.st_uid == (optype == O_FTEOWNED ? euid : uid) )
  1307. X        goto say_yes;
  1308. X    goto say_no;
  1309. X    case O_FTZERO:
  1310. X    if (mystat(arg,st[1]) < 0)
  1311. X        goto say_undef;
  1312. X    if (!statcache.st_size)
  1313. X        goto say_yes;
  1314. X    goto say_no;
  1315. X    case O_FTSIZE:
  1316. X    if (mystat(arg,st[1]) < 0)
  1317. X        goto say_undef;
  1318. X    value = (double)statcache.st_size;
  1319. X    goto donumset;
  1320. X
  1321. X    case O_FTMTIME:
  1322. X    if (mystat(arg,st[1]) < 0)
  1323. X        goto say_undef;
  1324. X    value = (double)(basetime - statcache.st_mtime) / 86400.0;
  1325. X    goto donumset;
  1326. X    case O_FTATIME:
  1327. X    if (mystat(arg,st[1]) < 0)
  1328. X        goto say_undef;
  1329. X    value = (double)(basetime - statcache.st_atime) / 86400.0;
  1330. X    goto donumset;
  1331. X    case O_FTCTIME:
  1332. X    if (mystat(arg,st[1]) < 0)
  1333. X        goto say_undef;
  1334. X    value = (double)(basetime - statcache.st_ctime) / 86400.0;
  1335. X    goto donumset;
  1336. X
  1337. X    case O_FTSOCK:
  1338. X    if (mystat(arg,st[1]) < 0)
  1339. X        goto say_undef;
  1340. X    if (S_ISSOCK(statcache.st_mode))
  1341. X        goto say_yes;
  1342. X    goto say_no;
  1343. X    case O_FTCHR:
  1344. X    if (mystat(arg,st[1]) < 0)
  1345. X        goto say_undef;
  1346. X    if (S_ISCHR(statcache.st_mode))
  1347. X        goto say_yes;
  1348. X    goto say_no;
  1349. X    case O_FTBLK:
  1350. X    if (mystat(arg,st[1]) < 0)
  1351. X        goto say_undef;
  1352. X    if (S_ISBLK(statcache.st_mode))
  1353. X        goto say_yes;
  1354. X    goto say_no;
  1355. X    case O_FTFILE:
  1356. X    if (mystat(arg,st[1]) < 0)
  1357. X        goto say_undef;
  1358. X    if (S_ISREG(statcache.st_mode))
  1359. X        goto say_yes;
  1360. X    goto say_no;
  1361. X    case O_FTDIR:
  1362. X    if (mystat(arg,st[1]) < 0)
  1363. X        goto say_undef;
  1364. X    if (S_ISDIR(statcache.st_mode))
  1365. X        goto say_yes;
  1366. X    goto say_no;
  1367. X    case O_FTPIPE:
  1368. X    if (mystat(arg,st[1]) < 0)
  1369. X        goto say_undef;
  1370. X    if (S_ISFIFO(statcache.st_mode))
  1371. X        goto say_yes;
  1372. X    goto say_no;
  1373. X    case O_FTLINK:
  1374. X    if (mylstat(arg,st[1]) < 0)
  1375. X        goto say_undef;
  1376. X    if (S_ISLNK(statcache.st_mode))
  1377. X        goto say_yes;
  1378. X    goto say_no;
  1379. X    case O_SYMLINK:
  1380. X#ifdef HAS_SYMLINK
  1381. X    tmps = str_get(st[1]);
  1382. X    tmps2 = str_get(st[2]);
  1383. X#ifdef TAINT
  1384. X    taintproper("Insecure dependency in symlink");
  1385. X#endif
  1386. X    value = (double)(symlink(tmps,tmps2) >= 0);
  1387. X    goto donumset;
  1388. X#else
  1389. X    fatal("Unsupported function symlink");
  1390. X#endif
  1391. X    case O_READLINK:
  1392. X#ifdef HAS_SYMLINK
  1393. X    if (maxarg < 1)
  1394. X        tmps = str_get(stab_val(defstab));
  1395. X    else
  1396. X        tmps = str_get(st[1]);
  1397. X    anum = readlink(tmps,buf,sizeof buf);
  1398. X    if (anum < 0)
  1399. X        goto say_undef;
  1400. X    str_nset(str,buf,anum);
  1401. X    break;
  1402. X#else
  1403. X    goto say_undef;        /* just pretend it's a normal file */
  1404. X#endif
  1405. X    case O_FTSUID:
  1406. X#ifdef S_ISUID
  1407. X    anum = S_ISUID;
  1408. X    goto check_xid;
  1409. X#else
  1410. X    goto say_no;
  1411. X#endif
  1412. X    case O_FTSGID:
  1413. X#ifdef S_ISGID
  1414. X    anum = S_ISGID;
  1415. X    goto check_xid;
  1416. X#else
  1417. X    goto say_no;
  1418. X#endif
  1419. X    case O_FTSVTX:
  1420. X#ifdef S_ISVTX
  1421. X    anum = S_ISVTX;
  1422. X#else
  1423. X    goto say_no;
  1424. X#endif
  1425. X      check_xid:
  1426. X    if (mystat(arg,st[1]) < 0)
  1427. X        goto say_undef;
  1428. X    if (statcache.st_mode & anum)
  1429. X        goto say_yes;
  1430. X    goto say_no;
  1431. X    case O_FTTTY:
  1432. X    if (arg[1].arg_type & A_DONT) {
  1433. X        stab = arg[1].arg_ptr.arg_stab;
  1434. X        tmps = "";
  1435. X    }
  1436. X    else
  1437. X        stab = stabent(tmps = str_get(st[1]),FALSE);
  1438. X    if (stab && stab_io(stab) && stab_io(stab)->ifp)
  1439. X        anum = fileno(stab_io(stab)->ifp);
  1440. X    else if (isdigit(*tmps))
  1441. X        anum = atoi(tmps);
  1442. X    else
  1443. X        goto say_undef;
  1444. X    if (isatty(anum))
  1445. X        goto say_yes;
  1446. X    goto say_no;
  1447. X    case O_FTTEXT:
  1448. X    case O_FTBINARY:
  1449. X    str = do_fttext(arg,st[1]);
  1450. X    break;
  1451. X#ifdef HAS_SOCKET
  1452. X    case O_SOCKET:
  1453. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1454. X        stab = arg[1].arg_ptr.arg_stab;
  1455. X    else
  1456. X        stab = stabent(str_get(st[1]),TRUE);
  1457. X#ifndef lint
  1458. X    value = (double)do_socket(stab,arglast);
  1459. X#else
  1460. X    (void)do_socket(stab,arglast);
  1461. X#endif
  1462. X    goto donumset;
  1463. X    case O_BIND:
  1464. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1465. X        stab = arg[1].arg_ptr.arg_stab;
  1466. X    else
  1467. X        stab = stabent(str_get(st[1]),TRUE);
  1468. X#ifndef lint
  1469. X    value = (double)do_bind(stab,arglast);
  1470. X#else
  1471. X    (void)do_bind(stab,arglast);
  1472. X#endif
  1473. X    goto donumset;
  1474. X    case O_CONNECT:
  1475. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1476. X        stab = arg[1].arg_ptr.arg_stab;
  1477. X    else
  1478. X        stab = stabent(str_get(st[1]),TRUE);
  1479. X#ifndef lint
  1480. X    value = (double)do_connect(stab,arglast);
  1481. X#else
  1482. X    (void)do_connect(stab,arglast);
  1483. X#endif
  1484. X    goto donumset;
  1485. X    case O_LISTEN:
  1486. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1487. X        stab = arg[1].arg_ptr.arg_stab;
  1488. X    else
  1489. X        stab = stabent(str_get(st[1]),TRUE);
  1490. X#ifndef lint
  1491. X    value = (double)do_listen(stab,arglast);
  1492. X#else
  1493. X    (void)do_listen(stab,arglast);
  1494. X#endif
  1495. X    goto donumset;
  1496. X    case O_ACCEPT:
  1497. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1498. X        stab = arg[1].arg_ptr.arg_stab;
  1499. X    else
  1500. X        stab = stabent(str_get(st[1]),TRUE);
  1501. X    if ((arg[2].arg_type & A_MASK) == A_WORD)
  1502. X        stab2 = arg[2].arg_ptr.arg_stab;
  1503. X    else
  1504. X        stab2 = stabent(str_get(st[2]),TRUE);
  1505. X    do_accept(str,stab,stab2);
  1506. X    STABSET(str);
  1507. X    break;
  1508. X    case O_GHBYNAME:
  1509. X    if (maxarg < 1)
  1510. X        goto say_undef;
  1511. X    case O_GHBYADDR:
  1512. X    case O_GHOSTENT:
  1513. X    sp = do_ghent(optype,
  1514. X      gimme,arglast);
  1515. X    goto array_return;
  1516. X    case O_GNBYNAME:
  1517. X    if (maxarg < 1)
  1518. X        goto say_undef;
  1519. X    case O_GNBYADDR:
  1520. X    case O_GNETENT:
  1521. X    sp = do_gnent(optype,
  1522. X      gimme,arglast);
  1523. X    goto array_return;
  1524. X    case O_GPBYNAME:
  1525. X    if (maxarg < 1)
  1526. X        goto say_undef;
  1527. X    case O_GPBYNUMBER:
  1528. X    case O_GPROTOENT:
  1529. X    sp = do_gpent(optype,
  1530. X      gimme,arglast);
  1531. X    goto array_return;
  1532. X    case O_GSBYNAME:
  1533. X    if (maxarg < 1)
  1534. X        goto say_undef;
  1535. X    case O_GSBYPORT:
  1536. X    case O_GSERVENT:
  1537. X    sp = do_gsent(optype,
  1538. X      gimme,arglast);
  1539. X    goto array_return;
  1540. X    case O_SHOSTENT:
  1541. X    value = (double) sethostent((int)str_gnum(st[1]));
  1542. X    goto donumset;
  1543. X    case O_SNETENT:
  1544. X    value = (double) setnetent((int)str_gnum(st[1]));
  1545. X    goto donumset;
  1546. X    case O_SPROTOENT:
  1547. X    value = (double) setprotoent((int)str_gnum(st[1]));
  1548. X    goto donumset;
  1549. X    case O_SSERVENT:
  1550. X    value = (double) setservent((int)str_gnum(st[1]));
  1551. X    goto donumset;
  1552. X    case O_EHOSTENT:
  1553. X    value = (double) endhostent();
  1554. X    goto donumset;
  1555. X    case O_ENETENT:
  1556. X    value = (double) endnetent();
  1557. X    goto donumset;
  1558. X    case O_EPROTOENT:
  1559. X    value = (double) endprotoent();
  1560. X    goto donumset;
  1561. X    case O_ESERVENT:
  1562. X    value = (double) endservent();
  1563. X    goto donumset;
  1564. X    case O_SOCKPAIR:
  1565. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1566. X        stab = arg[1].arg_ptr.arg_stab;
  1567. X    else
  1568. X        stab = stabent(str_get(st[1]),TRUE);
  1569. X    if ((arg[2].arg_type & A_MASK) == A_WORD)
  1570. X        stab2 = arg[2].arg_ptr.arg_stab;
  1571. X    else
  1572. X        stab2 = stabent(str_get(st[2]),TRUE);
  1573. X#ifndef lint
  1574. X    value = (double)do_spair(stab,stab2,arglast);
  1575. X#else
  1576. X    (void)do_spair(stab,stab2,arglast);
  1577. X#endif
  1578. X    goto donumset;
  1579. X    case O_SHUTDOWN:
  1580. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1581. X        stab = arg[1].arg_ptr.arg_stab;
  1582. X    else
  1583. X        stab = stabent(str_get(st[1]),TRUE);
  1584. X#ifndef lint
  1585. X    value = (double)do_shutdown(stab,arglast);
  1586. X#else
  1587. X    (void)do_shutdown(stab,arglast);
  1588. X#endif
  1589. X    goto donumset;
  1590. X    case O_GSOCKOPT:
  1591. X    case O_SSOCKOPT:
  1592. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1593. X        stab = arg[1].arg_ptr.arg_stab;
  1594. X    else
  1595. X        stab = stabent(str_get(st[1]),TRUE);
  1596. X    sp = do_sopt(optype,stab,arglast);
  1597. X    goto array_return;
  1598. X    case O_GETSOCKNAME:
  1599. X    case O_GETPEERNAME:
  1600. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1601. X        stab = arg[1].arg_ptr.arg_stab;
  1602. X    else
  1603. X        stab = stabent(str_get(st[1]),TRUE);
  1604. X    if (!stab)
  1605. X        goto say_undef;
  1606. X    sp = do_getsockname(optype,stab,arglast);
  1607. X    goto array_return;
  1608. X
  1609. X#else /* HAS_SOCKET not defined */
  1610. X    case O_SOCKET:
  1611. X    case O_BIND:
  1612. X    case O_CONNECT:
  1613. X    case O_LISTEN:
  1614. X    case O_ACCEPT:
  1615. X    case O_SOCKPAIR:
  1616. X    case O_GHBYNAME:
  1617. X    case O_GHBYADDR:
  1618. X    case O_GHOSTENT:
  1619. X    case O_GNBYNAME:
  1620. X    case O_GNBYADDR:
  1621. X    case O_GNETENT:
  1622. X    case O_GPBYNAME:
  1623. X    case O_GPBYNUMBER:
  1624. X    case O_GPROTOENT:
  1625. X    case O_GSBYNAME:
  1626. X    case O_GSBYPORT:
  1627. X    case O_GSERVENT:
  1628. X    case O_SHOSTENT:
  1629. X    case O_SNETENT:
  1630. X    case O_SPROTOENT:
  1631. X    case O_SSERVENT:
  1632. X    case O_EHOSTENT:
  1633. X    case O_ENETENT:
  1634. X    case O_EPROTOENT:
  1635. X    case O_ESERVENT:
  1636. X    case O_SHUTDOWN:
  1637. X    case O_GSOCKOPT:
  1638. X    case O_SSOCKOPT:
  1639. X    case O_GETSOCKNAME:
  1640. X    case O_GETPEERNAME:
  1641. X      badsock:
  1642. X    fatal("Unsupported socket function");
  1643. X#endif /* HAS_SOCKET */
  1644. X    case O_SSELECT:
  1645. X#ifdef HAS_SELECT
  1646. X    sp = do_select(gimme,arglast);
  1647. X    goto array_return;
  1648. X#else
  1649. X    fatal("select not implemented");
  1650. X#endif
  1651. X    case O_FILENO:
  1652. X    if (maxarg < 1)
  1653. X        goto say_undef;
  1654. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1655. X        stab = arg[1].arg_ptr.arg_stab;
  1656. X    else
  1657. X        stab = stabent(str_get(st[1]),TRUE);
  1658. X    if (!stab || !(stio = stab_io(stab)) || !(fp = stio->ifp))
  1659. X        goto say_undef;
  1660. X    value = fileno(fp);
  1661. X    goto donumset;
  1662. X    case O_BINMODE:
  1663. X    if (maxarg < 1)
  1664. X        goto say_undef;
  1665. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1666. X        stab = arg[1].arg_ptr.arg_stab;
  1667. X    else
  1668. X        stab = stabent(str_get(st[1]),TRUE);
  1669. X    if (!stab || !(stio = stab_io(stab)) || !(fp = stio->ifp))
  1670. X        goto say_undef;
  1671. X#ifdef MSDOS
  1672. X    str_set(str, (setmode(fileno(fp), O_BINARY) != -1) ? Yes : No);
  1673. X#else
  1674. X    str_set(str, Yes);
  1675. X#endif
  1676. X    STABSET(str);
  1677. X    break;
  1678. X    case O_VEC:
  1679. X    sp = do_vec(str == st[1], arg->arg_ptr.arg_str, arglast);
  1680. X    goto array_return;
  1681. X    case O_GPWNAM:
  1682. X    case O_GPWUID:
  1683. X    case O_GPWENT:
  1684. X#ifdef HAS_PASSWD
  1685. X    sp = do_gpwent(optype,
  1686. X      gimme,arglast);
  1687. X    goto array_return;
  1688. X    case O_SPWENT:
  1689. X    value = (double) setpwent();
  1690. X    goto donumset;
  1691. X    case O_EPWENT:
  1692. X    value = (double) endpwent();
  1693. X    goto donumset;
  1694. X#else
  1695. X    case O_EPWENT:
  1696. X    case O_SPWENT:
  1697. X    fatal("Unsupported password function");
  1698. X    break;
  1699. X#endif
  1700. X    case O_GGRNAM:
  1701. X    case O_GGRGID:
  1702. X    case O_GGRENT:
  1703. X#ifdef HAS_GROUP
  1704. X    sp = do_ggrent(optype,
  1705. X      gimme,arglast);
  1706. X    goto array_return;
  1707. X    case O_SGRENT:
  1708. X    value = (double) setgrent();
  1709. X    goto donumset;
  1710. X    case O_EGRENT:
  1711. X    value = (double) endgrent();
  1712. X    goto donumset;
  1713. X#else
  1714. X    case O_EGRENT:
  1715. X    case O_SGRENT:
  1716. X    fatal("Unsupported group function");
  1717. X    break;
  1718. X#endif
  1719. X    case O_GETLOGIN:
  1720. X#ifdef HAS_GETLOGIN
  1721. X    if (!(tmps = getlogin()))
  1722. X        goto say_undef;
  1723. X    str_set(str,tmps);
  1724. X#else
  1725. X    fatal("Unsupported function getlogin");
  1726. X#endif
  1727. X    break;
  1728. X    case O_OPENDIR:
  1729. X    case O_READDIR:
  1730. X    case O_TELLDIR:
  1731. X    case O_SEEKDIR:
  1732. X    case O_REWINDDIR:
  1733. X    case O_CLOSEDIR:
  1734. X    if (maxarg < 1)
  1735. X        goto say_undef;
  1736. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1737. X        stab = arg[1].arg_ptr.arg_stab;
  1738. X    else
  1739. X        stab = stabent(str_get(st[1]),TRUE);
  1740. X    if (!stab)
  1741. X        goto say_undef;
  1742. X    sp = do_dirop(optype,stab,gimme,arglast);
  1743. X    goto array_return;
  1744. X    case O_SYSCALL:
  1745. X    value = (double)do_syscall(arglast);
  1746. X    goto donumset;
  1747. X    case O_PIPE:
  1748. X#ifdef HAS_PIPE
  1749. X    if ((arg[1].arg_type & A_MASK) == A_WORD)
  1750. X        stab = arg[1].arg_ptr.arg_stab;
  1751. X    else
  1752. X        stab = stabent(str_get(st[1]),TRUE);
  1753. X    if ((arg[2].arg_type & A_MASK) == A_WORD)
  1754. X        stab2 = arg[2].arg_ptr.arg_stab;
  1755. X    else
  1756. X        stab2 = stabent(str_get(st[2]),TRUE);
  1757. X    do_pipe(str,stab,stab2);
  1758. X    STABSET(str);
  1759. X#else
  1760. X    fatal("Unsupported function pipe");
  1761. X#endif
  1762. X    break;
  1763. X    }
  1764. X
  1765. X  normal_return:
  1766. X    st[1] = str;
  1767. X#ifdef DEBUGGING
  1768. X    if (debug) {
  1769. X    dlevel--;
  1770. X    if (debug & 8)
  1771. X        deb("%s RETURNS \"%s\"\n",opname[optype],str_get(str));
  1772. X    }
  1773. X#endif
  1774. X    return arglast[0] + 1;
  1775. X}
  1776. !STUFFY!FUNK!
  1777. echo Extracting lib/ctime.pl
  1778. sed >lib/ctime.pl <<'!STUFFY!FUNK!' -e 's/X//'
  1779. X;# ctime.pl is a simple Perl emulation for the well known ctime(3C) function.
  1780. X;#
  1781. X;# Waldemar Kebsch, Federal Republic of Germany, November 1988
  1782. X;# kebsch.pad@nixpbe.UUCP
  1783. X;# Modified March 1990, Feb 1991 to properly handle timezones
  1784. X;#  $Id: ctime.pl,v 1.8 91/02/04 18:28:12 hakanson Exp $
  1785. X;#   Marion Hakanson (hakanson@cse.ogi.edu)
  1786. X;#   Oregon Graduate Institute of Science and Technology
  1787. X;#
  1788. X;# usage:
  1789. X;#
  1790. X;#     #include <ctime.pl>          # see the -P and -I option in perl.man
  1791. X;#     $Date = &ctime(time);
  1792. X
  1793. XCONFIG: {
  1794. X    package ctime;
  1795. X
  1796. X    @DoW = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
  1797. X    @MoY = ('Jan','Feb','Mar','Apr','May','Jun',
  1798. X        'Jul','Aug','Sep','Oct','Nov','Dec');
  1799. X}
  1800. X
  1801. Xsub ctime {
  1802. X    package ctime;
  1803. X
  1804. X    local($time) = @_;
  1805. X    local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
  1806. X
  1807. X    # Determine what time zone is in effect.
  1808. X    # Use GMT if TZ is defined as null, local time if TZ undefined.
  1809. X    # There's no portable way to find the system default timezone.
  1810. X
  1811. X    $TZ = defined($ENV{'TZ'}) ? ( $ENV{'TZ'} ? $ENV{'TZ'} : 'GMT' ) : '';
  1812. X    ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
  1813. X        ($TZ eq 'GMT') ? gmtime($time) : localtime($time);
  1814. X
  1815. X    # Hack to deal with 'PST8PDT' format of TZ
  1816. X    # Note that this can't deal with all the esoteric forms, but it
  1817. X    # does recognize the most common: [:]STDoff[DST[off][,rule]]
  1818. X
  1819. X    if($TZ=~/^([^:\d+\-,]{3,})([+-]?\d{1,2}(:\d{1,2}){0,2})([^\d+\-,]{3,})?/){
  1820. X        $TZ = $isdst ? $4 : $1;
  1821. X    }
  1822. X    $TZ .= ' ' unless $TZ eq '';
  1823. X
  1824. X    $year += ($year < 70) ? 2000 : 1900;
  1825. X    sprintf("%s %s %2d %2d:%02d:%02d %s%4d\n",
  1826. X      $DoW[$wday], $MoY[$mon], $mday, $hour, $min, $sec, $TZ, $year);
  1827. X}
  1828. X1;
  1829. !STUFFY!FUNK!
  1830. echo " "
  1831. echo "End of kit 23 (of 36)"
  1832. cat /dev/null >kit23isdone
  1833. run=''
  1834. config=''
  1835. 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
  1836.     if test -f kit${iskit}isdone; then
  1837.     run="$run $iskit"
  1838.     else
  1839.     todo="$todo $iskit"
  1840.     fi
  1841. done
  1842. case $todo in
  1843.     '')
  1844.     echo "You have run all your kits.  Please read README and then type Configure."
  1845.     for combo in *:AA; do
  1846.         if test -f "$combo"; then
  1847.         realfile=`basename $combo :AA`
  1848.         cat $realfile:[A-Z][A-Z] >$realfile
  1849.         rm -rf $realfile:[A-Z][A-Z]
  1850.         fi
  1851.     done
  1852.     rm -rf kit*isdone
  1853.     chmod 755 Configure
  1854.     ;;
  1855.     *)  echo "You have run$run."
  1856.     echo "You still need to run$todo."
  1857.     ;;
  1858. esac
  1859. : Someone might mail this, so...
  1860. exit
  1861.  
  1862. exit 0 # Just in case...
  1863. -- 
  1864. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1865. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1866. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1867. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1868.