++ eflag = 0;
+ #endif
+- ap++;
+ }
++ else break;
++ ap++;
+ }
+ while ((p = *ap++) != NULL) {
+ while ((c = *p++) != '\0') {
+ if (c == '\\' && eflag) {
+- switch (*p++) {
++ switch (c = *p++) {
++ case 'a': c = '\007'; break;
+ case 'b': c = '\b'; break;
+ case 'c': return 0; /* exit */
+ case 'f': c = '\f'; break;
+@@ -85,11 +95,13 @@
+ case 't': c = '\t'; break;
+ case 'v': c = '\v'; break;
+ case '\\': break; /* c = '\\' */
+- case '0':
+- c = 0;
+- count = 3;
+- while (--count >= 0 && (unsigned)(*p - '0') < 8)
+- c = (c << 3) + (*p++ - '0');
++ case '0': case '1': case '2': case '3':
++ case '4': case '5': case '6': case '7':
++ c -= '0';
++ if (*p >= '0' && *p <= '7')
++ c = c * 8 + (*p++ - '0');
++ if (*p >= '0' && *p <= '7')
++ c = c * 8 + (*p++ - '0');
+ break;
+ default:
+ p--;
+@@ -103,5 +115,12 @@
+ }
+ if (! nflag)
+ putchar('\n');
++#ifdef _GNU_SOURCE
++ fflush(stdout);
++ if (ferror(stdout)) {
++ clearerr(stdout);
++ return 1;
++ }