Skip to content

Commit

Permalink
Initial commit (from Comp.sources.unix by Ken Stauffer)
Browse files Browse the repository at this point in the history
  • Loading branch information
raforg committed Feb 18, 1990
0 parents commit 4e590aa
Show file tree
Hide file tree
Showing 14 changed files with 3,346 additions and 0 deletions.
Empty file added MANIFEST
Empty file.
29 changes: 29 additions & 0 deletions META
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
Comp.sources.unix

From
cluster!munnari.oz.au!uhccux!ames!think!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!snorkelwacker!mit-eddie!bbn!bbn.com!rsalz
Sun Feb 18 13:27:32 EST 1990

Submitted-by: Kenneth Stauffer <cpsc.UCalgary.CA!stauffer>
Posting-number: Volume 21, Issue 6
Archive-name: rh2/part01

Rh was written by Ken Stauffer to make the job of finding files easier by
allowing the user to enter real C expressions. This notation is much
easier to master than the notation used by the find(1) command, because
most Unix users already know C. In addition to being easier to use than
find(1), rh expressions can be used to select the desired files.

This version provides a fairly powerful mini-language for writing search
predicates in. It's not unlike the "tw" file walker presented at the
Baltimore 89 Usenix.



From cluster!munnari.oz.au!uhccux!ames!think!mintaka!mit-eddie!bbn!bbn.com!rsalz Sun Feb 18 13:27:33 EST 1990

Submitted-by: Kenneth Stauffer <cpsc.UCalgary.CA!stauffer>
Posting-number: Volume 21, Issue 7
Archive-name: rh2/part02


58 changes: 58 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# rh:
# >>>> VERSION: 2 <<<<
# Written by: Ken Stauffer
#
# Place one of the following -D's onto the end of
# the definition of CFLAGS.
#
# -DSYSV
# - System V/III like OS (including Xenix)
#
# -DBSD
# - BSD like OS (including SunOS)
#
# Also, place one of the following -D's onto the end of
# the definition of CFLAGS if you have an operating system
# in the specified subclass of the classes listed above.
#
# -DSUNOS_4
# - SunOS 4.x (subclass of BSD)
#
# -DSYSVR3
# - System V Release 3.x (subclass of SYSV)
#
# getopt.c uses void, so some systems may also need
# -Dvoid=int
#

CFLAGS= -DBSD -DSUNOS_4 -O

OBJS= rhcmds.o rh.o rhparse.o rhdir.o rhdata.o getopt.o glob_match.o

rh: $(OBJS)
cc $(CFLAGS) -o rh $(OBJS)

rhdir.o: rhdir.c rh.h
cc $(CFLAGS) -c rhdir.c

rh.o: rh.c rh.h
cc $(CFLAGS) -c rh.c

rhcmds.o: rhcmds.c rh.h
cc $(CFLAGS) -c rhcmds.c

rhparse.o: rhparse.c rh.h
cc $(CFLAGS) -c rhparse.c

rhdata.o: rhdata.c rh.h
cc $(CFLAGS) -c rhdata.c

getopt.o: getopt.c
cc $(CFLAGS) -Dvoid=int -c getopt.c

glob_match.o: glob_match.c
cc $(CFLAGS) -Dvoid=int -c glob_match.c

clean:
rm -f rh core $(OBJS)
144 changes: 144 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@

>>>> V E R S I O N 2 <<<<

INTRODUCTION:
Rh was written by Ken Stauffer to make the
job of finding files easier by allowing the
user to enter real C expressions. This notation is
much easier to master than the notation used by the
find(1) command, because most Unix users
already know C. In addition to being easier to use
than find(1), rh expressions can be used to select
the desired files.

CREDITS:
Guy Harris
- Corrected many portability problems.
David MacKenzie
- Manual revisions. Added getopt and regular expressions.
Norm Hutchinson
- Fixed ungetit().

COMPILING:
To make rh work on your system, you will need to change
some -D options in the Makefile. Define ONE of the
following in the definition of CFLAGS:

-DBSD - This would be used for most BSD systems.
-DSYSV - System V systems.

Also define one of the following:

-DSUNOS_4 - SunOS 4.x (subclass of BSD)
-DSYSVR3 - System V Release 3.x (subclass of SYSV)

In addition to the C source there is also a file called rh.man.
This is a nroff file and can be created by a command like:

nroff -man rh.man > rh.cat

The resultant file (rh.cat) is sutable for general viewing.

RUNNING:
There is a file called rhrc. This file contains some
examples of things that can go into a $HOME/.rhrc file.
If the file "rhrc" is moved to your home directory and renamed
to ".rhrc" then a command like:

% rh -l -e writable

Will do a search of the current directory, executing the function
"writable()", which finds files that other people have write access to.

Once rh is made, you can do what you want with it. A good test to
see if it is working is to do:

% rh -vle 1 /

This will find all files that makes the constant expression '1' true.
So if your root, all the files on the system will be found.

PORTABILITY:
The file rhdir.c contains code that does directory reading.
This is most likely where problems will occur. These differences
have been taken into account for most versions of unix
and will hopefully work on your system.
So far 'rh' works on:
SCO XENIX, BSD 4.3, and SUNOS 4.0

GRAMMER:
The following is the grammer that describes the input language
recognized by rh:

<program> ==> <function list> <expression> EOF
| <function list> <expression> ;

<function list> ==> <function>
| <function list> <function>
| /* empty */

<function> ==> <function heading> { RETURN <expression> ; }

<function heading> ==> IDENTIFIER
| IDENTIFIER ( )
| IDENTIFIER ( <idlist> )

<idlist> ==> IDENTIFIER <idtail>
<idtail> ==> , <idlist>
| /* empty */

<expression> ==> <expr0> ? <expression> : <expression>

<expr0> ==> <expr1> || <expr1>

<expr1> ==> <expr2> && <expr2>

<expr2> ==> <expr3> | <expr3>

<expr3> ==> <expr4> ^ <expr4>

<expr4> ==> <expr5> & <expr5>

<expr5> ==> <expr6> == <expr6>
| <expr6> != <expr6>

<expr6> ==> <expr7> < <expr7>
| <expr7> > <expr7>
| <expr7> <= <expr7>
| <expr7> >= <expr7>

<expr7> ==> <expr8> >> <expr8>
| <expr8> << <expr8>

<expr8> ==> <expr9> + <expr9>
| <expr9> - <expr9>

<expr9> ==> <expr10> * <expr10>
| <expr10> / <expr10>
| <expr10> % <expr10>

<expr10> ==> ~ <expr10>
| ! <expr10>
| - <expr10>
| <factor>

<factor> ==> ( <expression> )
| NUMBER
| <function call>
| IDENTIFIER
| [ <date spec> ]
| STRING

<function call> ==> IDENTIFIER
| IDENTIFIER ( <exprlist> )
| IDENTIFIER ( )

<exprlist> ==> <expression> <exprtail>
<exprtail> ==> , <exprlist>
| /* empty */

<datespec> ==> NUMBER / NUMBER / NUMBER

--------------------------------------------------------------------
Ken Stauffer.
root@sixk
Loading

0 comments on commit 4e590aa

Please sign in to comment.