fix percent printing
authorMazet Laurent <mazet@softndesign.org>
Wed, 4 Jan 2023 21:34:41 +0000 (22:34 +0100)
committerMazet Laurent <mazet@softndesign.org>
Wed, 4 Jan 2023 21:34:41 +0000 (22:34 +0100)
fdprintf.c
parser.c

index 17b847368ee41061498e1a85169a4e166f9453cf..46f27acb8f6b7a05032a4bd5d1038f90011b6061 100644 (file)
@@ -112,6 +112,9 @@ int fdprintf (int fd, const char *fmt, ...)
 
             /* process format char */
             switch (*fmt++) {
+            case '%': /* percent */
+                *str++ = '%';
+                break;
             case 'c': /* char */
                 c = (char) va_arg (ap, int);
                 *str++ = c;
index b7b74e230834129a77d98175ce20769930148c10..cd0d6bfe6b4e33be2d574408ffe8664405d18b53 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -367,7 +367,7 @@ void help (void)
 {
     PRINTOUT ("calc is a simple calculator\n\n");
     PRINTOUT ("supported operators:\n");
-    PRINTOUT (" + - * / % ^\n\n");
+    PRINTOUT (" + - * / %% ^\n\n");
     PRINTOUT ("supported functions:\n");
     PRINTOUT (" pow sqrt cos sin atan log exp\n\n");
     PRINTOUT ("miscellaneous functions:\n");