aboutsummaryrefslogtreecommitdiff
path: root/mpiosh
diff options
context:
space:
mode:
authorgermeier <germeier>2003-04-06 23:09:19 +0000
committergermeier <germeier>2003-04-06 23:09:19 +0000
commit50c439ffa36fed9e1cce65b211ec05bf50925cc2 (patch)
tree923c967c689a873b2497d5daf007531e194c61fc /mpiosh
parentc4c88c7d7227834fe2d94f507d01cfafabe885b9 (diff)
downloadmpiosh-50c439ffa36fed9e1cce65b211ec05bf50925cc2.tar.gz
mpiosh-50c439ffa36fed9e1cce65b211ec05bf50925cc2.tar.bz2
mpiosh-50c439ffa36fed9e1cce65b211ec05bf50925cc2.zip
initial support for directories
BEWARE: this might have broken some things!!!
Diffstat (limited to 'mpiosh')
-rw-r--r--mpiosh/callback.c63
-rw-r--r--mpiosh/callback.h5
-rw-r--r--mpiosh/global.c11
-rw-r--r--mpiosh/readline.c6
4 files changed, 69 insertions, 16 deletions
diff --git a/mpiosh/callback.c b/mpiosh/callback.c
index fd86825..c3e82d4 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.34 2003/03/08 17:28:20 germeier Exp $
+ * $Id: callback.c,v 1.35 2003/04/06 23:09:20 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -120,7 +120,7 @@ void
mpiosh_cmd_dir(char *args[])
{
BYTE *p;
- BYTE month, day, hour, minute;
+ BYTE month, day, hour, minute, type;
BYTE fname[100];
WORD year;
DWORD fsize;
@@ -136,16 +136,57 @@ mpiosh_cmd_dir(char *args[])
mpio_dentry_get(mpiosh.dev, mpiosh.card, p,
fname, 100,
&year, &month, &day,
- &hour, &minute, &fsize);
+ &hour, &minute, &fsize,
+ &type);
- printf ("%02d.%02d.%04d %02d:%02d %9d - %s\n",
- day, month, year, hour, minute, fsize, fname);
+ printf ("%02d.%02d.%04d %02d:%02d %9d %c %s\n",
+ day, month, year, hour, minute, fsize, type, fname);
p = mpio_dentry_next(mpiosh.dev, mpiosh.card, p);
}
}
void
+mpiosh_cmd_pwd(char *args[])
+{
+ BYTE pwd[INFO_LINE];
+
+ UNUSED(args);
+
+ MPIOSH_CHECK_CONNECTION_CLOSED;
+
+ mpio_directory_pwd(mpiosh.dev, mpiosh.card, pwd);
+ printf ("%s\n", pwd);
+
+}
+
+void
+mpiosh_cmd_mkdir(char *args[])
+{
+ BYTE pwd[INFO_LINE];
+
+ MPIOSH_CHECK_CONNECTION_CLOSED;
+
+ mpio_directory_make(mpiosh.dev, mpiosh.card, args[0]);
+ mpio_sync(mpiosh.dev, mpiosh.card);
+
+}
+
+void
+mpiosh_cmd_cd(char *args[])
+{
+ BYTE pwd[INFO_LINE];
+
+ MPIOSH_CHECK_CONNECTION_CLOSED;
+
+ mpio_directory_cd(mpiosh.dev, mpiosh.card, args[0]);
+
+ mpio_directory_pwd(mpiosh.dev, mpiosh.card, pwd);
+ printf ("directory is now: %s\n", pwd);
+
+}
+
+void
mpiosh_cmd_info(char *args[])
{
mpio_info_t info;
@@ -296,7 +337,7 @@ mpiosh_cmd_mget(char *args[])
regex_t regex;
BYTE fname[100];
BYTE errortext[100];
- BYTE month, day, hour, minute;
+ BYTE month, day, hour, minute, type;
WORD year;
DWORD fsize;
int found;
@@ -316,7 +357,7 @@ mpiosh_cmd_mget(char *args[])
while (p != NULL) {
memset(fname, '\0', 100);
mpio_dentry_get(mpiosh.dev, mpiosh.card, p, fname, 100,
- &year, &month, &day, &hour, &minute, &fsize);
+ &year, &month, &day, &hour, &minute, &fsize, &type);
if (!(error = regexec(&regex, fname, 0, NULL, 0))) {
found = 1;
@@ -482,7 +523,7 @@ mpiosh_cmd_mdel(char *args[])
regex_t regex;
BYTE fname[100];
BYTE errortext[100];
- BYTE month, day, hour, minute;
+ BYTE month, day, hour, minute, type;
WORD year;
DWORD fsize;
int deleted = 0;
@@ -500,7 +541,7 @@ mpiosh_cmd_mdel(char *args[])
while ((p != NULL) && (!mpiosh_cancel)) {
memset(fname, '\0', 100);
mpio_dentry_get(mpiosh.dev, mpiosh.card, p, fname, 100,
- &year, &month, &day, &hour, &minute, &fsize);
+ &year, &month, &day, &hour, &minute, &fsize, &type);
if (!(error = regexec(&regex, fname, 0, NULL, 0))) {
/* this line has to be above the del, or we won't write
@@ -535,7 +576,7 @@ void
mpiosh_cmd_dump(char *args[])
{
BYTE *p;
- BYTE month, day, hour, minute;
+ BYTE month, day, hour, minute, type;
BYTE fname[256];
char *arg[2];
WORD year;
@@ -555,7 +596,7 @@ mpiosh_cmd_dump(char *args[])
mpio_dentry_get(mpiosh.dev, mpiosh.card, p,
fname, 256,
&year, &month, &day,
- &hour, &minute, &fsize);
+ &hour, &minute, &fsize, &type);
mpiosh_cmd_mget(arg);
diff --git a/mpiosh/callback.h b/mpiosh/callback.h
index eefbd31..ac9862c 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.7 2002/10/27 02:45:28 germeier Exp $
+ * $Id: callback.h,v 1.8 2003/04/06 23:09:20 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -31,6 +31,9 @@ void mpiosh_cmd_debug(char *args[]);
void mpiosh_cmd_version(char *args[]);
void mpiosh_cmd_help(char *args[]);
void mpiosh_cmd_dir(char *args[]);
+void mpiosh_cmd_pwd(char *args[]);
+void mpiosh_cmd_mkdir(char *args[]);
+void mpiosh_cmd_cd(char *args[]);
void mpiosh_cmd_info(char *args[]);
void mpiosh_cmd_mem(char *args[]);
void mpiosh_cmd_open(char *args[]);
diff --git a/mpiosh/global.c b/mpiosh/global.c
index 0d8e374..4bfe7b5 100644
--- a/mpiosh/global.c
+++ b/mpiosh/global.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Buesching <crunchy@tzi.de>
*
- * $Id: global.c,v 1.7 2003/03/06 23:41:30 germeier Exp $
+ * $Id: global.c,v 1.8 2003/04/06 23:09:20 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -56,6 +56,15 @@ struct mpiosh_cmd_t commands[] = {
{ "dir", (char *[]){ "ls", "ll", NULL }, NULL,
" list content of current memory card",
mpiosh_cmd_dir, NULL },
+ { "pwd", NULL, NULL,
+ " print the current working directory",
+ mpiosh_cmd_pwd, NULL },
+ { "mkdir", (char *[]){ "md", NULL }, "<directory>",
+ " make a new directory",
+ mpiosh_cmd_mkdir, mpiosh_readline_comp_mpio_file },
+ { "cd", NULL, "<directory>",
+ " change the current working directory",
+ mpiosh_cmd_cd, mpiosh_readline_comp_mpio_file },
{ "info", NULL, NULL,
" show information about MPIO player",
mpiosh_cmd_info, NULL },
diff --git a/mpiosh/readline.c b/mpiosh/readline.c
index 8b97219..d10209b 100644
--- a/mpiosh/readline.c
+++ b/mpiosh/readline.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: readline.c,v 1.5 2002/10/29 20:03:35 crunchy Exp $
+ * $Id: readline.c,v 1.6 2003/04/06 23:09:20 germeier Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -84,7 +84,7 @@ mpiosh_readline_comp_mpio_file(const char *text, int state)
{
static BYTE *p;
char *arg = NULL;
- BYTE month, day, hour, minute;
+ BYTE month, day, hour, minute, type;
char fname[100];
WORD year;
DWORD fsize;
@@ -102,7 +102,7 @@ mpiosh_readline_comp_mpio_file(const char *text, int state)
mpio_dentry_get(mpiosh.dev, mpiosh.card, p,
fname, 100,
&year, &month, &day,
- &hour, &minute, &fsize);
+ &hour, &minute, &fsize, &type);
if (strstr(fname, text) == fname) {
arg = strdup(fname);