From 48574decddb922eb9cd13141cead74ee7fade63a Mon Sep 17 00:00:00 2001 From: gdr-ftp Date: Sun, 29 Mar 1998 20:46:17 +0000 Subject: [PATCH] - makefile changes to build under the GNO base distribution - fixed a bug when the argument does not contain a directory delimiter --- usr.bin/dirname/Makefile | 23 +++++++---------------- usr.bin/dirname/dirname.c | 15 +++++---------- usr.bin/dirname/dirname.rez | 6 ++++-- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/usr.bin/dirname/Makefile b/usr.bin/dirname/Makefile index ac67899..f4c60a1 100644 --- a/usr.bin/dirname/Makefile +++ b/usr.bin/dirname/Makefile @@ -1,19 +1,10 @@ -# Makefile for basename(1) and dirname(1) # -# Use TESTFLAGS to check stack usage. - -CFLAGS += -w -O -s 768 -c -LDFLAGS += -O -TESTFLAGS += -w -G25 -DSTACK_CHECK - -all : basename dirname - -basename : basename.o basename.r - $(CC) $(LDFLAGS) -o $@ $@.o - $(CATREZ) -d $@ $@.r - -dirname : dirname.o dirname.r - $(CC) $(LDFLAGS) -o $@ $@.o - $(CATREZ) -d $@ $@.r +# $Id: Makefile,v 1.2 1998/03/29 20:46:14 gdr-ftp Exp $ +# +PROG = dirname +BINDIR = /usr/bin +STACK *= 768 +OPTIMIZE *= -1 +.INCLUDE : /src/gno/prog.mk diff --git a/usr.bin/dirname/dirname.c b/usr.bin/dirname/dirname.c index 33b5683..080ef87 100644 --- a/usr.bin/dirname/dirname.c +++ b/usr.bin/dirname/dirname.c @@ -44,7 +44,9 @@ static char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95"; #include #include #include +#ifdef __GNO__ #include +#endif void usage __P((void)); @@ -54,8 +56,8 @@ main(int argc, char **argv) char *p, delimiter = '/'; int ch; -#ifdef STACK_CHECK - _beginStackCheck(); +#ifdef __GNO__ + __REPORT_STACK(); #endif while ((ch = getopt(argc, argv, "")) != -1) @@ -155,16 +157,9 @@ main(int argc, char **argv) *p = '\0'; (void)printf("%s\n", p == *argv ? delimiter : *argv); # else - if (!(p = dirname(*argv))) - (void)printf(".\n", p, *p); - else - (void)printf("%s%c\n", p, delimiter); + puts(dirname(*argv)); # endif -#ifdef STACK_CHECK - printf("Stack Usgae: %d\n", _endStackCheck()); -#endif - exit(0); } diff --git a/usr.bin/dirname/dirname.rez b/usr.bin/dirname/dirname.rez index 0dd7a6c..ca59514 100644 --- a/usr.bin/dirname/dirname.rez +++ b/usr.bin/dirname/dirname.rez @@ -2,11 +2,12 @@ * This is a CVS/RCS identification line -- an excellent tool for maintaining * your sources: * - * $Id: dirname.rez,v 1.1 1998/03/25 15:08:28 gdr-ftp Exp $ + * $Id: dirname.rez,v 1.2 1998/03/29 20:46:17 gdr-ftp Exp $ */ #include "Types.Rez" #include "Proginfo.Rez" +#include "/src/gno/build.tools/builddate.rez" resource rVersion (0x1, purgeable3, nocrossbank) { @@ -21,7 +22,8 @@ resource rVersion (0x1, purgeable3, nocrossbank) { /* Note that \n is used to separate lines here. */ "Strips the file name from a fully expanded filename path.\n" "Ported from FreeBSD source code.\n" - "Scott Moberly " + "Scott Moberly \n" + BUILD_DATE }; #define ON 1