System update to UTF-8

This commit is contained in:
Michiel Broek 2007-02-25 20:28:00 +00:00
parent 2a0fa86557
commit c5e7083deb
52 changed files with 754 additions and 710 deletions

View File

@ -3,12 +3,45 @@ $Id$
v0.91.5 18-Feb-2007 v0.91.5 18-Feb-2007
WARNING: do not configure with --enable-experiment this will break! With this version de default internal character encoding is
You own the pieces and the troubles, you have been warned. UTF-8. BBS users who have a UTF-8 terminal can use the bbs in
UTF-8 mode and should have no troubles at all reading and
writing messages in several language encodings.
Even BETTER: Do not use at all, currently there is unfinished code upgrade:
and some things don't work right now. In all macro files html.* change the charset to UTF-8.
FSP-1030 Unicode character set in FidoNet messages. If you still have all default macro files thein in the source
directory mbsebbs/examples simply run "make macros" to install
the updated versions.
Run "mbfile index -f " once to regenerate all download html
index pages with UTF-8 encoding. Check the error.log for
errors.
mbsebbs:
Added terminal setting UTF-8.
Removed setting ANSI/Textmode, allways graphic now.
All *.asc textfiles are now obsolete, only *.ans are valid.
Display ansi file converts to UTF-8 if the user has UTF-8.
Email and FTN mail reading now translates to the users
characterset using glibc iconv.
Changed menus lastcallers, whoson, userlist, pinfo, fsedit to
output UTF-8 code if the user has set that terminal setting.
mbfile:
The index command produces UTF-8 webpages.
mbfido:
The make web stat produces UTF-8 webpages.
mbnntp:
Reading news outputs UTF-8 coded articles.
TODO: test posting and fix if needed.
lang:
Language prompts 44, 75 and 76 are obsolete.
examples:
Upgraded the html macro templates to produce UTF-8 web pages.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -14,7 +14,7 @@
</HEAD> </HEAD>
<BODY> <BODY>
<BLOCKQUOTE> <BLOCKQUOTE>
<DIV align=right><h5>Last update 05-Mar-2006</h5></div> <DIV align=right><h5>Last update 25-Feb-2007</h5></div>
<DIV align=center><h1>MBSE BBS Control Codes in ANSI and ASCII files</h1></DIV> <DIV align=center><h1>MBSE BBS Control Codes in ANSI and ASCII files</h1></DIV>
<hr> <hr>
@ -101,7 +101,7 @@ For example: ^B32000^BThis is the text^B<br>
M User's screen length M User's screen length
N User's first name N User's first name
O User's last name O User's last name
P User's graphics mode (On/Off) P User's graphics mode allways (On).
Q User's news bulletins (On/Off) Q User's news bulletins (On/Off)
R User's hot-keys (On/Off) R User's hot-keys (On/Off)
S User's daily time limit S User's daily time limit

View File

@ -42,7 +42,7 @@
41 newuser.c user.c |Your passwords do not match! Try again. 41 newuser.c user.c |Your passwords do not match! Try again.
42 newuser.c change.c user.c |Your password must contain at least 42 newuser.c change.c user.c |Your password must contain at least
43 newuser.c change.c user.c |characters! Try again. 43 newuser.c change.c user.c |characters! Try again.
44 newuser.c YN|Do you want ANSI and graphics mode [Y/n]: 44 |
45 newuser.c change.c |Please enter you Voice Number 45 newuser.c change.c |Please enter you Voice Number
46 mail.c |Message exported to your private directory as: 46 mail.c |Message exported to your private directory as:
47 newuser.c change.c |Please enter a proper phone number 47 newuser.c change.c |Please enter a proper phone number
@ -73,8 +73,8 @@
72 misc.c |Could not find 72 misc.c |Could not find
73 change.c |Old Location: 73 change.c |Old Location:
74 change.c |Please enter a longer location (min 74 change.c |Please enter a longer location (min
75 change.c |Ansi Mode turned ON 75 |
76 change.c |Ansi Mode turned OFF 76 |
77 mail.c |Message doesn't exist 77 mail.c |Message doesn't exist
78 change.c |News bulletins turned ON 78 change.c |News bulletins turned ON
79 change.c |News bulletins turned OFF 79 change.c |News bulletins turned OFF

View File

@ -42,7 +42,7 @@ YN|Check for new files at login [Y/n]:
|Die Passwoerter stimmen nicht ueberein! Bitte wiederholen. |Die Passwoerter stimmen nicht ueberein! Bitte wiederholen.
|Dein Passwort muss mindestens |Dein Passwort muss mindestens
|Zeichen enthalten! Bitte wiederholen. |Zeichen enthalten! Bitte wiederholen.
JN|Moechtest Du den ANSI Anzeigemodus verwenden [<J>a/<n>ein]: |
|Bitte gib Deine Telefonnummer an: |Bitte gib Deine Telefonnummer an:
|Die Mitteilung wurde in Dein privates Verzeichnis gespeichert als: |Die Mitteilung wurde in Dein privates Verzeichnis gespeichert als:
|Bitte gib Deine vollstaendige Telefonnummer an: |Bitte gib Deine vollstaendige Telefonnummer an:
@ -73,8 +73,8 @@ JN|Moechtest Du Menues mit "Hot-Keys" verwenden? [<J>a/<n>ein]:
|Unbekannt |Unbekannt
|Bisheriger Ort: |Bisheriger Ort:
|Bitte gib eine laengere Bezeichung fuer den Ort ein (min |Bitte gib eine laengere Bezeichung fuer den Ort ein (min
|Ansi Modus ist jetzt EIN |
|Ansi Modus ist jetzt AUS |
|Die Mitteilung existiert nicht |Die Mitteilung existiert nicht
|System-Mitteilungen sind jetzt EIN |System-Mitteilungen sind jetzt EIN
|System-Mitteilungen sind jetzt AUS |System-Mitteilungen sind jetzt AUS

View File

@ -42,7 +42,7 @@ JN|Beim Login nach neuen Dateien suchen [J/n]:
|Die Passwoerter stimmen nicht ueberein! Bitte wiederholen. |Die Passwoerter stimmen nicht ueberein! Bitte wiederholen.
|Ihr Passwort muss mindestens |Ihr Passwort muss mindestens
|Zeichen enthalten! Bitte wiederholen. |Zeichen enthalten! Bitte wiederholen.
JN|Moechten Sie den ANSI Anzeigemodus verwenden [J/n]: |
|Bitte geben Sie Ihre Telefonnummer an: |Bitte geben Sie Ihre Telefonnummer an:
|Die Mitteilung wurde in Ihr privates Verzeichnis gespeichert als: |Die Mitteilung wurde in Ihr privates Verzeichnis gespeichert als:
|Bitte geben Sie eine vollstaendige Telefonnummer an: |Bitte geben Sie eine vollstaendige Telefonnummer an:
@ -73,8 +73,8 @@ JN|Moechten Sie in den Menues "Hot-Keys" verwenden? [J/n]:
|Unbekannt |Unbekannt
|Bisheriger Ort: |Bisheriger Ort:
|Bitte geben Sie eine laengere Bezeichung fuer den Ort ein (min |Bitte geben Sie eine laengere Bezeichung fuer den Ort ein (min
|Ansi Modus ist jetzt EIN |
|Ansi Modus ist jetzt AUS |
|Die Mitteilung existiert nicht |Die Mitteilung existiert nicht
|System-Mitteilungen sind jetzt EIN |System-Mitteilungen sind jetzt EIN
|System-Mitteilungen sind jetzt AUS |System-Mitteilungen sind jetzt AUS

View File

@ -42,7 +42,7 @@ YN|Check for new files at login [Y/n]:
|Your passwords do not match! Try again. |Your passwords do not match! Try again.
|Your password must contain at least |Your password must contain at least
|characters! Try again. |characters! Try again.
YN|Do you want ANSI and graphics mode [Y/n]: |
|Please enter you Voice Number |Please enter you Voice Number
|Message exported to your private directory as: |Message exported to your private directory as:
|Please enter a proper phone number |Please enter a proper phone number
@ -73,8 +73,8 @@ YN|Would you like Hot-Keyed menus? [Y/n]:
|Could not find |Could not find
|Old Location: |Old Location:
|Please enter a longer location (min |Please enter a longer location (min
|Ansi Mode turned ON |
|Ansi Mode turned OFF |
|Message doesn't exist |Message doesn't exist
|News bulletins turned ON |News bulletins turned ON
|News bulletins turned OFF |News bulletins turned OFF

View File

@ -42,7 +42,7 @@ YN|Check for new files at login [Y/n]:
|­No coinciden! Vuelta a empezar... |­No coinciden! Vuelta a empezar...
|El password debe tener como m¡nimo |El password debe tener como m¡nimo
|caracteres. Vuelta a empezar... |caracteres. Vuelta a empezar...
SN|¨Quieres gr ficos ANSI [S/n]: |
|Teclea tu n£mero de telfono de VOZ |Teclea tu n£mero de telfono de VOZ
|Mensaje exportado a tu directorio privado como: |Mensaje exportado a tu directorio privado como:
|N£mero de telfono incorrecto. Repite... |N£mero de telfono incorrecto. Repite...
@ -73,8 +73,8 @@ SN|
|No encuentro |No encuentro
|Localidad anterior : |Localidad anterior :
|Localidad demasiado corta: (min. |Localidad demasiado corta: (min.
|Modo ANSI activado |
|Modo ANSI desactivado |
|No existe el mensaje |No existe el mensaje
|Noticias activadas |Noticias activadas
|Noticias desactivadas |Noticias desactivadas

View File

@ -42,7 +42,7 @@ YN|Check for new files at login [Y/n]:
|Vos mots de passe ne sont pas identiques. Essayez encore. |Vos mots de passe ne sont pas identiques. Essayez encore.
|Votre mot de passe doit contenir au moins |Votre mot de passe doit contenir au moins
|caractères! Essayez encore. |caractères! Essayez encore.
ON|Voulez vous le mode graphique ANSI [O/n]: |
|Veuillez entrer votre numéro "voix" |Veuillez entrer votre numéro "voix"
|Message exporté dans votre répertoire perso sous le nom: |Message exporté dans votre répertoire perso sous le nom:
|Veuillez entrer un numéro de téléphone valable: |Veuillez entrer un numéro de téléphone valable:
@ -73,8 +73,8 @@ ON|Voulez vous les menus Hot-Keyed ? [O/n]:
|Ne peut pas trouver |Ne peut pas trouver
|Ancienne ville : |Ancienne ville :
|veuillez entrer un nom plus long (min |veuillez entrer un nom plus long (min
|Ansi Mode est ON |
|Ansi Mode est OFF |
|Message n'existe pas |Message n'existe pas
|News bulletins est ON |News bulletins est ON
|News bulletins est OFF |News bulletins est OFF

View File

@ -42,7 +42,7 @@ YN|Check for new files at login [Y/n]:
|­Non coinciden! Volta a empezar... |­Non coinciden! Volta a empezar...
|A password debe ter como m¡nimo |A password debe ter como m¡nimo
|caracteres. Volta a empezar... |caracteres. Volta a empezar...
SN|¨Queres gr ficos ANSI [S/n]: |
|Teclea o teu n£mero de telfono de VOZ |Teclea o teu n£mero de telfono de VOZ
|Mensaxe exportado ¢ teu directorio privado como: |Mensaxe exportado ¢ teu directorio privado como:
|N£mero de telfono incorrecto. Repite... |N£mero de telfono incorrecto. Repite...
@ -73,8 +73,8 @@ SN|
|Non topo |Non topo
|Localidade anterior : |Localidade anterior :
|Localidade demasiado curta: (min. |Localidade demasiado curta: (min.
|Modo ANSI activado |
|Modo ANSI desactivado |
|Non existe a mensaxe |Non existe a mensaxe
|Novas activadas |Novas activadas
|Novas desactivadas |Novas desactivadas

View File

@ -42,7 +42,7 @@ JN|Kijk voor nieuwe bestanden tijdens login [J/n]:
|De wachtwoorden zijn niet gelijk! Opnieuw. |De wachtwoorden zijn niet gelijk! Opnieuw.
|Uw wachtwoord moet minstens |Uw wachtwoord moet minstens
|karakters bevatten! Opnieuw. |karakters bevatten! Opnieuw.
JN|Wilt U ANSI karakters en kleuren [J/n]: |
|Geef Uw Spraak Telefoonnummer |Geef Uw Spraak Telefoonnummer
|Bericht weggeschreven naar Uw prive directory als: |Bericht weggeschreven naar Uw prive directory als:
|Geef het nummer in een goed formaat |Geef het nummer in een goed formaat
@ -73,8 +73,8 @@ JN|Wilt U sneltoets menus? [J/n]:
|Niet gevonden |Niet gevonden
|Oude woonplaats: |Oude woonplaats:
|Geef een langere woonplaats naam (minimaal |Geef een langere woonplaats naam (minimaal
|ANSI kleuren staan nu AAN |
|ANSI kleuren staan nu UIT |
|Bericht bestaat niet |Bericht bestaat niet
|News berichten staan nu AAN |News berichten staan nu AAN
|News berichten staan nu UIT |News berichten staan nu UIT

View File

@ -42,7 +42,7 @@ YN|Check for new files at login [Y/n]:
|两次输入的密码不同! 重试. |两次输入的密码不同! 重试.
|你的密码长度不能少于 |你的密码长度不能少于
|个字符! 重试. |个字符! 重试.
YN|Do you want ANSI and graphics mode [Y/n]: |
|Please enter you Voice Number |Please enter you Voice Number
|Message exported to your private directory as: |Message exported to your private directory as:
|Please enter a proper phone number |Please enter a proper phone number
@ -73,8 +73,8 @@ YN|Would you like Hot-Keyed menus? [Y/n]:
|Could not find |Could not find
|Old Location: |Old Location:
|Please enter a longer location (min |Please enter a longer location (min
|Ansi Mode turned ON |
|Ansi Mode turned OFF |
|Message doesn't exist |Message doesn't exist
|News bulletins turned ON |News bulletins turned ON
|News bulletins turned OFF |News bulletins turned OFF

View File

@ -34,6 +34,7 @@
int use_tran1 = FALSE; /* Translate stage 1 active */ int use_tran1 = FALSE; /* Translate stage 1 active */
int use_tran2 = FALSE; /* Translate stage 2 active */ int use_tran2 = FALSE; /* Translate stage 2 active */
int loglevel = '-'; /* Debug loglevel */
iconv_t cd1; /* Conversion descriptor 1 */ iconv_t cd1; /* Conversion descriptor 1 */
iconv_t cd2; /* Conversion descriptor 2 */ iconv_t cd2; /* Conversion descriptor 2 */
@ -82,7 +83,7 @@ struct _charmap charmap[] = {
{FTNC_CP850, (char *)"CP850 2", (char *)"iso-8859-1", (char *)"CP850", (char *)"ISO-8859-1", (char *)"en_US", (char *)"IBM codepage 850 (Latin-1)"}, {FTNC_CP850, (char *)"CP850 2", (char *)"iso-8859-1", (char *)"CP850", (char *)"ISO-8859-1", (char *)"en_US", (char *)"IBM codepage 850 (Latin-1)"},
{FTNC_LATIN_2,(char *)"LATIN-2 2",(char *)"iso-8859-2", (char *)"LATIN2", (char *)"ISO-8859-2", (char *)"cs_CZ", (char *)"ISO 8859-2 (Eastern European)"}, {FTNC_LATIN_2,(char *)"LATIN-2 2",(char *)"iso-8859-2", (char *)"LATIN2", (char *)"ISO-8859-2", (char *)"cs_CZ", (char *)"ISO 8859-2 (Eastern European)"},
{FTNC_CP852, (char *)"CP852 2", (char *)"iso-8859-2", (char *)"CP852", (char *)"ISO-8859-2", (char *)"cs_CZ", (char *)"IBM codepage 852 (Czech, Latin-1)"}, {FTNC_CP852, (char *)"CP852 2", (char *)"iso-8859-2", (char *)"CP852", (char *)"ISO-8859-2", (char *)"cs_CZ", (char *)"IBM codepage 852 (Czech, Latin-1)"},
{FTNC_CP895, (char *)"CP895 2", (char *)"iso-8859-2", (char *)"CP895", (char *)"ISO-8859-2", (char *)"cs_CZ", (char *)"IBM codepage 895 (Czech, Kamenicky)"}, {FTNC_CP895, (char *)"CP895 2", (char *)"iso-8859-2", (char *)"CP850", (char *)"ISO-8859-2", (char *)"cs_CZ", (char *)"IBM codepage 895 (Czech, Kamenicky)"},
{FTNC_LATIN_5,(char *)"LATIN-5 2",(char *)"iso-8859-5", (char *)"LATIN5", (char *)"ISO-8859-5", (char *)"turks", (char *)"ISO 8859-5 (Turkish)"}, {FTNC_LATIN_5,(char *)"LATIN-5 2",(char *)"iso-8859-5", (char *)"LATIN5", (char *)"ISO-8859-5", (char *)"turks", (char *)"ISO 8859-5 (Turkish)"},
{FTNC_CP866, (char *)"CP866 2", (char *)"iso-8859-5", (char *)"CP866", (char *)"ISO-8859-5", (char *)"ru_RU", (char *)"IBM codepage 866 (Russian)"}, {FTNC_CP866, (char *)"CP866 2", (char *)"iso-8859-5", (char *)"CP866", (char *)"ISO-8859-5", (char *)"ru_RU", (char *)"IBM codepage 866 (Russian)"},
{FTNC_LATIN_9,(char *)"LATIN-9 2",(char *)"iso-8859-15",(char *)"LATIN-9", (char *)"ISO-8859-15",(char *)"en_US", (char *)"ISO 8859-1 (Western European EURO)"}, {FTNC_LATIN_9,(char *)"LATIN-9 2",(char *)"iso-8859-15",(char *)"LATIN-9", (char *)"ISO-8859-15",(char *)"en_US", (char *)"ISO 8859-1 (Western European EURO)"},
@ -104,7 +105,7 @@ int find_ftn_charset(char *ftnkludge)
int j; int j;
char *ftn, *cmp; char *ftn, *cmp;
Syslog('n', "find_ftn_charset(%s)", ftnkludge); Syslog(loglevel, "find_ftn_charset(%s)", ftnkludge);
ftn = calloc(80, sizeof(char)); ftn = calloc(80, sizeof(char));
cmp = calloc(80, sizeof(char)); cmp = calloc(80, sizeof(char));
@ -123,7 +124,7 @@ int find_ftn_charset(char *ftnkludge)
} }
if (charalias[i].alias != NULL) { if (charalias[i].alias != NULL) {
Syslog('n', "found alias %s", charalias[i].ftnkludge); Syslog(loglevel, "found alias %s", charalias[i].ftnkludge);
snprintf(ftn, 80, "%s", charalias[i].ftnkludge); snprintf(ftn, 80, "%s", charalias[i].ftnkludge);
} }
@ -151,7 +152,7 @@ int find_ftn_charset(char *ftnkludge)
return FTNC_ERROR; return FTNC_ERROR;
} }
Syslog('n', "find_ftn_charset(%s) result %d", ftnkludge, i); Syslog(loglevel, "find_ftn_charset(%s) result %d", ftnkludge, i);
return i; return i;
} }
@ -197,6 +198,46 @@ char *getrfcchrs(int val)
char *get_ic_ftn(int val)
{
int i;
static char ic_ftnname[20];
for (i = 0; (charmap[i].ftncidx != FTNC_ERROR); i++) {
if (val == charmap[i].ftncidx) {
snprintf(ic_ftnname, 20, "%s", charmap[i].ic_ftn);
return ic_ftnname;
}
}
/*
* Not found, return a default
*/
return (char *)"LATIN1";
}
char *get_ic_rfc(int val)
{
int i;
static char ic_rfcname[20];
for (i = 0; (charmap[i].ftncidx != FTNC_ERROR); i++) {
if (val == charmap[i].ftncidx) {
snprintf(ic_rfcname, 20, "%s", charmap[i].ic_rfc);
return ic_rfcname;
}
}
/*
* Not found, return a default
*/
return (char *)"iso-8859-1";
}
/* /*
* Experimental table that should translate from the user selected * Experimental table that should translate from the user selected
* charset to a locale. This is not the right way to do, the best * charset to a locale. This is not the right way to do, the best
@ -249,17 +290,19 @@ char *getchrsdesc(int val)
* charactersets are given, the translation is off. * charactersets are given, the translation is off.
* On success return 0, on error return -1 and write errorlog. * On success return 0, on error return -1 and write errorlog.
*/ */
int chartran_init(char *fromset, char *toset) int chartran_init(char *fromset, char *toset, int logl)
{ {
loglevel = logl;
if (use_tran1 || use_tran2) { if (use_tran1 || use_tran2) {
WriteError("chartran_init() called while still open"); WriteError("chartran_init() called while still open");
chartran_close(); chartran_close();
} }
Syslog('-', "chartran_init(%s, %s)", fromset, toset); Syslog(loglevel, "chartran_init(%s, %s)", fromset, toset);
if (strcmp(fromset, toset) == 0) { if (strcmp(fromset, toset) == 0) {
Syslog('-', "nothing to translate"); Syslog(loglevel, "nothing to translate");
return 0; return 0;
} }
@ -273,10 +316,13 @@ int chartran_init(char *fromset, char *toset)
} }
if (strcmp(toset, (char *)"UTF-8")) { if (strcmp(toset, (char *)"UTF-8")) {
cd2 = iconv_open(toset, (char *)"UTF-8"); cd2 = iconv_open(toset, "UTF-8");
if (cd2 != (iconv_t)-1) { if (cd2 == (iconv_t)-1) {
WriteError("$chartran_init(%s, %s): iconv_open(%s, UTF-8s) error", fromset, toset, toset); WriteError("$chartran_init(%s, %s): iconv_open(%s, UTF-8) error", fromset, toset, toset);
chartran_close(); if (use_tran1) {
iconv_close(cd1);
use_tran1 = FALSE;
}
return -1; return -1;
} }
use_tran2 = TRUE; use_tran2 = TRUE;
@ -292,7 +338,7 @@ int chartran_init(char *fromset, char *toset)
*/ */
void chartran_close(void) void chartran_close(void)
{ {
Syslog('-', "chartran_close()"); Syslog(loglevel, "chartran_close()");
if (use_tran1) { if (use_tran1) {
iconv_close(cd1); iconv_close(cd1);
use_tran1 = FALSE; use_tran1 = FALSE;
@ -318,6 +364,7 @@ char *chartran(char *input)
char *in, *out; char *in, *out;
memset(&outbuf, 0, sizeof(outbuf)); memset(&outbuf, 0, sizeof(outbuf));
memset(&temp, 0, sizeof(temp));
/* /*
* Transparant * Transparant
@ -340,6 +387,10 @@ char *chartran(char *input)
WriteError("$iconv(%s) cd1", printable(input, 0)); WriteError("$iconv(%s) cd1", printable(input, 0));
strncpy(outbuf, input, sizeof(outbuf) -1); strncpy(outbuf, input, sizeof(outbuf) -1);
} }
if (strcmp(input, outbuf)) {
Syslog(loglevel, "i %s", printable(input, 0));
Syslog(loglevel, "u %s", printable(outbuf, 0));
}
return outbuf; return outbuf;
} }
@ -356,6 +407,10 @@ char *chartran(char *input)
WriteError("$iconv(%s) cd2", printable(input, 0)); WriteError("$iconv(%s) cd2", printable(input, 0));
strncpy(outbuf, input, sizeof(outbuf) -1); strncpy(outbuf, input, sizeof(outbuf) -1);
} }
if (strcmp(input, outbuf)) {
Syslog(loglevel, "u %s", printable(input, 0));
Syslog(loglevel, "o %s", printable(outbuf, 0));
}
return outbuf; return outbuf;
} }
@ -372,6 +427,10 @@ char *chartran(char *input)
strncpy(outbuf, input, sizeof(outbuf) -1); strncpy(outbuf, input, sizeof(outbuf) -1);
return outbuf; return outbuf;
} }
if (strcmp(input, temp)) {
Syslog(loglevel, "i %s", printable(input, 0));
}
inSize = strlen(temp); inSize = strlen(temp);
outSize = sizeof(outbuf); outSize = sizeof(outbuf);
in = temp; in = temp;
@ -381,6 +440,12 @@ char *chartran(char *input)
WriteError("$iconv(%s) cd2", printable(temp, 0)); WriteError("$iconv(%s) cd2", printable(temp, 0));
strncpy(outbuf, input, sizeof(outbuf) -1); strncpy(outbuf, input, sizeof(outbuf) -1);
} }
if (strcmp(input, temp) || strcmp(temp, outbuf)) {
Syslog(loglevel, "u %s", printable(temp, 0));
}
if (strcmp(temp, outbuf)) {
Syslog(loglevel, "o %s", printable(outbuf, 0));
}
return outbuf; return outbuf;
} }

View File

@ -255,6 +255,7 @@ void html_massage(char *inbuf, char *outbuf, size_t size)
case '&': snprintf(outptr, size, "&amp;"); break; case '&': snprintf(outptr, size, "&amp;"); break;
case '<': snprintf(outptr, size, "&lt;"); break; case '<': snprintf(outptr, size, "&lt;"); break;
case '>': snprintf(outptr, size, "&gt;"); break; case '>': snprintf(outptr, size, "&gt;"); break;
/* Not needed for UTF-8 output.
case 160: snprintf(outptr, size, "&nbsp;"); break; case 160: snprintf(outptr, size, "&nbsp;"); break;
case 161: snprintf(outptr, size, "&iexcl;"); break; case 161: snprintf(outptr, size, "&iexcl;"); break;
case 162: snprintf(outptr, size, "&cent;"); break; case 162: snprintf(outptr, size, "&cent;"); break;
@ -351,6 +352,7 @@ void html_massage(char *inbuf, char *outbuf, size_t size)
case 253: snprintf(outptr, size, "&yacute;"); break; case 253: snprintf(outptr, size, "&yacute;"); break;
case 254: snprintf(outptr, size, "&thorn;"); break; case 254: snprintf(outptr, size, "&thorn;"); break;
case 255: snprintf(outptr, size, "&yuml;"); break; case 255: snprintf(outptr, size, "&yuml;"); break;
*/
default: *outptr++ = *inptr; *outptr = '\0'; break; default: *outptr++ = *inptr; *outptr = '\0'; break;
} }
while (*outptr) while (*outptr)
@ -410,6 +412,18 @@ FILE *OpenMacro(const char *filename, int Language, int htmlmode)
if (fi == NULL) if (fi == NULL)
WriteError("OpenMacro(%s, %c): not found", filename, Language); WriteError("OpenMacro(%s, %c): not found", filename, Language);
else { else {
/*
* Check macro file for update correct charset.
*/
while (fgets(linebuf, sizeof(linebuf) -1, fi)) {
if (strcasestr(linebuf, (char *)"text/html")) {
if (! strcasestr(linebuf, (char *)"UTF-8")) {
WriteError("Macro file %s doesn't define 'Content-Type' content='text/html; charset=UTF-8'", temp);
}
}
}
rewind(fi);
snprintf(temp, PATH_MAX -1, "%s-%s", OsName(), OsCPU()); snprintf(temp, PATH_MAX -1, "%s-%s", OsName(), OsCPU());
if (CFG.aka[0].point) if (CFG.aka[0].point)
snprintf(aka, 80, "%d:%d/%d.%d@%s", CFG.aka[0].zone, CFG.aka[0].net, CFG.aka[0].node, CFG.aka[0].point, CFG.aka[0].domain); snprintf(aka, 80, "%d:%d/%d.%d@%s", CFG.aka[0].zone, CFG.aka[0].net, CFG.aka[0].node, CFG.aka[0].point, CFG.aka[0].domain);

View File

@ -1039,7 +1039,7 @@ struct sysconfig {
securityrec newuser_access; /* New Users Access level */ securityrec newuser_access; /* New Users Access level */
int OLR_MaxMsgs; /* OLR Max nr Msgs download */ int OLR_MaxMsgs; /* OLR Max nr Msgs download */
unsigned iCapUserName : 1; /* Capitalize Username */ unsigned iCapUserName : 1; /* Capitalize Username */
unsigned iAnsi : 1; /* Ask Ansi */ unsigned xiAnsi : 1;
unsigned iSex : 1; /* Ask Sex */ unsigned iSex : 1; /* Ask Sex */
unsigned iDataPhone : 1; /* Ask Data Phone */ unsigned iDataPhone : 1; /* Ask Data Phone */
unsigned iVoicePhone : 1; /* Ask Voice Phone */ unsigned iVoicePhone : 1; /* Ask Voice Phone */
@ -2604,7 +2604,9 @@ char *getftnchrs(int); /* Return FTN characterset name */
char *getrfcchrs(int); /* Return RFC characterset name */ char *getrfcchrs(int); /* Return RFC characterset name */
char *getlocale(int); /* Return locale name */ char *getlocale(int); /* Return locale name */
char *getchrsdesc(int); /* Return characterset description */ char *getchrsdesc(int); /* Return characterset description */
int chartran_init(char *, char *); /* Initialize chartran */ char *get_ic_ftn(int); /* Return iconv name FTN side */
char *get_ic_rfc(int); /* Return iconv name RFC side */
int chartran_init(char *, char *, int); /* Initialize chartran */
void chartran_close(void); /* Deinit chartran */ void chartran_close(void); /* Deinit chartran */
char *chartran(char *); /* Translate string */ char *chartran(char *); /* Translate string */

View File

@ -4,7 +4,7 @@
* Purpose ...............: MBSE BBS Users Database structure * Purpose ...............: MBSE BBS Users Database structure
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -96,7 +96,7 @@ struct userrec {
unsigned Hidden : 1; /* Hide User from Lists */ unsigned Hidden : 1; /* Hide User from Lists */
unsigned HotKeys : 1; /* Hot-Keys ON/OFF */ unsigned HotKeys : 1; /* Hot-Keys ON/OFF */
unsigned GraphMode : 1; /* ANSI Mode ON/OFF */ unsigned xGraphMode : 1;
unsigned Deleted : 1; /* Deleted Status */ unsigned Deleted : 1; /* Deleted Status */
unsigned NeverDelete : 1; /* Never Delete User */ unsigned NeverDelete : 1; /* Never Delete User */
unsigned xChat : 1; unsigned xChat : 1;

View File

@ -695,12 +695,10 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
Syslog('m', "ftn2rfc: charset in: %s charset out: %s", charset, getrfcchrs(msgs.Charset)); Syslog('m', "ftn2rfc: charset in: %s charset out: %s", charset, getrfcchrs(msgs.Charset));
#ifndef USE_EXPERIMENT
/* /*
* Setup charset conversion * Setup charset conversion
*/ */
charset_set_in_out(charset, getrfcchrs(msgs.Charset)); chartran_init(charset, getrfcchrs(msgs.Charset), 'm');
#endif
if (newsmode) { if (newsmode) {
/* /*
@ -1546,6 +1544,7 @@ int ftn2rfc(faddr *f, faddr *t, char *subj, char *origline, time_t mdate, int fl
fprintf(nfp, ".\n"); fprintf(nfp, ".\n");
} }
chartran_close();
if (newsgroup) if (newsgroup)
free(newsgroup); free(newsgroup);
rbuf = NULL; rbuf = NULL;

View File

@ -4,7 +4,7 @@
* Purpose ...............: Make Web statistics * Purpose ...............: Make Web statistics
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -133,6 +133,8 @@ void MakeStat(void)
else else
Lm = Miy -1; Lm = Miy -1;
chartran_init((char *)"CP437", (char *)"UTF-8", 'm');
snprintf(name, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT")); snprintf(name, PATH_MAX, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
if ((fg = fopen(name, "r")) == NULL) { if ((fg = fopen(name, "r")) == NULL) {
WriteError("Can't open %s", name); WriteError("Can't open %s", name);
@ -147,9 +149,9 @@ void MakeStat(void)
while ((fread(&mgroup, mgrouphdr.recsize, 1, fg)) == 1) { while ((fread(&mgroup, mgrouphdr.recsize, 1, fg)) == 1) {
if (mgroup.Active) { if (mgroup.Active) {
fseek(fi, fileptr, SEEK_SET); fseek(fi, fileptr, SEEK_SET);
html_massage(mgroup.Name, name, PATH_MAX -1); html_massage(chartran(mgroup.Name), name, PATH_MAX -1);
MacroVars("b", "s", name); MacroVars("b", "s", name);
html_massage(mgroup.Comment, name, PATH_MAX -1); html_massage(chartran(mgroup.Comment), name, PATH_MAX -1);
MacroVars("c", "s", name); MacroVars("c", "s", name);
MacroVars("d", "s", mgroup.UseAka.zone ? aka2str(mgroup.UseAka):"&nbsp;"); MacroVars("d", "s", mgroup.UseAka.zone ? aka2str(mgroup.UseAka):"&nbsp;");
MacroVars("e", "s", adate(mgroup.LastDate)); MacroVars("e", "s", adate(mgroup.LastDate));
@ -196,11 +198,11 @@ void MakeStat(void)
} }
fseek(fi, fileptr, SEEK_SET); fseek(fi, fileptr, SEEK_SET);
MacroVars("b", "d", Area); MacroVars("b", "d", Area);
html_massage(msgs.Name, name, PATH_MAX -1); html_massage(chartran(msgs.Name), name, PATH_MAX -1);
MacroVars("c", "s", strlen(name) ? name:"&nbsp;"); MacroVars("c", "s", strlen(name) ? name:"&nbsp;");
html_massage(msgs.Tag, name, PATH_MAX -1); html_massage(chartran(msgs.Tag), name, PATH_MAX -1);
MacroVars("d", "s", strlen(name) ? name:"&nbsp;"); MacroVars("d", "s", strlen(name) ? name:"&nbsp;");
html_massage(msgs.Group, name, PATH_MAX -1); html_massage(chartran(msgs.Group), name, PATH_MAX -1);
MacroVars("e", "s", strlen(name) ? name:"&nbsp;"); MacroVars("e", "s", strlen(name) ? name:"&nbsp;");
MacroVars("f", "s", adate(msgs.LastRcvd)); MacroVars("f", "s", adate(msgs.LastRcvd));
MacroVars("g", "d", msgs.Received.lweek); MacroVars("g", "d", msgs.Received.lweek);
@ -238,9 +240,9 @@ void MakeStat(void)
while ((fread(&fgroup, fgrouphdr.recsize, 1, fg)) == 1) { while ((fread(&fgroup, fgrouphdr.recsize, 1, fg)) == 1) {
if (fgroup.Active) { if (fgroup.Active) {
fseek(fi, fileptr, SEEK_SET); fseek(fi, fileptr, SEEK_SET);
html_massage(fgroup.Name, name, PATH_MAX -1); html_massage(chartran(fgroup.Name), name, PATH_MAX -1);
MacroVars("b", "s", name); MacroVars("b", "s", name);
html_massage(fgroup.Comment, name, PATH_MAX -1); html_massage(chartran(fgroup.Comment), name, PATH_MAX -1);
MacroVars("c", "s", name); MacroVars("c", "s", name);
MacroVars("d", "s", fgroup.UseAka.zone ? aka2str(fgroup.UseAka):"&nbsp;"); MacroVars("d", "s", fgroup.UseAka.zone ? aka2str(fgroup.UseAka):"&nbsp;");
MacroVars("e", "s", adate(fgroup.LastDate)); MacroVars("e", "s", adate(fgroup.LastDate));
@ -278,11 +280,11 @@ void MakeStat(void)
while ((fread(&tic, tichdr.recsize, 1, fg)) == 1) { while ((fread(&tic, tichdr.recsize, 1, fg)) == 1) {
if (tic.Active) { if (tic.Active) {
fseek(fi, fileptr, SEEK_SET); fseek(fi, fileptr, SEEK_SET);
html_massage(tic.Comment, name, PATH_MAX -1); html_massage(chartran(tic.Comment), name, PATH_MAX -1);
MacroVars("b", "s", name); MacroVars("b", "s", name);
html_massage(tic.Name, name, PATH_MAX -1); html_massage(chartran(tic.Name), name, PATH_MAX -1);
MacroVars("c", "s", name); MacroVars("c", "s", name);
html_massage(tic.Group, name, PATH_MAX -1); html_massage(chartran(tic.Group), name, PATH_MAX -1);
MacroVars("d", "s", name); MacroVars("d", "s", name);
MacroVars("e", "s", adate(tic.LastAction)); MacroVars("e", "s", adate(tic.LastAction));
MacroVars("f", "d", tic.Files.lweek); MacroVars("f", "d", tic.Files.lweek);
@ -328,7 +330,7 @@ void MakeStat(void)
else else
q = xstrcpy((char *)"Normal"); q = xstrcpy((char *)"Normal");
MacroVars("b", "s", aka2str(nodes.Aka[0])); MacroVars("b", "s", aka2str(nodes.Aka[0]));
html_massage(nodes.Sysop, name, PATH_MAX -1); html_massage(chartran(nodes.Sysop), name, PATH_MAX -1);
MacroVars("c", "s", name); MacroVars("c", "s", name);
MacroVars("d", "s", q); MacroVars("d", "s", q);
MacroVars("e", "s", p); MacroVars("e", "s", p);
@ -376,11 +378,11 @@ void MakeStat(void)
if (!strcmp(hist.aka.domain, "(null)")) if (!strcmp(hist.aka.domain, "(null)"))
hist.aka.domain[0] = '\0'; hist.aka.domain[0] = '\0';
MacroVars("c", "s", hist.aka.zone ? aka2str(hist.aka):"&nbsp;"); MacroVars("c", "s", hist.aka.zone ? aka2str(hist.aka):"&nbsp;");
html_massage(hist.system_name, name, PATH_MAX -1); html_massage(chartran(hist.system_name), name, PATH_MAX -1);
MacroVars("d", "s", strlen(name) ? name:"&nbsp;"); MacroVars("d", "s", strlen(name) ? name:"&nbsp;");
html_massage(hist.sysop, name, PATH_MAX -1); html_massage(chartran(hist.sysop), name, PATH_MAX -1);
MacroVars("e", "s", strlen(name) ? name:"&nbsp;"); MacroVars("e", "s", strlen(name) ? name:"&nbsp;");
html_massage(hist.location, name, PATH_MAX -1); html_massage(chartran(hist.location), name, PATH_MAX -1);
MacroVars("f", "s", strlen(name) ? name:"&nbsp;"); MacroVars("f", "s", strlen(name) ? name:"&nbsp;");
MacroVars("g", "s", strlen(hist.tty) ? hist.tty:"&nbsp;"); MacroVars("g", "s", strlen(hist.tty) ? hist.tty:"&nbsp;");
MacroVars("h", "s", adate(hist.online)); MacroVars("h", "s", adate(hist.online));
@ -435,6 +437,8 @@ void MakeStat(void)
free(name); free(name);
Syslog('+', "Finished making statistic HTML pages"); Syslog('+', "Finished making statistic HTML pages");
chartran_close();
if (!do_quiet) { if (!do_quiet) {
printf("\r \r"); printf("\r \r");
fflush(stdout); fflush(stdout);

View File

@ -39,6 +39,7 @@
extern int do_quiet; /* Suppress screen output */ extern int do_quiet; /* Suppress screen output */
extern int do_force; /* Force update */
int lastfile; /* Last file number */ int lastfile; /* Last file number */
int gfilepos = 0; /* Global file position */ int gfilepos = 0; /* Global file position */
int TotalHtml = 0; /* Total html files */ int TotalHtml = 0; /* Total html files */
@ -61,69 +62,23 @@ static char *months[]= {(char *)"Jan",(char *)"Feb",(char *)"Mar",
(char *)"Jul",(char *)"Aug",(char *)"Sep", (char *)"Jul",(char *)"Aug",(char *)"Sep",
(char *)"Oct",(char *)"Nov",(char *)"Dec"}; (char *)"Oct",(char *)"Nov",(char *)"Dec"};
#ifdef USE_EXPERIMENT
/*
* Translation table from Hi-USA-ANSI to low ASCII and HTML codes,
*/
char htmltab[] = {
"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017"
"\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
"\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057"
"\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077"
"\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117"
"\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137"
"\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157"
"\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177"
"\103\374\351\342\344\340\345\143\352\353\350\357\357\354\304\305" /* done */
"\311\346\306\364\366\362\374\371\171\326\334\244\243\245\120\146" /* done */
"\341\355\363\372\361\321\141\157\277\055\055\275\274\241\074\076" /* done */
"\043\043\043\174\053\053\053\053\053\043\174\043\043\053\053\053" /* done */
"\053\053\053\053\053\053\053\053\043\043\043\043\043\075\043\053" /* done */
"\053\053\053\053\053\053\053\053\053\053\053\043\043\043\043\043" /* done */
"\141\102\114\156\105\157\265\370\060\060\060\157\070\330\145\156" /* doesn't look good */
"\075\261\076\074\146\146\367\075\260\267\267\126\262\262\267\040" /* almost */
};
#endif
/* /*
* Translate a string from ANSI to safe HTML characters * Translate a string from ANSI to safe HTML characters
*/ */
/*
char *To_Html(char *); char *To_Html(char *);
char *To_Html(char *inp) char *To_Html(char *inp)
{ {
static char temp[256]; static char temp[1024];
int i;
#ifndef USE_EXPERIMENT
char *xl;
#endif
memset(&temp, 0, sizeof(temp)); memset(&temp, 0, sizeof(temp));
#ifdef USE_EXPERIMENT strncpy(temp, chartran(inp), sizeof(temp) -1);
strncpy(temp, inp, 80);
for (i = 0; i < strlen(temp); i++)
temp[i] = htmltab[temp[i] & 0xff];
#else
for (i = 0; i < strlen(inp); i++) {
if (inp[i] & 0x80) {
if ((xl = charset_map_c(inp[i], FALSE))) {
while (*xl) {
temp[i] = *xl++;
if (*xl)
i++;
}
}
} else
temp[i] = inp[i];
}
#endif
return temp; return temp;
} }
*/
void tidy_index(Findex **); void tidy_index(Findex **);
@ -631,13 +586,11 @@ void HtmlIndex(char *Lang)
fileptr = ftell(fi); fileptr = ftell(fi);
} }
#ifndef USE_EXPERIMENT
/* /*
* Setup the correct table to produce file listings for the www. * Setup the correct table to produce file listings for the www.
* This make ANSI grafics look a bit nicer with browsers. * This make ANSI grafics look a bit nicer with browsers.
*/ */
charset_set_in_out((char *)"cp437", (char *)"iso-8859-1"); chartran_init((char *)"CP437", (char *)"UTF-8", 'f');
#endif
for (i = 1; i <= iAreas; i++) { for (i = 1; i <= iAreas; i++) {
@ -679,7 +632,7 @@ void HtmlIndex(char *Lang)
aTotal = 0; aTotal = 0;
last = 0L; last = 0L;
if (obj_time < db_time) { if ((obj_time < db_time) || do_force) {
/* /*
* If not up todate * If not up todate
*/ */
@ -753,9 +706,10 @@ void HtmlIndex(char *Lang)
snprintf(desc+k, 2, "\n"); snprintf(desc+k, 2, "\n");
k += 1; k += 1;
} }
snprintf(linebuf, 1024, "%s", To_Html(fdb.Desc[j])); html_massage(fdb.Desc[j], linebuf, 1024);
html_massage(linebuf, outbuf, 1024); // strncpy(linebuf, fdb.Desc[j], 1024);
snprintf(desc+k, 6400 -k, "%s", outbuf); strncpy(outbuf, chartran(linebuf), 1024);
strncat(desc, outbuf, 6400 -k);
k += strlen(outbuf); k += strlen(outbuf);
} }
MacroVars("m", "s", desc); MacroVars("m", "s", desc);
@ -844,6 +798,7 @@ void HtmlIndex(char *Lang)
} }
fclose(pAreas); fclose(pAreas);
chartran_close();
if (!do_quiet) { if (!do_quiet) {
printf("\r \r"); printf("\r \r");

View File

@ -78,36 +78,20 @@ extern int most_debug;
* Internal functions * Internal functions
*/ */
int needputrfc(rfcmsg *, int); int needputrfc(rfcmsg *, int);
#ifdef USE_EXPERIMENT
int use_iconv = FALSE;
iconv_t iconv_s;
#endif
int charwrite(char *s, FILE *fp) int charwrite(char *s, FILE *fp)
{ {
#ifndef USE_EXPERIMENT char temp[2048];
char *o;
#endif
if ((strlen(s) >= 3) && (strncmp(s,"---",3) == 0) && (s[3] != '-')) { if ((strlen(s) >= 3) && (strncmp(s,"---",3) == 0) && (s[3] != '-')) {
putc('-',fp); putc('-',fp);
putc(' ',fp); putc(' ',fp);
} }
while (*s) { strncpy(temp, chartran(s), sizeof(temp) -1);
#ifdef USE_EXPERIMENT fputs(temp, fp);
putc(*s, fp);
#else
o = s;
if (s[0] &0x080) {
o = charset_map_c(s[0], 0);
}
putc(*o, fp);
#endif
s++;
}
return 0; return 0;
} }
@ -348,25 +332,11 @@ int rfc2ftn(FILE *fp, faddr *recipient)
hdrsize += (fmsg->to->name)?strlen(fmsg->to->name):0; hdrsize += (fmsg->to->name)?strlen(fmsg->to->name):0;
Syslog('m', "rfc2ftn: charset in: %s charset out: %s", charset,getrfcchrs(msgs.Charset)); Syslog('m', "rfc2ftn: charset in: %s charset out: %s", charset,getrfcchrs(msgs.Charset));
#ifndef USE_EXPERIMENT
/* /*
* Setup charset conversion * Setup charset conversion
*/ */
charset_set_in_out(charset,getrfcchrs(msgs.Charset)); chartran_init(charset,getrfcchrs(msgs.Charset), 'm');
#endif
#ifdef USE_EXPERIMENT
if (strcmp(charset,getrfcchrs(msgs.Charset)) == 0) {
Syslog('m', "rfc2ftn: no need for iconv");
} else {
iconv_s = iconv_open(getrfcchrs(msgs.Charset), charset);
if (iconv_s != (iconv_t)-1) {
Syslog('m', "rfc2ftn: activated iconv");
use_iconv = TRUE;
} else {
Syslog('+', "rfc2ftn: iconv_open(%s, %s) failed", getrfcchrs(msgs.Charset), charset);
}
}
#endif
do { do {
Syslog('m', "rfc2ftn: split loop, splitpart = %d", splitpart); Syslog('m', "rfc2ftn: split loop, splitpart = %d", splitpart);
@ -767,16 +737,7 @@ int rfc2ftn(FILE *fp, faddr *recipient)
} while (needsplit); } while (needsplit);
Syslog('m', "rfc2ftn: out of splitloop"); Syslog('m', "rfc2ftn: out of splitloop");
chartran_close();
#ifdef USE_EXPERIMENT
if (use_iconv) {
if (iconv_close(iconv_s))
WriteError("$rfc2ftn: iconv_close()");
else
Syslog('m', "rfc2ftn: inconv_close() success");
use_iconv = FALSE;
}
#endif
free(temp); free(temp);
if (charset) if (charset)

View File

@ -198,7 +198,7 @@ void command_abhs(char *buf)
charindex = find_ftn_charset(charset); charindex = find_ftn_charset(charset);
if (charindex != FTNC_ERROR) { if (charindex != FTNC_ERROR) {
chartran_init(charmap[charindex].ic_ftn, (char *)"UTF-8"); chartran_init(charmap[charindex].ic_ftn, (char *)"UTF-8", 'n');
} }
if ((strcasecmp(cmd, "ARTICLE") == 0) || (strcasecmp(cmd, "HEAD") == 0)) { if ((strcasecmp(cmd, "ARTICLE") == 0) || (strcasecmp(cmd, "HEAD") == 0)) {

View File

@ -79,27 +79,12 @@ int needputrfc(rfcmsg *, int);
int charwrite(char *, FILE *); int charwrite(char *, FILE *);
int charwrite(char *s, FILE *fp) int charwrite(char *s, FILE *fp)
{ {
#ifndef USE_EXPERIMENT
char *o;
#endif
if ((strlen(s) >= 3) && (strncmp(s,"---",3) == 0) && (s[3] != '-')) { if ((strlen(s) >= 3) && (strncmp(s,"---",3) == 0) && (s[3] != '-')) {
putc('-',fp); putc('-',fp);
putc(' ',fp); putc(' ',fp);
} }
while (*s) {
#ifdef USE_EXPERIMENT fwrite(s, strlen(s), 1, fp);
putc(*s, fp);
#else
o=s;
if (s[0] &0x080) {
o=charset_map_c(s[0],0);
}
// putc(*s, fp);
putc (*o,fp);
#endif
s++;
}
return 0; return 0;
} }
@ -291,10 +276,7 @@ int rfc2ftn(FILE *fp)
charset = xstrcpy((char *)"iso-8859-1"); charset = xstrcpy((char *)"iso-8859-1");
Syslog('m', "No charset, setting default to iso-8859-1"); Syslog('m', "No charset, setting default to iso-8859-1");
} }
chartran_init(charset,getrfcchrs(msgs.Charset), 'm');
#ifndef USE_EXPERIMENT
charset_set_in_out(charset,getrfcchrs(msgs.Charset));
#endif
if ((p = hdr((char *)"Message-ID",msg))) { if ((p = hdr((char *)"Message-ID",msg))) {
if (!removemsgid) if (!removemsgid)
@ -804,6 +786,7 @@ int rfc2ftn(FILE *fp)
free(temp); free(temp);
if (charset) if (charset)
free(charset); free(charset);
chartran_close();
tidyrfc(msg); tidyrfc(msg);
tidy_ftnmsg(fmsg); tidy_ftnmsg(fmsg);
UpdateMsgs(); UpdateMsgs();

View File

@ -595,33 +595,6 @@ void Chg_Address()
/*
* Toggle Graphics
*/
void Chg_Graphics()
{
ReadExitinfo();
Enter(2);
if (exitinfo.GraphMode) {
exitinfo.GraphMode = FALSE;
/* Ansi Mode turned OFF */
pout(WHITE, BLACK, (char *) Language(76));
} else {
exitinfo.GraphMode = TRUE;
/* Ansi Mode turned ON */
pout(WHITE, BLACK, (char *) Language(75));
}
Syslog('+', "Graphics mode now %s", exitinfo.GraphMode?"On":"Off");
Enter(2);
TermInit(exitinfo.GraphMode);
WriteExitinfo();
sleep(2);
}
void Chg_VoicePhone() void Chg_VoicePhone()
{ {
char temp[81]; char temp[81];
@ -1111,6 +1084,7 @@ void Chg_Charset()
Syslog('+', "New character set %s", getftnchrs(exitinfo.Charset)); Syslog('+', "New character set %s", getftnchrs(exitinfo.Charset));
WriteExitinfo(); WriteExitinfo();
setlocale(LC_CTYPE, getlocale(exitinfo.Charset)); setlocale(LC_CTYPE, getlocale(exitinfo.Charset));
utf8 = (exitinfo.Charset == FTNC_UTF8);
Syslog('b', "setlocale(LC_CTYPE, NULL) returns \"%s\"", printable(setlocale(LC_CTYPE, NULL), 0)); Syslog('b', "setlocale(LC_CTYPE, NULL) returns \"%s\"", printable(setlocale(LC_CTYPE, NULL), 0));
Enter(2); Enter(2);
colour(LIGHTGREEN, BLACK); colour(LIGHTGREEN, BLACK);

View File

@ -14,7 +14,6 @@ void Chg_FsMsged(void); /* Toggle Fullscreen Editor */
void Chg_FsMsgedKeys(void); /* Toggle FS editor shortcut keys */ void Chg_FsMsgedKeys(void); /* Toggle FS editor shortcut keys */
void Chg_Location(void); /* Change location */ void Chg_Location(void); /* Change location */
void Chg_Address(void); /* Change address */ void Chg_Address(void); /* Change address */
void Chg_Graphics(void); /* Toggle graphics */
void Chg_VoicePhone(void); /* Change voicephone */ void Chg_VoicePhone(void); /* Change voicephone */
void Chg_DataPhone(void); /* Change dataphone */ void Chg_DataPhone(void); /* Change dataphone */
void Chg_News(void); /* Toggle News Bulletins */ void Chg_News(void); /* Toggle News Bulletins */

View File

@ -231,63 +231,49 @@ int DisplayTextFile(char *filename)
*/ */
int DisplayFile(char *filename) int DisplayFile(char *filename)
{ {
FILE *pFileName; FILE *fp = NULL;
int iSec = 0; int iSec = 0;
char *sFileName, *tmp, *tmp1, newfile[PATH_MAX]; char tmp[256], tmp1[256], buf[256], out[1024], newfile[PATH_MAX];
int i, x; int x;
unsigned char c; unsigned char c;
sFileName = calloc(16385, sizeof(char));
tmp = calloc(PATH_MAX, sizeof(char));
tmp1 = calloc(PATH_MAX, sizeof(char));
/* /*
* Open the file in the following search order: * Open the file in the following search order:
* 1 - if GraphMode -> users language .ans * 1 - users language .ans
* 2 - if GraphMode -> default language .ans * 2 - default language .ans
* 3 - users language .asc * 3 - Abort, there is no file to show.
* 4 - default language .asc
* 5 - Abort, there is no file to show.
*/ */
pFileName = NULL; snprintf(newfile, PATH_MAX, "%s/share/int/txtfiles/%s/%s.ans", getenv("MBSE_ROOT"), lang.lc, filename);
if (exitinfo.GraphMode) { if ((fp = fopen(newfile, "rb")) == NULL) {
snprintf(newfile, PATH_MAX, "%s/share/int/txtfiles/%s/%s.ans", getenv("MBSE_ROOT"), lang.lc, filename); snprintf(newfile, PATH_MAX, "%s/share/int/txtfiles/%s/%s.ans", getenv("MBSE_ROOT"), CFG.deflang, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) { if ((fp = fopen(newfile, "rb")) == NULL) {
snprintf(newfile, PATH_MAX, "%s/share/int/txtfiles/%s/%s.ans", getenv("MBSE_ROOT"), CFG.deflang, filename); return FALSE;
pFileName = fopen(newfile, "rb");
}
}
if (pFileName == NULL) {
snprintf(newfile, PATH_MAX, "%s/share/int/txtfiles/%s/%s.asc", getenv("MBSE_ROOT"), lang.lc, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) {
snprintf(newfile, PATH_MAX, "%s/share/int/txtfiles/%s/%s.asc", getenv("MBSE_ROOT"), CFG.deflang, filename);
if ((pFileName = fopen(newfile, "rb")) == NULL) {
free(sFileName);
free(tmp);
free(tmp1);
return FALSE;
}
} }
} }
Syslog('B', "Displayfile %s", newfile); if (utf8) {
chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
}
Syslog('b', "Displayfile %s %s mode", newfile, utf8? "UTF-8":"CP437");
memset(&out, 0, sizeof(out));
while (!feof(pFileName)) { while (fgets(buf, sizeof(buf)-1, fp)) {
i = fread(sFileName, sizeof(char), 16384, pFileName);
for (x = 0; x < i; x++) { for (x = 0; x < strlen(buf); x++) {
c = *(sFileName + x) & 0xff; c = buf[x] & 0xff;
switch (c) { switch (c) {
case '': ControlCodeU(sFileName[++x]); case '': strncat(out, ControlCodeU(buf[++x]), sizeof(out)-1);
break; break;
case '': ControlCodeF(sFileName[++x]); case '': strncat(out, ControlCodeF(buf[++x]), sizeof(out)-1);
break; break;
case ' ': ControlCodeK(sFileName[++x]); case ' ': strncat(out, ControlCodeK(buf[++x]), sizeof(out)-1);
break; break;
case '': alarm_on(); case '': PUTSTR(chartran(out));
memset(&out, 0, sizeof(out));
alarm_on();
Readkey(); Readkey();
break; break;
@ -300,38 +286,45 @@ int DisplayFile(char *filename)
*/ */
x++; x++;
strcpy(tmp1, ""); strcpy(tmp1, "");
while (*(sFileName + x) != '') { while (buf[x] != '') {
snprintf(tmp, PATH_MAX, "%c", *(sFileName + x)); snprintf(tmp, sizeof(tmp)-1, "%c", buf[x]);
strcat(tmp1, tmp); strncat(tmp1, tmp, sizeof(tmp1)-1);
x++; x++;
} }
x++; x++;
iSec = atoi(tmp1); iSec = atoi(tmp1);
while ((x <= i) && (*(sFileName + x) != '')) { while ((x <= strlen(buf)) && buf[x] != '') {
if (exitinfo.Security.level >= iSec) if (exitinfo.Security.level >= iSec) {
PUTCHAR(*(sFileName + x)); snprintf(tmp1, sizeof(tmp1) -1, "%c", buf[x]);
strncat(out, tmp1, sizeof(out)-1);
}
x++; x++;
} }
break; break;
case '': sleep(1); case '\r': break;
case '\n': strncat(out, (char *)"\r\n", sizeof(out));
break; break;
case '\n': Enter(1); /* Insert <cr>, we are in raw mode */ case '': PUTSTR(chartran(out));
memset(&out, 0, sizeof(out));
FLUSHOUT();
sleep(1);
break; break;
case '\r': break; /* If the file has <cr> chars (DOS), eat them */ default: snprintf(tmp1, sizeof(tmp1)-1, "%c", buf[x]);
strncat(out, tmp1, sizeof(out));
default: PUTCHAR(*(sFileName + x));
} /* switch */ } /* switch */
} /* for */ } /* for */
} /* while !eof */
fclose(pFileName); PUTSTR(chartran(out));
free(sFileName); memset(&out, 0, sizeof(out));
free(tmp);
free(tmp1); } /* while fgets */
fclose(fp);
chartran_close();
return TRUE; return TRUE;
} }
@ -352,9 +345,9 @@ int DisplayFileEnter(char *File)
void ControlCodeF(int ch) char *ControlCodeF(int ch)
{ {
char temp[81]; static char temp[81];
/* Update user info */ /* Update user info */
ReadExitinfo(); ReadExitinfo();
@ -406,14 +399,15 @@ void ControlCodeF(int ch)
default: default:
snprintf(temp, 81, " "); snprintf(temp, 81, " ");
} }
PUTSTR(temp);
return temp;
} }
void ControlCodeU(int ch) char *ControlCodeU(int ch)
{ {
char temp[81]; static char temp[81];
/* /*
* Update user info * Update user info
@ -487,7 +481,7 @@ void ControlCodeU(int ch)
break; break;
case 'P': case 'P':
snprintf(temp, 81, "%s", exitinfo.GraphMode ? (char *) Language(147) : (char *) Language(148)); snprintf(temp, 81, "%s", (char *) Language(147));
break; break;
case 'R': case 'R':
@ -569,15 +563,17 @@ void ControlCodeU(int ch)
default: default:
snprintf(temp, 81, " "); snprintf(temp, 81, " ");
} }
PUTSTR(temp);
return temp;
} }
void ControlCodeK(int ch) char *ControlCodeK(int ch)
{ {
FILE *pCallerLog; FILE *pCallerLog;
char sDataFile[PATH_MAX], temp[81]; char sDataFile[PATH_MAX];
static char temp[81];
lastread LR; lastread LR;
switch (toupper(ch)) { switch (toupper(ch)) {
@ -680,7 +676,7 @@ void ControlCodeK(int ch)
} }
PUTSTR(temp); return temp;
} }

View File

@ -8,9 +8,9 @@ void DisplayRules(void); /* Display area rules */
int DisplayTextFile(char *); /* Display a flat textfile */ int DisplayTextFile(char *); /* Display a flat textfile */
int DisplayFile(char *); /* Display .ans/.asc textfile */ int DisplayFile(char *); /* Display .ans/.asc textfile */
int DisplayFileEnter(char *); /* Display .ans/.asc wait for Enter */ int DisplayFileEnter(char *); /* Display .ans/.asc wait for Enter */
void ControlCodeF(int); /* Check Control Codes in File */ char *ControlCodeF(int); /* Check Control Codes in File */
void ControlCodeU(int); /* Check Control Codes in File */ char *ControlCodeU(int); /* Check Control Codes in File */
void ControlCodeK(int); /* Check Control Codes in File */ char *ControlCodeK(int); /* Check Control Codes in File */
#endif #endif

View File

@ -4,7 +4,7 @@
* Purpose ...............: Run external door * Purpose ...............: Run external door
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -220,7 +220,7 @@ void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSu
fprintf(fp, "%s\r\n", Gdate(exitinfo.tLastLoginDate, Y2Kdoorsys)); fprintf(fp, "%s\r\n", Gdate(exitinfo.tLastLoginDate, Y2Kdoorsys));
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft * 60); /* Seconds */ fprintf(fp, "%d\r\n", exitinfo.iTimeLeft * 60); /* Seconds */
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft); /* Minutes */ fprintf(fp, "%d\r\n", exitinfo.iTimeLeft); /* Minutes */
fprintf(fp, "%s\r\n", exitinfo.GraphMode?"GR":"NG"); /* Graphics GR,RIP,NG */ fprintf(fp, "GR\r\n"); /* Graphics GR,RIP,NG */
fprintf(fp, "%d\r\n", rows); fprintf(fp, "%d\r\n", rows);
fprintf(fp, "N\r\n"); /* User mode, always N */ fprintf(fp, "N\r\n"); /* User mode, always N */
fprintf(fp, "\r\n"); /* Always blank */ fprintf(fp, "\r\n"); /* Always blank */
@ -285,7 +285,7 @@ void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSu
fprintf(fp, "%s\r\n", exitinfo.sHandle); /* User's handle */ fprintf(fp, "%s\r\n", exitinfo.sHandle); /* User's handle */
fprintf(fp, "%d\r\n", exitinfo.Security.level); /* User's security level */ fprintf(fp, "%d\r\n", exitinfo.Security.level); /* User's security level */
fprintf(fp, "%d\r\n", exitinfo.iTimeLeft); /* User's time left in minutes */ fprintf(fp, "%d\r\n", exitinfo.iTimeLeft); /* User's time left in minutes */
fprintf(fp, "%s\r\n", exitinfo.GraphMode?"1":"0"); /* User's graphic mode */ fprintf(fp, "1\r\n"); /* User's graphic mode */
fprintf(fp, "%d\r\n\032", iNode); /* Node number */ fprintf(fp, "%d\r\n\032", iNode); /* Node number */
fclose(fp); fclose(fp);
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Internet email * Purpose ...............: Internet email
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -455,7 +455,7 @@ int Read_a_Email(unsigned int Num)
if (Kludges) { if (Kludges) {
pout(LIGHTGRAY, BLACK, p); pout(LIGHTGRAY, BLACK, p);
Enter(1); Enter(1);
if (CheckLine(CFG.TextColourF, CFG.TextColourB, TRUE, FALSE)) if (CheckLine(CFG.TextColourF, CFG.TextColourB, TRUE))
break; break;
} }
} else { } else {
@ -465,7 +465,7 @@ int Read_a_Email(unsigned int Num)
colour(CFG.HiliteF, CFG.HiliteB); colour(CFG.HiliteF, CFG.HiliteB);
PUTSTR(p); PUTSTR(p);
Enter(1); Enter(1);
if (CheckLine(CFG.TextColourF, CFG.TextColourB, TRUE, FALSE)) if (CheckLine(CFG.TextColourF, CFG.TextColourB, TRUE))
break; break;
} }
} while ((p = (char *)MsgText_Next()) != NULL); } while ((p = (char *)MsgText_Next()) != NULL);

View File

@ -4,7 +4,7 @@
* Purpose ...............: FullScreen Message editor. * Purpose ...............: FullScreen Message editor.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -45,6 +45,8 @@
extern int cols; extern int cols;
extern int rows; extern int rows;
char hstr[81];
void Show_Ins(void) void Show_Ins(void)
{ {
@ -80,80 +82,83 @@ void Top_Menu(void)
} }
void Ls(int a, int y) void Ls(int y)
{ {
locate(y, 10); strcpy(hstr, locate_str(y, 10));
PUTCHAR(a ? 179 : '|'); strncat(hstr, (char *)"\xB3", 80);
} }
void Rs(int a) void Rs()
{ {
colour(LIGHTGREEN, BLUE); strncat(hstr, colour_str(LIGHTGREEN, BLUE), 80);
PUTCHAR(a ? 179 : '|'); strncat(hstr, (char *)"\xB3", 80);
} }
void Ws(int a, int y) void Ws(int y)
{ {
int i; int i;
Ls(a, y); Ls(y);
for (i = 0; i < 58; i++) for (i = 0; i < 58; i++)
PUTCHAR(' '); strncat(hstr, (char *)" ", 80);
Rs(a); Rs();
} }
void Hl(int a, int y, char *txt) void Hl(int y, char *txt)
{ {
Ls(a, y); Ls(y);
colour(WHITE, BLUE); strncat(hstr, colour_str(WHITE, BLUE), 80);
PUTSTR(padleft(txt, 58, ' ')); strncat(hstr, padleft(txt, 58, ' '), 80);
Rs(a); Rs();
PUTSTR(chartran(hstr));
} }
void Full_Help(void) void Full_Help(void)
{ {
int a, i; strcpy(hstr, colour_str(LIGHTGREEN, BLUE));
a = exitinfo.GraphMode;
colour(LIGHTGREEN, BLUE);
/* Top row */ /* Top row */
locate(1, 10); strncat(hstr, locate_str(1, 10), 80);
PUTCHAR(a ? 213 : '+'); strncat(hstr, (char *)"\xDA", 80);
for (i = 0; i < 58; i++) strncat(hstr, hLine_str(58), 80);
PUTCHAR(a ? 205 : '='); strncat(hstr, (char *)"\xBF", 80);
PUTCHAR(a ? 184 : '+'); PUTSTR(chartran(hstr));
Ws(a, 2); Ws(2);
PUTSTR(chartran(hstr));
Ls(a, 3); Ls(3);
colour(YELLOW, BLUE); strncat(hstr, colour_str(YELLOW, BLUE), 80);
PUTSTR(padleft((char *)" Editor Help", 58, ' ')); strncat(hstr, padleft((char *)" Editor Help", 58, ' '), 80);
Rs(a); Rs();
PUTSTR(chartran(hstr));
Ws(a, 4); Ws(4);
Hl(a, 5, (char *)"Ctrl-S or LeftArrow - Cursor left"); PUTSTR(chartran(hstr));
Hl(a, 6, (char *)"Ctrl-D or RightArrow - Cursor right");
Hl(a, 7, (char *)"Ctrl-E or UpArrow - Cursor up");
Hl(a, 8, (char *)"Ctrl-X or DownArrow - Cursor down");
Hl(a, 9, (char *)"Ctrl-V or Insert - Insert or Overwrite");
Hl(a, 10, (char *)"Ctrl-N - Insert line");
Hl(a, 11, (char *)"Ctrl-Y - Delete line");
Ws(a, 12);
Hl(a, 13, (char *)"Ctrl-L - Refresh screen");
Hl(a, 14, (char *)"Ctrl-R - Read from file");
Ws(a, 15);
locate(16,10); Hl( 5, (char *)"Ctrl-S or LeftArrow - Cursor left");
PUTCHAR(a ? 212 : '+'); Hl( 6, (char *)"Ctrl-D or RightArrow - Cursor right");
for (i = 0; i < 58; i++) Hl( 7, (char *)"Ctrl-E or UpArrow - Cursor up");
PUTCHAR(a ? 205 : '='); Hl( 8, (char *)"Ctrl-X or DownArrow - Cursor down");
PUTCHAR(a ? 190 : '+'); Hl( 9, (char *)"Ctrl-V or Insert - Insert or Overwrite");
Hl(10, (char *)"Ctrl-N - Insert line");
Hl(11, (char *)"Ctrl-Y - Delete line");
Ws(12);
PUTSTR(chartran(hstr));
Hl(13, (char *)"Ctrl-L - Refresh screen");
Hl(14, (char *)"Ctrl-R - Read from file");
Ws(15);
PUTSTR(chartran(hstr));
strcpy(hstr, locate_str(16,10));
strncat(hstr, (char *)"\xC0", 80);
strncat(hstr, hLine_str(58), 80);
strncat(hstr, (char *)"\xD9", 80);
PUTSTR(chartran(hstr));
} }
@ -411,6 +416,9 @@ int Fs_Edit()
FILE *fd; FILE *fd;
Syslog('b', "FSEDIT: Entering FullScreen editor"); Syslog('b', "FSEDIT: Entering FullScreen editor");
if (utf8)
chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
clear(); clear();
InsMode = TRUE; InsMode = TRUE;
TopVisible = 1; TopVisible = 1;
@ -700,6 +708,7 @@ int Fs_Edit()
if (ch == 'A' || ch == 'S') { if (ch == 'A' || ch == 'S') {
Syslog('b', "FSEDIT: %s message (%c)", (ch == 'S' && Changed) ? "Saving" : "Aborting", ch); Syslog('b', "FSEDIT: %s message (%c)", (ch == 'S' && Changed) ? "Saving" : "Aborting", ch);
clear(); clear();
chartran_close();
if (ch == 'S' && Changed) { if (ch == 'S' && Changed) {
Syslog('+', "FSEDIT: Message will be saved"); Syslog('+', "FSEDIT: Message will be saved");
return TRUE; return TRUE;
@ -781,6 +790,7 @@ int Fs_Edit()
} }
} }
chartran_close();
WriteError("FsEdit(): Impossible to be here"); WriteError("FsEdit(): Impossible to be here");
return FALSE; return FALSE;
} }

View File

@ -18,10 +18,10 @@ int CurRow; /* Current row in buffer */
void Show_Ins(void); void Show_Ins(void);
void Top_Help(void); void Top_Help(void);
void Top_Menu(void); void Top_Menu(void);
void Ls(int, int); void Ls(int);
void Rs(int); void Rs(void);
void Ws(int, int); void Ws(int);
void Hl(int, int, char *); void Hl(int, char *);
void Full_Help(void); void Full_Help(void);
void Setcursor(void); void Setcursor(void);
void Beep(void); void Beep(void);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Display Last Callers * Purpose ...............: Display Last Callers
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -60,53 +60,54 @@ extern int cols;
void LastCallers(char *OpData) void LastCallers(char *OpData)
{ {
FILE *pLC; FILE *pLC;
int LineCount = 5, count = 0, i, x; int LineCount = 5, count = 0;
char *sFileName, *Heading, *Underline; char lstr[128], *sFileName, *Heading;
struct lastcallers lcall; struct lastcallers lcall;
struct lastcallershdr lcallhdr; struct lastcallershdr lcallhdr;
sFileName = calloc(PATH_MAX, sizeof(char)); sFileName = calloc(PATH_MAX, sizeof(char));
Heading = calloc(81, sizeof(char)); Heading = calloc(81, sizeof(char));
Underline = calloc(81, sizeof(char));
clear(); if (utf8)
chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
strcpy(lstr, clear_str());
PUTSTR(chartran(lstr));
snprintf(sFileName, PATH_MAX, "%s/etc/lastcall.data", getenv("MBSE_ROOT")); snprintf(sFileName, PATH_MAX, "%s/etc/lastcall.data", getenv("MBSE_ROOT"));
if ((pLC = fopen(sFileName,"r")) == NULL) if ((pLC = fopen(sFileName,"r")) == NULL)
WriteError("$LastCallers: Can't open %s", sFileName); WriteError("$LastCallers: Can't open %s", sFileName);
else { else {
fread(&lcallhdr, sizeof(lcallhdr), 1, pLC); fread(&lcallhdr, sizeof(lcallhdr), 1, pLC);
colour(WHITE, BLACK);
strcpy(lstr, colour_str(WHITE, BLACK));
/* Todays callers to */ /* Todays callers to */
snprintf(Heading, 81, "%s%s", (char *) Language(84), CFG.bbs_name); snprintf(Heading, 81, "%s%s", (char *) Language(84), CFG.bbs_name);
Center(Heading); strncat(lstr, Center_str(Heading), 127);
PUTSTR(chartran(lstr));
x = strlen(Heading);
for (i = 0; i < x; i++)
snprintf(Underline, 81, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
colour(LIGHTRED, BLACK);
Center(Underline);
strcpy(lstr, colour_str(LIGHTRED, BLACK));
strncat(lstr, Center_str(hLine_str(strlen(Heading))), 127);
PUTSTR(chartran(lstr));
Enter(1); Enter(1);
/* # User Name Device timeOn Calls Location */ /* # User Name Device timeOn Calls Location */
pout(LIGHTGREEN, BLACK, (char *) Language(85)); strcpy(lstr, poutCR_str(LIGHTGREEN, BLACK, (char *) Language(85)));
Enter(1); PUTSTR(chartran(lstr));
colour(GREEN, BLACK); strcpy(lstr, colour_str(GREEN, BLACK));
fLine(cols -1); strncat(lstr, fLine_str(cols -1), 127);
PUTSTR(chartran(lstr));
while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) { while (fread(&lcall, lcallhdr.recsize, 1, pLC) == 1) {
if (!lcall.Hidden) { if (!lcall.Hidden) {
count++; count++;
colour(WHITE, BLACK); strcpy(lstr, colour_str(WHITE, BLACK));
snprintf(Heading, 81, "%-5d", count); snprintf(Heading, 81, "%-5d", count);
PUTSTR(Heading); strncat(lstr, Heading, 127);
colour(LIGHTCYAN, BLACK); strncat(lstr, colour_str(LIGHTCYAN, BLACK), 127);
if ((strcasecmp(OpData, "/H")) == 0) { if ((strcasecmp(OpData, "/H")) == 0) {
if ((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' ')) if ((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
snprintf(Heading, 81, "%-20s", lcall.Handle); snprintf(Heading, 81, "%-20s", lcall.Handle);
@ -117,39 +118,42 @@ void LastCallers(char *OpData)
} else { } else {
snprintf(Heading, 81, "%-20s", lcall.UserName); snprintf(Heading, 81, "%-20s", lcall.UserName);
} }
PUTSTR(Heading); strncat(lstr, Heading, 127);
snprintf(Heading, 81, "%-8s", lcall.Device); snprintf(Heading, 81, "%-8s", lcall.Device);
pout(LIGHTBLUE, BLACK, Heading); strncat(lstr, pout_str(LIGHTBLUE, BLACK, Heading), 127);
snprintf(Heading, 81, "%-8s", lcall.TimeOn); snprintf(Heading, 81, "%-8s", lcall.TimeOn);
pout(LIGHTMAGENTA, BLACK, Heading); strncat(lstr, pout_str(LIGHTMAGENTA, BLACK, Heading), 127);
snprintf(Heading, 81, "%-7d", lcall.Calls); snprintf(Heading, 81, "%-7d", lcall.Calls);
pout(YELLOW, BLACK, Heading); strncat(lstr, pout_str(YELLOW, BLACK, Heading), 127);
snprintf(Heading, 81, "%-32s", lcall.Location); snprintf(Heading, 81, "%-32s", lcall.Location);
pout(LIGHTRED, BLACK, Heading); strncat(lstr, pout_str(LIGHTRED, BLACK, Heading), 127);
PUTSTR(chartran(lstr));
Enter(1); Enter(1);
LineCount++; LineCount++;
if (LineCount == rows) { if (LineCount == (rows -2)) {
Pause(); Pause();
LineCount = 0; LineCount = 0;
} }
} /* End of check if user is hidden */ } /* End of check if user is hidden */
} }
colour(GREEN, BLACK); strcpy(lstr, colour_str(GREEN, BLACK));
fLine(cols -1); strncat(lstr, fLine_str(cols -1), 127);
PUTSTR(chartran(lstr));
fclose(pLC); fclose(pLC);
Enter(1); Enter(1);
Pause(); Pause();
} }
free(sFileName); free(sFileName);
free(Heading); free(Heading);
free(Underline); chartran_close();
} }

View File

@ -5,7 +5,7 @@
* Todo ..................: Implement message groups. * Todo ..................: Implement message groups.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -79,11 +79,7 @@ extern int rows;
/* /*
* Internal prototypes * Internal prototypes
*/ */
#ifdef USE_EXPERIMENT
void ShowMsgHdr(void); /* Show message header */ void ShowMsgHdr(void); /* Show message header */
#else
void ShowMsgHdr(int Conv); /* Show message header */
#endif
int Read_a_Msg(unsigned int Num, int);/* Read a message */ int Read_a_Msg(unsigned int Num, int);/* Read a message */
int Export_a_Msg(unsigned int Num);/* Export message to homedir */ int Export_a_Msg(unsigned int Num);/* Export message to homedir */
int ReadPanel(void); /* Read panel bar */ int ReadPanel(void); /* Read panel bar */
@ -897,20 +893,13 @@ int Save_Msg(int IsReply, faddr *Dest)
/* /*
* Show message header screen top for reading messages. * Show message header screen top for reading messages.
*/ */
#ifdef USE_EXPERIMENT
void ShowMsgHdr(void) void ShowMsgHdr(void)
#else
void ShowMsgHdr(int Conv)
#endif
{ {
static char Buf1[35], Buf2[35], Buf3[81]; static char Buf1[35], Buf2[35], Buf3[81];
char msg[81]; char msg[81];
struct tm *tm; struct tm *tm;
time_t now; time_t now;
int color; int color;
#ifndef USE_EXPERIMENT
int i;
#endif
Buf1[0] = '\0'; Buf1[0] = '\0';
Buf2[0] = '\0'; Buf2[0] = '\0';
@ -998,22 +987,7 @@ void ShowMsgHdr(int Conv)
/* Subject : */ /* Subject : */
pout(YELLOW, BLACK, (char *) Language(210)); pout(YELLOW, BLACK, (char *) Language(210));
#ifdef USE_EXPERIMENT pout(GREEN, BLACK, chartran(Msg.Subject));
pout(GREEN, BLACK, Msg.Subject);
#else
colour(GREEN, BLACK);
if (Conv) {
/*
* Try to translate character sets
*/
for (i = 0; i < strlen(Msg.Subject); i++) {
PUTSTR(charset_map_c(Msg.Subject[i], FALSE));
}
} else {
PUTSTR(Msg.Subject);
}
#endif
Enter(1); Enter(1);
colour(CFG.HiliteF, CFG.HiliteB); colour(CFG.HiliteF, CFG.HiliteB);
@ -1185,12 +1159,9 @@ int Export_a_Msg(unsigned int Num)
*/ */
int Read_a_Msg(unsigned int Num, int UpdateLR) int Read_a_Msg(unsigned int Num, int UpdateLR)
{ {
char *p = NULL, *fn, *charset = NULL, *charsin = NULL, *charsout = NULL; char *p = NULL, *fn, *charset = NULL, *charsin = NULL, temp[256];
int ShowMsg = TRUE, UseIconv = FALSE; int ShowMsg = TRUE;
lastread LR; lastread LR;
#ifndef USE_EXPERIMENT
int i;
#endif
LastNum = Num; LastNum = Num;
iLineCount = 7; iLineCount = 7;
@ -1280,25 +1251,21 @@ int Read_a_Msg(unsigned int Num, int UpdateLR)
/* /*
* No charset marked in the message, use the area charset * No charset marked in the message, use the area charset
*/ */
charset = xstrcpy(getftnchrs(msgs.Charset)); charsin = xstrcpy(get_ic_ftn(msgs.Charset));
} else {
charsin = xstrcpy(get_ic_ftn(find_ftn_charset(charset)));
} }
charsin = xstrcpy(charset);
charsout = xstrcpy(getftnchrs(exitinfo.Charset));
Syslog('b', "charsets: %s -> %s", charsin, get_ic_ftn(exitinfo.Charset));
/* /*
* Try to setup charset mapping if the charactersets are different. * Try to setup charset mapping if the charactersets are different.
*/ */
#ifndef USE_EXPERIMENT chartran_init(charsin, get_ic_ftn(exitinfo.Charset), 'b');
if (charsin && charsout && strcmp(charsout, charsin)) {
UseIconv = charset_set_in_out(charsin, charsout);
}
/* /*
* Show message header with charset mapping if needed. * Show message header with charset mapping if needed.
*/ */
ShowMsgHdr(UseIconv);
#else
ShowMsgHdr(); ShowMsgHdr();
#endif
/* /*
* Show message text * Show message text
@ -1311,7 +1278,7 @@ int Read_a_Msg(unsigned int Num, int UpdateLR)
if (Kludges) { if (Kludges) {
pout(LIGHTGRAY, BLACK, p); pout(LIGHTGRAY, BLACK, p);
Enter(1); Enter(1);
if (CheckLine(CFG.TextColourF, CFG.TextColourB, FALSE, UseIconv)) if (CheckLine(CFG.TextColourF, CFG.TextColourB, FALSE))
break; break;
} }
} else { } else {
@ -1319,25 +1286,11 @@ int Read_a_Msg(unsigned int Num, int UpdateLR)
if (strchr(p, '>') != NULL) if (strchr(p, '>') != NULL)
if ((strlen(p) - strlen(strchr(p, '>'))) < 10) if ((strlen(p) - strlen(strchr(p, '>'))) < 10)
colour(CFG.HiliteF, CFG.HiliteB); colour(CFG.HiliteF, CFG.HiliteB);
#ifdef USE_EXPERIMENT strncpy(temp, chartran(p), sizeof(temp) -1);
PUTSTR(p); PUTSTR(temp);
Enter(1); Enter(1);
#else
if (UseIconv) {
/*
* Try to translate character sets
*/
for (i = 0; i < strlen(p); i++) {
PUTSTR(charset_map_c(p[i], FALSE));
}
Enter(1);
} else {
PUTSTR(p);
Enter(1);
}
#endif
if (CheckLine(CFG.TextColourF, CFG.TextColourB, FALSE, UseIconv)) if (CheckLine(CFG.TextColourF, CFG.TextColourB, FALSE))
break; break;
} }
} while ((p = (char *)MsgText_Next()) != NULL); } while ((p = (char *)MsgText_Next()) != NULL);
@ -1346,10 +1299,9 @@ int Read_a_Msg(unsigned int Num, int UpdateLR)
if (charset) if (charset)
free(charset); free(charset);
if (charsout)
free(charsout);
if (charsin) if (charsin)
free(charsin); free(charsin);
chartran_close();
/* /*
* Set the Received status on this message if it's for the user. * Set the Received status on this message if it's for the user.
@ -1975,7 +1927,7 @@ void Delete_Msg()
/* /*
* Check linecounter for reading messages. * Check linecounter for reading messages.
*/ */
int CheckLine(int FG, int BG, int Email, int Conv) int CheckLine(int FG, int BG, int Email)
{ {
int x, z; int x, z;
@ -2002,11 +1954,7 @@ int CheckLine(int FG, int BG, int Email, int Conv)
if (Email) if (Email)
ShowEmailHdr(); ShowEmailHdr();
else else
#ifdef USE_EXPERIMENT
ShowMsgHdr(); ShowMsgHdr();
#else
ShowMsgHdr(Conv);
#endif
colour(FG, BG); colour(FG, BG);
} }
return FALSE; return FALSE;

View File

@ -9,7 +9,7 @@
int LC(int); /* More prompt for reading messages */ int LC(int); /* More prompt for reading messages */
int Edit_Msg(void); /* Edit a message */ int Edit_Msg(void); /* Edit a message */
int Ext_Edit(void); /* External Message editor */ int Ext_Edit(void); /* External Message editor */
int CheckLine(int, int, int, int); /* Check linecounter for read */ int CheckLine(int, int, int); /* Check linecounter for read */
void SysopComment(char *); /* Comment to Sysop */ void SysopComment(char *); /* Comment to Sysop */
void Post_Msg(void); /* Post a message */ void Post_Msg(void); /* Post a message */
void Read_Msgs(void); /* Read Messages */ void Read_Msgs(void); /* Read Messages */

View File

@ -4,7 +4,7 @@
* Purpose ...............: New user registration * Purpose ...............: New user registration
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -166,12 +166,6 @@ int main(int argc, char **argv)
signal(i, SIG_IGN); signal(i, SIG_IGN);
} }
/*
* Default set the terminal to ANSI mode. If your logo
* is in color, the user will see color no mather what.
*/
TermInit(1);
/* /*
* Now it's time to check if the bbs is open. If not, we * Now it's time to check if the bbs is open. If not, we
* log the user off. * log the user off.

View File

@ -214,12 +214,6 @@ int main(int argc, char **argv)
signal(i, SIG_DFL); signal(i, SIG_DFL);
} }
/*
* Default set the terminal to ANSI mode. If your logo
* is in color, the user will see color no mather what.
*/
TermInit(1);
/* /*
* Now it's time to check if the bbs is open. If not, we * Now it's time to check if the bbs is open. If not, we
* log the user off. * log the user off.

View File

@ -591,10 +591,6 @@ void DoMenu(int Type)
Chg_Location(); Chg_Location();
break; break;
case 304:
Chg_Graphics();
break;
case 305: case 305:
Chg_VoicePhone(); Chg_VoicePhone();
break; break;

View File

@ -123,11 +123,12 @@ void DisplayLogo()
WriteError("$DisplayLogo: Can't open %s", temp); WriteError("$DisplayLogo: Can't open %s", temp);
else { else {
while (Fgets(sString, 1023, pLogo) != NULL) { while (Fgets(sString, 1023, pLogo) != NULL) {
PUTSTR(sString); PUTSTR(chartran(sString));
Enter(1); Enter(1);
} }
fclose(pLogo); fclose(pLogo);
} }
free(sString); free(sString);
free(temp); free(temp);
} }

View File

@ -5,7 +5,7 @@
* BBS and unix accounts. * BBS and unix accounts.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -198,21 +198,6 @@ int newuser(void)
l_date = localtime(&Time_Now); l_date = localtime(&Time_Now);
ltime = time(NULL); ltime = time(NULL);
usrconfig.GraphMode = TRUE; /* Default set it to ANSI */
if (CFG.iAnsi) {
Enter(2);
/* Do you want ANSI and graphics mode [Y/n]: */
language(LIGHTGRAY, BLACK, 44);
alarm_on();
i = toupper(getchar());
if (i == Keystroke(44, 1))
usrconfig.GraphMode = FALSE;
}
exitinfo.GraphMode = usrconfig.GraphMode;
TermInit(exitinfo.GraphMode);
if (CFG.iVoicePhone) { if (CFG.iVoicePhone) {
while (1) { while (1) {
Enter(1); Enter(1);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Offline Reader * Purpose ...............: Offline Reader
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2006 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -1211,8 +1211,7 @@ void OLR_DownBW()
Inf.maxfreqs = CFG.OLR_MaxReq; Inf.maxfreqs = CFG.OLR_MaxReq;
if (exitinfo.HotKeys) if (exitinfo.HotKeys)
Inf.uflags |= le_us(INF_HOTKEYS); Inf.uflags |= le_us(INF_HOTKEYS);
if (exitinfo.GraphMode) Inf.uflags |= le_us(INF_GRAPHICS);
Inf.uflags |= le_us(INF_GRAPHICS);
if (exitinfo.OL_ExtInfo) if (exitinfo.OL_ExtInfo)
Inf.uflags |= le_us(INF_EXT_INFO); Inf.uflags |= le_us(INF_EXT_INFO);
Inf.credits = le_us(exitinfo.Credit); Inf.credits = le_us(exitinfo.Credit);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Product information * Purpose ...............: Product information
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -38,30 +38,32 @@
#include "ttyio.h" #include "ttyio.h"
void ls(int a) char pstr[256];
void ls(void)
{ {
PUTCHAR(a ? 179 : '|'); strcpy(pstr, (char *)"\xB3");
} }
void rs(int a) void rs(void)
{ {
colour(DARKGRAY, BLACK); strncat(pstr, colour_str(DARKGRAY, BLACK), 255);
PUTCHAR(a ? 179 : '|'); strncat(pstr, (char *)"\xB3\r\n", 255);
Enter(1);
} }
void wl(int a) void wl(void)
{ {
int i; int i;
ls(a); ls();
for(i = 0; i < 76; i++) for(i = 0; i < 76; i++)
PUTCHAR(' '); strncat(pstr, (char *)" ", 255);
rs(a); rs();
} }
@ -71,79 +73,117 @@ void wl(int a)
*/ */
void cr(void) void cr(void)
{ {
int a, i; char *temp;
char *string, *temp;
a = exitinfo.GraphMode;
string = calloc(81, sizeof(char));
temp = calloc(81, sizeof(char)); temp = calloc(81, sizeof(char));
clear(); if (utf8)
colour(DARKGRAY, BLACK); chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
strncpy(pstr, clear_str(), 255);
strncat(pstr, colour_str(DARKGRAY, BLACK), 255);
/* Print top row */ /* Print top row */
PUTCHAR(a ? 213 : '+'); strncat(pstr, (char *)"\xDA", 255);
for (i = 0; i < 76; i++) strncat(pstr, hLine_str(76), 255);
PUTCHAR(a ? 205 : '='); strncat(pstr, (char *)"\xBF\r\n", 255);
PUTCHAR(a ? 184 : '+'); PUTSTR(chartran(pstr));
Enter(1);
wl(a); wl();
ls(a); PUTSTR(chartran(pstr));
snprintf(temp, 81, "MBSE Bulletin Board System %s (%s-%s)", VERSION, OsName(), OsCPU());
pout(YELLOW, BLACK, padleft(temp, 76, ' ')); ls();
rs(a); snprintf(temp, 80, "MBSE Bulletin Board System %s (%s-%s)", VERSION, OsName(), OsCPU());
wl(a); strncat(pstr, pout_str(YELLOW, BLACK, padleft(temp, 76, ' ')), 255);
ls(a); rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
snprintf(temp, 81, "%s", COPYRIGHT); snprintf(temp, 81, "%s", COPYRIGHT);
pout(LIGHTCYAN, BLACK, padleft(temp, 76, ' ')); strncat(pstr, pout_str(LIGHTCYAN, BLACK, padleft(temp, 76, ' ')), 255);
rs(a); rs();
wl(a); PUTSTR(chartran(pstr));
ls(a);
wl();
PUTSTR(chartran(pstr));
ls();
snprintf(temp, 81, "Compiled on %s at %s", __DATE__, __TIME__); snprintf(temp, 81, "Compiled on %s at %s", __DATE__, __TIME__);
pout(LIGHTRED, BLACK, padleft(temp, 76, ' ')); strncat(pstr, pout_str(LIGHTRED, BLACK, padleft(temp, 76, ' ')), 255);
rs(a); rs();
wl(a); PUTSTR(chartran(pstr));
ls(a);
pout(LIGHTCYAN, BLACK, (char *)"MBSE has been written and designed by Michiel Broek. Many others have given ");
rs(a);
ls(a);
pout(LIGHTCYAN, BLACK, (char *)"valuable time in the form of new ideas and suggestions on how to make MBSE ");
rs(a);
ls(a);
pout(LIGHTCYAN, BLACK, (char *)"BBS a better BBS ");
rs(a);
wl(a);
ls(a);
pout(WHITE, BLACK, (char *)"Available from http://www.mbse.eu or 2:280/2802 ");
rs(a);
wl(a);
ls(a);
pout(LIGHTRED, BLACK, (char *)"JAM(mbp) - Copyright 1993 Joaquim Homrighausen, Andrew Milner, ");
rs(a);
ls(a);
pout(LIGHTRED, BLACK, (char *)" Mats Birch, Mats Wallin. ");
rs(a);
ls(a);
pout(LIGHTRED, BLACK, (char *)" ALL RIGHTS RESERVED. ");
rs(a);
wl(a);
ls(a);
pout(LIGHTBLUE, BLACK, (char *)"This is free software; released under the terms of the GNU General Public ");
rs(a);
ls(a);
pout(LIGHTBLUE, BLACK, (char *)"License as published by the Free Software Foundation. ");
rs(a);
wl(a);
PUTCHAR(a ? 212 : '+'); wl();
for (i = 0; i < 76; i++) PUTSTR(chartran(pstr));
PUTCHAR(a ? 205 : '=');
PUTCHAR(a ? 190 : '+'); ls();
strncat(pstr, pout_str(LIGHTCYAN, BLACK, (char *)"MBSE has been written and designed by Michiel Broek. Many others have given "), 255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTCYAN, BLACK, (char *)"valuable time in the form of new ideas and suggestions on how to make MBSE "), 255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTCYAN, BLACK, (char *)"BBS a better BBS "), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(WHITE, BLACK, (char *)"Available from http://www.mbse.eu or 2:280/2802 "), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTRED, BLACK, (char *)"JAM(mbp) - Copyright 1993 Joaquim Homrighausen, Andrew Milner, "),
255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTRED, BLACK, (char *)" Mats Birch, Mats Wallin. "), 255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTRED, BLACK, (char *)" ALL RIGHTS RESERVED. "), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTBLUE, BLACK, (char *)"This is free software; released under the terms of the GNU General Public "), 255);
rs();
PUTSTR(chartran(pstr));
ls();
strncat(pstr, pout_str(LIGHTBLUE, BLACK, (char *)"License as published by the Free Software Foundation. "), 255);
rs();
PUTSTR(chartran(pstr));
wl();
PUTSTR(chartran(pstr));
strcpy(pstr, (char *)"\xC0");
strncat(pstr, hLine_str(76), 255);
strncat(pstr, (char *)"\xD9\r\n", 255);
PUTSTR(chartran(pstr));
free(string);
free(temp); free(temp);
chartran_close();
Enter(1); Enter(1);
Pause(); Pause();
} }

View File

@ -1,8 +1,8 @@
#ifndef _PINFO_H #ifndef _PINFO_H
#define _PINFO_H #define _PINFO_H
void ls(int); /* Left side of block */ void ls(void); /* Left side of block */
void rs(int); /* Right side of block */ void rs(void); /* Right side of block */
void cr(void); /* Show product info screen */ void cr(void); /* Show product info screen */
#endif #endif

View File

@ -4,7 +4,7 @@
* Purpose ...............: Terminal output routines. * Purpose ...............: Terminal output routines.
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -36,17 +36,10 @@
#include "ttyio.h" #include "ttyio.h"
int termmode; /* 0 = tty, 1 = ANSI */
extern int cols; extern int cols;
extern int rows; extern int rows;
void TermInit(int mode)
{
termmode = mode;
}
/* /*
* Function will print about of enters specified * Function will print about of enters specified
@ -63,29 +56,57 @@ void Enter(int num)
char *pout_str(int fg, int bg, char *Str)
{
static char temp[256];
strncpy(temp, colour_str(fg, bg), 255);
strncat(temp, Str, 255);
return temp;
}
void pout(int fg, int bg, char *Str) void pout(int fg, int bg, char *Str)
{ {
colour(fg, bg); PUTSTR(pout_str(fg, bg, Str));
PUTSTR(Str); }
char *poutCenter_str(int fg, int bg, char *Str)
{
static char temp[256];
strncpy(temp, colour_str(fg, bg), 255);
strncat(temp, Center_str(Str), 255);
return temp;
} }
void poutCenter(int fg, int bg, char *Str) void poutCenter(int fg, int bg, char *Str)
{ {
colour(fg, bg); PUTSTR(poutCenter_str(fg, bg, Str));
Center(Str); }
char *poutCR_str(int fg, int bg, char *Str)
{
static char temp[256];
strncpy(temp, colour_str(fg, bg), 255);
strncat(temp, Str, 255);
strncat(temp, (char *)"\r\n", 255);
return temp;
} }
void poutCR(int fg, int bg, char *Str) void poutCR(int fg, int bg, char *Str)
{ {
colour(fg, bg); PUTSTR(poutCR_str(fg, bg, Str));
PUTSTR(Str);
PUTCHAR('\r');
PUTCHAR('\n');
} }
@ -93,90 +114,110 @@ void poutCR(int fg, int bg, char *Str)
/* /*
* Changes ansi background and foreground color * Changes ansi background and foreground color
*/ */
char *colour_str(int fg, int bg)
{
static char temp[61];
char tmp1[40];
int att = 0, fore = 37, back = 40;
if (fg<0 || fg>31 || bg<0 || bg>7) {
snprintf(temp, 61, "ANSI: Illegal colour specified: %i, %i\n", fg, bg);
return temp;
}
strcpy(temp, "\x1B[");
if ( fg > WHITE) {
strcat(temp, (char *)"5;");
fg-= 16;
}
if (fg > LIGHTGRAY) {
att=1;
fg=fg-8;
}
if (fg == BLACK) fore=30;
else if (fg == BLUE) fore=34;
else if (fg == GREEN) fore=32;
else if (fg == CYAN) fore=36;
else if (fg == RED) fore=31;
else if (fg == MAGENTA) fore=35;
else if (fg == BROWN) fore=33;
else fore=37;
if (bg == BLUE) back=44;
else if (bg == GREEN) back=42;
else if (bg == CYAN) back=46;
else if (bg == RED) back=41;
else if (bg == MAGENTA) back=45;
else if (bg == BROWN) back=43;
else if (bg == LIGHTGRAY) back=47;
else back=40;
snprintf(tmp1, 41, "%d;%d;%dm", att, fore, back);
strncat(temp, tmp1, 60);
return temp;
}
void colour(int fg, int bg) void colour(int fg, int bg)
{ {
char temp[61]; PUTSTR(colour_str(fg, bg));
}
if (termmode == 1) {
int att=0, fore=37, back=40;
if (fg<0 || fg>31 || bg<0 || bg>7) { char *Center_str(char *string)
snprintf(temp, 61, "ANSI: Illegal colour specified: %i, %i\n", fg, bg); {
PUTSTR(temp); int Strlen, Maxlen = cols, i, x, z;
return; static char Str[256];
}
PUTSTR((char *)"["); Strlen = strlen(string);
if ( fg > WHITE) { if (Maxlen > 255)
PUTSTR((char *)"5;"); Maxlen = 255;
fg-= 16;
}
if (fg > LIGHTGRAY) {
att=1;
fg=fg-8;
}
if (fg == BLACK) fore=30; if (Strlen == Maxlen)
else if (fg == BLUE) fore=34; strncpy(Str, string, 255);
else if (fg == GREEN) fore=32; else {
else if (fg == CYAN) fore=36; strcpy(Str, (char *)"");
else if (fg == RED) fore=31; x = Maxlen - Strlen;
else if (fg == MAGENTA) fore=35; z = x / 2;
else if (fg == BROWN) fore=33; for (i = 0; i < z; i++)
else fore=37; strcat(Str, " ");
strncat(Str, string, 255);
if (bg == BLUE) back=44;
else if (bg == GREEN) back=42;
else if (bg == CYAN) back=46;
else if (bg == RED) back=41;
else if (bg == MAGENTA) back=45;
else if (bg == BROWN) back=43;
else if (bg == LIGHTGRAY) back=47;
else back=40;
snprintf(temp, 61, "%d;%d;%dm", att, fore, back);
PUTSTR(temp);
} }
strncat(Str, (char *)"\r\n", 255);
return Str;
} }
void Center(char *string) void Center(char *string)
{ {
int Strlen; PUTSTR(Center_str(string));
int Maxlen = cols; }
int i, x, z;
char *Str;
Str = calloc(1024, sizeof(char));
Strlen = strlen(string);
if (Strlen == Maxlen)
PUTSTR(string); char *clear_str(void)
else { {
x = Maxlen - Strlen; static char temp[41];
z = x / 2;
for (i = 0; i < z; i++) strncpy(temp, colour_str(LIGHTGRAY, BLACK), 40);
strcat(Str, " "); strncat(temp, (char *)ANSI_HOME, 40);
strcat(Str, string); strncat(temp, (char *)ANSI_CLEAR, 50);
PUTSTR(Str); return temp;
}
PUTCHAR('\r');
PUTCHAR('\n');
free(Str);
} }
void clear() void clear()
{ {
if (termmode == 1) { PUTSTR(clear_str());
colour(LIGHTGRAY, BLACK);
PUTSTR((char *)ANSI_HOME);
PUTSTR((char *)ANSI_CLEAR);
} else
Enter(1);
} }
@ -184,36 +225,62 @@ void clear()
/* /*
* Moves cursor to specified position * Moves cursor to specified position
*/ */
void locate(int y, int x) char *locate_str(int y, int x)
{ {
char temp[61]; static char temp[61];
if (termmode > 0) { if (y > rows || x > cols) {
if (y > rows || x > cols) { snprintf(temp, 61, "ANSI: Invalid screen coordinates: %i, %i\n", y, x);
snprintf(temp, 61, "ANSI: Invalid screen coordinates: %i, %i\n", y, x); } else {
} else { snprintf(temp, 61, "\x1B[%i;%iH", y, x);
snprintf(temp, 61, "\x1B[%i;%iH", y, x);
}
PUTSTR(temp);
} }
return temp;
} }
void fLine(int Len) void locate(int y, int x)
{ {
int x; PUTSTR(locate_str(y, x));
}
if (termmode == 0)
for (x = 0; x < Len; x++)
PUTCHAR('-');
if (termmode == 1)
for (x = 0; x < Len; x++)
PUTCHAR(196);
PUTCHAR('\r'); char *hLine_str(int Len)
PUTCHAR('\n'); {
int x;
static char temp[256];
strcpy(temp, "");
for (x = 0; x < Len; x++)
strncat(temp, (char *)"\xC4", 255);
return temp;
}
char *fLine_str(int Len)
{
static char temp[255];
strncpy(temp, hLine_str(Len), 255);
strncat(temp, (char *)"\r\n", 255);
return temp;
}
void fLine(int Len)
{
PUTSTR(fLine_str(Len));
}
char *sLine_str(void)
{
return fLine_str(cols -1);
} }

View File

@ -3,16 +3,25 @@
/* $Id$ */ /* $Id$ */
void TermInit(int);
void Enter(int); void Enter(int);
char *pout_str(int, int, char *);
void pout(int, int, char *); void pout(int, int, char *);
char *poutCR_str(int, int, char *);
void poutCR(int, int, char *); void poutCR(int, int, char *);
char *poutCenter_str(int,int,char *);
void poutCenter(int,int,char *); void poutCenter(int,int,char *);
char *colour_str(int, int);
void colour(int, int); void colour(int, int);
char *Center_str(char *);
void Center(char *); void Center(char *);
char *clear_str(void);
void clear(void); void clear(void);
char *locate_str(int, int);
void locate(int, int); void locate(int, int);
char *hLine_str(int);
char *fLine_str(int);
void fLine(int); void fLine(int);
char *sLine_str(void);
void sLine(void); void sLine(void);
void mvprintw(int, int, const char *, ...); void mvprintw(int, int, const char *, ...);

View File

@ -246,6 +246,7 @@ void user(void)
/* /*
* Setup users favourite language. * Setup users favourite language.
*/ */
utf8 = (usrconfig.Charset == FTNC_UTF8);
Set_Language(usrconfig.iLanguage); Set_Language(usrconfig.iLanguage);
Free_Language(); Free_Language();
InitLanguage(); InitLanguage();
@ -259,7 +260,6 @@ void user(void)
UserCity(mypid, usrconfig.Name, usrconfig.sLocation); UserCity(mypid, usrconfig.Name, usrconfig.sLocation);
else else
UserCity(mypid, usrconfig.Name, (char *)"N/A"); UserCity(mypid, usrconfig.Name, (char *)"N/A");
TermInit(usrconfig.GraphMode);
/* /*
* Count simultaneous logins * Count simultaneous logins
@ -528,13 +528,11 @@ void user(void)
* file, search order is the same as in DisplayFile() * file, search order is the same as in DisplayFile()
*/ */
st.st_mtime = 0; st.st_mtime = 0;
if (exitinfo.GraphMode) { snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.ans", getenv("MBSE_ROOT"), lang.lc);
snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.ans", getenv("MBSE_ROOT"), lang.lc); stat(temp, &st);
if (st.st_mtime == 0) {
snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.ans", getenv("MBSE_ROOT"), CFG.deflang);
stat(temp, &st); stat(temp, &st);
if (st.st_mtime == 0) {
snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.ans", getenv("MBSE_ROOT"), CFG.deflang);
stat(temp, &st);
}
} }
if (st.st_mtime == 0) { if (st.st_mtime == 0) {
snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.asc", getenv("MBSE_ROOT"), lang.lc); snprintf(temp, PATH_MAX, "%s/share/int/txtfiles/%s/onceonly.asc", getenv("MBSE_ROOT"), lang.lc);

View File

@ -4,7 +4,7 @@
* Purpose ...............: Display Userlist * Purpose ...............: Display Userlist
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2005 * Copyright (C) 1997-2007
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -41,13 +41,14 @@
extern int rows; extern int rows;
extern int cols;
void UserList(char *OpData) void UserList(char *OpData)
{ {
FILE *pUsrConfig; FILE *pUsrConfig;
int LineCount = 2, iFoundName = FALSE, iNameCount = 0; int LineCount = 2, iFoundName = FALSE, iNameCount = 0;
char *Name, *sTemp, *User, *temp, msg[81]; char ustr[128], *Name, *sTemp, *User, *temp, msg[81];
struct userhdr uhdr; struct userhdr uhdr;
struct userrec u; struct userrec u;
@ -56,10 +57,13 @@ void UserList(char *OpData)
sTemp = calloc(81, sizeof(char)); sTemp = calloc(81, sizeof(char));
User = calloc(81, sizeof(char)); User = calloc(81, sizeof(char));
clear(); if (utf8)
chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
strcpy(ustr, clear_str());
/* User List */ /* User List */
language(WHITE, BLACK, 126); strncat(ustr, poutCR_str(WHITE, BLACK, (char *) Language(126)), 127);
Enter(1); PUTSTR(chartran(ustr));
LineCount = 1; LineCount = 1;
snprintf(temp, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT")); snprintf(temp, PATH_MAX, "%s/etc/users.data", getenv("MBSE_ROOT"));
@ -74,16 +78,19 @@ void UserList(char *OpData)
colour(CFG.InputColourF, CFG.InputColourB); colour(CFG.InputColourF, CFG.InputColourB);
alarm_on(); alarm_on();
GetstrC(Name, 35); GetstrC(Name, 35);
clear();
strcpy(ustr, clear_str());
/* Name Location Last On Calls */ /* Name Location Last On Calls */
language(WHITE, BLACK, 128); strncat(ustr, poutCR_str(WHITE, BLACK, (char *) Language(128)), 127);
Enter(1); PUTSTR(chartran(ustr));
colour(GREEN, BLACK); strcpy(ustr, colour_str(GREEN, BLACK));
fLine(79); strncat(ustr, fLine_str(cols -1), 127);
PUTSTR(chartran(ustr));
strcpy(ustr, colour_str(CYAN, BLACK));
PUTSTR(chartran(ustr));
colour(CYAN, BLACK);
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) { while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1) {
if ((strcmp(Name,"")) != 0) { if ((strcmp(Name,"")) != 0) {
if (((strcasecmp(OpData, "/H")) == 0) && strlen(u.sHandle)) if (((strcasecmp(OpData, "/H")) == 0) && strlen(u.sHandle))
@ -150,14 +157,17 @@ void UserList(char *OpData)
fclose(pUsrConfig); fclose(pUsrConfig);
colour(GREEN, BLACK); strcpy(ustr, colour_str(GREEN, BLACK));
fLine(79); strncat(ustr, fLine_str(cols -1), 127);
PUTSTR(chartran(ustr));
free(temp); free(temp);
free(Name); free(Name);
free(sTemp); free(sTemp);
free(User); free(User);
chartran_close();
Pause(); Pause();
} }

View File

@ -4,7 +4,7 @@
* Purpose ...............: Who's online functions * Purpose ...............: Who's online 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
@ -50,37 +50,41 @@ extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
*/ */
void WhosOn(char *OpData) void WhosOn(char *OpData)
{ {
char buf[128], *Heading, *Underline, *cnt, *isdoing, *location, *device; char buf[128], *Heading, *cnt, *isdoing, *location, *device;
char *fullname, *temp, msg[81]; char *fullname, *temp, msg[81], wstr[128];;
int i, x, Start = TRUE; int x, Start = TRUE;
FILE *fp; FILE *fp;
struct userhdr ushdr; struct userhdr ushdr;
struct userrec us; struct userrec us;
Underline = calloc(81, sizeof(char));
Heading = calloc(81, sizeof(char)); Heading = calloc(81, sizeof(char));
WhosDoingWhat(WHOSON, NULL); WhosDoingWhat(WHOSON, NULL);
clear(); if (utf8)
Enter(1); chartran_init((char *)"CP437", (char *)"UTF-8", 'B');
colour(WHITE, BLACK);
strcpy(wstr, clear_str());
strncat(wstr, (char *)"\r\n", 127);
strncat(wstr, colour_str(WHITE, BLACK), 127);
/* Callers On-Line to */ /* Callers On-Line to */
snprintf(Heading, 81, "%s%s", (char *) Language(414), CFG.bbs_name); snprintf(Heading, 81, "%s%s", (char *) Language(414), CFG.bbs_name);
Center(Heading); strncat(wstr, Center_str(Heading), 127);
x = strlen(Heading); PUTSTR(chartran(wstr));
for(i = 0; i < x; i++) x = strlen(Heading);
snprintf(Underline, 81, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45); strcpy(wstr, colour_str(LIGHTRED, BLACK));
colour(LIGHTRED, BLACK); strncat(wstr, Center_str(hLine_str(x)), 127);
Center(Underline); PUTSTR(chartran(wstr));
Enter(1);
/* Name Device Status Location */ /* Name Device Status Location */
pout(LIGHTGREEN, BLACK, (char *) Language(415)); strcpy(wstr, pout_str(LIGHTGREEN, BLACK, (char *) Language(415)));
Enter(1); strncat(wstr, (char *)"\r\n", 127);
colour(GREEN, BLACK); PUTSTR(chartran(wstr));
fLine(79);
strcpy(wstr, colour_str(GREEN, BLACK));
strncat(wstr, fLine_str(79), 127);
PUTSTR(chartran(wstr));
while (TRUE) { while (TRUE) {
if (Start) if (Start)
@ -192,10 +196,11 @@ void WhosOn(char *OpData)
} }
} }
colour(GREEN, BLACK); strcpy(wstr, colour_str(GREEN, BLACK));
fLine(79); strncat(wstr, fLine_str(79), 127);
PUTSTR(chartran(wstr));
free(Underline); chartran_close();
free(Heading); free(Heading);
Enter(1); Enter(1);
} }

View File

@ -2207,7 +2207,6 @@ char *getmenutype(int val)
case 301: return (char *)"Change transfer protocol"; case 301: return (char *)"Change transfer protocol";
case 302: return (char *)"Change password"; case 302: return (char *)"Change password";
case 303: return (char *)"Change location"; case 303: return (char *)"Change location";
case 304: return (char *)"Change graphics mode";
case 305: return (char *)"Change voice phone"; case 305: return (char *)"Change voice phone";
case 306: return (char *)"Change data phone"; case 306: return (char *)"Change data phone";
case 307: return (char *)"Change show news bulletins"; case 307: return (char *)"Change show news bulletins";