search for: fmtstr

Displaying 20 results from an estimated 22 matches for "fmtstr".

2020 Mar 28
0
[klibc:update-dash] dash: jobs: Replace some uses of fmtstr with stpcpy/stpncpy
...=commit;h=2b71087f65f966488d55fc32b53255508d1a5e4c Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Sat, 19 May 2018 02:39:45 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: jobs: Replace some uses of fmtstr with stpcpy/stpncpy [ dash commit 15a60c2357f772ccf953772859e8f9fc124442e2 ] Some uses of fmtstr, particularly the ones without a format string, can be replaced with stpcpy or stpncpy. This patch does that so we don't have to introduce unnecessary format strings in order to silence compiler...
2020 Mar 28
0
[klibc:update-dash] dash: output: Fix fmtstr return value
...ibc/klibc.git;a=commit;h=e177d47fdffd61bdd3f4e254d73653cda5454c07 Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Sat, 19 May 2018 02:39:44 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: output: Fix fmtstr return value [ dash commit 0e18261c159f0af3d9ea7eae116d201bc1e05dd5 ] The function fmtstr is meant to return the actual length of output produced, rather than the untruncated length. Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> Signed-off-by: Ben Hutchings <ben at decadent...
2020 Nov 09
4
[[PATCH v1 0/3] Fix clang build warnings
New clangs emit some warnings. The code isn't wrong, but should be updated to prevent warning creep. Bill Wendling (3): [klibc] dash: shell: Fix clang warnings [klibc] dash: shell: Fix clang warnings about format string [klibc] Kbuild: use an enum to silence a clang warning usr/dash/eval.c | 6 +++--- usr/dash/jobs.c | 2 +- usr/kinit/nfsmount/dummypmap.c
2020 Mar 27
2
[PATCH v2 5/5] Clean up clang warnings
- Convert the "old style" GNU field designator extension to the new style. - Use proper indexing into a string literal. - Use "%s" for the format string in "fmtstr". - Add or remove casts of the "void *" argument of ioctl. - Convert "if (!exitstatus == isor)" to "if ((!exitstatus) == isor)" which retains the current semantics, but may not be what the programmer intended. Signed-off-by: Bill Wendling <morbo at google....
2010 Oct 19
3
[PATCH] Fix up 3 klibc build warnings.
...ndianess? %#x\n", - *(int *)test); + test.i); exit(2); } } diff --git a/usr/dash/jobs.c b/usr/dash/jobs.c index bf770dd..43b6b98 100644 --- a/usr/dash/jobs.c +++ b/usr/dash/jobs.c @@ -424,7 +424,7 @@ sprint_status(char *s, int status, int sigonly) goto out; #endif } - col = fmtstr(s, 32, strsignal(st)); + col = fmtstr(s, 32, "%s", strsignal(st)); if (WCOREDUMP(status)) { col += fmtstr(s + col, 16, " (core dumped)"); } diff --git a/usr/dash/trap.c b/usr/dash/trap.c index 18c3cd1..d6706c6 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -351...
2000 Jan 06
1
bsd-snprintf.c and NeXT.
I'm wonder if anyone happens to have a simplier (slower) version of bsd-snprintf.c. It seems NeXT 3.3 (unsure about 4.2) is missing mprotect(). If I could get something to replace that for a while and fix some of theses utmp in login.c issues I may have a rough port NeXT to black hardware.=) Thanks
2020 Mar 27
12
[PATCH 0/5] Clang compatibility patches
This is a series of patches for clang compatibility: - Using flags needed flags and removing unsupported flags. - Adding support for clang's LLD linker. - Removing a variety of warnings. Bill Wendling (3): [klibc] Kbuild: use "libc.a" with clang [klibc] Kbuild: Add "-fcommon" for clang builds [klibc] Clean up clang warnings Michael Davidson (1): [klibc] Kbuild:
2020 Mar 28
0
[klibc:update-dash] dash: expand: Ensure result is escaped in cvtnum
...PTS, expdest); @@ -1711,15 +1714,13 @@ casematch(union node *pattern, char *val) * Our own itoa(). */ -STATIC int -cvtnum(intmax_t num) +static size_t cvtnum(intmax_t num, int flags) { int len = max_int_length(sizeof(num)); + char buf[len]; - expdest = makestrspace(len, expdest); - len = fmtstr(expdest, len, "%" PRIdMAX, num); - STADJUST(len, expdest); - return len; + len = fmtstr(buf, len, "%" PRIdMAX, num); + return memtodest(buf, len, flags); } STATIC void
2001 May 06
1
Text formatting string problem
Howdy, Running a FPGA design tool (Actel's Designer), I find that it works pretty good, but that certain printed status strings are being formatted incorrectly. It does not seem to affect the operation of the application, except for the status reports. For example, running wine --debugmsg +text,+string,+win /d/Actel/bin/designer and opening an existing design gives this:
1999 Dec 10
0
snprintf from postgresql
...= 0; end = str + count - 1; SnprfOverflow = 0; dopr(str, fmt, args); if (count > 0) end[0] = 0; if (SnprfOverflow) elog(NOTICE, "vsnprintf overflow, len = %d, str = %s", count, str); return strlen(str); } /* * dopr(): poor man's version of doprintf */ static void fmtstr(char *value, int ljust, int len, int zpad, int maxwidth); static void fmtnum(long_long value, int base, int dosign, int ljust, int len, int zpad); static void fmtfloat(double value, char type, int ljust, int len, int precision, int pointflag); static void dostr(char *str, int cut); static void dopr...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Handle embedded NULs correctly in printf
...*p, struct output *file) size_t len; len = strlen(p); - __outstr(p, len, file); + outmem(p, len, file); #endif } @@ -213,7 +214,7 @@ void outcslow(int c, struct output *dest) { char buf = c; - __outstr(&buf, 1, dest); + outmem(&buf, 1, dest); } #endif @@ -283,35 +284,58 @@ fmtstr(char *outbuf, size_t length, const char *fmt, ...) } +static int xvasprintf(char **sp, size_t size, const char *f, va_list ap) +{ + char *s; + int len; + va_list ap2; + + va_copy(ap2, ap); + len = xvsnprintf(*sp, size, f, ap2); + va_end(ap2); + if (len < 0) + sh_error("xvsnprintf fail...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Handle embedded NULs correctly in printf
...*p, struct output *file) size_t len; len = strlen(p); - __outstr(p, len, file); + outmem(p, len, file); #endif } @@ -213,7 +214,7 @@ void outcslow(int c, struct output *dest) { char buf = c; - __outstr(&buf, 1, dest); + outmem(&buf, 1, dest); } #endif @@ -283,35 +284,58 @@ fmtstr(char *outbuf, size_t length, const char *fmt, ...) } +static int xvasprintf(char **sp, size_t size, const char *f, va_list ap) +{ + char *s; + int len; + va_list ap2; + + va_copy(ap2, ap); + len = xvsnprintf(*sp, size, f, ap2); + va_end(ap2); + if (len < 0) + sh_error("xvsnprintf fail...
2019 Jan 25
0
[klibc:update-dash] [VAR] Initialise OPTIND after importing environment
...chings <ben at decadent.org.uk> --- usr/dash/var.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr/dash/var.c b/usr/dash/var.c index c35e925e..fa248544 100644 --- a/usr/dash/var.c +++ b/usr/dash/var.c @@ -142,6 +142,8 @@ INIT { } } + setvarint("OPTIND", 1, 0); + fmtstr(ppid + 5, sizeof(ppid) - 5, "%ld", (long) getppid()); setvareq(ppid, VTEXTFIXED);
2019 Jan 25
0
[klibc:update-dash] [VAR] Use setvareq to set OPTIND initially
...TFIXED, "OPTIND=1", getoptsreset }, + { 0, VSTRFIXED|VTEXTFIXED, defoptindvar, getoptsreset }, #ifdef WITH_LINENO { 0, VSTRFIXED|VTEXTFIXED, linenovar, 0 }, #endif @@ -142,7 +143,7 @@ INIT { } } - setvarint("OPTIND", 1, 0); + setvareq(defoptindvar, VTEXTFIXED); fmtstr(ppid + 5, sizeof(ppid) - 5, "%ld", (long) getppid()); setvareq(ppid, VTEXTFIXED);
2020 Mar 28
0
[klibc:update-dash] dash: [VAR] Initialise OPTIND after importing environment
...chings <ben at decadent.org.uk> --- usr/dash/var.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr/dash/var.c b/usr/dash/var.c index c35e925e..fa248544 100644 --- a/usr/dash/var.c +++ b/usr/dash/var.c @@ -142,6 +142,8 @@ INIT { } } + setvarint("OPTIND", 1, 0); + fmtstr(ppid + 5, sizeof(ppid) - 5, "%ld", (long) getppid()); setvareq(ppid, VTEXTFIXED);
2020 Mar 28
0
[klibc:update-dash] dash: [VAR] Use setvareq to set OPTIND initially
...TFIXED, "OPTIND=1", getoptsreset }, + { 0, VSTRFIXED|VTEXTFIXED, defoptindvar, getoptsreset }, #ifdef WITH_LINENO { 0, VSTRFIXED|VTEXTFIXED, linenovar, 0 }, #endif @@ -142,7 +143,7 @@ INIT { } } - setvarint("OPTIND", 1, 0); + setvareq(defoptindvar, VTEXTFIXED); fmtstr(ppid + 5, sizeof(ppid) - 5, "%ld", (long) getppid()); setvareq(ppid, VTEXTFIXED);
2020 Mar 28
0
[klibc:update-dash] dash: var: Set IFS to fixed value at start time
...D|VTEXTFIXED|VUNSET, "MAIL\0", changemail }, { 0, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH\0", changemail }, { 0, VSTRFIXED|VTEXTFIXED, defpathvar, changepath }, @@ -143,6 +135,7 @@ INIT { } } + setvareq(defifsvar, VTEXTFIXED); setvareq(defoptindvar, VTEXTFIXED); fmtstr(ppid + 5, sizeof(ppid) - 5, "%ld", (long) getppid()); diff --git a/usr/dash/var.h b/usr/dash/var.h index 11ce9b7d..52f559d1 100644 --- a/usr/dash/var.h +++ b/usr/dash/var.h @@ -100,12 +100,8 @@ extern struct var varinit[]; #define vhistsize (&vterm)[1] #endif -#ifdef IFS_BROKEN -e...
2020 Mar 28
0
[PATCH v2 5/5] Clean up clang warnings
On Fri, 2020-03-27 at 15:29 -0700, Bill Wendling wrote: > - Convert the "old style" GNU field designator extension to the new > style. > - Use proper indexing into a string literal. > - Use "%s" for the format string in "fmtstr". > - Add or remove casts of the "void *" argument of ioctl. > - Convert "if (!exitstatus == isor)" to "if ((!exitstatus) == isor)" > which retains the current semantics, but may not be what the > programmer intended. [...] This is all good, but I...
2012 Jul 02
0
[klibc:master] [SHELL] Allow building without LINEO support
...ED|VTEXTFIXED|VUNSET, "HISTSIZE\0", sethistsize }, @@ -335,9 +337,11 @@ lookupvar(const char *name) struct var *v; if ((v = *findvar(hashvar(name), name)) && !(v->flags & VUNSET)) { +#ifdef WITH_LINENO if (v == &vlineno && v->text == linenovar) { fmtstr(linenovar+7, sizeof(linenovar)-7, "%d", lineno); } +#endif return strchrnul(v->text, '=') + 1; } return NULL; diff --git a/usr/dash/var.h b/usr/dash/var.h index 4c02eb2..1a06a3c 100644 --- a/usr/dash/var.h +++ b/usr/dash/var.h @@ -88,9 +88,15 @@ extern struct var vari...
2009 Jul 31
2
[LLVMdev] llvm-gcc build of inferno/plan 9 'mk' fails
...reate.c dirwstat.c fmtprint.c fmtvprint.c fprint.c print.c runeseprint.c runesmprint.c runesnprint.c runevseprint.c seprint.c smprint.c snprint.c sprint.c vfprint.c vseprint.c vsmprint.c vsnprint.c dofmt.c dorfmt.c errfmt.c fcallfmt.c fltfmt.c fmt.c fmtfd.c fmtlock.c fmtprint.c fmtquote.c fmtrune.c fmtstr.c fmtvprint.c exits.c getfields.c pow10.c print.c qsort.c rune.c runestrlen.c seek.c strdup.c strtoll.c utflen.c utfrrune.c utfrune.c utfecpy.c utflen.c utfnlen.c utfrrune.c utfrune.c strecpy.c llvm-ar crvs /usr/local/inferno/MacOSX/386/lib/lib9.a dirstat-posix.o rerrstr.o errstr-posix.o getuser-po...