UTF-8 file listings

This commit is contained in:
Michiel Broek 2007-03-02 16:20:03 +00:00
parent 66503454ae
commit c7e5aefe17
3 changed files with 24 additions and 11 deletions

View File

@ -36,8 +36,8 @@ v0.91.5 18-Feb-2007
Email and FTN mail reading now translates to the users Email and FTN mail reading now translates to the users
characterset using glibc iconv. characterset using glibc iconv.
Changed menus lastcallers, whoson, userlist, pinfo, fsedit, Changed menus lastcallers, whoson, userlist, pinfo, fsedit,
timestats to output UTF-8 code if the user has set that terminal timestats, filelist to output UTF-8 code if the user has set
setting. that terminal setting.
mbfile: mbfile:
The index command produces UTF-8 webpages. The index command produces UTF-8 webpages.

View File

@ -4,7 +4,7 @@
* Purpose ...............: All the file functions. * Purpose ...............: All the file functions.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -111,10 +111,14 @@ void File_List()
if ((fdb_area = mbsedb_OpenFDB(iAreaNumber, 30)) == NULL) if ((fdb_area = mbsedb_OpenFDB(iAreaNumber, 30)) == NULL)
return; return;
if (utf8)
chartran_init((char *)"CP437", (char *)"UTF-8", 'b');
clear(); clear();
Header(); Header();
if (iLC(2) == 1) { if (iLC(2) == 1) {
mbsedb_CloseFDB(fdb_area); mbsedb_CloseFDB(fdb_area);
chartran_close();
return; return;
} }
@ -124,11 +128,12 @@ void File_List()
T.Active = FALSE; T.Active = FALSE;
T.Size = fdb.Size; T.Size = fdb.Size;
strncpy(T.SFile, fdb.Name, 12); strncpy(T.SFile, fdb.Name, 12);
strncpy(T.LFile, fdb.LName, 80); strncpy(T.LFile, chartran(fdb.LName), 80);
SetTag(T); SetTag(T);
if (ShowOneFile() == 1) { if (ShowOneFile() == 1) {
mbsedb_CloseFDB(fdb_area); mbsedb_CloseFDB(fdb_area);
chartran_close();
return; return;
} }
@ -150,6 +155,7 @@ void File_List()
snprintf(temp, 81, "%s%d / %d bytes", (char *) Language(242), FileCount, FileBytes); snprintf(temp, 81, "%s%d / %d bytes", (char *) Language(242), FileCount, FileBytes);
pout(LIGHTCYAN, BLACK, temp); pout(LIGHTCYAN, BLACK, temp);
Enter(2); Enter(2);
chartran_close();
iLineCount = 0; iLineCount = 0;
mbsedb_CloseFDB(fdb_area); mbsedb_CloseFDB(fdb_area);
@ -432,11 +438,14 @@ void File_RawDir(char *OpData)
Enter(2); Enter(2);
Pause(); Pause();
} else { } else {
if (utf8)
chartran_init((char *)"CP437", (char *)"UTF-8", 'b');
clear(); clear();
/* Filename Size Date */ /* Filename Size Date */
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(261)); pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(261));
Enter(1); Enter(1);
fLine(78); PUTSTR(chartran(fLine_str(78)));
while ((dp = readdir( dirp )) != NULL ) { while ((dp = readdir( dirp )) != NULL ) {
snprintf(FileName, PATH_MAX, "%s/%s", temp, dp->d_name); snprintf(FileName, PATH_MAX, "%s/%s", temp, dp->d_name);
@ -469,7 +478,7 @@ void File_RawDir(char *OpData)
} }
colour(CFG.HiliteF, CFG.HiliteB); colour(CFG.HiliteF, CFG.HiliteB);
fLine(78); PUTSTR(chartran(fLine_str(78)));
/* Total Files: */ /* Bytes */ /* Total Files: */ /* Bytes */
snprintf(temp2, 81, "%s %d, %d %s", (char *) Language(242), iFileCount, iBytes, (char *) Language(354)); snprintf(temp2, 81, "%s %d, %d %s", (char *) Language(242), iFileCount, iBytes, (char *) Language(354));
pout(LIGHTGREEN, BLACK, temp2); pout(LIGHTGREEN, BLACK, temp2);
@ -477,6 +486,7 @@ void File_RawDir(char *OpData)
Pause(); Pause();
closedir(dirp); closedir(dirp);
chartran_close();
} }
free(temp); free(temp);

View File

@ -172,7 +172,8 @@ void Header()
Enter(1); Enter(1);
colour(WHITE, BLACK); colour(WHITE, BLACK);
fLine(79); PUTSTR(chartran(fLine_str(79)));
iLineCount++;
} }
@ -391,11 +392,13 @@ int ShowOneFile()
else else
fg = (int)fdb.Desc[z][3] - 48; fg = (int)fdb.Desc[z][3] - 48;
bg = (int)fdb.Desc[z][2] - 48; bg = (int)fdb.Desc[z][2] - 48;
snprintf(temp, 81, " %s",fdb.Desc[z]+4); colour(fg, bg);
pout(fg, bg, temp); PUTSTR((char *)" ");
PUTSTR(chartran(fdb.Desc[z]+4));
} else { } else {
snprintf(temp, 81, " %s",fdb.Desc[z]); colour(CFG.FiledescF, CFG.FiledescB);
pout(CFG.FiledescF, CFG.FiledescB, temp); PUTSTR((char *)" ");
PUTSTR(chartran(fdb.Desc[z]));
} }
Enter(1); Enter(1);