Displaying 13 results from an estimated 13 matches for "nleft".
Did you mean:
left
2019 Jan 25
0
[klibc:update-dash] input: Move all input state into parsefile
...+++++++++------------------------------------
usr/dash/input.h | 33 +++++++++++++++--
2 files changed, 67 insertions(+), 73 deletions(-)
diff --git a/usr/dash/input.c b/usr/dash/input.c
index 232bb9c4..6223a735 100644
--- a/usr/dash/input.c
+++ b/usr/dash/input.c
@@ -61,38 +61,7 @@
#define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */
#define IBUFSIZ (BUFSIZ + 1)
-MKINIT
-struct strpush {
- struct strpush *prev; /* preceding string on stack */
- char *prevstring;
- int prevnleft;
- struct alias *ap; /* if push was associated with an alias */
- char *string; /* remember the...
2020 Mar 28
0
[klibc:update-dash] dash: input: Move all input state into parsefile
...+++++++++------------------------------------
usr/dash/input.h | 33 +++++++++++++++--
2 files changed, 67 insertions(+), 73 deletions(-)
diff --git a/usr/dash/input.c b/usr/dash/input.c
index 232bb9c4..6223a735 100644
--- a/usr/dash/input.c
+++ b/usr/dash/input.c
@@ -61,38 +61,7 @@
#define EOF_NLEFT -99 /* value of parsenleft when EOF pushed back */
#define IBUFSIZ (BUFSIZ + 1)
-MKINIT
-struct strpush {
- struct strpush *prev; /* preceding string on stack */
- char *prevstring;
- int prevnleft;
- struct alias *ap; /* if push was associated with an alias */
- char *string; /* remember the...
2019 Jan 25
0
[klibc:update-dash] input: Allow two consecutive calls to pungetc
...s(-)
diff --git a/usr/dash/input.c b/usr/dash/input.c
index 6223a735..06c08d49 100644
--- a/usr/dash/input.c
+++ b/usr/dash/input.c
@@ -102,10 +102,20 @@ RESET {
int
pgetc(void)
{
+ int c;
+
+ if (parsefile->unget)
+ return parsefile->lastc[--parsefile->unget];
+
if (--parsefile->nleft >= 0)
- return (signed char)*parsefile->nextc++;
+ c = (signed char)*parsefile->nextc++;
else
- return preadbuffer();
+ c = preadbuffer();
+
+ parsefile->lastc[1] = parsefile->lastc[0];
+ parsefile->lastc[0] = c;
+
+ return c;
}
@@ -194,7 +204,7 @@ static int preadbuffe...
2020 Mar 28
0
[klibc:update-dash] dash: input: Allow two consecutive calls to pungetc
...s(-)
diff --git a/usr/dash/input.c b/usr/dash/input.c
index 6223a735..06c08d49 100644
--- a/usr/dash/input.c
+++ b/usr/dash/input.c
@@ -102,10 +102,20 @@ RESET {
int
pgetc(void)
{
+ int c;
+
+ if (parsefile->unget)
+ return parsefile->lastc[--parsefile->unget];
+
if (--parsefile->nleft >= 0)
- return (signed char)*parsefile->nextc++;
+ c = (signed char)*parsefile->nextc++;
else
- return preadbuffer();
+ c = preadbuffer();
+
+ parsefile->lastc[1] = parsefile->lastc[0];
+ parsefile->lastc[0] = c;
+
+ return c;
}
@@ -194,7 +204,7 @@ static int preadbuffe...
2019 Jan 25
0
[klibc:update-dash] [OUTPUT] Add likely tag in outmem
...k>
---
usr/dash/output.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/output.c b/usr/dash/output.c
index 1b20850a..3e1ae256 100644
--- a/usr/dash/output.c
+++ b/usr/dash/output.c
@@ -144,7 +144,7 @@ outmem(const char *p, size_t len, struct output *dest)
size_t nleft;
nleft = dest->end - dest->nextc;
- if (nleft >= len) {
+ if (likely(nleft >= len)) {
buffered:
dest->nextc = mempcpy(dest->nextc, p, len);
return;
2020 Mar 28
0
[klibc:update-dash] dash: [OUTPUT] Add likely tag in outmem
...k>
---
usr/dash/output.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/dash/output.c b/usr/dash/output.c
index 6618cc33..f9d87a6a 100644
--- a/usr/dash/output.c
+++ b/usr/dash/output.c
@@ -144,7 +144,7 @@ outmem(const char *p, size_t len, struct output *dest)
size_t nleft;
nleft = dest->end - dest->nextc;
- if (nleft >= len) {
+ if (likely(nleft >= len)) {
buffered:
dest->nextc = mempcpy(dest->nextc, p, len);
return;
2020 Mar 28
0
[klibc:update-dash] dash: memalloc: Add growstackto helper
...+char *growstackto(size_t len)
+{
+ while (stackblocksize() < len)
+ growstackblock();
+
+ return stackblock();
+}
+
/*
* Called from CHECKSTRSPACE.
*/
@@ -273,18 +281,8 @@ char *
makestrspace(size_t newlen, char *p)
{
size_t len = p - stacknxt;
- size_t size;
- for (;;) {
- size_t nleft;
-
- size = stackblocksize();
- nleft = size - len;
- if (nleft >= newlen)
- break;
- growstackblock();
- }
- return stackblock() + len;
+ return growstackto(len + newlen) + len;
}
char *
diff --git a/usr/dash/memalloc.h b/usr/dash/memalloc.h
index 4b5be46c..b348d9cc 100644
--- a/usr/d...
2012 Jul 02
0
[klibc:master] [EVAL] Remove unused EV_BACKCMD flag
...set if we are skipping commands */
STATIC int skipcount; /* number of levels to skip */
@@ -594,6 +593,9 @@ evalpipe(union node *n, int flags)
void
evalbackcmd(union node *n, struct backcmd *result)
{
+ int pip[2];
+ struct job *jp;
+
result->fd = -1;
result->buf = NULL;
result->nleft = 0;
@@ -602,52 +604,24 @@ evalbackcmd(union node *n, struct backcmd *result)
goto out;
}
-#ifdef notyet
- /*
- * For now we disable executing builtins in the same
- * context as the shell, because we are not keeping
- * enough state to recover from changes that are
- * supposed only to...
2012 Jul 02
0
[klibc:master] [MEMALLOC] Avoid clang warning about dead store to "size"
...it a/usr/dash/memalloc.c b/usr/dash/memalloc.c
index 9fea067..d8e4413 100644
--- a/usr/dash/memalloc.c
+++ b/usr/dash/memalloc.c
@@ -273,7 +273,7 @@ char *
makestrspace(size_t newlen, char *p)
{
size_t len = p - stacknxt;
- size_t size = stackblocksize();
+ size_t size;
for (;;) {
size_t nleft;
2007 Aug 23
0
[git patch] klibc dash 0.5.4 update
...c
@@ -427,9 +427,12 @@ writetext(struct text *text, FILE *fp)
struct block *bp;
if (text->start != NULL) {
- for (bp = text->start ; bp != text->last ; bp = bp->next)
- fwrite(bp->text, sizeof (char), BLOCKSIZE, fp);
- fwrite(bp->text, sizeof (char), BLOCKSIZE - text->nleft, fp);
+ for (bp = text->start ; bp != text->last ; bp = bp->next) {
+ if ((fwrite(bp->text, sizeof (char), BLOCKSIZE, fp)) != BLOCKSIZE)
+ error("Can't write data\n");
+ }
+ if ((fwrite(bp->text, sizeof (char), BLOCKSIZE - text->nleft, fp)) != (BLOCKSIZE - te...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add assignment built-in support again
...dash/eval.c
@@ -100,8 +100,9 @@ STATIC int bltincmd(int, char **);
STATIC const struct builtincmd bltin = {
- name: nullstr,
- builtin: bltincmd
+ .name = nullstr,
+ .builtin = bltincmd,
+ .flags = BUILTIN_REGULAR,
};
@@ -648,22 +649,42 @@ out:
result->fd, result->buf, result->nleft, result->jp));
}
-static char **
-parse_command_args(char **argv, const char **path)
+static struct strlist *fill_arglist(struct arglist *arglist,
+ union node **argpp)
{
+ struct strlist **lastp = arglist->lastp;
+ union node *argp;
+
+ while ((argp = *argpp)) {
+ expandarg(argp,...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Handle embedded NULs correctly in printf
...if
-#ifndef USE_GLIBC_STDIO
-static void
-__outstr(const char *p, size_t len, struct output *dest)
+void
+outmem(const char *p, size_t len, struct output *dest)
{
+#ifdef USE_GLIBC_STDIO
+ INTOFF;
+ fwrite(p, 1, len, dest->stream);
+ INTON;
+#else
size_t bufsize;
size_t offset;
size_t nleft;
@@ -186,8 +187,8 @@ alloc:
err:
dest->flags |= OUTPUT_ERR;
}
-}
#endif
+}
void
@@ -201,7 +202,7 @@ outstr(const char *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, s...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Handle embedded NULs correctly in printf
...if
-#ifndef USE_GLIBC_STDIO
-static void
-__outstr(const char *p, size_t len, struct output *dest)
+void
+outmem(const char *p, size_t len, struct output *dest)
{
+#ifdef USE_GLIBC_STDIO
+ INTOFF;
+ fwrite(p, 1, len, dest->stream);
+ INTON;
+#else
size_t bufsize;
size_t offset;
size_t nleft;
@@ -186,8 +187,8 @@ alloc:
err:
dest->flags |= OUTPUT_ERR;
}
-}
#endif
+}
void
@@ -201,7 +202,7 @@ outstr(const char *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, s...