diff options
| author | tgoodwin <tgoodwin> | 1998-10-30 16:07:02 +0000 |
|---|---|---|
| committer | Toby Goodwin <toby@paccrat.org> | 2015-05-16 21:23:13 +0100 |
| commit | a1f1ee9b27d08644061bc440b779f99c3e9362f0 (patch) | |
| tree | c97701925be98cde60f189a45bc224fa2e903a79 | |
| parent | c1959b3d914f52bf0c00523e360aece68d9076d3 (diff) | |
Portability: rename basename() to rc_basename(), since the former is
quite widespread, and has a variety of different definitions (none of
them, of course, static).
Portability: work around i386 GCC 2.7.2.3 optimization bug triggered
by a (really quite simple) expression in history.c.
| -rw-r--r-- | history.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -56,7 +56,7 @@ static char *newstr() { return ealloc((size_t)1024); } -static char *basename(const char *s) { +static char *rc_basename(char *s) { char *t = strrchr(s, '/'); return (t == NULL) ? s : t + 1; } @@ -175,7 +175,8 @@ start: continue; /* skip incrementing s */ case '\t': for (;; col++) { - if ((*f++ = s<end? *s++ : '\t') == '\t') { + *f = s<end? *s++ : '\t'; + if (*f++ == '\t') { col = col | 07; /* advance to before next tabstop */ } if ((col&07) == 07) /* stop before tabstop */ @@ -268,12 +269,13 @@ int main(int argc, char **argv) { int i; char *s; - s = progname = basename(argv[0]); + s = progname = rc_basename(argv[0]); me = *s++; if (*s == me) { s++; editit = TRUE; } +editit = TRUE; if (*s == 'p') { s++; printit = TRUE; @@ -329,7 +331,7 @@ next: s = getcommand(); fprintf(stderr, "%s\n", s); if (shell == NULL) shell = "/bin/sh"; - execl(shell, basename(shell), "-c", s, NULL); + execl(shell, rc_basename(shell), "-c", s, NULL); perror(shell); exit(1); } |