Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perl 5.005_3 patch: Transit OS port #215

Closed
p5pRT opened this issue Jul 20, 1999 · 1 comment
Closed

Perl 5.005_3 patch: Transit OS port #215

p5pRT opened this issue Jul 20, 1999 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Jul 20, 1999

Migrated from rt.perl.org#1021 (status was 'resolved')

Searchable as RT1021$

@p5pRT
Copy link
Author

p5pRT commented Jul 20, 1999

From seans@ncube.com

Inline Patch
--- ./perl.h	Sat Mar 27 23:57:16 1999
+++ /vobs/ncube3/web/perl5.005_03/perl.h	Fri Jun  4 10:43:50 1999
@@ -1110,7 +1110,7 @@
 #   include "vmsish.h"
 # else
 #   if defined(PLAN9)
-#     include "./plan9/plan9ish.h"
+#     include "plan9ish.h"
 #   else
 #     if defined(MPE)
 #       include "mpeix/mpeixish.h"
--- ./pp_hot.c	Sat Mar 27 16:12:49 1999
+++ /vobs/ncube3/web/perl5.005_03/pp_hot.c	Fri Jun  4 10:36:52 1999
@@ -1198,11 +1198,16 @@
 #else
 		sv_setpv(tmpcmd, "echo ");
 		sv_catsv(tmpcmd, tmpglob);
+#ifdef PLAN9
+		sv_catpv(tmpcmd,
+			 "|tr -s '\040\011\013\015' '\012\012\012\012'|");
+#else
 #if 'z' - 'a' == 25
 		sv_catpv(tmpcmd, "|tr -s ' \t\f\r' '\\012\\012\\012\\012'|");
 #else
 		sv_catpv(tmpcmd, "|tr -s ' \t\f\r' '\\n\\n\\n\\n'|");
 #endif
+#endif /* !PLAN9 */
 #endif /* !CSH */
 #endif /* !DOSISH */
 		(void)do_open(PL_last_in_gv, SvPVX(tmpcmd), SvCUR(tmpcmd),
--- ./pp_sys.c	Sat Mar 27 09:56:16 1999
+++ /vobs/ncube3/web/perl5.005_03/pp_sys.c	Fri Jun  4 10:43:15 1999
@@ -2683,7 +2683,11 @@
     else
 	tmps = POPpx;
     if (!tmps || !*tmps) {
+#ifdef PLAN9
+	svp = hv_fetch(GvHVn(PL_envgv), "home", 4, FALSE);
+#else
 	svp = hv_fetch(GvHVn(PL_envgv), "HOME", 4, FALSE);
+#endif
 	if (svp)
 	    tmps = SvPV(*svp, n_a);
     }
--- ./t/io/fs.t	Thu Jan 28 17:15:20 1999
+++ /vobs/ncube3/web/perl5.005_03/t/io/fs.t	Fri Jun  4 10:53:09 1999
@@ -24,18 +24,20 @@
 
 umask(022);
 
-if ($^O eq 'MSWin32') { print "ok 1 # skipped: bogus umask()\n"; }
-elsif ((umask(0)&0777) == 022) {print "ok 1\n";} else {print "not ok 1\n";}
+if ($^O eq 'MSWin32' or $^O eq 'transit')
+    { print "ok 1 # skipped: bogus umask()\n"; }
+elsif ((umask(0)&0777) == 022)
+    {print "ok 1\n";} else {print "not ok 1\n";}
 open(fh,'>x') || die "Can't create x";
 close(fh);
 open(fh,'>a') || die "Can't create a";
 close(fh);
 
-if ($Is_Dosish) {print "ok 2 # skipped: no link\n";} 
+if ($Is_Dosish or $^O eq 'transit') {print "ok 2 # skipped: no link\n";} 
 elsif (eval {link('a','b')}) {print "ok 2\n";} 
 else {print "not ok 2\n";}
 
-if ($Is_Dosish) {print "ok 3 # skipped: no link\n";} 
+if ($Is_Dosish or $^O eq 'transit') {print "ok 3 # skipped: no link\n";} 
 elsif (eval {link('b','c')}) {print "ok 3\n";} 
 else {print "not ok 3\n";}
 
@@ -48,7 +50,7 @@
     {print "ok 4\n";} 
 else {print "not ok 4\n";}
 
-if ($^O eq 'amigaos' || $Is_Dosish)
+if ($^O eq 'amigaos' or $Is_Dosish or $^O eq 'transit')
     {print "ok 5 # skipped: no link\n";} 
 elsif (($mode & 0777) == 0666)
     {print "ok 5\n";} 
@@ -58,29 +60,32 @@
 
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
     $blksize,$blocks) = stat('c');
-if ($Is_Dosish) {print "ok 7 # skipped: no link\n";} 
+if ($Is_Dosish or $^O eq 'transit') {print "ok 7 # skipped: no link\n";} 
 elsif (($mode & 0777) == 0777) {print "ok 7\n";} 
 else {print "not ok 7\n";}
 
-if ($Is_Dosish) {print "ok 8 # skipped: no link\n";} 
+if ($Is_Dosish or $^O eq 'transit') {print "ok 8 # skipped: no link\n";} 
 elsif ((chmod 0700,'c','x') == 2) {print "ok 8\n";} 
 else {print "not ok 8\n";}
 
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
     $blksize,$blocks) = stat('c');
-if ($Is_Dosish) {print "ok 9 # skipped: no link\n";} 
+if ($Is_Dosish or $^O eq 'transit') {print "ok 9 # skipped: no link\n";} 
 elsif (($mode & 0777) == 0700) {print "ok 9\n";} 
 else {print "not ok 9\n";}
 
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
     $blksize,$blocks) = stat('x');
-if ($Is_Dosish) {print "ok 10 # skipped: no link\n";} 
+if ($Is_Dosish or $^O eq 'transit') {print "ok 10 # skipped: no link\n";} 
 elsif (($mode & 0777) == 0700) {print "ok 10\n";} 
 else {print "not ok 10\n";}
 
-if ($Is_Dosish) {print "ok 11 # skipped: no link\n"; unlink 'b','x'; } 
-elsif ((unlink 'b','x') == 2) {print "ok 11\n";} 
-else {print "not ok 11\n";}
+if ($Is_Dosish or $^O eq 'transit')
+    {print "ok 11 # skipped: no link\n"; unlink 'b','x'; } 
+elsif ((unlink 'b','x') == 2)
+    {print "ok 11\n";} 
+else
+    {print "not ok 11\n";}
 ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
     $blksize,$blocks) = stat('b');
 if ($ino == 0) {print "ok 12\n";} else {print "not ok 12\n";}
@@ -99,7 +104,8 @@
     $blksize,$blocks) = stat('b');
 if ($^O eq 'MSWin32') { print "ok 17 # skipped: bogus (stat)[1]\n"; }
 elsif ($ino) {print "ok 17\n";} else {print "not ok 17\n";}
-if ($wd =~ m#/afs/# || $^O eq 'amigaos' || $^O eq 'dos' || $^O eq 'MSWin32')
+if ($wd =~ m#/afs/# or $^O eq 'amigaos' or $^O eq 'dos' or $^O eq 'MSWin32' or
+    $^O eq 'transit')
     {print "ok 18 # skipped: granularity of the filetime\n";}
 elsif ($atime == 500000000 && $mtime == 500000000 + $delta)
     {print "ok 18\n";}
--- ./t/lib/anydbm.t	Wed Jul 29 18:50:53 1998
+++ /vobs/ncube3/web/perl5.005_03/t/lib/anydbm.t	Mon Jun  7 11:02:07 1999
@@ -6,7 +6,10 @@
     chdir 't' if -d 't';
     @INC = '../lib';
 }
-require AnyDBM_File;
+if (!eval 'require AnyDBM_File') {
+    print "1..0\n";
+    exit;
+}
 #If Fcntl is not available, try 0x202 or 0x102 for O_RDWR|O_CREAT
 use Fcntl;
 
--- ./t/op/stat.t	Tue Aug  4 20:01:57 1998
+++ /vobs/ncube3/web/perl5.005_03/t/op/stat.t	Fri Jun  4 08:34:08 1999
@@ -14,6 +14,7 @@
 $Is_MSWin32 = $^O eq 'MSWin32';
 $Is_Dos = $^O eq 'dos';
 $Is_Dosish = $Is_Dos || $^O eq 'os2' || $Is_MSWin32;
+$Is_Transit = $^O  eq 'transit';
 chop($cwd = ($Is_MSWin32 ? `cd` : `pwd`));
 
 $DEV = `ls -l /dev` unless $Is_Dosish;
@@ -35,7 +36,7 @@
 
 sleep 2;
 
-if ($Is_Dosish) { unlink "Op.stat.tmp2" }
+if ($Is_Dosish or $Is_Transit) { unlink "Op.stat.tmp2" }
 else {
     `rm -f Op.stat.tmp2;ln Op.stat.tmp Op.stat.tmp2; chmod 644 Op.stat.tmp`;
 }
@@ -49,7 +50,7 @@
     {print "ok 3\n";} 
 else {print "# \$nlink is |$nlink|\nnot ok 3\n";}
 
-if (   $Is_Dosish
+if (   $Is_Dosish || $Is_Transit
 	|| ($cwd =~ m#^/tmp# and $mtime && $mtime==$ctime) # Solaris tmpfs bug
 	|| $cwd =~ m#/afs/#
 	|| $^O eq 'amigaos') {
@@ -149,7 +150,7 @@
     {print "not ok 33\n";}
 if (! -b '.') {print "ok 34\n";} else {print "not ok 34\n";}
 
-if ($^O eq 'amigaos' or $Is_Dosish) {
+if ($^O eq 'amigaos' or $Is_Dosish or $Is_Transit) {
   print "ok 35 # skipped: no -u\n"; goto tty_test;
 }
 
@@ -184,8 +185,14 @@
 	print "ok 37\n";
     }
     else {
-	unless (open(tty,"/dev/tty")) {
-	    print STDERR "Can't open /dev/tty--run t/TEST outside of make.\n";
+	if ($Is_Transit) {
+	   $tty = '/dev/cons';
+	}
+	else {
+	   $tty = '/dev/tty';
+	}
+	unless (open(tty,$tty)) {
+	    print STDERR "Can't open $tty--run t/TEST outside of make.\n";
 	}
 	if (-t tty) {print "ok 36\n";} else {print "not ok 36\n";}
 	if (-c tty) {print "ok 37\n";} else {print "not ok 37\n";}
--- ./toke.c	Sat Mar 27 23:57:23 1999
+++ /vobs/ncube3/web/perl5.005_03/toke.c	Fri Jun  4 10:38:00 1999
@@ -1927,10 +1927,31 @@
 		     * which makes $^X incorrect.  And Digital UNIX and Linux,
 		     * at least, set argv[0] to the basename of the Perl
 		     * interpreter. So, having found "#!", we'll set it right.
+		     *
+		     * In Plan 9, the script name found by the interpreter will
+		     * include extra leading directory information, so only
+		     * match the file name portion.
 		     */
 		    SV *x = GvSV(gv_fetchpv("\030", TRUE, SVt_PV));
+#ifdef PLAN9
+		    char *pv1, *pv2;
+		    STRLEN len, len2;
+		    STRLEN skip = 0;
+#endif
+
 		    assert(SvPOK(x) || SvGMAGICAL(x));
+
+#ifdef PLAN9
+		    pv1 = SvPV(x, len);
+		    pv2 = SvPV(GvSV(PL_curcop->cop_filegv), len2);
+		    if (len > len2)
+			len = len2;
+		    else if (len < len2)
+			skip = len2 - len;
+		    if (memEQ(pv1, &pv2[skip], len)) {
+#else
 		    if (sv_eq(x, GvSV(PL_curcop->cop_filegv))) {
+#endif
 			sv_setpvn(x, ipath, ipathend - ipath);
 			SvSETMAGIC(x);
 		    }
--- transit/cpp	Tue Jul 20 10:11:02 1999
+++ /vobs/ncube3/web/perl5.005_03/transit/cpp	Fri Jun  4 10:48:38 1999
@@ -0,0 +1,2 @@
+#!/bin/sh
+cat >.$$.c; 4c -E ${1+"$@"} .$$.c; rm .$$.c
--- transit/plan9ish.h	Tue Jul 20 10:11:02 1999
+++ /vobs/ncube3/web/perl5.005_03/transit/plan9ish.h	Fri Jun  4 10:48:41 1999
@@ -0,0 +1,136 @@
+#ifndef __PLAN9ISH_H__
+#define __PLAN9ISH_H__
+
+/*
+ * The following symbols are defined if your operating system supports
+ * functions by that name.  All Unixes I know of support them, thus they
+ * are not checked by the configuration script, but are directly defined
+ * here.
+ */
+
+/* HAS_IOCTL:
+ *	This symbol, if defined, indicates that the ioctl() routine is
+ *	available to set I/O characteristics
+ */
+#define	HAS_IOCTL		/**/
+ 
+/* HAS_UTIME:
+ *	This symbol, if defined, indicates that the routine utime() is
+ *	available to update the access and modification times of files.
+ */
+#define HAS_UTIME		/**/
+
+/* HAS_GROUP
+ *	This symbol, if defined, indicates that the getgrnam() and
+ *	getgrgid() routines are available to get group entries.
+ *	The getgrent() has a separate definition, HAS_GETGRENT.
+ */
+/*#define HAS_GROUP		/**/
+
+/* HAS_PASSWD
+ *	This symbol, if defined, indicates that the getpwnam() and
+ *	getpwuid() routines are available to get password entries.
+ *	The getpwent() has a separate definition, HAS_GETPWENT.
+ */
+/*#define HAS_PASSWD		/**/
+
+#define HAS_KILL
+#define HAS_WAIT
+  
+/* UNLINK_ALL_VERSIONS:
+ *	This symbol, if defined, indicates that the program should arrange
+ *	to remove all versions of a file if unlink() is called.  This is
+ *	probably only relevant for VMS.
+ */
+/* #define UNLINK_ALL_VERSIONS		/**/
+
+/* PLAN9:
+ *	This symbol, if defined, indicates that the program is running under
+ *	Plan 9.  
+ */
+#ifndef PLAN9
+#define PLAN9		/**/
+#endif
+
+/* USEMYBINMODE
+ *	This symbol, if defined, indicates that the program should
+ *	use the routine my_binmode(FILE *fp, char iotype) to insure
+ *	that a file is in "binary" mode -- that is, that no translation
+ *	of bytes occurs on read or write operations.
+ */
+#undef USEMYBINMODE
+
+/* Stat_t:
+ *	This symbol holds the type used to declare buffers for information
+ *	returned by stat().  It's usually just struct stat.  It may be necessary
+ *	to include <sys/stat.h> and <sys/types.h> to get any typedef'ed
+ *	information.
+ */
+#define Stat_t struct stat
+
+/* USE_STAT_RDEV:
+*	This symbol is defined if this system has a stat structure declaring
+*	st_rdev
+*/
+#undef USE_STAT_RDEV		/**/
+
+/* ACME_MESS:
+ *	This symbol, if defined, indicates that error messages should be 
+ *	should be generated in a format that allows the use of the Acme
+ *	GUI/editor's autofind feature.
+ */
+#define ACME_MESS	/**/
+
+/* ALTERNATE_SHEBANG:
+ *	This symbol, if defined, contains a "magic" string which may be used
+ *	as the first line of a Perl program designed to be executed directly
+ *	by name, instead of the standard Unix #!.  If ALTERNATE_SHEBANG
+ *	begins with a character other then #, then Perl will only treat
+ *	it as a command line if if finds the string "perl" in the first
+ *	word; otherwise it's treated as the first line of code in the script.
+ *	(IOW, Perl won't hand off to another interpreter via an alternate
+ *	shebang sequence that might be legal Perl code.)
+ */
+/* #define ALTERNATE_SHEBANG "#!" / **/
+
+#if !defined(NSIG) || defined(M_UNIX) || defined(M_XENIX)
+# include <signal.h>
+#endif
+
+#ifndef SIGABRT
+#    define SIGABRT SIGILL
+#endif
+#ifndef SIGILL
+#    define SIGILL 6         /* blech */
+#endif
+#define ABORT() kill(getpid(),SIGABRT);
+
+#define BIT_BUCKET "/dev/null"
+#define PERL_SYS_INIT(c,v)	MALLOC_INIT
+#define dXSUB_SYS
+#define PERL_SYS_TERM()		MALLOC_TERM
+
+/*
+ * fwrite1() should be a routine with the same calling sequence as fwrite(),
+ * but which outputs all of the bytes requested as a single stream (unlike
+ * fwrite() itself, which on some systems outputs several distinct records
+ * if the number_of_items parameter is >1).
+ */
+#define fwrite1 fwrite
+
+#define Stat(fname,bufptr) stat((fname),(bufptr))
+#define Fstat(fd,bufptr)   fstat((fd),(bufptr))
+#define Fflush(fp)         fflush(fp)
+#define Mkdir(path,mode)   mkdir((path),(mode))
+
+/* For use by POSIX.xs */
+extern int tcsendbreak(int, int);
+
+/* For Transit, force use of the Bourne shell */
+#undef SH_PATH
+#define SH_PATH "/bin/ape/sh"
+
+/* exec uses the script name as argv[0] */
+#define ARG_ZERO_IS_SCRIPT
+
+#endif /* __PLAN9ISH_H__ */
--- transit/setup.sh	Tue Jul 20 10:11:02 1999
+++ /vobs/ncube3/web/perl5.005_03/transit/setup.sh	Fri Jun  4 10:48:43 1999
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# This is a sh shell script which builds directories, and puts files where they
+# belong.  To use, just run it from within the transit subdirectory with the
+# appropriate permissions.
+
+if [ $# -ne 0 ] ; then
+	echo 'Usage: setup.sh' 1>&2
+	exit 1
+fi
+
+# Populate source directory
+cp -f config.sh cpp transit.c plan9ish.h ..
+cp -f test_setup.rc ../t
+
+# Configure
+cd ..
+./Configure -S
--- transit/test_setup.rc	Tue Jul 20 10:11:02 1999
+++ /vobs/ncube3/web/perl5.005_03/transit/test_setup.rc	Mon Jun  7 10:24:46 1999
@@ -0,0 +1,21 @@
+#!/bin/rc
+
+if (! test -f /bin/sh) {
+    bind -a /$objtype/bin/ape /bin
+}
+if (! test -f /bin/true) {
+    bind -a /rc/bin/ape /bin
+}
+
+bind -ac /pkg/perl/bin/n4 .
+bind -a /pkg/perl/lib ../lib
+bind -a /pkg/perl/lib/$objtype/* ../lib
+bind -a /pkg/perl/lib/$objtype/*/auto ../lib/auto
+
+rm -f ../Configure
+cp README ../Configure
+
+chmod a+rwx $home/tmp
+
+# echo Manually set PATH to .:/bin
+echo -n .:/bin >/env/PATH
--- transit/transit.c	Tue Jul 20 10:11:02 1999
+++ /vobs/ncube3/web/perl5.005_03/transit/transit.c	Fri Jun  4 10:48:46 1999
@@ -0,0 +1,16 @@
+#include "EXTERN.h"
+#include "perl.h"
+
+struct netent *
+getnetbyaddr(long a, int b)
+{
+    croak("Function \"getnetbyaddr\" not implemented in this version of perl.");
+    return (struct netent *)NULL;
+}
+
+int
+tcdrain(int a)
+{
+    croak("Function \"tcdrain\" not implemented in this version of perl.");
+    return 0;
+}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant