mats@enea.se (Mats Josefsson) (06/13/91)
A few weeks ago I asked if anyone had managed to get the expect program (and thus also the tcl library) up on a HP9000/800 series machine running HP-UX 7.0 (we're running 7.02). Thanks to mcorrigan@ucsd.edu and nick@pluto.bis.com I managed to get tcl to work correctly. I also got expect to (almost) work. The only problem I have encountered is running programs that fiddles with the pty. For instance the passwd and ftp example programs don't work. I have used it extensively with telnet with no problems at all. I got the latest version of tcl from ucbvax.berkeley.edu and expect from durer.cme.nist.gov. mcorrigan also mentioned some patches to tcl at ucbvax, but I didn't find any. To compile expect I used the following defs in the Makefile: PTY_TYPE= usg INTERACT_TYPE= select CFLAGS= -DHPUX -DSYV3 Below are context diffs for the things I had to change to get tcl running. With these changes it passes all the tests in the distribution. ---- CONTEXT DIFFS FOR TCL ---- RCS file: RCS/Makefile,v retrieving revision 1.1 rdiff -c -r1.1 Makefile *** /tmp/,RCSt1a17951 Thu Jun 6 08:40:39 1991 --- Makefile Tue Jun 4 11:20:50 1991 *************** *** 4,11 # For HP-UX systems, use the second, commented-out, form of LIBS below. # ! LIBS = ! #LIBS = -lBSD CFLAGS = -g -I. -DTCL_VERSION=\"3.3\" --- 4,11 ----- # For HP-UX systems, use the second, commented-out, form of LIBS below. # ! #LIBS = ! LIBS = -lBSD CFLAGS = -g -I. -DTCL_VERSION=\"3.3\" *************** *** 12,19 OBJS = tclAssem.o tclBasic.o tclCmdAH.o tclCmdIZ.o tclExpr.o \ tclGlob.o tclHistory.o tclProc.o tclUtil.o ! LIBOBJS = panic.o strerror.o strtol.o strtoul.o strspn.o \ ! strpbrk.o strchr.o strstr.o CSRCS = tclAssem.c tclBasic.c tclCmdAH.c tclCmdIZ.c tclExpr.c \ tclGlob.c tclHistory.c tclProc.c tclUtil.c --- 12,18 ----- OBJS = tclAssem.o tclBasic.o tclCmdAH.o tclCmdIZ.o tclExpr.o \ tclGlob.o tclHistory.o tclProc.o tclUtil.o ! LIBOBJS = panic.o strtoul.o CSRCS = tclAssem.c tclBasic.c tclCmdAH.c tclCmdIZ.c tclExpr.c \ tclGlob.c tclHistory.c tclProc.c tclUtil.c =================================================================== RCS file: RCS/tclCmdAH.c,v retrieving revision 1.1 rdiff -c -r1.1 tclCmdAH.c *** /tmp/,RCSt1a17951 Thu Jun 6 08:40:40 1991 --- tclCmdAH.c Fri May 17 08:58:19 1991 *************** *** 425,431 int pid = -1; /* -1 means child process doesn't * exist (yet). Non-zero gives its * id (0 only in child). */ ! union wait status; char *cmdName, *execName; /* --- 425,431 ----- int pid = -1; /* -1 means child process doesn't * exist (yet). Non-zero gives its * id (0 only in child). */ ! int status; char *cmdName, *execName; /* *************** *** 633,639 sprintf(interp->result, "command terminated abnormally"); result = TCL_ERROR; } ! result = status.w_retcode; } if (stdIn[0] != -1) { close(stdIn[0]); --- 633,639 ----- sprintf(interp->result, "command terminated abnormally"); result = TCL_ERROR; } ! result = WEXITSTATUS(status); } if (stdIn[0] != -1) { close(stdIn[0]); =================================================================== RCS file: RCS/tclGlob.c,v retrieving revision 1.1 rdiff -c -r1.1 tclGlob.c *** /tmp/,RCSt1a17951 Thu Jun 6 08:40:41 1991 --- tclGlob.c Thu Jun 6 08:39:29 1991 *************** *** 248,253 /* * If there were any pattern-matching characters, then scan through * the directory to find all the matching names. */ if (gotSpecial) { --- 248,258 ----- /* * If there were any pattern-matching characters, then scan through * the directory to find all the matching names. + * + * In HPUX 7.0, stat(2) and readdir(3) do not work with an empty + * string, i.e. stat(""). The fix is to be explicit. + * + * - Nick Bender 7-20-90 */ if (gotSpecial) { *************** *** 257,262 char *pattern, *newDir; char static1[STATIC_SIZE], static2[STATIC_SIZE]; struct stat statBuf; if ((stat(dir, &statBuf) != 0) || ((statBuf.st_mode & S_IFMT) != S_IFDIR)) { --- 262,268 ----- char *pattern, *newDir; char static1[STATIC_SIZE], static2[STATIC_SIZE]; struct stat statBuf; + char *explicitDir = (*dir ? dir: "."); if ((stat(explicitDir, &statBuf) != 0) || ((statBuf.st_mode & S_IFMT) != S_IFDIR)) { *************** *** 258,264 char static1[STATIC_SIZE], static2[STATIC_SIZE]; struct stat statBuf; ! if ((stat(dir, &statBuf) != 0) || ((statBuf.st_mode & S_IFMT) != S_IFDIR)) { return TCL_OK; } --- 264,270 ----- struct stat statBuf; char *explicitDir = (*dir ? dir: "."); ! if ((stat(explicitDir, &statBuf) != 0) || ((statBuf.st_mode & S_IFMT) != S_IFDIR)) { return TCL_OK; } *************** *** 262,268 || ((statBuf.st_mode & S_IFMT) != S_IFDIR)) { return TCL_OK; } ! d = opendir(dir); if (d == NULL) { sprintf(interp->result, "couldn't read directory \"%.50s\": %.50s", --- 268,274 ----- || ((statBuf.st_mode & S_IFMT) != S_IFDIR)) { return TCL_OK; } ! d = opendir(explicitDir); if (d == NULL) { sprintf(interp->result, "couldn't read directory \"%.50s\": %.50s", =================================================================== RCS file: RCS/tclHistory.c,v retrieving revision 1.1 rdiff -c -r1.1 tclHistory.c *** /tmp/,RCSt1a17951 Thu Jun 6 08:40:41 1991 --- tclHistory.c Tue Jun 4 11:17:52 1991 *************** *** 780,786 size += revPtr->newSize; } ! newCommand = malloc(size); p = newCommand; bytesSeen = 0; for (revPtr = iPtr->revPtr; revPtr != NULL; revPtr = revPtr->nextPtr) { --- 780,786 ----- size += revPtr->newSize; } ! newCommand = malloc(size + 1); p = newCommand; bytesSeen = 0; for (revPtr = iPtr->revPtr; revPtr != NULL; revPtr = revPtr->nextPtr) { =================================================================== -- Mats Josefsson (mats@enea.se)