From 89c33fa060b5990a8a95f67970cce6e2791e3908 Mon Sep 17 00:00:00 2001 From: gdr Date: Wed, 8 Feb 1995 05:47:59 +0000 Subject: [PATCH] Soenke's 3 Feb 95 changes for version 1.14. Cleaned up the makefiles a bit. Ran ccprep on the *.c files, so that occ with -g produces good debug code. (Reported problem with Orca/C's #append directive.) Fixed stat() bug when running under Orca/Shell. --- usr.orca.bin/udl/Makefile.gs | 8 +++----- usr.orca.bin/udl/common.c | 32 +++++++++++++++++++++++++++----- usr.orca.bin/udl/globals.c | 5 ++++- usr.orca.bin/udl/udlgs.c | 11 ++++++++--- usr.orca.bin/udl/udlunix.c | 5 ++++- usr.orca.bin/udl/udluse.c | 5 ++++- 6 files changed, 50 insertions(+), 16 deletions(-) diff --git a/usr.orca.bin/udl/Makefile.gs b/usr.orca.bin/udl/Makefile.gs index f93f887..d01bef9 100644 --- a/usr.orca.bin/udl/Makefile.gs +++ b/usr.orca.bin/udl/Makefile.gs @@ -3,7 +3,7 @@ # Copyright (c) 1993-1994 Soenke Behrens # For use with dmake # -# $Id: Makefile.gs,v 1.4 1995/02/08 05:25:09 gdr Exp $ +# $Id: Makefile.gs,v 1.5 1995/02/08 05:47:43 gdr Exp $ # # Define the following as necessary: # @@ -29,10 +29,8 @@ DEFINES = -DGNO -D_POSIX_C_SOURCE -D_POSIX_SOURCE -DHAS_ATEXIT \ -DOVERFLOW_CHECK -#CFLAGS = $(DEFINES) -O -w -v -s2048 -#LDFLAGS = -v -l/usr/lib/gnulib -s2048 -CFLAGS = $(DEFINES) -O -v -s2048 -LDFLAGS = -v -s2048 +CFLAGS = $(DEFINES) -O -w -v -s2048 +LDFLAGS = -v -l/usr/lib/gnulib -s2048 # # You should not have to modify anything beyond this point diff --git a/usr.orca.bin/udl/common.c b/usr.orca.bin/udl/common.c index eebfe5f..19e0793 100644 --- a/usr.orca.bin/udl/common.c +++ b/usr.orca.bin/udl/common.c @@ -1,10 +1,13 @@ +#ifdef __CCFRONT__ +#line 2 +#endif /* * udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF), * and Apple (CR). * * Routines common to both the Unix and Apple IIgs versions. * - * $Id: common.c,v 1.4 1995/02/08 05:25:15 gdr Exp $ + * $Id: common.c,v 1.5 1995/02/08 05:47:48 gdr Exp $ * * Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade */ @@ -857,16 +860,35 @@ char *mktemp(const char *base) *p1 = 'A'; p1--; } else { - *p1++; + *p1 += 1; break; } /* Make sure the file name does not already exist */ - if (stat(st,&tstat) == 0) - { +#ifdef GNO + if (needsgno() == TRUE) { +#endif + if (stat(st,&tstat) == 0) + { free (st); st = mktemp (base); + } +#ifdef GNO + } else { /* ORCA/Shell doesn't like stat one little bit */ + FILE *fp; + if ((fp = fopen(st,"r")) != NULL) + { + fclose(fp); + free (st); + st = mktemp (base); + } else if ((fp = fopen(st,"a")) == NULL) { + free(st); + st = mktemp (base); + } else { + fclose(fp); + } } +#endif return st; } @@ -888,7 +910,7 @@ char *get_path (const char *name) strcpy(filebuffer, name); - for (i = strlen(filebuffer) - 1; i >= 0 && filebuffer[i] != dirbrk; i--) + for (i = strlen(filebuffer) - 1; i > 0 && filebuffer[i] != dirbrk; i--) ; /* empty loop to find end of path in name */ if (i != 0) diff --git a/usr.orca.bin/udl/globals.c b/usr.orca.bin/udl/globals.c index 26e7920..1af4e3f 100644 --- a/usr.orca.bin/udl/globals.c +++ b/usr.orca.bin/udl/globals.c @@ -1,10 +1,13 @@ +#ifdef __CCFRONT__ +#line 2 +#endif /* * udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF), * and Apple (CR). * * Contains definitions of global variables declared in common.h * - * $Id: globals.c,v 1.1 1995/02/08 05:25:18 gdr Exp $ + * $Id: globals.c,v 1.2 1995/02/08 05:47:52 gdr Exp $ * * Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade */ diff --git a/usr.orca.bin/udl/udlgs.c b/usr.orca.bin/udl/udlgs.c index 941d371..e8b6267 100644 --- a/usr.orca.bin/udl/udlgs.c +++ b/usr.orca.bin/udl/udlgs.c @@ -1,10 +1,13 @@ +#ifdef __CCFRONT__ +#line 2 +#endif /* * udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF), * and Apple (CR). * * Apple IIgs specific routines. * - * $Id: udlgs.c,v 1.4 1995/02/08 05:25:22 gdr Exp $ + * $Id: udlgs.c,v 1.5 1995/02/08 05:47:55 gdr Exp $ * * Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade */ @@ -183,7 +186,9 @@ int main(int argc,char *argv[]) { } else { InitWild.flags = 0; } - + + dirbrk = ':'; /* enforced by NextWildcardGS */ + /* loop through all command line args */ for (; optind < argc; optind++) { size_t i; @@ -259,7 +264,7 @@ int main(int argc,char *argv[]) { infile = tryopen(current_file,"rwb"); tempfile = mktemp(strcat(get_path(current_file), "udltmpXX")); outfile = tryopen(tempfile,"wb"); - + if (careful) { converted = TRUE; /* always */ diff --git a/usr.orca.bin/udl/udlunix.c b/usr.orca.bin/udl/udlunix.c index 1d0ee81..61bbc8d 100644 --- a/usr.orca.bin/udl/udlunix.c +++ b/usr.orca.bin/udl/udlunix.c @@ -1,10 +1,13 @@ +#ifdef __CCFRONT__ +#line 2 +#endif /* * udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF), * and Apple (CR). * * Unix specific routines. * - * $Id: udlunix.c,v 1.4 1995/02/08 05:25:24 gdr Exp $ + * $Id: udlunix.c,v 1.5 1995/02/08 05:47:57 gdr Exp $ * * Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade */ diff --git a/usr.orca.bin/udl/udluse.c b/usr.orca.bin/udl/udluse.c index 456a8e9..2b3eb78 100644 --- a/usr.orca.bin/udl/udluse.c +++ b/usr.orca.bin/udl/udluse.c @@ -1,10 +1,13 @@ +#ifdef __CCFRONT__ +#line 2 +#endif /* * udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF), * and Apple (CR). * * Usage strings. * - * $Id: udluse.c,v 1.4 1995/02/08 05:25:26 gdr Exp $ + * $Id: udluse.c,v 1.5 1995/02/08 05:47:59 gdr Exp $ * * Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade */