Deliver 1.00 patch #6
Chip Salzenberg
chip at ateng.ateng.com
Thu Dec 1 08:19:15 AEST 1988
This is an offical patch for deliver 1.00. Please apply it.
Patch number: 6
Date: 29 Nov 1988
Priority: HIGH for Berkeley Unix, LOW otherwise
Changes:
Patch #5 introduced the "uid" program. Unfortunately, I never
tested it under BSD, so I didn't realize that link errors would
result from uid's use of deliver's sysdep.o. So now I've separated
getopt() into its own module, since that's the only function that
uid needed anyway.
(So much for my monthly mistake allowance.)
Index: patchlevel.h
Prereq: 5
***************
*** 1 ****
! #define PATCHLEVEL 5
--- 1 ----
! #define PATCHLEVEL 6
Index: Makefile
***************
*** 1,4 ****
! # $Header: Makefile,v 1.11 88/11/28 18:45:20 network Exp $
#
# Makefile for deliver
#
--- 1,4 ----
! # $Header: Makefile,v 1.12 88/11/30 16:24:30 network Exp $
#
# Makefile for deliver
#
***************
*** 67,81 ****
HDRS = config.h context.h deliver.h dest.h patchlevel.h misc.h
! SRC1 = context.c copymsg.c debug.c dest.c dfile.c lock.c
! SRC2 = main.c mbox.c procs.c subs.c sysdep.c uucp.c
! SRCS = $(SRC1) $(SRC2)
! UIDSRC = uid.c
- OBJS = context.o copymsg.o debug.o dest.o dfile.o lock.o \
- main.o mbox.o procs.o subs.o sysdep.o uucp.o
-
#
# For GNU Make. Sorry about the ugliness.
#
--- 67,83 ----
HDRS = config.h context.h deliver.h dest.h patchlevel.h misc.h
! DELSRC1 = context.c copymsg.c debug.c dest.c dfile.c lock.c
! DELSRC2 = main.c mbox.c procs.c subs.c sysdep.c uucp.c
! DELSRCS = $(DELSRC1) $(DELSRC2)
! UIDSRCS = uid.c
! COMSRCS = getopt.c
! DELOBJS = context.o copymsg.o debug.o dest.o dfile.o lock.o \
! main.o mbox.o procs.o subs.o sysdep.o uucp.o
! UIDOBJS = uid.o
! COMOBJS = getopt.o
#
# For GNU Make. Sorry about the ugliness.
#
***************
*** 83,88 ****
--- 85,96 ----
.PHONY: all install lint shar clean clobber
#
+ # The default target.
+ #
+
+ all: deliver uid
+
+ #
# "make clobber" implies "make clean".
#
***************
*** 92,103 ****
# How to compile and link the program.
#
! all: deliver uid
- deliver: $(OBJS)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
- $(OBJS): $(HDRS)
-
install: deliver uid
@if [ `./uid -uU | fgrep '(root)' | wc -l` -ne 2 ]; \
then \
--- 100,109 ----
# How to compile and link the program.
#
! deliver: $(DELOBJS) $(COMOBJS)
! $(CC) $(LDFLAGS) -o $@ $(DELOBJS) $(COMOBJS) $(LIBS)
! $(DELOBJS): $(HDRS)
install: deliver uid
@if [ `./uid -uU | fgrep '(root)' | wc -l` -ne 2 ]; \
then \
***************
*** 110,116 ****
chmod 4711 $(BIN)/deliver
clean::
! rm -f $(OBJS)
clobber::
rm -f deliver
--- 116,122 ----
chmod 4711 $(BIN)/deliver
clean::
! rm -f $(DELOBJS)
clobber::
rm -f deliver
***************
*** 119,143 ****
# (I wish that the System V "id" program were available everywhere.)
#
! uid: $(UIDSRC) sysdep.o
! $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(UIDSRC) sysdep.o $(LIBS)
! @rm -f $@.o
! uid: config.h
clobber::
rm -f uid
#
# Look for fuzz.
#
lint: deliver.lint uid.lint
! deliver.lint: $(HDRS) $(SRCS)
! lint $(SRCS) -lc $(LIBS) >$@
! uid.lint: uid.c
! lint uid.c -lc $(LIBS) >$@
clean::
rm -f *.lint
--- 125,157 ----
# (I wish that the System V "id" program were available everywhere.)
#
! uid: $(UIDSRCS) $(COMOBJS) config.h
! $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(UIDSRCS) $(COMOBJS) $(LIBS)
! @rm -f $(UIDOBJS)
clobber::
rm -f uid
#
+ # Common subroutines
+ #
+
+ $(COMOBJS): config.h
+
+ clean::
+ rm -f $(COMOBJS)
+
+ #
# Look for fuzz.
#
lint: deliver.lint uid.lint
! deliver.lint: $(HDRS) $(DELSRCS) $(COMSRCS)
! lint $(DELSRCS) $(COMSRCS) -lc $(LIBS) >$@
! uid.lint: config.h $(UIDSRCS) $(COMSRCS)
! lint $(UIDSRCS) $(COMSRCS) -lc $(LIBS) >$@
clean::
rm -f *.lint
***************
*** 147,158 ****
#
shar: $(DELSHAR).01 $(DELSHAR).02 $(DELSHAR).03
! $(DELSHAR).01: $(DOCS) $(MF) $(HDRS) $(UIDSRC)
! $(SHAR) >$@ $(DOCS) $(MF) $(HDRS) $(UIDSRC)
! $(DELSHAR).02: $(SRC1)
! $(SHAR) >$@ $(SRC1)
! $(DELSHAR).03: $(SRC2)
! $(SHAR) >$@ $(SRC2)
clobber::
rm -f $(DELSHAR).??
--- 161,172 ----
#
shar: $(DELSHAR).01 $(DELSHAR).02 $(DELSHAR).03
! $(DELSHAR).01: $(DOCS) $(MF) $(HDRS) $(UIDSRCS) $(COMSRCS)
! $(SHAR) >$@ $(DOCS) $(MF) $(HDRS) $(UIDSRCS) $(COMSRCS)
! $(DELSHAR).02: $(DELSRC1)
! $(SHAR) >$@ $(DELSRC1)
! $(DELSHAR).03: $(DELSRC2)
! $(SHAR) >$@ $(DELSRC2)
clobber::
rm -f $(DELSHAR).??
Index: getopt.c
***************
*** 0 ****
--- 1,95 ----
+ /* $Header: getopt.c,v 1.2 88/11/30 16:24:50 network Exp $
+ *
+ * A version of the public-domain getopt() function, as found
+ * in the SVID and fine Unix manuals everywhere.
+ *
+ * $Log: getopt.c,v $
+ * Revision 1.2 88/11/30 16:24:50 network
+ * patch6: Separate getopt() into its own module.
+ *
+ */
+
+ #include "config.h"
+
+ /*----------------------------------------------------------------------
+ * Get command line options.
+ * This is essentially the public domain version, just reformatted to
+ * match the rest of the deliver program.
+ */
+
+ #ifndef HAS_GETOPT
+
+ int opterr = 1;
+ int optind = 1;
+ int optopt = 0;
+ char *optarg = NULL;
+
+ #define ERR(what,c) \
+ if (!opterr) {} else fprintf(stderr,"%s: %s -- %c\n", argv[0], what, c);
+
+ int
+ getopt(argc, argv, opts)
+ int argc;
+ char **argv;
+ char *opts;
+ {
+ static int sp = 1;
+ int c;
+ char *cp;
+
+ if (sp == 1)
+ {
+ if (optind >= argc
+ || argv[optind][0] != '-' || argv[optind][1] == '\0')
+ return EOF;
+
+ if (strcmp(argv[optind], "--") == NULL)
+ {
+ optind++;
+ return EOF;
+ }
+ }
+
+ optopt = c = argv[optind][sp];
+
+ if (c == ':' || (cp = strchr(opts, c)) == NULL)
+ {
+ ERR("illegal option", c);
+ if (argv[optind][++sp] == '\0')
+ {
+ optind++;
+ sp = 1;
+ }
+ return '?';
+ }
+
+ if (*++cp == ':')
+ {
+ if (argv[optind][sp + 1] != '\0')
+ optarg = &argv[optind++][sp + 1];
+ else if (++optind >= argc)
+ {
+ ERR("option requires an argument", c);
+ sp = 1;
+ return '?';
+ }
+ else
+ optarg = argv[optind++];
+
+ sp = 1;
+ }
+ else
+ {
+ if (argv[optind][++sp] == '\0')
+ {
+ sp = 1;
+ optind++;
+ }
+
+ optarg = NULL;
+ }
+
+ return c;
+ }
+
+ #endif /* !HAS_GETOPT */
Index: sysdep.c
***************
*** 1,4 ****
! /* $Header: sysdep.c,v 1.5 88/11/26 13:21:15 network Exp $
*
* Routines which are (or might well be) system-dependant.
* I've put the message routines here since you may need to use
--- 1,4 ----
! /* $Header: sysdep.c,v 1.6 88/11/30 16:24:56 network Exp $
*
* Routines which are (or might well be) system-dependant.
* I've put the message routines here since you may need to use
***************
*** 5,10 ****
--- 5,13 ----
* the ANSI <stdarg.h> instead of <varargs.h>.
*
* $Log: sysdep.c,v $
+ * Revision 1.6 88/11/30 16:24:56 network
+ * patch6: Separate getopt() into its own module.
+ *
* Revision 1.5 88/11/26 13:21:15 network
* patch4: Add return type of signal handlers to config.h.
* patch4: Provide a version of getopt() for systems that lack it.
***************
*** 308,392 ****
}
#endif /* !HAS_PUTENV */
-
- /*----------------------------------------------------------------------
- * Get command line options.
- * This is essentially the public domain version, reformatted to
- * my style and using my error message routine.
- */
-
- #ifndef HAS_GETOPT
-
- int opterr = 1;
- int optind = 1;
- int optopt = 0;
- char *optarg = NULL;
-
- int
- getopt(argc, argv, opts)
- int argc;
- char **argv;
- char *opts;
- {
- static int sp = 1;
- int c;
- char *cp;
-
- if (sp == 1)
- {
- if (optind >= argc
- || argv[optind][0] != '-' || argv[optind][1] == '\0')
- return EOF;
-
- if (strcmp(argv[optind], "--") == NULL)
- {
- optind++;
- return EOF;
- }
- }
-
- optopt = c = argv[optind][sp];
-
- if (c == ':' || (cp = strchr(opts, c)) == NULL)
- {
- if (opterr)
- error("illegal option -- %c\n", c);
- if (argv[optind][++sp] == '\0')
- {
- optind++;
- sp = 1;
- }
- return '?';
- }
-
- if (*++cp == ':')
- {
- if (argv[optind][sp + 1] != '\0')
- optarg = &argv[optind++][sp + 1];
- else if (++optind >= argc)
- {
- if (opterr)
- error("option requires an argument -- %c\n", c);
- sp = 1;
- return '?';
- }
- else
- optarg = argv[optind++];
-
- sp = 1;
- }
- else
- {
- if (argv[optind][++sp] == '\0')
- {
- sp = 1;
- optind++;
- }
-
- optarg = NULL;
- }
-
- return c;
- }
-
- #endif /* !HAS_GETOPT */
--- 311,313 ----
--
Chip Salzenberg <chip at ateng.com> or <uunet!ateng!chip>
A T Engineering Me? Speak for my company? Surely you jest!
Beware of programmers carrying screwdrivers.
More information about the Comp.sources.bugs
mailing list