Displaying 20 results from an estimated 1624 matches for "fmt".
2014 Sep 20
2
vsnprintf_s and vsnprintf
lvqcl wrote:
> I wrote a small program that fills a buffer[] with "abcdefghijklmnopqrstuvwxyz\0"
> pattern and then tries to write "0123456789" string into it.
> It calls either
> ret = vsnprintf_s(buffer, buf_size, _TRUNCATE, fmt, va);
> or
> ret = vsnprintf(buffer, buf_size, fmt, va);
<snip>
> vsnprintf (MSVC, MinGW):
>
> buf_size = 8; ret = -1; buffer = "01234567ijklmnopqrstuvwxyz"
> buf_size = 9; ret = -1; buffer = "012345678jklmnopqrstuvwxyz&qu...
2019 Jan 25
0
[klibc:update-dash] builtin: Reject malformed printf specifications with digits after '*'
....c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/usr/dash/bltin/printf.c b/usr/dash/bltin/printf.c
index d4ae794d..78bf388a 100644
--- a/usr/dash/bltin/printf.c
+++ b/usr/dash/bltin/printf.c
@@ -177,17 +177,24 @@ pc:
/* skip to field width */
fmt += strspn(fmt, SKIP1);
- if (*fmt == '*')
- *param++ = getuintmax(1);
-
- /* skip to possible '.', get following precision */
- fmt += strspn(fmt, SKIP2);
- if (*fmt == '.')
+ if (*fmt == '*') {
++fmt;
- if (*fmt == '*')
*param++ = ge...
2020 Mar 28
0
[klibc:update-dash] dash: builtin: Reject malformed printf specifications with digits after '*'
....c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/usr/dash/bltin/printf.c b/usr/dash/bltin/printf.c
index d4ae794d..78bf388a 100644
--- a/usr/dash/bltin/printf.c
+++ b/usr/dash/bltin/printf.c
@@ -177,17 +177,24 @@ pc:
/* skip to field width */
fmt += strspn(fmt, SKIP1);
- if (*fmt == '*')
- *param++ = getuintmax(1);
-
- /* skip to possible '.', get following precision */
- fmt += strspn(fmt, SKIP2);
- if (*fmt == '.')
+ if (*fmt == '*') {
++fmt;
- if (*fmt == '*')
*param++ = ge...
2014 Sep 20
0
vsnprintf_s and vsnprintf
...code, this function can made to behave resonably sensibly, even it
> its not possible to make it meet the requirements if the ISO C specs.
>
> I'm basically think of something like the (untested) diff below.
>
> @@ -62,8 +62,11 @@ flac_snprintf(char *str, size_t size, const char *fmt, ...)
> va_start (va, fmt);
> #ifdef _MSC_VER
> - rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va);
> - rc = (rc > 0) ? rc : (size == 0 ? 1024 : size * 2);
> + rc = vsnprintf (str, size, fmt, va);
> + if (rc < 0) {
> + rc = si...
2001 Oct 18
2
Incorrect return types for snprintf() and vsnprintf()
...penbsd-compat/bsd-snprintf.c.orig Thu Oct 18 13:57:51 2001
--- /openbsd-compat/bsd-snprintf.c Thu Oct 18 13:58:26 2001
***************
*** 632,638 ****
#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
#ifndef HAVE_VSNPRINTF
! int
vsnprintf(char *str, size_t count, const char *fmt, va_list args)
{
str[0] = 0;
--- 632,638 ----
#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
#ifndef HAVE_VSNPRINTF
! size_t
vsnprintf(char *str, size_t count, const char *fmt, va_list args)
{
str[0] = 0;
***************
*** 643,649 ****
#endif /* !HAVE_VSNPRINT...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Remove getintmax in printf
...intmax_t getintmax(void);
-static uintmax_t getuintmax(void);
+static uintmax_t getuintmax(int);
static char *getstr(void);
static char *mklong(const char *, const char *);
static void check_conversion(const char *, const char *);
@@ -181,14 +180,14 @@ pc:
/* skip to field width */
fmt += strspn(fmt, SKIP1);
if (*fmt == '*')
- *param++ = getintmax();
+ *param++ = getuintmax(1);
/* skip to possible '.', get following precision */
fmt += strspn(fmt, SKIP2);
if (*fmt == '.')
++fmt;
if (*fmt == '*')
- *param++ = geti...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Remove getintmax in printf
...intmax_t getintmax(void);
-static uintmax_t getuintmax(void);
+static uintmax_t getuintmax(int);
static char *getstr(void);
static char *mklong(const char *, const char *);
static void check_conversion(const char *, const char *);
@@ -181,14 +180,14 @@ pc:
/* skip to field width */
fmt += strspn(fmt, SKIP1);
if (*fmt == '*')
- *param++ = getintmax();
+ *param++ = getuintmax(1);
/* skip to possible '.', get following precision */
fmt += strspn(fmt, SKIP2);
if (*fmt == '.')
++fmt;
if (*fmt == '*')
- *param++ = geti...
2005 Jun 27
5
adding a new log-format escape
...hat I've
applied the md5 patch beforehand.
diff -Naur rsync-2.6.5-md5/log.c rsync-2.6.5/log.c
--- rsync-2.6.5-md5/log.c 2005-06-26 22:34:17.000000000 -0600
+++ rsync-2.6.5/log.c 2005-06-26 22:38:57.000000000 -0600
@@ -371,7 +371,7 @@
char buf[MAXPATHLEN+1024], buf2[MAXPATHLEN], fmt[32];
char *p, *s, *n;
size_t len, total;
- int64 b;
+ int64 b, j;
*fmt = '%';
@@ -483,6 +483,13 @@
snprintf(buf2, sizeof buf2, fmt, (double)b);
n = buf2;
break;
+ ca...
2020 Aug 05
2
Debugging a potential bug when generating wasm32
...t platforms before.
I'm currently trying to debug a bug in a LLVM-generated Wasm code. The bug could
be in the code that generates LLVM (rustc) or in the LLVM, I'm not sure yet.
LLVM IR and Wasm can be seen in [1].
The problem is this line:
(import "GOT.func"
"_ZN4core3fmt3num3imp52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i32$GT$3fmt17h9ba9fea9cadf7bd5E"
(global (;3;) (mut i32)))
The same symbol is already imported from "env" in the same module:
(import "env"
"_ZN5core3fmt3num3imp52_$LT$impl$u20$core..fmt..Display$u20$for$u20$i...
2001 Jul 05
1
OpenSSH Logging Madness
...willian (OpenSSH/j/5_log.h 1.1 644)
@@ -39,6 +39,7 @@
SYSLOG_LEVEL_QUIET,
SYSLOG_LEVEL_FATAL,
SYSLOG_LEVEL_ERROR,
+ SYSLOG_LEVEL_NOTICE,
SYSLOG_LEVEL_INFO,
SYSLOG_LEVEL_VERBOSE,
SYSLOG_LEVEL_DEBUG1,
@@ -58,6 +59,7 @@
/* Output a message to syslog or stderr */
void fatal(const char *fmt,...) __attribute__((format(printf, 1, 2)));
void error(const char *fmt,...) __attribute__((format(printf, 1, 2)));
+void notice(const char *fmt,...) __attribute__((format(printf, 1, 2)));
void log(const char *fmt,...) __attribute__((format(printf, 1, 2)));
void verbose(const char *fm...
2007 Sep 26
1
--keep-foreign-metadata question
On 9/26/07, Josh Coalson <xflac@yahoo.com> wrote:
> --- Martin Leese <martin.leese@stanfordalumni.org> wrote:
...
> > Where can I find more detail on what is a
> > "non-audio" RIFF chunk?
>
> it is any riff chunk that is not "fmt " or "data"
>
> > Ambisonic ".amb" files are WAVE-EX files with
> > a non-standard GUID in the 'fmt ' chunk. I
> > want to work out is this can now be preserved
> > in FLAC files. (And, I am interested in
> > metadata anyway.)
>...
2004 Aug 13
1
[PATCH] make spotless update
make spotless leaves 2 generated files.
diff -purN klibc-0.159.orig/klibc/Makefile klibc-0.159/klibc/Makefile
--- klibc-0.159.orig/klibc/Makefile 2004-08-03 23:07:05.000000000 +0200
+++ klibc-0.159/klibc/Makefile 2004-08-13 22:23:35.696699671 +0200
@@ -156,6 +156,7 @@ clean: archclean
rm -f sha1hash errlist.c
spotless: clean
+ rm -f include/klibc/havesyscall.h syscalls.nrs
find . \( -name
2018 Aug 30
3
[PATCH 0/2] drm/nouveau: Use more standard logging styles
Reduces object size ~4kb
Joe Perches (2):
drm/nouveau: Add new logging function nv_cli_printk
drm/nouveau: Convert NV_PRINTK macros and uses to new nv_cli_<level> macros
drivers/gpu/drm/nouveau/nouveau_abi16.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_chan.c | 12 +++----
drivers/gpu/drm/nouveau/nouveau_drm.c | 21 +++++++++++
drivers/gpu/drm/nouveau/nouveau_drv.h | 44
2014 Sep 20
3
vsnprintf_s and vsnprintf
...dn't write '\0' at the end. So
> if (rc < 0) { ... str [...] = 0; }
> is not enough.
Like I said, untested. It was the first thing that came into my head version
of the code :-).
> What about this version --
>
> int flac_snprintf(char *str, size_t size, const char *fmt, ...)
> {
> va_list va;
> int rc;
>
> va_start (va, fmt);
>
> #if defined _MSC_VER
> rc = vsnprintf_s (str, size, _TRUNCATE, fmt, va);
> if (rc < 0)
> rc = size - 1;
> #elif defined __MINGW32__ && (!defined __USE_MINGW_ANSI_STDIO || __USE_MINGW_A...
2020 Mar 26
0
[PATCH nbdkit 2/9] server: Rename replacement vfprintf function.
...((__format__ (printf, 1, 0)));
+extern void log_syslog_verror (const char *fs, va_list args)
+ __attribute__((__format__ (printf, 1, 0)));
+
+/* vfprintf.c */
#if !HAVE_VFPRINTF_PERCENT_M
#include <stdio.h>
-#define vfprintf nbdkit_vfprintf
-extern int nbdkit_vfprintf (FILE *f, const char *fmt, va_list args)
+#define vfprintf replace_vfprintf
+extern int replace_vfprintf (FILE *f, const char *fmt, va_list args)
__attribute__((__format__ (printf, 2, 0)));
#endif
-extern void log_stderr_verror (const char *fs, va_list args)
- __attribute__((__format__ (printf, 1, 0)));
-extern void lo...
2013 Aug 16
7
[PATCH v2] xen/console: buffer and show origin of guest PV writes
...rt_of_line(const char *prefix)
{
struct tm tm;
char tstr[32];
- __putstr("(XEN) ");
+ __putstr(prefix);
if ( !opt_console_timestamps )
return;
@@ -524,12 +567,11 @@ static void printk_start_of_line(void)
__putstr(tstr);
}
-void printk(const char *fmt, ...)
+static void vprintk_common(const char *prefix, const char *fmt, va_list args)
{
static char buf[1024];
static int start_of_line = 1, do_print;
- va_list args;
char *p, *q;
unsigned long flags;
@@ -537,9 +579,7 @@ void printk(const char *fmt, ......
2012 Apr 09
5
Need to split long lines in mail archives
CentOS-6.2
I am investigating how to split long lines present in a
Mailman generated html archives. Mailman places the email
bodies within <pre></pre> tags and some users have MUAs
that send entire paragraphs as one long line.
I have looked at fmt and fold but these assume a pipeline
from stdout to a fixed filename, which presumably is best
done at the time of the original file's creation. I am
looking for a way to deal with multiple existing files in
a batch fashion so that the reformatted file is written
back out to the same file name...
2014 Feb 14
0
[PATCH v2] drm/nouveau: use nv_debug for NV_DEBUG, make DRM a separate subflag
...k);
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drm.h
index 23ca7a5..7efbafa 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.h
@@ -161,10 +161,7 @@ int nouveau_pmops_resume(struct device *);
#define NV_ERROR(cli, fmt, args...) nv_error((cli), fmt, ##args)
#define NV_WARN(cli, fmt, args...) nv_warn((cli), fmt, ##args)
#define NV_INFO(cli, fmt, args...) nv_info((cli), fmt, ##args)
-#define NV_DEBUG(cli, fmt, args...) do { \
- if (drm_debug & DRM_UT_DRIVER)...
2006 May 19
1
Writing to a file with fixed precision
Dear R users;
A follow-up question regarding writing to a file with fixed precision:
Assuming for each column of x, I would like to have a different format, then I modify the code as:
x.fmt <- apply(x, 1, function(x) sprintf("%.14f %.10f %2.5f", x))
where three different formats are %.14f %.10f %2.5f.
The error message I got is "Error in sprintf(fmt, ...) : too few arguments".
If put %1$.14f %2$.10f %3$2.5f. instead, a different error message becomes:
"...
2015 Feb 24
4
Call for testing: OpenSSH 6.8
...ed char *, size_t *);
+static void err(int, const char *, ...) __attribute__((format(printf, 2, 3)));
+static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3)));
+static void warn(const char *, ...) __attribute__((format(printf, 1, 2)));
+
+static void
+err(int r, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ fprintf(stderr, "%s: ", strerror(errno));
+ vfprintf(stderr, fmt, args);
+ fputc('\n', stderr);
+ va_end(args);
+ exit(r);
+}
+
+static void
+errx(int r, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+ vfprint...