aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-09-02 20:05:34 -0500
committerRob Landley <rob@landley.net>2015-09-02 20:05:34 -0500
commit3426da02e60f33114ff0b3eac8680ab5bb3cdd93 (patch)
tree7b4bbd31a643942094ffa6ecd87a6f05997e8b61
parent6ff12f703214bee5cb92ba0c851969dffc6c29cd (diff)
downloadtoybox-3426da02e60f33114ff0b3eac8680ab5bb3cdd93.tar.gz
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.
-rw-r--r--toys/lsb/seq.c9
1 files changed, 5 insertions, 4 deletions
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)