src/commands/simple/find.c File Reference

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <pwd.h>
#include <grp.h>
#include <dirent.h>
#include <limits.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  exec
struct  node
struct  oper

Defines

#define LSTAT   stat
#define SHELL   "/bin/sh"
#define MAXARG   256
#define BSIZE   512
#define SECS_PER_DAY   (24L*60L*60L)
#define OP_NAME   1
#define OP_PERM   2
#define OP_TYPE   3
#define OP_LINKS   4
#define OP_USER   5
#define OP_GROUP   6
#define OP_SIZE   7
#define OP_SIZEC   8
#define OP_INUM   9
#define OP_ATIME   10
#define OP_CTIME   11
#define OP_MTIME   12
#define OP_EXEC   13
#define OP_OK   14
#define OP_PRINT   15
#define OP_PRINT0   16
#define OP_NEWER   17
#define OP_CNEWER   18
#define OP_AND   19
#define OP_OR   20
#define OP_XDEV   21
#define OP_DEPTH   22
#define OP_PRUNE   23
#define OP_NOUSER   24
#define OP_NOGROUP   25
#define LPAR   26
#define RPAR   27
#define NOT   28
#define EOI   -1
#define NONE   0
#define ISWHO(c)   ((c == 'u') || (c == 'g') || (c == 'o') || (c == 'a'))
#define ISOPER(c)   ((c == '-') || (c == '=') || (c == '+'))
#define ISMODE(c)
#define MUSER   1
#define MGROUP   2
#define MOTHERS   4

Functions

 _PROTOTYPE (int main,(int argc, char **argv))
 _PROTOTYPE (char *Malloc,(int n))
 _PROTOTYPE (char *Salloc,(char *s))
 _PROTOTYPE (void find,(char *path, struct node *pred, char *last))
 _PROTOTYPE (int check,(char *path, struct stat *st, struct node *n, char *last))
 _PROTOTYPE (int ichk,(long val, struct node *n))
 _PROTOTYPE (int lex,(char *str))
 _PROTOTYPE (struct node *newnode,(int t))
 _PROTOTYPE (int isnumber,(char *str, int base, int sign))
 _PROTOTYPE (void number,(char *str, int base, long *pl, int *ps))
 _PROTOTYPE (void fmode,(char *str, long *pl, int *ps))
 _PROTOTYPE (void checkarg,(char *arg))
 _PROTOTYPE (void nonfatal,(char *s1, char *s2))
 _PROTOTYPE (int smatch,(char *s, char *t))
 _PROTOTYPE (int execute,(int op, struct exec *e, char *path))
 _PROTOTYPE (void domode,(int op, int *mode, int bits))
char * Malloc (int n)
char * Salloc (char *s)
int main (int argc, argv)
void find (char *path, struct node *pred, char *last)
int check (char *path, struct stat *st, struct node *n, char *last)
int ichk (long val, struct node *n)
int lex (char *str)
struct nodenewnode (int t)
int isnumber (char *str, int base, int sign)
void number (char *str, int base, long *pl, int *ps)
void domode (int op, int *mode, int bits)
void fmode (char *str, long *pl, int *ps)
struct nodeexpr (int t)
struct nodeprimary (int t)
struct nodesecondary (int t)
void checkarg (char *arg)
struct nodesimple (int t)
void nonfatal (char *s1, char *s2)
void fatal (char *s1, char *s2)
int smatch (char *s, char *t)
char * find_bin (char *s)
int execute (int op, struct exec *e, char *path)

Variables

struct oper ops []
char ** ipp
char * prog
char * epath
long current_time
int tty
int xdev_flag = 0
int devnr
int depth_flag = 0
int prune_here
int um
int needprint = 1


Define Documentation

#define BSIZE   512

Definition at line 29 of file find.c.

#define EOI   -1

Definition at line 62 of file find.c.

#define ISMODE ( c   ) 

Value:

((c == 'r') || (c == 'w') || (c == 'x') || \
                         (c == 's') || (c == 't'))

Definition at line 68 of file find.c.

#define ISOPER ( c   )     ((c == '-') || (c == '=') || (c == '+'))

Definition at line 67 of file find.c.

#define ISWHO ( c   )     ((c == 'u') || (c == 'g') || (c == 'o') || (c == 'a'))

Definition at line 66 of file find.c.

#define LPAR   26

Definition at line 57 of file find.c.

#define LSTAT   stat

Definition at line 24 of file find.c.

#define MAXARG   256

Definition at line 28 of file find.c.

#define MGROUP   2

Definition at line 71 of file find.c.

#define MOTHERS   4

Definition at line 72 of file find.c.

#define MUSER   1

Definition at line 70 of file find.c.

#define NONE   0

Definition at line 63 of file find.c.

#define NOT   28

Definition at line 59 of file find.c.

#define OP_AND   19

Definition at line 50 of file find.c.

#define OP_ATIME   10

Definition at line 41 of file find.c.

#define OP_CNEWER   18

Definition at line 49 of file find.c.

#define OP_CTIME   11

Definition at line 42 of file find.c.

#define OP_DEPTH   22

Definition at line 53 of file find.c.

#define OP_EXEC   13

Definition at line 44 of file find.c.

#define OP_GROUP   6

Definition at line 37 of file find.c.

#define OP_INUM   9

Definition at line 40 of file find.c.

#define OP_LINKS   4

Definition at line 35 of file find.c.

#define OP_MTIME   12

Definition at line 43 of file find.c.

#define OP_NAME   1

Definition at line 32 of file find.c.

#define OP_NEWER   17

Definition at line 48 of file find.c.

#define OP_NOGROUP   25

Definition at line 56 of file find.c.

#define OP_NOUSER   24

Definition at line 55 of file find.c.

#define OP_OK   14

Definition at line 45 of file find.c.

#define OP_OR   20

Definition at line 51 of file find.c.

#define OP_PERM   2

Definition at line 33 of file find.c.

#define OP_PRINT   15

Definition at line 46 of file find.c.

#define OP_PRINT0   16

Definition at line 47 of file find.c.

#define OP_PRUNE   23

Definition at line 54 of file find.c.

#define OP_SIZE   7

Definition at line 38 of file find.c.

#define OP_SIZEC   8

Definition at line 39 of file find.c.

#define OP_TYPE   3

Definition at line 34 of file find.c.

#define OP_USER   5

Definition at line 36 of file find.c.

#define OP_XDEV   21

Definition at line 52 of file find.c.

#define RPAR   27

Definition at line 58 of file find.c.

#define SECS_PER_DAY   (24L*60L*60L)

Definition at line 30 of file find.c.

#define SHELL   "/bin/sh"

Definition at line 27 of file find.c.


Function Documentation

_PROTOTYPE ( void  domode,
(int op, int *mode, int bits  
)

_PROTOTYPE ( int  execute,
(int op, struct exec *e, char *path  
)

_PROTOTYPE ( int  smatch,
(char *s, char *t  
)

_PROTOTYPE ( void  nonfatal,
(char *s1, char *s2)   
)

_PROTOTYPE ( void  checkarg,
(char *arg  
)

_PROTOTYPE ( void  fmode,
(char *str, long *pl, int *ps  
)

_PROTOTYPE ( void  number,
(char *str, int base, long *pl, int *ps  
)

_PROTOTYPE ( int  isnumber,
(char *str, int base, int sign  
)

_PROTOTYPE ( struct node newnode,
(int t  
)

_PROTOTYPE ( int  lex,
(char *str  
)

_PROTOTYPE ( int  ichk,
(long val, struct node *n  
)

_PROTOTYPE ( int  check,
(char *path, struct stat *st, struct node *n, char *last  
)

_PROTOTYPE ( void  find,
(char *path, struct node *pred, char *last  
)

_PROTOTYPE ( char *  Salloc,
(char *s  
)

_PROTOTYPE ( char *  Malloc,
(int n  
)

_PROTOTYPE ( int  main,
(int argc, char **argv)   
)

int check ( char *  path,
struct stat st,
struct node n,
char *  last 
)

Definition at line 335 of file find.c.

void checkarg ( char *  arg  ) 

Definition at line 642 of file find.c.

void domode ( int  op,
int *  mode,
int  bits 
)

Definition at line 493 of file find.c.

int execute ( int  op,
struct exec e,
char *  path 
)

Definition at line 893 of file find.c.

struct node* expr ( int  t  )  [read]

Definition at line 587 of file find.c.

void fatal ( char *  s1,
char *  s2 
)

Definition at line 810 of file find.c.

void find ( char *  path,
struct node pred,
char *  last 
)

Definition at line 274 of file find.c.

char* find_bin ( char *  s  ) 

Definition at line 863 of file find.c.

void fmode ( char *  str,
long *  pl,
int *  ps 
)

Definition at line 510 of file find.c.

int ichk ( long  val,
struct node n 
)

Definition at line 406 of file find.c.

int isnumber ( char *  str,
int  base,
int  sign 
)

Definition at line 466 of file find.c.

int lex ( char *  str  ) 

Definition at line 421 of file find.c.

int main ( int argc  ,
argv   
)

Definition at line 235 of file find.c.

char* Malloc ( int  n  ) 

Definition at line 217 of file find.c.

struct node* newnode ( int  t  )  [read]

Definition at line 446 of file find.c.

void nonfatal ( char *  s1,
char *  s2 
)

Definition at line 804 of file find.c.

void number ( char *  str,
int  base,
long *  pl,
int *  ps 
)

Definition at line 477 of file find.c.

struct node* primary ( int  t  )  [read]

Definition at line 605 of file find.c.

char* Salloc ( char *  s  ) 

Definition at line 227 of file find.c.

struct node* secondary ( int  t  )  [read]

Definition at line 623 of file find.c.

struct node* simple ( int  t  )  [read]

Definition at line 649 of file find.c.

int smatch ( char *  s,
char *  t 
)

Definition at line 819 of file find.c.


Variable Documentation

Definition at line 181 of file find.c.

int depth_flag = 0

Definition at line 185 of file find.c.

int devnr

Definition at line 184 of file find.c.

char* epath

Definition at line 180 of file find.c.

char** ipp

Definition at line 178 of file find.c.

int needprint = 1

Definition at line 188 of file find.c.

struct oper ops[]

char* prog

Definition at line 179 of file find.c.

Definition at line 186 of file find.c.

int tty

Definition at line 182 of file find.c.

int um

Definition at line 187 of file find.c.

int xdev_flag = 0

Definition at line 183 of file find.c.


Generated on Tue Mar 9 04:36:39 2010 for Minix by  doxygen 1.5.8