From cd3d78bbb1b41a100603a80877ebd354265301d9 Mon Sep 17 00:00:00 2001 From: cvs2git Date: Mon, 16 Jul 2001 07:46:18 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'combined_graph'. --- agestat/GNUmakefile | 26 ---- agestat/agestat.pl | 86 ------------ agestat/configure | 30 ----- cgigw/cgigw.cgi | 106 --------------- charhist/GNUmakefile | 10 -- charhist/charhist.c | 21 --- chartab/GNUmakefile | 11 -- chartab/chartab.c | 10 -- chartab/ctype-test.c | 17 --- cleandir/.vimrc | 6 - cleandir/GNUmakefile | 39 ------ cleandir/cleandir | 131 ------------------- cleandir/cleandir.pl | 134 ------------------- cleandir/configure | 34 ----- count/GNUmakefile | 22 ---- count/count.c | 30 ----- cvsdiffmin/.vimrc | 6 - cvsdiffmin/GNUmakefile | 24 ---- cvsdiffmin/configure | 68 ---------- cvsdiffmin/cvsdiffmin.pl | 69 ---------- ddm/GNUmakefile | 34 ----- ddm/cfg/mnttab.sh | 10 -- ddm/ddm.c | 231 --------------------------------- ddm/stats.sh | 7 - dns/GNUmakefile | 20 --- dns/cfg/GNUmakefile | 4 - dns/cfg/have_hstrerror.sh | 11 -- dns/gethostbyname.c | 51 -------- dns/hstrerror.c | 11 -- dns/hstrerror.h | 1 - duwatch/GNUmakefile | 9 -- duwatch/duwatch | 37 ------ errno/GNUmakefile | 15 --- errno/errno.c | 34 ----- fact/GNUmakefile | 35 ----- fact/configure | 34 ----- fact/fact.pl | 31 ----- fix2var/Makefile | 9 -- fix2var/fix2var.c | 94 -------------- fortune/Makefile | 16 --- fortune/fortune.c | 213 ------------------------------ fotoindex/GNUmakefile | 13 -- fotoindex/fotoindex | 57 -------- hogs/memhog.c | 22 ---- ieeefloat/GNUmakefile | 13 -- ieeefloat/ieeefloat.c | 186 -------------------------- lspath/GNUmakefile | 25 ---- lspath/configure | 34 ----- lspath/lspath.pl | 14 -- mailsummary/GNUmakefile | 27 ---- mailsummary/configure | 30 ----- mailsummary/mailsummary.pl | 85 ------------ memlog/GNUmakefile | 12 -- memlog/memlog | 7 - mimetoc/mimetoc | 75 ----------- mkmotd/mkmotd | 30 ----- obwrap/.vimrc | 9 -- obwrap/GNUmakefile | 8 -- obwrap/obwrap.c | 94 -------------- oragetsrc/GNUmakefile | 30 ----- oragetsrc/configure | 34 ----- oragetsrc/oragetsrc.pl | 49 ------- prwtmp/GNUmakefile | 22 ---- prwtmp/prwtmp.c | 110 ---------------- prwtmp/prwtmp.man | 48 ------- rcstell/GNUmakefile | 24 ---- rcstell/rcstell | 55 -------- scat/GNUmakefile | 17 --- scat/scat.c | 103 --------------- scat/scat.de.msg | 5 - scat/scat.en.msg | 5 - setperm/GNUmakefile | 7 - setperm/setperm.c | 80 ------------ shuffle/GNUmakefile | 13 -- shuffle/shuffle.c | 107 --------------- slowcat/.vimrc | 36 ----- slowcat/GNUmakefile | 13 -- slowcat/slowcat.c | 70 ---------- snmp/GNUmakefile | 14 -- snmp/mac-port | 31 ----- snmp/mac-port-bay | 29 ----- tcpdump_tools/tcpdump2ascii | 16 --- tcpdump_tools/tcpdump_sum.pl | 39 ------ tcpdump_tools/tcpdump_sum2.pl | 54 -------- tcpdump_tools/tcpdumptognuplot | 30 ----- time_t/GNUmakefile | 9 -- time_t/time_t.c | 48 ------- tiny/GNUmakefile | 38 ------ tiny/configure | 48 ------- tiny/dus | 2 - tiny/fnp.sh | 2 - tiny/fnpa.sh | 2 - tiny/fnpc.sh | 2 - tiny/fqdn | 9 -- tiny/isodate | 2 - tiny/psg | 9 -- truncate/GNUmakefile | 25 ---- truncate/configure | 40 ------ truncate/truncate.1 | 23 ---- truncate/truncate.sh | 12 -- waste/GNUmakefile | 12 -- waste/patchperl | 14 -- waste/waste.pl | 73 ----------- 103 files changed, 3939 deletions(-) delete mode 100644 agestat/GNUmakefile delete mode 100755 agestat/agestat.pl delete mode 100644 agestat/configure delete mode 100644 cgigw/cgigw.cgi delete mode 100644 charhist/GNUmakefile delete mode 100644 charhist/charhist.c delete mode 100644 chartab/GNUmakefile delete mode 100644 chartab/chartab.c delete mode 100644 chartab/ctype-test.c delete mode 100644 cleandir/.vimrc delete mode 100644 cleandir/GNUmakefile delete mode 100755 cleandir/cleandir delete mode 100755 cleandir/cleandir.pl delete mode 100644 cleandir/configure delete mode 100644 count/GNUmakefile delete mode 100644 count/count.c delete mode 100644 cvsdiffmin/.vimrc delete mode 100644 cvsdiffmin/GNUmakefile delete mode 100644 cvsdiffmin/configure delete mode 100755 cvsdiffmin/cvsdiffmin.pl delete mode 100644 ddm/GNUmakefile delete mode 100644 ddm/cfg/mnttab.sh delete mode 100644 ddm/ddm.c delete mode 100755 ddm/stats.sh delete mode 100644 dns/GNUmakefile delete mode 100644 dns/cfg/GNUmakefile delete mode 100644 dns/cfg/have_hstrerror.sh delete mode 100644 dns/gethostbyname.c delete mode 100644 dns/hstrerror.c delete mode 100644 dns/hstrerror.h delete mode 100644 duwatch/GNUmakefile delete mode 100755 duwatch/duwatch delete mode 100644 errno/GNUmakefile delete mode 100644 errno/errno.c delete mode 100644 fact/GNUmakefile delete mode 100644 fact/configure delete mode 100644 fact/fact.pl delete mode 100644 fix2var/Makefile delete mode 100644 fix2var/fix2var.c delete mode 100644 fortune/Makefile delete mode 100644 fortune/fortune.c delete mode 100644 fotoindex/GNUmakefile delete mode 100755 fotoindex/fotoindex delete mode 100644 hogs/memhog.c delete mode 100644 ieeefloat/GNUmakefile delete mode 100644 ieeefloat/ieeefloat.c delete mode 100644 lspath/GNUmakefile delete mode 100644 lspath/configure delete mode 100755 lspath/lspath.pl delete mode 100644 mailsummary/GNUmakefile delete mode 100755 mailsummary/configure delete mode 100755 mailsummary/mailsummary.pl delete mode 100644 memlog/GNUmakefile delete mode 100644 memlog/memlog delete mode 100755 mimetoc/mimetoc delete mode 100755 mkmotd/mkmotd delete mode 100644 obwrap/.vimrc delete mode 100644 obwrap/GNUmakefile delete mode 100644 obwrap/obwrap.c delete mode 100644 oragetsrc/GNUmakefile delete mode 100644 oragetsrc/configure delete mode 100755 oragetsrc/oragetsrc.pl delete mode 100644 prwtmp/GNUmakefile delete mode 100644 prwtmp/prwtmp.c delete mode 100644 prwtmp/prwtmp.man delete mode 100644 rcstell/GNUmakefile delete mode 100755 rcstell/rcstell delete mode 100644 scat/GNUmakefile delete mode 100644 scat/scat.c delete mode 100644 scat/scat.de.msg delete mode 100644 scat/scat.en.msg delete mode 100644 setperm/GNUmakefile delete mode 100644 setperm/setperm.c delete mode 100644 shuffle/GNUmakefile delete mode 100644 shuffle/shuffle.c delete mode 100644 slowcat/.vimrc delete mode 100644 slowcat/GNUmakefile delete mode 100644 slowcat/slowcat.c delete mode 100644 snmp/GNUmakefile delete mode 100755 snmp/mac-port delete mode 100755 snmp/mac-port-bay delete mode 100755 tcpdump_tools/tcpdump2ascii delete mode 100755 tcpdump_tools/tcpdump_sum.pl delete mode 100755 tcpdump_tools/tcpdump_sum2.pl delete mode 100755 tcpdump_tools/tcpdumptognuplot delete mode 100644 time_t/GNUmakefile delete mode 100644 time_t/time_t.c delete mode 100644 tiny/GNUmakefile delete mode 100644 tiny/configure delete mode 100755 tiny/dus delete mode 100755 tiny/fnp.sh delete mode 100755 tiny/fnpa.sh delete mode 100755 tiny/fnpc.sh delete mode 100755 tiny/fqdn delete mode 100755 tiny/isodate delete mode 100755 tiny/psg delete mode 100644 truncate/GNUmakefile delete mode 100644 truncate/configure delete mode 100644 truncate/truncate.1 delete mode 100644 truncate/truncate.sh delete mode 100644 waste/GNUmakefile delete mode 100644 waste/patchperl delete mode 100755 waste/waste.pl diff --git a/agestat/GNUmakefile b/agestat/GNUmakefile deleted file mode 100644 index 7012132..0000000 --- a/agestat/GNUmakefile +++ /dev/null @@ -1,26 +0,0 @@ -include GNUmakevars - -BINDIR=/usr/local/bin - -all: agestat - -clean: - rm agestat customize - -install: $(BINDIR) $(BINDIR)/agestat - -%: %.pl customize - sh ./customize < $< > $@ - chmod +x $@ - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -$(BINDIR): - mkdir -p $@ - -include GNUmakerules diff --git a/agestat/agestat.pl b/agestat/agestat.pl deleted file mode 100755 index 5e3c206..0000000 --- a/agestat/agestat.pl +++ /dev/null @@ -1,86 +0,0 @@ -#!@@@perl@@@ -w -# -# $Id: agestat.pl,v 1.4 2001-01-19 19:06:01 hjp Exp $ -# - -use strict; -use File::stat; -use File::Find; -use Getopt::Long; - -my $now = time(); -my $log_2 = log(2); - -my %opts = (); -GetOptions(\%opts, "atime", "mtime", "scale=s"); -my $scale; -if (!defined($opts{scale})) { - $scale = 1; -} elsif ($opts{scale} eq 'k') { - $scale = 1024; -} elsif ($opts{scale} eq 'M') { - $scale = 1024*1024; -} else { - print STDERR "Usage: $0 [-atime|-mtime] [-scale=(k|M)]\n"; - exit 1; -} - -my @hist; - -sub wanted { - - my $st = lstat($_); - my $age = $now - ( - $opts{atime} ? $st->atime : - $opts{mtime} ? $st->mtime : - ($st->atime > $st->mtime ? $st->atime - : $st->mtime )); - #print $File::Find::name, ": $age sec, ", $st->size, " bytes, ", $st->nlink, " links\n"; - my $log2age = log($age >= 1 ? $age : 1) / $log_2; - $hist[$log2age] += $st->size / $st->nlink; -} - -sub logtime2str { - my ($lt) = (@_); - - my $t = 1 << $lt; - - if ($t < 60) { - return sprintf ("%5.1f s", $t); - } elsif ($t < 3600) { - return sprintf ("%5.1f m", $t/60); - } elsif ($t < 3600 * 24) { - return sprintf ("%5.1f h", $t/3600); - } elsif ($t < 3600 * 24 * 365.2422) { - return sprintf ("%5.1f d", $t/(3600*24)); - } else { - return sprintf ("%5.1f y", $t/(3600*24*365.2422)); - } -} - - -if (@ARGV == 0) { push (@ARGV, "."); } -find(\&wanted, @ARGV); - -print "\n\n"; - -my $sum = 0; - -for (my $i = 0; $i <= $#hist; $i++) { - $sum += ($hist[$i] || 0); -} - - -my $c = 0; -for (my $i = 0; $i <= $#hist; $i++) { - my $h = ($hist[$i] || 0); - $c += $h; - printf("%2d\t%s\t%12.0f\t%5.1f\t%12.0f\t%5.1f\n", $i, - logtime2str($i), $h/$scale, $h * 100 / $sum, $c/$scale, $c * 100 / $sum); -} - -# $Log: agestat.pl,v $ -# Revision 1.4 2001-01-19 19:06:01 hjp -# Removed superfluous "total" line. -# Fixed usage message. -# diff --git a/agestat/configure b/agestat/configure deleted file mode 100644 index 981a6b2..0000000 --- a/agestat/configure +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize.$$ -echo "sed \\" >> customize.$$ -chmod +x customize.$$ - -################################################################ -# find a working perl: -# -for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5 -do - if $i -e 'exit ($] < 5.000)' - then - echo $i works - perl="$i" - break - fi -done -if [ -z "$perl" ] -then - could not find a working perl command, sorry. - exit 1 -fi -echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize.$$ - - -echo >> customize.$$ - -mv customize.$$ customize - diff --git a/cgigw/cgigw.cgi b/cgigw/cgigw.cgi deleted file mode 100644 index 0ec77db..0000000 --- a/cgigw/cgigw.cgi +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/perl -# -# $Id: cgigw.cgi,v 1.1 1998-04-28 22:01:23 hjp Exp $ -# -# This is a simpe CGI gateway script. -# -# It can be used to access CGI scripts on a different server and/or -# port. -# Possible scenarios where this is useful: -# * Your real CGI scripts have to run on a machine behind a firewall. -# In this case you may also want to modify this script to check -# parameters. -# * Your real CGI scripts have to run on a different server (e.g., one -# with some special database installed), but you don't want to expose -# that server's address in your URLs. -# * Your real CGI scripts have to run on a Web server which doesn't -# speak SSL. -# -# Usage: Change the customization section to point to the script which -# you really want to call. Install this script in some convenient -# place. Make sure the target script generates only links to your -# "official" server (If this is not possible, you might want to -# tweak its output just before "print @rest;" at the very bottom -# of this script. -# -# $Log: cgigw.cgi,v $ -# Revision 1.1 1998-04-28 22:01:23 hjp -# Initial release. -# Only tested with a few CGIs and the Roxen web server. -# -# - -use IO::Socket; - -# BEGIN customization section -$serv_addr = "internal.host.com"; -$serv_port = 80; -$serv_script = "/some/script.cgi"; -# END customization section - -$sock = IO::Socket::INET->new(PeerAddr => $serv_addr, - PeerPort => $serv_port); -if (!$sock) { - print "Status: 500\r\n"; - print "Content-type: text/html\r\n"; - print "\r\n"; - print "\n"; - print "

Internal error

\n"; - print "Connection to $serv_addr:$serv_port failed: $!\n"; - print "\n"; -} - -$method = $ENV{REQUEST_METHOD}; -$query_string = $ENV{QUERY_STRING}; -print STDERR "$0: method = $method\n"; - -$sock->print("$method $serv_script"); -if ($query_string ne "") { - $sock->print("?$query_string"); -} -$sock->print(" HTTP/1.0\r\n"); -for $i (keys(%ENV)) { - if ($i =~ m/^HTTP_(.*)/) { - $key = $1; - $key =~ s/_/-/g; - $val = $ENV{$i}; - $sock->print("$key: $val\r\n"); - print STDERR "$0: Header: $key: $val\n"; - } else { - $val = $ENV{$i}; - print STDERR "$0: Env: $i: $val\n"; - } -} -$content_length = $ENV{CONTENT_LENGTH}; -if ($content_length) { - $sock->print("Content-Length: ", $content_length, "\r\n\r\n"); - for ($i = 0; $i < $content_length; $i++) { - read(STDIN, $c, 1); - print STDERR "$0: Body: $i of $content_length: $c\n"; - $sock->print($c); - } - # padding: - $sock->print("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n"); -} else { - $sock->print("\r\n"); -} -$sock->flush(); -print STDERR "$0: Flushing\n"; - -$status = $sock->getline(); -print STDERR "$0: Status: $status\n"; -if ($status =~ m|^HTTP/\d+\.\d+ (\d+) |) { - print "Status: $1\r\n"; -} elsif ($status =~ m|:|) { - # error: Assume this is a header and just pass it on - print $status; -} else { - # error: not a header. Assume this is HTML - print "Content-Type: text/html\r\n"; - print "\r\n"; - print $status; -} -@rest = $sock->getlines; -print @rest; - -print STDERR "$0: Finished\n"; diff --git a/charhist/GNUmakefile b/charhist/GNUmakefile deleted file mode 100644 index 574c244..0000000 --- a/charhist/GNUmakefile +++ /dev/null @@ -1,10 +0,0 @@ -include GNUmakevars -include GNUmakerules - -all: charhist - -chartab: -clean: - rm -f charhist core foo bar baz - -install: $(BINDIR)/charhist diff --git a/charhist/charhist.c b/charhist/charhist.c deleted file mode 100644 index dd59afb..0000000 --- a/charhist/charhist.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include -#include - -long hist[UCHAR_MAX+1]; - -int main (int argc, char **argv) { - int c; - - setlocale(LC_ALL, ""); - while ((c = getchar()) != EOF) { - hist[c]++; - } - for (c = 0; c <= UCHAR_MAX; c++) { - if (hist[c]) { - printf ("%x %d %o %c\t%ld\n", c, c, c, isprint(c) ? c : '.', hist[c]); - } - } - return 0; -} diff --git a/chartab/GNUmakefile b/chartab/GNUmakefile deleted file mode 100644 index 7dfdcbe..0000000 --- a/chartab/GNUmakefile +++ /dev/null @@ -1,11 +0,0 @@ -include GNUmakevars - -all: chartab ctype-test - -chartab: -ctype-test: -clean: - rm chartab -install: $(BINDIR)/chartab $(BINDIR)/ctype-test - -include GNUmakerules diff --git a/chartab/chartab.c b/chartab/chartab.c deleted file mode 100644 index 066d5c3..0000000 --- a/chartab/chartab.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int main (int argc, char **argv) { - int i; - for (i = 0; i < 256; i++) { - printf ("%x %d %o %c\t", i, i, i, i); - if (i % 4 == 3) printf ("\n"); - } - return 0; -} diff --git a/chartab/ctype-test.c b/chartab/ctype-test.c deleted file mode 100644 index 224fc97..0000000 --- a/chartab/ctype-test.c +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include -#include - -int main(int argc, char **argv) { - int i; - - setlocale(LC_ALL, ""); - - for (i = 0; i <= UCHAR_MAX; i++) { - printf ("%2x: ", i); - printf("%c ", isprint(i) ? i : '.'); - printf("\n"); - } - return 0; -} diff --git a/cleandir/.vimrc b/cleandir/.vimrc deleted file mode 100644 index 82155f2..0000000 --- a/cleandir/.vimrc +++ /dev/null @@ -1,6 +0,0 @@ -version 5.0 -map!  >I<yypa/O -set autoindent -set exrc -set number -set shiftwidth=4 diff --git a/cleandir/GNUmakefile b/cleandir/GNUmakefile deleted file mode 100644 index 15a3a55..0000000 --- a/cleandir/GNUmakefile +++ /dev/null @@ -1,39 +0,0 @@ -include GNUmakevars - -TARGETS = cleandir -CONFDIR=../../configure -CONFDIR_exists=$(shell [ -d $(CONFDIR) ] && echo ok) - -all: configure $(TARGETS) - -clean: - rm -f $(TARGETS) *.bak core foo bar baz *.ps - -distclean: clean - rm -f customize - -install: $(BINDIR) $(BINDIR)/cleandir - -%: %.pl customize - sh ./customize < $< > $@ - chmod +x $@ - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -$(SBINDIR): - mkdir -p $@ - -ifeq ($(CONFDIR_exists),ok) - -configure: $(CONFDIR)/start $(CONFDIR)/perl $(CONFDIR)/finish - cat $^ > $@ - -endif - - -include GNUmakerules diff --git a/cleandir/cleandir b/cleandir/cleandir deleted file mode 100755 index 8bf4b7f..0000000 --- a/cleandir/cleandir +++ /dev/null @@ -1,131 +0,0 @@ -#!/usr/bin/perl -w -use strict; -use File::stat; -use POSIX; - -my $verbose = 0; -my $nop = 0; - -sub usage { - print STDERR "Usage: $0 [-d days] dir ...\n"; - exit(1); -} - -sub cleandir { - my ($dir, $since, $level) = (@_); - my $notremoved = 0; - - if ($verbose > 1) { - print STDERR "$0:", " " x $level, " cleandir $dir $since {\n"; - } - if (!opendir(DIR, ".")) { - printf STDERR "$0:", " " x $level, " cannot opendir $dir: $!"; - return; - } - my $std = lstat("."); - for my $i (readdir(DIR)) { - if ($i eq "." || $i eq "..") {next} - if ($verbose > 2) { - print STDERR "$0:", " " x $level, " checking $dir/$i\n"; - } - my $st = lstat("$i"); - if ($verbose > 3) { - print STDERR "$0:", " " x $level, " mtime=", $st->mtime, " atime=", $st->atime, "\n"; - } - if (-d _) { - my $cwd = getcwd(); - if (chdir($i)) { - my $remaining = -1; - my $st1 = lstat("."); - if ($st->dev == $st1->dev && $st->ino == $st1->ino) { - $remaining = cleandir("$dir/$i", $since, $level+1); - } else { - print STDERR "$0:", " " x $level, - " $dir/$i changed dev/inode from ", - $st->dev, "/", $st->ino, - " to ", - $st1->dev, "/", $st1->ino, - "\n"; - } - chdir($cwd); - my $std1 = lstat("."); - if (!($std->dev == $std1->dev && $std->ino == $std1->ino)) { - print STDERR "$0:", " " x $level, - " $cwd changed dev/inode from ", - $std->dev, "/", $std->ino, - " to ", - $std1->dev, "/", $std1->ino, - "\n"; - } - if ($remaining == 0 && $st->mtime < $since) { - if ($verbose > 0) { - print STDERR "$0:", " " x $level, "rmdir $i\n"; - } - if (rmdir("$i")) {next} - print STDERR "$0:", " " x $level, "rmdir $i failed: $!\n"; - } - } else { - print STDERR "$0:", " " x $level, " chdir $dir/$i failed: $!\n"; - } - - } elsif ($st->mtime < $since && $st->atime < $since) { - if ($nop) { - print "would remove $dir/$i\n"; - } else { - if ($verbose > 0) { - print STDERR "$0:", " " x $level, " removing $dir/$i\n"; - } - if (unlink("$i")) {next} - print STDERR "$0:", " " x $level, " removing $dir/$i failed: $!\n"; - } - - } - $notremoved++; - } - if ($verbose > 1) { - print STDERR "$0:", " " x $level, " cleandir: $notremoved }\n"; - } - return $notremoved; -} - -sub main { - my $since = time() - 14 * 86400;; - my $i; - while ($i = shift(@ARGV)) { - if ($i eq "-d") { - my $days = shift(@ARGV); - $since = time() - $days * 86400; - } elsif ($i eq "-v") { - $verbose++; - } elsif ($i eq "-n") { - $nop++; - } else { - my $cwd = getcwd(); - if (chdir($i)) { - cleandir($i, $since, 0); - chdir($cwd); - } - } - } - exit(0); -} - -main(); - -# $Log: cleandir,v $ -# Revision 1.4 2000-11-20 21:10:08 hjp -# Checks introduced in last version prevented deletion of unused subdirs. -# Fixed. -# -# revision 1.3 -# date: 2000/09/10 16:16:41; author: hjp; state: Exp; lines: +37 -6 -# Added checks to detect directory/symlink switching attacks. -# ---------------------------- -# revision 1.2 -# date: 1999/08/21 12:37:53; author: hjp; state: Exp; lines: +25 -13 -# More levels of verbosity. -# ---------------------------- -# revision 1.1 -# date: 1999/07/09 21:05:26; author: hjp; state: Exp; -# Added cleandir -# diff --git a/cleandir/cleandir.pl b/cleandir/cleandir.pl deleted file mode 100755 index df753db..0000000 --- a/cleandir/cleandir.pl +++ /dev/null @@ -1,134 +0,0 @@ -#!@@@perl@@@ -w -use strict; -use File::stat; -use POSIX; - -my $verbose = 0; -my $nop = 0; - -sub usage { - print STDERR "Usage: $0 [-d days] dir ...\n"; - exit(1); -} - -sub cleandir { - my ($dir, $since, $level) = (@_); - my $notremoved = 0; - - if ($verbose > 1) { - print STDERR "$0:", " " x $level, " cleandir $dir $since {\n"; - } - if (!opendir(DIR, ".")) { - printf STDERR "$0:", " " x $level, " cannot opendir $dir: $!"; - return; - } - my $std = lstat("."); - for my $i (readdir(DIR)) { - if ($i eq "." || $i eq "..") {next} - if ($verbose > 2) { - print STDERR "$0:", " " x $level, " checking $dir/$i\n"; - } - my $st = lstat("$i"); - if ($verbose > 3) { - print STDERR "$0:", " " x $level, " mtime=", $st->mtime, " atime=", $st->atime, "\n"; - } - if (-d _) { - my $cwd = getcwd(); - if (chdir($i)) { - my $remaining = -1; - my $st1 = lstat("."); - if ($st->dev == $st1->dev && $st->ino == $st1->ino) { - $remaining = cleandir("$dir/$i", $since, $level+1); - } else { - print STDERR "$0:", " " x $level, - " $dir/$i changed dev/inode from ", - $st->dev, "/", $st->ino, - " to ", - $st1->dev, "/", $st1->ino, - "\n"; - } - chdir($cwd); - my $std1 = lstat("."); - if (!($std->dev == $std1->dev && $std->ino == $std1->ino)) { - print STDERR "$0:", " " x $level, - " $cwd changed dev/inode from ", - $std->dev, "/", $std->ino, - " to ", - $std1->dev, "/", $std1->ino, - "\n"; - } - if ($remaining == 0 && $st->mtime < $since) { - if ($verbose > 0) { - print STDERR "$0:", " " x $level, "rmdir $i\n"; - } - if (rmdir("$i")) {next} - print STDERR "$0:", " " x $level, "rmdir $i failed: $!\n"; - } - } else { - print STDERR "$0:", " " x $level, " chdir $dir/$i failed: $!\n"; - } - - } elsif ($st->mtime < $since && $st->atime < $since) { - if ($nop) { - print "would remove $dir/$i\n"; - } else { - if ($verbose > 0) { - print STDERR "$0:", " " x $level, " removing $dir/$i\n"; - } - if (unlink("$i")) {next} - print STDERR "$0:", " " x $level, " removing $dir/$i failed: $!\n"; - } - - } - $notremoved++; - } - if ($verbose > 1) { - print STDERR "$0:", " " x $level, " cleandir: $notremoved }\n"; - } - return $notremoved; -} - -sub main { - my $since = time() - 14 * 86400;; - my $i; - while ($i = shift(@ARGV)) { - if ($i eq "-d") { - my $days = shift(@ARGV); - $since = time() - $days * 86400; - } elsif ($i eq "-v") { - $verbose++; - } elsif ($i eq "-n") { - $nop++; - } else { - my $cwd = getcwd(); - if (chdir($i)) { - cleandir($i, $since, 0); - chdir($cwd); - } - } - } - exit(0); -} - -main(); - -# $Log: cleandir.pl,v $ -# Revision 1.1 2001-06-25 17:55:03 hjp -# Added configure script to figure out perl location. -# -# Revision 1.4 2000/11/20 21:10:08 hjp -# Checks introduced in last version prevented deletion of unused subdirs. -# Fixed. -# -# revision 1.3 -# date: 2000/09/10 16:16:41; author: hjp; state: Exp; lines: +37 -6 -# Added checks to detect directory/symlink switching attacks. -# ---------------------------- -# revision 1.2 -# date: 1999/08/21 12:37:53; author: hjp; state: Exp; lines: +25 -13 -# More levels of verbosity. -# ---------------------------- -# revision 1.1 -# date: 1999/07/09 21:05:26; author: hjp; state: Exp; -# Added cleandir -# diff --git a/cleandir/configure b/cleandir/configure deleted file mode 100644 index 6fea68e..0000000 --- a/cleandir/configure +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize.$$ -echo "sed \\" > customize.$$ -chmod +x customize.$$ - -################################################################ -# find a working perl: -# -for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5 -do - if $i -e 'exit ($] < 5.000)' - then - echo $i works - perl="$i" - break - fi -done -if [ -z "$perl" ] -then - could not find a working perl command, sorry. - exit 1 -fi -echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize.$$ - - -################################################################ -# finish -# Add trailing newline and rename temp file to final name -# -echo >> customize.$$ - -mv customize.$$ customize - diff --git a/count/GNUmakefile b/count/GNUmakefile deleted file mode 100644 index 16c1cfc..0000000 --- a/count/GNUmakefile +++ /dev/null @@ -1,22 +0,0 @@ -include GNUmakerules -include GNUmakevars - -count: - -install: $(ROOT)/usr/local/bin/count - -install_all: - $(MAKE) install ROOT=/nfs/wsrdb - $(MAKE) install ROOT=/nfs/wsrcom - $(MAKE) install ROOT=/nfs/wifosv - $(MAKE) install ROOT=/nfs/ihssv - $(MAKE) install ROOT=/nfs/wsrtest - -$(ROOT)/usr/local/bin/%: % - $(INSTALL) $< $@ - -$(ROOT)/usr/local/man/man8/%.8: %.man - $(INSTALL) $< $@ - -clean: - rm count diff --git a/count/count.c b/count/count.c deleted file mode 100644 index f77025d..0000000 --- a/count/count.c +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include - -int main(int argc, char **argv) { - unsigned long start = 0; - unsigned long stop = ULONG_MAX; - unsigned long i; - - switch (argc) { - case 0: - case 1: - break; - case 2: - stop = strtoul(argv[1], NULL, 0); - break; - case 3: - start = strtoul(argv[1], NULL, 0); - stop = strtoul(argv[2], NULL, 0); - break; - default: - fprintf(stderr, "Usage: %s [[start] stop]\n", argv[0]); - exit(1); - } - - for (i = start; i < stop; i++) { - printf("%ld\n", i); - } - return 0; -} diff --git a/cvsdiffmin/.vimrc b/cvsdiffmin/.vimrc deleted file mode 100644 index 9056a9a..0000000 --- a/cvsdiffmin/.vimrc +++ /dev/null @@ -1,6 +0,0 @@ -version 5.0 -map!  >I<yypa/O -set autoindent -set exrc -set ruler -set shiftwidth=4 diff --git a/cvsdiffmin/GNUmakefile b/cvsdiffmin/GNUmakefile deleted file mode 100644 index 9a42834..0000000 --- a/cvsdiffmin/GNUmakefile +++ /dev/null @@ -1,24 +0,0 @@ -include GNUmakevars - -all: cvsdiffmin - -clean: - rm cvsdiffmin customize - -install: $(BINDIR) $(BINDIR)/cvsdiffmin - -%: %.pl customize - sh ./customize < $< > $@ - chmod +x $@ - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -$(BINDIR): - mkdir -p $@ - -include GNUmakerules diff --git a/cvsdiffmin/configure b/cvsdiffmin/configure deleted file mode 100644 index 7b5b8ed..0000000 --- a/cvsdiffmin/configure +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize.$$ -echo "sed \\" > customize.$$ -chmod +x customize.$$ - -################################################################ -# find a working perl: -# -for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5 -do - if $i -e 'exit ($] < 5.000)' - then - echo $i works - perl="$i" - break - fi -done -if [ -z "$perl" ] -then - could not find a working perl command, sorry. - exit 1 -fi -echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize.$$ - - -################################################################ -# find a diff which understands --changed-group-format -# and related options (like gnu diff) -# -echo 'a -b -c' > diff_format-test.$$.1 -echo 'a -B -c' > diff_format-test.$$.2 - -wanted="" -for i in /usr/bin/diff /usr/local/bin/diff -do - a="`$i --unchanged-group-format='' --changed-group-format='<%<=%>>' diff_format-test.$$.1 diff_format-test.$$.2`" - echo "$a" - - if [ "x$a" = "x$wanted" ] - then - echo $i works - diff_format="$i" - fi -done -if [ -z "$diff_format" ] -then - echo could not find a working diff_format command, sorry. - exit 1 -fi -echo " -e 's,@@@diff_format@@@,$diff_format,g' \\" >> customize.$$ -rm diff_format-test.$$.? - - -################################################################ -# finish -# Add trailing newline and rename temp file to final name -# -echo >> customize.$$ - -mv customize.$$ customize - diff --git a/cvsdiffmin/cvsdiffmin.pl b/cvsdiffmin/cvsdiffmin.pl deleted file mode 100755 index 2b398da..0000000 --- a/cvsdiffmin/cvsdiffmin.pl +++ /dev/null @@ -1,69 +0,0 @@ -#!@@@perl@@@ -w -# -# $Id: cvsdiffmin.pl,v 1.3 2000-02-08 17:21:38 hjp Exp $ -# -# cvsdiffmin - minimize output of cvs diff -# - -use strict; - -use File::Slurp; - -my $diff = "@@@diff_format@@@"; - -my $state = 'EQ'; -my %text = (); -my %cap = (); -my $count = 0; - -local $| = 1; - -while (<>) { - - if ($state eq 'EQ' && /^\<{7} /) { - $state = 'V1'; - $text{$state} = ""; - s/'/_/g; - $cap{$state} = $_; - next; - } - if ($state eq 'V1' && /^\={7}$/) { - $state = 'V2'; - $text{$state} = ""; - next; - } - if ($state eq 'V2' && /^\>{7} /) { - s/'/_/g; - $cap{$state} = $_; - write_file("cvsdiffmin.$$.$count.1", $text{V1}); - write_file("cvsdiffmin.$$.$count.2", $text{V2}); - open (DIFF, - "$diff " . - " --unchanged-group-format='\%='" . - " --changed-group-format='${cap{V1}}\%<=======\n\%>${cap{V2}}'" . - " --old-group-format='${cap{V1}}\%<=======\n\%>${cap{V2}}'" . - " --new-group-format='${cap{V1}}\%<=======\n\%>${cap{V2}}'" . - " cvsdiffmin.$$.$count.1" . - " cvsdiffmin.$$.$count.2" . - "|") or die "cannot invoke diff: $!"; - while () { - print; - } - close(DIFF); - unlink ("cvsdiffmin.$$.$count.1", "cvsdiffmin.$$.$count.2") - or die "cannot unlink temporary files cvsdiffmin.$$.$count.1, cvsdiffmin.$$.$count.2: $!"; - - - $state = 'EQ'; - $count++; - next; - } - if ($state eq 'EQ') { - print; - } else { - $text{$state} .= $_; - } - -} - -# vim:sw=4 diff --git a/ddm/GNUmakefile b/ddm/GNUmakefile deleted file mode 100644 index 8cc0dfb..0000000 --- a/ddm/GNUmakefile +++ /dev/null @@ -1,34 +0,0 @@ -# $Id: GNUmakefile,v 1.3 2000-06-04 16:33:20 hjp Exp $ - -include GNUmakevars - -ddm: ddm.o - $(CC) $^ $(ANTLIB) -o $@ - -ddm.o: ddm.c - -clean: - rm ddm ddm.o - -install: $(SBINDIR)/ddm - -cfg/%.h: cfg/%.sh - sh $< > $@ - -include GNUmakerules - --include ddm.d - -# $Log: GNUmakefile,v $ -# Revision 1.3 2000-06-04 16:33:20 hjp -# Removed MNTTAB autodetection again as it seems to be already defined. -# Don't skip rest of mountpoints if one is not accessible. -# chdir to / while sleeping to avoid blocking automounters -# increased default sleep interval to 1 hour max. -# -# Revision 1.2 2000/06/04 16:11:12 hjp -# Added autodetection of /etc/m(nt)?tab. -# -# Revision 1.1 2000/06/04 15:53:18 hjp -# Pre-Version. Options are still missing. -# diff --git a/ddm/cfg/mnttab.sh b/ddm/cfg/mnttab.sh deleted file mode 100644 index b52cffd..0000000 --- a/ddm/cfg/mnttab.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -for i in /etc/mnttab /etc/mtab -do - if [ -f $i ] - then - echo '#define PATH_MNTTAB "'$i'"' - exit 0 - fi -done -exit 1 diff --git a/ddm/ddm.c b/ddm/ddm.c deleted file mode 100644 index f1c2513..0000000 --- a/ddm/ddm.c +++ /dev/null @@ -1,231 +0,0 @@ -char ddm_c_rcs_id[] = - "$Id: ddm.c,v 1.6 2001-02-21 16:02:46 hjp Exp $"; -/* - * ddm - disk delay monitor - * - * chdirs to a list of filesystems (mount points by default) and does - * the equivalent of an ls -l. - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "cfg/mnttab.h" - - -typedef enum { MODE_NONE, MODE_ARGS, MODE_MNTTAB, MODE_DIRFILE } modeT; - - -static double gettimestamp(void) { - struct timeval tm; - - gettimeofday(&tm, NULL); - return tm.tv_sec + tm.tv_usec/1E6; -} - -static void usage(void) { - fprintf(stderr, "Usage: %s [-d dirfile | -m mnttab | directory ... ] [-s max_sleep_time]\n", - cmnd); - exit(1); -} - -void printtimestamp (const char *fmt, ...) { - static double lts = 0; - double ts = gettimestamp(); - va_list ap; - - fprintf(stderr, "%s: %.6f: %.6f: ", cmnd, ts, ts - lts); - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - lts = ts; -} - -int main(int argc, char**argv) { - char **dirs = NULL; - modeT mode = MODE_NONE; - int nr_dirs; - int c; - char *filename = NULL; - double maxsleeptime = 3600; - - cmnd = argv[0]; - - while ((c = getopt(argc, argv, "d:m:s:")) != EOF) { - switch (c) { - char *p; - - case 'd': - mode = MODE_DIRFILE; - filename = optarg; - break; - case 'm': - mode = MODE_MNTTAB; - filename = optarg; - break; - case 's': - maxsleeptime = strtod(optarg, &p); - if (p == optarg || *p) usage(); - break; - case '?': - usage(); - default: - assert(0); - } - } - - if (mode == MODE_NONE) { - if (optind == argc) { - mode = MODE_MNTTAB; - filename = PATH_MNTTAB; - } else { - mode = MODE_ARGS; - dirs = argv + optind; - nr_dirs = argc - optind; - } - } else { - if (optind != argc) usage(); - } - - - srand(time(NULL)); - - for (;;) { - int i; - int sleeptime; - - /* Get list of directories - */ - switch (mode) { - case MODE_MNTTAB: { - FILE *mtp; - struct mntent *me; - - printtimestamp("open %s\n", filename); - if ((mtp = setmntent(filename, "r")) == NULL) { - fprintf(stderr, "%s: cannot open %s: %s\n", - argv[0], filename, strerror(errno)); - exit(1); - } - for (i = 0;(me = getmntent(mtp)); i++) { - DA_MKIND_INI(dirs, i, NULL); - if (dirs[i]) free(dirs[i]); - dirs[i] = strdup(me->mnt_dir); - printtimestamp("mountpoint %s\n", dirs[i]); - } - endmntent(mtp); - - nr_dirs = i; - break; - } - case MODE_DIRFILE: { - FILE *fp; - char *p; - - printtimestamp("open %s\n", filename); - fp = efopen(filename, "r"); - for (i = 0;(p = getline(fp)); i++) { - DA_MKIND_INI(dirs, i, NULL); - if (dirs[i]) free(dirs[i]); - dirs[i] = strdup(p); - printtimestamp("directory %s\n", dirs[i]); - } - efclose(fp); - - nr_dirs = i; - break; - } - case MODE_ARGS: - break; - default: - assert(0); - } - - - /* Now read them - */ - for (i = 0; i < nr_dirs; i++) { - int j; - char **entries = NULL; - int nr_entries; - DIR *dp; - struct dirent *de; - - printtimestamp("start %s\n", dirs[i]); - if (chdir(dirs[i]) == -1) { - printtimestamp("chdir %s failed: %s\n", dirs[i], strerror(errno)); - continue; - } - printtimestamp("chdir %s ok\n", dirs[i]); - - if ((dp = opendir(".")) == NULL) { - printtimestamp("opendir %s failed: %s\n", dirs[i], strerror(errno)); - continue; - } - for (j = 0;(de = readdir(dp)); j++) { - DA_MKIND_INI(entries, j, NULL); - if (entries[j]) free(entries[j]); - entries[j] = strdup(de->d_name); - printtimestamp("entry %s\n", entries[j]); - } - closedir(dp); - nr_entries = j; - - for (j = 0; j < nr_entries; j++) { - struct stat st; - stat (entries[j], &st); - printtimestamp("stat entry %s\n", entries[j]); - } - } - - chdir("/"); - - sleeptime = rand() * maxsleeptime / RAND_MAX; - printtimestamp("sleeping %d seconds\n", sleeptime); - sleep(sleeptime); - } - - - return 0; -} - -/* - * $Log: ddm.c,v $ - * Revision 1.6 2001-02-21 16:02:46 hjp - * Added config test for mnttab again. - * Added option -s (max sleep time) - * Added script stats.sh to generate stats. - * - * Revision 1.5 2000/09/07 10:12:35 hjp - * Added alternate ways to specify directories to be monitored. - * - * Revision 1.4 2000/06/04 16:33:21 hjp - * Removed MNTTAB autodetection again as it seems to be already defined. - * Don't skip rest of mountpoints if one is not accessible. - * chdir to / while sleeping to avoid blocking automounters - * increased default sleep interval to 1 hour max. - * - * Revision 1.3 2000/06/04 16:19:00 hjp - * Fixed order of args in fprintf (segfault). - * - * Revision 1.2 2000/06/04 16:11:12 hjp - * Added autodetection of /etc/m(nt)?tab. - * - * Revision 1.1 2000/06/04 15:53:19 hjp - * Pre-Version. Options are still missing. - * - */ diff --git a/ddm/stats.sh b/ddm/stats.sh deleted file mode 100755 index 5c70cb2..0000000 --- a/ddm/stats.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -# simple statistics (min, avg, max) for ddm output - -awk -F : '{ n[$4] ++; s[$4] += $3; if ($3 < min[$4]) min[$4] = $3; if ($3 > max[$4]) max[$4] = $3; } -END { for (i in n) { printf "%10.6f %10.6f %10.6f %s\n", min[i], s[i]/n[i], max[i], i } }' "$@" | sort -n +2 - diff --git a/dns/GNUmakefile b/dns/GNUmakefile deleted file mode 100644 index 7041ff3..0000000 --- a/dns/GNUmakefile +++ /dev/null @@ -1,20 +0,0 @@ -include GNUmakevars -include GNUmakerules - -all: gethostbyname -install: $(BINDIR)/gethostbyname - -clean: - rm -f *.bak *.o core gethostbyname - -distclean: clean - rm -f *.d - -cfg/%: - $(MAKE) -C cfg all - -gethostbyname: gethostbyname.o hstrerror.o - -hstrerror.o: cfg/have_hstrerror.h - --include *.d diff --git a/dns/cfg/GNUmakefile b/dns/cfg/GNUmakefile deleted file mode 100644 index f925f23..0000000 --- a/dns/cfg/GNUmakefile +++ /dev/null @@ -1,4 +0,0 @@ -all: have_hstrerror.h - -%.h: %.sh - CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' sh $^ > $@ diff --git a/dns/cfg/have_hstrerror.sh b/dns/cfg/have_hstrerror.sh deleted file mode 100644 index 9af42cb..0000000 --- a/dns/cfg/have_hstrerror.sh +++ /dev/null @@ -1,11 +0,0 @@ -cat > has_hstrerror_$$.c < -int main(void) { hstrerror(0); } -EOF -if $CC $CFLAGS has_hstrerror_$$.c $LDFLAGS -o has_hstrerror_$$ -then - echo '#define HAVE_HSTRERROR 1' -else - echo '#define HAVE_HSTRERROR 0' -fi -rm has_hstrerror_$$.c has_hstrerror_$$ diff --git a/dns/gethostbyname.c b/dns/gethostbyname.c deleted file mode 100644 index 45af0df..0000000 --- a/dns/gethostbyname.c +++ /dev/null @@ -1,51 +0,0 @@ -#include -#include -#include - -#include "hstrerror.h" - -char *cmnd; - -void usage(void) { - fprintf(stderr, "Usage: %s [hostname ...]\n", cmnd); - exit(1); -} - -int main(int argc, char **argv) { - int i; - int rc = 0; - - cmnd = argv[0]; - - if (argc < 2) { - usage(); - } - - for (i = 1; i < argc; i++) { - struct hostent *he = gethostbyname(argv[i]); - char **a; - - if (!he) { - fprintf(stderr, "%s: cannot resolve %s: %s\n", - argv[0], argv[i], hstrerror(h_errno)); - rc++; - continue; - } - - printf("%s\n", argv[i]); - printf("\tCanonical: %s\n", he->h_name); - for (a = he->h_aliases; *a; a++) { - printf("\tAlias: %s\n", *a); - } - for (a = he->h_addr_list; *a; a++) { - int j; - printf("\tAddress: "); - for (j = 0; j < he->h_length; j++) { - printf("%s%d", j ? "." : "", (unsigned char)(*a)[j]); - } - printf("\n"); - } - printf("\n"); - } - return rc; -} diff --git a/dns/hstrerror.c b/dns/hstrerror.c deleted file mode 100644 index 2fc552e..0000000 --- a/dns/hstrerror.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "cfg/have_hstrerror.h" -#include "hstrerror.h" - -#if (!HAVE_HSTRERROR) -const char *hstrerror(int err) { - static char errstr[80]; - - snprintf(errstr, sizeof(errstr), "resolver error %d", err); - return errstr; -} -#endif diff --git a/dns/hstrerror.h b/dns/hstrerror.h deleted file mode 100644 index aa0fd90..0000000 --- a/dns/hstrerror.h +++ /dev/null @@ -1 +0,0 @@ -const char * hstrerror(int err); diff --git a/duwatch/GNUmakefile b/duwatch/GNUmakefile deleted file mode 100644 index c1edc9f..0000000 --- a/duwatch/GNUmakefile +++ /dev/null @@ -1,9 +0,0 @@ -install: $(ROOT)/usr/local/bin/duwatch -install_all: - make install ROOT=/nfs/wsrdb - make install ROOT=/nfs/wifosv - make install ROOT=/nfs/ihssv - make install ROOT=/nfs/wsrcom - -$(ROOT)/usr/local/bin/%: % - install $< $@ diff --git a/duwatch/duwatch b/duwatch/duwatch deleted file mode 100755 index d621cac..0000000 --- a/duwatch/duwatch +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/perl - -$avgfile = "/usr/local/lib/duwatch.avg"; -$root = "/"; -$thresh = 20000; -$period = 30; - -open AVG, $avgfile || die; -while () { - ($size, $name) = split; - $avgdu{$name} = $size; - $all{$name} = 1; -} -close AVG; - -open NEW, "/bin/du -t hfs $root |" || die; -while () { - ($size, $name) = split; - $size /= 2; # du reports 512 byte blocks :-( - if ($size < $thresh) {next}; - $newdu{$name} = $size; - $all{$name} = 1; -} -close NEW; - -for $i (keys %all) { - if ($newdu{"$i"} > 2 * ($avgdu{"$i"})) { - printf "%s: %d -> %d\n", $i, $avgdu{$i}, $newdu{$i}; - } - $avgdu{$i} = ($avgdu{$i} * ($period - 1) + $newdu{$i}) / $period; -} - -open AVG, ">" . $avgfile || die; -for $i (keys %avgdu) { - printf AVG "%d %s\n", $avgdu{$i}, $i; -} -close AVG; diff --git a/errno/GNUmakefile b/errno/GNUmakefile deleted file mode 100644 index 63e78f0..0000000 --- a/errno/GNUmakefile +++ /dev/null @@ -1,15 +0,0 @@ -# $Id: GNUmakefile,v 1.2 1998-05-31 01:20:06 hjp Exp $ -# $Log: GNUmakefile,v $ -# Revision 1.2 1998-05-31 01:20:06 hjp -# GNUmakerules split into GNUmakerules and GNUmakevars. -# - -include GNUmakevars -include GNUmakerules - -all: errno - -errno: -clean: - rm errno -install: $(BINDIR)/errno diff --git a/errno/errno.c b/errno/errno.c deleted file mode 100644 index 8ee3b97..0000000 --- a/errno/errno.c +++ /dev/null @@ -1,34 +0,0 @@ -#include -#include -#include - -char *cmnd; - -static void usage(void) { - fprintf(stderr, "Usage: %s errno ...\n", cmnd); - exit(1); -} - - -int main(int argc, char **argv) { - int i; - - cmnd = argv[0]; - - if (argc <= 1) { - int e; - for (e = 0;; e++) { - printf("%d\t%s\n", e, strerror(e)); - } - } else { - for (i = 1; i < argc; i++) { - int e = strtoul(argv[i], NULL, 0); - - printf("%d\t%s\n", e, strerror(e)); - } - } - return 0; -} -/* - * vim:sw=4 - */ diff --git a/fact/GNUmakefile b/fact/GNUmakefile deleted file mode 100644 index 11c1633..0000000 --- a/fact/GNUmakefile +++ /dev/null @@ -1,35 +0,0 @@ -include GNUmakevars - -CONFDIR=../../configure -CONFDIR_exists=$(shell [ -d $(CONFDIR) ] && echo ok) - -all: configure fact - -clean: - rm fact customize - -install: $(BINDIR) $(BINDIR)/fact - -%: %.pl customize - sh ./customize < $< > $@ - chmod +x $@ - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -ifeq ($(CONFDIR_exists),ok) - -configure: $(CONFDIR)/start $(CONFDIR)/perl $(CONFDIR)/finish - cat $^ > $@ - -endif - -$(BINDIR): - mkdir -p $@ - -include GNUmakerules - diff --git a/fact/configure b/fact/configure deleted file mode 100644 index 6fea68e..0000000 --- a/fact/configure +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize.$$ -echo "sed \\" > customize.$$ -chmod +x customize.$$ - -################################################################ -# find a working perl: -# -for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5 -do - if $i -e 'exit ($] < 5.000)' - then - echo $i works - perl="$i" - break - fi -done -if [ -z "$perl" ] -then - could not find a working perl command, sorry. - exit 1 -fi -echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize.$$ - - -################################################################ -# finish -# Add trailing newline and rename temp file to final name -# -echo >> customize.$$ - -mv customize.$$ customize - diff --git a/fact/fact.pl b/fact/fact.pl deleted file mode 100644 index ca83a85..0000000 --- a/fact/fact.pl +++ /dev/null @@ -1,31 +0,0 @@ -#!@@@perl@@@ -w -use strict; - -sub usage { - print STDERR "Usage: $0 number\n"; - exit(1); -} - -sub fact { - my ($n) = @_; - - my $d = 2; - - my @f = (); - - while ($d <= $n) { - if ($n % $d == 0) { - push (@f, $d); - $n /= $d; - } else { - $d++; - } - } - return @f; -} - -if (@ARGV != 1) { usage(); } -my @f = fact($ARGV[0]); -print "@f\n"; - -#vim:sw=4 diff --git a/fix2var/Makefile b/fix2var/Makefile deleted file mode 100644 index 80edcf6..0000000 --- a/fix2var/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -BINDIR=/usr/local/bin -CC = gcc -CFLAGS = -Wall -ansi -pedantic -O2 -g -fix2var: fix2var.o - $(CC) $^ -lant -o $@ - -install: $(BINDIR)/fix2var -$(BINDIR)/%: % - install $< $@ diff --git a/fix2var/fix2var.c b/fix2var/fix2var.c deleted file mode 100644 index 2b7acb0..0000000 --- a/fix2var/fix2var.c +++ /dev/null @@ -1,94 +0,0 @@ -char fix2var_c_rcs_id[] = - "$Id: fix2var.c,v 1.1 1996-08-30 12:25:22 hjp Exp $"; -/* - * fix2var - convert fixed length record data to line oriented format - * - * This program simply copies fixed length chunks from a file to - * stdout. Each chunk is terminated with a '\n' character. - * Optionally trailing white space can be stripped. - * - * $Log: fix2var.c,v $ - * Revision 1.1 1996-08-30 12:25:22 hjp - * Initial release. - * - */ -#include -#include -#include -#include -#include -#include - -char *cmnd; - -unsigned long width = 80; -int strip = 1; - -void usage(void) { - fprintf(stderr, "Usage: %s [-l width] [file ...]\n", cmnd); - exit(1); -} - - -void fix2var(const char *filename) { - FILE *fp; - char *buf = emalloc(width+1); - size_t rc; - int i; - - if (strcmp(filename, "-") == 0) { - fp = stdin; - } else { - fp = efopen(filename, "r"); - } - while ((rc = fread (buf, 1, width, fp)) != 0 && (rc != (size_t)-1)) { - if (rc < width) { - fprintf(stderr, "%s: warning: short record (%lu bytes)" - " encountered\n", cmnd, (unsigned long)rc); - } - assert (rc <= INT_MAX); - if (strip) { - for (i = rc - 1; i >= 0 && isspace(buf[i]); i--); - buf[i+1] = '\0'; - } else { - buf[rc] = '\0'; - } - puts(buf); - } - - fclose(fp); - free(buf); -} - - -int main(int argc, char **argv) { - int c; - int i; - char *p; - - cmnd = argv[0]; - - while ((c = getopt(argc, argv, "sw:")) != EOF) { - switch (c) { - case 's': - strip= 1; - break; - case 'w': - width= strtoul(optarg, &p, 0); - if (width == 0 || *p) usage(); - break; - case '?': - usage(); - default: - assert(0); - } - } - if (optind == argc) { - fix2var("-"); - } else { - for (i = optind; i < argc; i++) { - fix2var(argv[i]); - } - } - return 0; -} diff --git a/fortune/Makefile b/fortune/Makefile deleted file mode 100644 index fa63ccf..0000000 --- a/fortune/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -CC = gcc -CFLAGS = -O2 - -BINDIR = /usr/local/bin - -fortune: fortune.c - $(CC) $(CFLAGS) -o fortune fortune.c -lant - -clean: - rm fortune core - -install: $(BINDIR)/fortune - -$(BINDIR)/fortune: fortune - cp fortune $(BINDIR)/fortune - diff --git a/fortune/fortune.c b/fortune/fortune.c deleted file mode 100644 index 09a3860..0000000 --- a/fortune/fortune.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Fortune -- Print one fortune out of an indexed fortune file - */ - -static char fortune_c_rcsid[] = "$Id: fortune.c,v 3.4 1994-01-08 18:05:00 hjp Exp $"; - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -/* The following parameters will have to be adapted to your system */ -#define DELIMITER "%%\n" -#define MAXLINE (80 + 1 + 1) -char * fortunefile = "/usr/lib/fortune.dat"; -char indexfile [PATH_MAX] = "/usr/lib/fortune.idx"; -#define RECLEN 4 /* length of a record in the index - * file. This would normally be the - * size of a long, but could be more - * or less if you want the program - * run on systems with different lengths - * of a long and share the same index - * file. - */ -/* The rest should be generic */ - - - -void fwritelong (FILE *fp, long offset, long value) { - unsigned char c [RECLEN]; - - assert (value < (1UL << (8 * RECLEN - 1))); - - if (fseek (fp, offset, SEEK_SET) != 0) { - eprintf ("%s: cannot seek to %ld in %s: %s\n", - cmnd, offset, indexfile, strerror (errno)); - exit (1); - } - - c [0] = value & 0xFF; - c [1] = (value >> 8) & 0xFF; - c [2] = (value >> 16) & 0xFF; - c [3] = (value >> 24) & 0xFF; - - if (fwrite (c, RECLEN, 1, fp) != 1) { - eprintf ("%s: cannot write to %s: %s\n", - cmnd, indexfile, strerror (errno)); - exit (1); - } -} - -long freadlong (FILE *fp, long offset) { - unsigned char c [RECLEN]; - unsigned long value; - - if (fseek (fp, offset, SEEK_SET) != 0) { - eprintf ("%s: cannot seek to %ld in %s: %s\n", - cmnd, offset, indexfile, strerror (errno)); - exit (1); - } - - if (fread (c, RECLEN, 1, fp) != 1) { - eprintf ("%s: cannot write to %s: %s\n", - cmnd, indexfile, strerror (errno)); - exit (1); - } - - value = c [0] + (c [1] << 8) + (c [2] << 16) + (c [3] << 24); - return value > LONG_MAX ? - (long) (- value) : value; -} - - - int -main( - int argc, - char **argv -){ - FILE * ffp, * ifp; - char * p; - long pos, ipos, /* position in fortune and - * index file - */ - cnt, /* Number of fortunes in the file - */ - nr, /* number of fortune to read */ - fortune_time; /* time the fortune file was last - * updated. - */ - struct stat statbuf; - char line [MAXLINE]; - - cmnd = argv [0]; - - if (argc >= 2){ - fortunefile = argv [1]; - strncpy (indexfile, argv [1], PATH_MAX); - if ((p = strrchr (indexfile, '.'))) { - strcpy (p, ".idx"); - } else { - strcat (indexfile, ".idx"); - } - } -#ifdef DEBUG - printf ("fortunefile = \"%s\"\n", fortunefile); - printf ("indexfile = \"%s\"\n", indexfile); -#endif /* DEBUG */ - - /* First check if index file is younger than fortune file - * and rebuild it if necessary. - */ - - if (stat (fortunefile, &statbuf) < 0) { - eprintf ("%s: Cannot stat \"%s\": %s", - argv [0], fortunefile, strerror (errno)); - exit (1); - } - fortune_time = statbuf.st_mtime; - if (stat (indexfile, &statbuf) < 0) { - /* Index file does not exit -- force its creation - * and pretend it is older than fortune file - */ - - if ((ifp = fopen (indexfile, "wb")) == NULL) { - eprintf ("%s: Cannot fopen \"%s\": %s", - argv [0], indexfile, strerror (errno)); - exit (3); - } - fclose (ifp); - statbuf.st_mtime = 0; - } - if (statbuf.st_mtime < fortune_time) { - /* Index file does either not exist or is older - * than fortune file. - */ - - if ((ffp = fopen (fortunefile, "r")) == NULL) { - eprintf ("%s: Cannot fopen \"%s\": %s", - argv [0], fortunefile, strerror (errno)); - exit (2); - } - if ((ifp = fopen (indexfile, "r+b")) == NULL) { - eprintf ("%s: Cannot fopen \"%s\": %s", - argv [0], indexfile, strerror (errno)); - exit (3); - } - cnt = 0; - fwritelong (ifp, 0, cnt); - ipos = RECLEN * 2; - while (fgets (line, sizeof (line), ffp)) { - if (STREQ (line, DELIMITER)) { - pos = ftell (ffp); - fwritelong (ifp, ipos, pos); - ++ cnt; - ipos += RECLEN; - } - } - fwritelong (ifp, 0, cnt); - fclose (ifp); - fclose (ffp); - } - - /* Now that we have a valid index file, open it and choose a fortune - */ - - if ((ifp = fopen (indexfile, "r+b")) == NULL) { - eprintf ("%s: Cannot fopen \"%s\": %s", - argv [0], indexfile, strerror (errno)); - exit (4); - } - - if ((ffp = fopen (fortunefile, "r")) == NULL) { - eprintf ("%s: Cannot fopen \"%s\": %s", - argv [0], fortunefile, strerror (errno)); - exit (5); - } - - /* Get number of entries */ - cnt = freadlong (ifp, 0); - - if (cnt == 0) { - eprintf ("%s: empty fortune file\n", argv [0]); - exit (6); - } - - nr = freadlong (ifp, RECLEN); - nr ++; - if (nr >= cnt) nr = 0; - fwritelong (ifp, RECLEN, nr); - - /* Now look for the start of the fortune in the index file */ - pos = freadlong (ifp, (nr + 2) * RECLEN); - - /* And seek to it in the fortune file */ - fseek (ffp, pos, SEEK_SET); - - /* write one fortune */ - while (fgets (line, sizeof (line), ffp) && ! STREQ (line, DELIMITER)) { - fputs (line, stdout); - } - fclose (ifp); - fclose (ffp); - return 0; -} diff --git a/fotoindex/GNUmakefile b/fotoindex/GNUmakefile deleted file mode 100644 index 775aaf1..0000000 --- a/fotoindex/GNUmakefile +++ /dev/null @@ -1,13 +0,0 @@ -include GNUmakevars -include GNUmakerules - -fotoindex: - -install: /usr/local/bin/fotoindex - - -/usr/local/man/man8/%.8: %.man - $(INSTALL) $< $@ - -clean: - rm -f *.gif *.jpg core foo bar baz diff --git a/fotoindex/fotoindex b/fotoindex/fotoindex deleted file mode 100755 index e68c9a7..0000000 --- a/fotoindex/fotoindex +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/local/bin/perl -# -# Combine several images into an index image (e.g., for use as an imagemap). -# -# Usage: fotoindex [-o outputfile] [templatefile] -# -# The first three lines give the width and height of the thumbnails and -# the number of thumbnails per row. The remaining lines are file names -# of the images to be combined. - -open(STDERR, ">/tmp/fotoindex.$$.debug"); - -$giftopnm = "/usr/local/bin/giftopnm"; -$pnmscale = "/usr/local/bin/pnmscale"; -$pbmmake = "/usr/local/bin/pbmmake"; -$pnmpaste = "/usr/local/bin/pnmpaste"; -$cjpeg = "/usr/local/bin/cjpeg"; - -if ($ARGV[0] eq "-o") { - shift; - $outputredirect = ">" . shift; -} - -@file = (<>); -chomp(@file); - -# Remove empty and comment lines -for ($i = 0; $i <= $#file;) { - if ($file[$i] =~ m/^(\#|\s*$)/ ) { - splice(@file, $i, 1); - } else { - $i++; - } -} - -$tnw = shift(@file); -$tnh = shift(@file); -$fw = shift(@file); -$fh = int(($#file + 1 + ($fw - 1)) / $fw); - -system ("$pbmmake " . $fw * $tnw . " " . $fh * $tnh . "> /tmp/fotoindex.$$.1.pnm"); - - -for ($i = 0; $i < $fh; $i ++) { - for ($j = 0; $j < $fw; $j++) { - $pic = $file[$i * $fw + $j]; - if (-f $pic) { - $cmnd = "$giftopnm $pic | $pnmscale -xysize $tnw $tnh > $pic.$$.pnm"; - system ($cmnd); - system ("$pnmpaste $pic.$$.pnm " . $j * $tnw . " " . $i * $tnh . " /tmp/fotoindex.$$.1.pnm > /tmp/fotoindex.$$.2.pnm"); - rename ("/tmp/fotoindex.$$.2.pnm", "/tmp/fotoindex.$$.1.pnm"); - unlink ("$pic.$$.pnm"); - } - } -} -system("$cjpeg -progressive /tmp/fotoindex.$$.1.pnm $outputredirect"); -unlink ("/tmp/fotoindex.$$.1.pnm"); diff --git a/hogs/memhog.c b/hogs/memhog.c deleted file mode 100644 index 0aa5d0c..0000000 --- a/hogs/memhog.c +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -int main(void) { - size_t s = 0x100000; - size_t sum = 0; - - while (s) { - void *p; - if (p = malloc(s)) { - sum += s; - printf("%lu - %lu\n", - (unsigned long)s, - (unsigned long)sum); - sleep (1); - memset(p, 'a', s); - s *= 2; - } else { - s /= 2; - } - } - return 0; -} diff --git a/ieeefloat/GNUmakefile b/ieeefloat/GNUmakefile deleted file mode 100644 index 2d0ac06..0000000 --- a/ieeefloat/GNUmakefile +++ /dev/null @@ -1,13 +0,0 @@ -include GNUmakevars -include GNUmakerules - -all: ieeefloat -install: $(BINDIR)/ieeefloat - -clean: - rm -f *.bak *.o core ieeefloat - -distclean: clean - rm -f *.d - --include *.d diff --git a/ieeefloat/ieeefloat.c b/ieeefloat/ieeefloat.c deleted file mode 100644 index 3af609b..0000000 --- a/ieeefloat/ieeefloat.c +++ /dev/null @@ -1,186 +0,0 @@ -char ieeefloat_c_rcs_id[] = - "$Id: ieeefloat.c,v 1.2 2000-02-08 17:04:37 hjp Exp $"; -/* ieeefloat: print binary representations of IEEE 754 FP numbers. - * - * $Log: ieeefloat.c,v $ - * Revision 1.2 2000-02-08 17:04:37 hjp - * Added -f and -d options to force input to be float or double format. - * - * Revision 1.1 1998/03/20 20:09:53 hjp - * Initial release: - * prints arguments as strings, floats, and doubles decimal and binary. - * - */ -#include -#include -#include -#include - - -#define BITS_FLT 32 -#define EXC_FLT 127 -#define MANT_FLT 23 -#define SIGN_FLT ((floatint)1<<(BITS_FLT-1)) - -#define BITS_DBL 64 -#define EXC_DBL 1023 -#define MANT_DBL 52 -#define SIGN_DBL ((doubleint)1<<(BITS_DBL-1)) - -#if ULONG_MAX/2+1 == (1UL << (BITS_FLT-1)) -typedef unsigned long int floatint; -#elif UINT_MAX/2+1 == (1U << (BITS_FLT-1)) -typedef unsigned int floatint; -#else -#error "no integral type with BITS_FLT bits" -#endif - -#if ULONG_MAX/2+1 == (1UL << (BITS_DBL-1)) -typedef unsigned long int doubleint; -#else -/* We cannot portably test for the existance of long long. - * If it doesn't exist, either the compiler or sanitychecks - * will complain - */ -typedef unsigned long long int doubleint; -#endif - - - - -char *cmnd; - - -static void usage(void) { - fprintf(stderr, "Usage: %s [-f|-d] fp-number ...\n", cmnd); - exit(1); -} - - -static void printbinary (doubleint b, int d) { - while (--d >= 0) { - putchar('0' + ((b >> d) & 1)); - } -} - - -static void printfloat(float f) { - union { - floatint i; - float f; - } u; - floatint e; - floatint m; - - u.f = f; - - printf("%24.7g: ", f); - printf("%c ", (u.i & SIGN_FLT) ? '-' : '+'); - u.i &= ~SIGN_FLT; - e = u.i >> MANT_FLT; - printf(" "); - printbinary(e, BITS_FLT-1-MANT_FLT); - - m = (u.i & (((floatint)1 << MANT_FLT) - 1)); - if (e == 0) { /* denormalized */ - printf(" [0.]"); - } else { - printf(" [1.]"); - } - printbinary(m, MANT_FLT); - printf("\n"); -} - - -static void printdouble(double f) { - union { - doubleint i; - double f; - } u; - doubleint e; - doubleint m; - - u.f = f; - - printf("%24.17g: ", f); - printf("%c ", (u.i & SIGN_DBL) ? '-' : '+'); - u.i &= ~SIGN_DBL; - e = u.i >> MANT_DBL; - printbinary(e, BITS_DBL-1-MANT_DBL); - - m = (u.i & (((doubleint)1 << MANT_DBL) - 1)); - if (e == 0) { - printf(" [0.]"); - } else { - printf(" [1.]"); - } - printbinary(m, MANT_DBL); - printf("\n"); -} - - -static void sanitychecks(void) { - union { - floatint i; - float f; - } fu; - union { - doubleint i; - double f; - } du; - - /* size */ - assert (sizeof(floatint) == sizeof(float)); - assert (sizeof(doubleint) == sizeof(double)); - - /* some numbers */ - fu.f = 0; - assert (fu.i == 0); - du.f = 0; - assert (du.i == 0); - - fu.f = 1.0; - assert (fu.i == (floatint)(0 + EXC_FLT) << MANT_FLT); - du.f = 1.0; - assert (du.i == (doubleint)(0 + EXC_DBL) << MANT_DBL); - - fu.f = 1.5; - assert (fu.i == - (((floatint)(0 + EXC_FLT) << MANT_FLT) | (1 << (MANT_FLT-1)))); - du.f = 1.5; - assert (du.i == - (((doubleint)(0 + EXC_DBL) << MANT_DBL) | ((doubleint)1 << (MANT_DBL-1)))); -} - - -int main(int argc, char**argv) { - int i; - int convfloat = 0; - char *p; - - cmnd = argv[0]; - sanitychecks(); - - for (i = 1; i < argc; i++) { - double d; - if (strcmp(argv[i], "-f") == 0) { - convfloat = 1; - continue; - } else if (strcmp(argv[i], "-d") == 0) { - convfloat = 0; - continue; - } - - d = strtod(argv[i], &p); - if (p && *p) usage(); - - if (convfloat) { - d = (float) d; - } - printf("%s\n", argv[i]); - printdouble(d); - printfloat(d); - } - - return 0; -} diff --git a/lspath/GNUmakefile b/lspath/GNUmakefile deleted file mode 100644 index e6e348f..0000000 --- a/lspath/GNUmakefile +++ /dev/null @@ -1,25 +0,0 @@ -include GNUmakevars - -all: lspath - -clean: - rm lspath customize - -install: $(BINDIR) $(BINDIR)/lspath - -%: %.pl customize - sh ./customize < $< > $@ - chmod +x $@ - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -$(BINDIR): - mkdir -p $@ - -include GNUmakerules - diff --git a/lspath/configure b/lspath/configure deleted file mode 100644 index 6fea68e..0000000 --- a/lspath/configure +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize.$$ -echo "sed \\" > customize.$$ -chmod +x customize.$$ - -################################################################ -# find a working perl: -# -for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5 -do - if $i -e 'exit ($] < 5.000)' - then - echo $i works - perl="$i" - break - fi -done -if [ -z "$perl" ] -then - could not find a working perl command, sorry. - exit 1 -fi -echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize.$$ - - -################################################################ -# finish -# Add trailing newline and rename temp file to final name -# -echo >> customize.$$ - -mv customize.$$ customize - diff --git a/lspath/lspath.pl b/lspath/lspath.pl deleted file mode 100755 index af81d59..0000000 --- a/lspath/lspath.pl +++ /dev/null @@ -1,14 +0,0 @@ -#!@@@perl@@@ -w -use strict; - - -for my $p (@ARGV) { - - my @p = split (/\//, $p); - for (my $i = 0; $i < scalar(@p); $i++) { - my $pp = join("/", @p[0..$i]); - $pp = "/" if $pp eq ""; - - system("/bin/ls", "-ldi", $pp); - } -} diff --git a/mailsummary/GNUmakefile b/mailsummary/GNUmakefile deleted file mode 100644 index a4ffb93..0000000 --- a/mailsummary/GNUmakefile +++ /dev/null @@ -1,27 +0,0 @@ -include GNUmakevars - -all: mailsummary - -clean: - rm -f mailsummary *.bak - -distclean: clean - rm -f customize - -install: $(BINDIR) $(BINDIR)/mailsummary - -%: %.pl customize - sh ./customize < $< > $@ - chmod +x $@ - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -$(BINDIR): - mkdir -p $@ - -include GNUmakerules diff --git a/mailsummary/configure b/mailsummary/configure deleted file mode 100755 index 0977b77..0000000 --- a/mailsummary/configure +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize -echo "sed \\" > customize -chmod +x customize - -################################################################ -# find a working perl: -# -for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5 -do - if $i -e 'exit ($] < 5.000)' - then - echo $i works - perl="$i" - break - fi -done -if [ -z "$perl" ] -then - could not find a working perl command, sorry. - exit 1 -fi -echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize - - -################################################################ -# finish: -# add a blank line to customize -echo >> customize diff --git a/mailsummary/mailsummary.pl b/mailsummary/mailsummary.pl deleted file mode 100755 index de51476..0000000 --- a/mailsummary/mailsummary.pl +++ /dev/null @@ -1,85 +0,0 @@ -#!@@@perl@@@ - -%mon2num = ( - Jan => 1, - Feb => 2, - Mar => 3, - Apr => 4, - May => 5, - Jun => 6, - Jul => 7, - Aug => 8, - Sep => 9, - Oct => 10, - Nov => 11, - Dec => 12 -); -$header = 0; - -foreach $f (@ARGV) { - if (!open(F, $f)) {next}; - $header = 1; - $from = ""; - $date = ""; - $subject = ""; - $to = ""; - - while () { - if (/^From ([^ ]*) /) { - $from = $1; - $header = 1; - if (/ - (?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s)? - (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s - ([0-9]?[0-9])\s - ([0-9]?[0-9]:[0-9][0-9]:[0-9][0-9])\s - (19[0-9][0-9]) - /x) { - $date = sprintf("%04d-%02d-%02d %8s", $4, $mon2num{$1}, $2, $3); - } else { - $date = "XXXX-XX-XX XX:XX:XX"; - } - } elsif ($header && /^Date:/) { - # Thu, 22 May 1997 16:49:23 +0200 - if (/^Date:\s+ - (?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s+)? - ([0-9]?[0-9])\s - (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s - (19[0-9][0-9])\s+ - ([0-9]?[0-9]:[0-9][0-9]:[0-9][0-9])/x) { - $date = sprintf("%04d-%02d-%02d %8s", $3, $mon2num{$2}, $1, $4); - } elsif (/^Date:\s+ - (?:(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s+)? - ([0-9]?[0-9])\s - (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s - ([7-9][0-9])\s+ - ([0-9]?[0-9]:[0-9][0-9]:[0-9][0-9])/x) { - $date = sprintf("%04d-%02d-%02d %8s", 1900 + $3, $mon2num{$2}, $1, $4); - } else { - print "bad date: $_\n"; - } - } elsif ($header && /^To:/) { - if (/^To:\s+(.*)/) { - $to = $1; - } else { - print "bad to: $_\n"; - } - } elsif ($header && /^Subject:/) { - if (/^Subject:\s+(.*)/) { - $subject = $1; - } else { - print "bad subject: $_\n"; - } - } elsif ($header && /^From:/) { - if (/^From:\s+(.*)/) { - $from = $1; - } else { - print "bad from: $_\n"; - } - } elsif ($header && /^$/) { - print "$date\t$f\t$from\t$to\t$subject\n"; - $header=0; - } - } - close(F); -} diff --git a/memlog/GNUmakefile b/memlog/GNUmakefile deleted file mode 100644 index 063dbba..0000000 --- a/memlog/GNUmakefile +++ /dev/null @@ -1,12 +0,0 @@ -include GNUmakevars - -BINDIR=/usr/local/sbin - -include GNUmakerules - -memlog: - -install: $(BINDIR)/memlog - -clean: - : diff --git a/memlog/memlog b/memlog/memlog deleted file mode 100644 index 3fc48b6..0000000 --- a/memlog/memlog +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -now=`/bin/date '+%Y-%m-%dT%H:%M:%S'` -egrep -i '^[a-z]+: +[0-9]+ kB$' /proc/meminfo |\ -while read a -do - echo "$now $a" -done >> /var/log/memlog diff --git a/mimetoc/mimetoc b/mimetoc/mimetoc deleted file mode 100755 index 5cc3c16..0000000 --- a/mimetoc/mimetoc +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/perl -w - -use MIME::Parser; - -#------------------------------ -# -# dump_entity ENTITY, NAME -# -# Recursive routine for dumping an entity. -# -sub dump_entity { - my ($entity, $level) = @_; - my $IO; - - $entity->head->unfold; - - # Output the head: - $subject = $entity->head->get('subject') || ""; - if ($subject) { - chomp($subject); - print ' ' x $level, "Subject: ", $subject, "\n"; - } - $from = $entity->head->get('from') || ""; - if ($from) { - chomp($from); - print ' ' x $level, "From: ", $from, "\n"; - } - - # Output the body: - my @parts = $entity->parts; - if (@parts) { # multipart... - my $i; - foreach $i (0 .. $#parts) { # dump each part... - dump_entity($parts[$i], $level + 1); - } - } - else { # single part... - - # Get MIME type, and display accordingly... - my ($type, $subtype) = split('/', $entity->head->mime_type); - my $body = $entity->bodyhandle; - my $size = length($body->as_string); - print ' ' x $level, "Content-type: $type/$subtype ($size bytes)\n"; - } - 1; -} - -#------------------------------ -# -# main -# -sub main { - - # Create a new MIME parser: - my $parser = new MIME::Parser; - - # Create and set the output directory: - (-d ".mimedump-tmp") or mkdir ".mimedump-tmp",0700 or die "mkdir: $!"; - (-w ".mimedump-tmp") or die "can't write to directory"; - $parser->output_dir(".mimedump-tmp"); - $parser->output_to_core(ALL); - - # Read the MIME message: - $entity = $parser->read(\*STDIN) or die "couldn't parse MIME stream"; - - # Dump it out: - dump_entity($entity, 0); -} -exit(&main ? 0 : -1); - -#------------------------------ -1; - - - diff --git a/mkmotd/mkmotd b/mkmotd/mkmotd deleted file mode 100755 index a36c2d9..0000000 --- a/mkmotd/mkmotd +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/perl - -$spooldir = "/usr/adm/motd"; -$motdfile = "/etc/motd"; - -chdir $spooldir || die "cannot chdir to $spooldir"; - -# build a list of files in the spool directory -opendir DIR, "." || die "cannot open `.'"; -@files = readdir (DIR); -closedir (DIR); - -open MOTD, ">$motdfile" || die "cannot open $motdfile"; - -foreach $thisfile (@files) { - if (-f $thisfile) { - $nonempty=1; - print MOTD "\n------------------------------------------------------------\n"; - open THISFILE, $thisfile || die "cannot open $thisfile"; - while ($line = ) { - print MOTD $line; - } - close THISFILE; - } -} -if ($nonempty) { - print MOTD "\n------------------------------------------------------------\n"; -} -system "/usr/local/bin/ci -l -q $motdfile" || die; -exit (0); diff --git a/obwrap/.vimrc b/obwrap/.vimrc deleted file mode 100644 index 7cb7ca1..0000000 --- a/obwrap/.vimrc +++ /dev/null @@ -1,9 +0,0 @@ -map [18~ :cp -map [19~ :cn -set autoindent -set errorformat=%f:%l:%m -set exrc -set number -set ruler -set shiftwidth=4 -set textwidth=72 diff --git a/obwrap/GNUmakefile b/obwrap/GNUmakefile deleted file mode 100644 index a4de0a5..0000000 --- a/obwrap/GNUmakefile +++ /dev/null @@ -1,8 +0,0 @@ -include GNUmakerules - -all: obwrap - -errno: -clean: - rm obwrap -install: $(BINDIR)/obwrap diff --git a/obwrap/obwrap.c b/obwrap/obwrap.c deleted file mode 100644 index 2bac387..0000000 --- a/obwrap/obwrap.c +++ /dev/null @@ -1,94 +0,0 @@ -char obwrap_c_rcsid[] = - "$Id: "; -/* obwrap - wrapper for omniback scripts - * - * Omniback leaves a lot of file descriptors open when executing its - * pre- and post-backup scripts. This means that any program started - * from such a script (e.g., oracle) will have open file descriptors - * on /var/opt/omni, which is a bad thing. - * This program closes all file descriptors except stdin and stdout, - * changes uid (if -u is given) and executes the specified program. - */ -#include -#include -#include -#include -#include -#include - -#define nonstderr stdout /* Omniback bogosity */ - -char *cmnd; - -void usage(void) { - fprintf(stderr, "Usage: %s [-u user] path arg0 ...\n", cmnd); - exit(1); -} - - -int main(int argc, char **argv) { - int i; - int c; - int open_max = sysconf(_SC_OPEN_MAX); - - cmnd = argv[0]; - - while ((c = getopt(argc, argv, "u:")) != EOF) { - switch (c) { - case 'u': { - char *p; - uid_t uid; - gid_t gid; - - uid = strtol(optarg, &p, 0); - if (*p != '\0') { - struct passwd *pwd = getpwnam(optarg); - if (!pwd) { - fprintf(nonstderr, "%s: no user %s\n", cmnd, optarg); - exit(1); - } - initgroups(optarg, pwd->pw_gid); - setresgid(pwd->pw_gid, pwd->pw_gid, pwd->pw_gid); - if (getgid() != pwd->pw_gid) { - fprintf(nonstderr, "%s: could not set gid %d (still %d)\n", cmnd, pwd->pw_gid, getgid()); - exit(1); - } - if (getegid() != pwd->pw_gid) { - fprintf(nonstderr, "%s: could not set egid %d (still %d)\n", cmnd, pwd->pw_gid, getgid()); - exit(1); - } - uid = pwd->pw_uid; - - } - setresuid(uid, uid, uid); - if (getuid() != uid) { - fprintf(nonstderr, "%s: could not set uid %d (still %d)\n", cmnd, uid, getuid()); - exit(1); - } - if (geteuid() != uid) { - fprintf(nonstderr, "%s: could not set euid %d (still %d)\n", cmnd, uid, geteuid()); - exit(1); - } - break; - } - default: - usage(); - - } - } - if (optind == argc) usage(); - - for (i = 2; i < open_max; i++) { - close(i); - } - - dup2(1, 2); - - execv(argv[optind], argv + optind + 1); - fprintf(nonstderr, "%s: could not exec %s: %s\n", - cmnd, argv[optind], strerror(errno)); - exit(1); - - - return 0; -} diff --git a/oragetsrc/GNUmakefile b/oragetsrc/GNUmakefile deleted file mode 100644 index 8f4b9b5..0000000 --- a/oragetsrc/GNUmakefile +++ /dev/null @@ -1,30 +0,0 @@ -include GNUmakevars - -CONFDIR=../../configure - -all: configure oragetsrc - -clean: - rm oragetsrc customize - -install: $(BINDIR) $(BINDIR)/oragetsrc - -%: %.pl customize - sh ./customize < $< > $@ - chmod +x $@ - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -configure: $(CONFDIR)/start $(CONFDIR)/perl $(CONFDIR)/finish - cat $^ > $@ - -$(BINDIR): - mkdir -p $@ - -include GNUmakerules - diff --git a/oragetsrc/configure b/oragetsrc/configure deleted file mode 100644 index 6fea68e..0000000 --- a/oragetsrc/configure +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize.$$ -echo "sed \\" > customize.$$ -chmod +x customize.$$ - -################################################################ -# find a working perl: -# -for i in /usr/bin/perl /usr/local/bin/perl /usr/bin/perl5 /usr/local/bin/perl5 -do - if $i -e 'exit ($] < 5.000)' - then - echo $i works - perl="$i" - break - fi -done -if [ -z "$perl" ] -then - could not find a working perl command, sorry. - exit 1 -fi -echo " -e 's,@@@perl@@@,$perl,g' \\" >> customize.$$ - - -################################################################ -# finish -# Add trailing newline and rename temp file to final name -# -echo >> customize.$$ - -mv customize.$$ customize - diff --git a/oragetsrc/oragetsrc.pl b/oragetsrc/oragetsrc.pl deleted file mode 100755 index bba8d53..0000000 --- a/oragetsrc/oragetsrc.pl +++ /dev/null @@ -1,49 +0,0 @@ -#!@@@perl@@@ -w - -# $Id: oragetsrc.pl,v 1.1 2001-02-12 14:32:43 hjp Exp $ -# -# print a named source (e.g, a function or procedure) from an oracle schema -# -use strict; -use DBI; - -sub read_cred { - my ($fn) = @_; - - open(FN, "<$fn") or die "cannot open $fn: $!"; - my $line = ; - close(FN); - my @cred = split(/[\s\n]/, $line); - return @cred; -} - -if (@ARGV != 2) { - print STDERR "Usage: $0 credential_file source_name\n"; - print STDERR "\tcredential_file is a filename relative to \$HOME/.dbi/\n"; - print STDERR "\tThe file must contain a single line with three whitespace-separated fields:\n"; - print STDERR "\tDBI data source, username, password.\n"; - print STDERR "\te.g:\n"; - print STDERR "\tdbi:Oracle:ORCL scott tiger\n"; - exit 1; -} - - -my $db_name = $ARGV[0]; -my $src_name = $ARGV[1]; - -my @cred = read_cred("$ENV{HOME}/.dbi/$ARGV[0]"); -my $dbh = DBI->connect($cred[0], $cred[1], $cred[2], - { RaiseError => 1, AutoCommit => 0 }); - -my $lines = - $dbh->selectcol_arrayref( - "select text from user_source where name=? order by line", - {}, - $src_name - ); - -for my $i (@$lines) { - print "$i"; -} -$dbh->disconnect(); - diff --git a/prwtmp/GNUmakefile b/prwtmp/GNUmakefile deleted file mode 100644 index dbcf70e..0000000 --- a/prwtmp/GNUmakefile +++ /dev/null @@ -1,22 +0,0 @@ -include GNUmakevars -include GNUmakerules - -prwtmp: - -install: $(ROOT)/usr/local/bin/prwtmp $(ROOT)/usr/local/man/man8/prwtmp.8 - -install_all: - $(MAKE) install ROOT=/nfs/wsrdb - $(MAKE) install ROOT=/nfs/wsrcom - $(MAKE) install ROOT=/nfs/wifosv - $(MAKE) install ROOT=/nfs/ihssv - $(MAKE) install ROOT=/nfs/wsrtest - -$(ROOT)/usr/local/bin/%: % - $(INSTALL) $< $@ - -$(ROOT)/usr/local/man/man8/%.8: %.man - $(INSTALL) $< $@ - -clean: - rm prwtmp diff --git a/prwtmp/prwtmp.c b/prwtmp/prwtmp.c deleted file mode 100644 index 13cc2a8..0000000 --- a/prwtmp/prwtmp.c +++ /dev/null @@ -1,110 +0,0 @@ -char prwtmp_c_rcs_id[] = - "$Id: prwtmp.c,v 1.2 1998-05-28 16:18:21 hjp Exp $"; -/* - * prwtmp - print wtmp to stdout - * - * $Log: prwtmp.c,v $ - * Revision 1.2 1998-05-28 16:18:21 hjp - * use GNUmakerules/GNUmakevars for CC and INSTALL. - * Bug fix: initial offset wasn't initialized - * Bug fix: #include and a cast (both needed for glibc2) - * - * Revision 1.1 1997/01/13 14:59:40 hjp - * Checked into CVS. - * Added -o and -s options. - * - */ -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -char *cmnd; - -void usage(void) { - fprintf(stderr, "Usage: %s [-o] [-s start] [file]\n", cmnd); - exit(1); -} - - -int main (int argc, char **argv) { - FILE *fp; - struct utmp u; - char *filename = WTMP_FILE; - long off = 0; - int print_offset = 0; - int c; - char *p; - - cmnd = argv[0]; - while ((c = getopt(argc, argv, "s:o")) != EOF) { - switch(c) { - case 's': - off = strtoul(optarg, &p, 0); - if (p == optarg || *p != '\0') usage(); - break; - case 'o': - print_offset = 1; - break; - case '?': - usage(); - default: - assert(0); - } - } - - if (argc > optind) filename = argv[optind]; - - fp = fopen(filename, "rb"); - if (!fp) { - fprintf(stderr, "%s: cannot open %s: %s\n", - cmnd, filename, strerror(errno)); - exit(1); - } - if (fseek(fp, off, SEEK_SET) == -1) { - fprintf(stderr, "%s: cannot seek to %ld on %s: %s\n", - cmnd, off, filename, strerror(errno)); - exit(1); - } - - while (fread(&u, (int)sizeof(u), 1, fp) == 1) { - char tbuf[20]; - - if (print_offset) printf ("%8ld: ", off); - off += sizeof(u); - - strftime(tbuf, (int)sizeof(tbuf), "%Y-%m-%d %H:%M:%S", - localtime(&u.ut_time)); - printf("%s ", tbuf); - printf("%-*.*s ", - (int)sizeof(u.ut_user), - (int)sizeof(u.ut_user), - u.ut_user); - printf("%-*.*s ", - (int)sizeof(u.ut_id), - (int)sizeof(u.ut_id), - u.ut_id); - printf("%-*.*s ", - (int)sizeof(u.ut_line), - (int)sizeof(u.ut_line), - u.ut_line); - printf("%5d ", (int)u.ut_pid); /* PID is typically < 30000 */ - printf("%5d ", (int)u.ut_type); /* short on HP-UX */ - printf("%5d ", (int)u.ut_exit.e_termination); /* short on HP-UX */ - printf("%5d ", (int)u.ut_exit.e_exit); /* short on HP-UX */ - printf("%-*.*s ", - (int)sizeof(u.ut_host), - (int)sizeof(u.ut_host), - u.ut_host); - printf("%08lx", (unsigned long)u.ut_addr); - printf("\n"); - - } - return 0; -} diff --git a/prwtmp/prwtmp.man b/prwtmp/prwtmp.man deleted file mode 100644 index 0e22576..0000000 --- a/prwtmp/prwtmp.man +++ /dev/null @@ -1,48 +0,0 @@ -.\" $Header: /usr/local/src/master/simple/prwtmp/prwtmp.man,v 1.1 1997-01-13 14:59:41 hjp Exp $ -.TH prwtmp 8 -.SH NAME -prwtmp \- print contents of wtmp file -.SH SYNOPSIS -.C prwtmp -.RC [ \-o ] -.RC [ \-s start ] -.RC [ file ] -.SH DESCRIPTION -.C prwtmp -interpretes -.I file -(default is the system wtmp file, normally /etc/wtmp, /var/log/wtmp, or -/var/adm/wtmp) as a -wtmp file and prints one line to stdout for each record. -If the -.B \-o -Option is given, each record is preceded by a decimal byte offset. -If the -.B -s -Option is given, processing starts at the given byte offset instead of -the beginning of the file. -.SH RETURN VALUE -Exit values are: -.RS 3 -.TP 8 -.B \00 -Successful completion. -.PD 0 -.TP -.B >0 -Error condition occurred. -.RE -.PD -.SH FILES -.TP -.B /etc/wtmp -.B /var/adm/wtmp -.B /var/log/wtmp -Default wtmp file (depends on OS). -.SH BUGS -None known. There are a few improvements planned, though: -An option to print the file in reverse (like last(1M), but without -coalescing matching records). Some way to select records or columns. -NLS support would be nice, too. -.SH SEE ALSO -last(1M) diff --git a/rcstell/GNUmakefile b/rcstell/GNUmakefile deleted file mode 100644 index c5744c3..0000000 --- a/rcstell/GNUmakefile +++ /dev/null @@ -1,24 +0,0 @@ -include GNUmakevars -include GNUmakerules - -rcstell: - -install: /usr/local/bin/rcstell \ - /usr/local/bin/rcsinfo \ - - -install_all: - $(MAKE) install ROOT=/nfs/wsrdb - $(MAKE) install ROOT=/nfs/wsrcom - $(MAKE) install ROOT=/nfs/wifosv - $(MAKE) install ROOT=/nfs/ihssv - $(MAKE) install ROOT=/nfs/wsrtest - -/usr/local/bin/rcsinfo: /usr/local/bin/rcstell - ln -s $< $@ - -/usr/local/man/man8/%.8: %.man - $(INSTALL) $< $@ - -clean: - rm count diff --git a/rcstell/rcstell b/rcstell/rcstell deleted file mode 100755 index ffadf28..0000000 --- a/rcstell/rcstell +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - -if [ $# -gt 1 ] -then - echo "Usage is: $0 [directory]" >&2 - exit 1 -fi - -NAME=`basename $0` - -if [ $# -eq 1 ] -then - DIR=`echo "$1" | sed -e 's+/RCS/*$++'` - cd "$DIR" -fi - -if [ ! -d RCS ] -then - echo "$0: no RCS directory" >&2 - exit 2 -fi - -OIFS="$IFS" -IFS=' -' -ALLFILES=`ls RCS/* | sed -e 's+^RCS/\(.*\),v+\1+'` -FILES=`grep '^locks$' /dev/null RCS/* | sed -e 's+^RCS/\(.*\),v:locks+\1+'` -FILEDIFF=`( echo "$ALLFILES"; echo "$FILES" ) | sort | uniq -u` - -for I in $FILES -do - IFS=${OIFS}:';' - set `awk '/^locks/,/;$/ { print }' RCS/${I},v` - LOCKER=$2 - VERSION=$3 - case "$NAME" - in - rcsinfo) echo "$I: version $VERSION locked by $LOCKER" ;; - rcstell) echo $I ;; - *) echo "Internal error: command $NAME unknown" >&2 - exit 1 - ;; - esac -done -IFS=' -' -for I in $FILEDIFF -do - case "$NAME" - in - rcsinfo) echo $I;; - esac -done - -exit 0 diff --git a/scat/GNUmakefile b/scat/GNUmakefile deleted file mode 100644 index 399947e..0000000 --- a/scat/GNUmakefile +++ /dev/null @@ -1,17 +0,0 @@ -include GNUmakevars -include GNUmakerules - -all: scat $(patsubst %.msg, %.cat, $(wildcard *.msg)) - -scat: scat.o -scat.o: scat.c scat.h -scat.h: scat.en.msg - gencat -H scat.h -o scat.en.cat scat.en.msg - -%.cat: %.msg - gencat $@ $^ - -clean: - rm -f *.cat *.o scat core scat.h - -install: $(BINDIR)/scat diff --git a/scat/scat.c b/scat/scat.c deleted file mode 100644 index 1deabed..0000000 --- a/scat/scat.c +++ /dev/null @@ -1,103 +0,0 @@ -char scat_c_cvs_version[] = - "$Id: scat.c,v 1.3 2000-02-10 00:17:35 hjp Exp $"; -/* scat - safe cat - * - * catenate input files and print to standard output. - * replace all non-printable characters with C \xXX escapes. - * - * $Log: scat.c,v $ - * Revision 1.3 2000-02-10 00:17:35 hjp - * Shut up gcc - * - * Revision 1.2 1999/08/01 18:09:09 hjp - * First release - * - */ -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "scat.h" - -char *cmnd; -nl_catd catalog; - -static void usage(void) { - fprintf(stderr, - catgets(catalog, MSG_Set, MSG_USAGE, - "Usage: %s [file ...]\n"), - cmnd); - exit(1); -} - - -static void do_safecat(const char *filename) { - FILE *fp; - int c; - - - if (strcmp(filename, "-") == 0) { - fp = stdin; - } else { - if ((fp = fopen(filename, "r")) == NULL) { - fprintf(stderr, catgets(catalog, MSG_Set, MSG_OPEN, - "%s: cannot open `%s' for reading: %s\n"), - cmnd, filename, strerror(errno)); - exit(1); - } - } - while ((c = getc(fp)) != EOF) { - if (isprint(c) || isspace(c)) { - if (putchar(c) == EOF) { - fprintf(stderr, - catgets(catalog, MSG_Set, MSG_WRITE, - "%s: cannot write stdout: %s\n"), - cmnd, strerror(errno)); - exit(1); - } - } else { - if (printf("\\x%02X", c) == EOF) { - fprintf(stderr, - catgets(catalog, MSG_Set, MSG_WRITE, - "%s: cannot write stdout: %s\n"), - cmnd, strerror(errno)); - exit(1); - } - } - } - if (ferror(fp)) { - fprintf(stderr, - catgets(catalog, MSG_Set, MSG_READ, - "%s: cannot read from `%s': %s\n"), - cmnd, filename, strerror(errno)); - exit(1); - } - if (strcmp(filename, "-") == 0) { - } else { - fclose(fp); - } - -} - - -int main(int argc, char **argv) { - setlocale(LC_ALL, ""); - - cmnd = argv[0]; - catalog = catopen("scat", 0); - if (argc == 1) { - do_safecat("-"); - } else { - int i; - for (i = 1; i < argc; i++) { - do_safecat(argv[i]); - } - } - return 0; -} diff --git a/scat/scat.de.msg b/scat/scat.de.msg deleted file mode 100644 index ebc1564..0000000 --- a/scat/scat.de.msg +++ /dev/null @@ -1,5 +0,0 @@ -$set MSG_ -USAGE Verwendung: %s [File ...]\n -OPEN %s: Kann `%s' nicht zum Lesen öffnen: %s\n -WRITE %s: Kann nicht auf stdout schreiben: %s\n -READ %s: Kann nicht von `%s' lesen: %s\n diff --git a/scat/scat.en.msg b/scat/scat.en.msg deleted file mode 100644 index d774299..0000000 --- a/scat/scat.en.msg +++ /dev/null @@ -1,5 +0,0 @@ -$set MSG_ -USAGE Usage: %s [files]\n -OPEN %s: cannot open `%s' for reading: %s\n -WRITE %s: cannot write to stdout: %s\n -READ %s: cannot read from `%s': %s\n diff --git a/setperm/GNUmakefile b/setperm/GNUmakefile deleted file mode 100644 index 1f2afa0..0000000 --- a/setperm/GNUmakefile +++ /dev/null @@ -1,7 +0,0 @@ -include GNUmakevars -setperm: -clean: - rm setperm -install: $(BINDIR)/setperm - -include GNUmakerules diff --git a/setperm/setperm.c b/setperm/setperm.c deleted file mode 100644 index 223a7a8..0000000 --- a/setperm/setperm.c +++ /dev/null @@ -1,80 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -char *cmnd; - -static void usage(void) { - fprintf(stderr, "Usage: %s -F protofile file ...\n", cmnd); - exit(1); -} - -typedef struct { - uid_t user; - gid_t group; - mode_t mode; -} perm_t; - -static int getperm(const char *filename, perm_t *permp) { - struct stat sb; - - if (stat(filename, &sb) == -1) return -1; - permp->user = sb.st_uid; - permp->group = sb.st_gid; - permp->mode = sb.st_mode; - return 0; -} - -static int setperm(const char *filename, perm_t perm) { - int rc = 0; - - if (chown(filename, perm.user, perm.group) == -1) { - fprintf (stderr, "%s: cannot change owner of `%s' to %ld:%ld: %s\n", - cmnd, filename, (long)perm.user, (long)perm.group, strerror(errno)); - rc = 1; - } - if (chmod(filename, perm.mode) == -1) { - fprintf (stderr, "%s: cannot change mode of %s to %lo: %s\n", - cmnd, filename, (unsigned long)perm.mode, strerror(errno)); - rc = 1; - } - return rc; -} - -int main (int argc, char **argv) { - int c; - perm_t perm; - int i; - - cmnd = argv[0]; - - while ((c = getopt(argc, argv, "o:g:m:F:R")) != EOF) { - switch (c) { - case 'o': - case 'p': - case 'm': - case 'R': - fprintf (stderr, "%s: option `%c' not yet implemented. Sorry\n", cmnd, c); - exit(1); - case 'F': - if (getperm (optarg, &perm) == -1) { - fprintf (stderr, "%s: cannot get permissions from %s: %s\n", - cmnd, optarg, strerror(errno)); - exit(1); - } - break; - case '?': - usage (); - default: - assert(0); - } - } - for (i = optind; i < argc; i ++) { - setperm(argv[i], perm); - } - return 0; -} diff --git a/shuffle/GNUmakefile b/shuffle/GNUmakefile deleted file mode 100644 index 7762d9e..0000000 --- a/shuffle/GNUmakefile +++ /dev/null @@ -1,13 +0,0 @@ -include GNUmakevars -include GNUmakerules - -shuffle: shuffle.o - $(CC) $^ -lant -o $@ - -clean: - rm -f *.o shuffle core foo bar - -install: $(BINDIR)/shuffle - -distclean: clean - rm -f *.bak *.d diff --git a/shuffle/shuffle.c b/shuffle/shuffle.c deleted file mode 100644 index 969cbb8..0000000 --- a/shuffle/shuffle.c +++ /dev/null @@ -1,107 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -char *cmnd; - -char **lines; -int nr_lines; -int nr_lines_a; - -unsigned int seed; - -static void usage(void) -{ - fprintf(stderr, "Usage: %s [-s seed]\n", cmnd); - exit(1); -} - -static void readfile(const char *filename) -{ - FILE *fp; - char *ln; - - if (STREQ(filename, "-")) { - fp = stdin; - } else { - fp = efopen(filename, "r"); - } - while ((ln = getline(fp))) { - if (nr_lines >= nr_lines_a) { - nr_lines_a = nr_lines_a * 3 / 2 + 1; - assert (nr_lines_a > nr_lines); - lines = realloc(lines, nr_lines_a * sizeof(*lines)); - assert(lines); - } - lines[nr_lines++] = strdup(ln); - } - if (fp != stdin) { - fclose(fp); - } -} - - -static void shuffle(void) { - int i; - int j; - char *p; - - srand(seed); - for (i = 0; i < nr_lines; i++) { - j = rand() / ((double)RAND_MAX + 1) * nr_lines; - assert (0 <= j && j < nr_lines); - p = lines[i]; - lines[i] = lines[j]; - lines[j] = p; - } -} - - -static void dump(void) { - int i; - - for (i = 0; i < nr_lines; i++) { - puts(lines[i]); - } -} - - -int main(int argc, char **argv) -{ - int c; - int i; - char *p; - - cmnd = argv[0]; - - seed = time(NULL); - while ((c = getopt(argc, argv, "")) != EOF) { - switch (c) { - case 's': - seed = strtoul(optarg, &p, 0); - if (p == optarg || *p != '\0') usage(); - break; - case '?': - usage(); - default: - assert(0); - } - } - - if (optind == argc) { - readfile("-"); - } - for (i = optind; i < argc; i++) { - readfile(argv[i]); - } - shuffle(); - dump(); - return 0; -} diff --git a/slowcat/.vimrc b/slowcat/.vimrc deleted file mode 100644 index 718e1ff..0000000 --- a/slowcat/.vimrc +++ /dev/null @@ -1,36 +0,0 @@ -version 5.0 -set nocompatible -let cpo_save=&cpo -set cpo=B -map! -map! -map! -map! -map! -map! -map! -map! -map! -map! -map :cn -map -map -map -map -map -map -map -map -map -map -map!  }I\begin{yyplcwendO -map!  >I<yypa/O -let &cpo=cpo_save -unlet cpo_save -set autoindent -set exrc -set number -set ruler -set shiftwidth=4 -set showmatch -set textwidth=72 diff --git a/slowcat/GNUmakefile b/slowcat/GNUmakefile deleted file mode 100644 index 0232bd4..0000000 --- a/slowcat/GNUmakefile +++ /dev/null @@ -1,13 +0,0 @@ -include GNUmakevars -include GNUmakerules - -all: slowcat -install: $(BINDIR)/slowcat - -clean: - rm -f *.bak *.o core slowcat - -distclean: clean - rm -f *.d - --include *.d diff --git a/slowcat/slowcat.c b/slowcat/slowcat.c deleted file mode 100644 index 1703f89..0000000 --- a/slowcat/slowcat.c +++ /dev/null @@ -1,70 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include - -char *cmnd; - -static void usage(void) { - fprintf(stderr, "Usage: %s [-d delay] file ...\n", cmnd); - exit(1); -} - - -static void do_cat(FILE *fp, double delay) { - int c; - - while ((c = getc(fp)) != EOF) { - putchar(c); - usleep(delay * 1E6); - } -} - - -int main(int argc, char **argv) { - int rc = 0; - int c; - double delay = 0.5; - - cmnd = argv[0]; - - while ((c = getopt(argc, argv, "d:")) != EOF) { - char *p; - switch (c) { - case 'd': - p = NULL; - delay = strtod(optarg, &p); - if (!p || *p) usage(); - if (delay < 0 || delay > ULONG_MAX / 1E6) usage(); - break; - case '?': - usage(); - default: - assert(0); - } - } - - setvbuf(stdout, NULL, _IONBF, 0); - - if (optind == argc) { - do_cat(stdin, delay); - } else { - int i; - - for (i = optind; i < argc; i++) { - FILE *fp = fopen(argv[i], "r"); - if (fp) { - do_cat(fp, delay); - fclose(fp); - } else { - fprintf(stderr, "%s: cannot open %s for reading: %s\n", - argv[0], argv[i], strerror(errno)); - rc++; - } - } - } - return rc; -} diff --git a/snmp/GNUmakefile b/snmp/GNUmakefile deleted file mode 100644 index 6619118..0000000 --- a/snmp/GNUmakefile +++ /dev/null @@ -1,14 +0,0 @@ -# $Id: GNUmakefile,v 1.1 2001-04-11 14:31:28 hjp Exp $ - -include GNUmakevars - -clean: - -install: $(SBINDIR)/mac-port-bay $(SBINDIR)/mac-port - -include GNUmakerules - -# $Log: GNUmakefile,v $ -# Revision 1.1 2001-04-11 14:31:28 hjp -# mac-port: convert mac address to switch port using snmp. -# diff --git a/snmp/mac-port b/snmp/mac-port deleted file mode 100755 index c20ad21..0000000 --- a/snmp/mac-port +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/perl -w -# -# $Id: mac-port,v 1.1 2001-04-11 14:31:29 hjp Exp $ -# -# find the port of a baystack 350 T switch to which a given -# mac address is connected. -# -use strict; - -sub usage { - print STDERR "Usage: $0 switch mac-address\n"; - exit(1); -} - - -if (@ARGV != 2) {usage();} - -my @hmac = split(/:/, $ARGV[1]); - -my $switch = $ARGV[0]; - -my @dmac = map { hex } @hmac; - -my $object = "17.4.3.1.2." . join(".", @dmac); - -system("snmpget", $switch, "public", $object); - -# $Log: mac-port,v $ -# Revision 1.1 2001-04-11 14:31:29 hjp -# mac-port: convert mac address to switch port using snmp. -# diff --git a/snmp/mac-port-bay b/snmp/mac-port-bay deleted file mode 100755 index b67f11b..0000000 --- a/snmp/mac-port-bay +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/perl -w -# -# $Id: mac-port-bay,v 1.1 2001-04-11 14:31:29 hjp Exp $ -# -# find the port of a baystack 350 T switch to which a given -# mac address is connected. -# -use strict; - -sub usage { - print STDERR "Usage: $0 mac-address\n"; - exit(1); -} - - -if (@ARGV != 1) {usage();} - -my @hmac = split(/:/, $ARGV[0]); - -my @dmac = map { hex } @hmac; - -my $object = "17.4.3.1.2." . join(".", @dmac); - -system("snmpget", "bay-switch-1", "public", $object); - -# $Log: mac-port-bay,v $ -# Revision 1.1 2001-04-11 14:31:29 hjp -# mac-port: convert mac address to switch port using snmp. -# diff --git a/tcpdump_tools/tcpdump2ascii b/tcpdump_tools/tcpdump2ascii deleted file mode 100755 index da750ad..0000000 --- a/tcpdump_tools/tcpdump2ascii +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/perl - -while(<>) { - if (/^\t\t\t( [0-9a-f]{2,4})+$/) { - @hex = split; - foreach $i (@hex) { - @c = pack("H4", $i); - foreach $j (@c) { - print "$j"; - } - } - print "\n"; - } else { - print - } -} diff --git a/tcpdump_tools/tcpdump_sum.pl b/tcpdump_tools/tcpdump_sum.pl deleted file mode 100755 index edf38d0..0000000 --- a/tcpdump_tools/tcpdump_sum.pl +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/perl - -# print summary of tcpdump output - -sub dumpstats { - print "-" x 60, "\n"; - print "$time_last\n"; - for $i (sort { $sum{$a} <=> $sum{$b} } keys (%sum)) { - printf("\t%6d %s\n", $sum{$i}, $i); - } -} - -while (<>) { - if (m/^(\d\d:\d\d):\d\d\.\d{6} ([-\w\.]+) \> ([-\w\.]+): (.*)/) { - $time = $1; - $from = $2; - $to = $3; - $rest = $4; - if ($time ne $time_last) { - dumpstats(); - undef %sum; - $time_last = $time; - } - if ($rest =~ m/^. (\d+):(\d+)\((\d+)\)/) { - # tcp - $sum{$from . " > " . $to} += $3; - } elsif ($rest =~ m/^. ack (\d+) win (\d+) \(DF\)/) { - # tcp ack - $sum{$from . " > " . $to} += 0; - } else { - print stderr "unparseable2: $_"; - } - - - } else { - print stderr "unparseable1: $_"; - } -} -dumpstats(); diff --git a/tcpdump_tools/tcpdump_sum2.pl b/tcpdump_tools/tcpdump_sum2.pl deleted file mode 100755 index a52210b..0000000 --- a/tcpdump_tools/tcpdump_sum2.pl +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/perl - -# print summary of tcpdump output - -sub dumpstats { - print "-" x 60, "\n"; - print "$time_last\n"; - for $i (sort { $sum{$a} <=> $sum{$b} } keys (%sum)) { - printf("\t%6d %s\n", $sum{$i}, $i); - } -} - -$maxsecs = 0; -$minsecs = 86400; - -while (<>) { - if (m/^(\d\d:\d\d:\d\d)\.\d{6} ([-\w\.]+) \> ([-\w\.]+): (.*)/) { - $time = $1; - $from = $2; - $to = $3; - $rest = $4; - @t = split(/:/, $time); - $secs = $t[0] * 3600 + $t[1] * 60 + $t[2]; - if ($secs < $minsecs) {$minsecs = $secs} - if ($secs > $maxsecs) {$maxsecs = $secs} - - if ($rest =~ m/^. (\d+):(\d+)\((\d+)\)/) { - # tcp - $con = "$from > $to"; - $tsum{$con} += $3; - if (!$sum{$con}) { - $sum{$con} = []; - } - $sum{$con}->[$secs] += $3; - - - } elsif ($rest =~ m/^. ack (\d+) win (\d+) \(DF\)/) { - # tcp ack - } else { - #print stderr "unparseable2: $_"; - } - - - } else { - #print stderr "unparseable1: $_"; - } -} - -for $c ((sort {$tsum{$b} <=> $tsum{$a}} keys %tsum)[0..9]) { - print "# ", $c, " ", $tsum{$c}, "\n"; - for ($s = $minsecs; $s <= $maxsecs; $s++) { - print $c, "\t", $s, "\t", $sum{$c}->[$s] + 0, "\n"; - } -} diff --git a/tcpdump_tools/tcpdumptognuplot b/tcpdump_tools/tcpdumptognuplot deleted file mode 100755 index bc94d2c..0000000 --- a/tcpdump_tools/tcpdumptognuplot +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/perl -$count = $ack = $prevtime = 0; - -while () { - if (/${ARGV[0]}/) { - print "# ", $_; - # 20:22:42.441592 calypso.wsr.ac.at.ftp-data > octopussy.wsr.ac.at.1365: . 1:1461(1460) ack 1 win 57344 (DF) - if (/^(\d\d):(\d\d):(\d\d).(\d\d\d\d\d\d) /) { - print "# time: $1 $2 $3 $4\n"; - $time = $1 * 3600 + $2 * 60 + $3 + $4 * 0.000001; - if ($prevtime == 0) { $prevtime = $time }; - $time -= $prevtime; - } - if (/(\d+):(\d+)\((\d+)\)/) { - print "# sequence: $1 $2 $3\n"; - # filter out initial seq. number but allow some packet loss - if ($2 == $1 + $3 && $1 <= $count + 300000) { - $count = $2; - } - } - if (/ ack (\d+)/) { - print "# ack: $1\n"; - # filter out initial seq. number but allow some packet loss - if ($1 <= $ack + 300000) { - $ack = $1; - } - } - print $time, "\t", $count, "\t", $ack, "\n"; - } -} diff --git a/time_t/GNUmakefile b/time_t/GNUmakefile deleted file mode 100644 index cb1e1b7..0000000 --- a/time_t/GNUmakefile +++ /dev/null @@ -1,9 +0,0 @@ -include GNUmakevars -include GNUmakerules - -all: time_t - -time_t: -clean: - rm time_t -install: $(BINDIR)/time_t diff --git a/time_t/time_t.c b/time_t/time_t.c deleted file mode 100644 index 9949f7a..0000000 --- a/time_t/time_t.c +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include -#include - -char *cmnd; - -static void usage(void) { - fprintf(stderr, "Usage: %s time_t ...\n", cmnd); - exit(1); -} - - -int main(int argc, char **argv) { - int i; - char *format = "%Y-%m-%d %H:%M:%S %Z"; - int c; - - cmnd = argv[0]; - - while ((c = getopt(argc, argv, "f:")) != EOF) { - switch(c) { - case 'f': - format = optarg; - break; - case '?': - usage(); - default: - assert("this" == "unreachable"); - } - } - - if (optind >= argc) usage(); - - for (i = optind; i < argc; i++) { - time_t t = strtoul(argv[i], NULL, 0); - struct tm *tmp; - char buf[1024]; - - tmp = localtime(&t); - strftime(buf, sizeof(buf), format, tmp); - printf("%s\n", buf); - } - return 0; -} -/* vim:sw=4 - */ diff --git a/tiny/GNUmakefile b/tiny/GNUmakefile deleted file mode 100644 index d8a0c5f..0000000 --- a/tiny/GNUmakefile +++ /dev/null @@ -1,38 +0,0 @@ -include GNUmakevars - -CONFDIR=../../configure -CONFDIR_exists=$(shell [ -d $(CONFDIR) ] && echo ok) - -all: configure dus fnp fnpa fnpc fqdn isodate psg - -clean: - rm fnp fnpa fnpc customize - -install: \ - $(BINDIR)/dus \ - $(BINDIR)/fnp \ - $(BINDIR)/fnpa \ - $(BINDIR)/fnpc \ - $(BINDIR)/fqdn \ - $(BINDIR)/isodate \ - $(BINDIR)/psg \ - -fnp: fnp.sh -fnpa: fnpa.sh -fnpc: fnpc.sh - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -ifeq ($(CONFDIR_exists),ok) - -configure: $(CONFDIR)/start $(CONFDIR)/find-printf $(CONFDIR)/finish - cat $^ > $@ - -endif - -include GNUmakerules diff --git a/tiny/configure b/tiny/configure deleted file mode 100644 index fa529d9..0000000 --- a/tiny/configure +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize.$$ -echo "sed \\" > customize.$$ -chmod +x customize.$$ - -################################################################ -# $Id: configure,v 1.2 2001-03-19 22:48:23 hjp Exp $ -# find a ln which understands -sf -# -touch find-printf.$$.1 -today=`date '+%Y-%m-%d'` -for i in /bin/find /usr/bin/find /usr/local/bin/find -do - if [ "`$i find-printf.$$.1 -printf '%TY-%Tm-%Td %p'`" = "$today find-printf.$$.1" ] - then - echo $i works - find="$i" - break - fi -done -if [ -z "$find" ] -then - echo could not find a working find command, sorry. - exit 1 -fi -echo " -e 's,@@@find@@@,$find,g' \\" >> customize.$$ -rm find-printf.$$.? - -# $Log: configure,v $ -# Revision 1.2 2001-03-19 22:48:23 hjp -# GNUmakefile: try to rebuild configure only if source dir is there. -# -# configure: Fixed test for find -printf. -# -# psg: include f option on Linux. -# -# Revision 1.1 2001/03/19 22:44:39 hjp -# *** empty log message *** -# -################################################################ -# finish -# Add trailing newline and rename temp file to final name -# -echo >> customize.$$ - -mv customize.$$ customize - diff --git a/tiny/dus b/tiny/dus deleted file mode 100755 index e2c740d..0000000 --- a/tiny/dus +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -du -k -x $@ | sort -n | tail -100 diff --git a/tiny/fnp.sh b/tiny/fnp.sh deleted file mode 100755 index 3ecafc1..0000000 --- a/tiny/fnp.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -@@@find@@@ "$@" -printf "%TY-%Tm-%Td %TH:%TM:%TS %5k %-8u %-8g %m %p\t%l\n" diff --git a/tiny/fnpa.sh b/tiny/fnpa.sh deleted file mode 100755 index 6875b8e..0000000 --- a/tiny/fnpa.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -@@@find@@@ "$@" -printf "%AY-%Am-%Ad %AH:%AM:%AS %5k %-8u %-8g %m %p\t%l\n" diff --git a/tiny/fnpc.sh b/tiny/fnpc.sh deleted file mode 100755 index def6e84..0000000 --- a/tiny/fnpc.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -@@@find@@@ "$@" -printf "%CY-%Cm-%Cd %CH:%CM:%CS %5k %-8u %-8g %m %p\t%l\n" diff --git a/tiny/fqdn b/tiny/fqdn deleted file mode 100755 index cd57f45..0000000 --- a/tiny/fqdn +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -[ $# -ge 2 ] && { echo "Usage: $0 [hostname]" >&2; exit 1; } -if [ $# -eq 1 ] -then - hostname=$1 -else - hostname="`/bin/hostname`" -fi -/usr/bin/nslookup $hostname | /bin/grep Name: | /bin/sed -e 's/.* *//' diff --git a/tiny/isodate b/tiny/isodate deleted file mode 100755 index 0cf1c0d..0000000 --- a/tiny/isodate +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -date '+%Y-%m-%dT%H:%M:%S' diff --git a/tiny/psg b/tiny/psg deleted file mode 100755 index 25c02a6..0000000 --- a/tiny/psg +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -case `uname` in -Linux) - ps auxwwf | grep "$1" - ;; -HP-UX) - ps -ef | grep "$1" - ;; -esac diff --git a/truncate/GNUmakefile b/truncate/GNUmakefile deleted file mode 100644 index 5e87aef..0000000 --- a/truncate/GNUmakefile +++ /dev/null @@ -1,25 +0,0 @@ -include GNUmakevars - -all: truncate - -clean: - rm truncate customize - -install: $(BINDIR) $(BINDIR)/truncate $(MAN1DIR)/truncate.1 - -%: %.pl customize - sh ./customize < $< > $@ - chmod +x $@ - -%: %.sh customize - sh ./customize < $< > $@ - chmod +x $@ - -customize: configure - sh ./configure - -$(BINDIR): - mkdir -p $@ - -include GNUmakerules - diff --git a/truncate/configure b/truncate/configure deleted file mode 100644 index f4c377f..0000000 --- a/truncate/configure +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# -echo "#!/bin/sh" > customize.$$ -echo "sed \\" > customize.$$ -chmod +x customize.$$ - -################################################################ -# find a find which understands -printf -# (like gnu find) -# -now=`date '+%Y%m%d' ` -touch find_printf.$now.$$ - -for i in /usr/bin/find /usr/local/bin/find -do - ts=`$i find_printf.$now.$$ -printf '%TY%Tm%Td\n'` - if [ "x$ts" = "x$now" ] - then - echo $i works - find_printf="$i" - break - fi -done -if [ -z "$find_printf" ] -then - echo could not find a working find_printf command, sorry. - exit 1 -fi -echo " -e 's,@@@find_printf@@@,$find_printf,g' \\" >> customize.$$ -rm find_printf.$now.$$ - - -################################################################ -# finish -# Add trailing newline and rename temp file to final name -# -echo >> customize.$$ - -mv customize.$$ customize - diff --git a/truncate/truncate.1 b/truncate/truncate.1 deleted file mode 100644 index 01eb266..0000000 --- a/truncate/truncate.1 +++ /dev/null @@ -1,23 +0,0 @@ -.\" $Id: truncate.1,v 1.1 2000-08-23 13:03:42 hjp Exp $ -.\" $Log: truncate.1,v $ -.\" Revision 1.1 2000-08-23 13:03:42 hjp -.\" Initial release -.\" -.\" -.TH truncate 1 -.SH NAME -truncate - truncate files to zero length -.SH SYNOPSIS -.B truncate -[ -.I find-options -] -.SH DESCRIPTION -Truncate uses find with the specified options to find regular files. -Each file is truncated to zero length, but owner, permissions, and -last-modified date are preserved. If the user doesn't have write -permissions for a file, a message is printed and the file is skipped. -.SH DIAGNOSTICS -Various error messages from the used commands. -.SH AUTHOR -Peter J. Holzer (hjp@wsr.ac.at) diff --git a/truncate/truncate.sh b/truncate/truncate.sh deleted file mode 100644 index fe1dcc0..0000000 --- a/truncate/truncate.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -if [ $# -eq 0 ] -then - echo "Usage: $0 find-options" >&2 - exit 1 -fi -@@@find_printf@@@ "$@" -type f -printf '%TY%Tm%Td%TH%TM.%TS %p\n' | -while read timestamp file -do - : > "$file" - touch -t "$timestamp" "$file" -done diff --git a/waste/GNUmakefile b/waste/GNUmakefile deleted file mode 100644 index 83da72d..0000000 --- a/waste/GNUmakefile +++ /dev/null @@ -1,12 +0,0 @@ -include GNUmakevars -include GNUmakerules - -all: waste - -errno: -clean: - rm waste -install: $(BINDIR)/waste - -%: %.pl patchperl - sh ./patchperl $< $@ diff --git a/waste/patchperl b/waste/patchperl deleted file mode 100644 index eb6bde2..0000000 --- a/waste/patchperl +++ /dev/null @@ -1,14 +0,0 @@ -perl=`which perl` -if [ $# -ne 2 ] -then - echo "Usage $0 source target" >&2 - exit 1 -fi -if [ -z "$perl" ] -then - echo "$0: cannot find perl binary" >&2 - exit 1 -fi -sed -e "s,@@@perl@@@,$perl," < $1 > $2 -chmod +x $2 -exit 0 diff --git a/waste/waste.pl b/waste/waste.pl deleted file mode 100755 index 9c2fabb..0000000 --- a/waste/waste.pl +++ /dev/null @@ -1,73 +0,0 @@ -#!@@@perl@@@ - -# -# Report wasted space. -# -# This basically prints a list of files and directories below a -# start point, where each entry is tagged with a "waste factor". -# The waste factor is a weighted sum of size, mtime and atime -# of the file. -# - -sub wastefactor { - my ($size, $mtime, $atime) = @_; - - return $size * $sf * ($mtime * $mf + $atime * $af); -} - - -sub waste { - my ($dir) = @_; - my $i; - my @files; - my ($mtime, $atime, $size); - my ($tmtime, $tatime, $tsize) = (0, 0, 0); - - if (!opendir(DIR, $dir)) { - printf "$0: cannot open directory $dir: $!\n"; - return; - } - @files = readdir(DIR); - closedir(DIR); - foreach $i (@files) { - if ($i eq "." || $i eq "..") { next } - - $filename = $dir . "/" . $i; - ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = - lstat($filename); - - if (-d _) { - ($size, $mtime, $atime) = waste($filename); - } else { - printf "%10.0f %d %d %d %s\n", - wastefactor( - $size, ($now - $mtime), ($now - $atime)), - $size, ($now - $mtime), ($now - $atime), - $filename; - } - $tsize += $size; - if ($mtime > $tmtime) {$tmtime = $mtime;} - if ($atime > $tatime) {$tatime = $atime;} - } - printf "%10.0f %d %d %d %s\n", - wastefactor( - $tsize, ($now - $tmtime), ($now - $tatime)), - $tsize, ($now - $tmtime), ($now - $tatime), - $dir; - return ($tsize, $tmtime, $tatime); -} - -### --- main --- ### -$sf = 1.0/1000; -$mf = $af = 1.0/(3600*24*365.25); - -if ($#ARGV != 0) { - print "Usage: $0 directoryname\n"; - exit(1); -} - -$now = time(); - -waste($ARGV[0]); -exit(0);