* Fwd: [9front-commits] ori: hg/plan9front: libc: tmparse should ignore leading whitespace
[not found] <hg.63e1749d5b5b.1598462594.4892889753185008284@code.9front.org>
@ 2020-08-26 18:47 ` Stanley Lieber
2020-08-26 19:41 ` [9front] " ori
0 siblings, 1 reply; 3+ messages in thread
From: Stanley Lieber @ 2020-08-26 18:47 UTC (permalink / raw)
To: 9front
it's still broken.
error+ from 's1.qery.ru!info' error+ to '1f300.com!info' alias `local!sl' error+ failed with error 'upas/fs: plan9: warning naked from [s1.qery.ru!info Wed Aug 26 14:34:53 EDT 2020 remote from ewsd error+ ] error+ grep: can't open /mail/fs/mbox/1/from: '/mail/fs/mbox/1' does not exist error+ grep: can't open /mail/fs/mbox/1/subject: '/mail/fs/mbox/1' does not exist error+ grep: can't open /mail/fs/mbox/1/replyto: '/mail/fs/mbox/1' does not exist error+ /mail/fs/mbox/1/raw: rc (pipeto): can't open: '/mail/fs/mbox/1' does not exist error+ '. error+
-------- Original Message --------
From: The Computer <commits@code.9front.org>
Sent: August 26, 2020 1:23:14 PM EDT
To: 9front-commits@9front.org
Subject: [9front-commits] ori: hg/plan9front: libc: tmparse should ignore leading whitespace
details: http://code.9front.org/hg/plan9front/rev/63e1749d5b5b
changeset: 7942:63e1749d5b5b
user: Ori Bernstein <ori@eigenstate.org>
date: Wed Aug 26 10:23:00 2020 -0700
description: libc: tmparse should ignore leading whitespace
We almost always want to skip leading whitespace in time
formats, so make tmparse just do it. This fixes upas mbox
parsing, which leaves a leading whitespace at the start of
the date.
diffstat:
sys/man/2/tmdate | 1 +
sys/src/libc/port/date.c | 16 +++++++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diffs (51 lines):
diff --git a/sys/man/2/tmdate b/sys/man/2/tmdate
--- a/sys/man/2/tmdate
+++ b/sys/man/2/tmdate
@@ -65,6 +65,7 @@ Tmstime is identical to tmtime, but acce
onds.
.PP
Tmparse parses a time from a string according to the format argument.
+Leading whitespace is ignored.
The point at which the parsing stopped is returned in
.IR ep .
If
diff --git a/sys/src/libc/port/date.c b/sys/src/libc/port/date.c
--- a/sys/src/libc/port/date.c
+++ b/sys/src/libc/port/date.c
@@ -632,6 +632,20 @@ tmparse(Tm *tm, char *fmt, char *str, Tz
sloppy = 1;
p++;
}
+
+ /* Skip whitespace */
+ for(;; p++) {
+ switch(*p) {
+ case ' ':
+ case '\t':
+ case '\n':
+ case '\f':
+ case '\r':
+ case '\v':
+ continue;
+ }
+ break;
+ }
while(*p){
w = 1;
c0 = *p++;
@@ -868,7 +882,6 @@ Zoneparsed:
case '_':
case ',':
case ' ':
-
if(*s != ' ' && *s != '\t' && *s != ',' && *s != '\n' && *s != '\0')
goto baddate;
p += strspn(p, " ,_\t\n");
@@ -884,6 +897,7 @@ Zoneparsed:
if(!ok)
goto baddate;
}
+
if(*p != '\0')
goto baddate;
if(ep != nil)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] Fwd: [9front-commits] ori: hg/plan9front: libc: tmparse should ignore leading whitespace
2020-08-26 18:47 ` Fwd: [9front-commits] ori: hg/plan9front: libc: tmparse should ignore leading whitespace Stanley Lieber
@ 2020-08-26 19:41 ` ori
2020-08-26 22:19 ` Stanley Lieber
0 siblings, 1 reply; 3+ messages in thread
From: ori @ 2020-08-26 19:41 UTC (permalink / raw)
To: 9front
> it's still broken.
>
Should be ok now.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9front] Fwd: [9front-commits] ori: hg/plan9front: libc: tmparse should ignore leading whitespace
2020-08-26 19:41 ` [9front] " ori
@ 2020-08-26 22:19 ` Stanley Lieber
0 siblings, 0 replies; 3+ messages in thread
From: Stanley Lieber @ 2020-08-26 22:19 UTC (permalink / raw)
To: 9front
On August 26, 2020 3:41:21 PM EDT, ori@eigenstate.org wrote:
>> it's still broken.
>>
>
>Should be ok now.
seems to be fixed now, thanks!
sl
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-26 22:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <hg.63e1749d5b5b.1598462594.4892889753185008284@code.9front.org>
2020-08-26 18:47 ` Fwd: [9front-commits] ori: hg/plan9front: libc: tmparse should ignore leading whitespace Stanley Lieber
2020-08-26 19:41 ` [9front] " ori
2020-08-26 22:19 ` Stanley Lieber
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).