zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] zerr*/zwarn* documentation
@ 2015-01-24 15:36 Daniel Shahaf
  2015-01-25 18:10 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Shahaf @ 2015-01-24 15:36 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 109 bytes --]

Add API documentation for the internal zerr*/zwarn* functions.

(Maybe it exists somewhere and I missed it?)

[-- Attachment #2: 0001-zerrmsg-Document-format-codes.patch --]
[-- Type: text/x-patch, Size: 1317 bytes --]

>From 5bb0c2931e4c68ef593e4b4f4c57e5cf63301756 Mon Sep 17 00:00:00 2001
From: Daniel Shahaf <d.s@daniel.shahaf.name>
Date: Mon, 19 Jan 2015 03:50:51 +0000
Subject: [PATCH] zerrmsg: Document format codes

---
 Src/utils.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/Src/utils.c b/Src/utils.c
index cf18f12..e393a1e 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);
-- 
1.9.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] zerr*/zwarn* documentation
  2015-01-24 15:36 [PATCH] zerr*/zwarn* documentation Daniel Shahaf
@ 2015-01-25 18:10 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2015-01-25 18:10 UTC (permalink / raw)
  To: zsh-workers

On Sat, 24 Jan 2015 15:36:16 +0000
Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Add API documentation for the internal zerr*/zwarn* functions.
> 
> (Maybe it exists somewhere and I missed it?)

Don't think so; the only other place would be the development guide, but
the source is more useful.  Thanks.

pws


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-25 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-24 15:36 [PATCH] zerr*/zwarn* documentation Daniel Shahaf
2015-01-25 18:10 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).