From 7935e28c8e5956849f1a1432dc7ae8e5ef4ea414 Mon Sep 17 00:00:00 2001 From: germeier Date: Sat, 19 Apr 2003 23:58:02 +0000 Subject: added function(s) to rename files on the player --- mpiosh/callback.c | 21 ++++++++++++++++++++- mpiosh/callback.h | 3 ++- mpiosh/global.c | 7 +++++-- 3 files changed, 27 insertions(+), 4 deletions(-) (limited to 'mpiosh') diff --git a/mpiosh/callback.c b/mpiosh/callback.c index 337d1d2..768222a 100644 --- a/mpiosh/callback.c +++ b/mpiosh/callback.c @@ -2,7 +2,7 @@ * * Author: Andreas Büsching * - * $Id: callback.c,v 1.40 2003/04/19 11:41:26 germeier Exp $ + * $Id: callback.c,v 1.41 2003/04/19 23:58:02 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -736,6 +736,25 @@ mpiosh_cmd_switch(char *args[]) } +void +mpiosh_cmd_rename(char *args[]) +{ + MPIOSH_CHECK_CONNECTION_CLOSED; + + if(args[0] && args[1] && !args[2]) { + if ((mpio_file_rename(mpiosh.dev, mpiosh.card, + args[0], args[1])) == -1) { + mpio_perror("error"); + } else { + mpio_sync(mpiosh.dev, mpiosh.card); + } + + } else { + fprintf(stderr, "error: wrong number of arguments given\n"); + printf("rename \n"); + } +} + void mpiosh_cmd_dump_mem(char *args[]) { diff --git a/mpiosh/callback.h b/mpiosh/callback.h index 8d6be74..3d1c8f8 100644 --- a/mpiosh/callback.h +++ b/mpiosh/callback.h @@ -2,7 +2,7 @@ * * Author: Andreas Büsching * - * $Id: callback.h,v 1.10 2003/04/19 09:32:48 germeier Exp $ + * $Id: callback.h,v 1.11 2003/04/19 23:58:02 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -49,6 +49,7 @@ void mpiosh_cmd_dump(char *args[]); void mpiosh_cmd_free(char *args[]); void mpiosh_cmd_format(char *args[]); void mpiosh_cmd_switch(char *args[]); +void mpiosh_cmd_rename(char *args[]); void mpiosh_cmd_dump_mem(char *args[]); void mpiosh_cmd_health(char *args[]); void mpiosh_cmd_config(char *args[]); diff --git a/mpiosh/global.c b/mpiosh/global.c index 2f10870..0047627 100644 --- a/mpiosh/global.c +++ b/mpiosh/global.c @@ -2,7 +2,7 @@ * * Author: Andreas Buesching * - * $Id: global.c,v 1.10 2003/04/19 09:32:48 germeier Exp $ + * $Id: global.c,v 1.11 2003/04/19 23:58:02 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -50,7 +50,7 @@ struct mpiosh_cmd_t commands[] = { { "ver", NULL, NULL, " version of mpio package", mpiosh_cmd_version, NULL }, - { "help", NULL, "[]", + { "help", (char *[]){ "?", NULL }, "[]", " show information about known commands or just about ", mpiosh_cmd_help, mpiosh_readline_comp_cmd }, { "dir", (char *[]){ "ls", "ll", NULL }, NULL, @@ -105,6 +105,9 @@ struct mpiosh_cmd_t commands[] = { { "switch", NULL, " ", " switches the order of two files", mpiosh_cmd_switch, mpiosh_readline_comp_mpio_file }, + { "rename", (char *[]){ "ren", NULL }, " ", + " renames a file on the current memory card", + mpiosh_cmd_rename, mpiosh_readline_comp_mpio_file }, { "ldir", (char *[]){ "lls", NULL }, NULL, " list local directory", mpiosh_cmd_ldir, NULL }, -- cgit v1.2.3