minc: read directory names from stdin

This matches `mlist` where it can take directories as arguments or via
stdin.

Closes: #244 [via git-merge-pr]
pull/245/head
Meudwy 10 months ago committed by Leah Neukirchen
parent 43f2cb8b49
commit 75de7d47da

@ -28,8 +28,8 @@ all: $(ALL) museragent
$(ALL) : % : %.o $(ALL) : % : %.o
maddr magrep mdeliver mexport mflag mflow mgenmid mhdr mpick mscan msed mshow \ maddr magrep mdeliver mexport mflag mflow mgenmid mhdr mpick mscan msed mshow \
msort mthread : blaze822.o mymemmem.o mytimegm.o msort mthread : blaze822.o mymemmem.o mytimegm.o
maddr magrep mdeliver mexport mflag mgenmid mhdr mlist mpick mscan msed mseq \ maddr magrep mdeliver mexport mflag mgenmid mhdr minc mlist mpick mscan msed \
mshow msort mthread : seq.o slurp.o mystrverscmp.o mseq mshow msort mthread : seq.o slurp.o mystrverscmp.o
maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o
magrep mflow mhdr mshow : rfc2045.o magrep mflow mhdr mshow : rfc2045.o
mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o

@ -17,6 +17,9 @@ by moving them from
to to
.Pa cur , .Pa cur ,
and adjusting the filenames. and adjusting the filenames.
If used non-interactively with no specified folders,
.Nm
reads directory names from the standard input.
.Pp .Pp
By default, the new filenames are printed, By default, the new filenames are printed,
separated by newlines. separated by newlines.

@ -74,14 +74,17 @@ usage:
exit(1); exit(1);
} }
if (optind == argc)
goto usage;
xpledge("stdio rpath cpath", ""); xpledge("stdio rpath cpath", "");
status = 0; status = 0;
for (i = optind; i < argc; i++) if (optind == argc) {
inc(argv[i]); if (isatty(0))
goto usage;
blaze822_loop(0, 0, inc);
} else {
for (i = optind; i < argc; i++)
inc(argv[i]);
}
return status; return status;
} }

@ -1,7 +1,7 @@
#!/bin/sh -e #!/bin/sh -e
cd ${0%/*} cd ${0%/*}
. ./lib.sh . ./lib.sh
plan 1 plan 2
rm -rf test.dir rm -rf test.dir
mkdir test.dir mkdir test.dir
@ -16,4 +16,10 @@ inbox/new/2
check_test 'minc' -eq 2 'minc inbox | wc -l' check_test 'minc' -eq 2 'minc inbox | wc -l'
while read f; do touch "$f"; done <<!
inbox/new/3:2,
inbox/new/4
!
check_test 'minc stdin' -eq 2 'echo inbox | minc | wc -l'
) )

Loading…
Cancel
Save