TurboC2.0 Patches *** /dev/null --- tcpatlev.h Wed Jul 18 09:54:12 1990 *************** *** 0 **** --- 1,1 ---- + #define TCPATCHLEVEL 1 *** ../patch/readme Wed May 30 15:03:04 1990 --- readme Wed Jul 18 09:54:12 1990 *************** *** 70,72 **** --- 70,83 ---- Uses a Configure script for greater portability. You are now asked if you want to apply a reversed patch. No limit (apart from memory) on the size of hunks. + + + *** OFFICIAL PATCHLEVEL 12, TurboC2.0 PATCHLEVEL 1 + + From: ward@sneezy.cs.wisc.edu (Mike Ward) + Date: 31 May 90 + + minimal patches to enable compilation under Turbo C2.0, execution under MSDOS + temp files go in directory /tmp + ed scripts disabled + *** ../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 #include + #ifdef TURBOC20 + #include + #include + #include + #include + #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 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 } *** /dev/null Fri May 25 21:39:04 1990 --- makefile Wed Jul 18 09:54:12 1990 *************** *** 0 **** --- 1,21 ---- + CC = tcc + CFLAGS = -N -ml -DTURBOC20 + + c = patch.c pch.c inp.c version.c util.c + obj = patch.obj pch.obj inp.obj util.obj version.obj + + .c.obj: + $(CC) -c $(CFLAGS) $(LARGE) $*.c + + patch.exe: $(obj) + $(CC) -epatch $(CFLAGS) $(obj) + + patch.obj: config.h common.h patch.c inp.h pch.h util.h version.h + + pch.obj: config.h common.h pch.c pch.h util.h + + inp.obj: config.h common.h inp.c inp.h util.h + + util.obj: config.h common.h util.c util.h + + version.obj: config.h common.h version.c version.h patchlevel.h util.h