cgmnlm

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/cgmnlm.git
Log | Files | Refs | README | LICENSE

commit b136eea98a33ffcaf2d965e907dd6799078d2110
parent c08e934c449c7a030fb1ebacd3166820b23faeb3
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 20 Sep 2020 14:44:30 -0400

Add man page

Diffstat:
MMakefile | 12++++++++++--
Mconfig.sh | 12++++++++++++
Adoc/gmnic.scd | 65+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 87 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile @@ -8,7 +8,9 @@ gmnic: $(gmnic_objects) @printf 'CCLD\t$@\n' @$(CC) $(LDFLAGS) $(LIBS) -o $@ $(gmnic_objects) -.SUFFIXES: .c .o +doc/gmnic.1: doc/gmnic.scd + +.SUFFIXES: .c .o .scd .1 .c.o: @printf 'CC\t$@\n' @@ -17,10 +19,16 @@ gmnic: $(gmnic_objects) $(CPP) $(CFLAGS) -MM -MT $@ $< >> $(OUTDIR)/cppcache @$(CC) -c $(CFLAGS) -o $@ $< +.scd.1: + @printf 'SCDOC\t$@\n' + @$(SCDOC) < $< > $@ + +docs: doc/gmnic.1 + clean: @rm -f gmnic distclean: clean @rm -rf "$(OUTDIR)" -.PHONY: clean distclean +.PHONY: clean distclean docs diff --git a/config.sh b/config.sh @@ -5,6 +5,7 @@ AS=${AS:-as} CC=${CC:-cc} CFLAGS=${CFLAGS:-} LD=${LD:-ld} +SCDOC=${SCDOC:-scdoc} for arg do @@ -104,9 +105,19 @@ run_configure() { find_library OpenSSL libssl find_library OpenSSL libcrypto + printf "Checking for scdoc... " + if scdoc -v >/dev/null 2>&1 + then + echo yes + all="$all docs" + else + echo no + fi + printf "Creating $outdir/config.mk... " cat <<-EOF > "$outdir"/config.mk CC=$CC + SCDOC=$SCDOC LIBS=$LIBS PREFIX=${PREFIX:-/usr/local} OUTDIR=${outdir} @@ -153,6 +164,7 @@ run_configure() { printf "Populating build dir... " populate "$srcdir/include" populate "$srcdir/src" + populate "$srcdir/doc" ln -sf "$srcdir"/Makefile ./ echo done } diff --git a/doc/gmnic.scd b/doc/gmnic.scd @@ -0,0 +1,65 @@ +gmnic(1) + +# NAME + +gmnic - Gemini client + +# SYNPOSIS + +*gmnic* [-46lLiIN] [-E _path_] [-d _input_] [-D _path_] _gemini://..._ + +# DESCRIPTION + +*gmnic* executes a gemini request and, if successful, prints the response body +to stdout. + +If an error is returned, information is printed to stderr and the process exits +with a non-zero exit status equal to the response status. If a response is +returned which is neither successful or an error, the response status and meta +text are printed to stderr. + +If the server requests user input, a prompt is shown and a second request is +performed with the user's input supplied to the server. + +# OPTIONS + +*-4* + Force the connection to use IPv4. + +*-6* + Force the connection to use IPv6. + +*-d* _input_ + If the server requests user input, a second request is performed with + the given input string as the user input. + +*-D* _path_ + If the server requests user input, _path_ is opened and read, and a + second request is performed with the contents of _path_ as the user + input. + +*-E* _path_[:_password_] + Sets the path to the client certificate to use (and optionally a + password). If the filename contains ":" but the certificate does not + accept a password, append ":" to the path and it will be intepreted as + an empty password. + +*-l* + For *text/\** responses, gmnic normally adds a line feed if stdout is a + TTY and the response body does not include one. This flag suppresses + this behavior. + +*-L* + Follow redirects. + +*-i* + Print the response status and meta text to stdout. + +*-I* + Print the response status and meta text to stdout, and suppress the + printing of the response body to stdout. + +*-N* + Suppress the input prompt if the server requests an input, and instead + print a diagnostic message and exit with a zero (successful) status + code.