aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-22 11:26:23 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-22 11:30:09 +0200
commit46345060aa9414aad838acad2af11176fa094891 (patch)
tree38d9e86cb16102fd1b04aa34be3d959546c99076
parent94f90dc4f48ee7f6bc1aa3a1116f20b714df89c9 (diff)
downloadwhen-46345060aa9414aad838acad2af11176fa094891.tar.gz
Rename to when
This is to resolve the name conflict with another program called watch, which is for watching command output.
-rw-r--r--Makefile12
-rw-r--r--when.1 (renamed from watch.1)23
-rw-r--r--when.c (renamed from watch.c)0
3 files changed, 17 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index 1770934..5a07973 100644
--- a/Makefile
+++ b/Makefile
@@ -2,12 +2,12 @@ BINDIR = /usr/local/bin
MANDIR = /usr/local/man
CFLAGS = -Wall -Wextra -pedantic -O2
-all: watch
+all: when
-install: watch
- cp watch $(BINDIR)/watch
- cp watch.1 $(MANDIR)/man1/watch.1
+install: when
+ cp when $(BINDIR)/when
+ cp when.1 $(MANDIR)/man1/when.1
uninstall:
- rm $(BINDIR)/watch
- rm $(MANDIR)/man1/watch.1
+ rm $(BINDIR)/when
+ rm $(MANDIR)/man1/when.1
diff --git a/watch.1 b/when.1
index a609547..2362bf2 100644
--- a/watch.1
+++ b/when.1
@@ -1,23 +1,23 @@
.Dd $Mdocdate$
-.Dt WATCH 1
+.Dt WHEN 1
.Os
.Sh NAME
-.Nm watch
+.Nm when
.Nd a simple file watcher
.
.Sh SYNPOSIS
-.Nm watch
+.Nm when
.Op Fl i
.Ar file ...
.
.Sh DESCRIPTION
.Pp
-.Nm watch
+.Nm when
is a simple program that watches any given
.Ar file
for changes.
When the file changes, its name (as specified in the arguments to
-.Nm watch )
+.Nm when )
is printed on standard output.
.Pp
If the
@@ -32,20 +32,19 @@ error and the program exits with error code 1.
.Pp
If a file is renamed, a notice is printed on standard error, but the
program keeps running.
-.\"
+.
.Sh EXAMPLES
.Bd -literal -offset indent
-$ watch *.ms | while read file; do
- make ${file%.ms}.pdf && kill -9 mupdf
-done
+when * | xargs -I% cp % /mnt/usb/
.Ed
.Bd -literal -offset indent
-$ alias each='xargs -L0 -I {}'
-$ watch -i * | each cp {} /mnt/usb/
+when -i *.ms | while read f; do
+ make "${f%.ms}".pdf && kill -HUP mupdf
+done
.Ed
.
.Sh AUTHORS
.Pp
-.Nm watch
+.Nm when
is written by
.An John Ankarström Aq Mt "john (at) ankarstrom.se" .
diff --git a/watch.c b/when.c
index 12cfbee..12cfbee 100644
--- a/watch.c
+++ b/when.c