dhrystone diff dirname dis88 du dumpcore easypack \
ed eject elle elvis env expand factor file \
find finger fingerd fix fold format fortune fsck \
- fsck1 ftp101 ftpd200 getty gomoku head host \
+ fsck1 ftp101 ftpd200 getty grep gomoku head host \
hostaddr id ifconfig ifdef indent install \
intr ipcrm ipcs irdpd isoread join kill last leave \
lex life loadkeys loadramdisk logger login look lp \
CFLAGS+= -Wall
+LDADD= -lz
+DPADD= ${LIBZ}
+
.if ${OPSYS} == "Minix"
-CPPFLAGS+= -DNOZ -D_POSIX_SOURCE -D_MINIX
+CPPFLAGS+= -D_POSIX_SOURCE -D_MINIX
.include <minix.prog.mk>
.else
-LDADD= -lz
-DPADD= ${LIBZ}
.include <bsd.prog.mk>
.endif
#endif
#define FILE_STDIO 0
+#ifndef __minix
#define FILE_MMAP 1
+#endif
#define FILE_GZIP 2
struct file {
} else
#endif
{
+#ifdef FILE_MMAP
/* try mmap first; if it fails, try stdio */
if ((f->mmf = mmopen(fname, mode)) != NULL) {
f->type = FILE_MMAP;
return f;
}
+#endif
f->type = FILE_STDIO;
if ((f->f = fopen(path, mode)) != NULL)
return f;
switch (f->type) {
case FILE_STDIO:
return bin_file(f->f);
+#ifdef FILE_MMAP
case FILE_MMAP:
return mmbin_file(f->mmf);
+#endif
#ifndef NOZ
case FILE_GZIP:
return gzbin_file(f->gzf);
switch (f->type) {
case FILE_STDIO:
return fgetln(f->f, l);
+#ifdef FILE_MMAP
case FILE_MMAP:
return mmfgetln(f->mmf, l);
+#endif
#ifndef NOZ
case FILE_GZIP:
return gzfgetln(f->gzf, l);
case FILE_STDIO:
fclose(f->f);
break;
+#ifdef FILE_MMAP
case FILE_MMAP:
mmclose(f->mmf);
break;
+#endif
#ifndef NOZ
case FILE_GZIP:
gzclose(f->gzf);
};
SLIST_HEAD(, patfile) patfilelh;
-extern char *__progname;
-
static void
usage(void)
{
"usage: %s [-abcEFGHhIiLlnoPqRSsUVvwxZ] [-A num] [-B num] [-C[num]]\n"
#endif
"\t[-e pattern] [-f file] [--binary-files=value] [--context[=num]]\n"
- "\t[--line-buffered] [pattern] [file ...]\n", __progname);
+ "\t[--line-buffered] [pattern] [file ...]\n", getprogname());
exit(2);
}
SLIST_INIT(&patfilelh);
-#ifdef __minix
- setprogname(argv[0]);
-#endif
-
- switch (__progname[0]) {
+ switch (getprogname()[0]) {
case 'e':
Eflag++;
break;
#ifndef NOZ
case 'z':
Zflag++;
- switch(__progname[1]) {
+ switch(getprogname()[1]) {
case 'e':
Eflag++;
break;
+#ifndef __minix
/* $OpenBSD: mmfile.c,v 1.11 2006/09/19 05:52:23 otto Exp $ */
/*-
++mmf->ptr;
return p;
}
+#endif