* [PR PATCH] minc: read directory names from stdin
@ 2023-07-25 12:43 meudwy
2023-07-25 12:56 ` leahneukirchen
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: meudwy @ 2023-07-25 12:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
There is a new pull request by meudwy against master on the mblaze repository
https://github.com/meudwy/mblaze minc-stdin
https://github.com/leahneukirchen/mblaze/pull/244
minc: read directory names from stdin
This matches `mlist` where it can take directories as arguments or via stdin.
A patch file from https://github.com/leahneukirchen/mblaze/pull/244.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-minc-stdin-244.patch --]
[-- Type: text/x-diff, Size: 2330 bytes --]
From 01132292c8a35f820712c6e9aebdb21d30248d84 Mon Sep 17 00:00:00 2001
From: Meudwy <meudwy@meudwy.uk>
Date: Tue, 25 Jul 2023 11:55:26 +0100
Subject: [PATCH] minc: read directory names from stdin
This matches `mlist` where it can take directories as arguments or via
stdin.
---
GNUmakefile | 4 ++--
man/minc.1 | 3 +++
minc.c | 13 ++++++++-----
t/9000-minc.t | 6 ++++++
4 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index c90e9383..89cb7794 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -28,8 +28,8 @@ all: $(ALL) museragent
$(ALL) : % : %.o
maddr magrep mdeliver mexport mflag mflow mgenmid mhdr mpick mscan msed mshow \
msort mthread : blaze822.o mymemmem.o mytimegm.o
-maddr magrep mdeliver mexport mflag mgenmid mhdr mlist mpick mscan msed mseq \
- mshow msort mthread : seq.o slurp.o mystrverscmp.o
+maddr magrep mdeliver mexport mflag mgenmid mhdr minc mlist mpick mscan msed \
+ mseq mshow msort mthread : seq.o slurp.o mystrverscmp.o
maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o
magrep mflow mhdr mshow : rfc2045.o
mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o
diff --git a/man/minc.1 b/man/minc.1
index cb71c859..6b7f96c5 100644
--- a/man/minc.1
+++ b/man/minc.1
@@ -17,6 +17,9 @@ by moving them from
to
.Pa cur ,
and adjusting the filenames.
+If used non-interactively with no specified folders,
+.Nm
+reads directory names from the standard input.
.Pp
By default, the new filenames are printed,
separated by newlines.
diff --git a/minc.c b/minc.c
index c1d28fd2..2811646a 100644
--- a/minc.c
+++ b/minc.c
@@ -74,14 +74,17 @@ main(int argc, char *argv[])
exit(1);
}
- if (optind == argc)
- goto usage;
-
xpledge("stdio rpath cpath", "");
status = 0;
- for (i = optind; i < argc; i++)
- inc(argv[i]);
+ if (optind == argc) {
+ if (isatty(0))
+ goto usage;
+ blaze822_loop(0, 0, inc);
+ } else {
+ for (i = optind; i < argc; i++)
+ inc(argv[i]);
+ }
return status;
}
diff --git a/t/9000-minc.t b/t/9000-minc.t
index 3d5b7894..3f6de27e 100644
--- a/t/9000-minc.t
+++ b/t/9000-minc.t
@@ -16,4 +16,10 @@ inbox/new/2
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'
)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: minc: read directory names from stdin
2023-07-25 12:43 [PR PATCH] minc: read directory names from stdin meudwy
@ 2023-07-25 12:56 ` leahneukirchen
2023-07-25 13:43 ` [PR PATCH] [Updated] " meudwy
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2023-07-25 12:56 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 216 bytes --]
New comment by leahneukirchen on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/244#issuecomment-1649790296
Comment:
> Parse errors: Bad plan. You planned 1 tests but ran 2.
Else looks good!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Updated] minc: read directory names from stdin
2023-07-25 12:43 [PR PATCH] minc: read directory names from stdin meudwy
2023-07-25 12:56 ` leahneukirchen
@ 2023-07-25 13:43 ` meudwy
2023-07-25 13:45 ` meudwy
2023-07-25 14:08 ` [PR PATCH] [Closed]: " leahneukirchen
3 siblings, 0 replies; 5+ messages in thread
From: meudwy @ 2023-07-25 13:43 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 381 bytes --]
There is an updated pull request by meudwy against master on the mblaze repository
https://github.com/meudwy/mblaze minc-stdin
https://github.com/leahneukirchen/mblaze/pull/244
minc: read directory names from stdin
This matches `mlist` where it can take directories as arguments or via stdin.
A patch file from https://github.com/leahneukirchen/mblaze/pull/244.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-minc-stdin-244.patch --]
[-- Type: text/x-diff, Size: 2437 bytes --]
From f5fcae1460a4ae159b6220fe9e83101c4e7a38ad Mon Sep 17 00:00:00 2001
From: Meudwy <meudwy@meudwy.uk>
Date: Tue, 25 Jul 2023 11:55:26 +0100
Subject: [PATCH] minc: read directory names from stdin
This matches `mlist` where it can take directories as arguments or via
stdin.
---
GNUmakefile | 4 ++--
man/minc.1 | 3 +++
minc.c | 13 ++++++++-----
t/9000-minc.t | 8 +++++++-
4 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/GNUmakefile b/GNUmakefile
index c90e9383..89cb7794 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -28,8 +28,8 @@ all: $(ALL) museragent
$(ALL) : % : %.o
maddr magrep mdeliver mexport mflag mflow mgenmid mhdr mpick mscan msed mshow \
msort mthread : blaze822.o mymemmem.o mytimegm.o
-maddr magrep mdeliver mexport mflag mgenmid mhdr mlist mpick mscan msed mseq \
- mshow msort mthread : seq.o slurp.o mystrverscmp.o
+maddr magrep mdeliver mexport mflag mgenmid mhdr minc mlist mpick mscan msed \
+ mseq mshow msort mthread : seq.o slurp.o mystrverscmp.o
maddr magrep mflow mhdr mpick mscan mshow : rfc2047.o
magrep mflow mhdr mshow : rfc2045.o
mshow : filter.o safe_u8putstr.o rfc2231.o pipeto.o
diff --git a/man/minc.1 b/man/minc.1
index cb71c859..6b7f96c5 100644
--- a/man/minc.1
+++ b/man/minc.1
@@ -17,6 +17,9 @@ by moving them from
to
.Pa cur ,
and adjusting the filenames.
+If used non-interactively with no specified folders,
+.Nm
+reads directory names from the standard input.
.Pp
By default, the new filenames are printed,
separated by newlines.
diff --git a/minc.c b/minc.c
index c1d28fd2..2811646a 100644
--- a/minc.c
+++ b/minc.c
@@ -74,14 +74,17 @@ main(int argc, char *argv[])
exit(1);
}
- if (optind == argc)
- goto usage;
-
xpledge("stdio rpath cpath", "");
status = 0;
- for (i = optind; i < argc; i++)
- inc(argv[i]);
+ if (optind == argc) {
+ if (isatty(0))
+ goto usage;
+ blaze822_loop(0, 0, inc);
+ } else {
+ for (i = optind; i < argc; i++)
+ inc(argv[i]);
+ }
return status;
}
diff --git a/t/9000-minc.t b/t/9000-minc.t
index 3d5b7894..9b291943 100644
--- a/t/9000-minc.t
+++ b/t/9000-minc.t
@@ -1,7 +1,7 @@
#!/bin/sh -e
cd ${0%/*}
. ./lib.sh
-plan 1
+plan 2
rm -rf test.dir
mkdir test.dir
@@ -16,4 +16,10 @@ inbox/new/2
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'
)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: minc: read directory names from stdin
2023-07-25 12:43 [PR PATCH] minc: read directory names from stdin meudwy
2023-07-25 12:56 ` leahneukirchen
2023-07-25 13:43 ` [PR PATCH] [Updated] " meudwy
@ 2023-07-25 13:45 ` meudwy
2023-07-25 14:08 ` [PR PATCH] [Closed]: " leahneukirchen
3 siblings, 0 replies; 5+ messages in thread
From: meudwy @ 2023-07-25 13:45 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 157 bytes --]
New comment by meudwy on mblaze repository
https://github.com/leahneukirchen/mblaze/pull/244#issuecomment-1649877321
Comment:
Fixed. Well spotted :smile:
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PR PATCH] [Closed]: minc: read directory names from stdin
2023-07-25 12:43 [PR PATCH] minc: read directory names from stdin meudwy
` (2 preceding siblings ...)
2023-07-25 13:45 ` meudwy
@ 2023-07-25 14:08 ` leahneukirchen
3 siblings, 0 replies; 5+ messages in thread
From: leahneukirchen @ 2023-07-25 14:08 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 236 bytes --]
There's a closed pull request on the mblaze repository
minc: read directory names from stdin
https://github.com/leahneukirchen/mblaze/pull/244
Description:
This matches `mlist` where it can take directories as arguments or via stdin.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-25 14:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-25 12:43 [PR PATCH] minc: read directory names from stdin meudwy
2023-07-25 12:56 ` leahneukirchen
2023-07-25 13:43 ` [PR PATCH] [Updated] " meudwy
2023-07-25 13:45 ` meudwy
2023-07-25 14:08 ` [PR PATCH] [Closed]: " leahneukirchen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).