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
characterset using glibc iconv.
Changed menus lastcallers, whoson, userlist, pinfo, fsedit,
timestats to output UTF-8 code if the user has set that terminal
setting.
timestats, filelist to output UTF-8 code if the user has set
that terminal setting.
mbfile:
The index command produces UTF-8 webpages.

View File

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

View File

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