libutil/unescape.c: only print argv0 once on error
Signed-off-by: Mattias Andrée <maandree@kth.se>
This commit is contained in:
parent
2c424c078a
commit
9a903c63de
@ -35,7 +35,7 @@ unescape(char *s)
|
|||||||
(s[m] < 'a' && s[m] > 'f'))
|
(s[m] < 'a' && s[m] > 'f'))
|
||||||
break;
|
break;
|
||||||
if (m == i + 2)
|
if (m == i + 2)
|
||||||
eprintf("%s: invalid escape sequence '\\%c'\n", argv0, s[i + 1]);
|
eprintf("invalid escape sequence '\\%c'\n", s[i + 1]);
|
||||||
off += m - i - 1;
|
off += m - i - 1;
|
||||||
for (--m, q = 0, factor = 1; m > i + 1; m--) {
|
for (--m, q = 0, factor = 1; m > i + 1; m--) {
|
||||||
if (s[m] >= '0' && s[m] <= '9')
|
if (s[m] >= '0' && s[m] <= '9')
|
||||||
@ -49,14 +49,14 @@ unescape(char *s)
|
|||||||
s[i] = q;
|
s[i] = q;
|
||||||
break;
|
break;
|
||||||
case '\0':
|
case '\0':
|
||||||
eprintf("%s: null escape sequence\n", argv0);
|
eprintf("null escape sequence\n");
|
||||||
default:
|
default:
|
||||||
/* "\O[OOO]" octal escape */
|
/* "\O[OOO]" octal escape */
|
||||||
for (m = i + 1; m < i + 1 + 4 && m < len; m++)
|
for (m = i + 1; m < i + 1 + 4 && m < len; m++)
|
||||||
if (s[m] < '0' || s[m] > '7')
|
if (s[m] < '0' || s[m] > '7')
|
||||||
break;
|
break;
|
||||||
if (m == i + 1)
|
if (m == i + 1)
|
||||||
eprintf("%s: invalid escape sequence '\\%c'\n", argv0, s[i + 1]);
|
eprintf("invalid escape sequence '\\%c'\n", s[i + 1]);
|
||||||
off += m - i - 1;
|
off += m - i - 1;
|
||||||
for (--m, q = 0, factor = 1; m > i; m--) {
|
for (--m, q = 0, factor = 1; m > i; m--) {
|
||||||
q += (s[m] - '0') * factor;
|
q += (s[m] - '0') * factor;
|
||||||
|
Loading…
Reference in New Issue
Block a user