From: Mike Lowis Date: Wed, 5 Oct 2016 16:17:24 +0000 (-0400) Subject: Added support for loading buffer contents from stdin and added an xman script for... X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=b9a6c24575a8f151c98baf0bf6b46496e14c174c;p=projs%2Ftide.git Added support for loading buffer contents from stdin and added an xman script for piping man pages into the editor. This will be useful later on for jumping around man pages via plumbing --- diff --git a/buf.c b/buf.c index 466a031..b3c8fc2 100644 --- a/buf.c +++ b/buf.c @@ -10,7 +10,7 @@ int fpeekc(FILE* fin) { void buf_load(Buf* buf, char* path) { unsigned i = 0; - FILE* in = fopen(path, "rb"); + FILE* in = (!strcmp(path,"-") ? stdin : fopen(path, "rb")); while (EOF != fpeekc(in)) { size_t len = 0; Rune r = 0; diff --git a/xman b/xman new file mode 100755 index 0000000..ba060ba --- /dev/null +++ b/xman @@ -0,0 +1,2 @@ +#!/bin/sh +man -P cat "$@" | fmt | ./edit -