home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / misc / volume18 / perl / part01 next >
Internet Message Format  |  1991-04-14  |  50KB

  1. From: lwall@netlabs.com (Larry Wall)
  2. Newsgroups: comp.sources.misc
  3. Subject: v18i019:  perl - The perl programming language, Part01/36
  4. Message-ID: <1991Apr15.015207.6491@sparky.IMD.Sterling.COM>
  5. Date: 15 Apr 91 01:52:07 GMT
  6. Approved: kent@sparky.imd.sterling.com
  7. X-Checksum-Snefru: afd48341 45aaf0a0 c8af2495 9685a77c
  8.  
  9. Submitted-by: Larry Wall <lwall@netlabs.com>
  10. Posting-number: Volume 18, Issue 19
  11. Archive-name: perl/part01
  12.  
  13. [There are 36 kits for perl version 4.0.]
  14.  
  15. [This is being posted at patchlevel 3. -Kent+]
  16.  
  17. Perl is a language that combines some of the features of C, sed, awk and shell.
  18.  
  19. #! /bin/sh
  20.  
  21. # Make a new directory for the perl sources, cd to it, and run kits 1
  22. # thru 36 through sh.  When all 36 kits have been run, read README.
  23.  
  24. echo "This is perl 4.0 kit 1 (of 36).  If kit 1 is complete, the line"
  25. echo '"'"End of kit 1 (of 36)"'" will echo at the end.'
  26. echo ""
  27. export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
  28. mkdir eg eg/sysvipc h2pl msdos os2 t t/op usub 2>/dev/null
  29. echo Extracting os2/README.OS2
  30. sed >os2/README.OS2 <<'!STUFFY!FUNK!' -e 's/X//'
  31. X           Notes on the OS/2 Perl port
  32. X
  33. X            Raymond Chen
  34. X         (rjc@math.princeton.edu)
  35. X
  36. X                        Kai Uwe Rommel
  37. X          (rommel@lan.informatik.tu-muenchen.dbp.de)
  38. X
  39. X-1.  Background.
  40. X
  41. XThis port was based on the MS-DOS port by Diomidis Spinellis.
  42. X
  43. X0.  Set-up.
  44. X
  45. XFirst copy the files in the os2 directory into the parent
  46. Xdirectory.  Also install the file msdos/dir.h in your include
  47. Xdirectory.
  48. X
  49. X1.  Compiling.
  50. X
  51. XPerl has been compiled under MS-DOS using the Microsoft C compiler
  52. Xversion 6.0.  Before compiling install dir.h as <sys/dir.h>.  You will
  53. Xneed a Unix-like make program and something like yacc (e.g. bison).  I
  54. Xjust ran yacc on my UNIX box and downloaded the resulting y.tab.[ch]
  55. Xfiles.  Compilation takes 45 minutes on a 16MHz 386 machine running
  56. Xno jobs other than the compiler, so you will probably need something to
  57. Xdo in the meantime.  Like, say, lunch.  (Compilation time does not
  58. Xinclude formatting the manual.)  If you compile with optimization
  59. Xturned off, it takes about half as long.
  60. X
  61. XThe executable is 270k (perlsym.exe is 473k; if you compile
  62. Xwithout optimization, the sizes are 329K/531K), and the top level
  63. Xdirectory needs 800K for sources, 550K for object code, and 800K for the
  64. Xexecutables, assuming you want to build both perl.exe and perlsym.exe
  65. Xwith full optimization.
  66. X
  67. XThe makefile will compile glob for you which you will need to place
  68. Xsomewhere in your path so that perl globbing will work correctly.  All
  69. Xthe tests were run, although some modifications were necessary because
  70. XOS/2 isn't UNIX. The tests that failed failed because of limitations of
  71. Xthe operating system and aren't the fault of the compiler.  a2p and s2p
  72. Xwere not tested.
  73. X
  74. XIn the eg directory you will find the syscalls.pl header file,
  75. Xand a sample program that demonstrates some of the improvements
  76. Xof the OS/2 version over the MS-DOS version and some of the
  77. Xsystem calls.
  78. X
  79. X2.  Using OS/2 Perl
  80. X
  81. XThe OS/2 version of perl has much of the functionality of the Unix
  82. Xversion.  Here are some things that don't work:  sockets, password
  83. Xfunctions, [gs]et[eug]id, dbm functions, fork.
  84. X
  85. XOne thing that doesn't work is "split" with no arguments.  Somehow,
  86. Xyylval.arg is empty ...  [[ Wait, sorry, I fixed that. --rjc ]]
  87. X
  88. XCare has been taken to implement the rest, although the implementation
  89. Xmight not be the best possible.  Here are short notes on the tricky
  90. Xbits:
  91. X
  92. X2.1.  In-place editing.
  93. X
  94. XFiles currently can be edited in-place provided you are creating a
  95. Xbackup.  Considerable effort is made to ensure that a reasonable
  96. Xname for the backup is selected, while still remaining within
  97. Xthe 8.3 contraints of the FAT filesystem.  (HPFS users have nothing
  98. Xto worry about, since HPFS doesn't have the stupid 8.3 rule.)
  99. X
  100. XThe rules for how OS/2 perl combines your filename with the suffix
  101. X(the thing passed to "-i") are rather complicated, but the basic
  102. Xidea is that the "obvious" name is chosen.
  103. X
  104. XHere are the rules:
  105. X
  106. XStyle 0:  Append the suffix exactly as UNIX perl would do it.
  107. X          If the filesystem likes it, use it.  (HPFS will always
  108. X          swallow it.  FAT will rarely accept it.)
  109. X
  110. XStyle 1:  If the suffix begins with a '.', change the file extension
  111. X      to whatever you supplied.  If the name matches the original
  112. X      name, use the fallback method.
  113. X
  114. XStyle 2:  If the suffix is a single character, not a '.', try to add the
  115. X          suffix to the following places, using the first one that works.
  116. X              [1] Append to extension.
  117. X              [2] Append to filename,
  118. X              [3] Replace end of extension,
  119. X              [4] Replace end of filename.
  120. X          If the name matches the original name, use the fallback method.
  121. X
  122. XStyle 3:  Any other case:  Ignore the suffix completely and use the
  123. X          fallback method.
  124. X
  125. XFallback method:  Change the extension to ".$$$".  If that matches the
  126. X          original name, then change the extension to ".~~~".
  127. X
  128. XIf filename is more than 1000 characters long, we die a horrible
  129. Xdeath.  Sorry.
  130. X
  131. XExamples, assuming style 0 failed.
  132. X
  133. Xsuffix = ".bak" (style 1)
  134. X               foo.bar => foo.bak
  135. X               foo.bak => foo.$$$    (fallback)
  136. X               foo.$$$ => foo.~~~    (fallback)
  137. X               makefile => makefile.bak
  138. X
  139. Xsuffix = "~" (style 2)
  140. X               foo.c => foo.c~
  141. X               foo.c~ => foo.c~~
  142. X               foo.c~~ => foo~.c~~
  143. X               foo~.c~~ => foo~~.c~~
  144. X               foo~~~~~.c~~ => foo~~~~~.$$$ (fallback)
  145. X
  146. X               foo.pas => foo~.pas
  147. X               makefile => makefile.~
  148. X               longname.fil => longname.fi~
  149. X               longname.fi~ => longnam~.fi~
  150. X               longnam~.fi~ => longnam~.$$$
  151. X
  152. X2.2.  Directory access.
  153. X
  154. XAre implemented, but in order to support telldir() and seekdir(),
  155. Xthey operate by reading in the entire directory at opendir(),
  156. Xthen handing out pieces of it each time you do a readdir().
  157. X
  158. X2.3.  Pipes and redirection.
  159. X
  160. XPipes and redirection are supported.  Although OS/2 does not
  161. Xterminate programs which try to write to closed pipes, perl will
  162. Xkill them for you if you do it like this:
  163. X
  164. X    open(I, "long-running-program|");
  165. X    ... process a few lines ...
  166. X    close(I);    # discard the rest ...
  167. X
  168. XThe killing works like this:  We wait until the child program either
  169. Xcloses its stdout or tries to write to it.  If it writes to its stdout,
  170. Xwe kill it.  Otherwise, we cwait for it.  This is pretty much what UNIX
  171. Xdoes by default.
  172. X
  173. XAll pipe commands are given to cmd.exe (or your COMSPEC) for execution as
  174. X
  175. X    CMD /c your-command-line
  176. X
  177. Xso you can go ahead and load it up with any goofy things you want,
  178. Xlike 2>1 redirection, more pipes, && || etc.
  179. X
  180. XThe pipe() function is also supported, so you can go ahead and
  181. Xmake your own funky file descriptor connections before piping off
  182. Xa process.  However, you have to mark the descriptor you are
  183. Xretaining as NOINHERIT before spawning, else you are in deadlock city.
  184. XUnfortunately, there's no way to mark the handle as NOINHERIT yet.
  185. XIt's on my wish list.
  186. X
  187. X2.4.  Syscall and Ioctl
  188. X
  189. XIOCtl is not supported because the API is very different from the
  190. XUNIX API.  Instead, IOCtl is supported as a syscall.  Here are
  191. Xthe syscalls I've written so far:
  192. X
  193. X    $OS2_GetVersion = 0;
  194. X    $OS2_Shutdown = 1;
  195. X    $OS2_Beep = 2;
  196. X    $OS2_PhysicalDisk = 3;
  197. X    $OS2_Config = 4;
  198. X    $OS2_IOCtl = 5;
  199. X    $OS2_QCurDisk = 6;
  200. X    $OS2_SelectDisk = 7;
  201. X    $OS2_SetMaxFH = 8;
  202. X    $OS2_Sleep = 9;
  203. X    $OS2_StartSession = 10;
  204. X    $OS2_StopSession = 11;
  205. X    $OS2_SelectSession = 12;
  206. X
  207. XThe arguments you pass are handed off to OS/2 without interpretation,
  208. Xand the return value is returned straight to you.  However, you don't
  209. Xhave to supply arguments for the ones whose descriptions are "must be
  210. Xzero"; perl will supply the mandatory zeros for you.
  211. X
  212. X2.5.  Binary file access
  213. X
  214. XFiles are opened in text mode by default.  This means that CR LF pairs
  215. Xare translated to LF. If binary access is needed the `binarymode'
  216. Xfunction should be used.  There is currently no way to reverse the
  217. Xeffect of the binary function.  If that is needed close and reopen the
  218. Xfile.
  219. X
  220. X2.6.  Priority
  221. X
  222. XThe getpriority and setpriority functions are implemented, but since
  223. XOS/2 priorities are different from UNIX priorities, the arguments aren't
  224. Xthe same.  Basically, the arguments you pass are handed directly to
  225. XOS/2. The only exception is the last argument to setpriority.  To make
  226. Xit easier to make delta priorities, if the priority class is 0xff, it
  227. Xis changed to 0.  That way, you can write
  228. X
  229. X    setpriority(0,0,-2)
  230. X
  231. Xinstead of
  232. X
  233. X    setpriority(0,0,0xfe)
  234. X
  235. Xto decrease the delta by 2.
  236. X
  237. X2.7.  Interpreter startup.
  238. X
  239. XThe effect of the Unix #!/bin/perl interpreter startup can be obtained
  240. Xunder OS/2 by giving the script a .cmd extension and beginning the script
  241. Xwith the line
  242. X
  243. X    extproc C:\binp\perl.exe -S
  244. X
  245. XYou should provide the appropriate path to your executable, and
  246. Xthe -S option is necessary so that perl can find your script.
  247. X
  248. X2.8.  The kill function.
  249. X
  250. XUNIX and OS/2 have different ideas about the kill function.  I've
  251. Xdone a pretty feeble job of taking perl's UNIXish approach and
  252. Xtrying to jam it into the OS/2 way.  No doubt you'll find that
  253. Xyour kill()s aren't working.  My apologies in advance.
  254. X
  255. X3.  Bug reports.
  256. X
  257. XI don't normally have access to an OS/2 machine, so if you find
  258. Xa bug, you can go ahead and tell me about it, but the odds that
  259. XI'd be able to fix it are slim.
  260. X
  261. X4.  Wish list.
  262. X
  263. X4.1.  OS/2.
  264. X
  265. XMake ENOPIPE a fatal error.
  266. X
  267. XPermit linking of files.  (Allegedly, they're working on this.)
  268. X
  269. XGet a fork.
  270. X
  271. XMake CMD.EXE pass through the return code of its child.
  272. X
  273. X4.2 perl.
  274. X
  275. XProvide a nice way to add new functions to perl without having
  276. Xto understand the innards of perl.  Not being fluent in perl
  277. Xinnards hacking, I added my extra functions via syscall.
  278. X
  279. X4.3. My port.
  280. X
  281. X4.3.1.  In-place editing.
  282. X
  283. XMake more idiot-proof.
  284. X
  285. XAllow in-place editing without backup.  (How?)
  286. X
  287. X4.3.2.  Spawning and piping.
  288. X
  289. XMake popen() cleverer.  Currently, it blindly hands everything
  290. Xoff to CMD.EXE.  This wastes an exec if the command line didn't
  291. Xhave any shell metacharacters and if the program being run
  292. Xis not a batch file.
  293. X
  294. XClever spawning is carried out by do_spawn.  We should try
  295. Xto make popen() do much of the same sort of preprocessing
  296. Xas do_spawn does (which means, of course, that we probably
  297. Xshould yank out code to be dished off into a subroutine).
  298. X
  299. XIn do_spawn(), use DosExecPgm instead of spawnl in order to get more
  300. Xprecise reasons why the child terminated (RESULTCODES).
  301. X
  302. X
  303. X                July 1990
  304. X
  305. X                Raymond Chen <rjc@math.princeton.edu>
  306. X                1817 Oxford St. Apt 6
  307. X                Berkeley, CA 94709-1828 USA
  308. X
  309. X-----------------------
  310. XI picked up the OS/2 port with patches 19-28. When compiling, I found
  311. Xout that os2.c and director.c were missing. I had to rewrite them because
  312. Xeven the original author of the port (Raymond Chen) did no longer have them.
  313. X
  314. XI had directory routines laying around, this was no big deal.
  315. XI rewrote os2.c, but did not implement the syscall() as described above.
  316. XI had not the time and did not really need it. Feel free ...
  317. X
  318. XChanges to above described port:
  319. X
  320. X- the small program GLOB is now named PERLGLOB for better ordering in
  321. X  my /bin directory
  322. X
  323. X- added help page (well, a graphical user interface would be overkill
  324. X  but a simple help page should be in every program :-)
  325. X
  326. X- several cosmetic changes in standard distribution files because of
  327. X  naming conventions etc., #ifdef'd OS2
  328. X
  329. X- syscall() not supported as noted above
  330. X
  331. X- chdir now recognizes also drive letters and changes also the drive
  332. X
  333. X- new mypopen(), mypclose() functions and simulation routines for DOS mode,
  334. X  they are selected automatically in real mode
  335. X- the new pclose() does not kill the child, my experience is that this is
  336. X  not needed.
  337. X
  338. X- setpriority is now:   setpriority(class, pid, val)
  339. X  see description of DosSetPrty() for class and val meanings
  340. X- getpriority is now:   getpriority(dummy, pid)
  341. X  see description of DosGetPrty()
  342. X
  343. X- kill is now:          kill(pid, sig)
  344. X  where sig can be 0 (kill process)
  345. X                   1-3 (send process flags A-C, see DosFlagProcess())
  346. X  if pid is less than zero, the signal is sent to the whole
  347. X  process tree originating at -pid.
  348. X
  349. XThe following files are now new with patch >=29:
  350. X
  351. Xreadme.os2        this file
  352. X
  353. Xdir.h             sys/dir.h
  354. Xdirector.c        directory routines
  355. Xos2.c             kernel of OS/2 port (see below)
  356. Xpopen.c           new popen.c
  357. Xmktemp.c          enhanced mktemp(), uses TMP env. variable, used by popen.c
  358. Xalarm.c           PD implementation for alarm()
  359. Xalarm.h          header for alarm.c
  360. X
  361. Xperl.cs           Compiler Shell script for perl itself
  362. Xperl.def          linker definition file for perl
  363. Xperl.bad          names of protect-only API calls for BIND
  364. Xperlglob.cs       Compiler Shell script for perl globbing program
  365. Xperlglob.def      linker definition file for perlglob
  366. Xa2p.cs            Compiler Shell script for a2p (see below)
  367. Xa2p.def           linker definition file for a2p
  368. Xmakefile          Makefile, not tested
  369. X
  370. Xperlsh.cmd        the converted perlsh
  371. Xperldb.dif        changes required for perldb.pl (change for your needs)
  372. Xselfrun.cmd       sample selfrunning perl script for OS/2
  373. Xselfrun.bat       sample selfrunning perl script for DOS mode
  374. X
  375. XNote: I don't use make but my own utility, the Compiler Shell CS.
  376. XIt was posted in comp.binaries.os2 or you can ask me for the newest
  377. Xversion. The .CS files are the "makefiles" for it.
  378. X
  379. XNote: MS C 6.00 is required. C 5.1 is not capable of compiling perl,
  380. Xespecially not with -DDEBUGGING
  381. X
  382. X
  383. X                                August 1990
  384. X
  385. X                                Kai Uwe Rommel
  386. X                                rommel@lan.informatik.tu-muenchen.dbp.de
  387. X                                Zennerstr. 1
  388. X                                D-8000 Muenchen 70
  389. X
  390. X
  391. X+ I have verified with patchlevel 37, that the OS/2 port compiles,
  392. X  after doing two minor changes. HPFS filenames support was also added.
  393. X  Some bugs were fixed.
  394. X+ To compile,
  395. X  - you need the bison parser generator
  396. X  - copy config.h from os2 into the main perl directory (important !)
  397. X  - copy perl.cs and perlglob.cs from the os2 subdir to the main dir
  398. X  - copy a2p.cs from os2 to x2p
  399. X  - say "bison -d perl.y"
  400. X      "ren perl_tab.c perl.c" and
  401. X      "ren perl_tab.h perly.h"    in the main directory
  402. X  - say "cs perl" and
  403. X      "cs perlglob" in the main directory
  404. X  - say "cs a2p" in the x2p subdir
  405. X+ If you don't have CS or don't want to use it, you have to
  406. X  construct a makefile ...
  407. X+ If you have GNU gdbm, you can define NDBM in config.h and link with a
  408. X  large model library of gdbm.
  409. X+ I am not shure if I can verify the OS/2 port with each release
  410. X  from Larry Wall. Therefore, in future releases there may be
  411. X  changes required to compile perl for OS/2.
  412. X                 October 1990
  413. X                Kai Uwe Rommel
  414. X                rommel@lan.informatik.tu-muenchen.dbp.de
  415. X
  416. X
  417. XVerified patchlevel 40.
  418. XSome bugs were fixed. Added alarm() support (using PD implementation).
  419. X
  420. X
  421. X                 November 1990
  422. X
  423. X                                Kai Uwe Rommel
  424. X                                rommel@lan.informatik.tu-muenchen.dbp.de
  425. X
  426. X
  427. XVerified patchlevel 44.
  428. XOnly two #ifdefs added to eval.c. Stack size for A2P had to be corrected.
  429. XPERLGLOB separated from DOS version because of HPFS support.
  430. X
  431. X[Note: instead of #ifdef'ing eval.c I fixed it in perl.h--lwall]
  432. X
  433. X                January 1991
  434. X
  435. X                                Kai Uwe Rommel
  436. X                                  rommel@lan.informatik.tu-muenchen.dbp.de
  437. !STUFFY!FUNK!
  438. echo Extracting README
  439. sed >README <<'!STUFFY!FUNK!' -e 's/X//'
  440. X
  441. X            Perl Kit, Version 4.0
  442. X
  443. X        Copyright (c) 1989,1990,1991, Larry Wall
  444. X
  445. X    This program is free software; you can redistribute it and/or modify
  446. X    it under the terms of the GNU General Public License as published by
  447. X    the Free Software Foundation; either version 1, or (at your option)
  448. X    any later version.
  449. X
  450. X    This program is distributed in the hope that it will be useful,
  451. X    but WITHOUT ANY WARRANTY; without even the implied warranty of
  452. X    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  453. X    GNU General Public License for more details.
  454. X
  455. X    You should have received a copy of the GNU General Public License
  456. X    along with this program; if not, write to the Free Software
  457. X    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  458. X
  459. X    My interpretation of the GNU General Public License is that no Perl
  460. X    script falls under the terms of the License unless you explicitly put
  461. X    said script under the terms of the License yourself.  Furthermore, any
  462. X    object code linked with uperl.o does not automatically fall under the
  463. X    terms of the License, provided such object code only adds definitions
  464. X    of subroutines and variables, and does not otherwise impair the
  465. X    resulting interpreter from executing any standard Perl script.  I
  466. X    consider linking in C subroutines in this manner to be the moral
  467. X    equivalent of defining subroutines in the Perl language itself.  You
  468. X    may sell such an object file as proprietary provided that you provide
  469. X    or offer to provide the Perl source, as specified by the GNU General
  470. X    Public License.  (This is merely an alternate way of specifying input
  471. X    to the program.)  You may also sell a binary produced by the dumping of
  472. X    a running Perl script that belongs to you, provided that you provide or
  473. X    offer to provide the Perl source as specified by the License.  (The
  474. X    fact that a Perl interpreter and your code are in the same binary file
  475. X    is, in this case, a form of mere aggregation.)  This is my interpretation
  476. X    of the License.  If you still have concerns or difficulties understanding
  477. X    my intent, feel free to contact me.
  478. X
  479. X--------------------------------------------------------------------------
  480. X
  481. XPerl is a language that combines some of the features of C, sed, awk and shell.
  482. XSee the manual page for more hype.
  483. X
  484. XPerl will probably not run on machines with a small address space.
  485. X
  486. XPlease read all the directions below before you proceed any further, and
  487. Xthen follow them carefully.
  488. X
  489. XAfter you have unpacked your kit, you should have all the files listed
  490. Xin MANIFEST.
  491. X
  492. XInstallation
  493. X
  494. X1)  Run Configure.  This will figure out various things about your system.
  495. X    Some things Configure will figure out for itself, other things it will
  496. X    ask you about.  It will then proceed to make config.h, config.sh, and
  497. X    Makefile.  If you're a hotshot, run Configure -d to take all the
  498. X    defaults and then edit config.sh to patch up any flaws.
  499. X
  500. X    You might possibly have to trim # comments from the front of Configure
  501. X    if your sh doesn't handle them, but all other # comments will be taken
  502. X    care of.
  503. X
  504. X    (If you don't have sh, you'll have to copy the sample file config.H to
  505. X    config.h and edit the config.h to reflect your system's peculiarities.)
  506. X
  507. X2)  Glance through config.h to make sure system dependencies are correct.
  508. X    Most of them should have been taken care of by running the Configure script.
  509. X
  510. X    If you have any additional changes to make to the C definitions, they
  511. X    can be done in cflags.SH.  For instance, to turn off the optimizer
  512. X    on eval.c, find the line in the switch structure for eval.c and
  513. X    put the command $optimize='-g' before the ;;.  You will probably
  514. X    want to change the entry for teval.c too.  To change the C flags
  515. X    for all the files, edit config.sh and change either $ccflags or $optimize.
  516. X
  517. X3)  make depend
  518. X
  519. X    This will look for all the includes and modify Makefile accordingly.
  520. X    Configure will offer to do this for you.
  521. X
  522. X4)  make
  523. X
  524. X    This will attempt to make perl in the current directory.
  525. X
  526. X    If you can't compile successfully, try adding a -DCRIPPLED_CC flag.
  527. X    (Just because you get no errors doesn't mean it compiled right!)
  528. X    This simplifies some complicated expressions for compilers that
  529. X    get indigestion easily.  If that has no effect, try turning off
  530. X    optimization.  If you have missing routines, you probably need to
  531. X    add some library or other, or you need to undefine some feature that
  532. X    Configure thought was there but is defective or incomplete.
  533. X
  534. X    Some compilers will not compile or optimize the larger files without
  535. X    some extra switches to use larger jump offsets or allocate larger
  536. X    internal tables.  You can customize the switches for each file in
  537. X    cflags.SH.  It's okay to insert rules for specific files into
  538. X    Makefile.SH, since a default rule only takes effect in the
  539. X    absence of a specific rule.
  540. X
  541. X    Most of the following hints are now done automatically by Configure.
  542. X
  543. X    The 3b2 needs to turn off -O.
  544. X    Compilers with limited switch tables may have to define -DSMALLSWITCHES
  545. X    Domain/OS 10.3 (at least) native C 6.7 may need -opt 2 for eval.c
  546. X    AIX/RT may need a -a switch and -DCRIPPLED_CC.
  547. X    AIX RS/6000 needs to use system malloc and avoid -O on eval.c and toke.c.
  548. X    AIX RS/6000 needs -D_NO_PROTO.
  549. X    SUNOS 4.0.[12] needs #define fputs(str,fp) fprintf(fp,"%s",str) in perl.h
  550. X    SUNOS 3.[45] should use the system malloc.
  551. X    SGI machines may need -Ddouble="long float" and -O1.
  552. X    Vax-based systems may need to hand assemble teval.s with a -J switch.
  553. X    Ultrix on MIPS machines may need -DLANGUAGE_C.
  554. X    Ultrix 4.0 on MIPS machines may need -Olimit 2900 or so.
  555. X    Ultrix 3.[01] on MIPS needs to undefine WAITPID--the system call is busted.
  556. X    MIPS machines may need to undef d_volatile.
  557. X    MIPS machines may need to turn off -O on cmd.c, perl.c and tperl.c.
  558. X    Some MIPS machines may need to undefine CASTNEGFLOAT.
  559. X    Xenix 386 needs -Sm11000 for yacc, and may need -UM_I86.
  560. X    SCO Xenix may need -m25000 for yacc.  See also README.xenix.
  561. X    Genix needs to use libc rather than libc_s, or #undef VARARGS.
  562. X    NCR Tower 32 (OS 2.01.01) may need -W2,-Sl,2000 and #undef MKDIR.
  563. X    A/UX may appears to work with -O -B/usr/lib/big/ optimizer flags.
  564. X    A/UX needs -lposix to find rewinddir.
  565. X    A/UX may need -ZP -DPOSIX, and -g if big cc is used.
  566. X    FPS machines may need -J and -DBADSWITCH.
  567. X    UTS may need one or more of -DCRIPPLED_CC, -K or -g, and undef LSTAT.
  568. X    dynix may need to undefine CASTNEGFLOAT (d_castneg='undef' in config.sh).
  569. X    Dnix (not dynix) may need to remove -O.
  570. X    IRIX 3.3 may need to undefine VFORK.
  571. X    HP/UX may need to pull cerror.o and syscall.o out of libc.a and link
  572. X    them in explicitly.
  573. X    If you get syntax errors on '(', try -DCRIPPLED_CC or -DBADSWITCH or both.
  574. X    Machines with half-implemented dbm routines will need to #undef ODBM & NDBM.
  575. X    If you have GDBM available and want it instead of NDBM, say -DHAS_GDBM.
  576. X    C's that don't try to restore registers on longjmp() may need -DJMPCLOBBER.
  577. X    (Try this if you get random glitches.)
  578. X
  579. X5)  make test
  580. X
  581. X    This will run the regression tests on the perl you just made.
  582. X    If it doesn't say "All tests successful" then something went wrong.
  583. X    See the README in the t subdirectory.  Note that you can't run it
  584. X    in background if this disables opening of /dev/tty.  If "make test"
  585. X    bombs out, just cd to the t directory and run TEST by hand to see if
  586. X    it makes any difference.  If individual tests bomb, you can run
  587. X    them by hand, e.g., ./perl op/groups.t
  588. X
  589. X6)  make install
  590. X
  591. X    This will put perl into a public directory (such as /usr/local/bin).
  592. X    It will also try to put the man pages in a reasonable place.  It will not
  593. X    nroff the man page, however.  You may need to be root to do this.  If
  594. X    you are not root, you must own the directories in question and you should
  595. X    ignore any messages about chown not working.
  596. X
  597. X7)  Read the manual entry before running perl.
  598. X
  599. X8)  IMPORTANT!  Help save the world!  Communicate any problems and suggested
  600. X    patches to me, lwall@netlabs.com (Larry Wall), so we can
  601. X    keep the world in sync.  If you have a problem, there's someone else
  602. X    out there who either has had or will have the same problem.
  603. X
  604. X    If possible, send in patches such that the patch program will apply them.
  605. X    Context diffs are the best, then normal diffs.  Don't send ed scripts--
  606. X    I've probably changed my copy since the version you have.
  607. X
  608. X    Watch for perl patches in comp.lang.perl.  Patches will generally be
  609. X    in a form usable by the patch program.  If you are just now bringing up
  610. X    perl and aren't sure how many patches there are, write to me and I'll
  611. X    send any you don't have.  Your current patch level is shown in patchlevel.h.
  612. X
  613. X
  614. XJust a personal note:  I want you to know that I create nice things like this
  615. Xbecause it pleases the Author of my story.  If this bothers you, then your
  616. Xnotion of Authorship needs some revision.  But you can use perl anyway. :-)
  617. X
  618. X                            The author.
  619. !STUFFY!FUNK!
  620. echo Extracting msdos/README.msdos
  621. sed >msdos/README.msdos <<'!STUFFY!FUNK!' -e 's/X//'
  622. X           Notes on the MS-DOS Perl port
  623. X
  624. X            Diomidis Spinellis
  625. X             (dds@cc.ic.ac.uk)
  626. X
  627. X[0. First copy the files in the msdos directory into the parent
  628. Xdirectory--law]
  629. X
  630. X1.  Compiling.
  631. X
  632. X     Perl has been compiled under MS-DOS using the Microsoft
  633. XC  compiler  version 5.1.  Before compiling install dir.h as
  634. X<sys/dir.h>.  You will need a Unix-like make  program  (e.g.
  635. Xpdmake) and something like yacc (e.g. bison).  You could get
  636. Xaway by running yacc and dry running make on  a  Unix  host,
  637. Xbut  I  haven't tried it.  Compilation takes 12 minutes on a
  638. X20MHz 386 machine (together with formating the  manual),  so
  639. Xyou  will probably need something to do in the meantime. The
  640. Xexecutable is 272k and the top level directory needs 1M  for
  641. Xsources  and  about the same ammount for the object code and
  642. Xthe executables.
  643. X
  644. X     The makefile will compile glob for you which  you  will
  645. Xneed  to  place somewhere in your path so that perl globbing
  646. Xwill work correctly.  I have not tried all the tests or  the
  647. Xexamples,  nor the awk and sed to Perl translators.  You are
  648. Xon your own with them.  In the eg directory I have  included
  649. Xan  example  program  that uses ioctl to display the charac-
  650. Xteristics of the storage devices of the system.
  651. X
  652. X2.  Using MS-DOS Perl
  653. X
  654. X     The MS-DOS version of perl has most of the  functional-
  655. Xity of the Unix version.  Functions that can not be provided
  656. Xunder  MS-DOS  like  sockets,  password  and  host  database
  657. Xaccess,  fork  and wait have been ommited and will terminate
  658. Xwith a fatal error.  Care has been taken  to  implement  the
  659. Xrest.   In particular directory access, redirection (includ-
  660. Xing pipes, but excluding the pipe function),  system,  ioctl
  661. Xand sleep have been provided.
  662. X
  663. X[Files currently can be edited in-place provided you are cre-
  664. Xating  a  backup.   However, if the backup coincidentally has 
  665. Xthe same name as the original, or  if  the  resulting  backup 
  666. Xfilename  is invalid, then the file will probably be trashed.
  667. XFor example, don't do
  668. X
  669. X    perl -i~ script makefile
  670. X    perl -i.bak script file.dat
  671. X
  672. Xbecause  (1)  MS-DOS treats "makefile~" and "makefile" as the
  673. Xsame filename, and (2) "file.dat.bak" is an invalid filename.
  674. XThe  files  "makefile"  and  "file.dat" will probably be lost 
  675. Xforever.  Moral of the story:   Don't  use  in-place  editing 
  676. Xunder MS-DOS. --rjc]
  677. X
  678. X2.1.  Interface to the MS-DOS ioctl system call.
  679. X
  680. X     The function code of the  ioctl  function  (the  second
  681. Xargument) is encoded as follows:
  682. X
  683. X- The lowest nibble of the function code goes to AL.
  684. X- The two middle nibbles go to CL.
  685. X- The high nibble goes to CH.
  686. X
  687. X     The return code is -1 in the case of an  error  and  if
  688. Xsuccessful:
  689. X
  690. X- for functions AL = 00, 09, 0a the value of the register DX
  691. X- for functions AL = 02 - 08, 0e the value of the register AX
  692. X- for functions AL = 01, 0b - 0f the number 0.
  693. X
  694. X     See the perl manual for instruction on how  to  distin-
  695. Xguish between the return value and the success of ioctl.
  696. X
  697. X     Some ioctl functions need a number as the  first  argu-
  698. Xment.   Provided  that  no  other files have been opened the
  699. Xnumber  can  be   obtained   if   ioctl   is   called   with
  700. X@fdnum[number]  as  the  first  argument after executing the
  701. Xfollowing code:
  702. X
  703. X        @fdnum = ("STDIN", "STDOUT", "STDERR");
  704. X        $maxdrives = 15;
  705. X        for ($i = 3; $i < $maxdrives; $i++) {
  706. X                open("FD$i", "nul");
  707. X                @fdnum[$i - 1] = "FD$i";
  708. X        }
  709. X
  710. X2.2.  Binary file access
  711. X
  712. X     Files are opened in text mode by default.   This  means
  713. Xthat  CR LF pairs are translated to LF.  If binary access is
  714. Xneeded the `binary'  function  should  be  used.   There  is
  715. Xcurrently  no  way to reverse the effect of the binary func-
  716. Xtion.  If that is needed close and reopen the file.
  717. X
  718. X2.3.  Interpreter startup.
  719. X
  720. X     The effect of the Unix #!/bin/perl interpreter  startup
  721. Xcan  be  obtained  under  MS-DOS by giving the script a .bat
  722. Xextension and using the following lines on its begining:
  723. X
  724. X        @REM=("
  725. X        @perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  726. X        @end ") if 0 ;
  727. X
  728. X(Note that you will probably want an absolute path name in
  729. Xfront of %0.bat).
  730. X
  731. X                March 1990
  732. X
  733. X                Diomidis Spinellis <dds@cc.ic.ac.uk>
  734. X                Myrsinis 1
  735. X                GR-145 62 Kifissia
  736. X                Greece
  737. X
  738. X--------------------------------------------------------------------------
  739. X
  740. X    Revisions to the MS-DOS support in Perl 4.0
  741. X    Tom Dinger, 18 March 1991
  742. X
  743. XThe DOS compatibility added to Perl sometime in release 3.x was not
  744. Xmaintained, and Perl as distributed could not be built without changes.
  745. X
  746. XBoth myself and Len Reed more or less "rediscovered" how to get Perl built
  747. Xand running reliably for MS-DOS, using the Microsoft C compiler.  He and I
  748. Xhave communicated, and will be putting together additional patches for the
  749. XDOS version of Perl.
  750. X
  751. X1. Compiling Perl
  752. X
  753. X    For now, I have not supplied a makefile, as there is no standard for
  754. X    make utilities under DOS.  All the files can be compiled with Microsoft
  755. X    C 5.1, using the switches "-AL -Ox" for Large memory model, maximum
  756. X    optimization (this turned out a few code generation bugs in MSC 5.1).
  757. X    The code will also compile with MSC 6.00A, with the optimization
  758. X    "-Oacegils /Gs" for all files (regcomp.c has special case code to change
  759. X    the aliasing optimizations).
  760. X
  761. X    Generally, you follow the instructions given above to compile and build
  762. X    Perl 4.0 for DOS.  I used the output of SunOS yacc run on perly.y,
  763. X    without modification, but I expect both Bison and Berkeley-YACC will work
  764. X    also.  From inspection of the generated code, however, I believe AT&T
  765. X    derived YACC produces the smallest tables, i.e. uses the least memory.
  766. X    This is important for a 300K executable file.
  767. X
  768. X2. Editing in-place.
  769. X
  770. X    You will need the file suffix.c from the os2 subdirectory -- it will
  771. X    create a backup file with much less danger for DOS.
  772. X
  773. X3. A "Smarter" chdir() function.
  774. X
  775. X    I have added to the DOS version of Perl 4.0 a replacement chdir()
  776. X    function.  Unlike the "normal" behavior, it is aware of drive letters
  777. X    at the start of paths for DOS.  So for example:
  778. X
  779. X    perl_chdir( "B:" )      changes to the default directory, on drive B:
  780. X    perl_chdir( "C:\FOO" )  changes to the specified directory, on drive C:
  781. X    perl_chdir( "\BAR" )    changes to the specified directory on the
  782. X                            current drive.
  783. X
  784. X4. *.BAT Scripts as Perl scripts
  785. X
  786. X    The strategy described above for turning a Perl script into a *.BAT
  787. X    script do not work.  I have been using the following lines at the
  788. X    beginning of a Perl *.BAT script:
  789. X
  790. X        @REM=(qq!
  791. X        @perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  792. X        @goto end !) if 0 ;
  793. X
  794. X    and the following at the end of the *.BAT script:
  795. X
  796. X        @REM=(qq!
  797. X        :end !) if 0 ;
  798. X
  799. X    If you like, with the proper editor you can replace the four '!'
  800. X    characters with some untypeable character, such as Ctrl-A.  This will
  801. X    allow you to pass any characters, including ".." strings as arguments.
  802. X
  803. X4. Things to Come
  804. X
  805. X     *  Better temporary file handling.
  806. X     *  A real Makefile -- Len Reed has one for Dmake 3.6
  807. X     *  Swapping code -- swaps most of Perl out of memory (to EMS, XMS or
  808. X    disk) before running a sub-program or pipe.
  809. X     *    MKS command line support, both into Perl, and to other programs
  810. X    spawned by Perl.
  811. X     *    Smarter pipe functions, not using COMMAND.COM.
  812. X
  813. X
  814. X                    Tom Dinger
  815. X                    tdinger@East.Sun.COM
  816. X                    Martch 18, 1991
  817. !STUFFY!FUNK!
  818. echo Extracting usub/README
  819. sed >usub/README <<'!STUFFY!FUNK!' -e 's/X//'
  820. XThis directory contains an example of how you might link in C subroutines
  821. Xwith perl to make your own special copy of perl.  In the perl distribution
  822. Xdirectory, there will be (after make is run) a file called uperl.o, which
  823. Xis all of perl except for a single undefined subroutine, named userinit().
  824. XSee usersub.c.
  825. X
  826. XThe sole purpose of the userinit() routine is to call the initialization
  827. Xroutines for any modules that you want to link in.  In this example, we just
  828. Xcall init_curses(), which sets up to link in the BSD curses routines.
  829. XYou'll find this in the file curses.c, which is the processed output of
  830. Xcurses.mus.
  831. X
  832. XThe magicname() routine adds variable names into the symbol table.  Along
  833. Xwith the name of the variable as Perl knows it, we pass a structure containing
  834. Xan index identifying the variable, and the names of two C functions that
  835. Xknow how to set or evaluate a variable given the index of the variable.
  836. XOur example uses a macro to handle this conveniently.
  837. X
  838. XThe init routine calls make_usub() to add user-defined subroutine names
  839. Xinto the symbol table.  The arguments are
  840. X
  841. X    make_usub(subname, subindex, subfunc, filename);
  842. X    char *subname;
  843. X    int subindex;
  844. X    int subfunc();
  845. X    char *filename;
  846. X
  847. XThe subname is the name that will be used in the Perl program.  The subindex
  848. Xwill be passed to subfunc() when it is called to tell it which C function
  849. Xis desired.  subfunc() is a glue routine that translates the arguments
  850. Xfrom Perl internal stack form to the form required by the routine in
  851. Xquestion, calls the desired C function, and then translates any return
  852. Xvalue back into the stack format.  The glue routine used by curses just
  853. Xhas a large switch statement, each branch of which does the processing
  854. Xfor a particular C function.  The subindex could, however, be used to look
  855. Xup a function in a dynamically linked library.  No example of this is
  856. Xprovided.
  857. X
  858. XAs a help in producing the glue routine, a preprocessor called "mus" lets
  859. Xyou specify argument and return value types in a tabular format.  An entry
  860. Xsuch as:
  861. X
  862. X    CASE int waddstr
  863. X    I       WINDOW*         win
  864. X    I       char*           str
  865. X    END
  866. X
  867. Xindicates that waddstr takes two input arguments, the first of which is a
  868. Xpointer to a window, and the second of which is an ordinary C string.  It
  869. Xalso indicates that an integer is returned.  The mus program turns this into:
  870. X
  871. X    case US_waddstr:
  872. X        if (items != 2)
  873. X            fatal("Usage: &waddstr($win, $str)");
  874. X        else {
  875. X            int retval;
  876. X            WINDOW*     win =           *(WINDOW**)     str_get(st[1]);
  877. X            char*       str =           (char*)         str_get(st[2]);
  878. X
  879. X            retval = waddstr(win, str);
  880. X            str_numset(st[0], (double) retval);
  881. X        }
  882. X        return sp;
  883. X
  884. XIt's also possible to have output parameters, indicated by O, and input/ouput
  885. Xparameters indicated by IO.
  886. X
  887. XThe mus program isn't perfect.  You'll note that curses.mus has some
  888. Xcases which are hand coded.  They'll be passed straight through unmodified.
  889. XYou can produce similar cases by analogy to what's in curses.c, as well
  890. Xas similar routines in the doarg.c, dolist.c and doio.c routines of Perl.
  891. XThe mus program is only intended to get you about 90% there.  It's not clear,
  892. Xfor instance, how a given structure should be passed to Perl.  But that
  893. Xshouldn't bother you--if you've gotten this far, it's already obvious
  894. Xthat you are totally mad.
  895. X
  896. XHere's an example of how to return an array value:
  897. X
  898. X    case US_appl_errlist:
  899. X    if (!wantarray) {
  900. X        str_numset(st[0], (double) appl_nerr);
  901. X        return sp;
  902. X    }
  903. X    astore(stack, sp + appl_nerr, Nullstr);        /* extend stack */
  904. X    st = stack->ary_array + sp;            /* possibly realloced */
  905. X    for (i = 0; i < appl_nerr; i++) {
  906. X        tmps = appl_errlist[i];
  907. X        st[i] = str_2mortal(str_make(tmps,strlen(tmps)));
  908. X    }
  909. X    return sp + appl_nerr - 1;
  910. X
  911. X
  912. XIn addition, there is a program, man2mus, that will scan a man page for
  913. Xfunction prototypes and attempt to construct a mus CASE entry for you.  It has
  914. Xto guess about input/output parameters, so you'll have to tidy up after it.
  915. XBut it can save you a lot of time if the man pages for a library are
  916. Xreasonably well formed.
  917. X
  918. XIf you happen to have BSD curses on your machine, you might try compiling
  919. Xa copy of curseperl.  The "pager" program in this directory is a rudimentary
  920. Xstart on writing a pager--don't believe the help message, which is stolen
  921. Xfrom the less program.
  922. X
  923. XThere is currently no official way to call a Perl routine back from C,
  924. Xbut we're working on it.  It might be easiest to fake up a call to do_eval()
  925. Xor do_subr().  This is not for the faint of heart.  If you come up with
  926. Xsuch a glue routine, I'll be glad to add it into the distribution.
  927. X
  928. XUser-defined subroutines may not currently be called as a signal handler,
  929. Xthough a signal handler may itself call a user-defined subroutine.
  930. !STUFFY!FUNK!
  931. echo Extracting h2pl/README
  932. sed >h2pl/README <<'!STUFFY!FUNK!' -e 's/X//'
  933. X[This file of Tom Christiansen's has been edited to change makelib to h2ph
  934. Xand .h to .ph where appropriate--law.]
  935. X
  936. XThis directory contains files to help you convert the *.ph files generated my
  937. Xh2ph out of the perl source directory into *.pl files with all the
  938. Xindirection of the subroutine calls removed.  The .ph version will be more
  939. Xsafely portable, because if something isn't defined on the new system, like
  940. X&TIOCGETP, then you'll get a fatal run-time error on the system lacking that
  941. Xfunction.  Using the .pl version means that the subsequent scripts will give
  942. Xyou a 0 $TIOCGETP and God only knows what may then happen.   Still, I like the
  943. X.pl stuff because they're faster to load.
  944. X
  945. XFIrst, you need to run h2ph on things like sys/ioctl.h to get stuff
  946. Xinto the perl library directory, often /usr/local/lib/perl.  For example,
  947. X    # h2ph sys/ioctl.h
  948. Xtakes /usr/include/sys/ioctl.h as input and writes (without i/o redirection)
  949. Xthe file /usr/local/lib/perl/sys/ioctl.ph, which looks like this
  950. X
  951. X    eval 'sub TIOCM_RTS {0004;}';
  952. X    eval 'sub TIOCM_ST {0010;}';
  953. X    eval 'sub TIOCM_SR {0020;}';
  954. X    eval 'sub TIOCM_CTS {0040;}';
  955. X    eval 'sub TIOCM_CAR {0100;}';
  956. X
  957. Xand much worse, rather than what Larry's ioctl.pl from the perl source dir has, 
  958. Xwhich is:
  959. X
  960. X    $TIOCM_RTS = 0004;
  961. X    $TIOCM_ST = 0010;
  962. X    $TIOCM_SR = 0020;
  963. X    $TIOCM_CTS = 0040;
  964. X    $TIOCM_CAR = 0100;
  965. X
  966. X[Workaround for fixed bug in makedir/h2ph deleted--law.]
  967. X
  968. XThe more complicated ioctl subs look like this:
  969. X
  970. X    eval 'sub TIOCGSIZE {&TIOCGWINSZ;}';
  971. X    eval 'sub TIOCGWINSZ {&_IOR("t", 104, \'struct winsize\');}';
  972. X    eval 'sub TIOCSETD {&_IOW("t", 1, \'int\');}';
  973. X    eval 'sub TIOCGETP {&_IOR("t", 8,\'struct sgttyb\');}';
  974. X
  975. XThe _IO[RW] routines use a %sizeof array, which (presumably) 
  976. Xis keyed on the type name with the value being the size in bytes.  
  977. X
  978. XTo build %sizeof, try running this in this directory:
  979. X
  980. X    % ./getioctlsizes 
  981. X
  982. XWhich will tell you which things the %sizeof array needs
  983. Xto hold.  You can try to build a sizeof.ph file with:
  984. X
  985. X    % ./getioctlsizes | ./mksizes > sizeof.ph
  986. X
  987. XNote that mksizes hardcodes the #include files for all the types, so it will
  988. Xprobably require customization.  Once you have sizeof.ph, install it in the
  989. Xperl library directory.  Run my tcbreak script to see whether you can do
  990. Xioctls in perl now.  You'll get some kind of fatal run-time error if you
  991. Xcan't.  That script should be included in this directory.
  992. X
  993. XIf this works well, now you can try to convert the *.ph files into
  994. X*.pl files.  Try this:
  995. X
  996. X    foreach file ( sysexits.ph sys/{errno.ph,ioctl.ph} )
  997. X    ./mkvars $file > t/$file:r.pl
  998. X    end
  999. X
  1000. XThe last one will be the hardest.  If it works, should be able to 
  1001. Xrun tcbreak2 and have it work the same as tcbreak.
  1002. X
  1003. XGood luck.
  1004. !STUFFY!FUNK!
  1005. echo Extracting README.xenix
  1006. sed >README.xenix <<'!STUFFY!FUNK!' -e 's/X//'
  1007. XFrom jpl-devvax!elroy.jpl.nasa.gov!sdd.hp.com!spool.mu.edu!uunet!mcsun!ukc!stl!robobar!ronald Thu Mar  7 09:51:06 PST 1991
  1008. XArticle 4564 of comp.lang.perl:
  1009. XPath: jpl-devvax!elroy.jpl.nasa.gov!sdd.hp.com!spool.mu.edu!uunet!mcsun!ukc!stl!robobar!ronald
  1010. X>From: ronald@robobar.co.uk (Ronald S H Khoo)
  1011. XNewsgroups: comp.lang.perl
  1012. XSubject: Re: directory entries chopped on SCO Unix
  1013. XMessage-ID: <1991Mar7.083046.14410@robobar.co.uk>
  1014. XDate: 7 Mar 91 08:30:46 GMT
  1015. XReferences: <18097@ogicse.ogi.edu> <DJM.91Mar5054514@egypt.eng.umd.edu> <498@stephsf.stephsf.com>
  1016. XOrganization: Robobar Ltd., Perivale, Middx., ENGLAND.
  1017. XLines: 38
  1018. XStatus: OR
  1019. X
  1020. Xwengland@stephsf.stephsf.com (Bill England) writes:
  1021. X
  1022. X>   Would modification of the config to 
  1023. X>   drop the Xenix specific test and also dropping the -lx library
  1024. X>   work better on Xenix boxes ?  Sorry I can't test Xenix here.
  1025. X
  1026. XThis is a difficult question to answer, mostly because it's hard to
  1027. Xtell exactly what kind of Xenix you have.
  1028. X
  1029. X    Early releases didn't have any kind of ndir  -- no problem
  1030. X
  1031. X    Many releases have only sys/ndir + -lx       -- no problem
  1032. X
  1033. X    SCO Xenix 2.3.[012] have ndir + dirent, but dirent is reputedly
  1034. X        broken on .0 and .1, hence the hack to undef it.
  1035. X
  1036. X    *However*, the kernel upgrade to 2.3.3 (where dirent apparently works)
  1037. X    from any lower 2.3.? is a free upgrade, which you can anon FTP or UUCP.
  1038. X
  1039. XI use dirent -- I had to make a decision which set of directory routines
  1040. Xto throw out (so that there would be no confusion), so I threw out the
  1041. Xold ones.  This means I have to manually remove the ! defined(M_XENIX)
  1042. Xhacks from the source which is very ugh.
  1043. X
  1044. XMy opinion is that the hacks should be removed seeing as they only apply
  1045. Xto a small number of operating system versions which you upgrade for
  1046. Xfree anyway.  Chip may disagree with me.  It all rather depends on your
  1047. Xparticular point of view.
  1048. X
  1049. XYou could hack Configure to do case "`uname -r`" in 2.3.[01])
  1050. XI guess.  It's a lot of code to handle just one specific case,
  1051. Xsince you have to determine whether to do it or not as well.
  1052. X
  1053. XIn short, I Really Don't Know But It's All Very Annoying.
  1054. X
  1055. XJust another Xenix user,
  1056. X-- 
  1057. XRonald Khoo <ronald@robobar.co.uk> +44 81 991 1142 (O) +44 71 229 7741 (H)
  1058. X
  1059. X
  1060. !STUFFY!FUNK!
  1061. echo Extracting README.uport
  1062. sed >README.uport <<'!STUFFY!FUNK!' -e 's/X//'
  1063. XFrom dwm@uf.msc.umn.edu  Tue Dec 19 15:03:27 1989
  1064. XSubject: perl on Microport Un*x 2.4
  1065. X
  1066. XHere are the steps to get perl patchlevel 6 running on Microport Un*x 2.4.
  1067. X
  1068. X(1) Get the directory routines (opendir, readdir, etc) from an archive 
  1069. X    somewhere.   I got mine from uunet:  comp.sources.unix/volume9/gwyn-dir-lib
  1070. X    and comp.sources.unix/volume10/dir-lib.pch.   Compile a large memory
  1071. X    version of the library and put it in /usr/lib/large/dir.a.  Also put
  1072. X    the dir.h include file in /usr/include/sys.  [ If you don't want to
  1073. X    do this make sure I_SYSDIR does not defined in config.sh ]
  1074. X
  1075. X(2) Configure causes sh to get a segmentation fault when it does the
  1076. X    ". config.sh" near line 2551.   You will have to remove that line 
  1077. X    from Configure and make sure you get your configuration info right 
  1078. X    the first time or start over if you make a mistake.  
  1079. X
  1080. X[Or just run the .SH files by hand and proceed to the make depend.]
  1081. X
  1082. X(3) If you are using C-shell, put a blank line at the start of Configure so it
  1083. X    wont get executed by the C-shell.   If you are using ksh, you will have to
  1084. X    execute Configure with 'sh Configure'.  Configure does not work with
  1085. X    ksh.
  1086. X
  1087. X(4) When you run Configure, select compilation option -DCRIPPLED_CC.
  1088. X    I also selected -DDEBUGGING to make debugging easier.  I recommend it.
  1089. X    You can use -O, but you will then have to compile consarg.c and util.c
  1090. X    separately without -O because the optimizer generates bad code for these
  1091. X    routines.   The optimizer also dies harmlessly while optimizing cmd.c,
  1092. X    eval.c (who can blame it? [sorry, Larry]), and toke.c.   
  1093. X    I am still trying to isolate the remaining optimization problems in 
  1094. X    consarg.c and util.c.
  1095. X
  1096. X[The rest of the previously published instructions are no longer necessary.]
  1097. !STUFFY!FUNK!
  1098. echo Extracting eg/README
  1099. sed >eg/README <<'!STUFFY!FUNK!' -e 's/X//'
  1100. XAlthough supplied with the perl package, the perl scripts in this eg
  1101. Xdirectory and its subdirectories are placed in the public domain, and
  1102. Xyou may do anything with them that you wish.
  1103. X
  1104. XThis stuff is supplied on an as-is basis--little attempt has been made to make
  1105. Xany of it portable.  It's mostly here to give you an idea of what perl code
  1106. Xlooks like, and what tricks and idioms are used.
  1107. X
  1108. XSystem administrators responsible for many computers will enjoy the items
  1109. Xdown in the g directory very much.  The scan directory contains the beginnings
  1110. Xof a system to check on and report various kinds of anomalies.
  1111. X
  1112. XIf you machine doesn't support #!, the first thing you'll want to do is
  1113. Xreplace the #! with a couple of lines that look like this:
  1114. X
  1115. X    eval "exec /usr/bin/perl -S $0 $*"
  1116. X        if $running_under_some_shell;
  1117. X
  1118. Xbeing sure to include any flags that were on the #! line.  A supplied script
  1119. Xcalled "nih" will translate perl scripts in place for you:
  1120. X
  1121. X    nih g/g??
  1122. !STUFFY!FUNK!
  1123. echo Extracting t/README
  1124. sed >t/README <<'!STUFFY!FUNK!' -e 's/X//'
  1125. XThis is the perl test library.  To run all the tests, just type 'TEST'.
  1126. X
  1127. XTo add new tests, just look at the current tests and do likewise.
  1128. X
  1129. XIf a test fails, run it by itself to see if it prints any informative
  1130. Xdiagnostics.  If not, modify the test to print informative diagnostics.
  1131. XIf you put out extra lines with a '#' character on the front, you don't
  1132. Xhave to worry about removing the extra print statements later since TEST
  1133. Xignores lines beginning with '#'.
  1134. X
  1135. XIf you come up with new tests, send them to lwall@netlabs.com.
  1136. !STUFFY!FUNK!
  1137. echo Extracting eg/sysvipc/README
  1138. sed >eg/sysvipc/README <<'!STUFFY!FUNK!' -e 's/X//'
  1139. XFYEnjoyment, here are the test scripts I used while implementing SysV
  1140. XIPC in Perl.  Each of them must be run with the parameter "s" for
  1141. X"send" or "r" for "receive"; in each case, the receiver is the server
  1142. Xand the sender is the client.
  1143. X
  1144. X-- 
  1145. XChip Salzenberg at ComDev/TCT     <chip@tct.uucp>, <uunet!ateng!tct!chip>
  1146. X
  1147. X
  1148. !STUFFY!FUNK!
  1149. echo Extracting t/op/study.t
  1150. sed >t/op/study.t <<'!STUFFY!FUNK!' -e 's/X//'
  1151. X#!./perl
  1152. X
  1153. X# $Header: study.t,v 4.0 91/03/20 01:54:59 lwall Locked $
  1154. X
  1155. Xprint "1..24\n";
  1156. X
  1157. X$x = "abc\ndef\n";
  1158. Xstudy($x);
  1159. X
  1160. Xif ($x =~ /^abc/) {print "ok 1\n";} else {print "not ok 1\n";}
  1161. Xif ($x !~ /^def/) {print "ok 2\n";} else {print "not ok 2\n";}
  1162. X
  1163. X$* = 1;
  1164. Xif ($x =~ /^def/) {print "ok 3\n";} else {print "not ok 3\n";}
  1165. X$* = 0;
  1166. X
  1167. X$_ = '123';
  1168. Xstudy;
  1169. Xif (/^([0-9][0-9]*)/) {print "ok 4\n";} else {print "not ok 4\n";}
  1170. X
  1171. Xif ($x =~ /^xxx/) {print "not ok 5\n";} else {print "ok 5\n";}
  1172. Xif ($x !~ /^abc/) {print "not ok 6\n";} else {print "ok 6\n";}
  1173. X
  1174. Xif ($x =~ /def/) {print "ok 7\n";} else {print "not ok 7\n";}
  1175. Xif ($x !~ /def/) {print "not ok 8\n";} else {print "ok 8\n";}
  1176. X
  1177. Xstudy($x);
  1178. Xif ($x !~ /.def/) {print "ok 9\n";} else {print "not ok 9\n";}
  1179. Xif ($x =~ /.def/) {print "not ok 10\n";} else {print "ok 10\n";}
  1180. X
  1181. Xif ($x =~ /\ndef/) {print "ok 11\n";} else {print "not ok 11\n";}
  1182. Xif ($x !~ /\ndef/) {print "not ok 12\n";} else {print "ok 12\n";}
  1183. X
  1184. X$_ = 'aaabbbccc';
  1185. Xstudy;
  1186. Xif (/(a*b*)(c*)/ && $1 eq 'aaabbb' && $2 eq 'ccc') {
  1187. X    print "ok 13\n";
  1188. X} else {
  1189. X    print "not ok 13\n";
  1190. X}
  1191. Xif (/(a+b+c+)/ && $1 eq 'aaabbbccc') {
  1192. X    print "ok 14\n";
  1193. X} else {
  1194. X    print "not ok 14\n";
  1195. X}
  1196. X
  1197. Xif (/a+b?c+/) {print "not ok 15\n";} else {print "ok 15\n";}
  1198. X
  1199. X$_ = 'aaabccc';
  1200. Xstudy;
  1201. Xif (/a+b?c+/) {print "ok 16\n";} else {print "not ok 16\n";}
  1202. Xif (/a*b+c*/) {print "ok 17\n";} else {print "not ok 17\n";}
  1203. X
  1204. X$_ = 'aaaccc';
  1205. Xstudy;
  1206. Xif (/a*b?c*/) {print "ok 18\n";} else {print "not ok 18\n";}
  1207. Xif (/a*b+c*/) {print "not ok 19\n";} else {print "ok 19\n";}
  1208. X
  1209. X$_ = 'abcdef';
  1210. Xstudy;
  1211. Xif (/bcd|xyz/) {print "ok 20\n";} else {print "not ok 20\n";}
  1212. Xif (/xyz|bcd/) {print "ok 21\n";} else {print "not ok 21\n";}
  1213. X
  1214. Xif (m|bc/*d|) {print "ok 22\n";} else {print "not ok 22\n";}
  1215. X
  1216. Xif (/^$_$/) {print "ok 23\n";} else {print "not ok 23\n";}
  1217. X
  1218. X$* = 1;        # test 3 only tested the optimized version--this one is for real
  1219. Xif ("ab\ncd\n" =~ /^cd/) {print "ok 24\n";} else {print "not ok 24\n";}
  1220. !STUFFY!FUNK!
  1221. echo " "
  1222. echo "End of kit 1 (of 36)"
  1223. cat /dev/null >kit1isdone
  1224. run=''
  1225. config=''
  1226. 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
  1227.     if test -f kit${iskit}isdone; then
  1228.     run="$run $iskit"
  1229.     else
  1230.     todo="$todo $iskit"
  1231.     fi
  1232. done
  1233. case $todo in
  1234.     '')
  1235.     echo "You have run all your kits.  Please read README and then type Configure."
  1236.     for combo in *:AA; do
  1237.         if test -f "$combo"; then
  1238.         realfile=`basename $combo :AA`
  1239.         cat $realfile:[A-Z][A-Z] >$realfile
  1240.         rm -rf $realfile:[A-Z][A-Z]
  1241.         fi
  1242.     done
  1243.     rm -rf kit*isdone
  1244.     chmod 755 Configure
  1245.     ;;
  1246.     *)  echo "You have run$run."
  1247.     echo "You still need to run$todo."
  1248.     ;;
  1249. esac
  1250. : Someone might mail this, so...
  1251. exit
  1252.  
  1253. exit 0 # Just in case...
  1254. -- 
  1255. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1256. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1257. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1258. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1259.