about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2015-01-24 15:36:16 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-01-25 18:08:29 +0000
commitf7a2fba5342a3cf8c2590111a0a296acd8c8a211 (patch)
tree25b13183228df37398c8a214e6eb0f55bd1c691e
parentccd3663d4e9a1749450b35cc689359f78a310c04 (diff)
downloadzsh-f7a2fba5342a3cf8c2590111a0a296acd8c8a211.tar.gz
zsh-f7a2fba5342a3cf8c2590111a0a296acd8c8a211.tar.xz
zsh-f7a2fba5342a3cf8c2590111a0a296acd8c8a211.zip
34369: document error and warning codes
-rw-r--r--ChangeLog2
-rw-r--r--Src/utils.c16
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 427725564..5b3cbdf9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2015-01-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 34369: Daniel Shahaf: document error / warning codes.
+
 	* 34383: Src/utils.c: new ztrdup() shoud be dupstring().
 
 2015-01-25  Oliver Kiddle  <opk@zsh.org>
diff --git a/Src/utils.c b/Src/utils.c
index 0490df516..383042dec 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -112,7 +112,20 @@ set_widearray(char *mb_array, Widechar_array wca)
 #endif
 
 
-/* Print an error */
+/* Print an error
+
+   The following functions use the following printf-like format codes
+   (implemented by zerrmsg()):
+
+   Code	Argument types		Prints
+   %s	const char *		C string (null terminated)
+   %l	const char *, int	C string of given length (null not required)
+   %L	long			decimal value
+   %d	int			decimal value
+   %%	(none)			literal '%'
+   %c	int			character at that codepoint
+   %e	int			strerror() message (argument is typically 'errno')
+ */
 
 static void
 zwarning(const char *cmd, const char *fmt, va_list ap)
@@ -343,6 +356,7 @@ zerrmsg(FILE *file, const char *fmt, va_list ap)
 		    fputs(errmsg + 1, file);
 		}
 		break;
+	    /* When adding format codes, update the comment above zwarning(). */
 	    }
 	} else {
 	    putc(*fmt == Meta ? *++fmt ^ 32 : *fmt, file);