From: Colin Watson Date: Sun, 29 Dec 2002 19:12:23 +0000 (+0000) Subject: bin: Remove some scripts I no longer use (they used to be part of the X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?p=bin.git;a=commitdiff_plain;h=6d1b5e7560ec759d8eb0e0d9f4cee43c1b40da32 bin: Remove some scripts I no longer use (they used to be part of the public_html build process). --- diff --git a/expandvars b/expandvars deleted file mode 100755 index d9d7fd9..0000000 --- a/expandvars +++ /dev/null @@ -1,97 +0,0 @@ -#! /usr/bin/perl -w -use strict; -use Getopt::Long; - -sub usage () -{ - print STDERR <<"EOF"; -Usage: $0 [options] source-filename -EOF - print STDERR <<'EOF'; -where options are: - - -h, -?, --help print this message - -c, --conf FILENAME use FILENAME as configuration file, default - '.headers' - -d, --directory DIR change to directory DIR - -s, --suffix SUFFIX use SUFFIX for all output filenames, default null - -The configuration file is of the following form: - -# Comments are preceded by hashes and extend to the end of the line. -# List of names of parameters to be substituted (as $param1$, $param2$, -# etc.) in order. -param1 param2 ... - -# Multiple records, one per line. -# Each record consists of an output filename (automatically used as the value -# of the name parameter; suffix will be added if present) followed by a list of -# parameter values. Fields are space-separated. Double quotes (") may be used -# to delimit fields containing spaces, and double quotes themselves may be -# escaped with backslashes. - -EOF - exit; -} - -my %opts = (conf => '.headers', directory => '', suffix => ''); -GetOptions(\%opts, 'help|h|?', 'conf|c=s', 'directory|d=s', 'suffix|s=s'); -my $source = shift; -usage unless defined $source; - -usage if $opts{'help'}; -chdir $opts{'directory'} if $opts{'directory'}; -open CONF, $opts{'conf'} or - die "Can't open configuration file " . $opts{'conf'} . ": $!"; --r $source or die "Can't read source file $source: $!"; - -my @params; -while () -{ - next if /^#/ || /^\s+/; - @params = split; - last; -} - -usage unless @params; - -# Eek. This matches the next (optionally double-quoted) string on the line. -my $stringre = qr/\s*("(?:[^\\]|\\.)*?"|(?:[^\\]|\\.)+?)(?:\s|$)/; -while () -{ - next if /^#/ || /^\s+/; - my $confline = $_; - next unless $confline =~ /$stringre/g; - my $target = $1; - my %values = (name => $target); - my @conffields = ($confline =~ /\G$stringre/g); - my $offset = 0; - for (my $i = 0; $i + $offset <= $#params && $i <= $#conffields; $i++) - { - $offset++ while $params[$i + $offset] eq 'name'; - last if $i + $offset > $#params; - my $value = $conffields[$i]; - $value =~ s/^"(.*)"$/$1/; - $value =~ s/\\(.)/$1/g; - $values{$params[$i + $offset]} = $value; - } - - # Do the substitution in the source file. - open SOURCE, $source or die "Can't open source file $source: $!"; - open TARGET, ">$target" . $opts{'suffix'} or - die "Can't open target file $target" . $opts{'suffix'} . ": $!"; - select TARGET; - while () - { - foreach my $param (keys %values) - { - my $value = $values{$param}; - s/\$\Q$param\E\$/$value/g; - } - s/\$\$/\$/g; - print; - } - select STDOUT; - close TARGET; -} - diff --git a/format b/format deleted file mode 100755 index 08a9d45..0000000 --- a/format +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Parameterizes a document. -# Input arguments Param1 Value1 Param2 Value2 ... will replace -# $Param1$ with Value1, $Param2$ with Value2, and so on. - -# Arguments with spaces in must be quoted. - -function getargs () -{ - while [ $# != 0 -a $# != 1 ]; do - SUBST=${2//\'/\'\\\'\'}; - SUBST=${SUBST//\//\\\/}; - echo -n -; - echo -n e \'s/\\\$$1\\\$/$SUBST/g\'\ ; - shift 2; - done - echo -n -; - echo -n e \'s/\\\$\%/\$/g\' -e \'s/\\\$\\\$/\$/g\'\ ; - echo -n $1; -} - -if [ "$1" == "-v" ]; then - shift; - bash --norc -vc "sed `getargs \"$@\"`"; -else - bash --norc -c "sed `getargs \"$@\"`"; -fi - diff --git a/genheaders b/genheaders deleted file mode 100755 index d9035f3..0000000 --- a/genheaders +++ /dev/null @@ -1,2 +0,0 @@ -#! /bin/sh -expandvars -s .header.ssi header.ssi