zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: [PATCH] zerr*/zwarn* documentation
Date: Sat, 24 Jan 2015 15:36:16 +0000	[thread overview]
Message-ID: <20150124153616.GE20359@tarsus.local2> (raw)

[-- 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


             reply	other threads:[~2015-01-24 15:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-24 15:36 Daniel Shahaf [this message]
2015-01-25 18:10 ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150124153616.GE20359@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).