[m-rev.] diff: fix index file generation on download sites

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Dec 23 15:36:11 AEDT 2010


Branches: main

Fix a problem with index file generation for the WWW and FTP download sites.

tools/generate_index_html:
 	Only report files sizes for non-directories.  (The existing way of
 	computing files sizes didn't work when invoked on a directory and
 	resulted in a bunch of error messages from expr.)

Julien.

Index: generate_index_html
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/tools/generate_index_html,v
retrieving revision 1.22
diff -u -r1.22 generate_index_html
--- generate_index_html	22 Dec 2010 14:45:10 -0000	1.22
+++ generate_index_html	23 Dec 2010 04:31:54 -0000
@@ -67,11 +67,16 @@
      prefix="$1"
      this_file="$2"
      this_file_descr="$3"
-    this_file_size=`ls -Ll "$this_file" | awk '{ print $5; }'`
-    this_file_sizekb=`expr "$this_file_size" / 1024`
-    handled_files="$this_file $handled_files"
      q='"'
-    echo "$prefix <a href=$q$this_file$q>$this_file_descr</a> ($this_file_sizekb kilobytes)" >> $INDEX 
+    if test -d "$this_file"
+    then
+        echo "$prefix <a href=$q$this_file$q>$this_file_descr</a>" >> $INDEX
+    else
+        this_file_size=`ls -Ll "$this_file" | awk '{ print $5; }'`
+        this_file_sizekb=`expr "$this_file_size" / 1024`
+        echo "$prefix <a href=$q$this_file$q>$this_file_descr</a> ($this_file_sizekb kilobytes)" >> $INDEX 
+    fi
+    handled_files="$this_file $handled_files"
  }

  #-----------------------------------------------------------------------------#

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list