[hatari-devel] GEMDOS HD emu file names case |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
Attached is a patch to add an option to set
whether the new dirs & files crated under GEMDOS
HD emulation are in upper or lower case on
the host side.
If there are no objections, I'll commit it to
the repo in few days.
- Eero
diff -r 7737842efdfd doc/hatari.1
--- a/doc/hatari.1 Mon Sep 10 12:27:48 2012 +0300
+++ b/doc/hatari.1 Mon Sep 10 13:16:47 2012 +0300
@@ -204,6 +204,10 @@
the protection can be controlled by setting individual files attributes
as it disables the file attribute modifications for the GEMDOS hard disk
emulation.
+.TP
+.B \-\-gemdos-case <x>
+Specify whether new dir/filenames are forced to be in upper or lower case
+with the GEMDOS HD emulation. Off by default.
.TP
.B \-d, \-\-harddrive <dir>
Emulate harddrive partition(s) with <dir> contents. If directory
diff -r 7737842efdfd doc/manual.html
--- a/doc/manual.html Mon Sep 10 12:27:48 2012 +0300
+++ b/doc/manual.html Mon Sep 10 13:16:47 2012 +0300
@@ -567,6 +567,10 @@
controlled by setting individual files attributes as it disables
the file attribute modifications for the GEMDOS hard disk
emulation.</p>
+<p class="parameter">−−gemdos-case <x></p>
+<p class="paramdesc">Specify whether new dir/filenames are forced to be
+in upper or lower case with the GEMDOS HD emulation. Off by default.
+</p>
<p class="parameter">−d, −−harddrive
<dir></p>
<p class="paramdesc">Emulate harddrive partition(s) with
diff -r 7737842efdfd doc/release-notes.txt
--- a/doc/release-notes.txt Mon Sep 10 12:27:48 2012 +0300
+++ b/doc/release-notes.txt Mon Sep 10 13:16:47 2012 +0300
@@ -16,6 +16,8 @@
- Much improved console redirection functionality and a separate --conout
option for it (--bios-intercept doesn't anymore imply console redirection)
- Give warning if GEMDOS dir/file path exceeds 8+8 characters
+- New --gemdos-case option to specify whether new dir/filenames are in
+ upper or lower case
- Debugger:
- Fix: expression expansion doesn't mess lines in command line history
- Also remote API debugger commands can use expression expansion
diff -r 7737842efdfd src/configuration.c
--- a/src/configuration.c Mon Sep 10 12:27:48 2012 +0300
+++ b/src/configuration.c Mon Sep 10 13:16:47 2012 +0300
@@ -271,6 +271,7 @@
{ "bBootFromHardDisk", Bool_Tag, &ConfigureParams.HardDisk.bBootFromHardDisk },
{ "bUseHardDiskDirectory", Bool_Tag, &ConfigureParams.HardDisk.bUseHardDiskDirectories },
{ "szHardDiskDirectory", String_Tag, ConfigureParams.HardDisk.szHardDiskDirectories[DRIVE_C] },
+ { "nGemdosCase", Int_Tag, &ConfigureParams.HardDisk.nGemdosCase },
{ "nWriteProtection", Int_Tag, &ConfigureParams.HardDisk.nWriteProtection },
{ "bUseHardDiskImage", Bool_Tag, &ConfigureParams.HardDisk.bUseHardDiskImage },
{ "szHardDiskImage", String_Tag, ConfigureParams.HardDisk.szHardDiskImage },
@@ -392,6 +393,7 @@
/* Set defaults for hard disks */
ConfigureParams.HardDisk.bBootFromHardDisk = false;
+ ConfigureParams.HardDisk.nGemdosCase = GEMDOS_NOP;
ConfigureParams.HardDisk.nWriteProtection = WRITEPROT_OFF;
ConfigureParams.HardDisk.nHardDiskDir = DRIVE_C;
ConfigureParams.HardDisk.bUseHardDiskDirectories = false;
diff -r 7737842efdfd src/gemdos.c
--- a/src/gemdos.c Mon Sep 10 12:27:48 2012 +0300
+++ b/src/gemdos.c Mon Sep 10 13:16:47 2012 +0300
@@ -906,6 +906,11 @@
}
+static int to_same(int ch)
+{
+ return ch;
+}
+
/*-----------------------------------------------------------------------*/
/**
* Check whether given TOS file/dir exists in given host path.
@@ -919,6 +924,7 @@
{
char *tmp, *match, name[strlen(origname) + 3];
int dot, namelen, pathlen;
+ int (*chr_conv)(int);
bool modified;
strcpy(name, origname);
@@ -1013,7 +1019,20 @@
}
/* not found, copy file/dirname as is */
- strncat(path+pathlen, origname, maxlen-pathlen);
+ switch (ConfigureParams.HardDisk.nGemdosCase) {
+ case GEMDOS_UPPER:
+ chr_conv = toupper;
+ break;
+ case GEMDOS_LOWER:
+ chr_conv = tolower;
+ break;
+ default:
+ chr_conv = to_same;
+ }
+ tmp = name;
+ while (*origname)
+ *tmp++ = chr_conv(*origname++);
+ strncat(path+pathlen, name, maxlen-pathlen);
return false;
}
diff -r 7737842efdfd src/includes/configuration.h
--- a/src/includes/configuration.h Mon Sep 10 12:27:48 2012 +0300
+++ b/src/includes/configuration.h Mon Sep 10 13:16:47 2012 +0300
@@ -166,6 +166,13 @@
#define MAX_HARDDRIVES 24
#define DRIVE_C 0
+typedef enum
+{
+ GEMDOS_NOP,
+ GEMDOS_UPPER,
+ GEMDOS_LOWER
+} GEMDOS_CHR_CONV;
+
typedef struct
{
int nHardDiskDir;
@@ -174,6 +181,7 @@
bool bUseIdeMasterHardDiskImage;
bool bUseIdeSlaveHardDiskImage;
WRITEPROTECTION nWriteProtection;
+ GEMDOS_CHR_CONV nGemdosCase;
bool bBootFromHardDisk;
char szHardDiskDirectories[MAX_HARDDRIVES][FILENAME_MAX];
char szHardDiskImage[FILENAME_MAX];
diff -r 7737842efdfd src/options.c
--- a/src/options.c Mon Sep 10 12:27:48 2012 +0300
+++ b/src/options.c Mon Sep 10 13:16:47 2012 +0300
@@ -103,6 +103,7 @@
OPT_FASTFLOPPY,
OPT_WRITEPROT_FLOPPY,
OPT_WRITEPROT_HD,
+ OPT_GEMDOS_CASE,
OPT_HARDDRIVE,
OPT_ACSIHDIMAGE,
OPT_IDEMASTERHDIMAGE,
@@ -283,6 +284,8 @@
"<x>", "Write protect floppy image contents (on/off/auto)" },
{ OPT_WRITEPROT_HD, NULL, "--protect-hd",
"<x>", "Write protect harddrive <dir> contents (on/off/auto)" },
+ { OPT_GEMDOS_CASE, NULL, "--gemdos-case",
+ "<x>", "Forcibly up/lowercase new GEMDOS dir/filenames (off/upper/lower)" },
{ OPT_HARDDRIVE, "-d", "--harddrive",
"<dir>", "Emulate harddrive partition(s) with <dir> contents" },
{ OPT_ACSIHDIMAGE, NULL, "--acsi",
@@ -1250,6 +1253,18 @@
return Opt_ShowError(OPT_WRITEPROT_HD, argv[i], "Unknown option value");
break;
+ case OPT_GEMDOS_CASE:
+ i += 1;
+ if (strcasecmp(argv[i], "off") == 0)
+ ConfigureParams.HardDisk.nGemdosCase = GEMDOS_NOP;
+ else if (strcasecmp(argv[i], "upper") == 0)
+ ConfigureParams.HardDisk.nGemdosCase = GEMDOS_UPPER;
+ else if (strcasecmp(argv[i], "lower") == 0)
+ ConfigureParams.HardDisk.nGemdosCase = GEMDOS_LOWER;
+ else
+ return Opt_ShowError(OPT_GEMDOS_CASE, argv[i], "Unknown option value");
+ break;
+
case OPT_HARDDRIVE:
i += 1;
ok = Opt_StrCpy(OPT_HARDDRIVE, false, ConfigureParams.HardDisk.szHardDiskDirectories[0],