mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Simplify the rusage.com command
This commit is contained in:
parent
b592716d1c
commit
dcda6f7d8d
7 changed files with 86 additions and 106 deletions
|
@ -129,6 +129,7 @@
|
|||
#include "libc/macros.internal.h"
|
||||
#include "libc/mem/alg.h"
|
||||
#include "libc/mem/alloca.h"
|
||||
#include "libc/mem/gc.internal.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/paths.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
|
@ -1787,7 +1788,7 @@ static int xvsnprintf(char *outbuf, unsigned length, const char *fmt,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int xvasprintf(char **sp, unsigned size, const char *f, va_list ap) {
|
||||
static int Xvasprintf(char **sp, unsigned size, const char *f, va_list ap) {
|
||||
char *s;
|
||||
int len;
|
||||
va_list ap2;
|
||||
|
@ -1858,7 +1859,7 @@ printfesque(2) static int Xasprintf(char **sp, const char *fmt, ...) {
|
|||
va_list ap;
|
||||
int ret;
|
||||
va_start(ap, fmt);
|
||||
ret = xvasprintf(sp, 0, fmt, ap);
|
||||
ret = Xvasprintf(sp, 0, fmt, ap);
|
||||
va_end(ap);
|
||||
return ret;
|
||||
}
|
||||
|
@ -1871,7 +1872,7 @@ static void doformat(struct output *dest, const char *f, va_list ap) {
|
|||
setstackmark(&smark);
|
||||
s = dest->nextc;
|
||||
olen = dest->end - dest->nextc;
|
||||
len = xvasprintf(&s, olen, f, ap);
|
||||
len = Xvasprintf(&s, olen, f, ap);
|
||||
if (likely(olen > len)) {
|
||||
dest->nextc += len;
|
||||
goto out;
|
||||
|
@ -5821,7 +5822,9 @@ retry:
|
|||
linenoiseSetHintsCallback(ShellHint);
|
||||
linenoiseSetCompletionCallback(ShellCompletion);
|
||||
}
|
||||
if ((p = linenoiseWithHistory(">: ", "unbourne"))) {
|
||||
char ps1[256];
|
||||
snprintf(ps1, sizeof(ps1), "%d >: ", exitstatus);
|
||||
if ((p = linenoiseWithHistory(ps1, "unbourne"))) {
|
||||
nr = min(strlen(p), IBUFSIZ - 2);
|
||||
memcpy(buf, p, nr);
|
||||
buf[nr++] = '\n';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue