[m-dev.] diff: fix for generate_index_html
David Glen JEFFERY
dgj at students.cs.mu.oz.au
Tue Jun 27 15:24:22 AEST 2000
On 27-Jun-2000, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> For future reference (it's not particularly important in this
> instance), as a style issue I would generally write that using
> `case'
>
> case $file in
> README|index.html*) ... ;;
> *) ... ;;
> esac
Ah, *that's* what I was trying to work out how to do. I might as well fix
it. (Well, it sure beats crushing coke cans...).
Estimated hours taken: 0.1
generate_index_html:
Use `case' syntax rather than using `expr' to do pattern matching.
Index: generate_index_html
===================================================================
RCS file: /home/staff/zs/imp/mercury/tools/generate_index_html,v
retrieving revision 1.2
diff -u -t -r1.2 generate_index_html
--- generate_index_html 2000/06/27 04:35:19 1.2
+++ generate_index_html 2000/06/27 05:21:24
@@ -26,18 +26,24 @@
for file in *
do
- if [ `expr $file : index\.html` -ne 10 ] && [ $file != README ]
- then
- if [ -d $file ]
- then
- (cd $file && generate_index_html)
- echo "$img_dir <a href=$file/>$file/</a><br>" >> $INDEX
- else
- size=`ls -l $file | awk '{ print $5; }'`
- sizekb=`expr $size / 1024`
- echo "$img_txt <a href=$file>$file</a> ($sizekb kilobytes)<br>" >> $INDEX
- fi
- fi
+ #
+ # Don't include the README or any of the index files
+ #
+ case $file in
+ README|index.html*)
+ ;;
+
+ *) if [ -d $file ]
+ then
+ (cd $file && generate_index_html)
+ echo "$img_dir <a href=$file/>$file/</a><br>" >> $INDEX
+ else
+ size=`ls -l $file | awk '{ print $5; }'`
+ sizekb=`expr $size / 1024`
+ echo "$img_txt <a href=$file>$file</a> ($sizekb kilobytes)<br>" >> $INDEX
+ fi
+ ;;
+ esac
done
echo "<hr>" >> $INDEX
dgj
--
David Jeffery (dgj at cs.mu.oz.au) | If your thesis is utterly vacuous
PhD student, | Use first-order predicate calculus.
Dept. of Comp. Sci. & Soft. Eng.| With sufficient formality
The University of Melbourne | The sheerist banality
Australia | Will be hailed by the critics: "Miraculous!"
| -- Anon.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list