aboutsummaryrefslogtreecommitdiff
path: root/mpiosh
diff options
context:
space:
mode:
Diffstat (limited to 'mpiosh')
-rw-r--r--mpiosh/callback.c6
-rw-r--r--mpiosh/mpiosh.c59
-rw-r--r--mpiosh/mpiosh.h5
3 files changed, 63 insertions, 7 deletions
diff --git a/mpiosh/callback.c b/mpiosh/callback.c
index deaec72..00163e4 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.4 2002/09/13 19:06:30 crunchy Exp $
+ * $Id: callback.c,v 1.5 2002/09/14 11:19:30 crunchy Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -253,6 +253,8 @@ mpiosh_cmd_mget(char *args[])
MPIOSH_CHECK_CONNECTION_CLOSED;
MPIOSH_CHECK_ARG;
+
+ mpiosh_command_regex_fix(args);
while (args[i] != NULL) {
if ((error = regcomp(&regex, args[i], REG_NOSUB))) {
@@ -323,6 +325,7 @@ mpiosh_cmd_mput(char *args[])
MPIOSH_CHECK_CONNECTION_CLOSED;
MPIOSH_CHECK_ARG;
+ mpiosh_command_regex_fix(args);
getcwd(dir_buf, NAME_MAX);
while (args[i] != NULL) {
if ((error = regcomp(&regex, args[i], REG_NOSUB))) {
@@ -396,6 +399,7 @@ mpiosh_cmd_mdel(char *args[])
MPIOSH_CHECK_CONNECTION_CLOSED;
MPIOSH_CHECK_ARG;
+ mpiosh_command_regex_fix(args);
while (args[i] != NULL) {
if ((error = regcomp(&regex, args[i], REG_NOSUB))) {
regerror(error, &regex, errortext, 100);
diff --git a/mpiosh/mpiosh.c b/mpiosh/mpiosh.c
index 7f8c359..75a01b4 100644
--- a/mpiosh/mpiosh.c
+++ b/mpiosh/mpiosh.c
@@ -2,7 +2,7 @@
/*
*
- * $Id: mpiosh.c,v 1.6 2002/09/14 09:55:31 crunchy Exp $
+ * $Id: mpiosh.c,v 1.7 2002/09/14 11:19:30 crunchy Exp $
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
@@ -183,7 +183,7 @@ mpiosh_init(void)
}
char **
-mpiosh_command_split(char *line)
+mpiosh_command_split_line(char *line)
{
char **cmds, *cmd;
int count = 1;
@@ -240,6 +240,54 @@ mpiosh_command_find(char *line)
return NULL;
}
+void
+mpiosh_command_regex_fix(char *argv[])
+{
+ char **walk;
+ char *new, *new_pos, *help;
+ char find[] = { '.', '*' };
+ char *replace[] = { "\\.", ".*" };
+ int count, i;
+
+ for (i = 0; i < sizeof find; i++) {
+ walk = argv;
+ while (*walk) {
+ help = *walk, count = 0;
+ while (*help != '\0')
+ if (*help++ == find[i]) count++;
+ new_pos = new = malloc(strlen(*walk) + 1 + count);
+ help = *walk;
+ while (*help != '\0') {
+ if (*help == find[i]) {
+ *new_pos++ = replace[i][0];
+ *new_pos++ = replace[i][1];
+ help++;
+ } else
+ *new_pos++ = *help++;
+ }
+ *new_pos = '\0';
+ free(*walk);
+ *walk = new;
+ walk++;
+ }
+ }
+
+ walk = argv;
+ while (*walk) {
+ help = *walk;
+ new = malloc(strlen(help) + 3);
+ *walk = new;
+
+ *new++ = '^';
+ strcpy(new, help);
+ *(new + strlen(help)) = '$';
+ *(new + strlen(help) + 1) = '\0';
+
+ free(help);
+ walk++;
+ }
+}
+
char **
mpiosh_command_get_args(char *line)
{
@@ -347,7 +395,10 @@ mpiosh_signal_handler(int signal)
mpiosh_cancel = 1;
}
-void mpiosh_noredisplay(void) {}
+void
+mpiosh_noredisplay(void)
+{
+}
int
main(int argc, char *argv[]) {
@@ -400,7 +451,7 @@ main(int argc, char *argv[]) {
continue;
}
- cmds = mpiosh_command_split(line);
+ cmds = mpiosh_command_split_line(line);
if (cmds[0][0] == '\0') {
free(cmds);
diff --git a/mpiosh/mpiosh.h b/mpiosh/mpiosh.h
index 944e73d..a983293 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.4 2002/09/14 09:55:31 crunchy Exp $
+ * $Id: mpiosh.h,v 1.5 2002/09/14 11:19:30 crunchy Exp $
*
* Copyright (C) 2002 Andreas Büsching <crunchy@tzi.de>
*
@@ -51,8 +51,9 @@ int mpiosh_readline_cancel(void);
/* helper functions */
void mpiosh_init(void);
mpiosh_cmd_t *mpiosh_command_find(char *line);
-char **mpiosh_command_split(char *line);
+char **mpiosh_command_split_line(char *line);
char **mpiosh_command_get_args(char *line);
+void mpiosh_command_regex_fix(char *argv[]);
void mpiosh_command_free_args(char **args);
/* global structures */