This commit was manufactured by cvs2svn to create branch 'combined_graph'.

This commit is contained in:
cvs2git 2001-07-16 07:46:18 +00:00
parent b39a4ebfbd
commit cd3d78bbb1
103 changed files with 0 additions and 3939 deletions

View File

@ -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

View File

@ -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.
#

30
agestat/configure vendored
View File

@ -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

View File

@ -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 "<html><body>\n";
print "<h1>Internal error</h1>\n";
print "Connection to $serv_addr:$serv_port failed: $!\n";
print "</body></html>\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";

View File

@ -1,10 +0,0 @@
include GNUmakevars
include GNUmakerules
all: charhist
chartab:
clean:
rm -f charhist core foo bar baz
install: $(BINDIR)/charhist

View File

@ -1,21 +0,0 @@
#include <ctype.h>
#include <locale.h>
#include <stdio.h>
#include <limits.h>
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;
}

View File

@ -1,11 +0,0 @@
include GNUmakevars
all: chartab ctype-test
chartab:
ctype-test:
clean:
rm chartab
install: $(BINDIR)/chartab $(BINDIR)/ctype-test
include GNUmakerules

View File

@ -1,10 +0,0 @@
#include <stdio.h>
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;
}

View File

@ -1,17 +0,0 @@
#include <ctype.h>
#include <locale.h>
#include <limits.h>
#include <stdio.h>
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;
}

View File

@ -1,6 +0,0 @@
version 5.0
map!  >I<yypa/O
set autoindent
set exrc
set number
set shiftwidth=4

View File

@ -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

View File

@ -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
#

View File

@ -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
#

34
cleandir/configure vendored
View File

@ -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

View File

@ -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

View File

@ -1,30 +0,0 @@
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
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;
}

View File

@ -1,6 +0,0 @@
version 5.0
map!  >I<yypa/O
set autoindent
set exrc
set ruler
set shiftwidth=4

View File

@ -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

68
cvsdiffmin/configure vendored
View File

@ -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="<b
=B
>"
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

View File

@ -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 (<DIFF>) {
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

View File

@ -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.
#

View File

@ -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

231
ddm/ddm.c
View File

@ -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 <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <mntent.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
#include <ant/da.h>
#include <ant/io.h>
#include <ant/globals.h>
#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.
*
*/

View File

@ -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

View File

@ -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

View File

@ -1,4 +0,0 @@
all: have_hstrerror.h
%.h: %.sh
CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' sh $^ > $@

View File

@ -1,11 +0,0 @@
cat > has_hstrerror_$$.c <<EOF
#include <netdb.h>
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_$$

View File

@ -1,51 +0,0 @@
#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#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;
}

View File

@ -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

View File

@ -1 +0,0 @@
const char * hstrerror(int err);

View File

@ -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 $< $@

View File

@ -1,37 +0,0 @@
#!/usr/bin/perl
$avgfile = "/usr/local/lib/duwatch.avg";
$root = "/";
$thresh = 20000;
$period = 30;
open AVG, $avgfile || die;
while (<AVG>) {
($size, $name) = split;
$avgdu{$name} = $size;
$all{$name} = 1;
}
close AVG;
open NEW, "/bin/du -t hfs $root |" || die;
while (<NEW>) {
($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;

View File

@ -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

View File

@ -1,34 +0,0 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
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
*/

View File

@ -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

34
fact/configure vendored
View File

@ -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

View File

@ -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

View File

@ -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 $< $@

View File

@ -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 <assert.h>
#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <ant/io.h>
#include <ant/alloc.h>
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;
}

View File

@ -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

View File

@ -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 <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ant/io.h>
#include <ant/string.h>
#include <ant/globals.h>
/* 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;
}

View File

@ -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

View File

@ -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");

View File

@ -1,22 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
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;
}

View File

@ -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

View File

@ -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 <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#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;
}

View File

@ -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

34
lspath/configure vendored
View File

@ -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

View File

@ -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);
}
}

View File

@ -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

30
mailsummary/configure vendored
View File

@ -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

View File

@ -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 (<F>) {
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);
}

View File

@ -1,12 +0,0 @@
include GNUmakevars
BINDIR=/usr/local/sbin
include GNUmakerules
memlog:
install: $(BINDIR)/memlog
clean:
:

View File

@ -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

View File

@ -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;

View File

@ -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 = <THISFILE>) {
print MOTD $line;
}
close THISFILE;
}
}
if ($nonempty) {
print MOTD "\n------------------------------------------------------------\n";
}
system "/usr/local/bin/ci -l -q $motdfile" || die;
exit (0);

View File

@ -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

View File

@ -1,8 +0,0 @@
include GNUmakerules
all: obwrap
errno:
clean:
rm obwrap
install: $(BINDIR)/obwrap

View File

@ -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 <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <unistd.h>
#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;
}

View File

@ -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

34
oragetsrc/configure vendored
View File

@ -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

View File

@ -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 = <FN>;
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();

View File

@ -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

View File

@ -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 <unistd.h> 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 <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/types.h>
#include <unistd.h>
#include <utmp.h>
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;
}

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 <ctype.h>
#include <errno.h>
#include <locale.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <features.h>
#include <nl_types.h>
#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;
}

View File

@ -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

View File

@ -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

View File

@ -1,7 +0,0 @@
include GNUmakevars
setperm:
clean:
rm setperm
install: $(BINDIR)/setperm
include GNUmakerules

View File

@ -1,80 +0,0 @@
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
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;
}

View File

@ -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

View File

@ -1,107 +0,0 @@
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h>
#include <ant/io.h>
#include <ant/string.h>
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;
}

View File

@ -1,36 +0,0 @@
version 5.0
set nocompatible
let cpo_save=&cpo
set cpo=B
map! <xHome> <Home>
map! <xEnd> <End>
map! <S-xF4> <S-F4>
map! <S-xF3> <S-F3>
map! <S-xF2> <S-F2>
map! <S-xF1> <S-F1>
map! <xF4> <F4>
map! <xF3> <F3>
map! <xF2> <F2>
map! <xF1> <F1>
map <F8> :cn
map <xHome> <Home>
map <xEnd> <End>
map <S-xF4> <S-F4>
map <S-xF3> <S-F3>
map <S-xF2> <S-F2>
map <S-xF1> <S-F1>
map <xF4> <F4>
map <xF3> <F3>
map <xF2> <F2>
map <xF1> <F1>
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

View File

@ -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

View File

@ -1,70 +0,0 @@
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
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;
}

View File

@ -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.
#

View File

@ -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.
#

View File

@ -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.
#

View File

@ -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
}
}

View File

@ -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();

View File

@ -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";
}
}

View File

@ -1,30 +0,0 @@
#!/usr/bin/perl
$count = $ack = $prevtime = 0;
while (<STDIN>) {
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";
}
}

View File

@ -1,9 +0,0 @@
include GNUmakevars
include GNUmakerules
all: time_t
time_t:
clean:
rm time_t
install: $(BINDIR)/time_t

View File

@ -1,48 +0,0 @@
#include <assert.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
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
*/

View File

@ -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

48
tiny/configure vendored
View File

@ -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

View File

@ -1,2 +0,0 @@
#!/bin/sh
du -k -x $@ | sort -n | tail -100

View File

@ -1,2 +0,0 @@
#!/bin/sh
@@@find@@@ "$@" -printf "%TY-%Tm-%Td %TH:%TM:%TS %5k %-8u %-8g %m %p\t%l\n"

View File

@ -1,2 +0,0 @@
#!/bin/sh
@@@find@@@ "$@" -printf "%AY-%Am-%Ad %AH:%AM:%AS %5k %-8u %-8g %m %p\t%l\n"

View File

@ -1,2 +0,0 @@
#!/bin/sh
@@@find@@@ "$@" -printf "%CY-%Cm-%Cd %CH:%CM:%CS %5k %-8u %-8g %m %p\t%l\n"

View File

@ -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/.* *//'

View File

@ -1,2 +0,0 @@
#!/bin/sh
date '+%Y-%m-%dT%H:%M:%S'

View File

@ -1,9 +0,0 @@
#!/bin/sh
case `uname` in
Linux)
ps auxwwf | grep "$1"
;;
HP-UX)
ps -ef | grep "$1"
;;
esac

View File

@ -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

40
truncate/configure vendored
View File

@ -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

View File

@ -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)

View File

@ -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

Some files were not shown because too many files have changed in this diff Show More