Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
164833a5c1 | |||
959d46a8f7 |
2
Makefile
2
Makefile
@ -1,7 +1,7 @@
|
|||||||
prefix=$$HOME/opt/pkg/miscutils
|
prefix=$$HOME/opt/pkg/miscutils
|
||||||
target_bin=${prefix}/bin
|
target_bin=${prefix}/bin
|
||||||
target_man=${prefix}/share/man/man1
|
target_man=${prefix}/share/man/man1
|
||||||
bin=bwrap hppt mkgmap newp osc p rot rr scmfmt ts upcasetl unpage
|
bin=bwrap hppt mkgmap newp rot rr scmfmt ts upcasetl unpage
|
||||||
install:
|
install:
|
||||||
install -d ${target_bin} ${target_man}
|
install -d ${target_bin} ${target_man}
|
||||||
install -c ${bin} ${target_bin}
|
install -c ${bin} ${target_bin}
|
||||||
|
2
mkgmap.1
2
mkgmap.1
@ -8,7 +8,7 @@
|
|||||||
.Nm
|
.Nm
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
generates a simple Gophermap in its standard output,
|
Generates a simple Gophermap in its standard output,
|
||||||
listing all text files in the current directory
|
listing all text files in the current directory
|
||||||
in reverse alphabetical order.
|
in reverse alphabetical order.
|
||||||
.Pp
|
.Pp
|
||||||
|
2
newp.1
2
newp.1
@ -9,7 +9,7 @@
|
|||||||
.Ar word ...
|
.Ar word ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
creates a new ms phlog post.
|
Creates a new ms phlog post.
|
||||||
The file name will contain the current date and
|
The file name will contain the current date and
|
||||||
.Ar word ...
|
.Ar word ...
|
||||||
separated by dashes.
|
separated by dashes.
|
||||||
|
18
osc
18
osc
@ -1,18 +0,0 @@
|
|||||||
#!/usr/bin/env ksh
|
|
||||||
(( $# < 1 )) && exit 64
|
|
||||||
[[ -v X_OSC_DISABLE || ! -t 1 ]] && exit 0
|
|
||||||
case $1 in
|
|
||||||
link)
|
|
||||||
[[ -z $2 ]] && exit 64
|
|
||||||
printf "\e]8;%s\e\\" "$2"
|
|
||||||
;;
|
|
||||||
pwd)
|
|
||||||
(( $# != 1 )) && exit 64
|
|
||||||
printf "\e]7;file://%s%s\e\\" "$HOSTNAME" "$PWD"
|
|
||||||
;;
|
|
||||||
title)
|
|
||||||
(( $# == 1 )) && exit 64
|
|
||||||
shift;
|
|
||||||
printf '\e]2;%s\e\\' "$*"
|
|
||||||
;;
|
|
||||||
esac
|
|
43
osc.1
43
osc.1
@ -1,43 +0,0 @@
|
|||||||
.Dd Jun 11, 2024
|
|
||||||
.Dt TS 1
|
|
||||||
.Os
|
|
||||||
.Sh NAME
|
|
||||||
.Nm osc
|
|
||||||
.Nd Print OSC escape sequences
|
|
||||||
.Sh SYNOPSIS
|
|
||||||
.Nm
|
|
||||||
.Cm pwd
|
|
||||||
.Nm
|
|
||||||
.Cm link
|
|
||||||
.Ar URI
|
|
||||||
.Nm
|
|
||||||
.Cm title
|
|
||||||
.Ar word ...
|
|
||||||
.Sh DESCRIPTION
|
|
||||||
.Nm
|
|
||||||
prints an OSC escape sequence to stdout if connected to a tty.
|
|
||||||
If stdout is not a TTY, prints nothing.
|
|
||||||
.Pp
|
|
||||||
Three escape sequences are supported:
|
|
||||||
.Bl -tag
|
|
||||||
.It pwd
|
|
||||||
ESC 7, set current working directory.
|
|
||||||
.It link
|
|
||||||
ESC 8, display an URI.
|
|
||||||
.It title
|
|
||||||
ESC 2, set a title for the current window.
|
|
||||||
.El
|
|
||||||
.Pp
|
|
||||||
Whatever it is done with these escape sequences depends on the
|
|
||||||
terminal emulator. To avoid printing anything, even on ttys, define
|
|
||||||
.Ev X_OSC_DISABLE
|
|
||||||
with any value.
|
|
||||||
.Sh ENVIRONMENT
|
|
||||||
.Bl -tag -width X_OSC_DISABLE
|
|
||||||
.It Ev X_OSC_DISABLE
|
|
||||||
Don't do anything.
|
|
||||||
.El
|
|
||||||
.Sh EXIT STATUS
|
|
||||||
.Ex -std
|
|
||||||
.Sh AUTHORS
|
|
||||||
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
|
49
p
49
p
@ -1,49 +0,0 @@
|
|||||||
#!/usr/bin/env perl
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
my $pagesize = $ENV{'LINES'} || 22;
|
|
||||||
|
|
||||||
open(my $tty, '<', '/dev/tty')
|
|
||||||
or die "$0: Cannot open /dev/tty for reading: $!";
|
|
||||||
|
|
||||||
sub evalcmd {
|
|
||||||
{
|
|
||||||
chomp($_ = <$tty>);
|
|
||||||
if (/^q$/) {
|
|
||||||
exit(0);
|
|
||||||
} elsif (/^!(.*)/) {
|
|
||||||
system($1);
|
|
||||||
redo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub printfile {
|
|
||||||
my ($fh) = @_;
|
|
||||||
my $lines = 0;
|
|
||||||
while (<$fh>) {
|
|
||||||
print;
|
|
||||||
&evalcmd unless ++$lines % $pagesize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unshift(@ARGV, '-') unless @ARGV;
|
|
||||||
|
|
||||||
my $n = $#ARGV;
|
|
||||||
for (@ARGV) {
|
|
||||||
if (/^-$/) {
|
|
||||||
&printfile(\*STDIN);
|
|
||||||
&evalcmd if $n--;
|
|
||||||
} elsif (/^-(\d+)$/) {
|
|
||||||
$pagesize = $1;
|
|
||||||
} else {
|
|
||||||
open(my $fh, '<', $_) or die "$0: Cannot open $_ for reading: $!";
|
|
||||||
&printfile($fh);
|
|
||||||
&evalcmd if $n--;
|
|
||||||
close($fh);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
close($tty);
|
|
48
p.1
48
p.1
@ -1,48 +0,0 @@
|
|||||||
.Dd May 17, 2024
|
|
||||||
.Dt TS 1
|
|
||||||
.Os
|
|
||||||
.Sh NAME
|
|
||||||
.Nm p
|
|
||||||
.Nd Paginate
|
|
||||||
.Sh SYNOPSIS
|
|
||||||
.Nm
|
|
||||||
.Op Fl number
|
|
||||||
.Ar
|
|
||||||
.Sh DESCRIPTION
|
|
||||||
.Nm
|
|
||||||
copies its standard input, or the named files if given,
|
|
||||||
to its standard output,
|
|
||||||
stopping at the end of every page and at the end of each file.
|
|
||||||
The special file name
|
|
||||||
.Pa -
|
|
||||||
can be used to refer explicitly to the standard input.
|
|
||||||
.Pp
|
|
||||||
Page size is defined by the
|
|
||||||
.Ev LINES
|
|
||||||
environment variable.
|
|
||||||
If not defined, a default page size of 22 will be used.
|
|
||||||
The page size can be overriden with the numeric option.
|
|
||||||
.Pp
|
|
||||||
While waiting for a newline,
|
|
||||||
.Nm
|
|
||||||
interprets the commands:
|
|
||||||
.Bl -tag
|
|
||||||
.It !
|
|
||||||
Run the rest of the line as a shell command.
|
|
||||||
.It q
|
|
||||||
Quit.
|
|
||||||
.El
|
|
||||||
Any other input will show the next input page.
|
|
||||||
.Sh ENVIRONMENT
|
|
||||||
.Bl -tag -width LINES
|
|
||||||
.It Ev LINES
|
|
||||||
Number of lines of the terminal.
|
|
||||||
.El
|
|
||||||
.Sh EXIT STATUS
|
|
||||||
.Ex -std
|
|
||||||
.Sh HISTORY
|
|
||||||
This is a reimplementation of Plan 9's
|
|
||||||
.Nm
|
|
||||||
pager.
|
|
||||||
.Sh AUTHORS
|
|
||||||
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
|
35
pick
35
pick
@ -1,35 +0,0 @@
|
|||||||
#!/usr/bin/env perl
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
use Scalar::Util qw{looks_like_number};
|
|
||||||
|
|
||||||
my @choices;
|
|
||||||
|
|
||||||
for (@ARGV) {
|
|
||||||
if (/^--$/) {
|
|
||||||
push(@choices, <STDIN>);
|
|
||||||
} elsif (/^@(.+)$/) {
|
|
||||||
open(my $fh, '<', $1);
|
|
||||||
push(@choices, <$fh>);
|
|
||||||
close($fh);
|
|
||||||
} else {
|
|
||||||
push(@choices, "$_\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open(my $tty, '<', '/dev/tty');
|
|
||||||
|
|
||||||
my $sel;
|
|
||||||
until (looks_like_number($sel) && $sel > 0 && $sel <= @choices) {
|
|
||||||
while (my ($i, $c) = each @choices) {
|
|
||||||
print $i+1 . ') ' . $choices[$i];
|
|
||||||
}
|
|
||||||
print $ENV{'PS3'} || '#? ';
|
|
||||||
exit(1) unless defined($sel = <$tty>);
|
|
||||||
}
|
|
||||||
|
|
||||||
close($tty);
|
|
||||||
|
|
||||||
print $choices[$sel - 1];
|
|
25
pick.1
25
pick.1
@ -1,25 +0,0 @@
|
|||||||
.Dd Sep 13, 2023
|
|
||||||
.Dt TS 1
|
|
||||||
.Os
|
|
||||||
.Sh NAME
|
|
||||||
.Nm pick
|
|
||||||
.Nd Choose interactively from the set of arguments and input lines
|
|
||||||
.Sh SYNOPSIS
|
|
||||||
.Nm
|
|
||||||
.Ar arg ...
|
|
||||||
.Sh DESCRIPTION
|
|
||||||
.Nm
|
|
||||||
will display a Korn shell style selection menu with stdin contents and
|
|
||||||
arguments as options.
|
|
||||||
.Pp
|
|
||||||
When a selection is made, the command will print its value to stdout.
|
|
||||||
If the selection is aborted, nothing will be printed.
|
|
||||||
.Sh ENVIRONMENT
|
|
||||||
.Bl -tag -width PS3
|
|
||||||
.It Ev PS3
|
|
||||||
Prompt string displayed to the user (default: #?).
|
|
||||||
.El
|
|
||||||
.Sh EXIT STATUS
|
|
||||||
.Ex -std
|
|
||||||
.Sh AUTHORS
|
|
||||||
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
|
2
rr
2
rr
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
[ $# -eq 0 ] && echo "usage: $0 command ..." && exit 64
|
[ $# -eq 1 ] && echo "usage: $0 command ..." && exit 64
|
||||||
tmp1=$(mktemp $0.XXXXXXXXXX)
|
tmp1=$(mktemp $0.XXXXXXXXXX)
|
||||||
tmp2=$(mktemp $0.XXXXXXXXXX)
|
tmp2=$(mktemp $0.XXXXXXXXXX)
|
||||||
trap "rm $tmp1 $tmp2; exit 0" 1 2 15
|
trap "rm $tmp1 $tmp2; exit 0" 1 2 15
|
||||||
|
4
scmfmt
4
scmfmt
@ -21,9 +21,9 @@ i\
|
|||||||
|
|
||||||
bl' |
|
bl' |
|
||||||
sed -e '1s/^/./' -e 's/^ /./' |
|
sed -e '1s/^/./' -e 's/^ /./' |
|
||||||
par -P=. |
|
fmt -p |
|
||||||
awk '
|
awk '
|
||||||
BEGIN { LIMIT = 72 }
|
BEGIN { LIMIT = 65 }
|
||||||
NR == 1 || /^[^\.]/ || length($0) < LIMIT {
|
NR == 1 || /^[^\.]/ || length($0) < LIMIT {
|
||||||
sub(/^\./, NR == 1 ? "" : " ");
|
sub(/^\./, NR == 1 ? "" : " ");
|
||||||
print;
|
print;
|
||||||
|
2
ts.1
2
ts.1
@ -10,7 +10,7 @@
|
|||||||
.Ar test ...
|
.Ar test ...
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
runs the shell tests passed as arguments.
|
Runs the shell tests passed as arguments.
|
||||||
If the
|
If the
|
||||||
.Fl b
|
.Fl b
|
||||||
flag is specified, the test is blessed \(em i.e. it is evaluated and the test
|
flag is specified, the test is blessed \(em i.e. it is evaluated and the test
|
||||||
|
2
unpage.1
2
unpage.1
@ -8,7 +8,7 @@
|
|||||||
.Nm
|
.Nm
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
removes all page headers and footers from stdin,
|
Removes all page headers and footers from stdin,
|
||||||
getting as result output that contains a single continuous page.
|
getting as result output that contains a single continuous page.
|
||||||
.Pp
|
.Pp
|
||||||
This command expects its input to be the result of processing an ms document
|
This command expects its input to be the result of processing an ms document
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
.Nm
|
.Nm
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
.Nm
|
.Nm
|
||||||
takes an ms troff document in stdin,
|
Takes an ms troff document in stdin,
|
||||||
and outputs to its stdout the same document
|
and outputs to its stdout the same document
|
||||||
with all
|
with all
|
||||||
.Qq .TL
|
.Qq .TL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user