- makefile changes to build under the GNO base distribution

- fixed a bug when the argument does not contain a directory delimiter
This commit is contained in:
gdr-ftp 1998-03-29 20:46:17 +00:00
parent db224b5b07
commit 48574decdd
3 changed files with 16 additions and 28 deletions

View File

@ -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

View File

@ -44,7 +44,9 @@ static char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95";
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef __GNO__
#include <gno/gno.h>
#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);
}

View File

@ -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 <smoberly@s-cwis.unomaha.edu>"
"Scott Moberly <smoberly@s-cwis.unomaha.edu>\n"
BUILD_DATE
};
#define ON 1