Article View: comp.text
Article #23most egregious modulus program
From: Larry Wall
Date: Fri, 23 Aug 1991 23:41
Date: Fri, 23 Aug 1991 23:41
26 lines
1263 bytes
1263 bytes
[Sorry 'bout all the crossposting, but there's no rec.nroff.abuse yet...]
The ;login: journal graciously printed my entry to the "Most Egregious
Misuse of Unix Utilities" contest. Unfortunately, the program suffered
a certain amount of bitrot during the publishing process, and several folks
have asked for the correct version. Here's the original (per)version,
for your viewing pleasure and/or nausea:
Task: modulus operator program
Implementation: use line wrapping and diversion in nroff
#!/bin/sh
nroff <<EOF | wc -w
'di xx
'll $2
'll +$2
`echo "10^$1" | bc | tr -d 1 | sed 's/0/0 /g'` \&
'di
EOF
(You invoke it with two numeric arguments. For example, if you say
"modulus 23 10", it prints out 3.)
Larry Wall
lwall@netlabs.com
Technical Details
Message-ID:
<1991Aug23.234156.21347@netlabs.com>Path:
arc1-ca.pugleaf.net!wupost!uunet!psinntp!netlabs!lwallShow Full Headers
Complete Article Headers
Newsgroups: comp.text,comp.org.usenix,comp.unix-wizards,alt.sources,comp.sources.bugs,comp.unix.misc,comp.unix.programmer,comp.unix.shell,talk.bizarre,alt.tasteless Path: arc1-ca.pugleaf.net!wupost!uunet!psinntp!netlabs!lwall From: lwall@netlabs.com (Larry Wall) Subject: most egregious modulus program Message-ID: <1991Aug23.234156.21347@netlabs.com> Sender: lwall@netlabs.com (Larry Wall) Organization: NetLabs, Inc. Date: Fri, 23 Aug 1991 23:41:56 GMT Lines: 26