summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bltin/printf.c30
1 files changed, 8 insertions, 22 deletions
diff --git a/src/bltin/printf.c b/src/bltin/printf.c
index 4812e40..6f39526 100644
--- a/src/bltin/printf.c
+++ b/src/bltin/printf.c
@@ -272,8 +272,8 @@ conv_escape_str(char *str, char **sp)
 		if (ch != '\\')
 			continue;
 
-		ch = *str++;
-		if (ch == 'c') {
+		c = *str++;
+		if (c == 'c') {
 			/* \c as in SYSV echo - abort all processing.... */
 			c = ch = 0x100;
 			continue;
@@ -284,24 +284,11 @@ conv_escape_str(char *str, char **sp)
 		 * They start with a \0, and are followed by 0, 1, 2, 
 		 * or 3 octal digits. 
 		 */
-		if (ch == '0') {
-			unsigned char i;
-			i = 3;
-			c = 0;
-			do {
-				unsigned k = octtobin(*str);
-				if (k > 7)
-					break;
-				str++;
-				c <<= 3;
-				c += k;
-			} while (--i);
-			continue;
-		}
+		if (c == '0' && isodigit(*str))
+			str++;
 
 		/* Finally test for sequences valid in the format string */
 		str = conv_escape(str - 1, &c);
-		ch = c;
 	} while (STPUTC(c, cp), (char)ch);
 
 	*sp = cp;
@@ -322,12 +309,11 @@ conv_escape(char *str, int *conv_ch)
 
 	switch (ch) {
 	default:
-	case 0:
-		value = '\\';
-		goto out;
+		if (!isodigit(*str)) {
+			value = '\\';
+			goto out;
+		}
 
-	case '0': case '1': case '2': case '3':
-	case '4': case '5': case '6': case '7':
 		ch = 3;
 		value = 0;
 		do {
21-08-20 16:33:12 -0400'>2021-08-20Replace verbose colors with two types of arrowsJune McEnroe 2021-08-20Explicitly clear TLS secrets after handshakeJune McEnroe 2021-08-20Handle TLS_WANT_POLL{IN,OUT} from tls_handshake(3) with serverJune McEnroe 2021-08-20Use "secure" libtls ciphersJune McEnroe 2021-07-08Use seprintf to build final 005June McEnroe 2021-06-19Fix LDADD.crypt on DarwinJune McEnroe 2021-06-18Add -m mode option to set user modesJune McEnroe 2021-06-18Document channel keys in join optionJune McEnroe 2021-06-18Use | to separate flags from config optionsJune McEnroe 2021-06-18Stop referring to server-time as IRCv3.2June McEnroe 2021-06-17Add mailing list archive to READMEJune McEnroe 2021-06-10Stop accumulating ISUPPORT tokens once MOTD startsJune McEnroe 2021-06-09Use seprintf for snip, removing strlcpynJune McEnroe 2021-06-09Use seprintf for reserializeJune McEnroe 2021-06-09Use seprintf for capListJune McEnroe 2021-06-09Add seprintfJune McEnroe 2021-05-27Add pounce-notify to README 2.4June McEnroe 2021-05-27Fix ENVIRONMENT formatting in pounce-notify(1)June McEnroe 2021-05-27Add note about Libera.Chat SASL-only rangesJune McEnroe 2021-05-25Add QUIRKS fileJune McEnroe 2021-05-19Replace freenode with tilde.chatJune McEnroe 2021-05-04notify: Reword pounce-notify manualJune McEnroe 2021-05-02Clean up Makefiles, configure scriptsJune McEnroe 2021-04-30palaver: Exit on getopt failureJune McEnroe 2021-04-30notify: Implement pounce-notifyJune McEnroe