Compare commits
9 Commits
5de6672e2a
...
3aee99f7f6
Author | SHA1 | Date |
---|---|---|
|
3aee99f7f6 | |
|
1efa5739d9 | |
|
4a7fea8945 | |
|
3a0ee630ed | |
|
ca9306318b | |
|
3a5268c37a | |
|
574338319e | |
|
3f726736ca | |
|
4563b0a53a |
|
@ -48,6 +48,8 @@ if ($opts{buckets} eq "log2") {
|
||||||
);
|
);
|
||||||
} elsif ($opts{buckets} =~ /^days=(\d+)/) {
|
} elsif ($opts{buckets} =~ /^days=(\d+)/) {
|
||||||
@bucket_max = map $_ * 86400, (1 .. $1);
|
@bucket_max = map $_ * 86400, (1 .. $1);
|
||||||
|
} elsif ($opts{buckets} =~ /^hours=(\d+)/) {
|
||||||
|
@bucket_max = map $_ * 3600, (1 .. $1);
|
||||||
} else {
|
} else {
|
||||||
usage();
|
usage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
include GNUmakevars
|
-include GNUmakevars
|
||||||
|
|
||||||
all: chartab ctype-test
|
all: chartab ctype-test
|
||||||
|
|
||||||
chartab:
|
chartab: chartab.pl
|
||||||
|
cp $^ $@
|
||||||
|
|
||||||
ctype-test:
|
ctype-test:
|
||||||
clean:
|
clean:
|
||||||
rm chartab
|
rm chartab
|
||||||
install: $(BINDIR)/chartab $(BINDIR)/ctype-test
|
install: $(BINDIR)/chartab $(BINDIR)/ctype-test
|
||||||
|
|
||||||
include GNUmakerules
|
GNUmakevars: GNUmakevars.sh
|
||||||
|
sh ./$^ > $@
|
||||||
|
GNUmakerules: GNUmakerules.pl
|
||||||
|
perl ./$^ > $@
|
||||||
|
|
||||||
|
|
||||||
|
-include GNUmakerules
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
print "\$(BINDIR)/%: %\n";
|
||||||
|
print "\tinstall -m 755 \$^ \$@\n";
|
||||||
|
print "\$(MAN1DIR)/%: %\n";
|
||||||
|
print "\tinstall -m 644 \$^ \$@\n";
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
prefix=${prefix:-/usr/local}
|
||||||
|
echo "BINDIR=$prefix/bin"
|
||||||
|
echo
|
||||||
|
echo "all:"
|
|
@ -85,8 +85,8 @@ sub cleandir {
|
||||||
print STDERR "$0:", " " x $level, " cleandir $dir $since {\n";
|
print STDERR "$0:", " " x $level, " cleandir $dir $since {\n";
|
||||||
}
|
}
|
||||||
if (!opendir(DIR, ".")) {
|
if (!opendir(DIR, ".")) {
|
||||||
printf STDERR "$0:", " " x $level, " cannot opendir $dir: $!";
|
print STDERR "$0:", " " x $level, " cannot opendir $dir: $!\n";
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
my $std = lstat(".");
|
my $std = lstat(".");
|
||||||
my $fs = $std->dev;
|
my $fs = $std->dev;
|
||||||
|
|
14
dbi/dumpsql
14
dbi/dumpsql
|
@ -55,6 +55,7 @@ my $vertical; # use vertical output format
|
||||||
my $escape; # escape non-printable characters
|
my $escape; # escape non-printable characters
|
||||||
my $xhtml; # produce XHTML output
|
my $xhtml; # produce XHTML output
|
||||||
my $style; # produce XHTML output
|
my $style; # produce XHTML output
|
||||||
|
my $separator; # if set, produce CSV with this separator and double-quoted fields
|
||||||
|
|
||||||
GetOptions(
|
GetOptions(
|
||||||
'help|?' => \$help,
|
'help|?' => \$help,
|
||||||
|
@ -62,6 +63,7 @@ GetOptions(
|
||||||
'xhtml' => \$xhtml,
|
'xhtml' => \$xhtml,
|
||||||
'escape' => \$escape,
|
'escape' => \$escape,
|
||||||
'style:s' => \$style,
|
'style:s' => \$style,
|
||||||
|
'separator:s' => \$separator,
|
||||||
) || pod2usage(2);
|
) || pod2usage(2);
|
||||||
pod2usage(1) if $help;
|
pod2usage(1) if $help;
|
||||||
|
|
||||||
|
@ -163,6 +165,18 @@ if ($xhtml) {
|
||||||
}
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
} elsif ($separator) {
|
||||||
|
no warnings 'uninitialized';
|
||||||
|
print join($separator, @{$sth->{NAME}}), "\n";
|
||||||
|
while (my @a = $sth->fetchrow_array()) {
|
||||||
|
for (@a) {
|
||||||
|
if (/[$separator"]/) {
|
||||||
|
s/"/""/g;
|
||||||
|
s/.*/"$&"/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print join($separator, @a), "\n";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
no warnings 'uninitialized';
|
no warnings 'uninitialized';
|
||||||
print join("\t", @{$sth->{NAME}}), "\n";
|
print join("\t", @{$sth->{NAME}}), "\n";
|
||||||
|
|
|
@ -22,7 +22,7 @@ cfg/%:
|
||||||
|
|
||||||
gethostbyname: gethostbyname.o hstrerror.o
|
gethostbyname: gethostbyname.o hstrerror.o
|
||||||
|
|
||||||
fqdn: fqdn.o hstrerror.o
|
fqdn: fqdn.pl
|
||||||
|
|
||||||
hstrerror.o: cfg/have_hstrerror.h
|
hstrerror.o: cfg/have_hstrerror.h
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/perl
|
||||||
|
use v5.26;
|
||||||
|
|
||||||
|
sub fqdn {
|
||||||
|
my ($h) = @_;
|
||||||
|
|
||||||
|
if ($h =~ /\./) {
|
||||||
|
return $h;
|
||||||
|
}
|
||||||
|
open(my $fh, '-|', '/usr/bin/host', $h);
|
||||||
|
while (<$fh>) {
|
||||||
|
if (/^(\S+\.\S+) has address/) {
|
||||||
|
return $1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
say STDERR "$0: cannot determine FQDN of $h";
|
||||||
|
return "$h.invalid";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!@ARGV) {
|
||||||
|
$ARGV[0] = `/bin/hostname -f`;
|
||||||
|
chomp($ARGV[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for my $h (@ARGV) {
|
||||||
|
say fqdn($h);
|
||||||
|
}
|
|
@ -2,6 +2,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "hstrerror.h"
|
#include "hstrerror.h"
|
||||||
|
|
||||||
char *cmnd;
|
char *cmnd;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
for my $i (0 .. 255) {
|
for my $i (0 .. 255) {
|
||||||
print fg(0), bg(15), sprintf("%3d", $i), " : ", bg($i), "x" x 10, rst(), "\n";
|
print fg(0), bg(15), sprintf("%3d", $i), " : ", bg($i), "x" x 10, rst(), " ", fg($i), "x" x 10, rst(), "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue