Changed Makefile.unx to select what should be the proper

defines automatically, based on the result of `uname -sr`.
Added Linux defines.
Changed references and definition of "mktemp" to "Mktemp".  There
   is a discrepancy between the internal implementation and
   other common Unix versions.
Added a section to this README on installation, and moved the
   description of the DEFINES from the makefiles to here.
On the IIgs version, the resource fork is now created from a
   resource source file that is compiled, rather than using
   an interactive tool to create the resource fork.
Changed source filenames to use the 8.3 format in anticipation of
   MS-DOS support.  This does not affect the file names upon which
   udl operates.
This commit is contained in:
gdr 1996-01-22 01:01:36 +00:00
parent ed782560cf
commit 53e5462236
11 changed files with 300 additions and 138 deletions

View File

@ -1,61 +1,60 @@
#
# Makefile for udl
# Copyright (c) 1993-1994 Soenke Behrens
# For use with dmake
# Copyright (c) 1993-1996 Soenke Behrens
#
# $Id: Makefile.gs,v 1.7 1995/02/13 19:47:23 gdr Exp $
# This makefile should be used with dmake.
#
# Define the following as necessary:
# $Id: Makefile.gs,v 1.8 1996/01/22 01:01:30 gdr Exp $
#
# HAS_ATEXIT if your system has atexit()
#
# _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.
#
# BROKEN_REALLOC if your realloc() doesn't behave like malloc() when
# passed a NULL pointer as the first argument.
#
# GNO if you are compiling on the IIgs. This will allow for both
# ':' 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).
# You will also have to specify -l/usr/lib/stack in LDFLAGS.
# Where do we put the binaries and man page?
BINDIR = /usr/local/bin
MANDIR = /usr/local/man
# OS-dependant macros. See the README for an explanation of these.
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
# Use optimization and a 2k stack.
CFLAGS = $(DEFINES) -O -w -s2048
LDFLAGS = -s2048
# Depending on how you have your libraries set up, you may not need
# this next line. In that case, just comment it out.
LDLIBS = -l/usr/lib/gnulib
#
# You should not have to modify anything beyond this point
#
udl: udl.o udluse.o udl.r common.o globals.o
-$(RM) udl
cp udl.r udl
chtyp -texe udl
$(CC) $(LDFLAGS) -o udl udl.o udluse.o common.o globals.o
OBJS = udl.o udluse.o common.o globals.o
udl.o: udl.gs.c common.h
$(CC) -c $(CFLAGS) -o udl.o udl.gs.c
udl: $(OBJS) udl.r help/udl
$(CC) $(LDFLAGS) $(OBJS) $(LDLIBS) -o $@
copyfork udl.r $@ -r
udl.o: udlgs.c common.h
$(CC) -c $(CFLAGS) -o udl.o udlgs.c
install:
cp -f udl /usr/local/bin
cp -f udl.1 /usr/man/man1
cp -f udl $(BINDIR)
cp -f udl.1 $(MANDIR)
docs: udl.1
nroff -man udl.1 >help/udl
help:
mkdir $@
help/udl: udl.1 help
nroff -man udl.1 > $@
clean:
$(RM) *.o udl
-$(RM) *.o *.root udl.r
clobber: clean
-$(RM) -rf udl help
dist:
@echo "Sorry, automatic packing not supported yet"

View File

@ -1,66 +1,94 @@
#
# Makefile for udl
# (c) 1993-1994 Soenke Behrens
# (c) 1993-1996 Soenke Behrens
#
# $Id: Makefile.unx,v 1.6 1995/02/08 06:12:29 gdr Exp $
#
# Define the following as necessary:
#
# HAS_ATEXIT if your system has atexit()
#
# _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 "..". 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.
# $Id: Makefile.unx,v 1.7 1996/01/22 01:01:31 gdr Exp $
#
# If you're on SunOS 4.x systems, use gcc instead; this is ANSI code.
# $(CC) _must_ be an ANSI compiler.
CC = cc
DESTDIR = /usr/local/
BINDIR = bin
MANDIR = man/man1
INSTALL = cp -f
BINDIR = /usr/local/bin
MANDIR = /usr/local/man/man1
INSTALL = /usr/bin/install
# These are Solaris defines. See previous comments.
DEFINES = -DREADDIR_RETURNS_DOT -D_POSIX_C_SOURCE -D_POSIX_SOURCE \
-DBROKEN_DIRENT_STRUCT
# These are arguments to $(INSTALL)
MODE644 = -m 644
MODE755 = -m 755
OWNER_GROUP = -o bin -g sys
# You should not have to modify anything beyond this point
##########################################################
#
# OS-dependant macros. See the README for an explanation of these.
#
DEFINES_AIX = -DBROKEN_REALLOC -D_POSIX_C_SOURCE -D_POSIX_SOURCE
DEFINES_Linux = -DREADDIR_RETURNS_DOT -D_POSIX_C_SOURCE -D_POSIX_SOURCE \
-DHAS_ATEXIT
DEFINES_Solaris = -DREADDIR_RETURNS_DOT -D_POSIX_C_SOURCE -D_POSIX_SOURCE \
-DBROKEN_DIRENT_STRUCT
LDLIBS_Solaris = -lucb
DEFINES_SunOS = -DREADDIR_RETURNS_DOT -D_POSIX_C_SOURCE -D_POSIX_SOURCE \
-DBROKEN_REALLOC
CFLAGS = $(DEFINES_$(OS)) -O
LDFLAGS = $(LDFLAGS_$(OS)) -s
LDLIBS = $(LDLIBS_$(OS))
CFLAGS = $(DEFINES) -O
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
#
build:
@os_string=`uname -sr | tr ' ' '_'`; \
case $$os_string in \
SunOS_4*) os=SunOS;; \
SunOS_5*) os=Solaris;; \
AIX*) os=AIX;; \
Linux*) os=Linux;; \
*) echo "don't know about OS $$os_string"; \
exit -1;; \
esac; \
$(MAKE) udl -f Makefile.unx OS=$$os
udl: $(OBJS)
$(CC) $(LDFLAGS) -o udl $(OBJS) $(LDLIBS)
udl.o: udl.unix.c common.h
$(CC) -c $(CFLAGS) -o udl.o udl.unix.c
udl.o: udlunix.c common.h
$(CC) -c $(CFLAGS) -o udl.o udlunix.c
install:
$(INSTALL) udl $(DESTDIR)$(BINDIR)
$(INSTALL) udl.1 $(DESTDIR)$(MANDIR)
newudl.1: udl.1
@echo "creating newudl.1"; \
echo '/^.TH/ c\' > sed.script; \
echo '.TH UDL 1 "15 January 1996" "Version 1.15"\
"Commands and Applications"' >>sed.script; \
sed -f sed.script <udl.1 >newudl.1; \
rm -f sed.script
install: newudl.1 udl
$(INSTALL) $(MODE755) $(OWNER_GROUP) udl $(BINDIR)
$(INSTALL) $(MODE644) $(OWNER_GROUP) newudl.1 $(MANDIR)/udl.1
rm -f newudl.1
clean:
-rm *.o *~ core
-rm -f *.o *~ core
clobber: clean
-rm udl
-rm -rf udl newudl.1 help
dist:
@echo 'Sorry, automatic packing not yet supported.'
dist: clobber
@echo "creating archive"; \
cwd=`pwd`; \
parent=`dirname $$cwd`; \
dir=`basename $$cwd`; \
cd $$parent; \
archive=$$dir.tar.Z; \
if [ -f $$archive ]; then \
echo "please move $$parent/$$archive out of the way, first"; \
exit -1; \
fi; \
tar -cf - $$dir | compress > $$archive
udluse.o common.o globals.o:: common.h

View File

@ -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 Reade
(c) 1993-1996 Soenke Behrens, Devin Reade
Version 1.14: $Id: README,v 1.7 1995/02/13 19:47:25 gdr Exp $
Version 1.15: $Id: README,v 1.8 1996/01/22 01:01:32 gdr Exp $
=============================================================================
Udl converts text files between CR, LF and CR/LF (Apple, Unix and MS-DOS).
@ -12,6 +12,131 @@ It is a very fast utility that ensures that the integrity of the file
cannot be compromised during the translation. It is also much easier
to use than tr(1).
=========
Compiling:
=========
There are two makefiles included:
Makefile.gs - for use on the Apple IIgs running GNO
Makefile.unx - for use with Unix systems.
Although udl on the IIgs can be run from either GNO or ORCA shells,
it cannot be built with the standard ORCA installation due to a lack
of additional libraries.
The IIgs distribution should contain a binary of udl, including a
resource fork. Therefore, you should be able to skip straight to the
section on installation. For those who must know, however, building the
binaries under GNO should just be a matter of typing 'dmake -f Makefile.gs'.
If you are compiling on Unix operating systems that have been previously
tested, you should be able to just type 'make -f Makefile.unx'. This
will select the appropriate DEFINES for your system. For an explanation
the various DEFINES, see the section below on "DEFINES Definitions".
Note that compilation of udl _requires_ an ANSI C compiler.
If you are compiling to a new system, add in another set of defines
and let us know about them.
Note that udl.c assumes that getopt() is declared in <unistd.h> and that
the function strdup() exists in <string.h>. You might have to change
these includes if that's not the case. Ensure you use cpp conditional
compilations to match your platform (and to avoid breaking the code for
other platforms).
============
Installation
============
Apple IIgs with GNO
^^^^^^^^^^^^^^^^^^^
Type 'dmake install -f Makefile.gs'. By default this copies the binary
into "/usr/local/bin" and the man page into "/usr/local/man/man1". (You
_are_ using version 3.x of 'man', are you not? *blatent plug*) If you
don't like these locations, either modify the BINDIR and MANDIR
macros in the makefile or install the files by hand.
If you have describe(1) installed, you can update the udl(1) entry
with the file "describe.udl". See the descu(8) and descc(8) man pages
for details.
Apple IIgs with Orca/Shell
^^^^^^^^^^^^^^^^^^^^^^^^^^
Copy the following files to their respective destinations:
udl to 17
help/udl to 17/help
Unix systems
^^^^^^^^^^^^
Type 'make -f Makefile.unx install'. By default the binary will
go into /usr/local/bin and the man page into /usr/local/man/man1.
This assumes root access. If this does not match your plans and/or
access permissions, either copy the files by hand or change the
BINDIR, MANDIR, and OWNER_GROUP macros in the makefile.
===================
DEFINES Definitions
===================
If you have problems compiling or are porting udl to a new operating
system, define the following macros in the makefile as necessary.
They should be used as the value of $(DEFINES_$(OS)) where $(OS) is
your operating system as returned by `uname -sr | tr ' ' '_'`.
HAS_ATEXIT if your system has atexit()
_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 "..". 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.
GNO if you are compiling on the IIgs. This will allow for both
':' 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).
You will also have to specify -l/usr/lib/stack in LDFLAGS.
The following are the DEFINES values for tested operating systems:
APPLE IIGS: (use "dmake -f Makefile.gs")
^^^^^^^^^^
ORCA/Shell and GNO/ME: (tested with occ)
-DGNO -D_POSIX_C_SOURCE -D_POSIX_SOURCE -DHAS_ATEXIT
-DOVERFLOW_CHECK
TESTED UNIX OS's: (use "make -f Makefile.unx")
^^^^^^^^^^^^^^^^
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
Linux 1.2.3: (tested with gcc)
-DREADDIR_RETURNS_DOT -D_POSIX_C_SOURCE -D_POSIX_SOURCE
-DHAS_ATEXIT
================
Revision History:
================
@ -71,48 +196,35 @@ v1.14
a core dump (Unix).
Tested under SunOS 4.x, SunOS 5.x (Solaris), and AIX.
=========
Compiling:
=========
There are two makefiles included:
Makefile.gs - for use on the Apple IIgs running GNO
Makefile.unix - for use with Unix systems.
Although udl on the IIgs can be run from either GNO or ORCA shells,
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. 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
these includes if that's not the case.
v1.15
(Devin Reade, January 1996)
Changed Makefile.unx to select what should be the proper
defines automatically, based on the result of `uname -sr`.
Added Linux defines.
Changed references and definition of "mktemp" to "Mktemp". There
is a discrepancy between the internal implementation and
other common Unix versions.
Added a section to this README on installation, and moved the
description of the DEFINES from the makefiles to here.
On the IIgs version, the resource fork is now created from a
resource source file that is compiled, rather than using
an interactive tool to create the resource fork.
Changed source filenames to use the 8.3 format in anticipation of
MS-DOS support. This does not affect the file names upon which
udl operates.
=======
Authors
=======
Original code by Soenke Behrens <sbehrens@contech.demon.co.uk>
with modifications and version-merging by Devin Reade <gdr@myrias.ab.ca>
with modifications and version-merging by Devin Reade <gdr@myrias.com>
==========
Legalities:
==========
This program contains material from the Orca/C Run-Time Libraries,
copyright 1987-1995 by Byte Works, Inc. Used with permission.
copyright 1987-1996 by Byte Works, Inc. Used with permission.
=============================================================================

View File

@ -4,7 +4,7 @@
*
* Routines common to both the Unix and Apple IIgs versions.
*
* $Id: common.c,v 1.7 1995/02/13 19:47:27 gdr Exp $
* $Id: common.c,v 1.8 1996/01/22 01:01:32 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/
@ -813,7 +813,10 @@ void add_to_pathList(char *thisdir, char *file) {
return;
}
/* mktemp() construct a unique file name
/* Mktemp() construct a unique file name
*
* This routine is slightly different than the Unix standard one,
* thus the capitalization.
*
* Inputs:
* base Template to construct the name upon. It should
@ -823,12 +826,12 @@ void add_to_pathList(char *thisdir, char *file) {
* base may contain a full or partial path.
*
* Outputs:
* mktemp() returns a pointer to a dynamically allocated string
* Mktemp() returns a pointer to a dynamically allocated string
* containing a unique file name.
*
*/
char *mktemp(const char *base)
char *Mktemp(const char *base)
{
static char id[16] = "AAAAAAAAAAAAAAA";
char *p1,*p2,*st;
@ -874,7 +877,7 @@ char *mktemp(const char *base)
if (stat(st,&tstat) == 0)
{
free (st);
st = mktemp (base);
st = Mktemp (base);
}
#ifdef GNO
} else { /* ORCA/Shell doesn't like stat one little bit */
@ -883,10 +886,10 @@ char *mktemp(const char *base)
{
fclose(fp);
free (st);
st = mktemp (base);
st = Mktemp (base);
} else if ((fp = fopen(st,"a")) == NULL) {
free(st);
st = mktemp (base);
st = Mktemp (base);
} else {
fclose(fp);
}

View File

@ -4,7 +4,7 @@
*
* Header file for routines common to both the Unix and Apple IIgs versions.
*
* $Id: common.h,v 1.7 1995/02/13 19:47:29 gdr Exp $
* $Id: common.h,v 1.8 1996/01/22 01:01:33 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/
@ -83,9 +83,8 @@ extern void cleanup (void);
extern void usage (void);
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);
extern char *Mktemp(const char *base);
extern int needsgno(void);
/* not strictly necessary, but it cuts down on warnings from gcc */

View File

@ -1,5 +1,5 @@
Name: udl
Version: 1.14
Version: 1.15
Author: Soenke Behrens, Devin Reade
Contact: sbehrens@contech.demon.co.uk, gdr@myrias.ab.ca
Where: /usr/local/bin

View File

@ -1,7 +1,7 @@
.\" Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
.\" $Id: udl.1,v 1.7 1995/02/13 19:47:33 gdr Exp $
.\" $Id: udl.1,v 1.8 1996/01/22 01:01:34 gdr Exp $
.\"
.TH UDL 1 "Commands and Applications" "7 February 1995" "Version 1.14"
.TH UDL 1 "Commands and Applications" "21 January 1996" "Version 1.15"
.SH NAME
udl - convert text files between different architectures
.SH SYNOPSIS
@ -89,9 +89,7 @@ Bug reports should be directed to one of the two addresses below.
.SH AUTHOR
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
version 1.14.
version 1.15.

22
usr.orca.bin/udl/udl.rez Normal file
View File

@ -0,0 +1,22 @@
#include "Types.Rez"
resource rVersion (0x1, purgeable1, nocrossbank) {
{ 1, 1, 5, /* version 1.1.4 */
release, /* development|alpha|beta|final|release */
0 /* non-final release number */
},
verBritain,
"udl",
"Copyright 1993-1996,\n"
"S" $"9A" "nke Behrens, Devin Reade"
};
resource rComment (0x1) {
"Text File Conversion Program\n"
"Converts files between CR, CR/LF, and LF.\n"
"(Apple, MS-DOS, and Unix)"
};
resource rComment (0x2) {
"Requires ORCA/Shell or GNO/ME"
};

View File

@ -4,7 +4,7 @@
*
* Apple IIgs specific routines.
*
* $Id: udlgs.c,v 1.7 1995/02/13 19:47:34 gdr Exp $
* $Id: udlgs.c,v 1.9 1996/02/04 01:34:29 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/
@ -265,7 +265,7 @@ int main(int argc,char *argv[]) {
}
infile = tryopen(current_file,"rwb");
tempfile = mktemp(strcat(get_path(current_file), "udltmpXX"));
tempfile = Mktemp(strcat(get_path(current_file), "udltmpXX"));
outfile = tryopen(tempfile,"wb");
if (careful) {

View File

@ -4,7 +4,7 @@
*
* Unix specific routines.
*
* $Id: udlunix.c,v 1.7 1995/02/13 19:47:36 gdr Exp $
* $Id: udlunix.c,v 1.8 1996/01/22 01:01:35 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/
@ -15,6 +15,7 @@ extern char *strdup(const char *);
int main(int argc,char *argv[]) {
FILE *infile, *outfile;
char *p;
int Tunix = FALSE;
int Messy = FALSE;
int GS = FALSE;
@ -162,7 +163,7 @@ int main(int argc,char *argv[]) {
}
infile = tryopen(current_file,"rwb");
tempfile = mktemp(strcat(get_path(current_file), "udltmpXX"));
tempfile = Mktemp(strcat(get_path(current_file), "udltmpXX"));
outfile = tryopen(tempfile,"wb");
if (careful) {

View File

@ -4,7 +4,7 @@
*
* Usage strings.
*
* $Id: udluse.c,v 1.7 1995/02/13 19:47:38 gdr Exp $
* $Id: udluse.c,v 1.8 1996/01/22 01:01:36 gdr Exp $
*
* Copyright (c) 1993-1995 Soenke Behrens, Devin Reade
*/
@ -14,7 +14,7 @@
#endif
char use1 [] =
"udl 1.14 by Soenke Behrens, Devin Reade\n"
"udl 1.15 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"