Initial commit
This commit is contained in:
commit
710062d6e1
24
LICENSE
Normal file
24
LICENSE
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
This is free and unencumbered software released into the public domain.
|
||||||
|
|
||||||
|
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||||
|
distribute this software, either in source code form or as a compiled
|
||||||
|
binary, for any purpose, commercial or non-commercial, and by any
|
||||||
|
means.
|
||||||
|
|
||||||
|
In jurisdictions that recognize copyright laws, the author or authors
|
||||||
|
of this software dedicate any and all copyright interest in the
|
||||||
|
software to the public domain. We make this dedication for the benefit
|
||||||
|
of the public at large and to the detriment of our heirs and
|
||||||
|
successors. We intend this dedication to be an overt act of
|
||||||
|
relinquishment in perpetuity of all present and future rights to this
|
||||||
|
software under copyright law.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
For more information, please refer to <http://unlicense.org/>
|
8
Makefile
Normal file
8
Makefile
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
prefix=$$HOME/opt/pkg/miscutils
|
||||||
|
target_bin=${prefix}/bin
|
||||||
|
target_man=${prefix}/share/man/man1
|
||||||
|
bin=bwrap hppt mkgmap newp rot scmfmt upcasetl unpage
|
||||||
|
install:
|
||||||
|
install -d ${target_bin} ${target_man}
|
||||||
|
install -c ${bin} ${target_bin}
|
||||||
|
install -c ${bin:%=%.1} ${target_man}
|
15
bwrap
Executable file
15
bwrap
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/awk -f
|
||||||
|
BEGIN { LINELEN = 64 }
|
||||||
|
{
|
||||||
|
s[++i] = $0;
|
||||||
|
n = length($0);
|
||||||
|
maxlen = n > maxlen ? n : maxlen;
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
for (i = 1; i <= maxlen; i += LINELEN)
|
||||||
|
for (j = 1; j <= NR; j++) {
|
||||||
|
pref = i == 1 ? "" : ":";
|
||||||
|
suff = maxlen - i <= LINELEN ? "" : ":";
|
||||||
|
print pref substr(s[j], i, LINELEN) suff;
|
||||||
|
}
|
||||||
|
}
|
45
bwrap.1
Normal file
45
bwrap.1
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
.Dd April 15, 2022
|
||||||
|
.Dt BWRAP 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm bwrap
|
||||||
|
.Nd Wrap input text as a unit
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
Wrap text received in stdin as if it was a single line.
|
||||||
|
Indicate breaks with the \(dq:\(dq charater at both ends.
|
||||||
|
.Pp
|
||||||
|
.Nm
|
||||||
|
will take the input text as a block,
|
||||||
|
wrapping the whole thing as a unit.
|
||||||
|
For normal text this is silly,
|
||||||
|
but it is useful to make ASCII art look alright in terminals that are not wide enough.
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
|
.Sh EXAMPLES
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
$ fortune | hppt | bwrap
|
||||||
|
---------------------------------------------------------------:
|
||||||
|
|o ooo o ooo o o o o oo o ooo o oo o o oo ooo o ooo :
|
||||||
|
| o o o o oo oo o o o o oo oooo o :
|
||||||
|
| o o ooooo o oooooo o oooo o oo oo o ooo oo :
|
||||||
|
|...............................................................:
|
||||||
|
|oo o o ooo ooo o o ooo o o o oo o :
|
||||||
|
| o oo o o o o o o ooo o o:
|
||||||
|
| oo oooooooo oooooooooooooooooooooooooooooooooooooooooooooooooo:
|
||||||
|
|oo ooooooo oooooooooo oo oo ooooooo oo ooooo o ooooooooo oooo:
|
||||||
|
---------------------------------------------------------------:
|
||||||
|
:------------------------------------
|
||||||
|
:o o oo o o oo oo o o o |
|
||||||
|
:oo o o oo o o o o oo oo|
|
||||||
|
:oo o o ooo oooo o ooooo o |
|
||||||
|
:....................................|
|
||||||
|
:oo o oo o oo oo o o ooo|
|
||||||
|
: o o o o o o o o o |
|
||||||
|
:ooooooo ooooooooooooooooooooooooooo |
|
||||||
|
:oo oooo oo oooo ooo oooo oo oooooo |
|
||||||
|
:------------------------------------
|
||||||
|
.Ed
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
12
hppt
Executable file
12
hppt
Executable file
@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
/usr/games/ppt |
|
||||||
|
rot |
|
||||||
|
sed '
|
||||||
|
1ba
|
||||||
|
$ba
|
||||||
|
/^_ *_ *$/d
|
||||||
|
s/_/|/g
|
||||||
|
b
|
||||||
|
:a
|
||||||
|
s/_/ /g
|
||||||
|
s/|/-/g'
|
31
hppt.1
Normal file
31
hppt.1
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
.Dd April 14, 2022
|
||||||
|
.Dt HPPT 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm hppt
|
||||||
|
.Nd Reformat stdin as a horizontal paper tape
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
Reformat stdin as a horizontal paper tape.
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
|
.Sh EXAMPLES
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
$ echo 'Hello, world!' | hppt
|
||||||
|
--------------
|
||||||
|
| o o oo o |
|
||||||
|
| o ooo o|
|
||||||
|
| ooooo oo oo |
|
||||||
|
|..............|
|
||||||
|
|o oooo o o o|
|
||||||
|
| o o |
|
||||||
|
| oooooooooooo |
|
||||||
|
|ooooo ooooo |
|
||||||
|
--------------
|
||||||
|
.Ed
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr bcd 6 ,
|
||||||
|
.Xr ppt 6
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
15
mkgmap
Executable file
15
mkgmap
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
[ -f $HOME/.mkgmap.head ] && cat $HOME/.mkgmap.head
|
||||||
|
for i in $(ls -r *.txt)
|
||||||
|
do
|
||||||
|
date=$(echo $i | sed 's/\(....\)\(..\)\(..\).*/[\1.\2.\3]/')
|
||||||
|
name=$(
|
||||||
|
sed -n -e '
|
||||||
|
/[^ ]/ {
|
||||||
|
s/^[ ]*//
|
||||||
|
p
|
||||||
|
q
|
||||||
|
}
|
||||||
|
b' $i)
|
||||||
|
printf "0%s %s\t%s\n" "$date" "$name" "$i"
|
||||||
|
done
|
54
mkgmap.1
Normal file
54
mkgmap.1
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
.Dd May 29, 2022
|
||||||
|
.Dt MKGMAP 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm mkgmap
|
||||||
|
.Nd Create a simple Gophermap for the current directory
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
generates a simple Gophermap in its standard output,
|
||||||
|
listing all text files in the current directory
|
||||||
|
in reverse alphabetical order.
|
||||||
|
.Pp
|
||||||
|
File names are assumed to follow the format
|
||||||
|
.Pa "" Ns Ar date Ns - Ns Ar word Ns -...- Ns Ar word Ns .txt,
|
||||||
|
where
|
||||||
|
.Ar date
|
||||||
|
is a sequence of six digits
|
||||||
|
\(em 4 for the year, 2 for the month and 2 for the day \(em
|
||||||
|
and
|
||||||
|
.Ar word
|
||||||
|
is a sequence of alphanumerical characters.
|
||||||
|
For example:
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
20220512-this-is-an-example.txt.
|
||||||
|
.Ed
|
||||||
|
.Pp
|
||||||
|
Each Gophermap entry displays the date and the title of the file.
|
||||||
|
The date is extracted from the file name
|
||||||
|
and displayed as \(dq[yyyy.mm.dd]\(dq.
|
||||||
|
The first non empty line of the file is used as the title.
|
||||||
|
.Pp
|
||||||
|
If the file
|
||||||
|
.Pa ~/.mkgmap.head
|
||||||
|
exists, it will be included at the top of the Gophermap as a header.
|
||||||
|
.Sh FILES
|
||||||
|
.Pa ~/.mkgmap.head
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
|
.Sh EXAMPLES
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
$ cat ~/.mkgmap.head # no file / empty
|
||||||
|
$ ls *.txt
|
||||||
|
20220601-sample.txt
|
||||||
|
$ mkgmap
|
||||||
|
0[2022.06.01] The first line in the file 20220601-sample.txt
|
||||||
|
$ echo 'Header!' > ~/.mkgmap.head
|
||||||
|
$ mkgmap
|
||||||
|
Header!
|
||||||
|
0[2022.06.01] The first line in the file 20220601-sample.txt
|
||||||
|
.Ed
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
11
rot
Executable file
11
rot
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/awk -f
|
||||||
|
{
|
||||||
|
m = split($0, a, "");
|
||||||
|
n = m > n ? m : n;
|
||||||
|
for (i = 1; i <= n; i++)
|
||||||
|
s[i] = s[i]a[i];
|
||||||
|
}
|
||||||
|
END {
|
||||||
|
for (i = n; i > 0; i--)
|
||||||
|
print s[i];
|
||||||
|
}
|
25
rot.1
Normal file
25
rot.1
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
.Dd April 14, 2022
|
||||||
|
.Dt ROT 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm rot
|
||||||
|
.Nd Rotate stdin 90 degrees
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
Visually rotate stdin 90 degrees counter clockwise,
|
||||||
|
swapping rows and columns.
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
|
.Sh EXAMPLES
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
$ printf 'Aa\\nBb\\nCc\\n'
|
||||||
|
Aa
|
||||||
|
Bb
|
||||||
|
Cc
|
||||||
|
$ printf 'Aa\\nBb\\nCc\\n' | rot
|
||||||
|
abc
|
||||||
|
ABC
|
||||||
|
.Ed
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
37
scmfmt
Executable file
37
scmfmt
Executable file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
expand |
|
||||||
|
sed -n '
|
||||||
|
/./!d
|
||||||
|
p
|
||||||
|
i\
|
||||||
|
|
||||||
|
:l
|
||||||
|
n
|
||||||
|
p
|
||||||
|
bl' |
|
||||||
|
sed -n '
|
||||||
|
:l
|
||||||
|
p
|
||||||
|
n
|
||||||
|
/./bl
|
||||||
|
:b
|
||||||
|
n
|
||||||
|
/./!bb
|
||||||
|
i\
|
||||||
|
|
||||||
|
bl' |
|
||||||
|
sed -e '1s/^/./' -e 's/^ /./' |
|
||||||
|
fmt -p |
|
||||||
|
awk '
|
||||||
|
BEGIN { LIMIT = 65 }
|
||||||
|
NR == 1 || /^[^\.]/ || length($0) < LIMIT {
|
||||||
|
sub(/^\./, NR == 1 ? "" : " ");
|
||||||
|
print;
|
||||||
|
}
|
||||||
|
/^\./ && length($0) >= LIMIT {
|
||||||
|
sub(/^\./, " ");
|
||||||
|
print substr($0, 1, LIMIT)"\\";
|
||||||
|
for (i = 2*LIMIT - length($0) + 1; i; i--)
|
||||||
|
printf " ";
|
||||||
|
print substr($0, LIMIT+1);
|
||||||
|
}'
|
39
scmfmt.1
Normal file
39
scmfmt.1
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
.Dd April 14, 2022
|
||||||
|
.Dt SCMFMT 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm scmfmt
|
||||||
|
.Nd Format a commit message
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
Format stdin to use as a commit message.
|
||||||
|
.Pp
|
||||||
|
.Nm
|
||||||
|
will apply the following formatting rules to the input text:
|
||||||
|
.Bl -bullet
|
||||||
|
.It
|
||||||
|
All leading blank lines will be removed.
|
||||||
|
Afterwards, any sequence of blanklines will be reduced to a single blank line.
|
||||||
|
.It
|
||||||
|
The first non blank line will be interpreted as the title.
|
||||||
|
This line will be taken as is; no wrapping nor filling will be done.
|
||||||
|
A blank line will be inserted after the title if one doesn't exist.
|
||||||
|
.It
|
||||||
|
If a line is prefixed with tabs or spaces
|
||||||
|
it will be treated as literal code
|
||||||
|
These lines will not be filled; instead, a soft wrap will be
|
||||||
|
simulated, terminating the line with a backslash and
|
||||||
|
right justifying the rest.
|
||||||
|
.It
|
||||||
|
Lines not starting with tabs or spaces will be treated as regular text.
|
||||||
|
A sequence of these lines will be filled as a single paragraph.
|
||||||
|
Breaks will only occur at blanks.
|
||||||
|
.El
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
|
.Sh SEE ALSO
|
||||||
|
.Xr fmt 1 ,
|
||||||
|
.Xr par 1
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
13
unpage
Executable file
13
unpage
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/awk -f
|
||||||
|
BEGIN { HDLEN = 9; FTLEN = 3 }
|
||||||
|
NR < HDLEN - 1 { next }
|
||||||
|
/^$/ { nl++; next}
|
||||||
|
/^./ {
|
||||||
|
if (nl == HDLEN)
|
||||||
|
for (i = 0; i < FTLEN; i++)
|
||||||
|
getline;
|
||||||
|
else
|
||||||
|
while (nl--) print "";
|
||||||
|
nl = 0;
|
||||||
|
}
|
||||||
|
{ print }
|
20
unpage.1
Normal file
20
unpage.1
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
.Dd May 31, 2022
|
||||||
|
.Dt UNPAGE 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm unpage
|
||||||
|
.Nd Remove page headers and footers from text documents
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
removes all page headers and footers from stdin,
|
||||||
|
getting as result output that contains a single continuous page.
|
||||||
|
.Pp
|
||||||
|
This command expects its input to be the result of processing an ms document
|
||||||
|
with the default settings.
|
||||||
|
It will probably not work as expected if the input was created by other means.
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
3
upcasetl
Executable file
3
upcasetl
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/awk -f
|
||||||
|
/^\.(TL|SH)/ { print; getline; print toupper($0); next }
|
||||||
|
{ print }
|
42
upcasetl.1
Normal file
42
upcasetl.1
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
.Dd Jun 22, 2022
|
||||||
|
.Dt UPCASETL 1
|
||||||
|
.Os
|
||||||
|
.Sh NAME
|
||||||
|
.Nm upcasetl
|
||||||
|
.Nd Upcase titles and section headers in an ms troff document
|
||||||
|
.Sh SYNOPSIS
|
||||||
|
.Nm
|
||||||
|
.Sh DESCRIPTION
|
||||||
|
.Nm
|
||||||
|
takes an ms troff document in stdin,
|
||||||
|
and outputs to its stdout the same document
|
||||||
|
with all
|
||||||
|
.Qq .TL
|
||||||
|
and
|
||||||
|
.Qq .SH
|
||||||
|
content converted to uppercase.
|
||||||
|
.Sh EXIT STATUS
|
||||||
|
.Ex -std
|
||||||
|
.Sh EXAMPLES
|
||||||
|
.Bd -literal -offset indent
|
||||||
|
$ cat sample.ms
|
||||||
|
\&.TL
|
||||||
|
This is a sample
|
||||||
|
\&.AU
|
||||||
|
Me
|
||||||
|
\&.SH
|
||||||
|
A section header
|
||||||
|
\&.PP
|
||||||
|
Fin
|
||||||
|
$ upcasetl <sample.ms
|
||||||
|
\&.TL
|
||||||
|
THIS IS A SAMPLE
|
||||||
|
\&.AU
|
||||||
|
Me
|
||||||
|
\&.SH
|
||||||
|
A SECTION HEADER
|
||||||
|
\&.PP
|
||||||
|
Fin
|
||||||
|
.Ed
|
||||||
|
.Sh AUTHORS
|
||||||
|
.An Adolfo Perez Alvarez Aq Mt adolfopa@sdf.org
|
Loading…
Reference in New Issue
Block a user