From 044228d5ecb9b79397f9fc915d046cf4538281e2 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 17 Jul 2001 01:12:36 +0000 Subject: This is vodz' latest patch. Sorry it took so long... 1) ping cleanup (compile fix from this patch already applied). 2) traceroute call not spare ntohl() now (and reduce size); 3) Fix for functions not declared static in insmod, ash, vi and mount. 4) a more simple API cmdedit :)) 5) adds "stopped jobs" warning to ash on Ctrl-D and fixes "ignoreeof" option 6) reduce exporting library function index->strchr (traceroute), bzero->memset (syslogd) --- shell/ash.c | 7 +++---- shell/cmdedit.c | 11 ++++++++++- shell/cmdedit.h | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 334d2fddd..d16da82db 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -6204,8 +6204,7 @@ retry: if (!iflag) nr = safe_read(parsefile->fd, buf, BUFSIZ - 1); else { - cmdedit_read_input((char*)cmdedit_prompt, buf); - nr = strlen(buf); + nr = cmdedit_read_input((char*)cmdedit_prompt, buf); } } #else @@ -9445,7 +9444,7 @@ static char *wordtext; /* text of last word returned by readtok static struct nodelist *backquotelist; static union node *redirnode; -struct heredoc *heredoc; +static struct heredoc *heredoc; static int quoteflag; /* set if (part of) last token was quoted */ static int startlinno; /* line # where last token started */ @@ -12917,7 +12916,7 @@ findvar(struct var **vpp, const char *name) /* * Copyright (c) 1999 Herbert Xu * This file contains code for the times builtin. - * $Id: ash.c,v 1.10 2001/07/12 20:26:31 andersen Exp $ + * $Id: ash.c,v 1.11 2001/07/17 01:12:35 andersen Exp $ */ static int timescmd (int argc, char **argv) { diff --git a/shell/cmdedit.c b/shell/cmdedit.c index 540eb7ea7..69f833747 100644 --- a/shell/cmdedit.c +++ b/shell/cmdedit.c @@ -1153,7 +1153,8 @@ enum { * */ -extern void cmdedit_read_input(char *prompt, char command[BUFSIZ]) + +int cmdedit_read_input(char *prompt, char command[BUFSIZ]) { int break_out = 0; @@ -1231,10 +1232,15 @@ extern void cmdedit_read_input(char *prompt, char command[BUFSIZ]) * if the len=0 and no chars to delete */ if (len == 0) { prepare_to_die: +#if !defined(BB_FEATURE_ASH) printf("exit"); goto_new_line(); /* cmdedit_reset_term() called in atexit */ exit(EXIT_SUCCESS); +#else + break_out = -1; /* for control stoped jobs */ + break; +#endif } else { input_delete(); } @@ -1455,8 +1461,10 @@ prepare_to_die: num_ok_lines++; #endif } + if(break_out>0) { command[len++] = '\n'; /* set '\n' */ command[len] = 0; + } #if defined(BB_FEATURE_CLEAN_UP) && defined(BB_FEATURE_COMMAND_TAB_COMPLETION) input_tab(0); /* strong free */ #endif @@ -1464,6 +1472,7 @@ prepare_to_die: free(cmdedit_prompt); #endif cmdedit_reset_term(); + return len; } diff --git a/shell/cmdedit.h b/shell/cmdedit.h index 1482da3b8..83893572a 100644 --- a/shell/cmdedit.h +++ b/shell/cmdedit.h @@ -1,6 +1,6 @@ #ifndef CMDEDIT_H #define CMDEDIT_H -void cmdedit_read_input(char* promptStr, char* command); /* read a line of input */ +int cmdedit_read_input(char* promptStr, char* command); #endif /* CMDEDIT_H */ -- cgit v1.2.3