mirror of
https://github.com/GnoConsortium/gno.git
synced 2025-08-07 15:25:35 +00:00
The comments on the previous checkin were a bit premature. The enclosed
files are the released version 1.13, minus the files "udl" and "udl.r".
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
# Copyright (c) 1993-1994 Soenke Behrens
|
# Copyright (c) 1993-1994 Soenke Behrens
|
||||||
# For use with dmake
|
# For use with dmake
|
||||||
#
|
#
|
||||||
# $Id: Makefile.gs,v 1.1 1994/12/13 18:08:13 gdr Exp $
|
# $Id: Makefile.gs,v 1.3 1995/02/08 05:15:20 gdr Exp $
|
||||||
#
|
#
|
||||||
# Define the following as necessary:
|
# Define the following as necessary:
|
||||||
#
|
#
|
||||||
@@ -20,20 +20,25 @@
|
|||||||
# GNO if you are compiling on the IIgs. This will allow for both
|
# GNO if you are compiling on the IIgs. This will allow for both
|
||||||
# ':' and '/' as pathname separators.
|
# ':' and '/' as pathname separators.
|
||||||
#
|
#
|
||||||
|
# OVERFLOW_CHECK Udl uses one recursive subroutine. Define this if
|
||||||
|
# you want to check for stack overflows for this routine (independent
|
||||||
|
# of any compiler flags). Strongly recommended.
|
||||||
|
#
|
||||||
# CHECK_STACK if you want stack usage to be displayed (IIgs only).
|
# CHECK_STACK if you want stack usage to be displayed (IIgs only).
|
||||||
# You will also have to specify -l/usr/lib/stack in LDFLAGS.
|
# You will also have to specify -l/usr/lib/stack in LDFLAGS.
|
||||||
|
|
||||||
DEFINES = -DGNO -D_POSIX_C_SOURCE -D_POSIX_SOURCE -DHAS_ATEXIT -DCHECK_STACK
|
DEFINES = -DGNO -D_POSIX_C_SOURCE -D_POSIX_SOURCE -DHAS_ATEXIT \
|
||||||
CFLAGS = $(DEFINES) -G25 -w -v
|
-DOVERFLOW_CHECK
|
||||||
LDFLAGS = -v -l/usr/lib/stack -l/usr/lib/gnulib
|
CFLAGS = $(DEFINES) -O -w -v -s2048
|
||||||
|
LDFLAGS = -v -l/usr/lib/gnulib -s2048
|
||||||
|
|
||||||
#
|
#
|
||||||
# You should not have to modify anything beyond this point
|
# You should not have to modify anything beyond this point
|
||||||
#
|
#
|
||||||
|
|
||||||
udl: udl.o udluse.o udl.r common.o
|
udl: udl.o udluse.o udl.r common.o
|
||||||
|
# cp udl.r udl
|
||||||
$(CC) $(LDFLAGS) -o udl udl.o udluse.o common.o
|
$(CC) $(LDFLAGS) -o udl udl.o udluse.o common.o
|
||||||
copyfork udl.r udl
|
|
||||||
|
|
||||||
udl.o: udl.gs.c common.h
|
udl.o: udl.gs.c common.h
|
||||||
$(CC) -c $(CFLAGS) -o udl.o udl.gs.c
|
$(CC) -c $(CFLAGS) -o udl.o udl.gs.c
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
# Makefile for udl
|
# Makefile for udl
|
||||||
# (c) 1993-1994 Soenke Behrens
|
# (c) 1993-1994 Soenke Behrens
|
||||||
#
|
#
|
||||||
# $Id: Makefile.unx,v 1.1 1994/12/13 18:08:16 gdr Exp $
|
# $Id: Makefile.unx,v 1.3 1995/02/08 05:15:22 gdr Exp $
|
||||||
#
|
#
|
||||||
# Define the following as necessary:
|
# Define the following as necessary:
|
||||||
#
|
#
|
||||||
|
@@ -4,7 +4,7 @@ udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF),
|
|||||||
|
|
||||||
(c) 1993-1994 Soenke Behrens
|
(c) 1993-1994 Soenke Behrens
|
||||||
|
|
||||||
Version 1.13: $Id: README,v 1.1 1994/12/13 18:08:18 gdr Exp $
|
Version 1.13: $Id: README,v 1.2 1995/02/08 05:05:36 gdr Exp $
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
|
||||||
Udl converts text files between CR, LF and CR/LF (Apple, Unix and MS-DOS).
|
Udl converts text files between CR, LF and CR/LF (Apple, Unix and MS-DOS).
|
||||||
@@ -46,6 +46,9 @@ v1.13
|
|||||||
Added ability to recurse through directories (-R flag).
|
Added ability to recurse through directories (-R flag).
|
||||||
Changed behavior to ignore binary files rather than exiting.
|
Changed behavior to ignore binary files rather than exiting.
|
||||||
Merged Unix and Apple IIgs versions.
|
Merged Unix and Apple IIgs versions.
|
||||||
|
No message is printed out when a binary file (or, in the IIgs
|
||||||
|
implementation, a non-TXT or non-SRC file) is encountered
|
||||||
|
unless the -v option is specified.
|
||||||
|
|
||||||
=========
|
=========
|
||||||
Compiling:
|
Compiling:
|
||||||
@@ -66,6 +69,13 @@ Also, udl.c assumes that getopt() is declared in <unistd.h> and that
|
|||||||
the function strdup() exists in <string.h>. You might want to change
|
the function strdup() exists in <string.h>. You might want to change
|
||||||
these includes if that's not the case.
|
these includes if that's not the case.
|
||||||
|
|
||||||
|
==========
|
||||||
|
Legalities:
|
||||||
|
==========
|
||||||
|
|
||||||
|
This program contains material from the Orca/C Run-Time Libraries,
|
||||||
|
copyright 1987-1994 by Byte Works, Inc. Used with permission.
|
||||||
|
|
||||||
=============================================================================
|
=============================================================================
|
||||||
Enjoy,
|
Enjoy,
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Routines common to both the Unix and Apple IIgs versions.
|
* Routines common to both the Unix and Apple IIgs versions.
|
||||||
*
|
*
|
||||||
* $Id: common.c,v 1.1 1994/12/13 18:08:20 gdr Exp $
|
* $Id: common.c,v 1.2 1995/02/08 05:05:38 gdr Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1993-1994 Soenke Behrens
|
* Copyright (c) 1993-1994 Soenke Behrens
|
||||||
*/
|
*/
|
||||||
@@ -56,36 +56,36 @@ void convert_gs(FILE *infile, FILE *outfile) {
|
|||||||
*out_bufpos = '\r';
|
*out_bufpos = '\r';
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc('\r',outfile); */
|
/* fputc('\r',outfile); */
|
||||||
} else if(a == '\r') {
|
} else if(a == '\r') {
|
||||||
*out_bufpos = '\r';
|
*out_bufpos = '\r';
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc('\r',outfile); */
|
/* fputc('\r',outfile); */
|
||||||
|
|
||||||
if (*in_bufpos == '\n' && file_remain != 0) {
|
if (*in_bufpos == '\n' && file_remain != 0) {
|
||||||
in_bufpos++;
|
in_bufpos++;
|
||||||
|
|
||||||
if (in_bufpos >= in_bufend) {
|
if (in_bufpos >= in_bufend) {
|
||||||
file_remain -= in_bufend - in_buffer;
|
file_remain -= in_bufend - in_buffer;
|
||||||
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
||||||
in_bufpos = in_buffer;
|
in_bufpos = in_buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if ((a = fgetc (infile)) != '\n')
|
/* if ((a = fgetc (infile)) != '\n')
|
||||||
ungetc (a,infile); */
|
ungetc (a,infile); */
|
||||||
} else {
|
} else {
|
||||||
*out_bufpos = a;
|
*out_bufpos = a;
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc(a,outfile); */
|
/* fputc(a,outfile); */
|
||||||
}
|
}
|
||||||
@@ -139,52 +139,52 @@ void convert_messy (FILE *infile, FILE *outfile) {
|
|||||||
*out_bufpos = '\r';
|
*out_bufpos = '\r';
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc('\r',outfile); */
|
/* fputc('\r',outfile); */
|
||||||
|
|
||||||
*out_bufpos = '\n';
|
*out_bufpos = '\n';
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc('\n',outfile); */
|
/* fputc('\n',outfile); */
|
||||||
} else if(a == '\r') {
|
} else if(a == '\r') {
|
||||||
*out_bufpos = '\r';
|
*out_bufpos = '\r';
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc('\r',outfile); */
|
/* fputc('\r',outfile); */
|
||||||
|
|
||||||
*out_bufpos = '\n';
|
*out_bufpos = '\n';
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc('\n',outfile); */
|
/* fputc('\n',outfile); */
|
||||||
|
|
||||||
if (*in_bufpos == '\n' && file_remain != 0) {
|
if (*in_bufpos == '\n' && file_remain != 0) {
|
||||||
in_bufpos++;
|
in_bufpos++;
|
||||||
|
|
||||||
if (in_bufpos >= in_bufend) {
|
if (in_bufpos >= in_bufend) {
|
||||||
file_remain -= in_bufend - in_buffer;
|
file_remain -= in_bufend - in_buffer;
|
||||||
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
||||||
in_bufpos = in_buffer;
|
in_bufpos = in_buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if ((a = fgetc (infile)) != '\n')
|
/* if ((a = fgetc (infile)) != '\n')
|
||||||
ungetc (a,infile); */
|
ungetc (a,infile); */
|
||||||
} else {
|
} else {
|
||||||
*out_bufpos = a;
|
*out_bufpos = a;
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc(a,outfile); */
|
/* fputc(a,outfile); */
|
||||||
}
|
}
|
||||||
@@ -238,28 +238,28 @@ void convert_tunix (FILE *infile, FILE *outfile) {
|
|||||||
*out_bufpos = '\n';
|
*out_bufpos = '\n';
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc('\n',outfile); */
|
/* fputc('\n',outfile); */
|
||||||
|
|
||||||
if (*in_bufpos == '\n' && file_remain != 0) {
|
if (*in_bufpos == '\n' && file_remain != 0) {
|
||||||
in_bufpos++;
|
in_bufpos++;
|
||||||
|
|
||||||
if (in_bufpos >= in_bufend) {
|
if (in_bufpos >= in_bufend) {
|
||||||
file_remain -= in_bufend - in_buffer;
|
file_remain -= in_bufend - in_buffer;
|
||||||
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
||||||
in_bufpos = in_buffer;
|
in_bufpos = in_buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if ((a = fgetc (infile)) != '\n')
|
/* if ((a = fgetc (infile)) != '\n')
|
||||||
ungetc (a,infile); */
|
ungetc (a,infile); */
|
||||||
} else {
|
} else {
|
||||||
*out_bufpos = a;
|
*out_bufpos = a;
|
||||||
out_bufpos++;
|
out_bufpos++;
|
||||||
if (out_bufpos == out_bufend) {
|
if (out_bufpos == out_bufend) {
|
||||||
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
my_fwrite(out_buffer,outfile,BUFFERSIZE);
|
||||||
out_bufpos = out_buffer;
|
out_bufpos = out_buffer;
|
||||||
}
|
}
|
||||||
/* fputc(a,outfile); */
|
/* fputc(a,outfile); */
|
||||||
}
|
}
|
||||||
@@ -308,7 +308,7 @@ int convert_fast_gs(FILE *infile, FILE *outfile) {
|
|||||||
case apple:
|
case apple:
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("%s: %s is already in Apple format, skipping.\n",
|
printf("%s: %s is already in Apple format, skipping.\n",
|
||||||
program_name,current_file);
|
program_name,current_file);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -317,17 +317,17 @@ int convert_fast_gs(FILE *infile, FILE *outfile) {
|
|||||||
while (file_remain != 0) {
|
while (file_remain != 0) {
|
||||||
a = *in_bufpos;
|
a = *in_bufpos;
|
||||||
if (a == '\n')
|
if (a == '\n')
|
||||||
*in_bufpos++ = '\r';
|
*in_bufpos++ = '\r';
|
||||||
else if (a == '\0') { /* End of buffer reached */
|
else if (a == '\0') { /* End of buffer reached */
|
||||||
|
|
||||||
/* Write changed buffer out */
|
/* Write changed buffer out */
|
||||||
my_fwrite(in_buffer,outfile,in_bufend - in_buffer);
|
my_fwrite(in_buffer,outfile,in_bufend - in_buffer);
|
||||||
|
|
||||||
/* And reload it */
|
/* And reload it */
|
||||||
file_remain -= in_bufend - in_buffer;
|
file_remain -= in_bufend - in_buffer;
|
||||||
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
||||||
*in_bufend = '\0';
|
*in_bufend = '\0';
|
||||||
in_bufpos = in_buffer;
|
in_bufpos = in_buffer;
|
||||||
} else in_bufpos++;
|
} else in_bufpos++;
|
||||||
}
|
}
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@@ -387,7 +387,7 @@ int convert_fast_messy (FILE *infile, FILE *outfile) {
|
|||||||
case dos:
|
case dos:
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("%s: %s is already in MS-DOS format, skipping.\n",
|
printf("%s: %s is already in MS-DOS format, skipping.\n",
|
||||||
program_name,current_file);
|
program_name,current_file);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -448,7 +448,7 @@ int convert_fast_tunix (FILE *infile, FILE *outfile) {
|
|||||||
case tunix:
|
case tunix:
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("%s: %s is already in Unix format, skipping.\n",
|
printf("%s: %s is already in Unix format, skipping.\n",
|
||||||
program_name,current_file);
|
program_name,current_file);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -457,17 +457,17 @@ int convert_fast_tunix (FILE *infile, FILE *outfile) {
|
|||||||
while (file_remain != 0) {
|
while (file_remain != 0) {
|
||||||
a = *in_bufpos;
|
a = *in_bufpos;
|
||||||
if (a == '\r')
|
if (a == '\r')
|
||||||
*in_bufpos++ = '\n';
|
*in_bufpos++ = '\n';
|
||||||
else if (a == '\0'){ /* End of buffer reached */
|
else if (a == '\0'){ /* End of buffer reached */
|
||||||
|
|
||||||
/* Write changed buffer out */
|
/* Write changed buffer out */
|
||||||
my_fwrite(in_buffer,outfile,in_bufend - in_buffer);
|
my_fwrite(in_buffer,outfile,in_bufend - in_buffer);
|
||||||
|
|
||||||
/* And reload */
|
/* And reload */
|
||||||
file_remain -= in_bufend - in_buffer;
|
file_remain -= in_bufend - in_buffer;
|
||||||
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
in_bufend = in_buffer + my_fread(infile, BUFFERSIZE);
|
||||||
*in_bufend = '\0';
|
*in_bufend = '\0';
|
||||||
in_bufpos = in_buffer;
|
in_bufpos = in_buffer;
|
||||||
} else in_bufpos++;
|
} else in_bufpos++;
|
||||||
}
|
}
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@@ -513,9 +513,9 @@ enum file_format get_file_format (unsigned char *buffer) {
|
|||||||
break;
|
break;
|
||||||
} else if (c == '\r') {
|
} else if (c == '\r') {
|
||||||
if (*buffer == '\n')
|
if (*buffer == '\n')
|
||||||
result = dos;
|
result = dos;
|
||||||
else
|
else
|
||||||
result = apple;
|
result = apple;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -523,8 +523,8 @@ enum file_format get_file_format (unsigned char *buffer) {
|
|||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("%s: No EOL found on the first %d bytes "
|
printf("%s: No EOL found on the first %d bytes "
|
||||||
"of %s. Might be a binary file. File skipped\n",
|
"of %s. Might be a binary file. File skipped\n",
|
||||||
program_name,BUFFERSIZE, current_file);
|
program_name,BUFFERSIZE, current_file);
|
||||||
result = binary;
|
result = binary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -625,14 +625,14 @@ void copy_file (char *from, char *to) {
|
|||||||
length = fread(buffer,1,BUFFERSIZE,fp1);
|
length = fread(buffer,1,BUFFERSIZE,fp1);
|
||||||
if (ferror(fp1)) {
|
if (ferror(fp1)) {
|
||||||
fprintf(stderr,"%s: Error while trying to read %s\n",
|
fprintf(stderr,"%s: Error while trying to read %s\n",
|
||||||
program_name, from);
|
program_name, from);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fwrite(buffer,1,length,fp2) != length) {
|
if (fwrite(buffer,1,length,fp2) != length) {
|
||||||
fprintf(stderr,"%s: Error while trying to write out "
|
fprintf(stderr,"%s: Error while trying to write out "
|
||||||
"file %s\n",program_name,to);
|
"file %s\n",program_name,to);
|
||||||
free (buffer);
|
free (buffer);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -717,8 +717,19 @@ void build_file_list(char *file, short recurse) {
|
|||||||
DIR *dir;
|
DIR *dir;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
|
|
||||||
|
/* check for stack overflow */
|
||||||
|
recursionDepth++;
|
||||||
|
#ifdef OVERFLOW_CHECK
|
||||||
|
if ((recursionDepth * BYTES_PER_DEPTH + BASESIZE) > STACKSIZE) {
|
||||||
|
fprintf(stderr,"%s: Exceeded permitted nesting depth (%d levels)\n"
|
||||||
|
"Aborted.\n",program_name,recursionDepth);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (stat(file,&tstat)!=0) {
|
if (stat(file,&tstat)!=0) {
|
||||||
fprintf(stderr,"%s: Couldn't stat %s. File skipped\n",program_name,file);
|
fprintf(stderr,"%s: Couldn't stat %s. File skipped\n",program_name,file);
|
||||||
|
--recursionDepth;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -790,6 +801,7 @@ void build_file_list(char *file, short recurse) {
|
|||||||
add_to_pathList(currentDirectory, file);
|
add_to_pathList(currentDirectory, file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--recursionDepth;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -801,13 +813,13 @@ void add_to_pathList(char *thisdir, char *file) {
|
|||||||
pathSlots += PATHLIST_QUANTUM;
|
pathSlots += PATHLIST_QUANTUM;
|
||||||
#if BROKEN_REALLOC
|
#if BROKEN_REALLOC
|
||||||
if ((pathList==NULL) &&
|
if ((pathList==NULL) &&
|
||||||
((pathList = malloc((pathSlots+1) * sizeof(char *)))==NULL)) {
|
((pathList = malloc((pathSlots+1) * sizeof(char *)))==NULL)) {
|
||||||
fprintf(stderr,"%s: Couldn't expand pathList\n",program_name);
|
fprintf(stderr,"%s: Couldn't expand pathList\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
} else {
|
} else {
|
||||||
if ((p = realloc(pathList, (pathSlots+1) * sizeof(char *)))==NULL) {
|
if ((p = realloc(pathList, (pathSlots+1) * sizeof(char *)))==NULL) {
|
||||||
fprintf(stderr,"%s: Couldn't expand pathList\n",program_name);
|
fprintf(stderr,"%s: Couldn't expand pathList\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
pathList = p;
|
pathList = p;
|
||||||
}
|
}
|
||||||
@@ -823,7 +835,7 @@ void add_to_pathList(char *thisdir, char *file) {
|
|||||||
pathList[pathSlotsUsed] = malloc(strlen(thisdir)+strlen(file)+2);
|
pathList[pathSlotsUsed] = malloc(strlen(thisdir)+strlen(file)+2);
|
||||||
if (pathList[pathSlotsUsed] == NULL) {
|
if (pathList[pathSlotsUsed] == NULL) {
|
||||||
fprintf(stderr,"%s: Couldn't duplicate filename %s%c%s\n",program_name,
|
fprintf(stderr,"%s: Couldn't duplicate filename %s%c%s\n",program_name,
|
||||||
thisdir,dirbrk,file);
|
thisdir,dirbrk,file);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (*thisdir) {
|
if (*thisdir) {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Header file for routines common to both the Unix and Apple IIgs versions.
|
* Header file for routines common to both the Unix and Apple IIgs versions.
|
||||||
*
|
*
|
||||||
* $Id: common.h,v 1.1 1994/12/13 18:08:23 gdr Exp $
|
* $Id: common.h,v 1.2 1995/02/08 05:05:40 gdr Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1993-1994 Soenke Behrens
|
* Copyright (c) 1993-1994 Soenke Behrens
|
||||||
*/
|
*/
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
#define BUFFERSIZE 0x2000
|
#define BUFFERSIZE 0x2000
|
||||||
#define PATHLIST_QUANTUM 20
|
#define PATHLIST_QUANTUM 20
|
||||||
#define UDL_VERSION "Version 1.13"
|
#define UDL_VERSION "Version 1.13"
|
||||||
|
#define STACKSIZE 2048
|
||||||
|
#define BYTES_PER_DEPTH 40
|
||||||
|
#define BASESIZE 700
|
||||||
|
|
||||||
#ifndef FALSE
|
#ifndef FALSE
|
||||||
# define FALSE 0
|
# define FALSE 0
|
||||||
|
9
usr.orca.bin/udl/describe.udl
Normal file
9
usr.orca.bin/udl/describe.udl
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Name: udl
|
||||||
|
Version: 1.13
|
||||||
|
Author: Soenke Behrens
|
||||||
|
Contact: soenke.behrens@conner.com
|
||||||
|
Where: /usr/local/bin
|
||||||
|
FTP: cco.caltech.edu, grind.isca.uiowa.edu
|
||||||
|
|
||||||
|
Converts text between the CR, LF and CR/LF forms. Also available for
|
||||||
|
Unix machines, reasonably fast yet secure.
|
@@ -1,6 +1,6 @@
|
|||||||
.\" Copyright (c) 1993-1994 Soenke Behrens
|
.\" Copyright (c) 1993-1994 Soenke Behrens
|
||||||
.\" $Id: udl.1,v 1.1 1994/12/13 18:08:26 gdr Exp $
|
.\" $Id: udl.1,v 1.2 1995/02/08 05:05:42 gdr Exp $
|
||||||
.TH UDL 1 "22 November 1994" "Version 1.13" "Commands and Applications"
|
.TH UDL 1 "Commands and Applications" "22 November 1994" "Version 1.13"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
udl - convert text files between different architectures
|
udl - convert text files between different architectures
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@@ -16,10 +16,25 @@ udl - convert text files between different architectures
|
|||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B udl
|
.B udl
|
||||||
converts files between different computer systems by changing the EOL
|
converts files between different computer systems by changing the EOL
|
||||||
(End-Of-Line) character. It does
|
(End-Of-Line) character.
|
||||||
.I not
|
.PP
|
||||||
do a plausability check, so the user has to make sure udl is not invoked
|
On the Apple IIgs,
|
||||||
on object files or the like.
|
.B udl
|
||||||
|
will skip any file that is not of type TXT or SRC.
|
||||||
|
No notice is given of this unless the
|
||||||
|
.B -v
|
||||||
|
flag is used.
|
||||||
|
Since Unix file systems do not have file types
|
||||||
|
.BR udl
|
||||||
|
is limited in the types of checks which it can carry out,
|
||||||
|
so the user must take care that
|
||||||
|
it is not invoked on object files or the like. On both platforms, if
|
||||||
|
.I file
|
||||||
|
appears to be a binary file (that is, no EOL is
|
||||||
|
found in the first part of the file), the file will be skipped.
|
||||||
|
Again, no notice is given of this unless the
|
||||||
|
.B -v
|
||||||
|
flag is used.
|
||||||
.PP
|
.PP
|
||||||
.B udl
|
.B udl
|
||||||
creates a temporary file the size of the file it is currently working on
|
creates a temporary file the size of the file it is currently working on
|
||||||
@@ -55,14 +70,6 @@ one file). For conversions to or from MS-DOS,
|
|||||||
.B udl
|
.B udl
|
||||||
is always pedantic, so this only affects conversions from Unix to Apple
|
is always pedantic, so this only affects conversions from Unix to Apple
|
||||||
or vice versa. Being pedantic slows udl down by a factor of 1.5.
|
or vice versa. Being pedantic slows udl down by a factor of 1.5.
|
||||||
.PP
|
|
||||||
If
|
|
||||||
.B udl
|
|
||||||
is given a file that seems to be a binary file \(that is, no EOL is
|
|
||||||
found in the first part of the file\), the file will be skipped. No
|
|
||||||
notice is given of this unless the
|
|
||||||
.B -v
|
|
||||||
flag is used.
|
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
When compiling on some Solaris installations, files within subdirectories
|
When compiling on some Solaris installations, files within subdirectories
|
||||||
do not get their names properly resolved.
|
do not get their names properly resolved.
|
||||||
@@ -71,6 +78,15 @@ This seems to be due to bad definitions in
|
|||||||
If you have access to SunOS 4.x,
|
If you have access to SunOS 4.x,
|
||||||
.BR udl
|
.BR udl
|
||||||
can be compiled there and used under Solaris.
|
can be compiled there and used under Solaris.
|
||||||
|
.PP
|
||||||
|
When running under Gno on the Apple IIgs, there is a limit to the nesting
|
||||||
|
depth when recusing on subdirectories. This is because the routine that
|
||||||
|
is responsible for this behavior is itself recursive. The default 2k
|
||||||
|
stack size will allow about 33 levels of nested directories, so this limit
|
||||||
|
should not normally be a problem. If the limit is exceeded,
|
||||||
|
.BR udl
|
||||||
|
will exit with an error message before any files are changed, and before
|
||||||
|
the stack actually overflows.
|
||||||
.LP
|
.LP
|
||||||
If you find any other bugs, please send a report to the address given below.
|
If you find any other bugs, please send a report to the address given below.
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Apple IIgs specific routines.
|
* Apple IIgs specific routines.
|
||||||
*
|
*
|
||||||
* $Id: udlgs.c,v 1.1 1994/12/13 18:08:29 gdr Exp $
|
* $Id: udlgs.c,v 1.2 1995/02/08 05:05:46 gdr Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1993-1994 Soenke Behrens
|
* Copyright (c) 1993-1994 Soenke Behrens
|
||||||
*/
|
*/
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#define QUITFLAG 0x4000 /* udl is restartable */
|
#define QUITFLAG 0x4000 /* udl is restartable */
|
||||||
|
#define DIRECTORY 0x0F
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Globals
|
* Globals
|
||||||
@@ -65,6 +66,7 @@ int main(int argc,char *argv[]) {
|
|||||||
pathSlots = 0;
|
pathSlots = 0;
|
||||||
pathList = NULL;
|
pathList = NULL;
|
||||||
*currentDirectory = '\0';
|
*currentDirectory = '\0';
|
||||||
|
recursionDepth=0;
|
||||||
|
|
||||||
#ifdef CHECK_STACK
|
#ifdef CHECK_STACK
|
||||||
begin_stack_check();
|
begin_stack_check();
|
||||||
@@ -79,7 +81,7 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
if (right_shell_version() == FALSE) {
|
if (right_shell_version() == FALSE) {
|
||||||
fprintf(stderr,"%s requires at least ORCA/Shell 2.0"
|
fprintf(stderr,"%s requires at least ORCA/Shell 2.0"
|
||||||
" or GNO/ME 1.0\n", argv[0]);
|
" or GNO/ME 1.0\n", argv[0]);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,27 +111,27 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
||||||
fprintf(stderr, "%s: You may not "
|
fprintf(stderr, "%s: You may not "
|
||||||
"specify more than one conversion option\n",program_name);
|
"specify more than one conversion option\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
Tunix = TRUE;
|
Tunix = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
||||||
fprintf(stderr, "%s: You may not "
|
fprintf(stderr, "%s: You may not "
|
||||||
"specify more than one conversion option\n",program_name);
|
"specify more than one conversion option\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
Messy = TRUE;
|
Messy = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
||||||
fprintf(stderr, "%s: You may not "
|
fprintf(stderr, "%s: You may not "
|
||||||
"specify more than one conversion option\n",program_name);
|
"specify more than one conversion option\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
GS = TRUE;
|
GS = TRUE;
|
||||||
break;
|
break;
|
||||||
@@ -156,7 +158,7 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
if (Tunix == FALSE && GS == FALSE && Messy == FALSE) {
|
if (Tunix == FALSE && GS == FALSE && Messy == FALSE) {
|
||||||
fprintf(stderr,"%s: You have to specify a destination "
|
fprintf(stderr,"%s: You have to specify a destination "
|
||||||
"format.\n",program_name);
|
"format.\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +179,11 @@ int main(int argc,char *argv[]) {
|
|||||||
rsp.bufSize = 259;
|
rsp.bufSize = 259;
|
||||||
NextWild.pathName = &rsp;
|
NextWild.pathName = &rsp;
|
||||||
InitWild.wFile = &gsp;
|
InitWild.wFile = &gsp;
|
||||||
InitWild.flags = 0x8000 | 0x2000 | 0x1000;
|
if (R_flag) {
|
||||||
|
InitWild.flags = 0x2000 | 0x1000;
|
||||||
|
} else {
|
||||||
|
InitWild.flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* loop through all command line args */
|
/* loop through all command line args */
|
||||||
for (; optind < argc; optind++) {
|
for (; optind < argc; optind++) {
|
||||||
@@ -192,33 +198,33 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
/* loop through all matches of wildcards */
|
/* loop through all matches of wildcards */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
NextWildcardGS (&NextWild);
|
NextWildcardGS (&NextWild);
|
||||||
if (toolerror()) {
|
if (toolerror()) {
|
||||||
fprintf(stderr,"%s: Fatal internal error, "
|
fprintf(stderr,"%s: Fatal internal error, "
|
||||||
"exiting\n", program_name);
|
"exiting\n", program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No further file found by NextWildcardGS */
|
/* No further file found by NextWildcardGS */
|
||||||
if(!rsp.bufString.length)
|
if(!rsp.bufString.length)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
num_of_files++;
|
num_of_files++;
|
||||||
|
|
||||||
if((current_file = calloc(1,rsp.bufString.length + 1)) == NULL) {
|
if((current_file = calloc(1,rsp.bufString.length + 1)) == NULL) {
|
||||||
fprintf(stderr,"%s: memory allocation failure\n",program_name);
|
fprintf(stderr,"%s: memory allocation failure\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
strncpy(current_file, rsp.bufString.text,rsp.bufString.length);
|
strncpy(current_file, rsp.bufString.text,rsp.bufString.length);
|
||||||
|
|
||||||
add_to_pathList("",current_file);
|
add_to_pathList("",current_file);
|
||||||
free(current_file);
|
free(current_file);
|
||||||
current_file = NULL;
|
current_file = NULL;
|
||||||
} /* for (;;) */
|
} /* for (;;) */
|
||||||
|
|
||||||
if (num_of_files == 0)
|
if (num_of_files == 0)
|
||||||
fprintf(stderr,"%s: No files found that match %s\n",
|
fprintf(stderr,"%s: No files found that match %s\n",
|
||||||
program_name,argv[optind]);
|
program_name,argv[optind]);
|
||||||
} /* for (; optind < argc; optind++) */
|
} /* for (; optind < argc; optind++) */
|
||||||
}
|
}
|
||||||
/* gsh or other Gno shell */
|
/* gsh or other Gno shell */
|
||||||
@@ -244,8 +250,6 @@ int main(int argc,char *argv[]) {
|
|||||||
current_file = *p;
|
current_file = *p;
|
||||||
|
|
||||||
if (CheckGSOSType (current_file) == FALSE) {
|
if (CheckGSOSType (current_file) == FALSE) {
|
||||||
fprintf(stderr,"%s: %s is not of type TXT or "
|
|
||||||
"SRC ... skipping\n",program_name,current_file);
|
|
||||||
p++;
|
p++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -260,18 +264,18 @@ int main(int argc,char *argv[]) {
|
|||||||
converted = TRUE; /* always */
|
converted = TRUE; /* always */
|
||||||
|
|
||||||
if (GS)
|
if (GS)
|
||||||
convert_gs(infile,outfile);
|
convert_gs(infile,outfile);
|
||||||
else if (Tunix)
|
else if (Tunix)
|
||||||
convert_tunix(infile,outfile);
|
convert_tunix(infile,outfile);
|
||||||
else
|
else
|
||||||
convert_messy(infile,outfile);
|
convert_messy(infile,outfile);
|
||||||
} else {
|
} else {
|
||||||
if (GS)
|
if (GS)
|
||||||
converted = convert_fast_gs(infile,outfile);
|
converted = convert_fast_gs(infile,outfile);
|
||||||
else if (Tunix)
|
else if (Tunix)
|
||||||
converted = convert_fast_tunix(infile,outfile);
|
converted = convert_fast_tunix(infile,outfile);
|
||||||
else
|
else
|
||||||
converted = convert_fast_messy(infile,outfile);
|
converted = convert_fast_messy(infile,outfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclose (infile) == EOF || fclose (outfile) == EOF) {
|
if (fclose (infile) == EOF || fclose (outfile) == EOF) {
|
||||||
@@ -281,14 +285,14 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
if (converted) { /* Temp file contains converted data */
|
if (converted) { /* Temp file contains converted data */
|
||||||
if (remove (current_file) != 0) {
|
if (remove (current_file) != 0) {
|
||||||
perror ("removing original file");
|
perror ("removing original file");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rename (tempfile,current_file) != 0) {
|
if (rename (tempfile,current_file) != 0) {
|
||||||
copy_file (tempfile,current_file);
|
copy_file (tempfile,current_file);
|
||||||
remove (tempfile);
|
remove (tempfile);
|
||||||
tempfile = NULL;
|
tempfile = NULL;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
remove (tempfile);
|
remove (tempfile);
|
||||||
@@ -331,13 +335,16 @@ int CheckGSOSType(char *name) {
|
|||||||
|
|
||||||
if (toolerror()) {
|
if (toolerror()) {
|
||||||
fprintf (stderr,"%s: GS/OS error on %s: 0x%04X\n",
|
fprintf (stderr,"%s: GS/OS error on %s: 0x%04X\n",
|
||||||
program_name,name,toolerror());
|
program_name,name,toolerror());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((fir.fileType != TXT) && (fir.fileType != SRC))
|
if ((fir.fileType != TXT) && (fir.fileType != SRC)) {
|
||||||
|
if (verbose && (fir.fileType != DIRECTORY))
|
||||||
|
fprintf(stderr,"%s: %s is not of type TXT or "
|
||||||
|
"SRC ... skipping\n",program_name,current_file);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
else {
|
} else {
|
||||||
theType = fir.fileType;
|
theType = fir.fileType;
|
||||||
theAuxType = fir.auxType;
|
theAuxType = fir.auxType;
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
@@ -372,7 +379,7 @@ void SetGSOSType (char *name, int type, int auxtype) {
|
|||||||
|
|
||||||
if (toolerror()) {
|
if (toolerror()) {
|
||||||
fprintf (stderr,"%s: GS/OS error on %s: 0x%04X\n",
|
fprintf (stderr,"%s: GS/OS error on %s: 0x%04X\n",
|
||||||
program_name,name,toolerror());
|
program_name,name,toolerror());
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Unix specific routines.
|
* Unix specific routines.
|
||||||
*
|
*
|
||||||
* $Id: udlunix.c,v 1.1 1994/12/13 18:08:32 gdr Exp $
|
* $Id: udlunix.c,v 1.2 1995/02/08 05:05:48 gdr Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1993-1994 Soenke Behrens
|
* Copyright (c) 1993-1994 Soenke Behrens
|
||||||
*/
|
*/
|
||||||
@@ -33,6 +33,7 @@ int main(int argc,char *argv[]) {
|
|||||||
pathSlots = 0;
|
pathSlots = 0;
|
||||||
pathList = NULL;
|
pathList = NULL;
|
||||||
*currentDirectory = '\0';
|
*currentDirectory = '\0';
|
||||||
|
recursionDepth=0;
|
||||||
|
|
||||||
/* In case of exit(), free the mem I allocated */
|
/* In case of exit(), free the mem I allocated */
|
||||||
#ifdef HAS_ATEXIT
|
#ifdef HAS_ATEXIT
|
||||||
@@ -64,31 +65,31 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
||||||
fprintf(stderr, "%s: You may not "
|
fprintf(stderr, "%s: You may not "
|
||||||
"specify more than one conversion option\n",program_name);
|
"specify more than one conversion option\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
Tunix = TRUE;
|
Tunix = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
||||||
fprintf(stderr, "%s: You may not specify more than one "
|
fprintf(stderr, "%s: You may not specify more than one "
|
||||||
"conversion option\n",program_name);
|
"conversion option\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
Messy = TRUE;
|
Messy = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
if (Tunix == TRUE || Messy == TRUE || GS == TRUE) {
|
||||||
fprintf(stderr, "%s: You may not specify more than one "
|
fprintf(stderr, "%s: You may not specify more than one "
|
||||||
"conversion option\n",program_name);
|
"conversion option\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
GS = TRUE;
|
GS = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
R_flag++;
|
R_flag++;
|
||||||
break;
|
break;
|
||||||
@@ -96,7 +97,7 @@ int main(int argc,char *argv[]) {
|
|||||||
case '?':
|
case '?':
|
||||||
usage();
|
usage();
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf (stderr, "%s: Internal getopt error\n", program_name);
|
fprintf (stderr, "%s: Internal getopt error\n", program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
@@ -112,7 +113,7 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
if (Tunix == FALSE && GS == FALSE && Messy == FALSE) {
|
if (Tunix == FALSE && GS == FALSE && Messy == FALSE) {
|
||||||
fprintf(stderr,"%s: You have to specify a destination "
|
fprintf(stderr,"%s: You have to specify a destination "
|
||||||
"format.\n",program_name);
|
"format.\n",program_name);
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,7 +153,7 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
if (verbose == TRUE) {
|
if (verbose == TRUE) {
|
||||||
printf("%s: Working on %s\n",program_name,
|
printf("%s: Working on %s\n",program_name,
|
||||||
current_file);
|
current_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
infile = tryopen(current_file,"rwb");
|
infile = tryopen(current_file,"rwb");
|
||||||
@@ -162,18 +163,18 @@ int main(int argc,char *argv[]) {
|
|||||||
converted = TRUE; /* always */
|
converted = TRUE; /* always */
|
||||||
|
|
||||||
if (GS)
|
if (GS)
|
||||||
convert_gs(infile,outfile);
|
convert_gs(infile,outfile);
|
||||||
else if (Tunix)
|
else if (Tunix)
|
||||||
convert_tunix(infile,outfile);
|
convert_tunix(infile,outfile);
|
||||||
else
|
else
|
||||||
convert_messy(infile,outfile);
|
convert_messy(infile,outfile);
|
||||||
} else {
|
} else {
|
||||||
if (GS)
|
if (GS)
|
||||||
converted = convert_fast_gs(infile,outfile);
|
converted = convert_fast_gs(infile,outfile);
|
||||||
else if (Tunix)
|
else if (Tunix)
|
||||||
converted = convert_fast_tunix(infile,outfile);
|
converted = convert_fast_tunix(infile,outfile);
|
||||||
else
|
else
|
||||||
converted = convert_fast_messy(infile,outfile);
|
converted = convert_fast_messy(infile,outfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclose (infile) == EOF || fclose (outfile) == EOF) {
|
if (fclose (infile) == EOF || fclose (outfile) == EOF) {
|
||||||
@@ -183,14 +184,14 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
if (converted) { /* Temp file contains converted data */
|
if (converted) { /* Temp file contains converted data */
|
||||||
if (remove (current_file) != 0) {
|
if (remove (current_file) != 0) {
|
||||||
perror ("removing original file");
|
perror ("removing original file");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rename (tempfile,current_file) != 0) {
|
if (rename (tempfile,current_file) != 0) {
|
||||||
copy_file (tempfile,current_file);
|
copy_file (tempfile,current_file);
|
||||||
remove (tempfile);
|
remove (tempfile);
|
||||||
tempfile = NULL;
|
tempfile = NULL;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
remove (tempfile);
|
remove (tempfile);
|
||||||
@@ -202,5 +203,3 @@ int main(int argc,char *argv[]) {
|
|||||||
|
|
||||||
return (EXIT_SUCCESS);
|
return (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* Usage strings.
|
* Usage strings.
|
||||||
*
|
*
|
||||||
* $Id: udluse.c,v 1.1 1994/12/13 18:08:34 gdr Exp $
|
* $Id: udluse.c,v 1.2 1995/02/08 05:05:49 gdr Exp $
|
||||||
*
|
*
|
||||||
* Copyright (c) 1993-1994 Soenke Behrens
|
* Copyright (c) 1993-1994 Soenke Behrens
|
||||||
*/
|
*/
|
||||||
@@ -23,7 +23,6 @@ char use1 [] =
|
|||||||
"written when it is done.\n";
|
"written when it is done.\n";
|
||||||
|
|
||||||
char use2 [] =
|
char use2 [] =
|
||||||
"files may contain ORCA/Shell style wildcards.\n\n";
|
"\nFiles may contain ORCA/Shell style wildcards.\n";
|
||||||
|
|
||||||
/* End Of File */
|
/* End Of File */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user