diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | libmpio/defs.h | 4 | ||||
-rw-r--r-- | libmpio/mpio.c | 24 | ||||
-rw-r--r-- | mpiosh/callback.c | 21 | ||||
-rw-r--r-- | mpiosh/mpiosh.c | 3 |
5 files changed, 37 insertions, 18 deletions
@@ -1,3 +1,6 @@ +2003-04-12 Markus Germeier <mager@tzi.de> + * small error messages changes + 2003-04-11 Markus Germeier <mager@tzi.de> * libmpio/directory.c (mpio_directory_make): diff --git a/libmpio/defs.h b/libmpio/defs.h index 1dcb1d4..baecc7f 100644 --- a/libmpio/defs.h +++ b/libmpio/defs.h @@ -1,7 +1,7 @@ /* -*- linux-c -*- */ /* - * $Id: defs.h,v 1.19 2003/04/11 21:42:57 germeier Exp $ + * $Id: defs.h,v 1.20 2003/04/11 22:53:10 germeier Exp $ * * Library for USB MPIO-* * @@ -145,6 +145,8 @@ typedef struct { #define MPIO_ERR_DIR_NOT_A_DIR -10 #define MPIO_ERR_DIR_NAME_ERROR -11 #define MPIO_ERR_DIR_NOT_EMPTY -12 +#define MPIO_ERR_DEVICE_NOT_READY -13 +#define MPIO_ERR_OUT_OF_MEMORY -14 /* internal errors, occur when UI has errors! */ #define MPIO_ERR_INT_STRING_INVALID -101 diff --git a/libmpio/mpio.c b/libmpio/mpio.c index 8665396..a3b177b 100644 --- a/libmpio/mpio.c +++ b/libmpio/mpio.c @@ -1,6 +1,6 @@ /* * - * $Id: mpio.c,v 1.49 2003/04/11 21:42:57 germeier Exp $ + * $Id: mpio.c,v 1.50 2003/04/11 22:53:10 germeier Exp $ * * Library for USB MPIO-* * @@ -91,6 +91,12 @@ static mpio_error_t mpio_errors[] = { "The selected directory name is not allowed." }, { MPIO_ERR_DIR_NOT_EMPTY, "The selected directory is not empty." }, + { MPIO_ERR_DEVICE_NOT_READY, + "Could not open " MPIO_DEVICE "\n" + "Verify that the mpio module is loaded and " + "your MPIO is\nconnected and powered up.\n" }, + { MPIO_ERR_OUT_OF_MEMORY, + "Out of Memory." }, { MPIO_ERR_INT_STRING_INVALID, "Internal Error: Supported is invalid!" } }; @@ -277,11 +283,7 @@ mpio_init(mpio_callback_init_t progress_callback) new_mpio->fd = open(MPIO_DEVICE, O_RDWR); if (new_mpio->fd < 0) { - - debug("Could not open %s\n" - "Verify that the mpio module is loaded and " - "your MPIO is\nconnected and powered up.\n\n" , MPIO_DEVICE); - + _mpio_errno = MPIO_ERR_DEVICE_NOT_READY; return NULL; } @@ -604,7 +606,8 @@ mpio_file_get_real(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename, utime(filename, &utbuf); } else { - debug("unable to locate the file: %s\n", filename); + debugn(2, "unable to locate the file: %s\n", filename); + _mpio_errno=MPIO_ERR_FILE_NOT_FOUND; } return (fsize-filesize); @@ -1053,7 +1056,7 @@ mpio_file_del(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename, (strcmp(filename, ".") == 0)) { debugn(2, "directory name not allowed: %s\n", filename); - return MPIO_ERR_DIR_NAME_ERROR; + MPIO_ERR_RETURN(MPIO_ERR_DIR_NAME_ERROR); } /* find file */ @@ -1072,7 +1075,7 @@ mpio_file_del(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename, if (mpio_directory_is_empty(m, mem, sm->cdir) != MPIO_OK) { mpio_directory_cd(m, mem, ".."); - return MPIO_ERR_DIR_NOT_EMPTY; + MPIO_ERR_RETURN(MPIO_ERR_DIR_NOT_EMPTY); } else { mpio_directory_cd(m, mem, ".."); } @@ -1115,7 +1118,8 @@ mpio_file_del(mpio_t *m, mpio_mem_t mem, mpio_filename_t filename, free(f); } else { - debug("unable to locate the file: %s\n", filename); + debugn(2, "unable to locate the file: %s\n", filename); + MPIO_ERR_RETURN(MPIO_ERR_FILE_NOT_FOUND); } mpio_dentry_delete(m, mem, filename); diff --git a/mpiosh/callback.c b/mpiosh/callback.c index 8006e5f..28c0284 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.36 2003/04/11 21:42:58 germeier Exp $ + * $Id: callback.c,v 1.37 2003/04/11 22:53:10 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -240,10 +240,13 @@ mpiosh_cmd_open(char *args[]) UNUSED(args); mpiosh.dev = mpio_init(mpiosh_callback_init); + printf("\n"); - if (mpiosh.dev == NULL) - printf("error: could not open connection MPIO player\n"); + if (mpiosh.dev == NULL) { + mpio_perror("ERROR"); + printf("could not open connection MPIO player\n"); + } else printf("connection to MPIO player is opened\n"); @@ -484,8 +487,11 @@ mpiosh_cmd_mput(char *args[]) if (mpiosh_cancel) debug("operation cancelled by user\n"); - if (written) + if (written) { mpio_sync(mpiosh.dev, mpiosh.card); + } else { + printf("file not found!\n"); + } } BYTE @@ -560,7 +566,7 @@ mpiosh_cmd_mdel(char *args[]) because the directory has changed !! */ if (r != MPIO_OK) { - printf("ERROR: %s\n", mpio_strerror(r)); + mpio_perror("ERROR"); p = mpio_dentry_next(mpiosh.dev, mpiosh.card, p); break; } @@ -576,8 +582,11 @@ mpiosh_cmd_mdel(char *args[]) i++; } regfree(®ex); - if (deleted) + if (deleted) { mpio_sync(mpiosh.dev, mpiosh.card); + } else { + printf("file not found!\n"); + } } diff --git a/mpiosh/mpiosh.c b/mpiosh/mpiosh.c index 2f39c04..5ddf5c6 100644 --- a/mpiosh/mpiosh.c +++ b/mpiosh/mpiosh.c @@ -2,7 +2,7 @@ /* * - * $Id: mpiosh.c,v 1.23 2002/11/13 23:05:28 germeier Exp $ + * $Id: mpiosh.c,v 1.24 2003/04/11 22:53:10 germeier Exp $ * * Author: Andreas Büsching <crunchy@tzi.de> * @@ -108,6 +108,7 @@ main(int argc, char *argv[]) { } if (!mpiosh.dev && interactive) { + printf("ERROR: %s\n", mpio_strerror(mpio_errno())); printf("could not find MPIO player.\n"); } |