home *** CD-ROM | disk | FTP | other *** search
- /*
- Stuff 2.0.
-
- Checksum: 620608636 (verify with "brik")
-
- (C) Copyright 1988 Rahul Dhesi. Permission is granted to copy and
- distribute this file in modified or unmodified form, whether for
- noncommercial or commercial use, provided (a) this copyright notice
- is preserved, (b) no attempt is made to restrict redistribution of
- this file, and (c) this file is not distributed as part of any
- collection whose redistribution is restricted by a compilation
- copyright.
- */
-
- /*
- All functions and common types are declared here
- */
-
- void *malloc (unsigned size);
- void *emalloc (unsigned size);
- void exit (int);
- void givehelp(void);
- void doarg (char *pathname);
- void forceslash (char *pathname);
- char *findlast (char *str, char *component);
- char *strlwr (char *str);
- void memerr(void);
- void parseopt (char **argv, int *i, int argc, int negate);
- void bugreport(char *func);
- int matchstr (char *str, char *pat);
- void dumpopts (void);
- char *fptr(char *pathname);
- long mstonix (unsigned date, unsigned time);
- long systime(void);
- long filetime (char *fname);
- char *lastptr (char *str);
-
- #define PATHSIZE 100
- #define FMTSIZE 200
- #define STRCMP(r,op,s) (strcmp(r,s) op 0)
- #define MAX_OPTS 4000 /* max options */
-
- /* For each option, we have a structure to hold its details */
- typedef enum { BIGGER, SAME, SMALLER } compare_pt; /* for + or - options */
- typedef enum
- {PRINT,NAME,SIZE,MTIME,MODIFIED,OLDER,NEWER,TYPE,FORMAT,NONE,LIMIT}
- choice_pt;
-
- compare_pt getcompare (char *str);
- long getvalue (char *str);
-
- /* whether to negate the next option or not -- used by parseopt() */
- #define NORMAL 0
- #define NEGATE 1
-
- #define OPT_PRINT "-print"
- #define OPT_NAME "-name"
- #define OPT_SIZE "-size"
- #define OPT_MTIME "-mtime"
- #define OPT_MODIFIED "-modified"
- #define OPT_OLDER "-older"
- #define OPT_NEWER "-newer"
- #define OPT_TYPE "-type"
- #define OPT_FORMAT "-format"
- #define OPT_LIMIT "-limit"
- typedef int boolean;
- typedef char name_pt[PATHSIZE]; /* just a filename */
- typedef struct { long value; compare_pt choice; } size_pt; /* -size +n */
- typedef struct { long value; compare_pt choice; } mtime_pt; /* -mtime +n */
- typedef struct {
- boolean negate;
- choice_pt choice;
- union {
- name_pt name;
- size_pt size_info;
- mtime_pt mtime_info;
- } info;
- } request_rec;
-
- struct file_info {
- long utime;
- long size;
- char attrib;
- };
-
- void dopath (char *pathname, struct file_info *);
-
- int cmptime (long utime, compare_pt choice, long value);
- int cmptime2 (long utime, compare_pt choice, long value);
- int cmpsize (long size, compare_pt choice, long value);
-
- #if !defined(NDEBUG)
- #define assert(p) if(!(p)){printf(\
- "Assertion failed: file %s, line %d\n",\
- __FILE__, __LINE__);exit(1);}
- #else
- #define assert(p)
- #endif
-
- #ifdef DEBUG
- # define debug(x) do{x}until(1)
- #else
- # define debug(x)
- #endif
-
- #ifndef NULL
- #define NULL 0
- #endif
-