Soenke's 2 Feb 95 modifications to the v1.14 release.

Changed EXTERN to extern in common.h, and added globals.c to compensate.

Fixed bug in IIgs version where invoking "udl -<flags> filename/" (with
the trailing '/') would cause udl to fail due to bad filenames.

Added "help" subdirectory.  The file "help/udl" is created at build time,
and therefore not checked in.

Added some "#pragma noroot"s.
This commit is contained in:
gdr 1995-02-08 05:25:26 +00:00
parent 85008f04ca
commit c254e15a3b
9 changed files with 85 additions and 40 deletions

View File

@ -3,7 +3,7 @@
# Copyright (c) 1993-1994 Soenke Behrens
# For use with dmake
#
# $Id: Makefile.gs,v 1.3 1995/02/08 05:15:20 gdr Exp $
# $Id: Makefile.gs,v 1.4 1995/02/08 05:25:09 gdr Exp $
#
# Define the following as necessary:
#
@ -29,16 +29,18 @@
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 -w -v -s2048
#LDFLAGS = -v -l/usr/lib/gnulib -s2048
CFLAGS = $(DEFINES) -O -v -s2048
LDFLAGS = -v -s2048
#
# 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 globals.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 globals.o
udl.o: udl.gs.c common.h
$(CC) -c $(CFLAGS) -o udl.o udl.gs.c
@ -47,6 +49,9 @@ install:
cp -f udl /usr/local/bin
cp -f udl.1 /usr/man/man1
docs: udl.1
nroff -man udl.1 >help/udl
clean:
$(RM) *.o udl
@ -54,3 +59,4 @@ dist:
@echo "Sorry, automatic packing not supported yet"
common.o:: common.h
globals.o:: common.h

View File

@ -2,7 +2,7 @@
# Makefile for udl
# (c) 1993-1994 Soenke Behrens
#
# $Id: Makefile.unx,v 1.3 1995/02/08 05:15:22 gdr Exp $
# $Id: Makefile.unx,v 1.5 1995/02/08 05:47:44 gdr Exp $
#
# Define the following as necessary:
#
@ -34,8 +34,8 @@ LDFLAGS =
# You should not have to modify anything beyond this point
#
udl: udl.o udluse.o common.o
$(CC) $(LDFLAGS) -o udl udl.o udluse.o common.o
udl: udl.o udluse.o common.o globals.o
$(CC) $(LDFLAGS) -o udl udl.o udluse.o common.o globals.o
udl.o: udl.unix.c common.h
$(CC) -c $(CFLAGS) -o udl.o udl.unix.c
@ -54,3 +54,4 @@ dist:
@echo 'Sorry, automatic packing not yet supported.'
common.o::common.h
globals.o::common.h

View File

@ -4,7 +4,7 @@ udl - Convert EOL formats freely between MS-DOS (CR/LF), Unix/Amiga (LF),
(c) 1993-1995 Soenke Behrens, Devin Glyn Reade
Version 1.14: $Id: README,v 1.3 1995/02/08 05:15:24 gdr Exp $
Version 1.14: $Id: README,v 1.5 1995/02/08 05:47:46 gdr Exp $
=============================================================================
Udl converts text files between CR, LF and CR/LF (Apple, Unix and MS-DOS).
@ -55,6 +55,8 @@ v1.14
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.
udl now accepts something like "udl -R directory/" without
affixing an extra '/' to "directory/".
=========
Compiling:

View File

@ -4,11 +4,15 @@
*
* Routines common to both the Unix and Apple IIgs versions.
*
* $Id: common.c,v 1.3 1995/02/08 05:15:26 gdr Exp $
* $Id: common.c,v 1.4 1995/02/08 05:25:15 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
*/
#ifdef GNO
#pragma noroot
#endif
#include "common.h"
extern char *strdup(const char *);
@ -665,7 +669,7 @@ void usage (void) {
*/
void build_file_list(char *file, short recurse) {
void build_file_list(const char *file, short recurse) {
char *thisdir;
DIR *dir;
struct dirent *entry;
@ -709,6 +713,8 @@ void build_file_list(char *file, short recurse) {
if (*currentDirectory) strcat(currentDirectory,tstr);
strcat(currentDirectory,file);
if (currentDirectory[strlen(currentDirectory)-1] == dirbrk)
currentDirectory[strlen(currentDirectory)-1] = '\0';
/* recurse */
if ((dir = opendir(file)) == NULL) {

View File

@ -4,7 +4,7 @@
*
* Header file for routines common to both the Unix and Apple IIgs versions.
*
* $Id: common.h,v 1.3 1995/02/08 05:15:28 gdr Exp $
* $Id: common.h,v 1.5 1995/02/08 05:47:50 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
*/
@ -33,13 +33,6 @@
# define TRUE !FALSE
#endif
/* we use this macro for macro definitions/declarations */
#ifdef MAIN
# define EXTERN
#else
# define EXTERN extern
#endif
#ifndef EXIT_FAILURE
# define EXIT_FAILURE 1
# define EXIT_SUCCESS 0
@ -54,23 +47,23 @@
enum file_format { tunix = 1, dos, apple, binary };
/* Since udl is so small, I dare to use some globals :) */
EXTERN char *program_name; /* How was udl invoked? */
EXTERN char *current_file; /* Name of current file */
EXTERN char *tempfile; /* Name of temporary file */
EXTERN unsigned char *in_buffer; /* My own buffering scheme instead of */
EXTERN unsigned char *out_buffer; /* setvbuf() */
EXTERN int verbose;
EXTERN char filebuffer[MAXPATHLEN]; /* a scratch buffer for file names */
EXTERN char currentDirectory[MAXPATHLEN];
EXTERN char rootdir[MAXPATHLEN]; /* the initial directory */
EXTERN struct stat tstat; /* temporary variable used to stat files */
EXTERN int pathSlotsUsed; /* number of used and available slots in pathList,*/
EXTERN int pathSlots; /* respectively. Both are initially zero. */
EXTERN char **pathList; /* the list of files to process, given relative */
extern char *program_name; /* How was udl invoked? */
extern char *current_file; /* Name of current file */
extern char *tempfile; /* Name of temporary file */
extern unsigned char *in_buffer; /* My own buffering scheme instead of */
extern unsigned char *out_buffer; /* setvbuf() */
extern int verbose;
extern char filebuffer[MAXPATHLEN]; /* a scratch buffer for file names */
extern char currentDirectory[MAXPATHLEN];
extern char rootdir[MAXPATHLEN]; /* the initial directory */
extern struct stat tstat; /* temporary variable used to stat files */
extern int pathSlotsUsed; /* number of used and available slots in pathList,*/
extern int pathSlots; /* respectively. Both are initially zero. */
extern char **pathList; /* the list of files to process, given relative */
/* to the initial directory. Initially NULL, */
/* and NULL terminated. */
EXTERN char dirbrk; /* the character used to separate parts of a path name */
EXTERN int recursionDepth; /* levels of subdirectories that we've traversed */
extern char dirbrk; /* the character used to separate parts of a path name */
extern int recursionDepth; /* levels of subdirectories that we've traversed */
extern int optind; /* part of getopt library */
extern int opterr;
@ -88,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(char *file, short recurse);
extern void build_file_list(const 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);

View File

@ -0,0 +1,35 @@
/*
* 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 $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
*/
#ifdef GNO
#pragma noroot
#endif
#include "common.h"
char *program_name; /* How was udl invoked? */
char *current_file; /* Name of current file */
char *tempfile; /* Name of temporary file */
unsigned char *in_buffer; /* My own buffering scheme instead of */
unsigned char *out_buffer; /* setvbuf() */
int verbose;
char filebuffer[MAXPATHLEN]; /* a scratch buffer for file names */
char currentDirectory[MAXPATHLEN];
char rootdir[MAXPATHLEN]; /* the initial directory */
struct stat tstat; /* temporary variable used to stat files */
int pathSlotsUsed; /* number of used and available slots in pathList,*/
int pathSlots; /* respectively. Both are initially zero. */
char **pathList; /* the list of files to process, given relative */
/* to the initial directory. Initially NULL, */
/* and NULL terminated. */
char dirbrk; /* the character used to separate parts of a path name */
int recursionDepth; /* levels of subdirectories that we've traversed */

View File

@ -4,7 +4,7 @@
*
* Apple IIgs specific routines.
*
* $Id: udlgs.c,v 1.3 1995/02/08 05:15:33 gdr Exp $
* $Id: udlgs.c,v 1.4 1995/02/08 05:25:22 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
*/
@ -14,7 +14,6 @@
#include <gsos.h>
#include <getopt.h>
#define MAIN 1
#include "common.h"
#define QUITFLAG 0x4000 /* udl is restartable */

View File

@ -4,12 +4,11 @@
*
* Unix specific routines.
*
* $Id: udlunix.c,v 1.3 1995/02/08 05:15:35 gdr Exp $
* $Id: udlunix.c,v 1.4 1995/02/08 05:25:24 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
*/
#define MAIN 1
#include "common.h"
extern char *strdup(const char *);

View File

@ -4,11 +4,15 @@
*
* Usage strings.
*
* $Id: udluse.c,v 1.3 1995/02/08 05:15:36 gdr Exp $
* $Id: udluse.c,v 1.4 1995/02/08 05:25:26 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Glyn Reade
*/
#ifdef GNO
#pragma noroot
#endif
char use1 [] =
"udl 1.14 by Soenke Behrens, Devin Glyn Reade\n"
"Usage: udl -u|g|m [-Rvp] file1 [file2 ...]\n\n"