diff options
author | germeier <germeier> | 2002-11-13 23:05:27 +0000 |
---|---|---|
committer | germeier <germeier> | 2002-11-13 23:05:27 +0000 |
commit | bdc5a205df74582d4b41bd0390131f538ba58b09 (patch) | |
tree | e627d8603b8201a182203e8dfb0d63d4435ea98b /mpiosh | |
parent | 4b1237e6d4fc6ca2e5ffe10946c92fe2e5484be0 (diff) | |
download | mpiosh-bdc5a205df74582d4b41bd0390131f538ba58b09.tar.gz mpiosh-bdc5a205df74582d4b41bd0390131f538ba58b09.tar.bz2 mpiosh-bdc5a205df74582d4b41bd0390131f538ba58b09.zip |
changed default charset from ASCII to ISO-8859-15
make charset configurable through config file
Diffstat (limited to 'mpiosh')
-rw-r--r-- | mpiosh/callback.c | 49 | ||||
-rw-r--r-- | mpiosh/config.c | 10 | ||||
-rw-r--r-- | mpiosh/config.h | 3 | ||||
-rw-r--r-- | mpiosh/mpiosh.c | 6 |
4 files changed, 58 insertions, 10 deletions
diff --git a/mpiosh/callback.c b/mpiosh/callback.c index b43d0c4..a88bbc9 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.31 2002/11/04 16:25:17 crunchy Exp $ + * $Id: callback.c,v 1.32 2002/11/13 23:05:28 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -212,6 +212,10 @@ mpiosh_cmd_open(char *args[]) printf("error: could not open connection MPIO player\n"); else printf("connection to MPIO player is opened\n"); + + if ((mpiosh.dev) && (mpiosh.config->charset)) + mpio_charset_set(mpiosh.dev, mpiosh.config->charset); + } void @@ -592,27 +596,58 @@ void mpiosh_cmd_format(char *args[]) { char answer[512]; + BYTE *config, *fmconfig; + int csize, fmsize; MPIOSH_CHECK_CONNECTION_CLOSED; UNUSED(args); - printf("WARNING\n"); - printf("Support for formatting memory is not complete and has" - " some known issues!!\n"); - printf("WARNING\n"); - printf("This will destroy all tracks saved on the memory card. " "Are you sure (y/n)? "); fgets(answer, 511, stdin); if (answer[0] == 'y' || answer[0] == 'Y') { + if (mpiosh.card == MPIO_INTERNAL_MEM) { + /* save config files and write them back after formatting */ + config = NULL; + fmconfig = NULL; + + csize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM, + MPIO_CONFIG_FILE, NULL, &config); + fmsize = mpio_file_get_to_memory(mpiosh.dev, MPIO_INTERNAL_MEM, + MPIO_CHANNEL_FILE, NULL, &fmconfig); + } + if (mpio_memory_format(mpiosh.dev, mpiosh.card, mpiosh_callback_format) == -1) printf("\nfailed\n"); - else + else { printf("\n"); + + if (mpiosh.card == MPIO_INTERNAL_MEM) { + /* restore everything we saved */ + if (config) + if (mpio_file_put_from_memory(mpiosh.dev, MPIO_INTERNAL_MEM, + MPIO_CONFIG_FILE, FTYPE_CONF, + NULL, config, csize)==-1) + mpio_perror("error"); + if (fmconfig) + if (mpio_file_put_from_memory(mpiosh.dev, MPIO_INTERNAL_MEM, + MPIO_CHANNEL_FILE, FTYPE_CHAN, + NULL, fmconfig, fmsize)==-1) + mpio_perror("error"); + + if (config || fmconfig) + mpio_sync(mpiosh.dev, MPIO_INTERNAL_MEM); + if (config) + free(config); + if (fmconfig) + free(fmconfig); + } + + } } } diff --git a/mpiosh/config.c b/mpiosh/config.c index dfe0e29..b77c99f 100644 --- a/mpiosh/config.c +++ b/mpiosh/config.c @@ -2,7 +2,7 @@ * * Author: Andreas Buesching <crunchy@tzi.de> * - * $Id: config.c,v 1.2 2002/11/04 16:25:17 crunchy Exp $ + * $Id: config.c,v 1.3 2002/11/13 23:05:28 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -137,6 +137,14 @@ mpiosh_config_read(struct mpiosh_config_t *config) config->default_mem = MPIO_EXTERNAL_MEM; } } + + value = mpiosh_config_read_key(config, "mpiosh", "charset"); + if (value) { + config->charset = strdup(value); + } else { + config->charset = NULL; + } + } return 1; diff --git a/mpiosh/config.h b/mpiosh/config.h index 24ca437..6c37752 100644 --- a/mpiosh/config.h +++ b/mpiosh/config.h @@ -2,7 +2,7 @@ * * Author: Andreas Buesching <crunchy@tzi.de> * - * $Id: config.h,v 1.1 2002/10/29 20:03:35 crunchy Exp $ + * $Id: config.h,v 1.2 2002/11/13 23:05:28 germeier Exp $ * * Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de> * @@ -32,6 +32,7 @@ struct mpiosh_config_t { char *prompt_int; char *prompt_ext; + char *charset; unsigned default_mem; }; diff --git a/mpiosh/mpiosh.c b/mpiosh/mpiosh.c index 5d76f42..2f39c04 100644 --- a/mpiosh/mpiosh.c +++ b/mpiosh/mpiosh.c @@ -2,7 +2,7 @@ /* * - * $Id: mpiosh.c,v 1.22 2002/11/04 16:25:17 crunchy Exp $ + * $Id: mpiosh.c,v 1.23 2002/11/13 23:05:28 germeier Exp $ * * Author: Andreas Büsching <crunchy@tzi.de> * @@ -63,6 +63,10 @@ mpiosh_init(void) mpiosh.dev = mpio_init(mpiosh_callback_init); printf("\n"); + + if ((mpiosh.dev) && (mpiosh.config->charset)) + mpio_charset_set(mpiosh.dev, mpiosh.config->charset); + } void |