Skip to content

Commit 4e590aa

Browse files
committed
Initial commit (from Comp.sources.unix by Ken Stauffer)
0 parents  commit 4e590aa

File tree

14 files changed

+3346
-0
lines changed

14 files changed

+3346
-0
lines changed

MANIFEST

Whitespace-only changes.

META

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Comp.sources.unix
2+
3+
From
4+
cluster!munnari.oz.au!uhccux!ames!think!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!snorkelwacker!mit-eddie!bbn!bbn.com!rsalz
5+
Sun Feb 18 13:27:32 EST 1990
6+
7+
Submitted-by: Kenneth Stauffer <cpsc.UCalgary.CA!stauffer>
8+
Posting-number: Volume 21, Issue 6
9+
Archive-name: rh2/part01
10+
11+
Rh was written by Ken Stauffer to make the job of finding files easier by
12+
allowing the user to enter real C expressions. This notation is much
13+
easier to master than the notation used by the find(1) command, because
14+
most Unix users already know C. In addition to being easier to use than
15+
find(1), rh expressions can be used to select the desired files.
16+
17+
This version provides a fairly powerful mini-language for writing search
18+
predicates in. It's not unlike the "tw" file walker presented at the
19+
Baltimore 89 Usenix.
20+
21+
22+
23+
From cluster!munnari.oz.au!uhccux!ames!think!mintaka!mit-eddie!bbn!bbn.com!rsalz Sun Feb 18 13:27:33 EST 1990
24+
25+
Submitted-by: Kenneth Stauffer <cpsc.UCalgary.CA!stauffer>
26+
Posting-number: Volume 21, Issue 7
27+
Archive-name: rh2/part02
28+
29+

Makefile

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#
2+
# rh:
3+
# >>>> VERSION: 2 <<<<
4+
# Written by: Ken Stauffer
5+
#
6+
# Place one of the following -D's onto the end of
7+
# the definition of CFLAGS.
8+
#
9+
# -DSYSV
10+
# - System V/III like OS (including Xenix)
11+
#
12+
# -DBSD
13+
# - BSD like OS (including SunOS)
14+
#
15+
# Also, place one of the following -D's onto the end of
16+
# the definition of CFLAGS if you have an operating system
17+
# in the specified subclass of the classes listed above.
18+
#
19+
# -DSUNOS_4
20+
# - SunOS 4.x (subclass of BSD)
21+
#
22+
# -DSYSVR3
23+
# - System V Release 3.x (subclass of SYSV)
24+
#
25+
# getopt.c uses void, so some systems may also need
26+
# -Dvoid=int
27+
#
28+
29+
CFLAGS= -DBSD -DSUNOS_4 -O
30+
31+
OBJS= rhcmds.o rh.o rhparse.o rhdir.o rhdata.o getopt.o glob_match.o
32+
33+
rh: $(OBJS)
34+
cc $(CFLAGS) -o rh $(OBJS)
35+
36+
rhdir.o: rhdir.c rh.h
37+
cc $(CFLAGS) -c rhdir.c
38+
39+
rh.o: rh.c rh.h
40+
cc $(CFLAGS) -c rh.c
41+
42+
rhcmds.o: rhcmds.c rh.h
43+
cc $(CFLAGS) -c rhcmds.c
44+
45+
rhparse.o: rhparse.c rh.h
46+
cc $(CFLAGS) -c rhparse.c
47+
48+
rhdata.o: rhdata.c rh.h
49+
cc $(CFLAGS) -c rhdata.c
50+
51+
getopt.o: getopt.c
52+
cc $(CFLAGS) -Dvoid=int -c getopt.c
53+
54+
glob_match.o: glob_match.c
55+
cc $(CFLAGS) -Dvoid=int -c glob_match.c
56+
57+
clean:
58+
rm -f rh core $(OBJS)

README

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
2+
>>>> V E R S I O N 2 <<<<
3+
4+
INTRODUCTION:
5+
Rh was written by Ken Stauffer to make the
6+
job of finding files easier by allowing the
7+
user to enter real C expressions. This notation is
8+
much easier to master than the notation used by the
9+
find(1) command, because most Unix users
10+
already know C. In addition to being easier to use
11+
than find(1), rh expressions can be used to select
12+
the desired files.
13+
14+
CREDITS:
15+
Guy Harris
16+
- Corrected many portability problems.
17+
David MacKenzie
18+
- Manual revisions. Added getopt and regular expressions.
19+
Norm Hutchinson
20+
- Fixed ungetit().
21+
22+
COMPILING:
23+
To make rh work on your system, you will need to change
24+
some -D options in the Makefile. Define ONE of the
25+
following in the definition of CFLAGS:
26+
27+
-DBSD - This would be used for most BSD systems.
28+
-DSYSV - System V systems.
29+
30+
Also define one of the following:
31+
32+
-DSUNOS_4 - SunOS 4.x (subclass of BSD)
33+
-DSYSVR3 - System V Release 3.x (subclass of SYSV)
34+
35+
In addition to the C source there is also a file called rh.man.
36+
This is a nroff file and can be created by a command like:
37+
38+
nroff -man rh.man > rh.cat
39+
40+
The resultant file (rh.cat) is sutable for general viewing.
41+
42+
RUNNING:
43+
There is a file called rhrc. This file contains some
44+
examples of things that can go into a $HOME/.rhrc file.
45+
If the file "rhrc" is moved to your home directory and renamed
46+
to ".rhrc" then a command like:
47+
48+
% rh -l -e writable
49+
50+
Will do a search of the current directory, executing the function
51+
"writable()", which finds files that other people have write access to.
52+
53+
Once rh is made, you can do what you want with it. A good test to
54+
see if it is working is to do:
55+
56+
% rh -vle 1 /
57+
58+
This will find all files that makes the constant expression '1' true.
59+
So if your root, all the files on the system will be found.
60+
61+
PORTABILITY:
62+
The file rhdir.c contains code that does directory reading.
63+
This is most likely where problems will occur. These differences
64+
have been taken into account for most versions of unix
65+
and will hopefully work on your system.
66+
So far 'rh' works on:
67+
SCO XENIX, BSD 4.3, and SUNOS 4.0
68+
69+
GRAMMER:
70+
The following is the grammer that describes the input language
71+
recognized by rh:
72+
73+
<program> ==> <function list> <expression> EOF
74+
| <function list> <expression> ;
75+
76+
<function list> ==> <function>
77+
| <function list> <function>
78+
| /* empty */
79+
80+
<function> ==> <function heading> { RETURN <expression> ; }
81+
82+
<function heading> ==> IDENTIFIER
83+
| IDENTIFIER ( )
84+
| IDENTIFIER ( <idlist> )
85+
86+
<idlist> ==> IDENTIFIER <idtail>
87+
<idtail> ==> , <idlist>
88+
| /* empty */
89+
90+
<expression> ==> <expr0> ? <expression> : <expression>
91+
92+
<expr0> ==> <expr1> || <expr1>
93+
94+
<expr1> ==> <expr2> && <expr2>
95+
96+
<expr2> ==> <expr3> | <expr3>
97+
98+
<expr3> ==> <expr4> ^ <expr4>
99+
100+
<expr4> ==> <expr5> & <expr5>
101+
102+
<expr5> ==> <expr6> == <expr6>
103+
| <expr6> != <expr6>
104+
105+
<expr6> ==> <expr7> < <expr7>
106+
| <expr7> > <expr7>
107+
| <expr7> <= <expr7>
108+
| <expr7> >= <expr7>
109+
110+
<expr7> ==> <expr8> >> <expr8>
111+
| <expr8> << <expr8>
112+
113+
<expr8> ==> <expr9> + <expr9>
114+
| <expr9> - <expr9>
115+
116+
<expr9> ==> <expr10> * <expr10>
117+
| <expr10> / <expr10>
118+
| <expr10> % <expr10>
119+
120+
<expr10> ==> ~ <expr10>
121+
| ! <expr10>
122+
| - <expr10>
123+
| <factor>
124+
125+
<factor> ==> ( <expression> )
126+
| NUMBER
127+
| <function call>
128+
| IDENTIFIER
129+
| [ <date spec> ]
130+
| STRING
131+
132+
<function call> ==> IDENTIFIER
133+
| IDENTIFIER ( <exprlist> )
134+
| IDENTIFIER ( )
135+
136+
<exprlist> ==> <expression> <exprtail>
137+
<exprtail> ==> , <exprlist>
138+
| /* empty */
139+
140+
<datespec> ==> NUMBER / NUMBER / NUMBER
141+
142+
--------------------------------------------------------------------
143+
Ken Stauffer.
144+
root@sixk

0 commit comments

Comments
 (0)