From b9a6c24575a8f151c98baf0bf6b46496e14c174c Mon Sep 17 00:00:00 2001 From: Mike Lowis Date: Wed, 5 Oct 2016 12:17:24 -0400 Subject: [PATCH] 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 --- buf.c | 2 +- xman | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100755 xman 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 - -- 2.49.0