Whereis version 1.2 for GNO.

This commit is contained in:
gdr 1996-01-27 22:40:15 +00:00
parent bd3ae6f767
commit c89ef9549f
2 changed files with 63 additions and 26 deletions

View File

@ -1,15 +1,28 @@
# makefile.mk generated by makedmake v0.22 (Gno v1.1) # Makefile.mk generated by makedmake (Gno) v1.1.1 for Dennis Vadura's dmake
# development flags: Undefine __GNO__ to get a more Orca compatible version. BINDIR = 17
# CFLAGS = -i -w -s1023 -G25 -DDEBUG -DCASEFLAG -D__GNO__ MANDIR = /usr/man
# LDLIBS = /usr/lib/stack.a
# LDFLAGS =
# distribution flags: Undefine __GNO__ to get a more Orca compatible version. # development flags
CFLAGS = -i -w -s1023 -O -DCASEFLAG -D__GNO__ # DEFINES += -DDEBUG -DCASEFLAG
LDLIBS = # CFLAGS += -w -s1023 -G25 $(DEFINES)
LDFLAGS = # LDFLAGS +=
# LDLIBS = /usr/lib/stack.a
# distribution flags
DEFINES += -DCASEFLAG
CFLAGS += -w -s1023 -O $(DEFINES)
LDFLAGS +=
LDLIBS =
all:
echo Targets ...
echo
echo dmake install ... to copy executable file to $(BINDIR) and manual
echo page to $(MANDIR)
echo
echo dmake whereis ... to compile source code. This should not be
echo necessary.
whereis : whereis.o whereis : whereis.o
$(CC) $(LDFLAGS) -o whereis whereis.o $(LDLIBS) $(CC) $(LDFLAGS) -o whereis whereis.o $(LDLIBS)
@ -18,6 +31,9 @@ whereis.o : whereis.c
$(CC) $(CFLAGS) -c whereis.c $(CC) $(CFLAGS) -c whereis.c
install : install :
/bin/cp -f Gno/whereis /usr/bin -$(RM) /usr/bin/whereis
/bin/cp -f Orca/whereis 17 -$(RM) 17/whereis
/bin/cp -f whereis.1 /usr/man/man1 /bin/cp -f whereis $(BINDIR)
/bin/cp -f whereis.1 $(MANDIR)/man1
.SILENT: all

View File

@ -52,9 +52,21 @@ static char sccsid[] = "@(#)whereis.c 5.5 (Berkeley) 4/18/91";
#include <dirent.h> #include <dirent.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <libc.h>
#ifdef __GNO__ /* define this to use pathnames _without_ the leading 31/ */ /*
static char *bindirs[] = { * Pointers that will correspond to the GNO_* or ORCA_* structs, below
*/
static char **bindirs;
static char **mandirs;
static char **srcdirs;
/*
* These are the directories to check when running under the Gno shell
*/
static char *GNO_bindirs[] = {
"/bin", "/bin",
"/usr/bin", "/usr/bin",
"/usr/sbin", "/usr/sbin",
@ -68,7 +80,7 @@ static char *bindirs[] = {
0 0
}; };
/* This needs to be redone - man pages live with sources */ /* This needs to be redone - man pages live with sources */
static char *mandirs[] = { static char *GNO_mandirs[] = {
/* /*
These are disabled since /man is not usually present; this eliminates These are disabled since /man is not usually present; this eliminates
@ -111,16 +123,18 @@ static char *mandirs[] = {
"17/help", "17/help",
0 0
}; };
static char *srcdirs[] = { static char *GNO_srcdirs[] = {
"/usr/src/bin", "/usr/src/bin",
"/usr/src/etc", "/usr/src/etc",
/* still need libs */ /* still need libs */
0 0
}; };
#else /* not __GNO__ */ /*
* These are the directories to check when running under the Orca shell
*/
static char *bindirs[] = { static char *ORCA_bindirs[] = {
"31/bin", "31/bin",
"31/usr/bin", "31/usr/bin",
"31/usr/sbin", "31/usr/sbin",
@ -134,7 +148,7 @@ static char *bindirs[] = {
0 0
}; };
/* This needs to be redone - man pages live with sources */ /* This needs to be redone - man pages live with sources */
static char *mandirs[] = { static char *ORCA_mandirs[] = {
/* /*
These are disabled since /man is not usually present; this eliminates These are disabled since /man is not usually present; this eliminates
@ -177,14 +191,13 @@ static char *mandirs[] = {
"17/help", "17/help",
0 0
}; };
static char *srcdirs[] = { static char *ORCA_srcdirs[] = {
"31/usr/src/bin", "31/usr/src/bin",
"31/usr/src/etc", "31/usr/src/etc",
/* still need libs */ /* still need libs */
0 0
}; };
#endif /* not __GNO__ */
#ifdef CASEFLAG #ifdef CASEFLAG
int cflag = 0; int cflag = 0;
@ -201,11 +214,7 @@ char **Mflag;
int Mcnt; int Mcnt;
char uflag; char uflag;
#ifdef __GNO__ char *verstring = "whereis -- Apple IIgs Version 1.2";
char *verstring = "whereis -- Gno/ME Version 1.1";
#else
char *verstring = "whereis -- Orca Version 1.1";
#endif
void getlist (int *argcp, char ***argvp, char ***flagp, int *cntp); void getlist (int *argcp, char ***argvp, char ***flagp, int *cntp);
void zerof(void); void zerof(void);
@ -251,6 +260,18 @@ usage:
exit(1); exit(1);
} }
/* select which directory structures we're going to use */
if (needsgno()) {
bindirs = GNO_bindirs;
mandirs = GNO_mandirs;
srcdirs = GNO_srcdirs;
} else {
bindirs = ORCA_bindirs;
mandirs = ORCA_mandirs;
srcdirs = ORCA_srcdirs;
}
do do
if (argv[0][0] == '-') { if (argv[0][0] == '-') {
register char *cp = argv[0] + 1; register char *cp = argv[0] + 1;