home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume18 / perl / part14 < prev    next >
Internet Message Format  |  1991-04-15  |  51KB

  1. From: lwall@netlabs.com (Larry Wall)
  2. Newsgroups: comp.sources.misc
  3. Subject: v18i032:  perl - The perl programming language, Part14/36
  4. Message-ID: <1991Apr16.000114.22955@sparky.IMD.Sterling.COM>
  5. Date: 16 Apr 91 00:01:14 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: b6f559f5 4099aac1 9fddf96c 864ebc3f
  8.  
  9. Submitted-by: Larry Wall <lwall@netlabs.com>
  10. Posting-number: Volume 18, Issue 32
  11. Archive-name: perl/part14
  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 14 (of 36).  If kit 14 is complete, the line"
  21. echo '"'"End of kit 14 (of 36)"'" will echo at the end.'
  22. echo ""
  23. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  24. mkdir t t/op usub 2>/dev/null
  25. echo Extracting Configure:AB
  26. sed >Configure:AB <<'!STUFFY!FUNK!' -e 's/X//'
  27. Xval=$D_dirnamlen;    set d_dirnamlen;    eval $setvar
  28. Xval=$I_dirent;        set i_dirent;        eval $setvar
  29. Xval=$I_sys_dir;        set i_sys_dir;        eval $setvar
  30. Xval=$I_my_dir;        set i_my_dir;        eval $setvar
  31. Xval=$I_ndir;        set i_ndir;        eval $setvar
  32. Xval=$I_sys_ndir;    set i_sys_ndir;        eval $setvar
  33. X
  34. X: now see if they want to do setuid emulation
  35. Xcase "$d_dosuid" in
  36. X'') dflt=n;;
  37. X*undef*) dflt=n;;
  38. X*) dflt=y;;
  39. Xesac
  40. Xcat <<EOM
  41. XSome sites have disabled setuid #! scripts because of a bug in the kernel
  42. Xthat prevents them from being secure.  If you are on such a system, the
  43. Xsetuid/setgid bits on scripts are currently useless.  It is possible for
  44. X$package to detect those bits and emulate setuid/setgid in a secure fashion
  45. Xuntil a better solution is devised for the kernel problem.
  46. X
  47. XEOM
  48. Xrp="Do you want to do setuid/setgid emulation? [$dflt]"
  49. X$echo $n "$rp $c"
  50. X. myread
  51. Xcase "$ans" in
  52. X'') $ans="$dflt";;
  53. Xesac
  54. Xcase "$ans" in
  55. Xy*)  d_dosuid="$define";;
  56. X*) d_dosuid="$undef";;
  57. Xesac
  58. X
  59. X: see if dup2 exists
  60. Xset dup2 d_dup2
  61. Xeval $inlibc
  62. X
  63. X: see if fchmod exists
  64. Xset fchmod d_fchmod
  65. Xeval $inlibc
  66. X
  67. X: see if fchown exists
  68. Xset fchown d_fchown
  69. Xeval $inlibc
  70. X
  71. X: see if this is an fcntl system
  72. Xset fcntl d_fcntl
  73. Xeval $inlibc
  74. X
  75. X: see if we can have long filenames
  76. Xecho " "
  77. Xrm -f 123456789abcde
  78. Xif (echo hi >123456789abcdef) 2>/dev/null; then
  79. X    : not version 8
  80. X    if test -f 123456789abcde; then
  81. X    echo 'You cannot have filenames longer than 14 characters.  Sigh.'
  82. X    val="$undef"
  83. X    else
  84. X    echo 'You can have filenames longer than 14 characters.'
  85. X    val="$define"
  86. X    fi
  87. Xelse
  88. X    : version 8 probably
  89. X    echo "You can't have filenames longer than 14 chars.  You can't even think about them!"
  90. X    val="$undef"
  91. Xfi 
  92. Xset d_flexfnam
  93. Xeval $setvar
  94. X
  95. X: see if flock exists
  96. Xset flock d_flock
  97. Xeval $inlibc
  98. X
  99. X: see if getgroups exists
  100. Xset getgroups d_getgrps
  101. Xeval $inlibc
  102. X
  103. X: see if gethostent exists
  104. Xset gethostent d_gethent
  105. Xeval $inlibc
  106. X
  107. X: see if getpgrp exists
  108. Xset getpgrp d_getpgrp
  109. Xeval $inlibc
  110. X
  111. X: see if getpgrp2 exists
  112. Xset getpgrp2 d_getpgrp2
  113. Xeval $inlibc
  114. X
  115. X: see if getpriority exists
  116. Xset getpriority d_getprior
  117. Xeval $inlibc
  118. X
  119. X: see if htonl exists
  120. Xset htonl d_htonl
  121. Xeval $inlibc
  122. X
  123. X: index or strcpy
  124. Xecho " "
  125. Xcase "$d_index" in
  126. Xn) dflt=n;;
  127. X*)  if $test -f /unix; then
  128. X    dflt=n
  129. X    else
  130. X    dflt=y
  131. X    fi
  132. X    ;;
  133. Xesac
  134. Xif $contains '^index$' libc.list >/dev/null 2>&1 ; then
  135. X    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  136. X    echo "Your system has both index() and strchr().  Shall I use"
  137. X    rp="index() rather than strchr()? [$dflt]"
  138. X    $echo $n "$rp $c"
  139. X    . myread
  140. X    case "$ans" in
  141. X        n*) d_index="$define" ;;
  142. X        *)  d_index="$undef" ;;
  143. X    esac
  144. X    else
  145. X    d_index="$undef"
  146. X    echo "index() found."
  147. X    fi
  148. Xelse
  149. X    if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
  150. X    d_index="$define"
  151. X    echo "strchr() found."
  152. X    else
  153. X    echo "No index() or strchr() found!"
  154. X    d_index="$undef"
  155. X    fi
  156. Xfi
  157. X
  158. X: see if killpg exists
  159. Xset killpg d_killpg
  160. Xeval $inlibc
  161. X
  162. X: see if lstat exists
  163. Xset lstat d_lstat
  164. Xeval $inlibc
  165. X
  166. X: see if memcmp exists
  167. Xset memcmp d_memcmp
  168. Xeval $inlibc
  169. X
  170. X: see if memcpy exists
  171. Xset memcpy d_memcpy
  172. Xeval $inlibc
  173. X
  174. X: see if mkdir exists
  175. Xset mkdir d_mkdir
  176. Xeval $inlibc
  177. X
  178. X: see if msgctl exists
  179. Xset msgctl d_msgctl
  180. Xeval $inlibc
  181. X
  182. X: see if msgget exists
  183. Xset msgget d_msgget
  184. Xeval $inlibc
  185. X
  186. X: see if msgsnd exists
  187. Xset msgsnd d_msgsnd
  188. Xeval $inlibc
  189. X
  190. X: see if msgrcv exists
  191. Xset msgrcv d_msgrcv
  192. Xeval $inlibc
  193. X
  194. X: see how much of the 'msg*(2)' library is present.
  195. Xh_msg=true
  196. Xecho " "
  197. Xcase "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
  198. X*undef*) h_msg=false;;
  199. Xesac
  200. X: we could also check for sys/ipc.h ...
  201. Xif $h_msg && $test -r $usrinclude/sys/msg.h; then
  202. X    echo "You have the full msg*(2) library."
  203. X    val="$define"
  204. Xelse
  205. X    echo "You don't have the full msg*(2) library."
  206. X    val="$undef"
  207. Xfi
  208. Xset d_msg
  209. Xeval $setvar
  210. X
  211. X: see if ndbm is available
  212. Xecho " "
  213. Xxxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
  214. Xif test -f $xxx; then
  215. X    val="$define"
  216. X    echo "ndbm.h found."
  217. Xelse
  218. X    val="$undef"
  219. X    echo "ndbm.h not found."
  220. Xfi
  221. Xset d_ndbm
  222. Xeval $setvar
  223. X
  224. X: see if we have the old dbm
  225. Xecho " "
  226. Xxxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
  227. Xif test -f $xxx; then
  228. X    val="$define"
  229. X    echo "dbm.h found."
  230. Xelse
  231. X    val="$undef"
  232. X    echo "dbm.h not found."
  233. Xfi
  234. Xset d_odbm
  235. Xeval $setvar
  236. X
  237. X: see whether socket exists
  238. Xecho " "
  239. Xsocketlib=''
  240. Xif $contains socket libc.list >/dev/null 2>&1; then
  241. X    echo "Looks like you have Berkeley networking support."
  242. X    val="$define"
  243. X    : now check for advanced features
  244. X    if $contains setsockopt libc.list >/dev/null 2>&1; then
  245. X    val2="$undef"
  246. X    else
  247. X    echo "...but it uses the old 4.1c interface, rather than 4.2"
  248. X    val2="$define"
  249. X    fi
  250. Xelse
  251. X    : hpux, for one, puts all the socket stuff in socklib.o
  252. X    if $contains socklib libc.list >/dev/null 2>&1; then
  253. X    echo "Looks like you have Berkeley networking support."
  254. X    val="$define"
  255. X    : we will have to assume that it supports the 4.2 BSD interface
  256. X    val2="$undef"
  257. X    else
  258. X    echo "Hmmm...you don't have Berkeley networking in libc.a..."
  259. X    : look for an optional networking library
  260. X    if test -f /usr/lib/libnet.a; then
  261. X        (ar t /usr/lib/libnet.a ||
  262. X        nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
  263. X        if $contains socket libc.list >/dev/null 2>&1; then
  264. X        echo "but the Wollongong group seems to have hacked it in."
  265. X        socketlib="-lnet -lnsl_s"
  266. X        val="$define"
  267. X        : now check for advanced features
  268. X        if $contains setsockopt libc.list >/dev/null 2>&1; then
  269. X            val2="$undef"
  270. X        else
  271. X            echo "...using the old 4.1c interface, rather than 4.2"
  272. X            val2="$define"
  273. X        fi
  274. X        else
  275. X        echo "or even in libnet.a, which is peculiar."
  276. X        val="$undef"
  277. X        val2="$undef"
  278. X        fi
  279. X    else
  280. X        echo "or anywhere else I see."
  281. X        val="$undef"
  282. X        val2="$undef"
  283. X    fi
  284. X    fi
  285. Xfi
  286. Xset d_socket
  287. Xeval $setvar
  288. X
  289. Xif $contains socketpair libc.list >/dev/null 2>&1; then
  290. X    val="$define"
  291. Xelse
  292. X    val="$undef"
  293. Xfi
  294. Xset d_sockpair
  295. Xeval $setvar
  296. Xval=$val2
  297. Xset d_oldsock
  298. Xeval $setvar
  299. X
  300. X: Locate the flags for 'open()'
  301. Xecho " "
  302. X$cat >open3.c <<'EOCP'
  303. X#include <sys/types.h>
  304. X#ifdef I_FCNTL
  305. X#include <fcntl.h>
  306. X#endif
  307. X#ifdef I_SYS_FILE
  308. X#include <sys/file.h>
  309. X#endif
  310. Xmain() {
  311. X
  312. X    if(O_RDONLY);
  313. X
  314. X#ifdef O_TRUNC
  315. X    exit(0);
  316. X#else
  317. X    exit(1);
  318. X#endif
  319. X}
  320. XEOCP
  321. X: check sys/file.h first to get FREAD on Sun
  322. Xif $test -r $usrinclude/sys/file.h && \
  323. X   $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
  324. X    h_sys_file=true;
  325. X    echo "sys/file.h defines the O_* constants..."
  326. X    if ./open3; then
  327. X    echo "and you have the 3 argument form of open()."
  328. X    val="$define"
  329. X    else
  330. X    echo "but not the 3 argument form of open().  Oh, well."
  331. X    val="$undef"
  332. X    fi
  333. Xelif $test -r $usrinclude/fcntl.h && \
  334. X   $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
  335. X    h_fcntl=true;
  336. X    echo "fcntl.h defines the O_* constants..."
  337. X    if ./open3; then
  338. X    echo "and you have the 3 argument form of open()."
  339. X    val="$define"
  340. X    else
  341. X    echo "but not the 3 argument form of open().  Oh, well."
  342. X    val="$undef"
  343. X    fi
  344. Xelse
  345. X    val="$undef"
  346. X    echo "I can't find the O_* constant definitions!  You got problems."
  347. Xfi
  348. Xset d_open3
  349. Xeval $setvar
  350. X
  351. X: see if how pwd stuff is defined
  352. Xecho " "
  353. Xif $test -r $usrinclude/pwd.h ; then
  354. X    i_pwd="$define"
  355. X    echo "pwd.h found."
  356. X    $cppstdin $cppflags $cppminus <$usrinclude/pwd.h >pwd.txt
  357. X    if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
  358. X    d_pwquota="$define"
  359. X    else
  360. X    d_pwquota="$undef"
  361. X    fi
  362. X    if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
  363. X    d_pwage="$define"
  364. X    else
  365. X    d_pwage="$undef"
  366. X    fi
  367. X    if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
  368. X    d_pwchange="$define"
  369. X    else
  370. X    d_pwchange="$undef"
  371. X    fi
  372. X    if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
  373. X    d_pwclass="$define"
  374. X    else
  375. X    d_pwclass="$undef"
  376. X    fi
  377. X    if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
  378. X    d_pwexpire="$define"
  379. X    else
  380. X    d_pwexpire="$undef"
  381. X    fi
  382. X    if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
  383. X    d_pwcomment="$define"
  384. X    else
  385. X    d_pwcomment="$undef"
  386. X    fi
  387. Xelse
  388. X    i_pwd="$undef"
  389. X    d_pwquota="$undef"
  390. X    d_pwage="$undef"
  391. X    d_pwchange="$undef"
  392. X    d_pwclass="$undef"
  393. X    d_pwexpire="$undef"
  394. X    d_pwcomment="$undef"
  395. X    echo "No pwd.h found."
  396. Xfi
  397. X
  398. X: see if rename exists
  399. Xset rename d_rename
  400. Xeval $inlibc
  401. X
  402. X: see if rmdir exists
  403. Xset rmdir d_rmdir
  404. Xeval $inlibc
  405. X
  406. X: see if select exists
  407. Xset select d_select
  408. Xeval $inlibc
  409. X
  410. X: see if semctl exists
  411. Xset semctl d_semctl
  412. Xeval $inlibc
  413. X
  414. X: see if semget exists
  415. Xset semget d_semget
  416. Xeval $inlibc
  417. X
  418. X: see if semop exists
  419. Xset semop d_semop
  420. Xeval $inlibc
  421. X
  422. X: see how much of the 'sem*(2)' library is present.
  423. Xh_sem=true
  424. Xecho " "
  425. Xcase "$d_semctl$d_semget$d_semop" in
  426. X*undef*) h_sem=false;;
  427. Xesac
  428. X: we could also check for sys/ipc.h ...
  429. Xif $h_sem && $test -r $usrinclude/sys/sem.h; then
  430. X    echo "You have the full sem*(2) library."
  431. X    val="$define"
  432. Xelse
  433. X    echo "You don't have the full sem*(2) library."
  434. X    val="$undef"
  435. Xfi
  436. Xset d_sem
  437. Xeval $setvar
  438. X
  439. X: see if setegid exists
  440. Xset setegid d_setegid
  441. Xeval $inlibc
  442. X
  443. X: see if seteuid exists
  444. Xset seteuid d_seteuid
  445. Xeval $inlibc
  446. X
  447. X: see if setpgrp exists
  448. Xset setpgrp d_setpgrp
  449. Xeval $inlibc
  450. X
  451. X: see if setpgrp2 exists
  452. Xset setpgrp2 d_setpgrp2
  453. Xeval $inlibc
  454. X
  455. X: see if setpriority exists
  456. Xset setpriority d_setprior
  457. Xeval $inlibc
  458. X
  459. X: see if setregid exists
  460. Xset setregid d_setregid
  461. Xeval $inlibc
  462. Xset setresgid d_setresgid
  463. Xeval $inlibc
  464. X
  465. X: see if setreuid exists
  466. Xset setreuid d_setreuid
  467. Xeval $inlibc
  468. Xset setresuid d_setresuid
  469. Xeval $inlibc
  470. X
  471. X: see if setrgid exists
  472. Xset setrgid d_setrgid
  473. Xeval $inlibc
  474. X
  475. X: see if setruid exists
  476. Xset setruid d_setruid
  477. Xeval $inlibc
  478. X
  479. X: see if shmctl exists
  480. Xset shmctl d_shmctl
  481. Xeval $inlibc
  482. X
  483. X: see if shmget exists
  484. Xset shmget d_shmget
  485. Xeval $inlibc
  486. X
  487. X: see if shmat exists
  488. Xset shmat d_shmat
  489. Xeval $inlibc
  490. X
  491. X: see if shmdt exists
  492. Xset shmdt d_shmdt
  493. Xeval $inlibc
  494. X
  495. X: see how much of the 'shm*(2)' library is present.
  496. Xh_shm=true
  497. Xecho " "
  498. Xcase "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
  499. X*undef*) h_shm=false;;
  500. Xesac
  501. X: we could also check for sys/ipc.h ...
  502. Xif $h_shm && $test -r $usrinclude/sys/shm.h; then
  503. X    echo "You have the full shm*(2) library."
  504. X    val="$define"
  505. Xelse
  506. X    echo "You don't have the full shm*(2) library."
  507. X    val="$undef"
  508. Xfi
  509. Xset d_shm
  510. Xeval $setvar
  511. X
  512. X: see if stat knows about block sizes
  513. Xecho " "
  514. Xif $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
  515. X    if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
  516. X    echo "Your stat knows about block sizes."
  517. X    val="$define"
  518. X    else
  519. X    echo "Your stat doesn't know about block sizes."
  520. X    val="$undef"
  521. X    fi
  522. Xelse
  523. X    echo "Your stat doesn't know about block sizes."
  524. X    val="$undef"
  525. Xfi
  526. Xset d_statblks
  527. Xeval $setvar
  528. X
  529. X: see if stdio is really std
  530. Xecho " "
  531. Xif $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
  532. X    if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
  533. X    echo "Your stdio is pretty std."
  534. X    val="$define"
  535. X    else
  536. X    echo "Your stdio isn't very std."
  537. X    val="$undef"
  538. X    fi
  539. Xelse
  540. X    echo "Your stdio isn't very std."
  541. X    val="$undef"
  542. Xfi
  543. Xset d_stdstdio
  544. Xeval $setvar
  545. X
  546. X: check for structure copying
  547. Xecho " "
  548. Xecho "Checking to see if your C compiler can copy structs..."
  549. X$cat >strctcpy.c <<'EOCP'
  550. Xmain()
  551. X{
  552. X    struct blurfl {
  553. X        int dyick;
  554. X    } foo, bar;
  555. X
  556. X    foo = bar;
  557. X}
  558. XEOCP
  559. Xif $cc -c strctcpy.c >/dev/null 2>&1 ; then
  560. X    val="$define"
  561. X    echo "Yup, it can."
  562. Xelse
  563. X    val="$undef"
  564. X    echo "Nope, it can't."
  565. Xfi
  566. Xset d_strctcpy
  567. Xeval $setvar
  568. X
  569. X: see if strerror exists
  570. Xset strerror d_strerror
  571. Xeval $inlibc
  572. X
  573. X: see if symlink exists
  574. Xset symlink d_symlink
  575. Xeval $inlibc
  576. X
  577. X: see if syscall exists
  578. Xset syscall d_syscall
  579. Xeval $inlibc
  580. X
  581. X: set if package uses struct tm
  582. Xw_s_tm=1
  583. X
  584. X: set if package uses struct timeval
  585. Xcase "$d_select" in
  586. Xdefine) w_s_timevl=1 ;;
  587. Xesac
  588. X
  589. X: set if package uses localtime function
  590. Xw_localtim=1
  591. X
  592. X: see which of time.h, sys/time.h, and sys/select should be included.
  593. Xidefs=''
  594. Xcat <<'EOM'
  595. X  
  596. XTesting to see which of <time.h>, <sys/time.h>, and <sys/select.h>
  597. Xshould be included, because this application wants:
  598. X
  599. XEOM
  600. Xcase "$w_s_itimer" in
  601. X1)
  602. X    echo "    struct itimerval"
  603. X    idefs="-DS_ITIMERVAL $idefs"
  604. X    ;;
  605. Xesac
  606. Xcase "$w_s_timevl" in
  607. X1)
  608. X    echo "    struct timeval"
  609. X    idefs="-DS_TIMEVAL $idefs"
  610. X    ;;
  611. Xesac
  612. Xcase "$w_s_tm" in
  613. X1)
  614. X    echo "    struct tm"
  615. X    idefs="-DS_TM $idefs"
  616. X    ;;
  617. Xesac
  618. Xcase "$w_localtim" in
  619. X1)
  620. X    echo "    ctime(3) declarations"
  621. X    idefs="-DD_CTIME $idefs"
  622. X    ;;
  623. Xesac
  624. Xcase "$idefs" in
  625. X'')
  626. X    echo "    (something I don't know about)"
  627. X    ;;
  628. Xesac
  629. Xecho " "
  630. Xecho "I'm now running the test program..."
  631. X$cat >i_time.c <<'EOCP'
  632. X#include <sys/types.h>
  633. X#ifdef I_TIME
  634. X#include <time.h>
  635. X#endif
  636. X#ifdef I_SYS_TIME
  637. X#ifdef SYSTIMEKERNEL
  638. X#define KERNEL
  639. X#endif
  640. X#include <sys/time.h>
  641. X#endif
  642. X#ifdef I_SYS_SELECT
  643. X#include <sys/select.h>
  644. X#endif
  645. Xmain()
  646. X{
  647. X    struct tm foo;
  648. X    struct tm *tmp;
  649. X#ifdef S_TIMEVAL
  650. X    struct timeval bar;
  651. X#endif
  652. X#ifdef S_ITIMERVAL
  653. X    struct itimerval baz;
  654. X#endif
  655. X
  656. X    if (foo.tm_sec == foo.tm_sec)
  657. X    exit(0);
  658. X#ifdef S_TIMEVAL
  659. X    if (bar.tv_sec == bar.tv_sec)
  660. X    exit(0);
  661. X#endif
  662. X#ifdef S_ITIMERVAL
  663. X    if (baz.it_interval == baz.it_interval)
  664. X    exit(0);
  665. X#endif
  666. X#ifdef S_TIMEVAL
  667. X    if (bar.tv_sec == bar.tv_sec)
  668. X    exit(0);
  669. X#endif
  670. X#ifdef D_CTIME
  671. X    /* this might not do anything for us... */
  672. X    tmp = localtime((time_t *)0);
  673. X#endif
  674. X    exit(1);
  675. X}
  676. XEOCP
  677. Xflags=''
  678. Xfor i_sys_select in '' '-DI_SYS_SELECT'; do
  679. X    for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
  680. X    for i_time in '' '-DI_TIME'; do
  681. X        for i_systime in '-DI_SYS_TIME' ''; do
  682. X        case "$flags" in
  683. X        '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
  684. X            if $cc $ccflags $idefs \
  685. X                $i_time $i_systime $d_systimekernel $i_sys_select \
  686. X                i_time.c -o i_time >/dev/null 2>&1 ; then
  687. X            set X $i_time $i_systime $d_systimekernel $i_sys_select
  688. X            shift
  689. X            flags="$*"
  690. X            echo Succeeded with $flags
  691. X            fi
  692. X            ;;
  693. X        esac
  694. X        done
  695. X    done
  696. X    done
  697. Xdone
  698. Xcase "$flags" in
  699. X*SYSTIMEKERNEL*) val="$define";;
  700. X*) val="$undef";;
  701. Xesac
  702. Xset d_systimekernel
  703. Xeval $setvar
  704. Xcase "$flags" in
  705. X*I_TIME*) val="$define";;
  706. X*) val="$undef";;
  707. Xesac
  708. Xset i_time
  709. Xeval $setvar
  710. Xcase "$flags" in
  711. X*I_SYS_SELECT*) val="$define";;
  712. X*) val="$undef";;
  713. Xesac
  714. Xset i_sys_select
  715. Xeval $setvar
  716. Xcase "$flags" in
  717. X*I_SYS_TIME*) val="$define";;
  718. X*) val="$undef";;
  719. Xesac
  720. Xset i_sys_time
  721. Xeval $setvar
  722. Xcase "$flags$i_sys_time$i_time" in
  723. Xundefundef) i_sys_time="$define"; i_time="$define";
  724. X    echo "ICK, NOTHING WORKED!!!  You may have to diddle the includes.";;
  725. Xesac
  726. X
  727. X: see if signal is declared as pointer to function returning int or void
  728. Xecho " "
  729. X$cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
  730. Xif $contains 'int.*signal' d_voidsig.txt >/dev/null 2>&1 ; then
  731. X    echo "You have int (*signal())() instead of void."
  732. X    val="$undef"
  733. X    d_tosignal=int
  734. Xelse
  735. X    echo "You have void (*signal())() instead of int."
  736. X    val="$define"
  737. X    d_tosignal=void
  738. Xfi
  739. Xset d_voidsig
  740. Xeval $setvar
  741. X
  742. X: see if truncate exists
  743. Xset truncate d_truncate
  744. Xeval $inlibc
  745. X
  746. X: see if there is a vfork
  747. Xset vfork d_vfork
  748. Xeval $inlibc
  749. X
  750. X: check for volatile keyword
  751. Xecho " "
  752. Xecho 'Checking to see if your C compiler knows about "volatile"...'
  753. X$cat >try.c <<'EOCP'
  754. Xmain()
  755. X{
  756. X    typedef unsigned short foo_t;
  757. X    char *volatile foo;
  758. X    volatile int bar;
  759. X    volatile foo_t blech;
  760. X    foo = foo;
  761. X}
  762. XEOCP
  763. Xif $cc -c $ccflags try.c >/dev/null 2>&1 ; then
  764. X    val="$define"
  765. X    echo "Yup, it does."
  766. Xelse
  767. X    val="$undef"
  768. X    echo "Nope, it doesn't."
  769. Xfi
  770. Xset d_volatile
  771. Xeval $setvar
  772. X$rm -f try.*
  773. X
  774. X: see if there is a wait4
  775. Xset wait4 d_wait4
  776. Xeval $inlibc
  777. X
  778. X: see if there is a waitpid
  779. Xset waitpid d_waitpid
  780. Xeval $inlibc
  781. X
  782. X: see what type gids are declared as in the kernel
  783. Xcase "$gidtype" in
  784. X'')
  785. X    if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
  786. X    dflt='gid_t';
  787. X    else
  788. X    set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
  789. X    case $1 in
  790. X    unsigned) dflt="$1 $2" ;;
  791. X    *) dflt="$1" ;;
  792. X    esac
  793. X    fi
  794. X    ;;
  795. X*)  dflt="$gidtype"
  796. X    ;;
  797. Xesac
  798. Xcont=true
  799. Xecho " "
  800. Xrp="What type are groups ids returned by getgid(), etc.? [$dflt]"
  801. X$echo $n "$rp $c"
  802. X. myread
  803. Xgidtype="$ans"
  804. X
  805. X: check for length of integer
  806. Xecho " "
  807. Xcase "$intsize" in
  808. X'')
  809. X    echo "Checking to see how big your integers are..."
  810. X    $cat >intsize.c <<'EOCP'
  811. X#include <stdio.h>
  812. Xmain()
  813. X{
  814. X    printf("%d\n", sizeof(int));
  815. X}
  816. XEOCP
  817. X    if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
  818. X    dflt=`./intsize`
  819. X    else
  820. X    dflt='4'
  821. X    echo "(I can't seem to compile the test program.  Guessing...)"
  822. X    fi
  823. X    ;;
  824. X*)
  825. X    dflt="$intsize"
  826. X    ;;
  827. Xesac
  828. Xrp="What is the size of an integer (in bytes)? [$dflt]"
  829. X$echo $n "$rp $c"
  830. X. myread
  831. Xintsize="$ans"
  832. X
  833. X: determine which malloc to compile in
  834. Xecho " "
  835. Xcase "$usemymalloc" in
  836. X'')
  837. X    if bsd || v7; then
  838. X    dflt='y'
  839. X    else
  840. X    dflt='n'
  841. X    fi
  842. X    ;;
  843. X*)  dflt="$usemymalloc"
  844. X    ;;
  845. Xesac
  846. Xrp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
  847. X$echo $n "$rp $c"
  848. X. myread
  849. Xcase "$ans" in
  850. X'') ans=$dflt;;
  851. Xesac
  852. Xusemymalloc="$ans"
  853. Xcase "$ans" in
  854. Xy*) mallocsrc='malloc.c'; mallocobj='malloc.o'
  855. X    libs=`echo $libs | sed 's/-lmalloc//'`
  856. X    case "$mallocptrtype" in
  857. X    '')
  858. X    cat >usemymalloc.c <<'END'
  859. X#include <malloc.h>
  860. Xvoid *malloc();
  861. XEND
  862. X    if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
  863. X        mallocptrtype=void
  864. X    else
  865. X        mallocptrtype=char
  866. X    fi
  867. X    ;;
  868. X    esac
  869. X    echo " "
  870. X    echo "Your system wants malloc to return $mallocptrtype*, it would seem."
  871. X    ;;
  872. X*) mallocsrc=''; mallocobj=''; mallocptrtype=void;;
  873. Xesac
  874. X
  875. X: determine where private executables go
  876. Xcase "$privlib" in
  877. X'')
  878. X    dflt=/usr/lib/$package
  879. X    test -d /usr/local/lib && dflt=/usr/local/lib/$package
  880. X    ;;
  881. X*)  dflt="$privlib"
  882. X    ;;
  883. Xesac
  884. X$cat <<EOM
  885. X
  886. XThe $package package has some auxiliary files that should be reside in a library
  887. Xthat is accessible by everyone.  Where should these "private" but accessible
  888. XEOM
  889. X$echo $n "files reside? (~name ok) [$dflt] $c"
  890. Xrp="Private files will reside where? [$dflt]"
  891. X. myread
  892. Xprivlib=`./filexp "$ans"`
  893. X
  894. Xcase "$installprivlib" in
  895. X'')
  896. X    dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
  897. X    ;;
  898. X*)  dflt="$installprivlib"
  899. X    ;;
  900. Xesac
  901. X$cat <<EOM
  902. X
  903. XOn some systems (such as afs) you have to install the library files in a
  904. Xdifferent directory to get them to go to the right place.  Where should the
  905. XEOM
  906. X$echo $n "library files be installed? (~name ok) [$dflt] $c"
  907. Xrp="Install private files where? [$dflt]"
  908. X. myread
  909. Xinstallprivlib=`./filexp "$ans"`
  910. X
  911. X: check for size of random number generator
  912. Xecho " "
  913. Xcase "$randbits" in
  914. X'')
  915. X    echo "Checking to see how many bits your rand function produces..."
  916. X    $cat >randbits.c <<'EOCP'
  917. X#include <stdio.h>
  918. Xmain()
  919. X{
  920. X    register int i;
  921. X    register unsigned long tmp;
  922. X    register unsigned long max = 0L;
  923. X
  924. X    for (i=1000; i; i--) {
  925. X    tmp = (unsigned long)rand();
  926. X    if (tmp > max) max = tmp;
  927. X    }
  928. X    for (i=0; max; i++)
  929. X    max /= 2;
  930. X    printf("%d\n",i);
  931. X}
  932. XEOCP
  933. X    if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
  934. X    dflt=`./randbits`
  935. X    else
  936. X    dflt='?'
  937. X    echo "(I can't seem to compile the test program...)"
  938. X    fi
  939. X    ;;
  940. X*)
  941. X    dflt="$randbits"
  942. X    ;;
  943. Xesac
  944. Xrp="How many bits does your rand() function produce? [$dflt]"
  945. X$echo $n "$rp $c"
  946. X. myread
  947. Xrandbits="$ans"
  948. X
  949. X: determine where public executables go
  950. Xcase "$scriptdir" in
  951. X'')
  952. X    dflt="$bin"
  953. X    : guess some guesses
  954. X    test -d /usr/share/scripts && dflt=/usr/share/scripts
  955. X    test -d /usr/share/bin && dflt=/usr/share/bin
  956. X    ;;
  957. X*)  dflt="$scriptdir"
  958. X    ;;
  959. Xesac
  960. Xcont=true
  961. X$cat <<EOM
  962. XSome installations have a separate directory just for executable scripts so
  963. Xthat they can mount it across multiple architectures but keep the scripts in
  964. Xone spot.  You might, for example, have a subdirectory of /usr/share for this.
  965. XOr you might just lump your scripts in with all your other executables.
  966. XEOM
  967. Xwhile $test "$cont" ; do
  968. X    rp="Where do you keep publicly executable scripts (~name ok)? [$dflt]"
  969. X    $echo $n "$rp $c"
  970. X    . myread
  971. X    scriptdir="$ans"
  972. X    scriptdir=`./filexp "$scriptdir"`
  973. X    if test -d $scriptdir; then
  974. X    cont=''
  975. X    else
  976. X    case "$fastread" in
  977. X    yes) dflt=y;;
  978. X    *) dflt=n;;
  979. X    esac
  980. X    rp="Directory $scriptdir doesn't exist.  Use that name anyway? [$dflt]"
  981. X    $echo $n "$rp $c"
  982. X    . myread
  983. X    dflt=''
  984. X    case "$ans" in
  985. X    y*) cont='';;
  986. X    esac
  987. X    fi
  988. Xdone
  989. X
  990. X: generate list of signal names
  991. Xecho " "
  992. Xcase "$sig_name" in
  993. X'')
  994. X    echo "Generating a list of signal names..."
  995. X    set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
  996. X$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
  997. X    sig[$3] = substr($2,4,20)
  998. X    if (max < $3 && $3 < 60) {
  999. X    max = $3
  1000. X    }
  1001. X}
  1002. X
  1003. XEND {
  1004. X    for (i=1; i<=max; i++) {
  1005. X    if (sig[i] == "")
  1006. X        printf "%d", i
  1007. X    else
  1008. X        printf "%s", sig[i]
  1009. X    if (i < max)
  1010. X        printf " "
  1011. X    }
  1012. X    printf "\n"
  1013. X}
  1014. X'`
  1015. X    shift
  1016. X    case $# in
  1017. X    0)  echo 'kill -l' >/tmp/foo$$
  1018. X    set X `$csh -f </tmp/foo$$`
  1019. X    shift
  1020. X    case $# in
  1021. X    0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
  1022. X        ;;
  1023. X    esac
  1024. X    ;;
  1025. X    esac
  1026. X    sig_name="ZERO $*"
  1027. X    ;;
  1028. Xesac
  1029. Xecho "Signals are: $sig_name"
  1030. X
  1031. X: see what type of char stdio uses.
  1032. Xecho " "
  1033. Xif $contains 'unsigned.*char.*_ptr;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
  1034. X    echo "Your stdio uses unsigned chars."
  1035. X    stdchar="unsigned char"
  1036. Xelse
  1037. X    echo "Your stdio uses signed chars."
  1038. X    stdchar="char"
  1039. Xfi
  1040. X
  1041. X: see what type uids are declared as in the kernel
  1042. Xcase "$uidtype" in
  1043. X'')
  1044. X    if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
  1045. X    dflt='uid_t';
  1046. X    else
  1047. X    set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
  1048. X    case $1 in
  1049. X    unsigned) dflt="$1 $2" ;;
  1050. X    *) dflt="$1" ;;
  1051. X    esac
  1052. X    fi
  1053. X    ;;
  1054. X*)  dflt="$uidtype"
  1055. X    ;;
  1056. Xesac
  1057. Xcont=true
  1058. Xecho " "
  1059. Xrp="What type are user ids returned by getuid(), etc.? [$dflt]"
  1060. X$echo $n "$rp $c"
  1061. X. myread
  1062. Xuidtype="$ans"
  1063. X
  1064. X: check for void type
  1065. Xecho " "
  1066. X$cat <<EOM
  1067. XChecking to see how well your C compiler groks the void type...
  1068. X
  1069. X  Support flag bits are:
  1070. X    1: basic void declarations.
  1071. X    2: arrays of pointers to functions returning void.
  1072. X    4: operations between pointers to and addresses of void functions.
  1073. X
  1074. XEOM
  1075. Xcase "$voidhave" in
  1076. X'')
  1077. X    $cat >void.c <<'EOCP'
  1078. X#if TRY & 1
  1079. Xvoid main() {
  1080. X#else
  1081. Xmain() {
  1082. X#endif
  1083. X    extern void moo();    /* function returning void */
  1084. X    void (*goo)();        /* ptr to func returning void */
  1085. X#if TRY & 2
  1086. X    void (*foo[10])();
  1087. X#endif
  1088. X
  1089. X#if TRY & 4
  1090. X    if(goo == moo) {
  1091. X        exit(0);
  1092. X    }
  1093. X#endif
  1094. X    exit(0);
  1095. X}
  1096. XEOCP
  1097. X    if $cc -S -DTRY=$voidwant void.c >void.out 2>&1 ; then
  1098. X    voidhave=$voidwant
  1099. X    echo "It appears to support void to the level $package wants ($voidwant)."
  1100. X    if $contains warning void.out >/dev/null 2>&1; then
  1101. X        echo "However, you might get some warnings that look like this:"
  1102. X        $cat void.out
  1103. X    fi
  1104. X    else
  1105. X    echo "Hmm, your compiler has some difficulty with void.  Checking further..."
  1106. X    if $cc -S -DTRY=1 void.c >/dev/null 2>&1 ; then
  1107. X        echo "It supports 1..."
  1108. X        if $cc -S -DTRY=3 void.c >/dev/null 2>&1 ; then
  1109. X        voidhave=3
  1110. X        echo "And it supports 2 but not 4."
  1111. X        else
  1112. X        echo "It doesn't support 2..."
  1113. X        if $cc -S -DTRY=5 void.c >/dev/null 2>&1 ; then
  1114. X            voidhave=5
  1115. X            echo "But it supports 4."
  1116. X        else
  1117. X            voidhave=1
  1118. X            echo "And it doesn't support 4."
  1119. X        fi
  1120. X        fi
  1121. X    else
  1122. X        echo "There is no support at all for void."
  1123. X        voidhave=0
  1124. X    fi
  1125. X    fi
  1126. Xesac
  1127. Xdflt="$voidhave";
  1128. Xrp="Your void support flags add up to what? [$dflt]"
  1129. X$echo $n "$rp $c"
  1130. X. myread
  1131. Xvoidhave="$ans"
  1132. X
  1133. X: preserve RCS keywords in files with variable substitution, grrr
  1134. XLog='$Log'
  1135. XHeader='$Header'
  1136. XId='$Id'
  1137. XAuthor='$Author'
  1138. XDate='$Date'
  1139. XLocker='$Locker'
  1140. XRCSfile='$RCSfile'
  1141. XRevision='$Revision'
  1142. XSource='$Source'
  1143. XState='$State'
  1144. X
  1145. X
  1146. X: determine compiler compiler
  1147. Xcase "$yacc" in
  1148. X'') if xenix; then
  1149. X    dflt=yacc
  1150. X    else
  1151. X    dflt='yacc -Sm25000'
  1152. X    fi
  1153. X    ;;
  1154. X*)  dflt="$yacc";;
  1155. Xesac
  1156. Xcont=true
  1157. X    echo " "
  1158. Xrp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
  1159. X$echo $n "$rp $c"
  1160. X. myread
  1161. Xcase "$ans" in
  1162. X'') ans="$dflt";;
  1163. Xesac
  1164. Xyacc="$ans"
  1165. X
  1166. X: see what type gids are returned by getgroups
  1167. Xecho " "
  1168. Xcase "$groupstype" in
  1169. X'')
  1170. X    if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
  1171. X    dflt='short'
  1172. X    elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
  1173. X    dflt='int'
  1174. X    elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
  1175. X    dflt='short'
  1176. X    elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
  1177. X    dflt='int'
  1178. X    elif $contains 'int gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1 ; then
  1179. X    dflt='int'
  1180. X    elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
  1181. X    dflt='gid_t'
  1182. X    else
  1183. X    set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
  1184. X    case $1 in
  1185. X    unsigned) dflt="$1 $2" ;;
  1186. X    *) dflt="$1" ;;
  1187. X    esac
  1188. X    fi
  1189. X    ;;
  1190. X*)  dflt="$groupstype"
  1191. X    ;;
  1192. Xesac
  1193. Xcont=true
  1194. Xecho "(The following only matters if you have getgroups().)"
  1195. Xrp="What type are the group ids returned by getgroups()? [$dflt]"
  1196. X$echo $n "$rp $c"
  1197. X. myread
  1198. Xgroupstype="$ans"
  1199. X
  1200. X: see if we can include fcntl.h
  1201. Xecho " "
  1202. Xif $h_fcntl; then
  1203. X    val="$define"
  1204. X    echo "We'll be including <fcntl.h>."
  1205. Xelse
  1206. X    val="$undef"
  1207. X    if $h_sys_file; then
  1208. X    echo "We don't need to <fcntl.h> if we include <sys/file.h>."
  1209. X    else
  1210. X    echo "We won't be including <fcntl.h>."
  1211. X    fi
  1212. Xfi
  1213. Xset i_fcntl
  1214. Xeval $setvar
  1215. X
  1216. X: see if gdbm is available
  1217. Xecho " "
  1218. Xxxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
  1219. Xif test -f $xxx; then
  1220. X    val="$define"
  1221. X    echo "gdbm.h found."
  1222. Xelse
  1223. X    val="$undef"
  1224. X    echo "gdbm.h not found."
  1225. Xfi
  1226. Xset i_gdbm
  1227. Xeval $setvar
  1228. X
  1229. X: see if this is an grp system
  1230. Xecho " "
  1231. Xif $test -r $usrinclude/grp.h ; then
  1232. X    val="$define"
  1233. X    echo "grp.h found."
  1234. Xelse
  1235. X    val="$undef"
  1236. X    echo "No grp.h found."
  1237. Xfi
  1238. Xset i_grp
  1239. Xeval $setvar
  1240. X
  1241. X: see if this is a netinet/in.h or sys/in.h system
  1242. Xecho " "
  1243. Xxxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
  1244. Xif test -f $xxx; then
  1245. X    val="$define"
  1246. X    val2="$undef"
  1247. X    echo "netinet/in.h found."
  1248. Xelse
  1249. X    val="$undef"
  1250. X    echo "No netinet/in.h found, ..."
  1251. X    xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
  1252. X    if test -f $xxx; then
  1253. X    val2="$define"
  1254. X    echo "but I found sys/in.h instead."
  1255. X    else
  1256. X    val2="$undef"
  1257. X    echo "and I didn't find sys/in.h either."
  1258. X    fi
  1259. Xfi
  1260. Xset i_niin
  1261. Xeval $setvar
  1262. Xval=$val2
  1263. Xset i_sysin
  1264. Xeval $setvar
  1265. X
  1266. X: Do we need to #include <sys/file.h> ?
  1267. Xecho " "
  1268. Xif $h_sys_file; then
  1269. X    val="$define"
  1270. X    echo "We'll be including <sys/file.h>."
  1271. Xelse
  1272. X    val="$undef"
  1273. X    echo "We won't be including <sys/file.h>."
  1274. Xfi
  1275. Xset i_sys_file
  1276. Xeval $setvar
  1277. X
  1278. X: see if ioctl defs are in sgtty/termio or sys/ioctl
  1279. Xecho " "
  1280. Xif $test -r $usrinclude/sys/ioctl.h ; then
  1281. X    val="$define"
  1282. X    echo "sys/ioctl.h found."
  1283. Xelse
  1284. X    val="$undef"
  1285. X    echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
  1286. Xfi
  1287. Xset i_sysioctl
  1288. Xeval $setvar
  1289. X
  1290. X: see if we should include utime.h
  1291. Xecho " "
  1292. Xif $test -r $usrinclude/utime.h ; then
  1293. X    val="$define"
  1294. X    echo "utime.h found."
  1295. Xelse
  1296. X    val="$undef"
  1297. X    echo "No utime.h found, but that's ok."
  1298. Xfi
  1299. Xset i_utime
  1300. Xeval $setvar
  1301. X
  1302. X: see if this is a varargs system
  1303. Xecho " "
  1304. Xif $test -r $usrinclude/varargs.h ; then
  1305. X    val="$define"
  1306. X    echo "varargs.h found."
  1307. Xelse
  1308. X    val="$undef"
  1309. X    echo "No varargs.h found, but that's ok (I hope)."
  1310. Xfi
  1311. Xset i_varargs
  1312. Xeval $setvar
  1313. X
  1314. X: see if this is a vfork system
  1315. Xecho " "
  1316. Xif $test -r $usrinclude/vfork.h ; then
  1317. X    val="$define"
  1318. X    echo "vfork.h found."
  1319. Xelse
  1320. X    val="$undef"
  1321. X    echo "No vfork.h found."
  1322. Xfi
  1323. Xset i_vfork
  1324. Xeval $setvar
  1325. X
  1326. X: end of configuration questions
  1327. Xecho " "
  1328. Xecho "End of configuration questions."
  1329. Xecho " "
  1330. X
  1331. X: create config.sh file
  1332. Xecho " "
  1333. Xif test -d ../UU; then
  1334. X    cd ..
  1335. Xfi
  1336. Xecho "Creating config.sh..."
  1337. X$spitshell <<EOT >config.sh
  1338. X$startsh
  1339. X# config.sh
  1340. X# This file was produced by running the Configure script.
  1341. X
  1342. Xd_eunice='$d_eunice'
  1343. Xdefine='$define'
  1344. Xeunicefix='$eunicefix'
  1345. Xloclist='$loclist'
  1346. Xexpr='$expr'
  1347. Xsed='$sed'
  1348. Xecho='$echo'
  1349. Xcat='$cat'
  1350. Xrm='$rm'
  1351. Xmv='$mv'
  1352. Xcp='$cp'
  1353. Xtail='$tail'
  1354. Xtr='$tr'
  1355. Xmkdir='$mkdir'
  1356. Xsort='$sort'
  1357. Xuniq='$uniq'
  1358. Xgrep='$grep'
  1359. Xtrylist='$trylist'
  1360. Xtest='$test'
  1361. Xinews='$inews'
  1362. Xegrep='$egrep'
  1363. Xmore='$more'
  1364. Xpg='$pg'
  1365. XMcc='$Mcc'
  1366. Xvi='$vi'
  1367. Xmailx='$mailx'
  1368. Xmail='$mail'
  1369. Xcpp='$cpp'
  1370. Xperl='$perl'
  1371. Xemacs='$emacs'
  1372. Xls='$ls'
  1373. Xrmail='$rmail'
  1374. Xsendmail='$sendmail'
  1375. Xshar='$shar'
  1376. Xsmail='$smail'
  1377. Xtbl='$tbl'
  1378. Xtroff='$troff'
  1379. Xnroff='$nroff'
  1380. Xuname='$uname'
  1381. Xuuname='$uuname'
  1382. Xline='$line'
  1383. Xchgrp='$chgrp'
  1384. Xchmod='$chmod'
  1385. Xlint='$lint'
  1386. Xsleep='$sleep'
  1387. Xpr='$pr'
  1388. Xtar='$tar'
  1389. Xln='$ln'
  1390. Xlpr='$lpr'
  1391. Xlp='$lp'
  1392. Xtouch='$touch'
  1393. Xmake='$make'
  1394. Xdate='$date'
  1395. Xcsh='$csh'
  1396. Xbash='$bash'
  1397. Xksh='$ksh'
  1398. Xlex='$lex'
  1399. Xflex='$flex'
  1400. Xbison='$bison'
  1401. XLog='$Log'
  1402. XHeader='$Header'
  1403. XId='$Id'
  1404. Xlastuname='$lastuname'
  1405. Xalignbytes='$alignbytes'
  1406. Xbin='$bin'
  1407. Xinstallbin='$installbin'
  1408. Xbyteorder='$byteorder'
  1409. Xcontains='$contains'
  1410. Xcppstdin='$cppstdin'
  1411. Xcppminus='$cppminus'
  1412. Xd_bcmp='$d_bcmp'
  1413. Xd_bcopy='$d_bcopy'
  1414. Xd_bzero='$d_bzero'
  1415. Xd_castneg='$d_castneg'
  1416. Xcastflags='$castflags'
  1417. Xd_charsprf='$d_charsprf'
  1418. Xd_chsize='$d_chsize'
  1419. Xd_crypt='$d_crypt'
  1420. Xcryptlib='$cryptlib'
  1421. Xd_csh='$d_csh'
  1422. Xd_dosuid='$d_dosuid'
  1423. Xd_dup2='$d_dup2'
  1424. Xd_fchmod='$d_fchmod'
  1425. Xd_fchown='$d_fchown'
  1426. Xd_fcntl='$d_fcntl'
  1427. Xd_flexfnam='$d_flexfnam'
  1428. Xd_flock='$d_flock'
  1429. Xd_getgrps='$d_getgrps'
  1430. Xd_gethent='$d_gethent'
  1431. Xd_getpgrp='$d_getpgrp'
  1432. Xd_getpgrp2='$d_getpgrp2'
  1433. Xd_getprior='$d_getprior'
  1434. Xd_htonl='$d_htonl'
  1435. Xd_index='$d_index'
  1436. Xd_killpg='$d_killpg'
  1437. Xd_lstat='$d_lstat'
  1438. Xd_memcmp='$d_memcmp'
  1439. Xd_memcpy='$d_memcpy'
  1440. Xd_mkdir='$d_mkdir'
  1441. Xd_msg='$d_msg'
  1442. Xd_msgctl='$d_msgctl'
  1443. Xd_msgget='$d_msgget'
  1444. Xd_msgrcv='$d_msgrcv'
  1445. Xd_msgsnd='$d_msgsnd'
  1446. Xd_ndbm='$d_ndbm'
  1447. Xd_odbm='$d_odbm'
  1448. Xd_open3='$d_open3'
  1449. Xd_readdir='$d_readdir'
  1450. Xd_rename='$d_rename'
  1451. Xd_rmdir='$d_rmdir'
  1452. Xd_select='$d_select'
  1453. Xd_sem='$d_sem'
  1454. Xd_semctl='$d_semctl'
  1455. Xd_semget='$d_semget'
  1456. Xd_semop='$d_semop'
  1457. Xd_setegid='$d_setegid'
  1458. Xd_seteuid='$d_seteuid'
  1459. Xd_setpgrp='$d_setpgrp'
  1460. Xd_setpgrp2='$d_setpgrp2'
  1461. Xd_setprior='$d_setprior'
  1462. Xd_setregid='$d_setregid'
  1463. Xd_setresgid='$d_setresgid'
  1464. Xd_setreuid='$d_setreuid'
  1465. Xd_setresuid='$d_setresuid'
  1466. Xd_setrgid='$d_setrgid'
  1467. Xd_setruid='$d_setruid'
  1468. Xd_shm='$d_shm'
  1469. Xd_shmat='$d_shmat'
  1470. Xd_shmctl='$d_shmctl'
  1471. Xd_shmdt='$d_shmdt'
  1472. Xd_shmget='$d_shmget'
  1473. Xd_socket='$d_socket'
  1474. Xd_sockpair='$d_sockpair'
  1475. Xd_oldsock='$d_oldsock'
  1476. Xsocketlib='$socketlib'
  1477. Xd_statblks='$d_statblks'
  1478. Xd_stdstdio='$d_stdstdio'
  1479. Xd_strctcpy='$d_strctcpy'
  1480. Xd_strerror='$d_strerror'
  1481. Xd_symlink='$d_symlink'
  1482. Xd_syscall='$d_syscall'
  1483. Xd_truncate='$d_truncate'
  1484. Xd_vfork='$d_vfork'
  1485. Xd_voidsig='$d_voidsig'
  1486. Xd_tosignal='$d_tosignal'
  1487. Xd_volatile='$d_volatile'
  1488. Xd_vprintf='$d_vprintf'
  1489. Xd_charvspr='$d_charvspr'
  1490. Xd_wait4='$d_wait4'
  1491. Xd_waitpid='$d_waitpid'
  1492. Xgidtype='$gidtype'
  1493. Xgroupstype='$groupstype'
  1494. Xi_fcntl='$i_fcntl'
  1495. Xi_gdbm='$i_gdbm'
  1496. Xi_grp='$i_grp'
  1497. Xi_niin='$i_niin'
  1498. Xi_sysin='$i_sysin'
  1499. Xi_pwd='$i_pwd'
  1500. Xd_pwquota='$d_pwquota'
  1501. Xd_pwage='$d_pwage'
  1502. Xd_pwchange='$d_pwchange'
  1503. Xd_pwclass='$d_pwclass'
  1504. Xd_pwexpire='$d_pwexpire'
  1505. Xd_pwcomment='$d_pwcomment'
  1506. Xi_sys_file='$i_sys_file'
  1507. Xi_sysioctl='$i_sysioctl'
  1508. Xi_time='$i_time'
  1509. Xi_sys_time='$i_sys_time'
  1510. Xi_sys_select='$i_sys_select'
  1511. Xd_systimekernel='$d_systimekernel'
  1512. Xi_utime='$i_utime'
  1513. Xi_varargs='$i_varargs'
  1514. Xi_vfork='$i_vfork'
  1515. Xintsize='$intsize'
  1516. Xlibc='$libc'
  1517. Xnm_opts='$nm_opts'
  1518. Xlibndir='$libndir'
  1519. Xi_my_dir='$i_my_dir'
  1520. Xi_ndir='$i_ndir'
  1521. Xi_sys_ndir='$i_sys_ndir'
  1522. Xi_dirent='$i_dirent'
  1523. Xi_sys_dir='$i_sys_dir'
  1524. Xd_dirnamlen='$d_dirnamlen'
  1525. Xndirc='$ndirc'
  1526. Xndiro='$ndiro'
  1527. Xmallocsrc='$mallocsrc'
  1528. Xmallocobj='$mallocobj'
  1529. Xusemymalloc='$usemymalloc'
  1530. Xmallocptrtype='$mallocptrtype'
  1531. Xmansrc='$mansrc'
  1532. Xmanext='$manext'
  1533. Xmodels='$models'
  1534. Xsplit='$split'
  1535. Xsmall='$small'
  1536. Xmedium='$medium'
  1537. Xlarge='$large'
  1538. Xhuge='$huge'
  1539. Xoptimize='$optimize'
  1540. Xccflags='$ccflags'
  1541. Xcppflags='$cppflags'
  1542. Xldflags='$ldflags'
  1543. Xcc='$cc'
  1544. Xlibs='$libs'
  1545. Xn='$n'
  1546. Xc='$c'
  1547. Xpackage='$package'
  1548. Xrandbits='$randbits'
  1549. Xscriptdir='$scriptdir'
  1550. Xsig_name='$sig_name'
  1551. Xspitshell='$spitshell'
  1552. Xshsharp='$shsharp'
  1553. Xsharpbang='$sharpbang'
  1554. Xstartsh='$startsh'
  1555. Xstdchar='$stdchar'
  1556. Xuidtype='$uidtype'
  1557. Xusrinclude='$usrinclude'
  1558. XinclPath='$inclPath'
  1559. Xvoid='$void'
  1560. Xvoidhave='$voidhave'
  1561. Xvoidwant='$voidwant'
  1562. Xw_localtim='$w_localtim'
  1563. Xw_s_timevl='$w_s_timevl'
  1564. Xw_s_tm='$w_s_tm'
  1565. Xyacc='$yacc'
  1566. Xlib='$lib'
  1567. Xprivlib='$privlib'
  1568. Xinstallprivlib='$installprivlib'
  1569. XCONFIG=true
  1570. XEOT
  1571. X
  1572. X: Finish up
  1573. XCONFIG=true
  1574. X
  1575. Xecho " "
  1576. Xtest -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
  1577. Xdflt=''
  1578. Xfastread=''
  1579. Xecho "If you didn't make any mistakes, then just type a carriage return here."
  1580. Xrp="If you need to edit config.sh, do it as a shell escape here:"
  1581. X$echo $n "$rp $c"
  1582. X. UU/myread
  1583. Xcase "$ans" in
  1584. X'') ;;
  1585. X*) : in case they cannot read
  1586. X    eval $ans;;
  1587. Xesac
  1588. X: if this fails, just run all the .SH files by hand
  1589. X. ./config.sh
  1590. X
  1591. Xecho " "
  1592. Xecho "Doing variable substitutions on .SH files..."
  1593. Xset x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
  1594. Xshift
  1595. Xcase $# in
  1596. X0) set x *.SH; shift;;
  1597. Xesac
  1598. Xif test ! -f $1; then
  1599. X    shift
  1600. Xfi
  1601. Xfor file in $*; do
  1602. X    set X
  1603. X    shift
  1604. X    chmod +x $file
  1605. X    case "$file" in
  1606. X    */*)
  1607. X    dir=`$expr X$file : 'X\(.*\)/'`
  1608. X    file=`$expr X$file : 'X.*/\(.*\)'`
  1609. X    (cd $dir && . $file)
  1610. X    ;;
  1611. X    *)
  1612. X    . $file
  1613. X    ;;
  1614. X    esac
  1615. Xdone
  1616. Xif test -f config.h.SH; then
  1617. X    if test ! -f config.h; then
  1618. X    : oops, they left it out of MANIFEST, probably, so do it anyway.
  1619. X    . config.h.SH
  1620. X    fi
  1621. Xfi
  1622. X
  1623. Xif $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
  1624. X    dflt=n
  1625. X    $cat <<EOM
  1626. X
  1627. XNow you need to generate make dependencies by running "make depend".
  1628. XYou might prefer to run it in background: "make depend > makedepend.out &"
  1629. XIt can take a while, so you might not want to run it right now.
  1630. X
  1631. XEOM
  1632. X    rp="Run make depend now? [$dflt]"
  1633. X    $echo $n "$rp $c"
  1634. X    . UU/myread
  1635. X    case "$ans" in
  1636. X    y*) make depend && echo "Now you must run a make."
  1637. X    ;;
  1638. X    *)  echo "You must run 'make depend' then 'make'."
  1639. X    ;;
  1640. X    esac
  1641. Xelif test -f [Mm]akefile; then
  1642. X    echo " "
  1643. X    echo "Now you must run a make."
  1644. Xelse
  1645. X    echo "Done."
  1646. Xfi
  1647. X
  1648. X$rm -f kit*isdone
  1649. Xcd .. && $rm -rf UU
  1650. X: end of Configure
  1651. !STUFFY!FUNK!
  1652. echo Extracting usub/curses.mus
  1653. sed >usub/curses.mus <<'!STUFFY!FUNK!' -e 's/X//'
  1654. X/* $Header: curses.mus,v 4.0 91/03/20 01:56:13 lwall Locked $
  1655. X *
  1656. X * $Log:    curses.mus,v $
  1657. X * Revision 4.0  91/03/20  01:56:13  lwall
  1658. X * 4.0 baseline.
  1659. X * 
  1660. X * Revision 3.0.1.1  90/08/09  04:05:21  lwall
  1661. X * patch19: Initial revision
  1662. X * 
  1663. X */
  1664. X
  1665. X#include "EXTERN.h"
  1666. X#include "perl.h"
  1667. Xextern int wantarray;
  1668. X
  1669. Xchar *savestr();
  1670. X
  1671. X#include <curses.h>
  1672. X
  1673. Xstatic enum uservars {
  1674. X    UV_curscr,
  1675. X    UV_stdscr,
  1676. X    UV_Def_term,
  1677. X    UV_My_term,
  1678. X    UV_ttytype,
  1679. X    UV_LINES,
  1680. X    UV_COLS,
  1681. X    UV_ERR,
  1682. X    UV_OK,
  1683. X};
  1684. X
  1685. Xstatic enum usersubs {
  1686. X    US_addch,
  1687. X    US_waddch,
  1688. X    US_addstr,
  1689. X    US_waddstr,
  1690. X    US_box,
  1691. X    US_clear,
  1692. X    US_wclear,
  1693. X    US_clearok,
  1694. X    US_clrtobot,
  1695. X    US_wclrtobot,
  1696. X    US_clrtoeol,
  1697. X    US_wclrtoeol,
  1698. X    US_delch,
  1699. X    US_wdelch,
  1700. X    US_deleteln,
  1701. X    US_wdeleteln,
  1702. X    US_erase,
  1703. X    US_werase,
  1704. X    US_flushok,
  1705. X    US_idlok,
  1706. X    US_insch,
  1707. X    US_winsch,
  1708. X    US_insertln,
  1709. X    US_winsertln,
  1710. X    US_move,
  1711. X    US_wmove,
  1712. X    US_overlay,
  1713. X    US_overwrite,
  1714. X    US_printw,
  1715. X    US_wprintw,
  1716. X    US_refresh,
  1717. X    US_wrefresh,
  1718. X    US_standout,
  1719. X    US_wstandout,
  1720. X    US_standend,
  1721. X    US_wstandend,
  1722. X    US_cbreak,
  1723. X    US_nocbreak,
  1724. X    US_echo,
  1725. X    US_noecho,
  1726. X    US_getch,
  1727. X    US_wgetch,
  1728. X    US_getstr,
  1729. X    US_wgetstr,
  1730. X    US_raw,
  1731. X    US_noraw,
  1732. X    US_scanw,
  1733. X    US_wscanw,
  1734. X    US_baudrate,
  1735. X    US_delwin,
  1736. X    US_endwin,
  1737. X    US_erasechar,
  1738. X    US_getcap,
  1739. X    US_getyx,
  1740. X    US_inch,
  1741. X    US_winch,
  1742. X    US_initscr,
  1743. X    US_killchar,
  1744. X    US_leaveok,
  1745. X    US_longname,
  1746. X    US_fullname,
  1747. X    US_mvwin,
  1748. X    US_newwin,
  1749. X    US_nl,
  1750. X    US_nonl,
  1751. X    US_scrollok,
  1752. X    US_subwin,
  1753. X    US_touchline,
  1754. X    US_touchoverlap,
  1755. X    US_touchwin,
  1756. X    US_unctrl,
  1757. X    US_gettmode,
  1758. X    US_mvcur,
  1759. X    US_scroll,
  1760. X    US_savetty,
  1761. X    US_resetty,
  1762. X    US_setterm,
  1763. X    US_tstp,
  1764. X    US__putchar,
  1765. X};
  1766. X
  1767. Xstatic int usersub();
  1768. Xstatic int userset();
  1769. Xstatic int userval();
  1770. X
  1771. Xint
  1772. Xinit_curses()
  1773. X{
  1774. X    struct ufuncs uf;
  1775. X    char *filename = "curses.c";
  1776. X
  1777. X    uf.uf_set = userset;
  1778. X    uf.uf_val = userval;
  1779. X
  1780. X#define MAGICVAR(name, ix) uf.uf_index = ix, magicname(name, &uf, sizeof uf)
  1781. X
  1782. X    MAGICVAR("curscr",    UV_curscr);
  1783. X    MAGICVAR("stdscr",    UV_stdscr);
  1784. X    MAGICVAR("Def_term",UV_Def_term);
  1785. X    MAGICVAR("My_term",    UV_My_term);
  1786. X    MAGICVAR("ttytype",    UV_ttytype);
  1787. X    MAGICVAR("LINES",    UV_LINES);
  1788. X    MAGICVAR("COLS",    UV_COLS);
  1789. X    MAGICVAR("ERR",    UV_ERR);
  1790. X    MAGICVAR("OK",    UV_OK);
  1791. X
  1792. X    make_usub("addch",        US_addch,    usersub, filename);
  1793. X    make_usub("waddch",        US_waddch,    usersub, filename);
  1794. X    make_usub("addstr",        US_addstr,    usersub, filename);
  1795. X    make_usub("waddstr",    US_waddstr,    usersub, filename);
  1796. X    make_usub("box",        US_box,        usersub, filename);
  1797. X    make_usub("clear",        US_clear,    usersub, filename);
  1798. X    make_usub("wclear",        US_wclear,    usersub, filename);
  1799. X    make_usub("clearok",    US_clearok,    usersub, filename);
  1800. X    make_usub("clrtobot",    US_clrtobot,    usersub, filename);
  1801. X    make_usub("wclrtobot",    US_wclrtobot,    usersub, filename);
  1802. X    make_usub("clrtoeol",    US_clrtoeol,    usersub, filename);
  1803. X    make_usub("wclrtoeol",    US_wclrtoeol,    usersub, filename);
  1804. X    make_usub("delch",        US_delch,    usersub, filename);
  1805. X    make_usub("wdelch",        US_wdelch,    usersub, filename);
  1806. X    make_usub("deleteln",    US_deleteln,    usersub, filename);
  1807. X    make_usub("wdeleteln",    US_wdeleteln,    usersub, filename);
  1808. X    make_usub("erase",        US_erase,    usersub, filename);
  1809. X    make_usub("werase",        US_werase,    usersub, filename);
  1810. X    make_usub("flushok",    US_flushok,    usersub, filename);
  1811. X    make_usub("idlok",        US_idlok,    usersub, filename);
  1812. X    make_usub("insch",        US_insch,    usersub, filename);
  1813. X    make_usub("winsch",        US_winsch,    usersub, filename);
  1814. X    make_usub("insertln",    US_insertln,    usersub, filename);
  1815. X    make_usub("winsertln",    US_winsertln,    usersub, filename);
  1816. X    make_usub("move",        US_move,    usersub, filename);
  1817. X    make_usub("wmove",        US_wmove,    usersub, filename);
  1818. X    make_usub("overlay",    US_overlay,    usersub, filename);
  1819. X    make_usub("overwrite",    US_overwrite,    usersub, filename);
  1820. X    make_usub("printw",        US_printw,    usersub, filename);
  1821. X    make_usub("wprintw",    US_wprintw,    usersub, filename);
  1822. X    make_usub("refresh",    US_refresh,    usersub, filename);
  1823. X    make_usub("wrefresh",    US_wrefresh,    usersub, filename);
  1824. X    make_usub("standout",    US_standout,    usersub, filename);
  1825. X    make_usub("wstandout",    US_wstandout,    usersub, filename);
  1826. X    make_usub("standend",    US_standend,    usersub, filename);
  1827. X    make_usub("wstandend",    US_wstandend,    usersub, filename);
  1828. X    make_usub("cbreak",        US_cbreak,    usersub, filename);
  1829. X    make_usub("nocbreak",    US_nocbreak,    usersub, filename);
  1830. X    make_usub("echo",        US_echo,    usersub, filename);
  1831. X    make_usub("noecho",        US_noecho,    usersub, filename);
  1832. X    make_usub("getch",        US_getch,    usersub, filename);
  1833. X    make_usub("wgetch",        US_wgetch,    usersub, filename);
  1834. X    make_usub("getstr",        US_getstr,    usersub, filename);
  1835. X    make_usub("wgetstr",    US_wgetstr,    usersub, filename);
  1836. X    make_usub("raw",        US_raw,        usersub, filename);
  1837. X    make_usub("noraw",        US_noraw,    usersub, filename);
  1838. X    make_usub("scanw",        US_scanw,    usersub, filename);
  1839. X    make_usub("wscanw",        US_wscanw,    usersub, filename);
  1840. X    make_usub("baudrate",    US_baudrate,    usersub, filename);
  1841. X    make_usub("delwin",        US_delwin,    usersub, filename);
  1842. X    make_usub("endwin",        US_endwin,    usersub, filename);
  1843. X    make_usub("erasechar",    US_erasechar,    usersub, filename);
  1844. X    make_usub("getcap",        US_getcap,    usersub, filename);
  1845. X    make_usub("getyx",        US_getyx,    usersub, filename);
  1846. X    make_usub("inch",        US_inch,    usersub, filename);
  1847. X    make_usub("winch",        US_winch,    usersub, filename);
  1848. X    make_usub("initscr",    US_initscr,    usersub, filename);
  1849. X    make_usub("killchar",    US_killchar,    usersub, filename);
  1850. X    make_usub("leaveok",    US_leaveok,    usersub, filename);
  1851. X    make_usub("longname",    US_longname,    usersub, filename);
  1852. X    make_usub("fullname",    US_fullname,    usersub, filename);
  1853. X    make_usub("mvwin",        US_mvwin,    usersub, filename);
  1854. X    make_usub("newwin",        US_newwin,    usersub, filename);
  1855. X    make_usub("nl",        US_nl,        usersub, filename);
  1856. X    make_usub("nonl",        US_nonl,    usersub, filename);
  1857. X    make_usub("scrollok",    US_scrollok,    usersub, filename);
  1858. X    make_usub("subwin",        US_subwin,    usersub, filename);
  1859. X    make_usub("touchline",    US_touchline,    usersub, filename);
  1860. X    make_usub("touchoverlap",    US_touchoverlap,usersub, filename);
  1861. X    make_usub("touchwin",    US_touchwin,    usersub, filename);
  1862. X    make_usub("unctrl",        US_unctrl,    usersub, filename);
  1863. X    make_usub("gettmode",    US_gettmode,    usersub, filename);
  1864. X    make_usub("mvcur",        US_mvcur,    usersub, filename);
  1865. X    make_usub("scroll",        US_scroll,    usersub, filename);
  1866. X    make_usub("savetty",    US_savetty,    usersub, filename);
  1867. X    make_usub("resetty",    US_resetty,    usersub, filename);
  1868. X    make_usub("setterm",    US_setterm,    usersub, filename);
  1869. X    make_usub("tstp",        US_tstp,    usersub, filename);
  1870. X    make_usub("_putchar",    US__putchar,    usersub, filename);
  1871. X};
  1872. X
  1873. Xstatic int
  1874. Xusersub(ix, sp, items)
  1875. Xint ix;
  1876. Xregister int sp;
  1877. Xregister int items;
  1878. X{
  1879. X    STR **st = stack->ary_array + sp;
  1880. X    register int i;
  1881. X    register char *tmps;
  1882. X    register STR *Str;        /* used in str_get and str_gnum macros */
  1883. X
  1884. X    switch (ix) {
  1885. XCASE int addch
  1886. XI    char        ch
  1887. XEND
  1888. X
  1889. XCASE int waddch
  1890. XI    WINDOW*        win
  1891. XI    char        ch
  1892. XEND
  1893. X
  1894. XCASE int addstr
  1895. XI    char*        str
  1896. XEND
  1897. X
  1898. XCASE int waddstr
  1899. XI    WINDOW*        win
  1900. XI    char*        str
  1901. XEND
  1902. X
  1903. XCASE int box
  1904. XI    WINDOW*        win
  1905. XI    char        vert
  1906. XI    char        hor
  1907. XEND
  1908. X
  1909. XCASE int clear
  1910. XEND
  1911. X
  1912. XCASE int wclear
  1913. XI    WINDOW*        win
  1914. XEND
  1915. X
  1916. XCASE int clearok
  1917. XI    WINDOW*        win
  1918. XI    bool        boolf
  1919. XEND
  1920. X
  1921. XCASE int clrtobot
  1922. XEND
  1923. X
  1924. XCASE int wclrtobot
  1925. XI    WINDOW*        win
  1926. XEND
  1927. X
  1928. XCASE int clrtoeol
  1929. XEND
  1930. X
  1931. XCASE int wclrtoeol
  1932. XI    WINDOW*        win
  1933. XEND
  1934. X
  1935. XCASE int delch
  1936. XEND
  1937. X
  1938. XCASE int wdelch
  1939. XI    WINDOW*        win
  1940. XEND
  1941. X
  1942. XCASE int deleteln
  1943. XEND
  1944. X
  1945. XCASE int wdeleteln
  1946. XI    WINDOW*        win
  1947. XEND
  1948. X
  1949. XCASE int erase
  1950. XEND
  1951. X
  1952. XCASE int werase
  1953. XI    WINDOW*        win
  1954. XEND
  1955. X
  1956. XCASE int flushok
  1957. XI    WINDOW*        win
  1958. XI    bool        boolf
  1959. XEND
  1960. X
  1961. XCASE int idlok
  1962. XI    WINDOW*        win
  1963. XI    bool        boolf
  1964. XEND
  1965. X
  1966. XCASE int insch
  1967. XI    char        c
  1968. XEND
  1969. X
  1970. XCASE int winsch
  1971. XI    WINDOW*        win
  1972. XI    char        c
  1973. XEND
  1974. X
  1975. XCASE int insertln
  1976. XEND
  1977. X
  1978. XCASE int winsertln
  1979. XI    WINDOW*        win
  1980. XEND
  1981. X
  1982. XCASE int move
  1983. XI    int        y
  1984. XI    int        x
  1985. XEND
  1986. X
  1987. XCASE int wmove
  1988. XI    WINDOW*        win
  1989. XI    int        y
  1990. XI    int        x
  1991. XEND
  1992. X
  1993. XCASE int overlay
  1994. XI    WINDOW*        win1
  1995. XI    WINDOW*        win2
  1996. XEND
  1997. X
  1998. XCASE int overwrite
  1999. XI    WINDOW*        win1
  2000. XI    WINDOW*        win2
  2001. XEND
  2002. X
  2003. X    case US_printw:
  2004. X    if (items < 1)
  2005. X        fatal("Usage: &printw($fmt, $arg1, $arg2, ... )");
  2006. X    else {
  2007. X        int retval;
  2008. X        STR*    str =        str_new(0);
  2009. X
  2010. X        do_sprintf(str, items - 1, st + 1);
  2011. X        retval = addstr(str->str_ptr);
  2012. X        str_numset(st[0], (double) retval);
  2013. X        str_free(str);
  2014. X    }
  2015. X    return sp;
  2016. X
  2017. X    case US_wprintw:
  2018. X    if (items < 2)
  2019. X        fatal("Usage: &wprintw($win, $fmt, $arg1, $arg2, ... )");
  2020. X    else {
  2021. X        int retval;
  2022. X        STR*    str =        str_new(0);
  2023. X        WINDOW*    win =        *(WINDOW**)    str_get(st[1]);
  2024. X
  2025. X        do_sprintf(str, items - 1, st + 1);
  2026. X        retval = waddstr(win, str->str_ptr);
  2027. X        str_numset(st[0], (double) retval);
  2028. X        str_free(str);
  2029. X    }
  2030. X    return sp;
  2031. X
  2032. XCASE int refresh
  2033. XEND
  2034. X
  2035. XCASE int wrefresh
  2036. XI    WINDOW*        win
  2037. XEND
  2038. X
  2039. XCASE int standout
  2040. XEND
  2041. X
  2042. XCASE int wstandout
  2043. XI    WINDOW*        win
  2044. XEND
  2045. X
  2046. XCASE int standend
  2047. XEND
  2048. X
  2049. XCASE int wstandend
  2050. XI    WINDOW*        win
  2051. XEND
  2052. X
  2053. XCASE int cbreak
  2054. XEND
  2055. X
  2056. XCASE int nocbreak
  2057. XEND
  2058. X
  2059. XCASE int echo
  2060. XEND
  2061. X
  2062. XCASE int noecho
  2063. XEND
  2064. X
  2065. X    case US_getch:
  2066. X        if (items != 0)
  2067. X            fatal("Usage: &getch()");
  2068. X        else {
  2069. X            int retval;
  2070. X        char retch;
  2071. X
  2072. X            retval = getch();
  2073. X        if (retval == EOF)
  2074. X        st[0] = &str_undef;
  2075. X        else {
  2076. X        retch = retval;
  2077. X        str_nset(st[0], &retch, 1);
  2078. X        }
  2079. X        }
  2080. X        return sp;
  2081. X
  2082. X    case US_wgetch:
  2083. X        if (items != 1)
  2084. X            fatal("Usage: &wgetch($win)");
  2085. X        else {
  2086. X            int retval;
  2087. X        char retch;
  2088. X            WINDOW*     win =           *(WINDOW**)     str_get(st[1]);
  2089. X
  2090. X            retval = wgetch(win);
  2091. X        if (retval == EOF)
  2092. X        st[0] = &str_undef;
  2093. X        else {
  2094. X        retch = retval;
  2095. X        str_nset(st[0], &retch, 1);
  2096. X        }
  2097. X        }
  2098. X        return sp;
  2099. X
  2100. XCASE int getstr
  2101. XIO    char*        str
  2102. XEND
  2103. X
  2104. XCASE int wgetstr
  2105. XI    WINDOW*        win
  2106. XIO    char*        str
  2107. XEND
  2108. X
  2109. XCASE int raw
  2110. XEND
  2111. X
  2112. XCASE int noraw
  2113. XEND
  2114. X
  2115. XCASE int baudrate
  2116. XEND
  2117. X
  2118. XCASE int delwin
  2119. XI    WINDOW*        win
  2120. XEND
  2121. X
  2122. XCASE int endwin
  2123. XEND
  2124. X
  2125. XCASE int erasechar
  2126. XEND
  2127. X
  2128. XCASE char* getcap
  2129. XI    char*        str
  2130. XEND
  2131. X
  2132. X    case US_getyx:
  2133. X    if (items != 3)
  2134. X        fatal("Usage: &getyx($win, $y, $x)");
  2135. X    else {
  2136. X        int retval;
  2137. X        STR*    str =        str_new(0);
  2138. X        WINDOW*    win =        *(WINDOW**)    str_get(st[1]);
  2139. X        int        y;
  2140. X        int        x;
  2141. X
  2142. X        do_sprintf(str, items - 1, st + 1);
  2143. X        retval = getyx(win, y, x);
  2144. X        str_numset(st[2], (double)y);
  2145. X        str_numset(st[3], (double)x);
  2146. X        str_numset(st[0], (double) retval);
  2147. X        str_free(str);
  2148. X    }
  2149. X    return sp;
  2150. X
  2151. X    
  2152. XCASE int inch
  2153. XEND
  2154. X
  2155. XCASE int winch
  2156. XI    WINDOW*        win
  2157. XEND
  2158. X
  2159. XCASE WINDOW* initscr
  2160. XEND
  2161. X
  2162. XCASE int killchar
  2163. XEND
  2164. X
  2165. XCASE int leaveok
  2166. XI    WINDOW*        win
  2167. XI    bool        boolf
  2168. XEND
  2169. X
  2170. XCASE char* longname
  2171. XI    char*        termbuf
  2172. XIO    char*        name
  2173. XEND
  2174. X
  2175. XCASE int fullname
  2176. XI    char*        termbuf
  2177. XIO    char*        name
  2178. XEND
  2179. X
  2180. XCASE int mvwin
  2181. XI    WINDOW*        win
  2182. XI    int        y
  2183. XI    int        x
  2184. XEND
  2185. X
  2186. XCASE WINDOW* newwin
  2187. XI    int        lines
  2188. XI    int        cols
  2189. XI    int        begin_y
  2190. XI    int        begin_x
  2191. XEND
  2192. X
  2193. XCASE int nl
  2194. XEND
  2195. X
  2196. XCASE int nonl
  2197. XEND
  2198. X
  2199. XCASE int scrollok
  2200. XI    WINDOW*        win
  2201. XI    bool        boolf
  2202. XEND
  2203. X
  2204. XCASE WINDOW* subwin
  2205. XI    WINDOW*        win
  2206. XI    int        lines
  2207. XI    int        cols
  2208. XI    int        begin_y
  2209. XI    int        begin_x
  2210. XEND
  2211. X
  2212. XCASE int touchline
  2213. XI    WINDOW*        win
  2214. XI    int        y
  2215. XI    int        startx
  2216. XI    int        endx
  2217. XEND
  2218. X
  2219. XCASE int touchoverlap
  2220. XI    WINDOW*        win1
  2221. XI    WINDOW*        win2
  2222. XEND
  2223. X
  2224. XCASE int touchwin
  2225. XI    WINDOW*        win
  2226. XEND
  2227. X
  2228. XCASE char* unctrl
  2229. XI    char        ch
  2230. XEND
  2231. X
  2232. XCASE int gettmode
  2233. XEND
  2234. X
  2235. XCASE int mvcur
  2236. XI    int        lasty
  2237. XI    int        lastx
  2238. XI    int        newy
  2239. XI    int        newx
  2240. XEND
  2241. X
  2242. XCASE int scroll
  2243. XI    WINDOW*        win
  2244. XEND
  2245. X
  2246. XCASE int savetty
  2247. XEND
  2248. X
  2249. XCASE void resetty
  2250. XEND
  2251. X
  2252. XCASE int setterm
  2253. XI    char*        name
  2254. XEND
  2255. X
  2256. XCASE int tstp
  2257. XEND
  2258. X
  2259. XCASE int _putchar
  2260. XI    char        ch
  2261. XEND
  2262. X
  2263. X    default:
  2264. X    fatal("Unimplemented user-defined subroutine");
  2265. X    }
  2266. X    return sp;
  2267. X}
  2268. X
  2269. Xstatic int
  2270. Xuserval(ix, str)
  2271. Xint ix;
  2272. XSTR *str;
  2273. X{
  2274. X    switch (ix) {
  2275. X    case UV_COLS:
  2276. X    str_numset(str, (double)COLS);
  2277. X    break;
  2278. X    case UV_Def_term:
  2279. X    str_set(str, Def_term);
  2280. X    break;
  2281. X    case UV_ERR:
  2282. X    str_numset(str, (double)ERR);
  2283. X    break;
  2284. X    case UV_LINES:
  2285. X    str_numset(str, (double)LINES);
  2286. X    break;
  2287. X    case UV_My_term:
  2288. X    str_numset(str, (double)My_term);
  2289. X    break;
  2290. X    case UV_OK:
  2291. X    str_numset(str, (double)OK);
  2292. X    break;
  2293. X    case UV_curscr:
  2294. X    str_nset(str, &curscr, sizeof(WINDOW*));
  2295. X    break;
  2296. X    case UV_stdscr:
  2297. X    str_nset(str, &stdscr, sizeof(WINDOW*));
  2298. X    break;
  2299. X    case UV_ttytype:
  2300. X    str_set(str, ttytype);
  2301. X    break;
  2302. X    }
  2303. X    return 0;
  2304. X}
  2305. X
  2306. Xstatic int
  2307. Xuserset(ix, str)
  2308. Xint ix;
  2309. XSTR *str;
  2310. X{
  2311. X    switch (ix) {
  2312. X    case UV_COLS:
  2313. X    COLS = (int)str_gnum(str);
  2314. X    break;
  2315. X    case UV_Def_term:
  2316. X    Def_term = savestr(str_get(str));    /* never freed */
  2317. X    break;
  2318. X    case UV_LINES:
  2319. X    LINES = (int)str_gnum(str);
  2320. X    break;
  2321. X    case UV_My_term:
  2322. X    My_term = (bool)str_gnum(str);
  2323. X    break;
  2324. X    case UV_ttytype:
  2325. X    strcpy(ttytype, str_get(str));        /* hope it fits */
  2326. X    break;
  2327. X    }
  2328. X    return 0;
  2329. X}
  2330. !STUFFY!FUNK!
  2331. echo Extracting t/op/delete.t
  2332. sed >t/op/delete.t <<'!STUFFY!FUNK!' -e 's/X//'
  2333. X#!./perl
  2334. X
  2335. X# $Header: delete.t,v 4.0 91/03/20 01:51:56 lwall Locked $
  2336. X
  2337. Xprint "1..6\n";
  2338. X
  2339. X$foo{1} = 'a';
  2340. X$foo{2} = 'b';
  2341. X$foo{3} = 'c';
  2342. X
  2343. X$foo = delete $foo{2};
  2344. X
  2345. Xif ($foo eq 'b') {print "ok 1\n";} else {print "not ok 1 $foo\n";}
  2346. Xif ($foo{2} eq '') {print "ok 2\n";} else {print "not ok 2 $foo{2}\n";}
  2347. Xif ($foo{1} eq 'a') {print "ok 3\n";} else {print "not ok 3\n";}
  2348. Xif ($foo{3} eq 'c') {print "ok 4\n";} else {print "not ok 4\n";}
  2349. X
  2350. X$foo = join('',values(foo));
  2351. Xif ($foo eq 'ac' || $foo eq 'ca') {print "ok 5\n";} else {print "not ok 5\n";}
  2352. X
  2353. Xforeach $key (keys foo) {
  2354. X    delete $foo{$key};
  2355. X}
  2356. X
  2357. X$foo{'foo'} = 'x';
  2358. X$foo{'bar'} = 'y';
  2359. X
  2360. X$foo = join('',values(foo));
  2361. Xif ($foo eq 'xy' || $foo eq 'yx') {print "ok 6\n";} else {print "not ok 6\n";}
  2362. !STUFFY!FUNK!
  2363. echo " "
  2364. echo "End of kit 14 (of 36)"
  2365. cat /dev/null >kit14isdone
  2366. run=''
  2367. config=''
  2368. 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
  2369.     if test -f kit${iskit}isdone; then
  2370.     run="$run $iskit"
  2371.     else
  2372.     todo="$todo $iskit"
  2373.     fi
  2374. done
  2375. case $todo in
  2376.     '')
  2377.     echo "You have run all your kits.  Please read README and then type Configure."
  2378.     for combo in *:AA; do
  2379.         if test -f "$combo"; then
  2380.         realfile=`basename $combo :AA`
  2381.         cat $realfile:[A-Z][A-Z] >$realfile
  2382.         rm -rf $realfile:[A-Z][A-Z]
  2383.         fi
  2384.     done
  2385.     rm -rf kit*isdone
  2386.     chmod 755 Configure
  2387.     ;;
  2388.     *)  echo "You have run$run."
  2389.     echo "You still need to run$todo."
  2390.     ;;
  2391. esac
  2392. : Someone might mail this, so...
  2393. exit
  2394.  
  2395. exit 0 # Just in case...
  2396. -- 
  2397. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  2398. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  2399. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  2400. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  2401.