Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Enable sub-second timeout in zsystem flock

On Sun, 2020-03-15 at 16:54 +0000, Daniel Shahaf wrote:
> > 
> > Done, but it had to be as a string, because I didn't see a way to use
> > a zlong in zwarnnam().
> That doesn't seem to be supported.  It could be added, if needed.

Seems obvious enough maybe we should just add it?  A single use of it
would justify adding it for the extra clarity alone.

Not (yet) tested as not (yet) used.


diff --git a/Src/utils.c b/Src/utils.c
index f9c2d4a2b..73d27dc94 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -130,6 +130,7 @@ set_widearray(char *mb_array, Widechar_array wca)
    %l	const char *, int	C string of given length (null not required)
    %L	long			decimal value
    %d	int			decimal value
+   %z	zlong			decimal value
    %%	(none)			literal '%'
    %c	int			character at that codepoint
    %e	int			strerror() message (argument is typically 'errno')
@@ -331,6 +332,14 @@ zerrmsg(FILE *file, const char *fmt, va_list ap)
 		num = va_arg(ap, int);
 		fprintf(file, "%d", num);
+	    case 'z':
+	    {
+		zlong znum = va_arg(ap, zlong);
+		char buf[DIGBUFSIZE];
+		convbase(buf, znum, 10);
+		fputs(buf, file);
+		break;
+	    }
 	    case '%':
 		putc('%', file);

Messages sorted by: Reverse Date, Date, Thread, Author