aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcrunchy <crunchy>2002-09-14 09:55:31 +0000
committercrunchy <crunchy>2002-09-14 09:55:31 +0000
commitb994b5499a4fd50675bc3c772a0c19fa2d4290ac (patch)
tree86cd72a1c8f4d95cd38899d114917facbae0ce0d
parent628031051a17756e48b6726ddd477d2fa5692dc2 (diff)
downloadmpiosh-b994b5499a4fd50675bc3c772a0c19fa2d4290ac.tar.gz
mpiosh-b994b5499a4fd50675bc3c772a0c19fa2d4290ac.tar.bz2
mpiosh-b994b5499a4fd50675bc3c772a0c19fa2d4290ac.zip
better handling for SIGINT
-rw-r--r--ChangeLog5
-rw-r--r--TODO4
-rw-r--r--mpiosh/mpiosh.c29
-rw-r--r--mpiosh/mpiosh.h3
4 files changed, 26 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 309c5de..24dce90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,11 @@
2002-09-14 Andreas Buesching <crunchy@tzi.de>
* mpiosh/mpiosh.c: fixed output of none interactive mode
+ (mpiosh_signal_handler, mpiosh_readline_cancel)
+ (mpiosh_noredisplay): functions added to get a expected handling
+ of C-c (SIGINT)
-2002-09-13 Markus Germeier <mager@tzi.e>
+2002-09-13 Markus Germeier <mager@tzi.de>
* libmpio/mpio.c (mpio_file_put): fixed abort handling
diff --git a/TODO b/TODO
index 3a2241b..21e18d8 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-$Id: TODO,v 1.13 2002/09/13 15:20:24 crunchy Exp $
+$Id: TODO,v 1.14 2002/09/14 09:55:31 crunchy Exp $
* Kernel Module
- the MPIO can no multitasking, so:
@@ -37,7 +37,7 @@ $Id: TODO,v 1.13 2002/09/13 15:20:24 crunchy Exp $
- use indices for files as possible arguments for put/get
- use shell-like regular expressions
- command separator like ';' [DONE]
- - using stdin for reading command sequences
+ - using stdin for reading command sequences [DONE]
- fill: uses current local directory to fill the current memory card
+ options: random, best(?)
diff --git a/mpiosh/mpiosh.c b/mpiosh/mpiosh.c
index aca7e19..7f8c359 100644
--- a/mpiosh/mpiosh.c
+++ b/mpiosh/mpiosh.c
@@ -2,7 +2,7 @@
/*
*
- * $Id: mpiosh.c,v 1.5 2002/09/14 07:23:59 crunchy Exp $
+ * $Id: mpiosh.c,v 1.6 2002/09/14 09:55:31 crunchy Exp $
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
@@ -132,7 +132,10 @@ void
mpiosh_readline_init(void)
{
rl_readline_name = "mpio";
+ rl_catch_signals = 0;
+ rl_filename_quote_characters = " ";
rl_attempted_completion_function = mpiosh_readline_completion;
+ rl_event_hook = mpiosh_readline_cancel;
}
char *
@@ -166,9 +169,6 @@ mpiosh_readline_completion(const char *text, int start, int end)
if (start == 0)
matches = rl_completion_matches(text, mpiosh_readline_comp_cmd);
- else {
-
- }
return matches;
}
@@ -333,10 +333,17 @@ mpiosh_command_free_args(char **args)
free(args);
}
+int
+mpiosh_readline_cancel(void)
+{
+ if (mpiosh_cancel) rl_done = 1;
+
+ return 0;
+}
+
void
mpiosh_signal_handler(int signal)
{
- debug("user abort!\n");
mpiosh_cancel = 1;
}
@@ -362,13 +369,11 @@ main(int argc, char *argv[]) {
sigaction(SIGINT, &sigc, NULL);
-/* signal(SIGINT, SIG_IGN); */
-
/* init readline and history */
+ mpiosh_readline_init();
using_history();
debug_init();
- mpiosh_readline_init();
mpiosh_init();
mpiosh.dev = mpio_init();
@@ -389,7 +394,11 @@ main(int argc, char *argv[]) {
}
while ((line = readline(mpiosh.prompt))) {
- if (*line == '\0') continue;
+ if ((*line == '\0') || mpiosh_cancel) {
+ rl_clear_pending_input ();
+ mpiosh_cancel = 0;
+ continue;
+ }
cmds = mpiosh_command_split(line);
@@ -428,5 +437,3 @@ main(int argc, char *argv[]) {
return 0;
}
-
-
diff --git a/mpiosh/mpiosh.h b/mpiosh/mpiosh.h
index c6e8755..944e73d 100644
--- a/mpiosh/mpiosh.h
+++ b/mpiosh/mpiosh.h
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: mpiosh.h,v 1.3 2002/09/13 15:20:25 crunchy Exp $
+ * $Id: mpiosh.h,v 1.4 2002/09/14 09:55:31 crunchy Exp $
*
* Copyright (C) 2002 Andreas Büsching <crunchy@tzi.de>
*
@@ -46,6 +46,7 @@ void mpiosh_signal_handler(int signal);
void mpiosh_readline_init(void);
char **mpiosh_readline_completion(const char *text, int start, int end);
char *mpiosh_readline_comp_cmd(const char *text, int state);
+int mpiosh_readline_cancel(void);
/* helper functions */
void mpiosh_init(void);