2 ms·
I am stupid, too. I generally do not use git(1). I wrote a short script to download the manual as a single 639K text file. I do not use a GUI or mouse so thi
by 1vuio0pswjnm7 4y ago
I am stupid, too. I generally do not use git(1). I wrote a short script to download the manual as a single 639K text file. I do not use a GUI or mouse so this makes it easier for me to work with code snippets. I also reformat the text to match personal preferences. Here is an example script using popular curl program to make the HTTP requests.
# requirements: curl, links, perl, texinfo (Linux), texi2html (BSD)
#!/bin/sh
set -v;
x0=c-intro-and-ref.git;
x1=https://git.savannah.nongnu.org/cgit/;
test -d $x0||mkdir $x0;cd $x0||exit;
for x2 in Makefile c.texi cpp.texi fdl.texi fp.texi texinfo.tex;do
echo url=$x1$x0/plain/$x2;
echo output=$x2;
echo user-agent=\"\";
done|curl -K/dev/stdin -s;
case $(uname) in :)
;;*BSD) texi2html --no-headers --no-split --html c.texi
;;Linux) makeinfo --no-headers --no-split --html c.texi
esac;
# personal preference for ~15-inch screen: 4 space indent, 60-70 max chars per line
links -width 70 -dump .html \
|sed '/^ *Link:/d;/^ *\*/s/\*//;s/^/ /;/Jump to: /{N;N;d;}' > c.txt;
exec less c.txt;
- tolciho 4y agoprintf 'the form\n' \ | tr a-z A-Z golfs to printf 'the form\n' | tr a-z A-Z but that only saves like one or two keystrokes but is probably good to know for shell trivia questions or when implementing something that supposedly can handle shell continuation lines
- 1vuio0pswjnm7 4y agodjb used this style when shell scripting and I believe that is where I picked it up.^1 I have not seen (m)any HN commenters publishing their work for public scrutiny who are more skilled in programming, including C, than djb. Other programmers, good ones, but not a large number, copied his C style. 1. An extreme example https://raw.githubusercontent.com/drudru/qhasm/master/qhasm-amd64 https://raw.githubusercontent.com/drudru/qhasm/master/qhasm-...