diff options
Diffstat (limited to 'mpiosh')
-rw-r--r-- | mpiosh/callback.c | 27 | ||||
-rw-r--r-- | mpiosh/callback.h | 3 | ||||
-rw-r--r-- | mpiosh/mpiosh.c | 5 |
3 files changed, 27 insertions, 8 deletions
diff --git a/mpiosh/callback.c b/mpiosh/callback.c index df4a3ab..bdcb345 100644 --- a/mpiosh/callback.c +++ b/mpiosh/callback.c @@ -2,7 +2,7 @@ * * Author: Andreas Büsching <crunchy@tzi.de> * - * $Id: callback.c,v 1.9 2002/09/18 20:32:22 crunchy Exp $ + * $Id: callback.c,v 1.10 2002/09/18 22:18:29 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -160,13 +160,20 @@ mpiosh_cmd_info(char *args[]) void mpiosh_cmd_mem(char *args[]) { + int free; + MPIOSH_CHECK_CONNECTION_CLOSED; MPIOSH_CHECK_ARG; if (!strcmp(args[0], "e")) { - mpiosh.card = MPIO_EXTERNAL_MEM; - mpiosh.prompt = PROMPT_EXT; - printf("external memory card is selected\n"); + if (mpio_memory_free(mpiosh.dev, mpiosh.card, &free)) { + mpiosh.card = MPIO_EXTERNAL_MEM; + mpiosh.prompt = PROMPT_EXT; + printf("external memory card is selected\n"); + } else { + printf("no external memory card is available\n"); + } + } else if (!strcmp(args[0], "i")) { mpiosh.card = MPIO_INTERNAL_MEM; mpiosh.prompt = PROMPT_INT; @@ -183,7 +190,8 @@ mpiosh_cmd_open(char *args[]) UNUSED(args); - mpiosh.dev = mpio_init(); + mpiosh.dev = mpio_init(mpiosh_callback_init); + printf("\n"); if (mpiosh.dev == NULL) printf("error: could not open connection MPIO player\n"); @@ -218,6 +226,15 @@ mpiosh_cmd_quit(char *args[]) } BYTE +mpiosh_callback_init(int read, int total) +{ + printf("\rinitialized %.2f %%", ((double) read / total) * 100.0 ); + fflush(stdout); + + return mpiosh_cancel; // continue +} + +BYTE mpiosh_callback_get(int read, int total) { printf("\rretrieved %.2f %%", ((double) read / total) * 100.0 ); diff --git a/mpiosh/callback.h b/mpiosh/callback.h index 92642fa..08a756c 100644 --- a/mpiosh/callback.h +++ b/mpiosh/callback.h @@ -2,7 +2,7 @@ * * Author: Andreas Büsching <crunchy@tzi.de> * - * $Id: callback.h,v 1.3 2002/09/15 12:03:23 germeier Exp $ + * $Id: callback.h,v 1.4 2002/09/18 22:18:29 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -55,6 +55,7 @@ void mpiosh_cmd_lcd(char *args[]); void mpiosh_cmd_lmkdir(char *args[]); /* progress callbacks */ +BYTE mpiosh_callback_init(int read, int total); BYTE mpiosh_callback_get(int read, int total); BYTE mpiosh_callback_put(int read, int total); BYTE mpiosh_callback_del(int read, int total); diff --git a/mpiosh/mpiosh.c b/mpiosh/mpiosh.c index 10e518e..aa4ff2d 100644 --- a/mpiosh/mpiosh.c +++ b/mpiosh/mpiosh.c @@ -2,7 +2,7 @@ /* * - * $Id: mpiosh.c,v 1.13 2002/09/18 20:32:22 crunchy Exp $ + * $Id: mpiosh.c,v 1.14 2002/09/18 22:18:29 germeier Exp $ * * Author: Andreas Büsching <crunchy@tzi.de> * @@ -418,7 +418,8 @@ main(int argc, char *argv[]) { debug_init(); mpiosh_init(); - mpiosh.dev = mpio_init(); + mpiosh.dev = mpio_init(mpiosh_callback_init); + printf("\n"); if (mpiosh.card == MPIO_INTERNAL_MEM) mpiosh.prompt = PROMPT_INT; |