summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorwosch <wosch@FreeBSD.org>1997-11-09 11:23:54 +0000
committerwosch <wosch@FreeBSD.org>1997-11-09 11:23:54 +0000
commita69ac9160a2e4ec27cb305df1a71885d86d4708e (patch)
treee55ab79a6c023f87b498fbec1b7a18477560c0eb /tools
parent67ba7220fd45bbe2b4448467dfc3e852b313ec21 (diff)
downloadFreeBSD-src-a69ac9160a2e4ec27cb305df1a71885d86d4708e.zip
FreeBSD-src-a69ac9160a2e4ec27cb305df1a71885d86d4708e.tar.gz
Add html-mv script. Html-mv rename HTML generated filenames to
human readable filenames. E.g.: $ cd FAQ $ make FORMATS=html $ html-mv FAQ $ ls FAQ_ACKNOWLEDGMENTS.html FAQ_Any_restrictions_on_how_I_divide_the_disk_up_.html FAQ_Are_there_any_Database_systems_for_FreeBSD_.html FAQ_Are_there_any_commercial_high-performance_X_servers_.html FAQ_Books_on_FreeBSD.html FAQ_Can_FreeBSD_handle_multiport_serial_cards_sharing_irqs_.html [...]
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/README3
-rw-r--r--tools/tools/html-mv/html-mv59
2 files changed, 61 insertions, 1 deletions
diff --git a/tools/tools/README b/tools/tools/README
index ef68551..533a774 100644
--- a/tools/tools/README
+++ b/tools/tools/README
@@ -1,4 +1,4 @@
-# $Id: README,v 1.8 1997/02/22 14:08:16 peter Exp $
+# $Id: README,v 1.9 1997/04/25 14:14:31 wosch Exp $
This directory is for tools.
@@ -16,3 +16,4 @@ kdrv KernelDriver; add/list/remove third-party kernel driver
source to/in/from a kernel source tree.
scsi-defects Get at the primary or grown defect list of a SCSI disk.
portsinfo Generate list of new ports for last two weeks.
+html-mv Rename HTML generated filenames to human readable filenames.
diff --git a/tools/tools/html-mv/html-mv b/tools/tools/html-mv/html-mv
new file mode 100644
index 0000000..c91f533
--- /dev/null
+++ b/tools/tools/html-mv/html-mv
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright (c) 1997 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
+# All rights reserved.
+#
+# rename sgml/html generated file names to human readable file names
+#
+# $ cd FAQ
+# $ make FORMATS=html
+# $ html-mv FAQ
+# $ ls
+# FAQ_ACKNOWLEDGMENTS.html
+# FAQ_Any_restrictions_on_how_I_divide_the_disk_up_.html
+# FAQ_Are_there_any_Database_systems_for_FreeBSD_.html
+# FAQ_Are_there_any_commercial_high-performance_X_servers_.html
+# FAQ_Books_on_FreeBSD.html
+# FAQ_Can_FreeBSD_handle_multiport_serial_cards_sharing_irqs_.html
+# [...]
+#
+# $Id$
+
+case $# in 0)
+ echo "usage `basename $0` file"
+ exit 1
+esac
+
+file=$1; export file
+
+if [ -f "$file.html" ]; then :
+else
+ echo "$file.html does not exist"
+ exit 1
+fi
+
+# search for title name
+egrep -i '^<title' $file[1-9]*.html |
+ perl -npe 's/<TITLE>[\*\s]*//; s%\s*</TITLE>.*%%;
+ s/[^a-zA-Z0-9\_\-\.:\n]/_/g' > .list
+
+# create sed commands
+awk -F: '{print "s/" $1 "/'$file'_" $2 ".html/g;"}' .list > .sed
+
+# create mv(1) shell script
+perl -ne 'chop;($a,$b)=split(/:/);
+ print qq[rename ("$a", "$ENV{'file'}_$b.html") || ] .
+ qq[die "rename $a $ENV{'file'}_$b.html:\$\!";\n]' .list > .mv
+
+# replace links
+if [ -f "$file.ln" ]; then
+ perl -i -p .sed $file.ln
+fi
+
+# replace links
+perl -i -p .sed $file*.html
+
+# rename file names
+perl .mv
+
+rm -f .mv .sed .list
OpenPOWER on IntegriCloud