Github messages for mblaze
 help / color / mirror / Atom feed
* [PR PATCH] seq: fix printing multiple mmsgs
@ 2020-08-11 12:00 jeremybobbin
  2020-08-11 12:01 ` [PR PATCH] [Updated] " jeremybobbin
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jeremybobbin @ 2020-08-11 12:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 446 bytes --]

There is a new pull request by jeremybobbin against master on the mblaze repository

https://github.com/jeremybobbin/mblaze master
https://github.com/leahneukirchen/mblaze/pull/181

seq: fix printing multiple mmsgs
According to `mseq(1)`, `mseq` should accept multiple *msgs*.

```
printf 'a\nb\n' | mseq -S
mseq 1 2
```

The above prints:
```
a
```

A patch file from https://github.com/leahneukirchen/mblaze/pull/181.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-181.patch --]
[-- Type: text/x-diff, Size: 1243 bytes --]

From f2db792d8384b8fc9c2e070ef2dc5bfaf8a36f3a Mon Sep 17 00:00:00 2001
From: Jeremy Bobbin <jer@jer.cx>
Date: Tue, 11 Aug 2020 04:50:51 -0700
Subject: [PATCH] seq: fix printing multiple mmsgs

printf 'a\nb\n' | mseq -S
mseq 1 2
---
 seq.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/seq.c b/seq.c
index 5d98284..58f3d17 100644
--- a/seq.c
+++ b/seq.c
@@ -427,17 +427,18 @@ blaze822_seq_next(char *map, char *range, struct blaze822_seq_iter *iter)
 	if (!iter->lines)  // count total lines
 		find_cur(map, iter);
 
-	if (!iter->s) {
-		int ret = parse_range(map, range, &iter->start, &iter->stop,
-		    iter->cur, iter->lines);
-		if (ret == 1) {
-			fprintf(stderr, "can't parse range: %s\n", range);
-			return 0;
-		} else if (ret == 2) {
-			fprintf(stderr, "message not found for specified range: %s\n", range);
-			return 0;
-		}
+	int ret = parse_range(map, range, &iter->start, &iter->stop,
+	    iter->cur, iter->lines);
 
+	if (ret == 1) {
+		fprintf(stderr, "can't parse range: %s\n", range);
+		return 0;
+	} else if (ret == 2) {
+		fprintf(stderr, "message not found for specified range: %s\n", range);
+		return 0;
+	}
+
+	if (!iter->s) {
 		iter->s = map;
 		iter->line = 1;
 	}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] seq: fix printing multiple mmsgs
  2020-08-11 12:00 [PR PATCH] seq: fix printing multiple mmsgs jeremybobbin
@ 2020-08-11 12:01 ` jeremybobbin
  2020-08-11 12:23 ` Duncaen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jeremybobbin @ 2020-08-11 12:01 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

There is an updated pull request by jeremybobbin against master on the mblaze repository

https://github.com/jeremybobbin/mblaze master
https://github.com/leahneukirchen/mblaze/pull/181

seq: fix printing multiple mmsgs
According to `mseq(1)`, `mseq` should accept multiple *msgs*.

```
printf 'a\nb\n' | mseq -S
mseq 1 2
```

The above prints:
```
a
```

A patch file from https://github.com/leahneukirchen/mblaze/pull/181.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-181.patch --]
[-- Type: text/x-diff, Size: 1242 bytes --]

From baa5d4c3077a313e3b77392972774ad835ccc559 Mon Sep 17 00:00:00 2001
From: Jeremy Bobbin <jer@jer.cx>
Date: Tue, 11 Aug 2020 04:50:51 -0700
Subject: [PATCH] seq: fix printing multiple msgs

printf 'a\nb\n' | mseq -S
mseq 1 2
---
 seq.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/seq.c b/seq.c
index 5d98284..58f3d17 100644
--- a/seq.c
+++ b/seq.c
@@ -427,17 +427,18 @@ blaze822_seq_next(char *map, char *range, struct blaze822_seq_iter *iter)
 	if (!iter->lines)  // count total lines
 		find_cur(map, iter);
 
-	if (!iter->s) {
-		int ret = parse_range(map, range, &iter->start, &iter->stop,
-		    iter->cur, iter->lines);
-		if (ret == 1) {
-			fprintf(stderr, "can't parse range: %s\n", range);
-			return 0;
-		} else if (ret == 2) {
-			fprintf(stderr, "message not found for specified range: %s\n", range);
-			return 0;
-		}
+	int ret = parse_range(map, range, &iter->start, &iter->stop,
+	    iter->cur, iter->lines);
 
+	if (ret == 1) {
+		fprintf(stderr, "can't parse range: %s\n", range);
+		return 0;
+	} else if (ret == 2) {
+		fprintf(stderr, "message not found for specified range: %s\n", range);
+		return 0;
+	}
+
+	if (!iter->s) {
 		iter->s = map;
 		iter->line = 1;
 	}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: seq: fix printing multiple mmsgs
  2020-08-11 12:00 [PR PATCH] seq: fix printing multiple mmsgs jeremybobbin
  2020-08-11 12:01 ` [PR PATCH] [Updated] " jeremybobbin
@ 2020-08-11 12:23 ` Duncaen
  2020-08-11 12:32 ` [PR PATCH] [Updated] " jeremybobbin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Duncaen @ 2020-08-11 12:23 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

New comment by Duncaen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/181#issuecomment-671913910

Comment:
Maybe also add the following test case to your PR:

http://ix.io/2tSu

```patch
From 9c88276bd5b42f7c233f8ded07b5d5db54006349 Mon Sep 17 00:00:00 2001
From: Duncan Overbruck <mail@duncano.de>
Date: Tue, 11 Aug 2020 14:21:07 +0200
Subject: [PATCH] t/7000-mseq.t: add test case for multiple mmsg arguments

---
 t/7000-mseq.t | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/t/7000-mseq.t b/t/7000-mseq.t
index 4afa561..5566252 100644
--- a/t/7000-mseq.t
+++ b/t/7000-mseq.t
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 cd ${0%/*}
 . ./lib.sh
-plan 10
+plan 11
 
 rm -rf test.dir
 mkdir test.dir
@@ -31,6 +31,7 @@ check_test 'whole thread' -eq 4 'mseq 6= | wc -l'
 check_test  'subthread' -eq 2 'mseq 7_ | wc -l'
 check 'parent' 'mseq 6^ | grep "inbox/cur/5_1:2,"'
 check_test 'range' -eq 3 'mseq 1:3 | wc -l'
+check_same 'multiple mmsg' 'mseq 1 2' 'echo "inbox/cur/1:2,\ninbox/cur/2:2,"'
 
 cat <<! >seq
 inbox/cur/1:2,
-- 
2.27.0

```

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] seq: fix printing multiple mmsgs
  2020-08-11 12:00 [PR PATCH] seq: fix printing multiple mmsgs jeremybobbin
  2020-08-11 12:01 ` [PR PATCH] [Updated] " jeremybobbin
  2020-08-11 12:23 ` Duncaen
@ 2020-08-11 12:32 ` jeremybobbin
  2020-08-11 12:35 ` jeremybobbin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jeremybobbin @ 2020-08-11 12:32 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

There is an updated pull request by jeremybobbin against master on the mblaze repository

https://github.com/jeremybobbin/mblaze master
https://github.com/leahneukirchen/mblaze/pull/181

seq: fix printing multiple mmsgs
According to `mseq(1)`, `mseq` should accept multiple *msgs*.

```
printf 'a\nb\n' | mseq -S
mseq 1 2
```

The above prints:
```
a
```

A patch file from https://github.com/leahneukirchen/mblaze/pull/181.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-181.patch --]
[-- Type: text/x-diff, Size: 1872 bytes --]

From 28957142509ceff91e492bde12cf345719155e00 Mon Sep 17 00:00:00 2001
From: Jeremy Bobbin <jer@jer.cx>
Date: Tue, 11 Aug 2020 04:50:51 -0700
Subject: [PATCH] seq: fix printing multiple msgs

printf 'a\nb\n' | mseq -S
mseq 1 2

Co-authored-by: Duncan Overbruck <mail@duncano.de>
---
 seq.c         | 21 +++++++++++----------
 t/7000-mseq.t |  3 ++-
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/seq.c b/seq.c
index 5d98284..58f3d17 100644
--- a/seq.c
+++ b/seq.c
@@ -427,17 +427,18 @@ blaze822_seq_next(char *map, char *range, struct blaze822_seq_iter *iter)
 	if (!iter->lines)  // count total lines
 		find_cur(map, iter);
 
-	if (!iter->s) {
-		int ret = parse_range(map, range, &iter->start, &iter->stop,
-		    iter->cur, iter->lines);
-		if (ret == 1) {
-			fprintf(stderr, "can't parse range: %s\n", range);
-			return 0;
-		} else if (ret == 2) {
-			fprintf(stderr, "message not found for specified range: %s\n", range);
-			return 0;
-		}
+	int ret = parse_range(map, range, &iter->start, &iter->stop,
+	    iter->cur, iter->lines);
 
+	if (ret == 1) {
+		fprintf(stderr, "can't parse range: %s\n", range);
+		return 0;
+	} else if (ret == 2) {
+		fprintf(stderr, "message not found for specified range: %s\n", range);
+		return 0;
+	}
+
+	if (!iter->s) {
 		iter->s = map;
 		iter->line = 1;
 	}
diff --git a/t/7000-mseq.t b/t/7000-mseq.t
index 4afa561..5566252 100644
--- a/t/7000-mseq.t
+++ b/t/7000-mseq.t
@@ -1,7 +1,7 @@
 #!/bin/sh -e
 cd ${0%/*}
 . ./lib.sh
-plan 10
+plan 11
 
 rm -rf test.dir
 mkdir test.dir
@@ -31,6 +31,7 @@ check_test 'whole thread' -eq 4 'mseq 6= | wc -l'
 check_test  'subthread' -eq 2 'mseq 7_ | wc -l'
 check 'parent' 'mseq 6^ | grep "inbox/cur/5_1:2,"'
 check_test 'range' -eq 3 'mseq 1:3 | wc -l'
+check_same 'multiple mmsg' 'mseq 1 2' 'echo "inbox/cur/1:2,\ninbox/cur/2:2,"'
 
 cat <<! >seq
 inbox/cur/1:2,

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: seq: fix printing multiple mmsgs
  2020-08-11 12:00 [PR PATCH] seq: fix printing multiple mmsgs jeremybobbin
                   ` (2 preceding siblings ...)
  2020-08-11 12:32 ` [PR PATCH] [Updated] " jeremybobbin
@ 2020-08-11 12:35 ` jeremybobbin
  2020-08-11 12:41 ` [PR PATCH] [Closed]: " leahneukirchen
  2020-08-11 12:41 ` leahneukirchen
  5 siblings, 0 replies; 7+ messages in thread
From: jeremybobbin @ 2020-08-11 12:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 155 bytes --]

New comment by jeremybobbin on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/181#issuecomment-671919752

Comment:
Thank you, @Duncaen !

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Closed]: seq: fix printing multiple mmsgs
  2020-08-11 12:00 [PR PATCH] seq: fix printing multiple mmsgs jeremybobbin
                   ` (3 preceding siblings ...)
  2020-08-11 12:35 ` jeremybobbin
@ 2020-08-11 12:41 ` leahneukirchen
  2020-08-11 12:41 ` leahneukirchen
  5 siblings, 0 replies; 7+ messages in thread
From: leahneukirchen @ 2020-08-11 12:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

There's a closed pull request on the mblaze repository

seq: fix printing multiple mmsgs
https://github.com/leahneukirchen/mblaze/pull/181

Description:
According to `mseq(1)`, `mseq` should accept multiple *msgs*.

```
printf 'a\nb\n' | mseq -S
mseq 1 2
```

The above prints:
```
a
```

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: seq: fix printing multiple mmsgs
  2020-08-11 12:00 [PR PATCH] seq: fix printing multiple mmsgs jeremybobbin
                   ` (4 preceding siblings ...)
  2020-08-11 12:41 ` [PR PATCH] [Closed]: " leahneukirchen
@ 2020-08-11 12:41 ` leahneukirchen
  5 siblings, 0 replies; 7+ messages in thread
From: leahneukirchen @ 2020-08-11 12:41 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 193 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/pull/181#issuecomment-671922608

Comment:
You found a bug, but I fixed it at the call site. Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-08-11 12:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-11 12:00 [PR PATCH] seq: fix printing multiple mmsgs jeremybobbin
2020-08-11 12:01 ` [PR PATCH] [Updated] " jeremybobbin
2020-08-11 12:23 ` Duncaen
2020-08-11 12:32 ` [PR PATCH] [Updated] " jeremybobbin
2020-08-11 12:35 ` jeremybobbin
2020-08-11 12:41 ` [PR PATCH] [Closed]: " leahneukirchen
2020-08-11 12:41 ` leahneukirchen

Github messages for mblaze

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.vuxu.org/mblaze-github

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 mblaze-github mblaze-github/ http://inbox.vuxu.org/mblaze-github \
		mblaze-github@inbox.vuxu.org
	public-inbox-index mblaze-github

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.github.mblaze


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git