From 53a51993489a4d519fd54a01167f804325661ded Mon Sep 17 00:00:00 2001 From: germeier Date: Tue, 1 Jul 2003 09:06:11 +0000 Subject: return/display file type/tag for files from internal memory (as requested by Markus) --- ChangeLog | 7 +++++++ libmpio/src/directory.c | 7 ++++++- mpiosh/callback.c | 30 ++++++++++++++++++++++++++++-- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c27c1b..baf625a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-07-01 Markus Germeier + * mpiosh/callback.c(mpiosh_ftyp2ascii): added function + * mpiosh/callback.c(mpiosh_cmd_dir): + * libmpio/src/directory.c (mpio_dentry_get_real): + return/display file type/tag for files from internal memory + (as requested by Markus) + 2003-06-27 Andreas Buesching * mpiosh/callback.c (mpiosh_cmd_backup): using the resolved backup diff --git a/libmpio/src/directory.c b/libmpio/src/directory.c index 394e193..c907941 100644 --- a/libmpio/src/directory.c +++ b/libmpio/src/directory.c @@ -1,5 +1,5 @@ /* - * $Id: directory.c,v 1.6 2003/06/26 19:53:58 germeier Exp $ + * $Id: directory.c,v 1.7 2003/07/01 09:06:11 germeier Exp $ * * libmpio - a library for accessing Digit@lways MPIO players * Copyright (C) 2002, 2003 Markus Germeier @@ -690,6 +690,7 @@ mpio_dentry_get_real(mpio_t *m, mpio_mem_t mem, BYTE *buffer, int slots = 0; int in = 0, out = 0, iconv_return; mpio_dir_entry_t *dentry; + mpio_fatentry_t *f; mpio_dir_slot_t *slot; BYTE *unicode = 0; BYTE *uc; @@ -801,6 +802,10 @@ mpio_dentry_get_real(mpio_t *m, mpio_mem_t mem, BYTE *buffer, *type = FTYPE_DIR; } else { *type = FTYPE_PLAIN; + if (mem == MPIO_INTERNAL_MEM) { + f = mpio_dentry_get_startcluster(m, mem, buffer); + *type = m->internal.fat[f->entry * 0x10 + 0x06]; + } } return(((BYTE *)dentry) - buffer); diff --git a/mpiosh/callback.c b/mpiosh/callback.c index 90eeec7..2404850 100644 --- a/mpiosh/callback.c +++ b/mpiosh/callback.c @@ -2,7 +2,7 @@ * * Author: Andreas Büsching * - * $Id: callback.c,v 1.44 2003/06/27 13:40:23 crunchy Exp $ + * $Id: callback.c,v 1.45 2003/07/01 09:06:11 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching * @@ -37,6 +37,31 @@ #include "libmpio/debug.h" +/* helper */ +BYTE +mpiosh_ftype2ascii(BYTE ftype) { + switch(ftype) + { + case FTYPE_CONF: + case FTYPE_FONT: + case FTYPE_OTHER: + case FTYPE_MEMO: + case FTYPE_WAV: + case FTYPE_ENTRY: + case FTYPE_DIR: + case FTYPE_PLAIN: + return ftype; + case FTYPE_CHAN: + return 'c'; + case FTYPE_MUSIC: + return '-'; + default: + return '?'; + } + return '?'; +} + + /* commands */ void mpiosh_cmd_debug(char *args[]) @@ -142,7 +167,8 @@ mpiosh_cmd_dir(char *args[]) &type); printf ("%02d.%02d.%04d %02d:%02d %9d %c %s\n", - day, month, year, hour, minute, fsize, type, fname); + day, month, year, hour, minute, fsize, + mpiosh_ftype2ascii(type), fname); p = mpio_dentry_next(mpiosh.dev, mpiosh.card, p); } -- cgit v1.2.3