This commit is contained in:
Wengier 2021-06-25 00:02:25 -04:00
parent 9d6add6342
commit 06277b8f85
11 changed files with 9 additions and 12 deletions

View File

@ -35,6 +35,9 @@
#include <strings.h>
#endif
char *strchr_dbcs(char *str, char ch);
char *strrchr_dbcs(char *str, char ch);
char *strtok_dbcs(char *s, const char *d);
void strreplace_dbcs(char * str,char o,char n);
void strreplace(char * str,char o,char n);
char *ltrim(char *str);

View File

@ -985,7 +985,7 @@ bool CDROM_Interface_Image::CanReadPVD(TrackFile *file, int sectorSize, bool mod
#if defined(WIN32)
static string dirname(char * file) {
char * sep = strrchr(file, '\\');
char * sep = strrchr_dbcs(file, '\\');
if (sep == nullptr)
sep = strrchr(file, '/');
if (sep == nullptr)

View File

@ -726,7 +726,7 @@ uint8_t DOS_FindDevice(char const * name) {
// if(!name || !(*name)) return DOS_DEVICES; //important, but makename does it
if (!DOS_MakeName(name,fullname,&drive)) return DOS_DEVICES;
char* name_part = strrchr(fullname,'\\');
char* name_part = strrchr_dbcs(fullname,'\\');
if(name_part) {
*name_part++ = 0;
//Check validity of leading directory.

View File

@ -34,6 +34,7 @@
#include "drives.h"
#include "cross.h"
#include "control.h"
#include "support.h"
#include "dos_network2.h"
#include "menu.h"
#include "cdrom.h"
@ -67,7 +68,6 @@ int sdrive = 0;
* be LFN_FILEFIND_NONE as defined in drives.h. */
int lfn_filefind_handle = LFN_FILEFIND_NONE;
bool isDBCSCP(), isKanji1(uint8_t chr), shiftjis_lead_byte(int c);
char *strchr_dbcs(char *str, char ch), *strrchr_dbcs(char *str, char ch);
uint8_t DOS_GetDefaultDrive(void) {
// return DOS_SDA(DOS_SDA_SEG,DOS_SDA_OFS).GetDrive();

View File

@ -24,6 +24,7 @@
#include "regs.h"
#include "dos_inc.h"
#include "control.h"
#include "support.h"
#include <list>
#include <SDL.h>
@ -176,7 +177,7 @@ static bool DOS_MultiplexFunctions(void) {
// fill in filename in fcb style
// (space-padded name (8 chars)+space-padded extension (3 chars))
const char* filename=(const char*)Files[reg_bx]->GetName();
if (strrchr(filename,'\\')) filename=strrchr(filename,'\\')+1;
if (strrchr_dbcs((char *)filename,'\\')) filename=strrchr_dbcs((char *)filename,'\\')+1;
if (strrchr(filename,'/')) filename=strrchr(filename,'/')+1;
if (!filename) return true;
const char* dotpos=strrchr(filename,'.');

View File

@ -41,8 +41,6 @@
int fileInfoCounter = 0;
char *strchr_dbcs(char *str, char ch), *strrchr_dbcs(char *str, char ch);
bool SortByName(DOS_Drive_Cache::CFileInfo* const &a, DOS_Drive_Cache::CFileInfo* const &b) {
return strcmp(a->shortname,b->shortname)<0;
}

View File

@ -48,7 +48,6 @@ static uint32_t dnum[256];
extern bool wpcolon, force_sfn;
extern int lfn_filefind_handle;
void dos_ver_menu(bool start);
char *strrchr_dbcs(char *str, char ch), *strtok_dbcs(char *s, const char *d);
bool systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton);
bool filename_not_8x3(const char *n) {

View File

@ -135,7 +135,6 @@ static std::string hostname = "";
extern bool rsize, morelen, force_sfn, enable_share_exe, isDBCSCP();
extern int lfn_filefind_handle, freesizecap, file_access_tries;
extern unsigned long totalc, freec;
char *strchr_dbcs(char *str, char ch), *strrchr_dbcs(char *str, char ch);
bool String_ASCII_TO_HOST_UTF16(uint16_t *d/*CROSS_LEN*/,const char *s/*CROSS_LEN*/) {
const uint16_t* df = d + CROSS_LEN - 1;

View File

@ -88,7 +88,7 @@ char *strrchr_dbcs(char *str, char ch) {
return strrchr(str, ch);
}
char* strtok_dbcs(char *s, const char *d) {
char *strtok_dbcs(char *s, const char *d) {
if (!IS_PC98_ARCH && !isDBCSCP()) return strtok(s, d);
static char* input = NULL;
if (s != NULL) input = s;

View File

@ -120,7 +120,6 @@ extern unsigned long freec;
extern uint16_t countryNo;
void DOS_SetCountry(uint16_t countryNo);
void GetExpandedPath(std::string &path);
char *strchr_dbcs(char *str, char ch), *strrchr_dbcs(char *str, char ch);
/* support functions */
static char empty_char = 0;

View File

@ -53,8 +53,6 @@ extern bool ctrlbrk, gbk;
extern bool DOS_BreakFlag;
extern bool DOS_BreakConioFlag;
char *strrchr_dbcs(char *str, char ch);
void DOS_Shell::ShowPrompt(void) {
char dir[DOS_PATHLENGTH];
dir[0] = 0; //DOS_GetCurrentDir doesn't always return something. (if drive is messed up)