commands: import of netbsd find
This commit is contained in:
parent
fcd2a802a8
commit
6704520919
9 changed files with 87 additions and 70 deletions
|
@ -11,7 +11,7 @@ SUBDIR= aal add_route adduser advent arp ash at autil awk \
|
||||||
dd de decomp16 DESCRIBE dev2name devsize df dhcpd \
|
dd de decomp16 DESCRIBE dev2name devsize df dhcpd \
|
||||||
dhrystone diff dirname dis88 du dumpcore easypack \
|
dhrystone diff dirname dis88 du dumpcore easypack \
|
||||||
ed eject elle elvis env expand factor fgrep file \
|
ed eject elle elvis env expand factor fgrep file \
|
||||||
finger fingerd fix fold format fortune fsck \
|
find finger fingerd fix fold format fortune fsck \
|
||||||
fsck1 ftp101 ftpd200 getty gomoku grep head host \
|
fsck1 ftp101 ftpd200 getty gomoku grep head host \
|
||||||
hostaddr id ifconfig ifdef indent install \
|
hostaddr id ifconfig ifdef indent install \
|
||||||
intr ipcrm ipcs irdpd isoread join kill last leave \
|
intr ipcrm ipcs irdpd isoread join kill last leave \
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
# $NetBSD: Makefile,v 1.12 2006/12/14 20:55:56 he Exp $
|
# $NetBSD: Makefile,v 1.12 2006/12/14 20:55:56 he Exp $
|
||||||
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
|
# from: @(#)Makefile 8.1 (Berkeley) 6/6/93
|
||||||
|
|
||||||
.include <bsd.own.mk>
|
.include <minix.own.mk>
|
||||||
|
|
||||||
PROG= find
|
PROG= find
|
||||||
SRCS= find.c function.c ls.c main.c misc.c operator.c option.c
|
SRCS= find.c function.c ls.c main.c misc.c operator.c option.c
|
||||||
WARNS= 4
|
|
||||||
|
CFLAGS += -Wall
|
||||||
|
|
||||||
LDADD+=-lutil
|
LDADD+=-lutil
|
||||||
DPADD+=${LIBUTIL}
|
DPADD+=${LIBUTIL}
|
||||||
|
|
||||||
.include <bsd.prog.mk>
|
.include <minix.prog.mk>
|
||||||
|
|
|
@ -33,13 +33,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "from: @(#)find.c 8.5 (Berkeley) 8/5/94";
|
|
||||||
#else
|
|
||||||
__RCSID("$NetBSD: find.c,v 1.25 2007/09/25 04:10:12 lukem Exp $");
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -54,7 +47,7 @@ __RCSID("$NetBSD: find.c,v 1.25 2007/09/25 04:10:12 lukem Exp $");
|
||||||
|
|
||||||
#include "find.h"
|
#include "find.h"
|
||||||
|
|
||||||
static int ftscompare(const FTSENT **, const FTSENT **);
|
static int ftscompare(const FTSENT * const *, const FTSENT * const *);
|
||||||
|
|
||||||
static void sig_lock(sigset_t *);
|
static void sig_lock(sigset_t *);
|
||||||
static void sig_unlock(const sigset_t *);
|
static void sig_unlock(const sigset_t *);
|
||||||
|
@ -148,7 +141,7 @@ find_formplan(char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
ftscompare(const FTSENT **e1, const FTSENT **e2)
|
ftscompare(const FTSENT * const *e1, const FTSENT * const *e2)
|
||||||
{
|
{
|
||||||
|
|
||||||
return (strcoll((*e1)->fts_name, (*e2)->fts_name));
|
return (strcoll((*e1)->fts_name, (*e2)->fts_name));
|
||||||
|
@ -160,7 +153,9 @@ sig_lock(sigset_t *s)
|
||||||
sigset_t new;
|
sigset_t new;
|
||||||
|
|
||||||
sigemptyset(&new);
|
sigemptyset(&new);
|
||||||
|
#ifdef SIGINFO
|
||||||
sigaddset(&new, SIGINFO); /* block SIGINFO */
|
sigaddset(&new, SIGINFO); /* block SIGINFO */
|
||||||
|
#endif
|
||||||
sigprocmask(SIG_BLOCK, &new, s);
|
sigprocmask(SIG_BLOCK, &new, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,14 +40,21 @@
|
||||||
enum ntype {
|
enum ntype {
|
||||||
N_AND = 1, /* must start > 0 */
|
N_AND = 1, /* must start > 0 */
|
||||||
N_AMIN, N_ANEWER, N_ATIME, N_CLOSEPAREN, N_CMIN, N_CNEWER, N_CTIME,
|
N_AMIN, N_ANEWER, N_ATIME, N_CLOSEPAREN, N_CMIN, N_CNEWER, N_CTIME,
|
||||||
N_DEPTH, N_EMPTY, N_EXEC, N_EXECDIR, N_EXIT, N_EXPR, N_FALSE, N_FLAGS,
|
N_DEPTH, N_EMPTY, N_EXEC, N_EXECDIR, N_EXIT, N_EXPR, N_FALSE,
|
||||||
N_FOLLOW, N_FPRINT, N_FSTYPE, N_GROUP,
|
N_FOLLOW, N_FPRINT,
|
||||||
|
#ifndef _MINIX
|
||||||
|
N_FSTYPE,
|
||||||
|
N_FLAGS,
|
||||||
|
#endif
|
||||||
|
N_GROUP,
|
||||||
N_INAME, N_INUM, N_IREGEX, N_LINKS, N_LS, N_MINDEPTH, N_MAXDEPTH,
|
N_INAME, N_INUM, N_IREGEX, N_LINKS, N_LS, N_MINDEPTH, N_MAXDEPTH,
|
||||||
N_MMIN, N_MTIME, N_NAME, N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_OK,
|
N_MMIN, N_MTIME, N_NAME, N_NEWER, N_NOGROUP, N_NOT, N_NOUSER, N_OK,
|
||||||
N_OPENPAREN, N_OR, N_PATH, N_PERM, N_PRINT, N_PRINT0, N_PRINTX,
|
N_OPENPAREN, N_OR, N_PATH, N_PERM, N_PRINT, N_PRINT0, N_PRINTX,
|
||||||
N_PRUNE, N_REGEX, N_SIZE, N_TYPE, N_USER, N_XDEV, N_DELETE
|
N_PRUNE, N_REGEX, N_SIZE, N_TYPE, N_USER, N_XDEV, N_DELETE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef unsigned int u_int32_t;
|
||||||
|
|
||||||
/* node definition */
|
/* node definition */
|
||||||
typedef struct _plandata {
|
typedef struct _plandata {
|
||||||
struct _plandata *next; /* next node */
|
struct _plandata *next; /* next node */
|
||||||
|
@ -61,6 +68,7 @@ typedef struct _plandata {
|
||||||
#define F_MTFLAG 1 /* fstype */
|
#define F_MTFLAG 1 /* fstype */
|
||||||
#define F_MTTYPE 2
|
#define F_MTTYPE 2
|
||||||
#define F_ATLEAST 1 /* perm */
|
#define F_ATLEAST 1 /* perm */
|
||||||
|
#define F_ANY 2 /* perm */
|
||||||
int flags; /* private flags */
|
int flags; /* private flags */
|
||||||
enum ntype type; /* plan node type */
|
enum ntype type; /* plan node type */
|
||||||
union {
|
union {
|
||||||
|
|
|
@ -33,13 +33,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "from: @(#)function.c 8.10 (Berkeley) 5/4/95";
|
|
||||||
#else
|
|
||||||
__RCSID("$NetBSD: function.c,v 1.64 2007/07/19 07:49:30 daniel Exp $");
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -55,7 +48,6 @@ __RCSID("$NetBSD: function.c,v 1.64 2007/07/19 07:49:30 daniel Exp $");
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -65,6 +57,10 @@ __RCSID("$NetBSD: function.c,v 1.64 2007/07/19 07:49:30 daniel Exp $");
|
||||||
|
|
||||||
#include "find.h"
|
#include "find.h"
|
||||||
|
|
||||||
|
typedef int bool;
|
||||||
|
#define false 0
|
||||||
|
#define true 1
|
||||||
|
|
||||||
#define COMPARE(a, b) { \
|
#define COMPARE(a, b) { \
|
||||||
switch (plan->flags) { \
|
switch (plan->flags) { \
|
||||||
case F_EQUAL: \
|
case F_EQUAL: \
|
||||||
|
@ -78,7 +74,7 @@ __RCSID("$NetBSD: function.c,v 1.64 2007/07/19 07:49:30 daniel Exp $");
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t find_parsenum(PLAN *, const char *, const char *, char *);
|
static int32_t find_parsenum(PLAN *, const char *, const char *, char *);
|
||||||
static void run_f_exec(PLAN *);
|
static void run_f_exec(PLAN *);
|
||||||
int f_always_true(PLAN *, FTSENT *);
|
int f_always_true(PLAN *, FTSENT *);
|
||||||
int f_amin(PLAN *, FTSENT *);
|
int f_amin(PLAN *, FTSENT *);
|
||||||
|
@ -131,10 +127,10 @@ extern time_t now;
|
||||||
* find_parsenum --
|
* find_parsenum --
|
||||||
* Parse a string of the form [+-]# and return the value.
|
* Parse a string of the form [+-]# and return the value.
|
||||||
*/
|
*/
|
||||||
static int64_t
|
static int32_t
|
||||||
find_parsenum(PLAN *plan, const char *option, const char *vp, char *endch)
|
find_parsenum(PLAN *plan, const char *option, const char *vp, char *endch)
|
||||||
{
|
{
|
||||||
int64_t value;
|
int32_t value;
|
||||||
const char *str;
|
const char *str;
|
||||||
char *endchar; /* Pointer to character ending conversion. */
|
char *endchar; /* Pointer to character ending conversion. */
|
||||||
|
|
||||||
|
@ -159,7 +155,7 @@ find_parsenum(PLAN *plan, const char *option, const char *vp, char *endch)
|
||||||
* and endchar points to the beginning of the string we know we have
|
* and endchar points to the beginning of the string we know we have
|
||||||
* a syntax error.
|
* a syntax error.
|
||||||
*/
|
*/
|
||||||
value = strtoq(str, &endchar, 10);
|
value = strtol(str, &endchar, 10);
|
||||||
if (value == 0 && endchar == str)
|
if (value == 0 && endchar == str)
|
||||||
errx(1, "%s: %s: illegal numeric value", option, vp);
|
errx(1, "%s: %s: illegal numeric value", option, vp);
|
||||||
if (endchar[0] && (endch == NULL || endchar[0] != *endch))
|
if (endchar[0] && (endch == NULL || endchar[0] != *endch))
|
||||||
|
@ -379,12 +375,14 @@ f_delete(PLAN *plan __unused, FTSENT *entry)
|
||||||
errx(1, "-delete: %s: relative path potentially not safe",
|
errx(1, "-delete: %s: relative path potentially not safe",
|
||||||
entry->fts_accpath);
|
entry->fts_accpath);
|
||||||
|
|
||||||
|
#ifndef _MINIX
|
||||||
/* Turn off user immutable bits if running as root */
|
/* Turn off user immutable bits if running as root */
|
||||||
if ((entry->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
|
if ((entry->fts_statp->st_flags & (UF_APPEND|UF_IMMUTABLE)) &&
|
||||||
!(entry->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
|
!(entry->fts_statp->st_flags & (SF_APPEND|SF_IMMUTABLE)) &&
|
||||||
geteuid() == 0)
|
geteuid() == 0)
|
||||||
chflags(entry->fts_accpath,
|
chflags(entry->fts_accpath,
|
||||||
entry->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
|
entry->fts_statp->st_flags &= ~(UF_APPEND|UF_IMMUTABLE));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* rmdir directories, unlink everything else */
|
/* rmdir directories, unlink everything else */
|
||||||
if (S_ISDIR(entry->fts_statp->st_mode)) {
|
if (S_ISDIR(entry->fts_statp->st_mode)) {
|
||||||
|
@ -545,9 +543,9 @@ f_exec(PLAN *plan, FTSENT *entry)
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
switch (pid = vfork()) {
|
switch (pid = fork()) {
|
||||||
case -1:
|
case -1:
|
||||||
err(1, "vfork");
|
err(1, "fork");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
case 0:
|
case 0:
|
||||||
if (fchdir(dotfd)) {
|
if (fchdir(dotfd)) {
|
||||||
|
@ -577,9 +575,9 @@ run_f_exec(PLAN *plan)
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
switch (pid = vfork()) {
|
switch (pid = fork()) {
|
||||||
case -1:
|
case -1:
|
||||||
err(1, "vfork");
|
err(1, "fork");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
case 0:
|
case 0:
|
||||||
if (fchdir(dotfd)) {
|
if (fchdir(dotfd)) {
|
||||||
|
@ -755,7 +753,7 @@ f_execdir(PLAN *plan, FTSENT *entry)
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
switch (pid = vfork()) {
|
switch (pid = fork()) {
|
||||||
case -1:
|
case -1:
|
||||||
err(1, "fork");
|
err(1, "fork");
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
@ -857,6 +855,7 @@ c_false(char ***argvp, int isok)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _MINIX
|
||||||
/*
|
/*
|
||||||
* -flags [-]flags functions --
|
* -flags [-]flags functions --
|
||||||
*/
|
*/
|
||||||
|
@ -870,6 +869,8 @@ f_flags(PLAN *plan, FTSENT *entry)
|
||||||
return ((plan->f_data | flags) == flags);
|
return ((plan->f_data | flags) == flags);
|
||||||
else
|
else
|
||||||
return (flags == plan->f_data);
|
return (flags == plan->f_data);
|
||||||
|
/* MINIX has no file flags. */
|
||||||
|
return 0;
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -897,6 +898,7 @@ c_flags(char ***argvp, int isok)
|
||||||
new->f_data = flagset;
|
new->f_data = flagset;
|
||||||
return (new);
|
return (new);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -follow functions --
|
* -follow functions --
|
||||||
|
@ -951,6 +953,7 @@ c_fprint(char ***argvp, int isok)
|
||||||
*
|
*
|
||||||
* True if the file is of a certain type.
|
* True if the file is of a certain type.
|
||||||
*/
|
*/
|
||||||
|
#ifndef _MINIX
|
||||||
int
|
int
|
||||||
f_fstype(PLAN *plan, FTSENT *entry)
|
f_fstype(PLAN *plan, FTSENT *entry)
|
||||||
{
|
{
|
||||||
|
@ -1044,6 +1047,7 @@ c_fstype(char ***argvp, int isok)
|
||||||
new->c_data = arg;
|
new->c_data = arg;
|
||||||
return (new);
|
return (new);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* -group gname functions --
|
* -group gname functions --
|
||||||
|
@ -1424,9 +1428,15 @@ f_perm(PLAN *plan, FTSENT *entry)
|
||||||
mode_t mode;
|
mode_t mode;
|
||||||
|
|
||||||
mode = entry->fts_statp->st_mode &
|
mode = entry->fts_statp->st_mode &
|
||||||
(S_ISUID|S_ISGID|S_ISTXT|S_IRWXU|S_IRWXG|S_IRWXO);
|
(S_ISUID|S_ISGID
|
||||||
|
#ifdef S_ISTXT
|
||||||
|
|S_ISTXT
|
||||||
|
#endif
|
||||||
|
|S_IRWXU|S_IRWXG|S_IRWXO);
|
||||||
if (plan->flags == F_ATLEAST)
|
if (plan->flags == F_ATLEAST)
|
||||||
return ((plan->m_data | mode) == mode);
|
return ((plan->m_data | mode) == mode);
|
||||||
|
else if (plan->flags == F_ANY)
|
||||||
|
return ((plan->m_data & mode) != 0);
|
||||||
else
|
else
|
||||||
return (mode == plan->m_data);
|
return (mode == plan->m_data);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
@ -1447,6 +1457,9 @@ c_perm(char ***argvp, int isok)
|
||||||
if (*perm == '-') {
|
if (*perm == '-') {
|
||||||
new->flags = F_ATLEAST;
|
new->flags = F_ATLEAST;
|
||||||
++perm;
|
++perm;
|
||||||
|
} else if (*perm == '+') {
|
||||||
|
new->flags = F_ANY;
|
||||||
|
++perm;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((set = setmode(perm)) == NULL)
|
if ((set = setmode(perm)) == NULL)
|
||||||
|
@ -1562,7 +1575,7 @@ f_regex(PLAN *plan, FTSENT *entry)
|
||||||
static PLAN *
|
static PLAN *
|
||||||
c_regex_common(char ***argvp, int isok, enum ntype type, bool icase)
|
c_regex_common(char ***argvp, int isok, enum ntype type, bool icase)
|
||||||
{
|
{
|
||||||
char errbuf[LINE_MAX];
|
char errbuf[100];
|
||||||
regex_t reg;
|
regex_t reg;
|
||||||
char *regexp = **argvp;
|
char *regexp = **argvp;
|
||||||
char *lineregexp;
|
char *lineregexp;
|
||||||
|
@ -1687,9 +1700,11 @@ c_type(char ***argvp, int isok)
|
||||||
case 'p':
|
case 'p':
|
||||||
mask = S_IFIFO;
|
mask = S_IFIFO;
|
||||||
break;
|
break;
|
||||||
|
#ifdef S_IFSOCK
|
||||||
case 's':
|
case 's':
|
||||||
mask = S_IFSOCK;
|
mask = S_IFSOCK;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
#ifdef S_IFWHT
|
#ifdef S_IFWHT
|
||||||
case 'W':
|
case 'W':
|
||||||
case 'w':
|
case 'w':
|
||||||
|
|
|
@ -30,13 +30,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "from: @(#)ls.c 8.1 (Berkeley) 6/6/93";
|
|
||||||
#else
|
|
||||||
__RCSID("$NetBSD: ls.c,v 1.19 2006/10/11 19:51:10 apb Exp $");
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -52,6 +45,9 @@ __RCSID("$NetBSD: ls.c,v 1.19 2006/10/11 19:51:10 apb Exp $");
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <tzfile.h>
|
#include <tzfile.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <sys/statfs.h>
|
||||||
|
|
||||||
#include "find.h"
|
#include "find.h"
|
||||||
|
|
||||||
|
@ -66,19 +62,40 @@ printlong(char *name, /* filename to print */
|
||||||
struct stat *sb) /* stat buffer */
|
struct stat *sb) /* stat buffer */
|
||||||
{
|
{
|
||||||
char modep[15];
|
char modep[15];
|
||||||
|
static dev_t dev;
|
||||||
|
static int blocksize = 0;
|
||||||
|
long blocks = -1;
|
||||||
|
|
||||||
(void)printf("%7lu %6lld ", (u_long)sb->st_ino,
|
if(!blocksize || sb->st_dev != dev) {
|
||||||
(long long)sb->st_blocks);
|
int fd;
|
||||||
|
struct statfs fs;
|
||||||
|
blocksize = 0;
|
||||||
|
if((fd = open(name, O_RDONLY)) >= 0) {
|
||||||
|
if(fstatfs(fd, &fs) >= 0) {
|
||||||
|
blocksize = fs.f_bsize;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(blocksize > 0)
|
||||||
|
blocks = ((long)sb->st_size+blocksize-1)/blocksize;
|
||||||
|
|
||||||
|
(void)printf("%7lu ", (u_long)sb->st_ino);
|
||||||
|
if(blocks >= 0)
|
||||||
|
(void)printf("%6ld ", blocks);
|
||||||
|
else
|
||||||
|
(void)printf("? ");
|
||||||
(void)strmode(sb->st_mode, modep);
|
(void)strmode(sb->st_mode, modep);
|
||||||
(void)printf("%s %3lu %-*s %-*s ", modep, (unsigned long)sb->st_nlink,
|
(void)printf("%s %3lu %-10s %-10s ", modep, (unsigned long)sb->st_nlink,
|
||||||
LOGIN_NAME_MAX, user_from_uid(sb->st_uid, 0), LOGIN_NAME_MAX,
|
user_from_uid(sb->st_uid, 0),
|
||||||
group_from_gid(sb->st_gid, 0));
|
group_from_gid(sb->st_gid, 0));
|
||||||
|
|
||||||
if (S_ISCHR(sb->st_mode) || S_ISBLK(sb->st_mode))
|
if (S_ISCHR(sb->st_mode) || S_ISBLK(sb->st_mode))
|
||||||
(void)printf("%3d,%5d ", major(sb->st_rdev),
|
(void)printf("%3d,%5d ", major(sb->st_rdev),
|
||||||
minor(sb->st_rdev));
|
minor(sb->st_rdev));
|
||||||
else
|
else
|
||||||
(void)printf("%9lld ", (long long)sb->st_size);
|
(void)printf("%9ld ", (long)sb->st_size);
|
||||||
printtime(sb->st_mtime);
|
printtime(sb->st_mtime);
|
||||||
(void)printf("%s", name);
|
(void)printf("%s", name);
|
||||||
if (S_ISLNK(sb->st_mode))
|
if (S_ISLNK(sb->st_mode))
|
||||||
|
|
|
@ -33,15 +33,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "@(#)main.c 8.4 (Berkeley) 5/4/95";
|
|
||||||
#else
|
|
||||||
__COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\
|
|
||||||
The Regents of the University of California. All rights reserved.");
|
|
||||||
__RCSID("$NetBSD: main.c,v 1.28 2008/07/21 14:19:22 lukem Exp $");
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -86,7 +77,9 @@ main(int argc, char *argv[])
|
||||||
memset(&sa, 0, sizeof(sa));
|
memset(&sa, 0, sizeof(sa));
|
||||||
sa.sa_flags = SA_RESTART;
|
sa.sa_flags = SA_RESTART;
|
||||||
sa.sa_handler = show_path;
|
sa.sa_handler = show_path;
|
||||||
|
#ifdef SIGINFO
|
||||||
sigaction(SIGINFO, &sa, NULL);
|
sigaction(SIGINFO, &sa, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* array to hold dir list. at most (argc - 1) elements. */
|
/* array to hold dir list. at most (argc - 1) elements. */
|
||||||
p = start = malloc(argc * sizeof (char *));
|
p = start = malloc(argc * sizeof (char *));
|
||||||
|
|
|
@ -33,13 +33,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "from: @(#)misc.c 8.2 (Berkeley) 4/1/94";
|
|
||||||
#else
|
|
||||||
__RCSID("$NetBSD: misc.c,v 1.14 2006/10/11 19:51:10 apb Exp $");
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
@ -33,13 +33,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
#ifndef lint
|
|
||||||
#if 0
|
|
||||||
static char sccsid[] = "from: @(#)option.c 8.2 (Berkeley) 4/16/94";
|
|
||||||
#else
|
|
||||||
__RCSID("$NetBSD: option.c,v 1.26 2007/02/06 15:33:22 perry Exp $");
|
|
||||||
#endif
|
|
||||||
#endif /* not lint */
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -75,10 +68,12 @@ static OPTION const options[] = {
|
||||||
{ "-execdir", N_EXECDIR, c_execdir, 1 },
|
{ "-execdir", N_EXECDIR, c_execdir, 1 },
|
||||||
{ "-exit", N_EXIT, c_exit, 0 },
|
{ "-exit", N_EXIT, c_exit, 0 },
|
||||||
{ "-false", N_FALSE, c_false, 0 },
|
{ "-false", N_FALSE, c_false, 0 },
|
||||||
{ "-flags", N_FLAGS, c_flags, 1 },
|
|
||||||
{ "-follow", N_FOLLOW, c_follow, 0 },
|
{ "-follow", N_FOLLOW, c_follow, 0 },
|
||||||
{ "-fprint", N_FPRINT, c_fprint, 1 },
|
{ "-fprint", N_FPRINT, c_fprint, 1 },
|
||||||
|
#ifndef _MINIX
|
||||||
|
{ "-flags", N_FLAGS, c_flags, 1 },
|
||||||
{ "-fstype", N_FSTYPE, c_fstype, 1 },
|
{ "-fstype", N_FSTYPE, c_fstype, 1 },
|
||||||
|
#endif
|
||||||
{ "-group", N_GROUP, c_group, 1 },
|
{ "-group", N_GROUP, c_group, 1 },
|
||||||
{ "-iname", N_INAME, c_iname, 1 },
|
{ "-iname", N_INAME, c_iname, 1 },
|
||||||
{ "-inum", N_INUM, c_inum, 1 },
|
{ "-inum", N_INUM, c_inum, 1 },
|
||||||
|
|
Loading…
Reference in a new issue