aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-01-30 22:23:17 +0000
committerEric Andersen <andersen@codepoet.org>2001-01-30 22:23:17 +0000
commit4bbdd788e03d2aad25bd00caac69d86d02089824 (patch)
tree58b3fc6ad63468583aa185ab55b74de8b0f1fb2f /shell
parent30f64c3aa2696026f9c21e555c79f1dea7c55c76 (diff)
downloadbusybox-w32-4bbdd788e03d2aad25bd00caac69d86d02089824.tar.gz
busybox-w32-4bbdd788e03d2aad25bd00caac69d86d02089824.tar.bz2
busybox-w32-4bbdd788e03d2aad25bd00caac69d86d02089824.zip
Fix the pwd and group functions. The bb_ stuff was a leftover from
a brief past that mercifully (except for this) never made it into CVS. -Erik
Diffstat (limited to 'shell')
-rw-r--r--shell/cmdedit.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index e043d5f52..9c2facc7b 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -136,19 +136,20 @@ static void win_changed(int nsig)
136 struct winsize win = { 0, 0, 0, 0 }; 136 struct winsize win = { 0, 0, 0, 0 };
137 static __sighandler_t previous_SIGWINCH_handler; /* for reset */ 137 static __sighandler_t previous_SIGWINCH_handler; /* for reset */
138 138
139 /* emulate || signal call */ 139 /* emulate signal call if not called as a sig handler */
140 if(nsig == -SIGWINCH || nsig == SIGWINCH) { 140 if(nsig == -SIGWINCH || nsig == SIGWINCH) {
141 ioctl(0, TIOCGWINSZ, &win); 141 ioctl(0, TIOCGWINSZ, &win);
142 if (win.ws_col > 0) { 142 if (win.ws_col > 0) {
143 cmdedit_setwidth( win.ws_col, nsig == SIGWINCH ); 143 cmdedit_setwidth( win.ws_col, nsig == SIGWINCH );
144 } 144 }
145 } 145 }
146 /* Unix not all standart in recall signal */ 146
147 /* Unix not all standart in recall signal */
147 148
148 if(nsig == -SIGWINCH) /* save previous handler */ 149 if(nsig == -SIGWINCH) /* save previous handler */
149 previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); 150 previous_SIGWINCH_handler = signal(SIGWINCH, win_changed);
150 else if(nsig == SIGWINCH) /* signaled called handler */ 151 else if(nsig == SIGWINCH) /* signaled called handler */
151 signal(SIGWINCH, win_changed); /* set for next call */ 152 signal(SIGWINCH, win_changed); /* set for next call */
152 else /* set previous handler */ 153 else /* set previous handler */
153 signal(SIGWINCH, previous_SIGWINCH_handler); /* reset */ 154 signal(SIGWINCH, previous_SIGWINCH_handler); /* reset */
154} 155}
@@ -321,7 +322,7 @@ static void cmdedit_setwidth(int w, int redraw_flg)
321extern void cmdedit_init(void) 322extern void cmdedit_init(void)
322{ 323{
323 if((handlers_sets & SET_WCHG_HANDLERS)==0) { 324 if((handlers_sets & SET_WCHG_HANDLERS)==0) {
324 /* emulate usage handler to set handler and call yours work */ 325 /* pretend we received a signal in order to set term size and sig handling */
325 win_changed(-SIGWINCH); 326 win_changed(-SIGWINCH);
326 handlers_sets |= SET_WCHG_HANDLERS; 327 handlers_sets |= SET_WCHG_HANDLERS;
327 } 328 }
@@ -350,10 +351,10 @@ static char** username_tab_completion(char *ud, int *num_matches)
350 char *temp; 351 char *temp;
351 int nm = 0; 352 int nm = 0;
352 353
353 bb_setpwent (); 354 setpwent ();
354 userlen = strlen (ud + 1); 355 userlen = strlen (ud + 1);
355 356
356 while ((entry = bb_getpwent ()) != NULL) { 357 while ((entry = getpwent ()) != NULL) {
357 /* Null usernames should result in all users as possible completions. */ 358 /* Null usernames should result in all users as possible completions. */
358 if (!userlen || !strncmp (ud + 1, entry->pw_name, userlen)) { 359 if (!userlen || !strncmp (ud + 1, entry->pw_name, userlen)) {
359 360
@@ -365,7 +366,7 @@ static char** username_tab_completion(char *ud, int *num_matches)
365 } 366 }
366 } 367 }
367 368
368 bb_endpwent (); 369 endpwent ();
369 (*num_matches) = nm; 370 (*num_matches) = nm;
370 return (matches); 371 return (matches);
371} 372}