aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-03 04:29:08 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-03 04:29:08 +0200
commit79b3d42e13814f984ec35ec632d34db301871567 (patch)
treecaf186cea2f4397655b9a9f0cae958a7919123b0 /shell/ash.c
parent08d8b3cee1329d390f91bce419e2b4dadf484952 (diff)
downloadbusybox-w32-79b3d42e13814f984ec35ec632d34db301871567.tar.gz
busybox-w32-79b3d42e13814f984ec35ec632d34db301871567.tar.bz2
busybox-w32-79b3d42e13814f984ec35ec632d34db301871567.zip
ash: rename parsefile->fd to ->pf_fd
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 067feb13d..b2c56f0aa 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -1044,7 +1044,7 @@ struct strpush {
1044struct parsefile { 1044struct parsefile {
1045 struct parsefile *prev; /* preceding file on stack */ 1045 struct parsefile *prev; /* preceding file on stack */
1046 int linno; /* current line */ 1046 int linno; /* current line */
1047 int fd; /* file descriptor (or -1 if string) */ 1047 int pf_fd; /* file descriptor (or -1 if string) */
1048 int left_in_line; /* number of chars left in this line */ 1048 int left_in_line; /* number of chars left in this line */
1049 int left_in_buffer; /* number of chars left in this buffer past the line */ 1049 int left_in_buffer; /* number of chars left in this buffer past the line */
1050 char *next_to_pgetc; /* next char in buffer */ 1050 char *next_to_pgetc; /* next char in buffer */
@@ -1070,7 +1070,7 @@ ash_vmsg(const char *msg, va_list ap)
1070 if (commandname) { 1070 if (commandname) {
1071 if (strcmp(arg0, commandname)) 1071 if (strcmp(arg0, commandname))
1072 fprintf(stderr, "%s: ", commandname); 1072 fprintf(stderr, "%s: ", commandname);
1073 if (!iflag || g_parsefile->fd > 0) 1073 if (!iflag || g_parsefile->pf_fd > 0)
1074 fprintf(stderr, "line %d: ", startlinno); 1074 fprintf(stderr, "line %d: ", startlinno);
1075 } 1075 }
1076 vfprintf(stderr, msg, ap); 1076 vfprintf(stderr, msg, ap);
@@ -5066,15 +5066,15 @@ static int is_hidden_fd(struct redirtab *rp, int fd)
5066 /* Check open scripts' fds */ 5066 /* Check open scripts' fds */
5067 pf = g_parsefile; 5067 pf = g_parsefile;
5068 while (pf) { 5068 while (pf) {
5069 /* We skip fd == 0 case because of the following case: 5069 /* We skip pf_fd == 0 case because of the following case:
5070 * $ ash # running ash interactively 5070 * $ ash # running ash interactively
5071 * $ . ./script.sh 5071 * $ . ./script.sh
5072 * and in script.sh: "exec 9>&0". 5072 * and in script.sh: "exec 9>&0".
5073 * Even though top-level fd _is_ 0, 5073 * Even though top-level pf_fd _is_ 0,
5074 * it's still ok to use it: "read" builtin uses it, 5074 * it's still ok to use it: "read" builtin uses it,
5075 * why should we cripple "exec" builtin? 5075 * why should we cripple "exec" builtin?
5076 */ 5076 */
5077 if (pf->fd > 0 && fd == pf->fd) { 5077 if (pf->pf_fd > 0 && fd == pf->pf_fd) {
5078 return 1; 5078 return 1;
5079 } 5079 }
5080 pf = pf->prev; 5080 pf = pf->prev;
@@ -9456,8 +9456,8 @@ preadfd(void)
9456 g_parsefile->next_to_pgetc = buf; 9456 g_parsefile->next_to_pgetc = buf;
9457#if ENABLE_FEATURE_EDITING 9457#if ENABLE_FEATURE_EDITING
9458 retry: 9458 retry:
9459 if (!iflag || g_parsefile->fd != STDIN_FILENO) 9459 if (!iflag || g_parsefile->pf_fd != STDIN_FILENO)
9460 nr = nonblock_safe_read(g_parsefile->fd, buf, IBUFSIZ - 1); 9460 nr = nonblock_safe_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1);
9461 else { 9461 else {
9462#if ENABLE_FEATURE_TAB_COMPLETION 9462#if ENABLE_FEATURE_TAB_COMPLETION
9463 line_input_state->path_lookup = pathval(); 9463 line_input_state->path_lookup = pathval();
@@ -9706,7 +9706,7 @@ pushfile(void)
9706 9706
9707 pf = ckzalloc(sizeof(*pf)); 9707 pf = ckzalloc(sizeof(*pf));
9708 pf->prev = g_parsefile; 9708 pf->prev = g_parsefile;
9709 pf->fd = -1; 9709 pf->pf_fd = -1;
9710 /*pf->strpush = NULL; - ckzalloc did it */ 9710 /*pf->strpush = NULL; - ckzalloc did it */
9711 /*pf->basestrpush.prev = NULL;*/ 9711 /*pf->basestrpush.prev = NULL;*/
9712 g_parsefile = pf; 9712 g_parsefile = pf;
@@ -9718,8 +9718,8 @@ popfile(void)
9718 struct parsefile *pf = g_parsefile; 9718 struct parsefile *pf = g_parsefile;
9719 9719
9720 INT_OFF; 9720 INT_OFF;
9721 if (pf->fd >= 0) 9721 if (pf->pf_fd >= 0)
9722 close(pf->fd); 9722 close(pf->pf_fd);
9723 free(pf->buf); 9723 free(pf->buf);
9724 while (pf->strpush) 9724 while (pf->strpush)
9725 popstring(); 9725 popstring();
@@ -9746,9 +9746,9 @@ static void
9746closescript(void) 9746closescript(void)
9747{ 9747{
9748 popallfiles(); 9748 popallfiles();
9749 if (g_parsefile->fd > 0) { 9749 if (g_parsefile->pf_fd > 0) {
9750 close(g_parsefile->fd); 9750 close(g_parsefile->pf_fd);
9751 g_parsefile->fd = 0; 9751 g_parsefile->pf_fd = 0;
9752 } 9752 }
9753} 9753}
9754 9754
@@ -9764,7 +9764,7 @@ setinputfd(int fd, int push)
9764 pushfile(); 9764 pushfile();
9765 g_parsefile->buf = NULL; 9765 g_parsefile->buf = NULL;
9766 } 9766 }
9767 g_parsefile->fd = fd; 9767 g_parsefile->pf_fd = fd;
9768 if (g_parsefile->buf == NULL) 9768 if (g_parsefile->buf == NULL)
9769 g_parsefile->buf = ckmalloc(IBUFSIZ); 9769 g_parsefile->buf = ckmalloc(IBUFSIZ);
9770 g_parsefile->left_in_buffer = 0; 9770 g_parsefile->left_in_buffer = 0;
@@ -13008,7 +13008,7 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
13008 * Ensure we don't falsely claim that 0 (stdin) 13008 * Ensure we don't falsely claim that 0 (stdin)
13009 * is one of stacked source fds. 13009 * is one of stacked source fds.
13010 * Testcase: ash -c 'exec 1>&0' must not complain. */ 13010 * Testcase: ash -c 'exec 1>&0' must not complain. */
13011 // if (!sflag) g_parsefile->fd = -1; 13011 // if (!sflag) g_parsefile->pf_fd = -1;
13012 // ^^ not necessary since now we special-case fd 0 13012 // ^^ not necessary since now we special-case fd 0
13013 // in is_hidden_fd() to not be considered "hidden fd" 13013 // in is_hidden_fd() to not be considered "hidden fd"
13014 evalstring(minusc, 0); 13014 evalstring(minusc, 0);