% Remember to use the lgrind style

\Head{}
\File{finduidgid.sh}{2003}{Apr}{16}{18:46}{1110}
\L{\LB{\C{}\#!_\1bin\1sh}}
\CE{}\L{\LB{}}
\L{\LB{\C{}\#_Question_5,_shell_programming_assignment,_2003.}}
\CE{}\L{\LB{}}
\L{\LB{\V{prog}=\N{\$}(\V{basename}_\N{\$0})}}
\L{\LB{\V{usage}()_\{}}
\L{\LB{___\V{echo}_\S{}\3Usage:_\$prog\3\SE{}}}
\L{\LB{___\K{exit}_\N{1}}}
\L{\LB{\}}}
\L{\LB{}}
\L{\LB{\V{UG\_TMPFILE}=\N{\$}(\V{mktemp}_\1\V{tmp}\1\N{\$}\{\V{prog}\}.\V{XXXXXX})_\|\,\|_\K{exit}_\N{1}}}
\L{\LB{\V{U\_TMPFILE}=\N{\$}(\V{mktemp}_\1\V{tmp}\1\N{\$}\{\V{prog}\}.\V{XXXXXX})__\|\,\|_\K{exit}_\N{1}}}
\L{\LB{\V{G\_TMPFILE}=\N{\$}(\V{mktemp}_\1\V{tmp}\1\N{\$}\{\V{prog}\}.\V{XXXXXX})__\|\,\|_\K{exit}_\N{1}}}
\L{\LB{\K{trap}_\S{}\3rm_\$UG\_TMPFILE_\$U\_TMPFILE_\$G\_TMPFILE\3\SE{}_\V{HUP}_\V{INT}_\V{QUIT}_\V{PIPE}_\V{ALRM}_\V{TERM}_\V{EXIT}}}
\L{\LB{}}
\L{\LB{\V{find}_\N{\$PWD}_\-\V{type}_\V{f}_\2(_\-\V{perm}_\-\N{6000}_\-\V{fprintf}_\N{\$}\{\V{UG\_TMPFILE}\}_\S{}\3\%m\2t\%u\2t\%g\2t\%p\2n\3\SE{}_\-\V{o}_\2}}
\L{\LB{_____________________\-\V{perm}_\-\N{4000}_\-\V{fprintf}_\N{\$}\{\V{U\_TMPFILE}\}__\S{}\3\%m\2t\%u\2t\%g\2t\%p\2n\3\SE{}_\-\V{o}_\2}}
\L{\LB{_____________________\-\V{perm}_\-\N{2000}_\-\V{fprintf}_\N{\$}\{\V{G\_TMPFILE}\}__\S{}\3\%m\2t\%u\2t\%g\2t\%p\2n\3\SE{}_\2)}}
\L{\LB{}}
\L{\LB{\V{UG\_LINES}=\N{\$}(\V{cat}_\N{\$}\{\V{UG\_TMPFILE}\}_\|_\V{wc}_\-\V{l})}}
\L{\LB{\V{U\_LINES}=\N{\$}(\V{cat}_\N{\$}\{\V{U\_TMPFILE}\}___\|_\V{wc}_\-\V{l})}}
\L{\LB{\V{G\_LINES}=\N{\$}(\V{cat}_\N{\$}\{\V{G\_TMPFILE}\}___\|_\V{wc}_\-\V{l})}}
\L{\LB{}}
\L{\LB{\K{if}_[_\S{}\3\$UG\_LINES\3\SE{}_\-\V{gt}_\N{0}_]}}
\L{\LB{\K{then}}}
\L{\LB{____\V{echo}_\S{}\3Ordinary_files_that_are_BOTH_SUID_and_SGID:\3\SE{}}}
\L{\LB{____\V{cat}_\S{}\3\$UG\_TMPFILE\3\SE{}}}
\L{\LB{\K{fi}}}
\L{\LB{\K{if}_[_\S{}\3\$U\_LINES\3\SE{}_\-\V{gt}_\N{0}_]}}
\L{\LB{\K{then}}}
\L{\LB{____[_\S{}\3\$UG\_LINES\3\SE{}_\-\V{gt}_\N{0}_]_\&\&_\V{echo}}}
\L{\LB{____\V{echo}_\S{}\3Ordinary_files_that_are_SUID_only:\3\SE{}}}
\L{\LB{____\V{cat}_\S{}\3\$U\_TMPFILE\3\SE{}}}
\L{\LB{\K{fi}}}
\L{\LB{\K{if}_[_\S{}\3\$G\_LINES\3\SE{}_\-\V{gt}_\N{0}_]}}
\L{\LB{\K{then}}}
\L{\LB{____[_\S{}\3\$U\_LINES\3\SE{}_\-\V{gt}_\N{0}_\-\V{o}_\S{}\3\$UG\_LINES\3\SE{}_\-\V{gt}_\N{0}_]_\&\&_\V{echo}}}
\L{\LB{____\V{echo}_\S{}\3Ordinary_files_that_are_SGID_only:\3\SE{}}}
\L{\LB{____\V{cat}_\S{}\3\$G\_TMPFILE\3\SE{}}}
\L{\LB{\K{fi}}}
