diff options
author | crunchy <crunchy> | 2002-09-19 22:23:01 +0000 |
---|---|---|
committer | crunchy <crunchy> | 2002-09-19 22:23:01 +0000 |
commit | 21ec3fac700bf50b8c5cfafa6b6b5a86599fa9e2 (patch) | |
tree | 1d59b665505bbf41c43f46f74433a27b6aef9fe7 | |
parent | cf208d020339d2c0e755d6de1a5b312328908a4e (diff) | |
download | mpiosh-21ec3fac700bf50b8c5cfafa6b6b5a86599fa9e2.tar.gz mpiosh-21ec3fac700bf50b8c5cfafa6b6b5a86599fa9e2.tar.bz2 mpiosh-21ec3fac700bf50b8c5cfafa6b6b5a86599fa9e2.zip |
bug fixes in error handling and fix in regex_fix
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | libmpio/mpio.c | 12 | ||||
-rw-r--r-- | libmpio/mpio.h | 4 | ||||
-rw-r--r-- | mpiosh/callback.c | 47 | ||||
-rw-r--r-- | mpiosh/mpiosh.c | 5 |
5 files changed, 56 insertions, 28 deletions
@@ -1,9 +1,23 @@ +2002-09-20 Andreas Buesching <crunchy@tzi.de> + + * mpiosh/mpiosh.c (mpiosh_command_regex_fix): bug fix for .* + do not quote the '.' if next character is a '*' + + * libmpio/mpio.c (mpio_strerror): fixed stupid bug no + 23.423.543.453.453 (time to go to bed) + +2002-09-19 Andreas Buesching <crunchy@tzi.de> + + * libmpio/mpio.c (mpio_strerror): fixed a strange bug with the + argument name. Never call an argument errno?!? + 2002-09-19 Markus Germeier <mager@tzi.de> * mpiosh/callback.c (mpiosh_cmd_dump, mpiosh_cmd_mget) (mpiosh_cmd_mdel, mpiosh_cmd_mput): fixed handling of an abort * libmpio/mpio.c (MPIO_ERR_RETURN): fixed buggy define + 2002-09-19 Andreas Buesching <crunchy@tzi.de> * mpiosh/mpiosh.c (mpiosh_command_regex_fix): hopefully fixed a @@ -17,7 +31,7 @@ (mpio_file_get, mpio_file_put, mpio_file_del): using error handling functions ->>>>>>> 1.40 + 2002-09-19 Markus Germeier <mager@tzi.de> * libmpio/mpio.c (mpio_init_internal): diff --git a/libmpio/mpio.c b/libmpio/mpio.c index f1637cc..f9da4b8 100644 --- a/libmpio/mpio.c +++ b/libmpio/mpio.c @@ -1,6 +1,6 @@ /* * - * $Id: mpio.c,v 1.22 2002/09/19 21:25:07 germeier Exp $ + * $Id: mpio.c,v 1.23 2002/09/19 22:23:01 crunchy Exp $ * * Library for USB MPIO-* * @@ -770,16 +770,14 @@ mpio_errno(void) } char * -mpio_strerror(int errno) +mpio_strerror(int err) { int i; - printf("mpio_strerror %d\n", errno); - - if (errno >= 0) return NULL; + if (err >= 0) return NULL; for (i = 0; i < mpio_error_num; i++) { - if (mpio_errors[i].id == errno) + if (mpio_errors[i].id == err) return mpio_errors[i].msg; } @@ -790,7 +788,7 @@ void mpio_perror(char *prefix) { char *msg = mpio_strerror(_mpio_errno); - + if (msg == NULL) return; if (prefix) diff --git a/libmpio/mpio.h b/libmpio/mpio.h index 7df2349..b3d781d 100644 --- a/libmpio/mpio.h +++ b/libmpio/mpio.h @@ -1,7 +1,7 @@ /* -*- linux-c -*- */ /* - * $Id: mpio.h,v 1.6 2002/09/19 20:46:02 crunchy Exp $ + * $Id: mpio.h,v 1.7 2002/09/19 22:23:01 crunchy Exp $ * * Library for USB MPIO-* * @@ -102,7 +102,7 @@ int mpio_memory_debug(mpio_t *, mpio_mem_t); int mpio_errno(void); /* returns the description of the error <errno> */ -char * mpio_strerror(int errno); +char * mpio_strerror(int err); /* prints the error message of the last error*/ void mpio_perror(char *prefix); diff --git a/mpiosh/callback.c b/mpiosh/callback.c index ec929dc..3e8cb13 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.14 2002/09/19 21:25:07 germeier Exp $ + * $Id: callback.c,v 1.15 2002/09/19 22:23:01 crunchy Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -240,20 +240,22 @@ mpiosh_callback_get(int read, int total) printf("\rretrieved %.2f %%", ((double) read / total) * 100.0 ); fflush(stdout); + if (mpiosh_cancel) + debug ("user cancelled operation\n"); + return mpiosh_cancel; // continue } void mpiosh_cmd_get(char *args[]) { - int size; - MPIOSH_CHECK_CONNECTION_CLOSED; MPIOSH_CHECK_ARG; - size = mpio_file_get(mpiosh.dev, mpiosh.card, args[0], mpiosh_callback_get); - - printf("\n"); + if (mpio_file_get(mpiosh.dev, mpiosh.card, args[0], + mpiosh_callback_get) == -1) { + mpio_perror("error"); + } } void @@ -287,11 +289,12 @@ mpiosh_cmd_mget(char *args[]) if (!(error = regexec(®ex, fname, 0, NULL, 0))) { printf("getting '%s' ... \n", fname); - if ((size = mpio_file_get(mpiosh.dev, mpiosh.card, + if ((mpio_file_get(mpiosh.dev, mpiosh.card, fname, mpiosh_callback_put)) == -1) { - mpio_perror("error"); - break; - } + debug("cancelled operation\n"); + mpio_perror("error"); + break; + } if (mpiosh_cancel) { debug("operation cancelled by user\n"); break; @@ -324,14 +327,16 @@ void mpiosh_cmd_put(char *args[]) { int size; - + MPIOSH_CHECK_CONNECTION_CLOSED; MPIOSH_CHECK_ARG; - size = mpio_file_put(mpiosh.dev, mpiosh.card, args[0], mpiosh_callback_put); - mpio_sync(mpiosh.dev, mpiosh.card); - - printf("\n"); + if ((size = mpio_file_put(mpiosh.dev, mpiosh.card, args[0], + mpiosh_callback_put)) == -1) { + mpio_perror("error"); + } else { + mpio_sync(mpiosh.dev, mpiosh.card); + } } void @@ -340,6 +345,7 @@ mpiosh_cmd_mput(char *args[]) char dir_buf[NAME_MAX]; int size, j, i = 0; struct dirent ** dentry, **run; + struct stat st; regex_t regex; int error; BYTE errortext[100]; @@ -359,6 +365,17 @@ mpiosh_cmd_mput(char *args[]) if ((size = scandir(dir_buf, &dentry, NULL, alphasort)) != -1) { run = dentry; for (j = 0; ((j < size) && (!mpiosh_cancel)); j++, run++) { + if (stat((*run)->d_name, &st) == -1) { + free(*run); + continue; + } else { + if (!S_ISREG(st.st_mode)) { + debugn(2, "not a regular file: '%s'\n", (*run)->d_name); + free(*run); + continue; + } + } + if (!(error = regexec(®ex, (*run)->d_name, 0, NULL, 0))) { printf("putting '%s' ... \n", (*run)->d_name); if (mpio_file_put(mpiosh.dev, mpiosh.card, diff --git a/mpiosh/mpiosh.c b/mpiosh/mpiosh.c index 83c45fb..fa2f75f 100644 --- a/mpiosh/mpiosh.c +++ b/mpiosh/mpiosh.c @@ -2,7 +2,7 @@ /* * - * $Id: mpiosh.c,v 1.15 2002/09/19 21:02:45 crunchy Exp $ + * $Id: mpiosh.c,v 1.16 2002/09/19 22:23:01 crunchy Exp $ * * Author: Andreas Büsching <crunchy@tzi.de> * @@ -259,7 +259,7 @@ mpiosh_command_regex_fix(char *argv[]) if (*help == '*' && ((help == *walk) || (*(help - 1) != '.'))) { *new_pos++ = '.'; *new_pos = *help; - } else if ((*help == '.') && (*help != '*')) { + } else if ((*help == '.') && (*(help + 1) != '*')) { *new_pos++ = '\\'; *new_pos = *help; } else if (*help == '?' && ((help == *walk) || (*(help - 1) != '\\'))) { @@ -273,7 +273,6 @@ mpiosh_command_regex_fix(char *argv[]) *new_pos = '$'; free(*walk); *walk = strdup(buffer); - printf("new regex: '%s'\n", *walk); walk++; } |