home *** CD-ROM | disk | FTP | other *** search
- *** ../patch/common.h Thu May 24 14:21:46 1990
- --- common.h Thu May 31 10:28:21 1990
- ***************
- *** 1,6 ****
- ! /* $Header: common.h,v 2.0.1.2 88/06/22 20:44:53 lwall Locked $
- *
- * $Log: common.h,v $
- * Revision 2.0.1.2 88/06/22 20:44:53 lwall
- * patch12: sprintf was declared wrong
- *
- --- 1,9 ----
- ! /* $Header: common.h,v 2.0.1.3 90/05/30 11:30:00 mward $
- *
- * $Log: common.h,v $
- + * Revision 2.0.1.3 90/05/30 11:30:00 mward
- + * added TURBOC stuff
- + *
- * Revision 2.0.1.2 88/06/22 20:44:53 lwall
- * patch12: sprintf was declared wrong
- *
- ***************
- *** 40,51 ****
- --- 43,68 ----
- #include <ctype.h>
- #include <signal.h>
-
- + #ifdef TURBOC20
- + #include <stdlib.h>
- + #include <string.h>
- + #include <io.h>
- + #include <fcntl.h>
- + #endif
- +
- /* constants */
-
- #define TRUE (1)
- #define FALSE (0)
-
- + #ifdef TURBOC20
- + #define MAXPATH 80 /* max path spec size */
- + #define MAXMEMBLK 65534L /* biggest block of mem */
- + #define MAXHUNKSIZE (MAXMEMBLK/sizeof(char *)) /* is this enough lines? */
- + #else
- #define MAXHUNKSIZE 100000 /* is this enough lines? */
- + #endif
- +
- #define INITHUNKMAX 125 /* initial dynamic allocation size */
- #define MAXLINELEN 1024
- #define BUFFERSIZE 1024
- ***************
- *** 145,150 ****
- --- 162,168 ----
-
- EXT char *revision INIT(Nullch); /* prerequisite revision, if any */
-
- + #ifndef TURBOC20
- char *malloc();
- char *realloc();
- char *strcpy();
- ***************
- *** 156,159 ****
- --- 174,178 ----
- char *sprintf();
- #else
- int sprintf();
- + #endif
- #endif
- *** ../patch/config.h Thu May 24 14:21:52 1990
- --- config.h Thu May 31 10:36:24 1990
- ***************
- *** 1,25 ****
- /* config.h
- ! * This file was produced by running the Configure script.
- * Feel free to modify any of this as the need arises.
- */
-
-
- ! #/*undef EUNICE /* no file linking? */
- ! #/*undef VMS
-
- ! #/*undef index strchr /* cultural */
- ! #/*undef rindex strrchr /* differences? */
-
- - #/*undef void int /* is void to be avoided? */
- -
- /* How many register declarations are paid attention to? */
-
- #define Reg1 register
- #define Reg2 register
- #define Reg3 register
- ! #define Reg4 register
- ! #define Reg5 register
- ! #define Reg6 register
- #define Reg7
- #define Reg8
- #define Reg9
- --- 1,36 ----
- + /* $Header: cofig.h,v 2.0.1 90/05/30 11:30:00 mward $
- + *
- + * $Log: config.h,v $
- + * Revision 2.0.1 90/05/30 11:30:00 mward
- + * set up for MSDOS TURBOC v2.0
- + */
- +
- /* config.h
- ! * This file was produced by hand for MSDOS TURBOC V2.0.
- * Feel free to modify any of this as the need arises.
- */
-
-
- ! #undef EUNICE /* no file linking? */
- ! #undef VMS
- ! #undef CHARSPRINTF /* sprintf does NOT return pointer to char */
- ! #undef FLEXFILENAMES /* file names must be 14 chars or less */
-
- ! #ifdef TURBOC20
- ! #define index strchr /* cultural */
- ! #define rindex strrchr /* differences? */
- ! #define VOIDSIG /* signal returns ptr to function returning void*/
- ! #define VOIDFLAGS 7 /* full void support */
- ! #endif
-
- /* How many register declarations are paid attention to? */
-
- #define Reg1 register
- #define Reg2 register
- #define Reg3 register
- ! #define Reg4
- ! #define Reg5
- ! #define Reg6
- #define Reg7
- #define Reg8
- #define Reg9
- *** ../patch/inp.c Thu May 24 14:21:46 1990
- --- inp.c Thu May 31 10:37:49 1990
- ***************
- *** 1,6 ****
- ! /* $Header: inp.c,v 2.0.1.1 88/06/03 15:06:13 lwall Locked $
- *
- * $Log: inp.c,v $
- * Revision 2.0.1.1 88/06/03 15:06:13 lwall
- * patch10: made a little smarter about sccs files
- *
- --- 1,12 ----
- ! /* $Header: inp.c,v 2.0.1.2 90/05/30 11:30:00 mward $
- *
- * $Log: inp.c,v $
- + * Revision 2.0.1.2 90/05/30 11:30:00 mward
- + * if TURBOC20 have plan_a check against MAXMEMBLK before mallocs
- + * if TURBOC20 have plan_b use binary mode io for tmp file
- + * modified plan_a to allow for translation shrinkage on text reads
- + * modify calls to read, write to detect error on return value of -1
- + *
- * Revision 2.0.1.1 88/06/03 15:06:13 lwall
- * patch10: made a little smarter about sccs files
- *
- ***************
- *** 120,128 ****
- out_of_mem = FALSE;
- return FALSE; /* force plan b because plan a bombed */
- }
- - #ifdef lint
- i_womp = Nullch;
- ! #else
- i_womp = malloc((MEM)(i_size+2)); /* lint says this may alloc less than */
- /* i_size, but that's okay, I think. */
- #endif
- --- 126,136 ----
- out_of_mem = FALSE;
- return FALSE; /* force plan b because plan a bombed */
- }
- i_womp = Nullch;
- ! #ifndef lint
- ! #ifdef TURBOC20
- ! if (i_size < MAXMEMBLK)
- ! #endif
- i_womp = malloc((MEM)(i_size+2)); /* lint says this may alloc less than */
- /* i_size, but that's okay, I think. */
- #endif
- ***************
- *** 131,137 ****
- if ((ifd = open(filename, 0)) < 0)
- fatal2("Can't open file %s\n", filename);
- #ifndef lint
- ! if (read(ifd, i_womp, (int)i_size) != i_size) {
- Close(ifd); /* probably means i_size > 15 or 16 bits worth */
- free(i_womp); /* at this point it doesn't matter if i_womp was */
- return FALSE; /* undersized. */
- --- 139,145 ----
- if ((ifd = open(filename, 0)) < 0)
- fatal2("Can't open file %s\n", filename);
- #ifndef lint
- ! if ((i_size=(unsigned)read(ifd, i_womp, (int)i_size)) == (unsigned)-1) {
- Close(ifd); /* probably means i_size > 15 or 16 bits worth */
- free(i_womp); /* at this point it doesn't matter if i_womp was */
- return FALSE; /* undersized. */
- ***************
- *** 149,157 ****
- if (*s == '\n')
- iline++;
- }
- - #ifdef lint
- i_ptr = Null(char**);
- ! #else
- i_ptr = (char **)malloc((MEM)((iline + 2) * sizeof(char *)));
- #endif
- if (i_ptr == Null(char **)) { /* shucks, it was a near thing */
- --- 157,167 ----
- if (*s == '\n')
- iline++;
- }
- i_ptr = Null(char**);
- ! #ifndef lint
- ! #ifdef TURBOC20
- ! if (iline+2<MAXMEMBLK/sizeof(char *))
- ! #endif
- i_ptr = (char **)malloc((MEM)((iline + 2) * sizeof(char *)));
- #endif
- if (i_ptr == Null(char **)) { /* shucks, it was a near thing */
- ***************
- *** 210,215 ****
- --- 220,228 ----
- fatal2("Can't open file %s\n", filename);
- if ((tifd = creat(TMPINNAME, 0666)) < 0)
- fatal2("Can't open file %s\n", TMPINNAME);
- + #ifdef TURBOC20
- + setmode(tifd, O_BINARY);
- + #endif
- while (fgets(buf, sizeof buf, ifp) != Nullch) {
- if (revision != Nullch && !found_revision && rev_in_string(buf))
- found_revision = TRUE;
- ***************
- *** 245,257 ****
- fatal1("Can't seem to get enough memory.\n");
- for (i=1; ; i++) {
- if (! (i % lines_per_buf)) /* new block */
- ! if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE)
- fatal1("patch: can't write temp file.\n");
- if (fgets(tibuf[0] + maxlen * (i%lines_per_buf), maxlen + 1, ifp)
- == Nullch) {
- input_lines = i - 1;
- if (i % lines_per_buf)
- ! if (write(tifd, tibuf[0], BUFFERSIZE) < BUFFERSIZE)
- fatal1("patch: can't write temp file.\n");
- break;
- }
- --- 258,270 ----
- fatal1("Can't seem to get enough memory.\n");
- for (i=1; ; i++) {
- if (! (i % lines_per_buf)) /* new block */
- ! if (write(tifd, tibuf[0], BUFFERSIZE) == -1)
- fatal1("patch: can't write temp file.\n");
- if (fgets(tibuf[0] + maxlen * (i%lines_per_buf), maxlen + 1, ifp)
- == Nullch) {
- input_lines = i - 1;
- if (i % lines_per_buf)
- ! if (write(tifd, tibuf[0], BUFFERSIZE) == -1)
- fatal1("patch: can't write temp file.\n");
- break;
- }
- ***************
- *** 258,264 ****
- --- 271,281 ----
- }
- Fclose(ifp);
- Close(tifd);
- + #ifdef TURBOC20
- + if ((tifd = open(TMPINNAME, O_BINARY)) < 0) {
- + #else
- if ((tifd = open(TMPINNAME, 0)) < 0) {
- + #endif
- fatal2("Can't reopen file %s\n", TMPINNAME);
- }
- }
- ***************
- *** 287,293 ****
- #ifndef lint /* complains of long accuracy */
- Lseek(tifd, (long)baseline / lines_per_buf * BUFFERSIZE, 0);
- #endif
- ! if (read(tifd, tibuf[whichbuf], BUFFERSIZE) < 0)
- fatal2("Error reading tmp file %s.\n", TMPINNAME);
- }
- return tibuf[whichbuf] + (tireclen*offline);
- --- 304,310 ----
- #ifndef lint /* complains of long accuracy */
- Lseek(tifd, (long)baseline / lines_per_buf * BUFFERSIZE, 0);
- #endif
- ! if (read(tifd, tibuf[whichbuf], BUFFERSIZE) == -1)
- fatal2("Error reading tmp file %s.\n", TMPINNAME);
- }
- return tibuf[whichbuf] + (tireclen*offline);
- *** ../patch/pch.c Thu May 24 14:21:38 1990
- --- pch.c Thu May 31 10:40:00 1990
- ***************
- *** 1,6 ****
- ! /* $Header: pch.c,v 2.0.1.7 88/06/03 15:13:28 lwall Locked $
- *
- * $Log: pch.c,v $
- * Revision 2.0.1.7 88/06/03 15:13:28 lwall
- * patch10: Can now find patches in shar scripts.
- * patch10: Hunks that swapped and then swapped back could core dump.
- --- 1,10 ----
- ! /* $Header: pch.c,v 2.0.1.7 90/05/30 11:30:00 mward $
- *
- * $Log: pch.c,v $
- + * Revision 2.0.1.8 90/05/30 11:30:00 mward
- + * replace do_ed_script with stub
- + * modify calls to read, write to detect error on return value of -1
- + *
- * Revision 2.0.1.7 88/06/03 15:13:28 lwall
- * patch10: Can now find patches in shar scripts.
- * patch10: Hunks that swapped and then swapped back could core dump.
- ***************
- *** 1058,1063 ****
- --- 1062,1077 ----
- return p_hunk_beg;
- }
-
- + #ifdef TURBOC20
- + /* Ignore an ed script. */
- +
- + void
- + do_ed_script()
- + {
- + say1("Sorry, can't do ed scripts yet!\n");
- + say1("Use ed to do this one yourself!\n");
- + }
- + #else
- /* Apply an ed script by feeding ed itself. */
-
- void
- ***************
- *** 1121,1123 ****
- --- 1134,1137 ----
- chmod(outname, filemode);
- set_signals(1);
- }
- + #endif
- *** ../patch/util.c Thu May 24 14:21:46 1990
- --- util.c Thu May 31 10:40:14 1990
- ***************
- *** 1,3 ****
- --- 1,15 ----
- + /* $Header: pch.c,v 2.0.1 90/05/30 11:30:00 mward $
- + *
- + * $Log: pch.c,v $
- + * Revision 2.0.1 90/05/30 11:30:00 mward
- + * modify calls to read, write to detect error on return of value -1
- + * added TURBOC20 ifdef stuff:
- + * no inodes: modify move_file same file detect accordingly
- + * no links: modify move_file link calls to copy_file calls
- + * no SIGHUP: modify signal routines accordingly
- + *
- + */
- +
- #include "EXTERN.h"
- #include "common.h"
- #include "INTERN.h"
- ***************
- *** 24,31 ****
- fromfd = open(from, 0);
- if (fromfd < 0)
- fatal2("patch: internal error, can't reopen %s\n", from);
- ! while ((i=read(fromfd, buf, sizeof buf)) > 0)
- ! if (write(1, buf, i) != 1)
- fatal1("patch: write failed\n");
- Close(fromfd);
- return 0;
- --- 36,43 ----
- fromfd = open(from, 0);
- if (fromfd < 0)
- fatal2("patch: internal error, can't reopen %s\n", from);
- ! while ((i=read(fromfd, buf, sizeof buf))!=-1 && i!=0)
- ! if (write(1, buf, i) == -1)
- fatal1("patch: write failed\n");
- Close(fromfd);
- return 0;
- ***************
- *** 39,46 ****
- Strcat(bakname, origext?origext:ORIGEXT);
- }
- if (stat(to, &filestat) >= 0) { /* output file exists */
- ! dev_t to_device = filestat.st_dev;
- ! ino_t to_inode = filestat.st_ino;
- char *simplename = bakname;
-
- for (s=bakname; *s; s++) {
- --- 51,65 ----
- Strcat(bakname, origext?origext:ORIGEXT);
- }
- if (stat(to, &filestat) >= 0) { /* output file exists */
- ! #ifdef TURBOC20
- ! short to_device = filestat.st_dev;
- ! short to_mode = filestat.st_mode;
- ! long to_size = filestat.st_size;
- ! long to_time = filestat.st_mtime;
- ! #else
- ! dev_t to_device = filestat.st_dev;
- ! ino_t to_inode = filestat.st_ino;
- ! #endif
- char *simplename = bakname;
-
- for (s=bakname; *s; s++) {
- ***************
- *** 49,55 ****
- }
- /* find a backup name that is not the same file */
- while (stat(bakname, &filestat) >= 0 &&
- ! to_device == filestat.st_dev && to_inode == filestat.st_ino) {
- for (s=simplename; *s && !islower(*s); s++) ;
- if (*s)
- *s = toupper(*s);
- --- 68,82 ----
- }
- /* find a backup name that is not the same file */
- while (stat(bakname, &filestat) >= 0 &&
- ! to_device == filestat.st_dev &&
- ! #ifdef TURBOC20
- ! to_mode == filestat.st_mode &&
- ! to_size == filestat.st_size &&
- ! to_time == filestat.st_mtime
- ! #else
- ! to_inode == filestat.st_ino
- ! #endif
- ! ) {
- for (s=simplename; *s && !islower(*s); s++) ;
- if (*s)
- *s = toupper(*s);
- ***************
- *** 61,71 ****
- --- 88,102 ----
- if (debug & 4)
- say3("Moving %s to %s.\n", to, bakname);
- #endif
- + #ifdef TURBOC20
- + copy_file(to, bakname);
- + #else
- if (link(to, bakname) < 0) {
- say3("patch: can't backup %s, output is in %s\n",
- to, from);
- return -1;
- }
- + #endif
- while (unlink(to) >= 0) ;
- }
- #ifdef DEBUGGING
- ***************
- *** 72,77 ****
- --- 103,111 ----
- if (debug & 4)
- say3("Moving %s to %s.\n", from, to);
- #endif
- + #ifdef TURBOC20
- + copy_file(from, to);
- + #else
- if (link(from, to) < 0) { /* different file system? */
- Reg4 int tofd;
-
- ***************
- *** 84,95 ****
- fromfd = open(from, 0);
- if (fromfd < 0)
- fatal2("patch: internal error, can't reopen %s\n", from);
- ! while ((i=read(fromfd, buf, sizeof buf)) > 0)
- ! if (write(tofd, buf, i) != i)
- fatal1("patch: write failed\n");
- Close(fromfd);
- Close(tofd);
- }
- Unlink(from);
- return 0;
- }
- --- 118,130 ----
- fromfd = open(from, 0);
- if (fromfd < 0)
- fatal2("patch: internal error, can't reopen %s\n", from);
- ! while ((i=read(fromfd, buf, sizeof buf))!=-1 && i!=0)
- ! if (write(tofd, buf, i) == -1)
- fatal1("patch: write failed\n");
- Close(fromfd);
- Close(tofd);
- }
- + #endif
- Unlink(from);
- return 0;
- }
- ***************
- *** 110,117 ****
- fromfd = open(from, 0);
- if (fromfd < 0)
- fatal2("patch: internal error, can't reopen %s\n", from);
- ! while ((i=read(fromfd, buf, sizeof buf)) > 0)
- ! if (write(tofd, buf, i) != i)
- fatal2("patch: write (%s) failed\n", to);
- Close(fromfd);
- Close(tofd);
- --- 145,152 ----
- fromfd = open(from, 0);
- if (fromfd < 0)
- fatal2("patch: internal error, can't reopen %s\n", from);
- ! while ((i=read(fromfd, buf, sizeof buf))!=-1 && i!=0)
- ! if (write(tofd, buf, i) == -1)
- fatal2("patch: write (%s) failed\n", to);
- Close(fromfd);
- Close(tofd);
- ***************
- *** 233,245 ****
- --- 268,289 ----
- {
- void my_exit();
- #ifndef lint
- + #ifdef TURBOC20
- #ifdef VOIDSIG
- + static void (*intval)();
- + #else
- + static int (*intval)();
- + #endif
- + #else
- + #ifdef VOIDSIG
- static void (*hupval)(),(*intval)();
- #else
- static int (*hupval)(),(*intval)();
- #endif
- + #endif
-
- if (!reset) {
- + #ifndef TURBOC20
- hupval = signal(SIGHUP, SIG_IGN);
- if (hupval != SIG_IGN)
- #ifdef VOIDSIG
- ***************
- *** 247,252 ****
- --- 291,298 ----
- #else
- hupval = (int(*)())my_exit;
- #endif
- + #endif
- +
- intval = signal(SIGINT, SIG_IGN);
- if (intval != SIG_IGN)
- #ifdef VOIDSIG
- ***************
- *** 255,261 ****
- --- 301,309 ----
- intval = (int(*)())my_exit;
- #endif
- }
- + #ifndef TURBOC20
- Signal(SIGHUP, hupval);
- + #endif
- Signal(SIGINT, intval);
- #endif
- }
- ***************
- *** 266,272 ****
- --- 314,322 ----
- ignore_signals()
- {
- #ifndef lint
- + #ifndef TURBOC20
- Signal(SIGHUP, SIG_IGN);
- + #endif
- Signal(SIGINT, SIG_IGN);
- #endif
- }
-