mirror of
https://github.com/GnoConsortium/gno.git
synced 2025-02-22 08:29:09 +00:00
Fixed bug (via the BROKEN_DIRENT_STRUCT macro) that was causing
filename-munging on Solaris. It seems that the sys/stat.h header file doesn't agree with the stat implementation. Modified Makefile.gs to properly write the new executable over the old resource fork for udl. The resource fork originates with the file udl.r. Added suggested defines to the README for various Unix platforms. Man page changes, including grammar and the deletion of a bug that no longer exists. Fixed bug where invoking 'udl -u directory' would attempt to deref a NULL pointer, causing either memory tromping (IIgs) or a core dump (Unix). Tested under SunOS 4.x, SunOS 5.x (Solaris), and AIX.
This commit is contained in:
parent
89c33fa060
commit
3cef5cabcf
@ -3,7 +3,7 @@
|
||||
# Copyright (c) 1993-1994 Soenke Behrens
|
||||
# For use with dmake
|
||||
#
|
||||
# $Id: Makefile.gs,v 1.5 1995/02/08 05:47:43 gdr Exp $
|
||||
# $Id: Makefile.gs,v 1.6 1995/02/08 06:12:27 gdr Exp $
|
||||
#
|
||||
# Define the following as necessary:
|
||||
#
|
||||
@ -37,7 +37,9 @@ LDFLAGS = -v -l/usr/lib/gnulib -s2048
|
||||
#
|
||||
|
||||
udl: udl.o udluse.o udl.r common.o globals.o
|
||||
# cp udl.r udl
|
||||
-$(RM) udl
|
||||
cp udl.r udl
|
||||
chtyp -texe udl
|
||||
$(CC) $(LDFLAGS) -o udl udl.o udluse.o common.o globals.o
|
||||
|
||||
udl.o: udl.gs.c common.h
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Makefile for udl
|
||||
# (c) 1993-1994 Soenke Behrens
|
||||
#
|
||||
# $Id: Makefile.unx,v 1.5 1995/02/08 05:47:44 gdr Exp $
|
||||
# $Id: Makefile.unx,v 1.6 1995/02/08 06:12:29 gdr Exp $
|
||||
#
|
||||
# Define the following as necessary:
|
||||
#
|
||||
@ -11,11 +11,17 @@
|
||||
# _POSIX_C_SOURCE and _POSIX_SOURCE if your compiler is Posix compliant
|
||||
#
|
||||
# READDIR_RETURNS_DOT if your direct readdir() function will return
|
||||
# entries for "." and "..". SunOS4 is known to do this.
|
||||
# entries for "." and "..". SunOS 4.x and 5.x (Solaris) are known to
|
||||
# do this.
|
||||
#
|
||||
# BROKEN_REALLOC if your realloc() doesn't behave like malloc() when
|
||||
# passed a NULL pointer as the first argument.
|
||||
#
|
||||
# BROKEN_DIRENT_STRUCT if you find that the first two letters of
|
||||
# filenames obtained during directory recursion (as shown when the
|
||||
# "-v" flag is used) seem to be missing. Some installations of
|
||||
# Solaris are known to do this.
|
||||
#
|
||||
|
||||
# If you're on SunOS 4.x systems, use gcc instead; this is ANSI code.
|
||||
CC = cc
|
||||
@ -24,18 +30,22 @@ BINDIR = bin
|
||||
MANDIR = man/man1
|
||||
INSTALL = cp -f
|
||||
|
||||
DEFINES = -DREADDIR_RETURNS_DOT=1 -DBROKEN_REALLOC=1 -D_POSIX_C_SOURCE \
|
||||
-D_POSIX_SOURCE
|
||||
# These are Solaris defines. See previous comments.
|
||||
DEFINES = -DREADDIR_RETURNS_DOT -D_POSIX_C_SOURCE -D_POSIX_SOURCE \
|
||||
-DBROKEN_DIRENT_STRUCT
|
||||
|
||||
CFLAGS = $(DEFINES) -O
|
||||
# You may need -lucb in LDFLAGS
|
||||
LDFLAGS =
|
||||
# You may need -lucb in LDLIBS
|
||||
LDLIBS = -lucb
|
||||
OBJS = udl.o udluse.o common.o globals.o
|
||||
|
||||
#
|
||||
# You should not have to modify anything beyond this point
|
||||
#
|
||||
|
||||
udl: udl.o udluse.o common.o globals.o
|
||||
$(CC) $(LDFLAGS) -o udl udl.o udluse.o common.o globals.o
|
||||
udl: $(OBJS)
|
||||
$(CC) $(LDFLAGS) -o udl $(OBJS) $(LDLIBS)
|
||||
|
||||
udl.o: udl.unix.c common.h
|
||||
$(CC) -c $(CFLAGS) -o udl.o udl.unix.c
|
||||
@ -45,13 +55,12 @@ install:
|
||||
$(INSTALL) udl.1 $(DESTDIR)$(MANDIR)
|
||||
|
||||
clean:
|
||||
rm *.o
|
||||
-rm *.o *~ core
|
||||
|
||||
clobber: clean
|
||||
rm udl
|
||||
-rm udl
|
||||
|
||||
dist:
|
||||
@echo 'Sorry, automatic packing not yet supported.'
|
||||
|
||||
common.o::common.h
|
||||
globals.o::common.h
|
||||
udluse.o common.o globals.o:: common.h
|
||||
|
@ -2,9 +2,9 @@
|
||||
udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF),
|
||||
and Apple (CR).
|
||||
|
||||
(c) 1993-1995 Soenke Behrens, Devin Glyn Reade
|
||||
(c) 1993-1995 Soenke Behrens, Devin Reade
|
||||
|
||||
Version 1.14: $Id: README,v 1.5 1995/02/08 05:47:46 gdr Exp $
|
||||
Version 1.14: $Id: README,v 1.6 1995/02/08 06:12:31 gdr Exp $
|
||||
=============================================================================
|
||||
|
||||
Udl converts text files between CR, LF and CR/LF (Apple, Unix and MS-DOS).
|
||||
@ -51,12 +51,25 @@ v1.13
|
||||
unless the -v option is specified.
|
||||
|
||||
v1.14
|
||||
(Soenke Behrens, January 1995)
|
||||
(Soenke Behrens, Devin Reade, February 1995)
|
||||
udl creates a temporary file in the directory of the
|
||||
source file, not in /tmp. This reduces the likelihood of
|
||||
data loss in the event of a system crash or powerdown.
|
||||
source file, not in /tmp. This reduces the likelihood of
|
||||
data loss in the event of a system crash or powerdown.
|
||||
udl now accepts something like "udl -R directory/" without
|
||||
affixing an extra '/' to "directory/".
|
||||
affixing an extra '/' to "directory/".
|
||||
Fixed bug (via the BROKEN_DIRENT_STRUCT macro) that was causing
|
||||
filename-munging on Solaris. It seems that the sys/stat.h header
|
||||
file doesn't agree with the stat implementation.
|
||||
Modified Makefile.gs to properly write the new executable over
|
||||
the old resource fork for udl. The resource fork originates with
|
||||
the file udl.r.
|
||||
Added suggested defines to the README for various Unix platforms.
|
||||
Man page changes, including grammar and the deletion of a bug that
|
||||
no longer exists.
|
||||
Fixed bug where invoking 'udl -u directory' would attempt to
|
||||
deref a NULL pointer, causing either memory tromping (IIgs) or
|
||||
a core dump (Unix).
|
||||
Tested under SunOS 4.x, SunOS 5.x (Solaris), and AIX.
|
||||
|
||||
=========
|
||||
Compiling:
|
||||
@ -71,7 +84,18 @@ it cannot be built with the standard Orca installation due to a lack
|
||||
of additional libraries.
|
||||
|
||||
Before you type "make", have a look at the Makefile and edit the defines
|
||||
to your liking.
|
||||
to your liking. Proper defines for Unix systems should be as follows:
|
||||
|
||||
SunOS 4.x: (tested with gcc)
|
||||
-DREADDIR_RETURNS_DOT -DBROKEN_REALLOC
|
||||
-D_POSIX_C_SOURCE -D_POSIX_SOURCE
|
||||
|
||||
SunOS 5.x (Solaris): (tested with SUNWspro cc)
|
||||
-DREADDIR_RETURNS_DOT -DBROKEN_DIRENT_STRUCT
|
||||
-D_POSIX_C_SOURCE -D_POSIX_SOURCE
|
||||
|
||||
AIX 3.2: (tested with xlc)
|
||||
-DBROKEN_REALLOC -D_POSIX_C_SOURCE -D_POSIX_SOURCE
|
||||
|
||||
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
|
||||
@ -81,14 +105,14 @@ these includes if that's not the case.
|
||||
Authors
|
||||
=======
|
||||
|
||||
Original code by Soenke Behrens, sbehrens@contech.demon.co.uk
|
||||
Modifications and version-merging by Devin Reade, gdr@myrias.ab.ca
|
||||
Original code by Soenke Behrens <sbehrens@contech.demon.co.uk>
|
||||
with modifications and version-merging by Devin Reade <gdr@myrias.ab.ca>
|
||||
|
||||
==========
|
||||
Legalities:
|
||||
==========
|
||||
|
||||
This program contains material from the Orca/C Run-Time Libraries,
|
||||
copyright 1987-1994 by Byte Works, Inc. Used with permission.
|
||||
copyright 1987-1995 by Byte Works, Inc. Used with permission.
|
||||
|
||||
=============================================================================
|
||||
|
@ -7,9 +7,9 @@
|
||||
*
|
||||
* Routines common to both the Unix and Apple IIgs versions.
|
||||
*
|
||||
* $Id: common.c,v 1.5 1995/02/08 05:47:48 gdr Exp $
|
||||
* $Id: common.c,v 1.6 1995/02/08 06:12:33 gdr Exp $
|
||||
*
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
|
||||
*/
|
||||
|
||||
#ifdef GNO
|
||||
@ -644,7 +644,9 @@ void cleanup (void) {
|
||||
|
||||
void usage (void) {
|
||||
extern char use1[]; /* from udluse.c */
|
||||
#ifdef GNO
|
||||
extern char use2[];
|
||||
#endif
|
||||
|
||||
fprintf(stderr,"%s",use1);
|
||||
#ifdef GNO
|
||||
@ -672,7 +674,7 @@ void usage (void) {
|
||||
*/
|
||||
|
||||
|
||||
void build_file_list(const char *file, short recurse) {
|
||||
void build_file_list(char *file, short recurse) {
|
||||
char *thisdir;
|
||||
DIR *dir;
|
||||
struct dirent *entry;
|
||||
@ -736,7 +738,11 @@ void build_file_list(const char *file, short recurse) {
|
||||
|
||||
while ((entry = readdir(dir))!=NULL) {
|
||||
/* ignore hidden files */
|
||||
#ifdef BROKEN_DIRENT_STRUCT
|
||||
if (*(entry->d_name)!='.') build_file_list((entry->d_name)-2,1);
|
||||
#else
|
||||
if (*(entry->d_name)!='.') build_file_list(entry->d_name,1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (*thisdir) {
|
||||
|
@ -4,9 +4,9 @@
|
||||
*
|
||||
* Header file for routines common to both the Unix and Apple IIgs versions.
|
||||
*
|
||||
* $Id: common.h,v 1.5 1995/02/08 05:47:50 gdr Exp $
|
||||
* $Id: common.h,v 1.6 1995/02/08 06:12:36 gdr Exp $
|
||||
*
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -81,7 +81,7 @@ extern int my_fread (FILE *infile, int howmuch);
|
||||
extern void my_fwrite (unsigned char *buffer, FILE *outfile, int howmuch);
|
||||
extern void cleanup (void);
|
||||
extern void usage (void);
|
||||
extern void build_file_list(const char *file, short recurse);
|
||||
extern void build_file_list(char *file, short recurse);
|
||||
extern void add_to_pathList(char *thisdir, char *file);
|
||||
extern char *mktemp(const char *base);
|
||||
extern char *get_path(const char *name);
|
||||
@ -89,7 +89,10 @@ extern char *get_path(const char *name);
|
||||
extern int needsgno(void);
|
||||
|
||||
/* not strictly necessary, but it cuts down on warnings from gcc */
|
||||
#ifdef __GNUC__
|
||||
#if defined(__GNUC__) || defined(_AIX)
|
||||
extern char *getwd(char *);
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
extern char getopt(int, char **, char *);
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: udl
|
||||
Version: 1.14
|
||||
Author: Soenke Behrens, Devin Glyn Reade
|
||||
Author: Soenke Behrens, Devin Reade
|
||||
Contact: sbehrens@contech.demon.co.uk, gdr@myrias.ab.ca
|
||||
Where: /usr/local/bin
|
||||
FTP: ftp.cco.caltech.edu, grind.isca.uiowa.edu
|
||||
|
@ -7,9 +7,9 @@
|
||||
*
|
||||
* Contains definitions of global variables declared in common.h
|
||||
*
|
||||
* $Id: globals.c,v 1.2 1995/02/08 05:47:52 gdr Exp $
|
||||
* $Id: globals.c,v 1.3 1995/02/08 06:12:38 gdr Exp $
|
||||
*
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
|
||||
*/
|
||||
|
||||
#ifdef GNO
|
||||
|
@ -1,6 +1,7 @@
|
||||
.\" Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
|
||||
.\" $Id: udl.1,v 1.5 1995/02/08 05:47:53 gdr Exp $
|
||||
.TH UDL 1 "Commands and Applications" "28 January 1995" "Version 1.14"
|
||||
.\" Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
|
||||
.\" $Id: udl.1,v 1.6 1995/02/08 06:12:40 gdr Exp $
|
||||
.\"
|
||||
.TH UDL 1 "Commands and Applications" "7 February 1995" "Version 1.14"
|
||||
.SH NAME
|
||||
udl - convert text files between different architectures
|
||||
.SH SYNOPSIS
|
||||
@ -31,14 +32,18 @@ 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.
|
||||
found in the first part of the file) then
|
||||
.I file
|
||||
will be skipped.
|
||||
Again, no notice is given of this unless the
|
||||
.B -v
|
||||
flag is used.
|
||||
.PP
|
||||
During file conversion
|
||||
.B udl
|
||||
creates a temporary file the size of the file it is currently working on
|
||||
during conversion.
|
||||
creates a temporary file in the same directory as the orginal file.
|
||||
The temporary file is close to or exactly the same size as the original
|
||||
file.
|
||||
.PP
|
||||
When running under Byteworks' ORCA shell, the Orca shell wildcards
|
||||
.BR =
|
||||
@ -65,20 +70,12 @@ switch,
|
||||
.B udl
|
||||
is pedantic while doing the conversion. This means: The input file may
|
||||
contain bytes with a value of zero (0), and the input file may contain
|
||||
different EOL characters (i.e., MS-DOS and Unix style might be mixed in
|
||||
one file). For conversions to or from MS-DOS,
|
||||
different EOL characters (ie: MS-DOS and Unix style might be mixed in
|
||||
one file). For conversions to or from MS-DOS
|
||||
.B udl
|
||||
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.
|
||||
.SH BUGS
|
||||
When compiling on some Solaris installations, files within subdirectories
|
||||
do not get their names properly resolved.
|
||||
This seems to be due to bad definitions in
|
||||
.IR <sys/stat.h> .
|
||||
If you have access to SunOS 4.x,
|
||||
.BR udl
|
||||
can be compiled there and used under Solaris.
|
||||
.PP
|
||||
.SH LIMITATIONS
|
||||
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
|
||||
@ -87,12 +84,13 @@ 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
|
||||
If you find any other bugs, please send a report to the address given below.
|
||||
.SH BUGS
|
||||
Bug reports should be directed to one of the two addresses below.
|
||||
.SH AUTHOR
|
||||
Soenke Behrens, sbehrens@contech.demon.co.uk
|
||||
.br
|
||||
Version 1.13 updated by Devin Reade, gdr@myrias.ab.ca
|
||||
Soenke Behrens <sbehrens@contech.demon.co.uk> with contributions by
|
||||
Devin Reade <gdr@myrias.ab.ca>.
|
||||
.\" .br
|
||||
.\" Version 1.13 updated by Devin Reade, gdr@myrias.ab.ca
|
||||
.SH VERSION
|
||||
This is
|
||||
.B udl
|
||||
|
@ -7,9 +7,9 @@
|
||||
*
|
||||
* Apple IIgs specific routines.
|
||||
*
|
||||
* $Id: udlgs.c,v 1.5 1995/02/08 05:47:55 gdr Exp $
|
||||
* $Id: udlgs.c,v 1.6 1995/02/08 06:12:44 gdr Exp $
|
||||
*
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
|
||||
*/
|
||||
|
||||
#include <orca.h>
|
||||
@ -249,6 +249,12 @@ int main(int argc,char *argv[]) {
|
||||
}
|
||||
}
|
||||
|
||||
/* files were all directories and no -R flag given */
|
||||
if (!pathList) {
|
||||
if (verbose) printf("%s: no files to process\n",program_name);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
p = pathList;
|
||||
while(*p) {
|
||||
current_file = *p;
|
||||
|
@ -7,9 +7,9 @@
|
||||
*
|
||||
* Unix specific routines.
|
||||
*
|
||||
* $Id: udlunix.c,v 1.5 1995/02/08 05:47:57 gdr Exp $
|
||||
* $Id: udlunix.c,v 1.6 1995/02/08 06:12:47 gdr Exp $
|
||||
*
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
@ -147,6 +147,12 @@ int main(int argc,char *argv[]) {
|
||||
*currentDirectory = '\0';
|
||||
}
|
||||
|
||||
/* files were all directories and no -R flag given */
|
||||
if (!pathList) {
|
||||
if (verbose) printf("%s: no files to process\n",program_name);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
for (c=0; pathList[c]; c++) {
|
||||
if((current_file = strdup(pathList[c])) == NULL) {
|
||||
fprintf(stderr,"%s: memory allocation failure\n", program_name);
|
||||
|
@ -7,9 +7,9 @@
|
||||
*
|
||||
* Usage strings.
|
||||
*
|
||||
* $Id: udluse.c,v 1.5 1995/02/08 05:47:59 gdr Exp $
|
||||
* $Id: udluse.c,v 1.6 1995/02/08 06:12:49 gdr Exp $
|
||||
*
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
|
||||
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
|
||||
*/
|
||||
|
||||
#ifdef GNO
|
||||
@ -17,7 +17,7 @@
|
||||
#endif
|
||||
|
||||
char use1 [] =
|
||||
"udl 1.14 by Soenke Behrens, Devin Glyn Reade\n"
|
||||
"udl 1.14 by Soenke Behrens, Devin Reade\n"
|
||||
"Usage: udl -u|g|m [-Rvp] file1 [file2 ...]\n\n"
|
||||
"Options:\n"
|
||||
" -u Convert file to use LF as EOL character.\n"
|
||||
@ -26,8 +26,8 @@ char use1 [] =
|
||||
" -R Recurse through subdirectories.\n"
|
||||
" -p Be pedantic.\n"
|
||||
" -v Be verbose about it.\n\n"
|
||||
"udl creates a temporary file in the directory of the original file,\n"
|
||||
"the original file is overwritten after conversion.\n";
|
||||
"udl creates a temporary file in the directory of the original file.\n"
|
||||
"The original file is overwritten after conversion.\n";
|
||||
|
||||
char use2 [] =
|
||||
"\nFiles may contain ORCA/Shell style wildcards.\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user