From 3426da02e60f33114ff0b3eac8680ab5bb3cdd93 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 2 Sep 2015 20:05:34 -0500 Subject: If you start a git commit and then edit the file more on the filesystem before saving, the updates don't go in the commit. Behavior difference between git and mercurial, that. Good to know. --- toys/lsb/seq.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'toys') diff --git a/toys/lsb/seq.c b/toys/lsb/seq.c index 8e7d2783..62f42557 100644 --- a/toys/lsb/seq.c +++ b/toys/lsb/seq.c @@ -36,17 +36,18 @@ static void insanitize(char *f) int found = 0; for (s = f; *s; s++) { - while (*s != '%') continue; + if (*s != '%') continue; if (*++s == '%') continue; if (found++) break; - while (strchr("'#-+ ", *s)) s++; + while (0 <= stridx("'#-+ ", *s)) s++; while (isdigit(*s)) s++; if (*s == '.') s++; while (isdigit(*s)) s++; - if (!strchr("aAeEfFgG", *s)) break; + if (-1 == stridx("aAeEfFgG", *s)) break; } + // The @ is a byte offset, not utf8 chars. Waiting for somebody to complain... - if (*s) error_exit("bad -f '%s@'%d"); + if (*s) error_exit("bad -f '%s'@%d", f, s-f+1); } void seq_main(void) -- cgit v1.2.3