Changed terminal i/o for the bbs
This commit is contained in:
parent
fd8eb8b6f3
commit
3fb35f698c
17
ChangeLog
17
ChangeLog
@ -1,8 +1,25 @@
|
|||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
|
!!!! DON'T USE, THIS VERSION HAS LOTS OF BUGS !!!!
|
||||||
|
|
||||||
v0.71.0 27-Oct-2004
|
v0.71.0 27-Oct-2004
|
||||||
|
|
||||||
|
mbsebbs:
|
||||||
|
In change handle the first character of the name is not
|
||||||
|
capitalized.
|
||||||
|
Changed layout of raw directory listing to support long
|
||||||
|
filenames.
|
||||||
|
Rewrote terminal i/o.
|
||||||
|
|
||||||
|
mbnewusr:
|
||||||
|
Rewrote terminal i/o.
|
||||||
|
|
||||||
|
lang:
|
||||||
|
Changed width of prompt 261.
|
||||||
|
|
||||||
|
examples:
|
||||||
|
Fixed logo display.
|
||||||
|
|
||||||
|
|
||||||
v0.70.0 06-Jun-2004 - 26-Oct-2004.
|
v0.70.0 06-Jun-2004 - 26-Oct-2004.
|
||||||
|
|
||||||
|
2
TODO
2
TODO
@ -124,6 +124,8 @@ mbcico:
|
|||||||
|
|
||||||
N: Make workaround for binkp bug in Irex 2.24 upto 2.29
|
N: Make workaround for binkp bug in Irex 2.24 upto 2.29
|
||||||
|
|
||||||
|
U: See whathappens if we remove FLUSHOUT(), this may give troubles.
|
||||||
|
|
||||||
mbfile:
|
mbfile:
|
||||||
L: Update <filespec> <area> <-touch>
|
L: Update <filespec> <area> <-touch>
|
||||||
|
|
||||||
|
Binary file not shown.
@ -259,7 +259,7 @@ JN|Node onbekend, toch doorgaan [j/N]:
|
|||||||
|Geen bestanden gemarkeerd voor download.
|
|Geen bestanden gemarkeerd voor download.
|
||||||
|extra minuten.
|
|extra minuten.
|
||||||
|De volgende conferentie(s) zijn geselecteerd:
|
|De volgende conferentie(s) zijn geselecteerd:
|
||||||
|Bestand Grootte Datum
|
|Bestand Grootte Datum
|
||||||
|Protocol: Kan protocollen bestand niet openen.
|
|Protocol: Kan protocollen bestand niet openen.
|
||||||
|Kies Uw favourite overdracht protocol
|
|Kies Uw favourite overdracht protocol
|
||||||
|Kies Protocol (Enter is Stop):
|
|Kies Protocol (Enter is Stop):
|
||||||
|
@ -259,7 +259,7 @@ YN|Node not known, continue anyway [y/N]:
|
|||||||
|No files marked for download.
|
|No files marked for download.
|
||||||
|extra minutes.
|
|extra minutes.
|
||||||
|You have selected the following Conference(s):
|
|You have selected the following Conference(s):
|
||||||
|Filename Size Date
|
|Filename Size Date
|
||||||
|Protocol: Can't open protocol file.
|
|Protocol: Can't open protocol file.
|
||||||
|Select your preferred file transfer protcol
|
|Select your preferred file transfer protcol
|
||||||
|Select Protocol (Enter to Quit):
|
|Select Protocol (Enter to Quit):
|
||||||
|
@ -259,7 +259,7 @@ ON|Node inconnu, continue quand m
|
|||||||
|No files marked for download.
|
|No files marked for download.
|
||||||
|extra minutes.
|
|extra minutes.
|
||||||
|You have selected the following Conference(s):
|
|You have selected the following Conference(s):
|
||||||
|Filename Size Date
|
|Filename Size Date
|
||||||
|Protocol: Can't open protocol file.
|
|Protocol: Can't open protocol file.
|
||||||
|Select your preferred file transfer protcol
|
|Select your preferred file transfer protcol
|
||||||
|Select Protocol (Enter to Quit):
|
|Select Protocol (Enter to Quit):
|
||||||
|
@ -259,7 +259,7 @@ SN|Nodo desco
|
|||||||
|Non hai ficheiros marcados.
|
|Non hai ficheiros marcados.
|
||||||
|minutos extra.
|
|minutos extra.
|
||||||
|Escolleche-las seguintes reas:
|
|Escolleche-las seguintes reas:
|
||||||
|Ficheiro Tama¤o Fecha
|
|Ficheiro Tama¤o Fecha
|
||||||
|Protocolo: Non podo abrir ficheiro de protocolos.
|
|Protocolo: Non podo abrir ficheiro de protocolos.
|
||||||
|Escolle o protocolo de transferencia predeterminado
|
|Escolle o protocolo de transferencia predeterminado
|
||||||
|Escolle Protocolo (Enter para sair):
|
|Escolle Protocolo (Enter para sair):
|
||||||
|
@ -259,7 +259,7 @@ JN|Adresse unbekannt, dennoch fortfahren [j/N]:
|
|||||||
|Es sind keine Dateien zum Herunterladen markiert.
|
|Es sind keine Dateien zum Herunterladen markiert.
|
||||||
|extra Minuten.
|
|extra Minuten.
|
||||||
|Sie haben folgende Bereiche fuer den "Offline Reader" markiert:
|
|Sie haben folgende Bereiche fuer den "Offline Reader" markiert:
|
||||||
|Dateiname Groesse Datum
|
|Dateiname Groesse Datum
|
||||||
|Protokoll: Protokolldatei kann nicht geoeffnet werden.
|
|Protokoll: Protokolldatei kann nicht geoeffnet werden.
|
||||||
|Auswahl des bevorzugten Protokolls
|
|Auswahl des bevorzugten Protokolls
|
||||||
|Bitte Protokoll auswaehlen (frei lassen um abzubrechen):
|
|Bitte Protokoll auswaehlen (frei lassen um abzubrechen):
|
||||||
|
@ -259,7 +259,7 @@ JN|Adresse unbekannt, dennoch fortfahren [<j>a/<N>ein]:
|
|||||||
|Es sind keine Dateien zum Herunterladen markiert.
|
|Es sind keine Dateien zum Herunterladen markiert.
|
||||||
|extra Minuten.
|
|extra Minuten.
|
||||||
|Du hast folgende Bereiche fuer den "Offline Reader" markiert:
|
|Du hast folgende Bereiche fuer den "Offline Reader" markiert:
|
||||||
|Dateiname Groesse Datum
|
|Dateiname Groesse Datum
|
||||||
|Protokoll: Protokolldatei kann nicht geoeffnet werden.
|
|Protokoll: Protokolldatei kann nicht geoeffnet werden.
|
||||||
|Auswahl des bevorzugten Protokolls
|
|Auswahl des bevorzugten Protokolls
|
||||||
|Bitte Protokoll auswaehlen (frei lassen um abzubrechen):
|
|Bitte Protokoll auswaehlen (frei lassen um abzubrechen):
|
||||||
|
@ -259,7 +259,7 @@ SN|Nodo sconosciuto, continua lo stesso [s/N]:
|
|||||||
|Nessun file selezionato per il download.
|
|Nessun file selezionato per il download.
|
||||||
|minuti extra.
|
|minuti extra.
|
||||||
|Hai selezionato le seguenti Conferenze:
|
|Hai selezionato le seguenti Conferenze:
|
||||||
|Filename Dimensione Data
|
|Filename Dimensione Data
|
||||||
|Protocollo: Non posso aprire il file del protocollo.
|
|Protocollo: Non posso aprire il file del protocollo.
|
||||||
|Seleziona il tuo protocollo di trasferimento preferito
|
|Seleziona il tuo protocollo di trasferimento preferito
|
||||||
|Seleziona Protocollo (Invio per uscire):
|
|Seleziona Protocollo (Invio per uscire):
|
||||||
|
@ -259,7 +259,7 @@ SN|Nodo desconocido.
|
|||||||
|No hay ficheros marcados.
|
|No hay ficheros marcados.
|
||||||
|minutos extra.
|
|minutos extra.
|
||||||
|Has seleccionado las siguientes reas:
|
|Has seleccionado las siguientes reas:
|
||||||
|Fichero Tama¤o Fecha
|
|Fichero Tama¤o Fecha
|
||||||
|Protocolo: No puedo abrir fichero de protocolos.
|
|Protocolo: No puedo abrir fichero de protocolos.
|
||||||
|Elija el protocolo de transferencia predeterminado
|
|Elija el protocolo de transferencia predeterminado
|
||||||
|Elija Protocolo (Enter para salir):
|
|Elija Protocolo (Enter para salir):
|
||||||
|
@ -2240,13 +2240,13 @@ char *arcname(faddr *, unsigned short, int);
|
|||||||
/*
|
/*
|
||||||
* From rawio.c
|
* From rawio.c
|
||||||
*/
|
*/
|
||||||
void Setraw(void); /* Set raw mode */
|
void mbse_Setraw(void); /* Set raw mode */
|
||||||
void Unsetraw(void); /* Unset raw mode */
|
void mbse_Unsetraw(void); /* Unset raw mode */
|
||||||
unsigned char Getone(void); /* Get one raw character */
|
unsigned char mbse_Getone(void); /* Get one raw character */
|
||||||
long Speed(void); /* Get (locked) tty speed */
|
long mbse_Speed(void); /* Get (locked) tty speed */
|
||||||
int Waitchar(unsigned char *, int); /* Wait n * 10mSec for char */
|
int mbse_Waitchar(unsigned char *, int); /* Wait n * 10mSec for char */
|
||||||
int Escapechar(unsigned char *); /* Escape sequence test */
|
int mbse_Escapechar(unsigned char *); /* Escape sequence test */
|
||||||
unsigned char Readkey(void); /* Read a translated key */
|
unsigned char mbse_Readkey(void); /* Read a translated key */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
160
lib/rawio.c
160
lib/rawio.c
@ -38,7 +38,7 @@ int rawset = FALSE;
|
|||||||
/*
|
/*
|
||||||
* Sets raw mode and saves the terminal setup
|
* Sets raw mode and saves the terminal setup
|
||||||
*/
|
*/
|
||||||
void Setraw()
|
void mbse_Setraw()
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ void Setraw()
|
|||||||
/*
|
/*
|
||||||
* Unsets raw mode and returns state of terminal
|
* Unsets raw mode and returns state of terminal
|
||||||
*/
|
*/
|
||||||
void Unsetraw()
|
void mbse_Unsetraw()
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -95,21 +95,21 @@ void Unsetraw()
|
|||||||
* This function is used to get a single character from a user ie for a
|
* This function is used to get a single character from a user ie for a
|
||||||
* menu option
|
* menu option
|
||||||
*/
|
*/
|
||||||
unsigned char Getone()
|
unsigned char mbse_Getone()
|
||||||
{
|
{
|
||||||
unsigned char c = 0;
|
unsigned char c = 0;
|
||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
||||||
perror("open 8");
|
perror("open 8");
|
||||||
exit(MBERR_TTYIO_ERROR);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
mbse_Setraw();
|
||||||
|
|
||||||
c = Readkey();
|
c = mbse_Readkey();
|
||||||
|
|
||||||
Unsetraw();
|
mbse_Unsetraw();
|
||||||
close(ttyfd);
|
close(ttyfd);
|
||||||
return(c);
|
return(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ unsigned char Getone()
|
|||||||
/*
|
/*
|
||||||
* Read the (locked) speed from the tty
|
* Read the (locked) speed from the tty
|
||||||
*/
|
*/
|
||||||
long Speed(void)
|
long mbse_Speed(void)
|
||||||
{
|
{
|
||||||
speed_t mspeed;
|
speed_t mspeed;
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ long Speed(void)
|
|||||||
/*
|
/*
|
||||||
* Wait for a character for a maximum of wtime * 10 mSec.
|
* Wait for a character for a maximum of wtime * 10 mSec.
|
||||||
*/
|
*/
|
||||||
int Waitchar(unsigned char *ch, int wtime)
|
int mbse_Waitchar(unsigned char *ch, int wtime)
|
||||||
{
|
{
|
||||||
int i, rc = -1;
|
int i, rc = -1;
|
||||||
|
|
||||||
@ -242,56 +242,56 @@ int Waitchar(unsigned char *ch, int wtime)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Escapechar(unsigned char *ch)
|
int mbse_Escapechar(unsigned char *ch)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Escape character, if nothing follows within
|
||||||
|
* 50 mSec, the user really pressed <esc>.
|
||||||
|
*/
|
||||||
|
if ((rc = mbse_Waitchar(ch, 5)) == -1)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
if (*ch == '[') {
|
||||||
|
/*
|
||||||
|
* Start of CSI sequence. If nothing follows,
|
||||||
|
* return immediatly.
|
||||||
|
*/
|
||||||
|
if ((rc = mbse_Waitchar(ch, 5)) == -1)
|
||||||
|
return rc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Escape character, if nothing follows within
|
* Test for the most important keys. Note
|
||||||
* 50 mSec, the user really pressed <esc>.
|
* that only the cursor movement keys are
|
||||||
|
* guaranteed to work with PC-clients.
|
||||||
*/
|
*/
|
||||||
if ((rc = Waitchar(ch, 5)) == -1)
|
c = *ch;
|
||||||
return rc;
|
if (c == 'A')
|
||||||
|
c = KEY_UP;
|
||||||
if (*ch == '[') {
|
if (c == 'B')
|
||||||
/*
|
c = KEY_DOWN;
|
||||||
* Start of CSI sequence. If nothing follows,
|
if (c == 'C')
|
||||||
* return immediatly.
|
c = KEY_RIGHT;
|
||||||
*/
|
if (c == 'D')
|
||||||
if ((rc = Waitchar(ch, 5)) == -1)
|
c = KEY_LEFT;
|
||||||
return rc;
|
if ((c == '1') || (c == 'H') || (c == 0))
|
||||||
|
c = KEY_HOME;
|
||||||
/*
|
if ((c == '4') || (c == 'K') || (c == 101) || (c == 144))
|
||||||
* Test for the most important keys. Note
|
c = KEY_END;
|
||||||
* that only the cursor movement keys are
|
if (c == '2')
|
||||||
* guaranteed to work with PC-clients.
|
c = KEY_INS;
|
||||||
*/
|
if (c == '3')
|
||||||
c = *ch;
|
c = KEY_DEL;
|
||||||
if (c == 'A')
|
if (c == '5')
|
||||||
c = KEY_UP;
|
c = KEY_PGUP;
|
||||||
if (c == 'B')
|
if (c == '6')
|
||||||
c = KEY_DOWN;
|
c = KEY_PGDN;
|
||||||
if (c == 'C')
|
memcpy(ch, &c, sizeof(unsigned char));
|
||||||
c = KEY_RIGHT;
|
return rc;
|
||||||
if (c == 'D')
|
}
|
||||||
c = KEY_LEFT;
|
return -1;
|
||||||
if ((c == '1') || (c == 'H') || (c == 0))
|
|
||||||
c = KEY_HOME;
|
|
||||||
if ((c == '4') || (c == 'K') || (c == 101) || (c == 144))
|
|
||||||
c = KEY_END;
|
|
||||||
if (c == '2')
|
|
||||||
c = KEY_INS;
|
|
||||||
if (c == '3')
|
|
||||||
c = KEY_DEL;
|
|
||||||
if (c == '5')
|
|
||||||
c = KEY_PGUP;
|
|
||||||
if (c == '6')
|
|
||||||
c = KEY_PGDN;
|
|
||||||
memcpy(ch, &c, sizeof(unsigned char));
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -303,31 +303,31 @@ int Escapechar(unsigned char *ch)
|
|||||||
* If for example cursur keys are detected, this function returns
|
* If for example cursur keys are detected, this function returns
|
||||||
* a translated value.
|
* a translated value.
|
||||||
*/
|
*/
|
||||||
unsigned char Readkey(void)
|
unsigned char mbse_Readkey(void)
|
||||||
{
|
{
|
||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int rc = -1;
|
int rc = -1;
|
||||||
|
|
||||||
while (rc == -1) {
|
while (rc == -1) {
|
||||||
rc = Waitchar(&ch, 5);
|
rc = mbse_Waitchar(&ch, 5);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the character is not an Escape character,
|
* If the character is not an Escape character,
|
||||||
* then this function is finished.
|
* then this function is finished.
|
||||||
*/
|
*/
|
||||||
if ((rc == 1) && (ch != KEY_ESCAPE))
|
if ((rc == 1) && (ch != KEY_ESCAPE))
|
||||||
return ch;
|
return ch;
|
||||||
|
|
||||||
if ((rc == 1) && (ch == KEY_ESCAPE)) {
|
if ((rc == 1) && (ch == KEY_ESCAPE)) {
|
||||||
rc = Escapechar(&ch);
|
rc = mbse_Escapechar(&ch);
|
||||||
if (rc == 1)
|
if (rc == 1)
|
||||||
return ch;
|
return ch;
|
||||||
else
|
else
|
||||||
return KEY_ESCAPE;
|
return KEY_ESCAPE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return(ch);
|
return(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -611,7 +611,7 @@ int main(int argc, char **argv)
|
|||||||
mbse_colour(LIGHTGREEN, BLACK);
|
mbse_colour(LIGHTGREEN, BLACK);
|
||||||
printf("Are you sure to process all area lists [y/N] ");
|
printf("Are you sure to process all area lists [y/N] ");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
x = Getone();
|
x = mbse_Getone();
|
||||||
printf("\r \r");
|
printf("\r \r");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
if (toupper(x) != 'Y')
|
if (toupper(x) != 'Y')
|
||||||
|
@ -47,7 +47,7 @@ unsigned char readkey(int y, int x, int fg, int bg)
|
|||||||
perror("open /dev/tty");
|
perror("open /dev/tty");
|
||||||
exit(MBERR_TTYIO_ERROR);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
mbse_Setraw();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (rc == -1) {
|
while (rc == -1) {
|
||||||
@ -56,12 +56,12 @@ unsigned char readkey(int y, int x, int fg, int bg)
|
|||||||
|
|
||||||
mbse_locate(y, x);
|
mbse_locate(y, x);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
rc = Waitchar(&ch, 5);
|
rc = mbse_Waitchar(&ch, 5);
|
||||||
if ((rc == 1) && (ch != KEY_ESCAPE))
|
if ((rc == 1) && (ch != KEY_ESCAPE))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((rc == 1) && (ch == KEY_ESCAPE))
|
if ((rc == 1) && (ch == KEY_ESCAPE))
|
||||||
rc = Escapechar(&ch);
|
rc = mbse_Escapechar(&ch);
|
||||||
|
|
||||||
if (rc == 1)
|
if (rc == 1)
|
||||||
break;
|
break;
|
||||||
@ -69,7 +69,7 @@ unsigned char readkey(int y, int x, int fg, int bg)
|
|||||||
Nopper();
|
Nopper();
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
mbse_Unsetraw();
|
||||||
close(ttyfd);
|
close(ttyfd);
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
@ -90,15 +90,15 @@ unsigned char testkey(int y, int x)
|
|||||||
perror("open /dev/tty");
|
perror("open /dev/tty");
|
||||||
exit(MBERR_TTYIO_ERROR);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
mbse_Setraw();
|
||||||
|
|
||||||
rc = Waitchar(&ch, 50);
|
rc = mbse_Waitchar(&ch, 50);
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
if (ch == KEY_ESCAPE)
|
if (ch == KEY_ESCAPE)
|
||||||
rc = Escapechar(&ch);
|
rc = mbse_Escapechar(&ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
mbse_Unsetraw();
|
||||||
close(ttyfd);
|
close(ttyfd);
|
||||||
|
|
||||||
if (rc == 1)
|
if (rc == 1)
|
||||||
|
@ -7,7 +7,7 @@ include ../Makefile.global
|
|||||||
SRCS = signature.c filesub.c language.c mbtoberep.c \
|
SRCS = signature.c filesub.c language.c mbtoberep.c \
|
||||||
msgutil.c oneline.c bbslist.c morefile.c \
|
msgutil.c oneline.c bbslist.c morefile.c \
|
||||||
email.c fsedit.c lineedit.c mblang.c mbuser.c page.c \
|
email.c fsedit.c lineedit.c mblang.c mbuser.c page.c \
|
||||||
bye.c funcs.c mail.c term.c \
|
bye.c funcs.c mail.c term.c ttyio.c openport.c \
|
||||||
newuser.c pinfo.c timecheck.c change.c \
|
newuser.c pinfo.c timecheck.c change.c \
|
||||||
exitinfo.c mball.c mbsebbs.c menu.c pop3.c lastcallers.c \
|
exitinfo.c mball.c mbsebbs.c menu.c pop3.c lastcallers.c \
|
||||||
timeout.c chat.c file.c mbstat.c misc.c \
|
timeout.c chat.c file.c mbstat.c misc.c \
|
||||||
@ -16,7 +16,7 @@ SRCS = signature.c filesub.c language.c mbtoberep.c \
|
|||||||
HDRS = signature.h filesub.h language.h mbsebbs.h misc.h offline.h \
|
HDRS = signature.h filesub.h language.h mbsebbs.h misc.h offline.h \
|
||||||
timeout.h bbslist.h email.h fsedit.h lineedit.h \
|
timeout.h bbslist.h email.h fsedit.h lineedit.h \
|
||||||
mbstat.h msgutil.h oneline.h user.h bye.h morefile.h \
|
mbstat.h msgutil.h oneline.h user.h bye.h morefile.h \
|
||||||
funcs.h mail.h mbuser.h page.h term.h \
|
funcs.h mail.h mbuser.h page.h term.h ttyio.h openport.h \
|
||||||
change.h exitinfo.h mball.h newuser.h \
|
change.h exitinfo.h mball.h newuser.h \
|
||||||
pinfo.h chat.h file.h menu.h \
|
pinfo.h chat.h file.h menu.h \
|
||||||
pop3.h timecheck.h mbnewusr.h input.h whoson.h \
|
pop3.h timecheck.h mbnewusr.h input.h whoson.h \
|
||||||
@ -26,10 +26,10 @@ MBSEBBS_OBJS = signature.o bbslist.o chat.o file.o funcs.o mail.o menu.o \
|
|||||||
bye.o change.o mbsebbs.o timeout.o user.o timecheck.o \
|
bye.o change.o mbsebbs.o timeout.o user.o timecheck.o \
|
||||||
exitinfo.o filesub.o lineedit.o offline.o language.o msgutil.o \
|
exitinfo.o filesub.o lineedit.o offline.o language.o msgutil.o \
|
||||||
pop3.o email.o input.o whoson.o door.o dispfile.o userlist.o timestats.o \
|
pop3.o email.o input.o whoson.o door.o dispfile.o userlist.o timestats.o \
|
||||||
logentry.o morefile.o lastcallers.o term.o
|
logentry.o morefile.o lastcallers.o term.o ttyio.o openport.o
|
||||||
MBSEBBS_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libmbinet.a ../lib/libnodelist.a
|
MBSEBBS_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libmbinet.a ../lib/libnodelist.a
|
||||||
MBNEWUSR_OBJS = mbnewusr.o newuser.o language.o timeout.o dispfile.o oneline.o \
|
MBNEWUSR_OBJS = mbnewusr.o newuser.o language.o timeout.o dispfile.o oneline.o ttyio.o \
|
||||||
timecheck.o input.o exitinfo.o funcs.o misc.o change.o door.o term.o \
|
timecheck.o input.o exitinfo.o funcs.o misc.o change.o door.o term.o openport.o \
|
||||||
filesub.o mail.o email.o msgutil.o pop3.o lineedit.o fsedit.o whoson.o
|
filesub.o mail.o email.o msgutil.o pop3.o lineedit.o fsedit.o whoson.o
|
||||||
MBNEWUSR_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libmbinet.a ../lib/libnodelist.a
|
MBNEWUSR_LIBS = ../lib/libmbse.a ../lib/libmsgbase.a ../lib/libdbase.a ../lib/libmbinet.a ../lib/libnodelist.a
|
||||||
MBALL_OBJS = mball.o
|
MBALL_OBJS = mball.o
|
||||||
@ -118,47 +118,49 @@ depend:
|
|||||||
|
|
||||||
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
|
# DO NOT DELETE THIS LINE - MAKE DEPEND RELIES ON IT
|
||||||
# Dependencies generated by make depend
|
# Dependencies generated by make depend
|
||||||
signature.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h signature.h funcs.h input.h language.h timeout.h term.h
|
signature.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h signature.h funcs.h input.h language.h timeout.h term.h ttyio.h
|
||||||
filesub.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbsedb.h filesub.h funcs.h language.h input.h misc.h timeout.h exitinfo.h change.h term.h
|
filesub.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbsedb.h filesub.h funcs.h language.h input.h misc.h timeout.h exitinfo.h change.h term.h ttyio.h
|
||||||
language.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h term.h
|
language.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h term.h ttyio.h
|
||||||
mbtoberep.o: ../config.h ../lib/mbselib.h
|
mbtoberep.o: ../config.h ../lib/mbselib.h
|
||||||
msgutil.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h oneline.h msgutil.h
|
msgutil.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h oneline.h msgutil.h
|
||||||
oneline.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h oneline.h funcs.h input.h language.h term.h
|
oneline.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h oneline.h funcs.h input.h language.h term.h ttyio.h
|
||||||
bbslist.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h bbslist.h funcs.h input.h language.h term.h
|
bbslist.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h bbslist.h funcs.h input.h language.h term.h
|
||||||
morefile.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h morefile.h timeout.h
|
morefile.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h morefile.h timeout.h term.h ttyio.h
|
||||||
email.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h term.h
|
email.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h ../lib/mbinet.h exitinfo.h language.h mail.h timeout.h msgutil.h input.h email.h whoson.h term.h ttyio.h
|
||||||
fsedit.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mail.h input.h language.h timeout.h pinfo.h fsedit.h term.h
|
fsedit.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mail.h input.h language.h timeout.h pinfo.h fsedit.h term.h ttyio.h
|
||||||
lineedit.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mail.h input.h language.h timeout.h lineedit.h term.h
|
lineedit.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mail.h input.h language.h timeout.h lineedit.h term.h ttyio.h
|
||||||
mblang.o: ../config.h ../lib/mbselib.h
|
mblang.o: ../config.h ../lib/mbselib.h
|
||||||
mbuser.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbuser.h
|
mbuser.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbuser.h
|
||||||
page.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h term.h
|
page.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h dispfile.h input.h chat.h page.h timeout.h mail.h language.h term.h ttyio.h
|
||||||
bye.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h dispfile.h misc.h language.h bye.h term.h
|
bye.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h dispfile.h misc.h language.h bye.h term.h openport.h ttyio.h
|
||||||
funcs.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h funcs.h
|
funcs.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h funcs.h term.h ttyio.h
|
||||||
mail.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h term.h
|
mail.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h misc.h timeout.h oneline.h exitinfo.h lineedit.h fsedit.h filesub.h msgutil.h pop3.h email.h door.h whoson.h term.h ttyio.h openport.h
|
||||||
term.o: ../config.h ../lib/mbselib.h ../lib/users.h term.h
|
term.o: ../config.h ../lib/mbselib.h ../lib/users.h term.h ttyio.h
|
||||||
newuser.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h term.h
|
ttyio.o: ../config.h ../lib/mbselib.h ttyio.h
|
||||||
pinfo.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h pinfo.h input.h term.h
|
openport.o: ../config.h ../lib/mbselib.h ttyio.h openport.h
|
||||||
timecheck.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h term.h
|
newuser.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h funcs.h input.h newuser.h language.h timeout.h change.h dispfile.h term.h ttyio.h openport.h
|
||||||
change.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h change.h dispfile.h funcs.h input.h language.h misc.h timeout.h exitinfo.h bye.h term.h
|
pinfo.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h pinfo.h input.h term.h ttyio.h
|
||||||
|
timecheck.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h timecheck.h funcs.h bye.h exitinfo.h language.h input.h term.h ttyio.h
|
||||||
|
change.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h change.h dispfile.h funcs.h input.h language.h misc.h timeout.h exitinfo.h bye.h term.h ttyio.h
|
||||||
exitinfo.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h funcs.h input.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
|
exitinfo.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h funcs.h input.h language.h oneline.h misc.h bye.h timeout.h timecheck.h exitinfo.h
|
||||||
mball.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbsedb.h mball.h
|
mball.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbsedb.h mball.h
|
||||||
mbsebbs.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msg.h mbsebbs.h user.h dispfile.h language.h menu.h misc.h bye.h timeout.h funcs.h term.h
|
mbsebbs.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msg.h mbsebbs.h user.h dispfile.h language.h menu.h misc.h bye.h timeout.h funcs.h term.h ttyio.h openport.h
|
||||||
menu.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h oneline.h mail.h bbslist.h change.h chat.h file.h funcs.h input.h misc.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h signature.h term.h
|
menu.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h oneline.h mail.h bbslist.h change.h chat.h file.h funcs.h input.h misc.h timeout.h menu.h page.h pinfo.h bye.h timecheck.h whoson.h language.h offline.h email.h door.h dispfile.h userlist.h timestats.h logentry.h morefile.h lastcallers.h signature.h term.h ttyio.h
|
||||||
pop3.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h term.h
|
pop3.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbinet.h ../lib/msgtext.h ../lib/msg.h msgutil.h pop3.h term.h ttyio.h
|
||||||
lastcallers.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h lastcallers.h term.h
|
lastcallers.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h lastcallers.h term.h ttyio.h
|
||||||
timeout.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msg.h timeout.h funcs.h bye.h filesub.h language.h term.h
|
timeout.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msg.h timeout.h funcs.h bye.h filesub.h language.h term.h
|
||||||
chat.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h chat.h funcs.h input.h language.h misc.h whoson.h term.h
|
chat.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h chat.h funcs.h input.h language.h misc.h whoson.h term.h ttyio.h
|
||||||
file.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbsedb.h filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h dispfile.h term.h
|
file.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/mbsedb.h filesub.h file.h funcs.h input.h language.h misc.h timeout.h exitinfo.h whoson.h change.h dispfile.h term.h ttyio.h openport.h
|
||||||
mbstat.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbstat.h
|
mbstat.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h mbstat.h
|
||||||
misc.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h funcs.h input.h language.h misc.h timeout.h exitinfo.h
|
misc.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msg.h funcs.h input.h language.h misc.h timeout.h exitinfo.h ttyio.h term.h
|
||||||
offline.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/bluewave.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h term.h
|
offline.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/bluewave.h ../lib/msgtext.h ../lib/msg.h mail.h funcs.h input.h language.h file.h filesub.h exitinfo.h timeout.h msgutil.h pop3.h offline.h whoson.h term.h ttyio.h openport.h
|
||||||
user.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h timeout.h user.h dispfile.h funcs.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h email.h term.h
|
user.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h timeout.h user.h dispfile.h funcs.h input.h misc.h bye.h file.h mail.h change.h menu.h exitinfo.h language.h offline.h email.h term.h ttyio.h
|
||||||
mbnewusr.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mbnewusr.h funcs.h input.h language.h misc.h timeout.h newuser.h term.h
|
mbnewusr.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h mbnewusr.h funcs.h input.h language.h misc.h timeout.h newuser.h term.h ttyio.h openport.h
|
||||||
input.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h timeout.h language.h term.h
|
input.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h timeout.h language.h term.h ttyio.h
|
||||||
whoson.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h exitinfo.h whoson.h term.h
|
whoson.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h input.h language.h exitinfo.h whoson.h term.h ttyio.h
|
||||||
door.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h language.h input.h timeout.h exitinfo.h whoson.h door.h term.h
|
door.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h language.h input.h timeout.h exitinfo.h whoson.h door.h term.h ttyio.h openport.h
|
||||||
dispfile.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h funcs.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h input.h dispfile.h filesub.h term.h
|
dispfile.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/msgtext.h ../lib/msg.h funcs.h language.h oneline.h misc.h timeout.h timecheck.h exitinfo.h mail.h email.h input.h dispfile.h filesub.h term.h ttyio.h
|
||||||
userlist.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h userlist.h language.h input.h timeout.h term.h
|
userlist.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h userlist.h language.h input.h timeout.h term.h ttyio.h
|
||||||
timestats.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h timestats.h funcs.h language.h input.h exitinfo.h term.h
|
timestats.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h timestats.h funcs.h language.h input.h exitinfo.h term.h
|
||||||
logentry.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h logentry.h
|
logentry.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h logentry.h
|
||||||
# End of generated dependencies
|
# End of generated dependencies
|
||||||
|
@ -38,12 +38,14 @@
|
|||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "bye.h"
|
#include "bye.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "openport.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern pid_t mypid;
|
extern pid_t mypid;
|
||||||
extern time_t t_start;
|
extern time_t t_start;
|
||||||
extern char *StartTime;
|
extern char *StartTime;
|
||||||
|
extern int hanged_up;
|
||||||
|
|
||||||
int do_mailout = FALSE;
|
int do_mailout = FALSE;
|
||||||
|
|
||||||
@ -54,6 +56,7 @@ void Good_Bye(int onsig)
|
|||||||
char *temp;
|
char *temp;
|
||||||
long offset;
|
long offset;
|
||||||
time_t t_end;
|
time_t t_end;
|
||||||
|
int i;
|
||||||
|
|
||||||
IsDoing("Hangup");
|
IsDoing("Hangup");
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -63,7 +66,7 @@ void Good_Bye(int onsig)
|
|||||||
* Don't display goodbye screen on SIGHUP and idle timeout.
|
* Don't display goodbye screen on SIGHUP and idle timeout.
|
||||||
* With idle timeout this will go into a loop.
|
* With idle timeout this will go into a loop.
|
||||||
*/
|
*/
|
||||||
if ((onsig != SIGHUP) && (onsig != SIGALRM) && (onsig != MBERR_TIMEOUT))
|
if ((onsig != SIGHUP) && (onsig != SIGALRM) && (onsig != MBERR_TIMEOUT) && (hanged_up == 0))
|
||||||
DisplayFile((char *)"goodbye");
|
DisplayFile((char *)"goodbye");
|
||||||
|
|
||||||
if (do_mailout)
|
if (do_mailout)
|
||||||
@ -86,7 +89,7 @@ void Good_Bye(int onsig)
|
|||||||
usrconfig.iLastFileArea = iAreaNumber;
|
usrconfig.iLastFileArea = iAreaNumber;
|
||||||
|
|
||||||
/* If time expired, do not say say successful logoff */
|
/* If time expired, do not say say successful logoff */
|
||||||
if (!iExpired)
|
if (!iExpired && !hanged_up)
|
||||||
Syslog('+', "User successfully logged off BBS");
|
Syslog('+', "User successfully logged off BBS");
|
||||||
|
|
||||||
usrconfig.iLastMsgArea = iMsgAreaNumber;
|
usrconfig.iLastMsgArea = iMsgAreaNumber;
|
||||||
@ -102,8 +105,24 @@ void Good_Bye(int onsig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Flush all data to the user, wait 5 seconds to
|
||||||
|
* be sure the user received all data.
|
||||||
|
*/
|
||||||
|
if (! hanged_up) {
|
||||||
|
colour(LIGHTGRAY, BLACK);
|
||||||
|
sleep(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < NSIG; i++)
|
||||||
|
signal(i, SIG_IGN);
|
||||||
|
|
||||||
|
cookedport();
|
||||||
|
hangup();
|
||||||
|
|
||||||
t_end = time(NULL);
|
t_end = time(NULL);
|
||||||
Syslog(' ', "MBSEBBS finished in %s", t_elapsed(t_start, t_end));
|
Syslog(' ', "MBSEBBS finished in %s", t_elapsed(t_start, t_end));
|
||||||
|
sleep(1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start shutting down this session
|
* Start shutting down this session
|
||||||
@ -117,16 +136,6 @@ void Good_Bye(int onsig)
|
|||||||
free(temp);
|
free(temp);
|
||||||
unlink("taglist");
|
unlink("taglist");
|
||||||
|
|
||||||
/*
|
|
||||||
* Flush all data to the user, wait 5 seconds to
|
|
||||||
* be sure the user received all data.
|
|
||||||
*/
|
|
||||||
colour(LIGHTGRAY, BLACK);
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
sleep(5);
|
|
||||||
|
|
||||||
Unsetraw();
|
|
||||||
Free_Language();
|
Free_Language();
|
||||||
free(pTTY);
|
free(pTTY);
|
||||||
if (StartTime)
|
if (StartTime)
|
||||||
@ -156,10 +165,11 @@ void Quick_Bye(int onsig)
|
|||||||
signal(i, SIG_DFL);
|
signal(i, SIG_DFL);
|
||||||
|
|
||||||
colour(LIGHTGRAY, BLACK);
|
colour(LIGHTGRAY, BLACK);
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
cookedport();
|
||||||
|
hangup();
|
||||||
|
|
||||||
free(pTTY);
|
free(pTTY);
|
||||||
if (StartTime)
|
if (StartTime)
|
||||||
free(StartTime);
|
free(StartTime);
|
||||||
|
984
mbsebbs/change.c
984
mbsebbs/change.c
File diff suppressed because it is too large
Load Diff
@ -39,6 +39,7 @@
|
|||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "whoson.h"
|
#include "whoson.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
int chat_with_sysop = FALSE; /* Global sysop chat flag */
|
int chat_with_sysop = FALSE; /* Global sysop chat flag */
|
||||||
@ -63,21 +64,12 @@ unsigned char testkey(int y, int x)
|
|||||||
|
|
||||||
Nopper();
|
Nopper();
|
||||||
locate(y, x);
|
locate(y, x);
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
|
||||||
perror("open /dev/tty");
|
|
||||||
exit(MBERR_TTYIO_ERROR);
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
|
|
||||||
rc = Waitchar(&ch, 50);
|
rc = Waitchar(&ch, 50);
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
if (ch == KEY_ESCAPE)
|
if (ch == KEY_ESCAPE)
|
||||||
rc = Escapechar(&ch);
|
rc = Escapechar(&ch);
|
||||||
}
|
}
|
||||||
Unsetraw();
|
|
||||||
close(ttyfd);
|
|
||||||
if (rc == 1)
|
if (rc == 1)
|
||||||
return ch;
|
return ch;
|
||||||
else
|
else
|
||||||
@ -97,15 +89,15 @@ void Showline(int y, int x, char *msg)
|
|||||||
if (msg[0] == '<') {
|
if (msg[0] == '<') {
|
||||||
locate(y, x);
|
locate(y, x);
|
||||||
colour(LIGHTCYAN, BLACK);
|
colour(LIGHTCYAN, BLACK);
|
||||||
putchar('<');
|
PUTCHAR('<');
|
||||||
colour(LIGHTBLUE, BLACK);
|
colour(LIGHTBLUE, BLACK);
|
||||||
for (i = 1; i < strlen(msg); i++) {
|
for (i = 1; i < strlen(msg); i++) {
|
||||||
if (msg[i] == '>') {
|
if (msg[i] == '>') {
|
||||||
colour(LIGHTCYAN, BLACK);
|
colour(LIGHTCYAN, BLACK);
|
||||||
putchar(msg[i]);
|
PUTCHAR(msg[i]);
|
||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
} else {
|
} else {
|
||||||
putchar(msg[i]);
|
PUTCHAR(msg[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (msg[0] == '*') {
|
} else if (msg[0] == '*') {
|
||||||
@ -142,7 +134,6 @@ void DispMsg(char *msg)
|
|||||||
} else {
|
} else {
|
||||||
rpointer++;
|
rpointer++;
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -152,7 +143,7 @@ void DispMsg(char *msg)
|
|||||||
*/
|
*/
|
||||||
void clrtoeol(void)
|
void clrtoeol(void)
|
||||||
{
|
{
|
||||||
fprintf(stdout, ANSI_CLREOL);
|
PUTSTR((char *)ANSI_CLREOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -178,15 +169,14 @@ void Chat(char *username, char *channel)
|
|||||||
|
|
||||||
if (username && channel) {
|
if (username && channel) {
|
||||||
colour(LIGHTGREEN, BLACK);
|
colour(LIGHTGREEN, BLACK);
|
||||||
|
PUTCHAR('\007');
|
||||||
/* *** Sysop is starting chat *** */
|
/* *** Sysop is starting chat *** */
|
||||||
printf("\007%s\n\r", (char *) Language(59));
|
pout(LIGHTGREEN, BLACK, (char *) Language(59));
|
||||||
fflush(stdout);
|
Enter(1);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
printf("\007");
|
PUTCHAR('\007');
|
||||||
fflush(stdout);
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
printf("\007");
|
PUTCHAR('\007');
|
||||||
fflush(stdout);
|
|
||||||
Syslog('+', "Sysop chat started");
|
Syslog('+', "Sysop chat started");
|
||||||
chat_with_sysop = TRUE;
|
chat_with_sysop = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -200,7 +190,8 @@ void Chat(char *username, char *channel)
|
|||||||
locate(1, 1);
|
locate(1, 1);
|
||||||
colour(WHITE, BLUE);
|
colour(WHITE, BLUE);
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
mvprintw(1, 2, "MBSE BBS Chat Server");
|
sprintf(buf, "%-*s", 79, " MBSE BBS Chat Server");
|
||||||
|
mvprintw(1, 1, buf);
|
||||||
|
|
||||||
sprintf(buf, "CCON,3,%d,%s,0;", mypid, exitinfo.Name);
|
sprintf(buf, "CCON,3,%d,%s,0;", mypid, exitinfo.Name);
|
||||||
Syslog('c', "> %s", buf);
|
Syslog('c', "> %s", buf);
|
||||||
@ -223,7 +214,8 @@ void Chat(char *username, char *channel)
|
|||||||
locate(exitinfo.iScreenLen - 2, 1);
|
locate(exitinfo.iScreenLen - 2, 1);
|
||||||
colour(WHITE, BLUE);
|
colour(WHITE, BLUE);
|
||||||
clrtoeol();
|
clrtoeol();
|
||||||
mvprintw(exitinfo.iScreenLen - 2, 2, "Chat, type \"/EXIT\" to exit");
|
sprintf(buf, "%-*s", 79, " Chat, type \"/EXIT\" to exit or \"/HELP\" for help");
|
||||||
|
mvprintw(exitinfo.iScreenLen - 2, 1, buf);
|
||||||
|
|
||||||
colour(LIGHTGRAY, BLACK);
|
colour(LIGHTGRAY, BLACK);
|
||||||
mvprintw(exitinfo.iScreenLen - 1, 1, ">");
|
mvprintw(exitinfo.iScreenLen - 1, 1, ">");
|
||||||
@ -287,21 +279,19 @@ void Chat(char *username, char *channel)
|
|||||||
ch = testkey(exitinfo.iScreenLen -1, curpos + 2);
|
ch = testkey(exitinfo.iScreenLen -1, curpos + 2);
|
||||||
if (isprint(ch)) {
|
if (isprint(ch)) {
|
||||||
if (curpos < 77) {
|
if (curpos < 77) {
|
||||||
putchar(ch);
|
PUTCHAR(ch);
|
||||||
fflush(stdout);
|
|
||||||
sbuf[curpos] = ch;
|
sbuf[curpos] = ch;
|
||||||
curpos++;
|
curpos++;
|
||||||
} else {
|
} else {
|
||||||
putchar(7);
|
PUTCHAR(7);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
} else if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) {
|
} else if ((ch == KEY_BACKSPACE) || (ch == KEY_RUBOUT) || (ch == KEY_DEL)) {
|
||||||
if (curpos) {
|
if (curpos) {
|
||||||
curpos--;
|
curpos--;
|
||||||
sbuf[curpos] = '\0';
|
sbuf[curpos] = '\0';
|
||||||
printf("\b \b");
|
BackErase();
|
||||||
} else {
|
} else {
|
||||||
putchar(7);
|
PUTCHAR(7);
|
||||||
}
|
}
|
||||||
} else if ((ch == '\r') && curpos) {
|
} else if ((ch == '\r') && curpos) {
|
||||||
sprintf(buf, "CPUT:2,%d,%s;", mypid, sbuf);
|
sprintf(buf, "CPUT:2,%d,%s;", mypid, sbuf);
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
#include "dispfile.h"
|
#include "dispfile.h"
|
||||||
#include "filesub.h"
|
#include "filesub.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -55,28 +56,28 @@
|
|||||||
int TotalUsers(void);
|
int TotalUsers(void);
|
||||||
int TotalUsers(void)
|
int TotalUsers(void)
|
||||||
{
|
{
|
||||||
FILE *pUsrConfig;
|
FILE *pUsrConfig;
|
||||||
int ch = 0;
|
int ch = 0;
|
||||||
char *temp;
|
char *temp;
|
||||||
struct userhdr uhdr;
|
struct userhdr uhdr;
|
||||||
struct userrec u;
|
struct userrec u;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||||
if(( pUsrConfig = fopen(temp,"rb")) == NULL)
|
if(( pUsrConfig = fopen(temp,"rb")) == NULL)
|
||||||
WriteError("ControlCodeK: Can't open users file %s for reading", temp);
|
WriteError("ControlCodeK: Can't open users file %s for reading", temp);
|
||||||
else {
|
else {
|
||||||
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
|
fread(&uhdr, sizeof(uhdr), 1, pUsrConfig);
|
||||||
|
|
||||||
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1)
|
while (fread(&u, uhdr.recsize, 1, pUsrConfig) == 1)
|
||||||
if ((!u.Deleted) && (strlen(u.sUserName) > 0))
|
if ((!u.Deleted) && (strlen(u.sUserName) > 0))
|
||||||
ch++;
|
ch++;
|
||||||
|
|
||||||
fclose(pUsrConfig);
|
fclose(pUsrConfig);
|
||||||
}
|
}
|
||||||
free(temp);
|
free(temp);
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -100,8 +101,10 @@ void DisplayRules(void)
|
|||||||
|
|
||||||
if ((dp = opendir(CFG.rulesdir)) == NULL) {
|
if ((dp = opendir(CFG.rulesdir)) == NULL) {
|
||||||
WriteError("$Can't open directory %s", CFG.rulesdir);
|
WriteError("$Can't open directory %s", CFG.rulesdir);
|
||||||
|
Enter(1);
|
||||||
/* Can't open directory for listing: */
|
/* Can't open directory for listing: */
|
||||||
printf("\n%s\n\n", (char *) Language(290));
|
pout(LIGHTRED, BLACK, (char *) Language(290));
|
||||||
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -138,9 +141,9 @@ void DisplayRules(void)
|
|||||||
} else {
|
} else {
|
||||||
Syslog('+', "Display rules for %s failed, not found", msgs.Tag);
|
Syslog('+', "Display rules for %s failed, not found", msgs.Tag);
|
||||||
Enter(1);
|
Enter(1);
|
||||||
colour(LIGHTRED, BLACK);
|
|
||||||
/* No rules found for this area */
|
/* No rules found for this area */
|
||||||
printf("\n%s\n\n", (char *) Language(13));
|
pout(LIGHTRED, BLACK, (char *) Language(13));
|
||||||
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -155,9 +158,10 @@ void DisplayRules(void)
|
|||||||
*/
|
*/
|
||||||
int DisplayTextFile(char *filename)
|
int DisplayTextFile(char *filename)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *buf;
|
char *buf;
|
||||||
int i, x, c, z, lc = 0;
|
int i, x, z, lc = 0;
|
||||||
|
unsigned char c;
|
||||||
|
|
||||||
if ((fp = fopen(filename, "r")) == NULL) {
|
if ((fp = fopen(filename, "r")) == NULL) {
|
||||||
WriteError("$DisplayTextFile(%s) failed");
|
WriteError("$DisplayTextFile(%s) failed");
|
||||||
@ -172,26 +176,23 @@ int DisplayTextFile(char *filename)
|
|||||||
i = strlen(buf);
|
i = strlen(buf);
|
||||||
|
|
||||||
for (x = 0; x < i; x++) {
|
for (x = 0; x < i; x++) {
|
||||||
c = (*(buf + x));
|
c = (*(buf + x) & 0xff);
|
||||||
if (isprint(c))
|
if (isprint(c))
|
||||||
printf("%c", c);
|
PUTCHAR(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
Enter(1);
|
||||||
fflush(stdout);
|
|
||||||
lc++;
|
lc++;
|
||||||
|
|
||||||
if ((lc >= exitinfo.iScreenLen) && (lc < 1000)) {
|
if ((lc >= exitinfo.iScreenLen) && (lc < 1000)) {
|
||||||
lc = 0;
|
lc = 0;
|
||||||
/* More (Y/n/=) */
|
/* More (Y/n/=) */
|
||||||
pout(CFG.MoreF, CFG.MoreB, (char *) Language(61));
|
pout(CFG.MoreF, CFG.MoreB, (char *) Language(61));
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
z = toupper(Getone());
|
z = toupper(Readkey());
|
||||||
|
|
||||||
if (z == Keystroke(61, 1)) {
|
if (z == Keystroke(61, 1)) {
|
||||||
printf("\n");
|
Enter(1);
|
||||||
fflush(stdout);
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
free(buf);
|
free(buf);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -211,10 +212,8 @@ int DisplayTextFile(char *filename)
|
|||||||
Enter(1);
|
Enter(1);
|
||||||
/* Press ENTER to continue */
|
/* Press ENTER to continue */
|
||||||
language(CFG.MoreF, CFG.MoreB, 436);
|
language(CFG.MoreF, CFG.MoreB, 436);
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
Getone();
|
Readkey();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -228,10 +227,11 @@ int DisplayTextFile(char *filename)
|
|||||||
*/
|
*/
|
||||||
int DisplayFile(char *filename)
|
int DisplayFile(char *filename)
|
||||||
{
|
{
|
||||||
FILE *pFileName;
|
FILE *pFileName;
|
||||||
long iSec = 0;
|
long iSec = 0;
|
||||||
char *sFileName, *tmp, *tmp1, newfile[PATH_MAX];
|
char *sFileName, *tmp, *tmp1, newfile[PATH_MAX];
|
||||||
int i, x;
|
int i, x;
|
||||||
|
unsigned char c;
|
||||||
|
|
||||||
sFileName = calloc(16385, sizeof(char));
|
sFileName = calloc(16385, sizeof(char));
|
||||||
tmp = calloc(PATH_MAX, sizeof(char));
|
tmp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -272,7 +272,8 @@ int DisplayFile(char *filename)
|
|||||||
i = fread(sFileName, sizeof(char), 16384, pFileName);
|
i = fread(sFileName, sizeof(char), 16384, pFileName);
|
||||||
|
|
||||||
for (x = 0; x < i; x++) {
|
for (x = 0; x < i; x++) {
|
||||||
switch(*(sFileName + x)) {
|
c = *(sFileName + x) & 0xff;
|
||||||
|
switch (c) {
|
||||||
case '': ControlCodeU(sFileName[++x]);
|
case '': ControlCodeU(sFileName[++x]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -282,10 +283,8 @@ int DisplayFile(char *filename)
|
|||||||
case '': ControlCodeK(sFileName[++x]);
|
case '': ControlCodeK(sFileName[++x]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '': fflush(stdout);
|
case '': alarm_on();
|
||||||
fflush(stdin);
|
Readkey();
|
||||||
alarm_on();
|
|
||||||
Getone();
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '': /*
|
case '': /*
|
||||||
@ -306,16 +305,20 @@ int DisplayFile(char *filename)
|
|||||||
iSec = atoi(tmp1);
|
iSec = atoi(tmp1);
|
||||||
while ((x <= i) && (*(sFileName + x) != '')) {
|
while ((x <= i) && (*(sFileName + x) != '')) {
|
||||||
if (exitinfo.Security.level >= iSec)
|
if (exitinfo.Security.level >= iSec)
|
||||||
printf("%c", *(sFileName + x));
|
PUTCHAR(*(sFileName + x));
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '': fflush(stdout);
|
case '': sleep(1);
|
||||||
sleep(1);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: printf("%c", *(sFileName + x));
|
case '\n': Enter(1); /* Insert <cr>, we are in raw mode */
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '\r': break; /* If the file has <cr> chars (DOS), eat them */
|
||||||
|
|
||||||
|
default: PUTCHAR(*(sFileName + x));
|
||||||
|
|
||||||
} /* switch */
|
} /* switch */
|
||||||
} /* for */
|
} /* for */
|
||||||
@ -338,10 +341,8 @@ int DisplayFileEnter(char *File)
|
|||||||
Enter(1);
|
Enter(1);
|
||||||
/* Press ENTER to continue */
|
/* Press ENTER to continue */
|
||||||
language(13, 0, 436);
|
language(13, 0, 436);
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
Getone();
|
Readkey();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,325 +350,333 @@ int DisplayFileEnter(char *File)
|
|||||||
|
|
||||||
void ControlCodeF(int ch)
|
void ControlCodeF(int ch)
|
||||||
{
|
{
|
||||||
/* Update user info */
|
char temp[81];
|
||||||
ReadExitinfo();
|
|
||||||
|
|
||||||
switch (toupper(ch)) {
|
/* Update user info */
|
||||||
|
ReadExitinfo();
|
||||||
|
|
||||||
|
switch (toupper(ch)) {
|
||||||
case '!':
|
case '!':
|
||||||
printf(exitinfo.sProtocol);
|
sprintf(temp, "%s", exitinfo.sProtocol);
|
||||||
break;
|
break;
|
||||||
case 'A':
|
case 'A':
|
||||||
printf("%ld", exitinfo.Uploads);
|
sprintf(temp, "%ld", exitinfo.Uploads);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
printf("%ld", exitinfo.Downloads);
|
sprintf(temp, "%ld", exitinfo.Downloads);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
printf("%lu", exitinfo.DownloadK);
|
sprintf(temp, "%lu", exitinfo.DownloadK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
printf("%lu", exitinfo.UploadK);
|
sprintf(temp, "%lu", exitinfo.UploadK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'E':
|
case 'E':
|
||||||
printf("%lu", exitinfo.DownloadK + exitinfo.UploadK);
|
sprintf(temp, "%lu", exitinfo.DownloadK + exitinfo.UploadK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
printf("%lu", LIMIT.DownK);
|
sprintf(temp, "%lu", LIMIT.DownK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'G':
|
case 'G':
|
||||||
printf("%d", exitinfo.iTransferTime);
|
sprintf(temp, "%d", exitinfo.iTransferTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'H':
|
case 'H':
|
||||||
printf("%d", iAreaNumber);
|
sprintf(temp, "%d", iAreaNumber);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I':
|
case 'I':
|
||||||
printf(sAreaDesc);
|
sprintf(temp, "%s", sAreaDesc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
printf("%u", LIMIT.DownF);
|
sprintf(temp, "%u", LIMIT.DownF);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
printf("%s", LIMIT.Description);
|
sprintf(temp, "%s", LIMIT.Description);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf(" ");
|
sprintf(temp, " ");
|
||||||
}
|
}
|
||||||
|
PUTSTR(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ControlCodeU(int ch)
|
void ControlCodeU(int ch)
|
||||||
{
|
{
|
||||||
/*
|
char temp[81];
|
||||||
* Update user info
|
|
||||||
*/
|
|
||||||
TimeCheck();
|
|
||||||
ReadExitinfo();
|
|
||||||
|
|
||||||
switch (toupper(ch)) {
|
/*
|
||||||
|
* Update user info
|
||||||
|
*/
|
||||||
|
TimeCheck();
|
||||||
|
ReadExitinfo();
|
||||||
|
|
||||||
|
switch (toupper(ch)) {
|
||||||
case 'A':
|
case 'A':
|
||||||
printf("%s", exitinfo.sUserName);
|
sprintf(temp, "%s", exitinfo.sUserName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
printf(exitinfo.sLocation);
|
sprintf(temp, "%s", exitinfo.sLocation);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
printf(exitinfo.sVoicePhone);
|
sprintf(temp, "%s", exitinfo.sVoicePhone);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
printf(exitinfo.sDataPhone);
|
sprintf(temp, "%s", exitinfo.sDataPhone);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'E':
|
case 'E':
|
||||||
printf(LastLoginDate);
|
sprintf(temp, "%s", LastLoginDate);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
printf("%s %s", StrDateDMY(exitinfo.tFirstLoginDate), StrTimeHMS(exitinfo.tFirstLoginDate));
|
sprintf(temp, "%s %s", StrDateDMY(exitinfo.tFirstLoginDate), StrTimeHMS(exitinfo.tFirstLoginDate));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'G':
|
case 'G':
|
||||||
printf(LastLoginTime);
|
sprintf(temp, "%s", LastLoginTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'H':
|
case 'H':
|
||||||
printf("%d", exitinfo.Security.level);
|
sprintf(temp, "%d", exitinfo.Security.level);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I':
|
case 'I':
|
||||||
printf("%d", exitinfo.iTotalCalls);
|
sprintf(temp, "%d", exitinfo.iTotalCalls);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
printf("%d", exitinfo.iTimeUsed);
|
sprintf(temp, "%d", exitinfo.iTimeUsed);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
printf("%d", exitinfo.iConnectTime);
|
sprintf(temp, "%d", exitinfo.iConnectTime);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
printf("%d", exitinfo.iTimeLeft);
|
sprintf(temp, "%d", exitinfo.iTimeLeft);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
printf("%d", exitinfo.iScreenLen);
|
sprintf(temp, "%d", exitinfo.iScreenLen);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
printf(FirstName);
|
sprintf(temp, "%s", FirstName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
printf(LastName);
|
sprintf(temp, "%s", LastName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Q':
|
case 'Q':
|
||||||
printf("%s", exitinfo.ieNEWS ? (char *) Language(147) : (char *) Language(148));
|
sprintf(temp, "%s", exitinfo.ieNEWS ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
printf("%s", exitinfo.GraphMode ? (char *) Language(147) : (char *) Language(148));
|
sprintf(temp, "%s", exitinfo.GraphMode ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
printf("%s", exitinfo.HotKeys ? (char *) Language(147) : (char *) Language(148));
|
sprintf(temp, "%s", exitinfo.HotKeys ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S':
|
case 'S':
|
||||||
printf("%d", exitinfo.iTimeUsed + exitinfo.iTimeLeft);
|
sprintf(temp, "%d", exitinfo.iTimeUsed + exitinfo.iTimeLeft);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'T':
|
case 'T':
|
||||||
printf(exitinfo.sDateOfBirth);
|
sprintf(temp, "%s", exitinfo.sDateOfBirth);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'U':
|
case 'U':
|
||||||
printf("%d", exitinfo.iPosted);
|
sprintf(temp, "%d", exitinfo.iPosted);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
printf(lang.Name);
|
sprintf(temp, "%s", lang.Name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Y':
|
case 'Y':
|
||||||
printf(exitinfo.sHandle);
|
sprintf(temp, "%s", exitinfo.sHandle);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Z':
|
case 'Z':
|
||||||
printf("%s", exitinfo.DoNotDisturb ? (char *) Language(147) : (char *) Language(148));
|
sprintf(temp, "%s", exitinfo.DoNotDisturb ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '1':
|
case '1':
|
||||||
printf("%s", exitinfo.MailScan ? (char *) Language(147) : (char *) Language(148));
|
sprintf(temp, "%s", exitinfo.MailScan ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '2':
|
case '2':
|
||||||
printf("%s", exitinfo.ieFILE ? (char *) Language(147) : (char *) Language(148));
|
sprintf(temp, "%s", exitinfo.ieFILE ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '3':
|
case '3':
|
||||||
switch(exitinfo.MsgEditor) {
|
switch(exitinfo.MsgEditor) {
|
||||||
case LINEEDIT: printf(Language(387));
|
case LINEEDIT: sprintf(temp, "%s", Language(387));
|
||||||
break;
|
break;
|
||||||
case FSEDIT: printf(Language(388));
|
case FSEDIT: sprintf(temp, "%s", Language(388));
|
||||||
break;
|
break;
|
||||||
case EXTEDIT: printf(Language(389));
|
case EXTEDIT: sprintf(temp, "%s", Language(389));
|
||||||
break;
|
break;
|
||||||
default: printf("?");
|
default: sprintf(temp, "?");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '4':
|
case '4':
|
||||||
printf("%s", exitinfo.FSemacs ? (char *) Language(147) : (char *) Language(148));
|
sprintf(temp, "%s", exitinfo.FSemacs ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '5':
|
case '5':
|
||||||
printf(exitinfo.address[0]);
|
sprintf(temp, "%s", exitinfo.address[0]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '6':
|
case '6':
|
||||||
printf(exitinfo.address[1]);
|
sprintf(temp, "%s", exitinfo.address[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '7':
|
case '7':
|
||||||
printf(exitinfo.address[2]);
|
sprintf(temp, "%s", exitinfo.address[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '8':
|
case '8':
|
||||||
printf("%s", exitinfo.OL_ExtInfo ? (char *) Language(147) : (char *) Language(148));
|
sprintf(temp, "%s", exitinfo.OL_ExtInfo ? (char *) Language(147) : (char *) Language(148));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '9':
|
case '9':
|
||||||
printf("%s", getchrs(exitinfo.Charset));
|
sprintf(temp, "%s", getchrs(exitinfo.Charset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf(" ");
|
sprintf(temp, " ");
|
||||||
}
|
}
|
||||||
|
PUTSTR(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ControlCodeK(int ch)
|
void ControlCodeK(int ch)
|
||||||
{
|
{
|
||||||
FILE *pCallerLog;
|
FILE *pCallerLog;
|
||||||
char sDataFile[PATH_MAX];
|
char sDataFile[PATH_MAX], temp[81];
|
||||||
lastread LR;
|
lastread LR;
|
||||||
|
|
||||||
switch (toupper(ch)) {
|
switch (toupper(ch)) {
|
||||||
case 'A':
|
case 'A':
|
||||||
printf("%s", (char *) GetDateDMY());
|
sprintf(temp, "%s", (char *) GetDateDMY());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
printf("%s", (char *) GetLocalHMS());
|
sprintf(temp, "%s", (char *) GetLocalHMS());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'C':
|
case 'C':
|
||||||
printf("%s", (char *) GLCdate());
|
sprintf(temp, "%s", (char *) GLCdate());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
printf("%s", (char *) GLCdateyy());
|
sprintf(temp, "%s", (char *) GLCdateyy());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'E':
|
case 'E':
|
||||||
printf("%ld", Speed());
|
sprintf(temp, "%ld", Speed());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
printf("%s", LastCaller);
|
sprintf(temp, "%s", LastCaller);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'G':
|
case 'G':
|
||||||
printf("%d", TotalUsers());
|
sprintf(temp, "%d", TotalUsers());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'H':
|
case 'H':
|
||||||
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
sprintf(sDataFile, "%s/etc/sysinfo.data", getenv("MBSE_ROOT"));
|
||||||
if((pCallerLog = fopen(sDataFile, "rb")) != NULL) {
|
if((pCallerLog = fopen(sDataFile, "rb")) != NULL) {
|
||||||
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
|
fread(&SYSINFO, sizeof(SYSINFO), 1, pCallerLog);
|
||||||
printf("%ld", SYSINFO.SystemCalls);
|
sprintf(temp, "%ld", SYSINFO.SystemCalls);
|
||||||
fclose(pCallerLog);
|
fclose(pCallerLog);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'I':
|
case 'I':
|
||||||
printf("%d", iMsgAreaNumber + 1);
|
sprintf(temp, "%d", iMsgAreaNumber + 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
printf(sMsgAreaDesc);
|
sprintf(temp, "%s", sMsgAreaDesc);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'K':
|
case 'K':
|
||||||
printf("%s", Oneliner_Get());
|
sprintf(temp, "%s", Oneliner_Get());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'L':
|
case 'L':
|
||||||
SetMsgArea(iMsgAreaNumber);
|
SetMsgArea(iMsgAreaNumber);
|
||||||
printf("%ld", MsgBase.Total);
|
sprintf(temp, "%ld", MsgBase.Total);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'M':
|
case 'M':
|
||||||
LR.UserID = grecno;
|
LR.UserID = grecno;
|
||||||
if (Msg_Open(sMsgAreaBase)) {
|
if (Msg_Open(sMsgAreaBase)) {
|
||||||
if (Msg_GetLastRead(&LR) == TRUE) {
|
if (Msg_GetLastRead(&LR) == TRUE) {
|
||||||
if (LR.HighReadMsg > MsgBase.Highest)
|
if (LR.HighReadMsg > MsgBase.Highest)
|
||||||
LR.HighReadMsg = MsgBase.Highest;
|
LR.HighReadMsg = MsgBase.Highest;
|
||||||
printf("%ld", LR.HighReadMsg);
|
sprintf(temp, "%ld", LR.HighReadMsg);
|
||||||
} else
|
} else
|
||||||
printf("?");
|
sprintf(temp, "?");
|
||||||
Msg_Close();
|
Msg_Close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N':
|
case 'N':
|
||||||
printf("%s", sMailbox);
|
sprintf(temp, "%s", sMailbox);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
SetEmailArea(sMailbox);
|
SetEmailArea(sMailbox);
|
||||||
printf("%ld", EmailBase.Total);
|
sprintf(temp, "%ld", EmailBase.Total);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'P':
|
case 'P':
|
||||||
sprintf(sDataFile, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, sMailbox);
|
sprintf(sDataFile, "%s/%s/%s", CFG.bbs_usersdir, exitinfo.Name, sMailbox);
|
||||||
LR.UserID = grecno;
|
LR.UserID = grecno;
|
||||||
if (Msg_Open(sDataFile)) {
|
if (Msg_Open(sDataFile)) {
|
||||||
if (Msg_GetLastRead(&LR) == TRUE) {
|
if (Msg_GetLastRead(&LR) == TRUE) {
|
||||||
if (LR.HighReadMsg > EmailBase.Highest)
|
if (LR.HighReadMsg > EmailBase.Highest)
|
||||||
LR.HighReadMsg = EmailBase.Highest;
|
LR.HighReadMsg = EmailBase.Highest;
|
||||||
printf("%ld", LR.HighReadMsg);
|
sprintf(temp, "%ld", LR.HighReadMsg);
|
||||||
} else
|
} else
|
||||||
printf("?");
|
sprintf(temp, "?");
|
||||||
Msg_Close();
|
Msg_Close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Q':
|
case 'Q':
|
||||||
printf("%s %s", StrDateDMY(LastCallerTime), StrTimeHMS(LastCallerTime));
|
sprintf(temp, "%s %s", StrDateDMY(LastCallerTime), StrTimeHMS(LastCallerTime));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
printf(" ");
|
sprintf(temp, " ");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PUTSTR(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,8 @@
|
|||||||
#include "whoson.h"
|
#include "whoson.h"
|
||||||
#include "door.h"
|
#include "door.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
#include "openport.h"
|
||||||
|
|
||||||
|
|
||||||
extern time_t t_start;
|
extern time_t t_start;
|
||||||
@ -128,9 +130,10 @@ void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSu
|
|||||||
strtok(NULL, ","); /* location */
|
strtok(NULL, ","); /* location */
|
||||||
if (strcmp(strtok(NULL, ","), menus.DoorName) == 0) {
|
if (strcmp(strtok(NULL, ","), menus.DoorName) == 0) {
|
||||||
Syslog('+', "User tried single user door %s, but door is in use", menus.DoorName);
|
Syslog('+', "User tried single user door %s, but door is in use", menus.DoorName);
|
||||||
colour(LIGHTRED, BLACK);
|
Enter(1);
|
||||||
/* The door is in use by another user, try again later */
|
/* The door is in use by another user, try again later */
|
||||||
printf("\n%s\n\n", (char *) Language(20));
|
pout(LIGHTRED, BLACK, (char *) Language(20));
|
||||||
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
free(temp1);
|
free(temp1);
|
||||||
free(String);
|
free(String);
|
||||||
@ -149,14 +152,14 @@ void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSu
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((strstr(Program, "/A")) != NULL) {
|
if ((strstr(Program, "/A")) != NULL) {
|
||||||
|
Enter(1);
|
||||||
colour(3, 0);
|
colour(3, 0);
|
||||||
if ((String = strstr(Program, "/T=")) != NULL) {
|
if ((String = strstr(Program, "/T=")) != NULL) {
|
||||||
String1 = String + 3;
|
String1 = String + 3;
|
||||||
printf("\n%s", String1);
|
PUTSTR(String1);
|
||||||
} else
|
} else
|
||||||
printf("\nPlease enter filename: ");
|
PUTSTR((char *)"Please enter filename: ");
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(temp1, 80);
|
GetstrC(temp1, 80);
|
||||||
|
|
||||||
@ -288,19 +291,32 @@ void ExtDoor(char *Program, int NoDoorsys, int Y2Kdoorsys, int Comport, int NoSu
|
|||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
printf("Loading ...\n\n");
|
PUTSTR((char *)"Loading ...");
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Put terminal back in cooked mode, prefered by some doors.
|
||||||
|
*/
|
||||||
|
cookedport();
|
||||||
|
|
||||||
if (NoSuid)
|
if (NoSuid)
|
||||||
rc = exec_nosuid(Program);
|
rc = exec_nosuid(Program);
|
||||||
else
|
else
|
||||||
rc = execute_str((char *)"/bin/sh", (char *)"-c", Program, NULL, NULL, NULL);
|
rc = execute_str((char *)"/bin/sh", (char *)"-c", Program, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Restore raw mode if needed, some doors put the terminal
|
||||||
|
* back in cooked mode.
|
||||||
|
*/
|
||||||
|
rawport();
|
||||||
|
|
||||||
Altime(0);
|
Altime(0);
|
||||||
alarm_off();
|
alarm_off();
|
||||||
alarm_on();
|
alarm_on();
|
||||||
Syslog('+', "Door end, rc=%d", rc);
|
Syslog('+', "Door end, rc=%d", rc);
|
||||||
|
|
||||||
free(temp1);
|
free(temp1);
|
||||||
printf("\n\n");
|
Enter(2);
|
||||||
|
|
||||||
if (!NoPrompt)
|
if (!NoPrompt)
|
||||||
Pause();
|
Pause();
|
||||||
|
1007
mbsebbs/email.c
1007
mbsebbs/email.c
File diff suppressed because it is too large
Load Diff
2202
mbsebbs/file.c
2202
mbsebbs/file.c
File diff suppressed because it is too large
Load Diff
@ -42,6 +42,7 @@
|
|||||||
#include "exitinfo.h"
|
#include "exitinfo.h"
|
||||||
#include "change.h"
|
#include "change.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern pid_t mypid;
|
extern pid_t mypid;
|
||||||
@ -62,13 +63,13 @@ _Tag Tagbuf[100];
|
|||||||
*/
|
*/
|
||||||
void InitTag()
|
void InitTag()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Tagnr = 0;
|
Tagnr = 0;
|
||||||
|
|
||||||
for (i = 0; i < 100; i++) {
|
for (i = 0; i < 100; i++) {
|
||||||
memset(&Tagbuf[i], 0, sizeof(_Tag));
|
memset(&Tagbuf[i], 0, sizeof(_Tag));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -78,32 +79,32 @@ void InitTag()
|
|||||||
*/
|
*/
|
||||||
void SetTag(_Tag tag)
|
void SetTag(_Tag tag)
|
||||||
{
|
{
|
||||||
if (Tagnr < 99)
|
if (Tagnr < 99)
|
||||||
Tagnr++;
|
Tagnr++;
|
||||||
else
|
else
|
||||||
Tagnr = 1;
|
Tagnr = 1;
|
||||||
|
|
||||||
Tagbuf[Tagnr] = tag;
|
Tagbuf[Tagnr] = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int ForceProtocol()
|
int ForceProtocol()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* If user has no default protocol, make sure he has one.
|
||||||
|
*/
|
||||||
|
if (strcmp(sProtName, "") == 0) {
|
||||||
|
Chg_Protocol();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If user has no default protocol, make sure he has one.
|
* If the user didn't pick a protocol, quit.
|
||||||
*/
|
*/
|
||||||
if (strcmp(sProtName, "") == 0) {
|
if (strcmp(sProtName, "") == 0) {
|
||||||
Chg_Protocol();
|
return FALSE;
|
||||||
|
|
||||||
/*
|
|
||||||
* If the user didn't pick a protocol, quit.
|
|
||||||
*/
|
|
||||||
if (strcmp(sProtName, "") == 0) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -113,41 +114,29 @@ int ForceProtocol()
|
|||||||
*/
|
*/
|
||||||
void GetstrD(char *sStr, int iMaxlen)
|
void GetstrD(char *sStr, int iMaxlen)
|
||||||
{
|
{
|
||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
|
|
||||||
fflush(stdout);
|
strcpy(sStr, "");
|
||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR)) < 0) {
|
alarm_on();
|
||||||
perror("open 6");
|
while (ch != 13) {
|
||||||
return;
|
ch = Readkey();
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
strcpy(sStr, "");
|
|
||||||
|
|
||||||
alarm_on();
|
if (((ch == 8) || (ch == KEY_DEL) || (ch == 127)) && (iPos > 0)) {
|
||||||
while (ch != 13) {
|
BackErase();
|
||||||
ch = Readkey();
|
sStr[--iPos]='\0';
|
||||||
|
|
||||||
if (((ch == 8) || (ch == KEY_DEL) || (ch == 127)) && (iPos > 0)) {
|
|
||||||
printf("\b \b");
|
|
||||||
fflush(stdout);
|
|
||||||
sStr[--iPos]='\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch > 31 && ch < 127) {
|
|
||||||
if (iPos <= iMaxlen) {
|
|
||||||
iPos++;
|
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
|
||||||
printf("%c", ch);
|
|
||||||
fflush(stdout);
|
|
||||||
} else
|
|
||||||
ch=07;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
if (ch > 31 && ch < 127) {
|
||||||
close(ttyfd);
|
if (iPos <= iMaxlen) {
|
||||||
|
iPos++;
|
||||||
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
|
PUTCHAR(ch);
|
||||||
|
} else
|
||||||
|
PUTCHAR(7);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -159,27 +148,28 @@ void GetstrD(char *sStr, int iMaxlen)
|
|||||||
*/
|
*/
|
||||||
FILE *OpenFareas(int Write)
|
FILE *OpenFareas(int Write)
|
||||||
{
|
{
|
||||||
FILE *pAreas;
|
FILE *pAreas;
|
||||||
char *FileArea;
|
char *FileArea;
|
||||||
|
|
||||||
FileArea = calloc(PATH_MAX, sizeof(char));
|
FileArea = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(FileArea, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
sprintf(FileArea, "%s/etc/fareas.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if (Write)
|
if (Write)
|
||||||
pAreas = fopen(FileArea, "r+");
|
pAreas = fopen(FileArea, "r+");
|
||||||
else
|
else
|
||||||
pAreas = fopen(FileArea, "r");
|
pAreas = fopen(FileArea, "r");
|
||||||
|
|
||||||
if (pAreas == NULL) {
|
if (pAreas == NULL) {
|
||||||
WriteError("$Can't open FileBase %s", FileArea);
|
WriteError("$Can't open FileBase %s", FileArea);
|
||||||
/* FATAL: Unable to open areas database */
|
/* FATAL: Unable to open areas database */
|
||||||
printf("%s\n\n", (char *) Language(243));
|
pout(LIGHTRED, BLACK, (char *) Language(243));
|
||||||
sleep(2);
|
Enter(2);
|
||||||
} else
|
sleep(2);
|
||||||
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
} else
|
||||||
|
fread(&areahdr, sizeof(areahdr), 1, pAreas);
|
||||||
|
|
||||||
free(FileArea);
|
free(FileArea);
|
||||||
return pAreas;
|
return pAreas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -189,17 +179,19 @@ FILE *OpenFareas(int Write)
|
|||||||
*/
|
*/
|
||||||
void Header()
|
void Header()
|
||||||
{
|
{
|
||||||
colour(4, 7);
|
char temp[81];
|
||||||
printf(" Area ");
|
|
||||||
|
|
||||||
colour(4, 7);
|
pout(RED, LIGHTGRAY, (char *)" Area ");
|
||||||
printf("%-5d ", iAreaNumber);
|
|
||||||
|
|
||||||
colour(1,7);
|
sprintf(temp, "%-5d ", iAreaNumber);
|
||||||
printf("%-65s\n", sAreaDesc);
|
pout(RED, LIGHTGRAY, temp);
|
||||||
|
|
||||||
colour(15,0);
|
sprintf(temp, "%-65s", sAreaDesc);
|
||||||
fLine(79);
|
pout(BLUE, LIGHTGRAY, temp);
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
|
colour(15,0);
|
||||||
|
fLine(79);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -209,20 +201,21 @@ void Header()
|
|||||||
*/
|
*/
|
||||||
void Sheader()
|
void Sheader()
|
||||||
{
|
{
|
||||||
colour(Hcolor, 0);
|
char temp[81];
|
||||||
printf("\r %-4ld", arecno);
|
|
||||||
|
|
||||||
colour(9, 0);
|
PUTCHAR('\r');
|
||||||
printf(" ... ");
|
sprintf(temp, " %-4ld", arecno);
|
||||||
|
pout(Hcolor, BLACK, temp);
|
||||||
|
|
||||||
colour(Hcolor, 0);
|
pout(LIGHTBLUE, BLACK, (char *)" ... ");
|
||||||
printf("%-44s", area.Name);
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
if (Hcolor < 15)
|
sprintf(temp, "%-44s", area.Name);
|
||||||
Hcolor++;
|
pout(Hcolor, BLACK, temp);
|
||||||
else
|
|
||||||
Hcolor = 9;
|
if (Hcolor < WHITE)
|
||||||
|
Hcolor++;
|
||||||
|
else
|
||||||
|
Hcolor = LIGHTBLUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -232,16 +225,15 @@ void Sheader()
|
|||||||
*/
|
*/
|
||||||
void Blanker(int count)
|
void Blanker(int count)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
printf("\b");
|
PUTCHAR('\b');
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
printf(" ");
|
PUTCHAR(' ');
|
||||||
|
|
||||||
printf("\r");
|
PUTCHAR('\r');
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -252,80 +244,77 @@ void Blanker(int count)
|
|||||||
*/
|
*/
|
||||||
void Mark()
|
void Mark()
|
||||||
{
|
{
|
||||||
char *temp;
|
char *temp;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i, Found;
|
int i, Found, Count, Size;
|
||||||
int Count, Size;
|
|
||||||
|
|
||||||
temp = calloc(81, sizeof(char));
|
temp = calloc(81, sizeof(char));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* First count the already tagged files.
|
* First count the already tagged files.
|
||||||
*/
|
*/
|
||||||
Count = Size = 0;
|
Count = Size = 0;
|
||||||
if ((fp = fopen("taglist", "r")) != NULL) {
|
if ((fp = fopen("taglist", "r")) != NULL) {
|
||||||
while (fread(&Tag, sizeof(Tag), 1, fp) == 1) {
|
while (fread(&Tag, sizeof(Tag), 1, fp) == 1) {
|
||||||
if (Tag.Active) {
|
if (Tag.Active) {
|
||||||
Count++;
|
Count++;
|
||||||
Size += (Tag.Size / 1024);
|
Size += (Tag.Size / 1024);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
fclose(fp);
|
|
||||||
}
|
}
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
/* Marked: */
|
||||||
/* Marked: */
|
sprintf(temp, "%s%d, %dK; ", (char *) Language(360), Count, Size);
|
||||||
printf("%s%d, %dK; ", (char *) Language(360), Count, Size);
|
pout(CFG.HiliteF, CFG.HiliteB, temp);
|
||||||
|
|
||||||
/* Mark file number of press <Enter> to stop */
|
/* Mark file number of press <Enter> to stop */
|
||||||
printf("%s", (char *) Language(7));
|
PUTSTR((char *) Language(7));
|
||||||
|
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrD(temp, 10);
|
GetstrD(temp, 10);
|
||||||
Blanker(strlen(Language(7)) + strlen(temp));
|
Blanker(strlen(Language(7)) + strlen(temp));
|
||||||
|
|
||||||
if (strlen(temp) == 0) {
|
|
||||||
free(temp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
i = atoi(temp);
|
|
||||||
|
|
||||||
if ((i > 0) && (i < 100)) {
|
|
||||||
if ((Tagbuf[i].Area) && (strlen(Tagbuf[i].LFile))) {
|
|
||||||
if (Access(exitinfo.Security, area.DLSec)) {
|
|
||||||
if ((fp = fopen("taglist", "a+")) != NULL) {
|
|
||||||
|
|
||||||
fseek(fp, 0, SEEK_SET);
|
|
||||||
Found = FALSE;
|
|
||||||
while (fread(&Tag, sizeof(Tag), 1, fp) == 1)
|
|
||||||
if ((Tag.Area == Tagbuf[i].Area) && (strcmp(Tag.LFile, Tagbuf[i].LFile) == 0)) {
|
|
||||||
Found = TRUE;
|
|
||||||
Syslog('b', "Tagbuf[i].File already tagged");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Found) {
|
|
||||||
memset(&Tag, 0, sizeof(Tag));
|
|
||||||
Tag = Tagbuf[i];
|
|
||||||
Tag.Active = TRUE;
|
|
||||||
fwrite(&Tag, sizeof(Tag), 1, fp);
|
|
||||||
Syslog('+', "Tagged file %s from area %d", Tag.LFile, Tag.Area);
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(fp);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
colour(12, 0);
|
|
||||||
/* You do not have enough access to download from this area. */
|
|
||||||
printf("%s", (char *) Language(244));
|
|
||||||
fflush(stdout);
|
|
||||||
sleep(3);
|
|
||||||
Blanker(strlen(Language(244)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (strlen(temp) == 0) {
|
||||||
free(temp);
|
free(temp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = atoi(temp);
|
||||||
|
|
||||||
|
if ((i > 0) && (i < 100)) {
|
||||||
|
if ((Tagbuf[i].Area) && (strlen(Tagbuf[i].LFile))) {
|
||||||
|
if (Access(exitinfo.Security, area.DLSec)) {
|
||||||
|
if ((fp = fopen("taglist", "a+")) != NULL) {
|
||||||
|
|
||||||
|
fseek(fp, 0, SEEK_SET);
|
||||||
|
Found = FALSE;
|
||||||
|
while (fread(&Tag, sizeof(Tag), 1, fp) == 1)
|
||||||
|
if ((Tag.Area == Tagbuf[i].Area) && (strcmp(Tag.LFile, Tagbuf[i].LFile) == 0)) {
|
||||||
|
Found = TRUE;
|
||||||
|
Syslog('b', "Tagbuf[i].File already tagged");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Found) {
|
||||||
|
memset(&Tag, 0, sizeof(Tag));
|
||||||
|
Tag = Tagbuf[i];
|
||||||
|
Tag.Active = TRUE;
|
||||||
|
fwrite(&Tag, sizeof(Tag), 1, fp);
|
||||||
|
Syslog('+', "Tagged file %s from area %d", Tag.LFile, Tag.Area);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* You do not have enough access to download from this area. */
|
||||||
|
pout(LIGHTRED, BLACK, (char *) Language(244));
|
||||||
|
sleep(3);
|
||||||
|
Blanker(strlen(Language(244)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -335,43 +324,42 @@ void Mark()
|
|||||||
*/
|
*/
|
||||||
int iLC(int Lines)
|
int iLC(int Lines)
|
||||||
{
|
{
|
||||||
int x, z;
|
int x, z;
|
||||||
|
|
||||||
x = strlen(Language(131));
|
x = strlen(Language(131));
|
||||||
iLineCount += Lines;
|
iLineCount += Lines;
|
||||||
|
|
||||||
if ((iLineCount >= exitinfo.iScreenLen) && (iLineCount < 1000)) {
|
if ((iLineCount >= exitinfo.iScreenLen) && (iLineCount < 1000)) {
|
||||||
iLineCount = 0;
|
iLineCount = 0;
|
||||||
|
|
||||||
while(TRUE) {
|
while (TRUE) {
|
||||||
/* More (Y/n/=) M=Mark */
|
/* More (Y/n/=) M=Mark */
|
||||||
pout(CFG.MoreF, CFG.MoreB, (char *) Language(131));
|
pout(CFG.MoreF, CFG.MoreB, (char *) Language(131));
|
||||||
|
|
||||||
fflush(stdout);
|
alarm_on();
|
||||||
alarm_on();
|
z = toupper(Readkey());
|
||||||
z = toupper(Getone());
|
Blanker(x);
|
||||||
Blanker(x);
|
|
||||||
|
|
||||||
if (z == Keystroke(131, 1)) {
|
if (z == Keystroke(131, 1)) {
|
||||||
printf("\n");
|
Enter(1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (z == Keystroke(131, 2)) {
|
if (z == Keystroke(131, 2)) {
|
||||||
iLineCount = 1000;
|
iLineCount = 9000;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((z == Keystroke(131, 0)) || (z == '\r') || (z == '\n')) {
|
if ((z == Keystroke(131, 0)) || (z == '\r') || (z == '\n')) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (z == Keystroke(131, 3)) {
|
if (z == Keystroke(131, 3)) {
|
||||||
Mark();
|
Mark();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -381,30 +369,32 @@ int iLC(int Lines)
|
|||||||
*/
|
*/
|
||||||
int ShowOneFile()
|
int ShowOneFile()
|
||||||
{
|
{
|
||||||
int y, z, fg, bg;
|
int y, z, fg, bg;
|
||||||
|
char temp[81];
|
||||||
|
|
||||||
if (!fdb.Deleted) {
|
if (!fdb.Deleted) {
|
||||||
|
|
||||||
colour(7, 0);
|
sprintf(temp, " %02d ", Tagnr);
|
||||||
printf(" %02d ", Tagnr);
|
pout(LIGHTGRAY, BLACK, temp);
|
||||||
|
|
||||||
colour(CFG.FilenameF, CFG.FilenameB);
|
sprintf(temp, "%-12s", fdb.Name);
|
||||||
printf("%-12s", fdb.Name);
|
pout(CFG.FilenameF, CFG.FilenameB, temp);
|
||||||
|
|
||||||
colour(CFG.FilesizeF, CFG.FilesizeB);
|
sprintf(temp, "%10lu ", (long)(fdb.Size));
|
||||||
printf("%10lu ", (long)(fdb.Size));
|
pout(CFG.FilesizeF, CFG.FilesizeB, temp);
|
||||||
|
|
||||||
colour(CFG.FiledateF, CFG.FiledateB);
|
sprintf(temp, "%-10s ", StrDateDMY(fdb.UploadDate));
|
||||||
printf("%-10s ", StrDateDMY(fdb.UploadDate));
|
pout(CFG.FiledateF, CFG.FiledateB, temp);
|
||||||
|
|
||||||
colour(12, 0);
|
sprintf(temp, "[%4ld] ", fdb.TimesDL);
|
||||||
printf("[%4ld] ", fdb.TimesDL);
|
pout(LIGHTRED, BLACK, temp);
|
||||||
|
|
||||||
if ((strcmp(fdb.Uploader, "")) == 0)
|
if ((strcmp(fdb.Uploader, "")) == 0)
|
||||||
strcpy(fdb.Uploader, "SysOp");
|
strcpy(fdb.Uploader, "SysOp");
|
||||||
|
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
sprintf(temp, "%s%s", (char *) Language(238), fdb.Uploader);
|
||||||
printf("%s%s\n", (char *) Language(238), fdb.Uploader);
|
pout(CFG.HiliteF, CFG.HiliteB, temp);
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
if (iLC(1) == 1)
|
if (iLC(1) == 1)
|
||||||
return 1;
|
return 1;
|
||||||
@ -420,12 +410,13 @@ int ShowOneFile()
|
|||||||
else
|
else
|
||||||
fg = (int)fdb.Desc[z][3] - 48;
|
fg = (int)fdb.Desc[z][3] - 48;
|
||||||
bg = (int)fdb.Desc[z][2] - 48;
|
bg = (int)fdb.Desc[z][2] - 48;
|
||||||
colour(fg, bg);
|
sprintf(temp, " %s",fdb.Desc[z]+4);
|
||||||
printf(" %s\n",fdb.Desc[z]+4);
|
pout(fg, bg, temp);
|
||||||
} else {
|
} else {
|
||||||
colour(CFG.FiledescF, CFG.FiledescB);
|
sprintf(temp, " %s",fdb.Desc[z]);
|
||||||
printf(" %s\n",fdb.Desc[z]);
|
pout(CFG.FiledescF, CFG.FiledescB, temp);
|
||||||
}
|
}
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
if (iLC(1) == 1)
|
if (iLC(1) == 1)
|
||||||
return 1;
|
return 1;
|
||||||
@ -439,6 +430,8 @@ int ShowOneFile()
|
|||||||
|
|
||||||
int CheckBytesAvailable(long CostSize)
|
int CheckBytesAvailable(long CostSize)
|
||||||
{
|
{
|
||||||
|
char temp[81];
|
||||||
|
|
||||||
if (LIMIT.DownK) {
|
if (LIMIT.DownK) {
|
||||||
if ((exitinfo.DownloadKToday <= 0) || ((CostSize / 1024) > exitinfo.DownloadKToday)) {
|
if ((exitinfo.DownloadKToday <= 0) || ((CostSize / 1024) > exitinfo.DownloadKToday)) {
|
||||||
|
|
||||||
@ -447,14 +440,14 @@ int CheckBytesAvailable(long CostSize)
|
|||||||
Enter(1);
|
Enter(1);
|
||||||
Syslog('+', "Not enough bytes to download %ld", CostSize);
|
Syslog('+', "Not enough bytes to download %ld", CostSize);
|
||||||
|
|
||||||
colour(WHITE, BLACK);
|
|
||||||
/* You must upload before you can download. */
|
/* You must upload before you can download. */
|
||||||
pout(LIGHTRED, BLACK, (char *) Language(253));
|
pout(LIGHTRED, BLACK, (char *) Language(253));
|
||||||
Enter(2);
|
Enter(2);
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
|
||||||
/* Kilobytes currently available: */
|
/* Kilobytes currently available: */
|
||||||
printf("%s%lu Kbytes.\n\n", (char *) Language(254), exitinfo.DownloadKToday);
|
sprintf(temp, "%s%lu Kbytes.", (char *) Language(254), exitinfo.DownloadKToday);
|
||||||
|
pout(YELLOW, BLACK, temp);
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
Pause();
|
Pause();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -488,7 +481,7 @@ int ScanDirect(char *fn)
|
|||||||
{
|
{
|
||||||
FILE *fp, *lp;
|
FILE *fp, *lp;
|
||||||
int err, Found = FALSE;
|
int err, Found = FALSE;
|
||||||
char *temp, *temp1, *stdlog, *errlog, buf[256];
|
char *temp, *temp1, *stdlog, *errlog, buf[256], msg[81];
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
temp1 = calloc(PATH_MAX, sizeof(char));
|
temp1 = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -506,10 +499,9 @@ int ScanDirect(char *fn)
|
|||||||
while (fread(&virscan, virscanhdr.recsize, 1, fp) == 1) {
|
while (fread(&virscan, virscanhdr.recsize, 1, fp) == 1) {
|
||||||
|
|
||||||
if (virscan.available) {
|
if (virscan.available) {
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
|
||||||
/* Scanning */ /* with */
|
/* Scanning */ /* with */
|
||||||
printf("%s %s %s %s ", (char *) Language(132), fn, (char *) Language(133), virscan.comment);
|
sprintf(msg, "%s %s %s %s ", (char *) Language(132), fn, (char *) Language(133), virscan.comment);
|
||||||
fflush(stdout);
|
pout(CFG.TextColourF, CFG.TextColourB, msg);
|
||||||
|
|
||||||
Altime(3600);
|
Altime(3600);
|
||||||
err = execute_str(virscan.scanner, virscan.options, temp, (char *)"/dev/null", stdlog, errlog);
|
err = execute_str(virscan.scanner, virscan.options, temp, (char *)"/dev/null", stdlog, errlog);
|
||||||
@ -535,17 +527,18 @@ int ScanDirect(char *fn)
|
|||||||
unlink(errlog);
|
unlink(errlog);
|
||||||
if (err != virscan.error) {
|
if (err != virscan.error) {
|
||||||
WriteError("VIRUS ALERT: Result %d (%s)", err, virscan.comment);
|
WriteError("VIRUS ALERT: Result %d (%s)", err, virscan.comment);
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
|
||||||
/* Possible VIRUS found! */
|
/* Possible VIRUS found! */
|
||||||
printf("%s\n", (char *) Language(199));
|
sprintf(msg, "%s", (char *) Language(199));
|
||||||
|
pout(CFG.HiliteF, CFG.HiliteB, msg);
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* Ok */
|
/* Ok */
|
||||||
printf("%s\n", (char *) Language(200));
|
sprintf(msg, "%s", (char *) Language(200));
|
||||||
|
PUTSTR(msg);
|
||||||
}
|
}
|
||||||
|
Enter(1);
|
||||||
Altime(0);
|
Altime(0);
|
||||||
Nopper();
|
Nopper();
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
@ -572,7 +565,7 @@ int ScanArchive(char *fn, char *ftype)
|
|||||||
{
|
{
|
||||||
FILE *fp, *lp;
|
FILE *fp, *lp;
|
||||||
int err = 0, Found = FALSE;
|
int err = 0, Found = FALSE;
|
||||||
char *temp, *stdlog, *errlog, buf[256];
|
char *temp, *stdlog, *errlog, buf[256], msg[81];
|
||||||
char *cwd = NULL;
|
char *cwd = NULL;
|
||||||
|
|
||||||
|
|
||||||
@ -613,10 +606,9 @@ int ScanArchive(char *fn, char *ftype)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
|
||||||
/* Unpacking archive */
|
/* Unpacking archive */
|
||||||
printf("%s %s ", (char *) Language(201), fn);
|
sprintf(msg, "%s %s ", (char *) Language(201), fn);
|
||||||
fflush(stdout);
|
pout(CFG.TextColourF, CFG.TextColourB, msg);
|
||||||
|
|
||||||
if (!strlen(archiver.funarc)) {
|
if (!strlen(archiver.funarc)) {
|
||||||
WriteError("No unarc command available");
|
WriteError("No unarc command available");
|
||||||
@ -627,17 +619,16 @@ int ScanArchive(char *fn, char *ftype)
|
|||||||
execute_pth((char *)"rm", (char *)"-r -f ./*", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
execute_pth((char *)"rm", (char *)"-r -f ./*", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
||||||
chdir(cwd);
|
chdir(cwd);
|
||||||
free(cwd);
|
free(cwd);
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
|
||||||
/* ERROR */
|
/* ERROR */
|
||||||
printf("%s\n", (char *) Language(217));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(217));
|
||||||
fflush(stdout);
|
Enter(1);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ok */
|
/* Ok */
|
||||||
printf("%s\n", (char *) Language(200));
|
PUTSTR((char *) Language(200));
|
||||||
fflush(stdout);
|
Enter(1);
|
||||||
|
|
||||||
sprintf(temp, "%s/etc/virscan.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/virscan.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
@ -646,10 +637,9 @@ int ScanArchive(char *fn, char *ftype)
|
|||||||
while (fread(&virscan, virscanhdr.recsize, 1, fp) == 1) {
|
while (fread(&virscan, virscanhdr.recsize, 1, fp) == 1) {
|
||||||
|
|
||||||
if (virscan.available) {
|
if (virscan.available) {
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
|
||||||
/* Scanning */ /* with */
|
/* Scanning */ /* with */
|
||||||
printf("%s %s %s %s ", (char *) Language(132), fn, (char *) Language(133), virscan.comment);
|
sprintf(msg, "%s %s %s %s ", (char *) Language(132), fn, (char *) Language(133), virscan.comment);
|
||||||
fflush(stdout);
|
pout(CFG.TextColourF, CFG.TextColourB, msg);
|
||||||
|
|
||||||
Altime(3600);
|
Altime(3600);
|
||||||
err = execute_str(virscan.scanner, virscan.options, (char *)"*", (char *)"/dev/null", stdlog, errlog);
|
err = execute_str(virscan.scanner, virscan.options, (char *)"*", (char *)"/dev/null", stdlog, errlog);
|
||||||
@ -675,15 +665,14 @@ int ScanArchive(char *fn, char *ftype)
|
|||||||
unlink(errlog);
|
unlink(errlog);
|
||||||
if (err != virscan.error) {
|
if (err != virscan.error) {
|
||||||
WriteError("VIRUS ALERT: Result %d (%s)", err, virscan.comment);
|
WriteError("VIRUS ALERT: Result %d (%s)", err, virscan.comment);
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
|
||||||
/* Possible VIRUS found! */
|
/* Possible VIRUS found! */
|
||||||
printf("%s\n", (char *) Language(199));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(199));
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* Ok */
|
/* Ok */
|
||||||
printf("%s\n", (char *) Language(200));
|
PUTSTR((char *) Language(200));
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
Enter(1);
|
||||||
Altime(0);
|
Altime(0);
|
||||||
Nopper();
|
Nopper();
|
||||||
}
|
}
|
||||||
@ -792,7 +781,7 @@ char *GetFileType(char *fn)
|
|||||||
*/
|
*/
|
||||||
int ImportFile(char *fn, int Area, int fileid, time_t iTime, off_t Size)
|
int ImportFile(char *fn, int Area, int fileid, time_t iTime, off_t Size)
|
||||||
{
|
{
|
||||||
char *temp, *temp1;
|
char *temp, *temp1, msg[81];
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
temp1 = calloc(PATH_MAX, sizeof(char));
|
temp1 = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -817,7 +806,9 @@ int ImportFile(char *fn, int Area, int fileid, time_t iTime, off_t Size)
|
|||||||
exitinfo.UploadKToday += (Size / 1024);
|
exitinfo.UploadKToday += (Size / 1024);
|
||||||
Syslog('b', "Uploads %d, Kb %d, Kb today %d", exitinfo.Uploads, exitinfo.UploadK, exitinfo.UploadKToday);
|
Syslog('b', "Uploads %d, Kb %d, Kb today %d", exitinfo.Uploads, exitinfo.UploadK, exitinfo.UploadKToday);
|
||||||
/* You have */ /* extra download KBytes. */
|
/* You have */ /* extra download KBytes. */
|
||||||
printf("%s %ld %s\n", (char *) Language(249), (long)(Size / 1024), (char *) Language(250));
|
sprintf(msg, "%s %ld %s", (char *) Language(249), (long)(Size / 1024), (char *) Language(250));
|
||||||
|
PUTSTR(msg);
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
exitinfo.DownloadKToday += (Size / 1024);
|
exitinfo.DownloadKToday += (Size / 1024);
|
||||||
Syslog('b', "DownloadKToday %d", exitinfo.DownloadKToday);
|
Syslog('b', "DownloadKToday %d", exitinfo.DownloadKToday);
|
||||||
@ -825,7 +816,9 @@ int ImportFile(char *fn, int Area, int fileid, time_t iTime, off_t Size)
|
|||||||
|
|
||||||
iTime /= 60; /* Divide Seconds by 60 to give minutes */
|
iTime /= 60; /* Divide Seconds by 60 to give minutes */
|
||||||
/* You have */ /* extra minutes. */
|
/* You have */ /* extra minutes. */
|
||||||
printf("%s %ld %s\n", (char *) Language(249), iTime, (char *) Language(259));
|
sprintf(msg, "%s %ld %s", (char *) Language(249), iTime, (char *) Language(259));
|
||||||
|
PUTSTR(msg);
|
||||||
|
Enter(1);
|
||||||
exitinfo.iTimeLeft += iTime;
|
exitinfo.iTimeLeft += iTime;
|
||||||
|
|
||||||
WriteExitinfo();
|
WriteExitinfo();
|
||||||
@ -852,7 +845,7 @@ int Addfile(char *File, int AreaNum, int fileid)
|
|||||||
{
|
{
|
||||||
FILE *id, *pPrivate;
|
FILE *id, *pPrivate;
|
||||||
int err = 1, iDesc = 1, iPrivate = FALSE, GotId = FALSE, lines, i, j;
|
int err = 1, iDesc = 1, iPrivate = FALSE, GotId = FALSE, lines, i, j;
|
||||||
char *Filename, *temp1, *idname = NULL, *Desc[26], *lname, temp[81];
|
char *Filename, *temp1, *idname = NULL, *Desc[26], *lname, temp[81], msg[81];
|
||||||
struct stat statfile;
|
struct stat statfile;
|
||||||
struct _fdbarea *fdb_area = NULL;
|
struct _fdbarea *fdb_area = NULL;
|
||||||
|
|
||||||
@ -870,9 +863,12 @@ int Addfile(char *File, int AreaNum, int fileid)
|
|||||||
*/
|
*/
|
||||||
if (stat(Filename, &statfile) != 0) {
|
if (stat(Filename, &statfile) != 0) {
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
colour(10, 0);
|
colour(10, 0);
|
||||||
/* Upload was unsuccessful for: */
|
/* Upload was unsuccessful for: */
|
||||||
printf("\n%s%s\n\n", (char *) Language(284), File);
|
sprintf(msg, "%s%s", (char *) Language(284), File);
|
||||||
|
pout(LIGHTGREEN, BLACK, msg);
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
mbsedb_CloseFDB(fdb_area);
|
mbsedb_CloseFDB(fdb_area);
|
||||||
free(Filename);
|
free(Filename);
|
||||||
@ -899,20 +895,17 @@ int Addfile(char *File, int AreaNum, int fileid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (area.PwdUP) {
|
if (area.PwdUP) {
|
||||||
colour(9,0);
|
Enter(1);
|
||||||
/* Do you want to password protect your upload ? [y/N]: */
|
/* Do you want to password protect your upload ? [y/N]: */
|
||||||
printf("\n%s", (char *) Language(285));
|
pout(LIGHTBLUE, BLACK, (char *) Language(285));
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
if (toupper(Getone()) == Keystroke(285, 0)) {
|
if (toupper(Readkey()) == Keystroke(285, 0)) {
|
||||||
colour(10, 0);
|
Enter(1);
|
||||||
/* REMEMBER: Passwords are "CaSe SeNsITiVe!" */
|
/* REMEMBER: Passwords are "CaSe SeNsITiVe!" */
|
||||||
printf("\n%s\n", (char *) Language(286));
|
pout(LIGHTGREEN, BLACK, (char *) Language(286));
|
||||||
colour(14,0);
|
Enter(1);
|
||||||
/* Password: */
|
/* Password: */
|
||||||
printf("%s", (char *) Language(8));
|
pout(YELLOW, BLACK, (char *) Language(8));
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
GetstrC(fdb.Password, 20);
|
GetstrC(fdb.Password, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -994,10 +987,10 @@ int Addfile(char *File, int AreaNum, int fileid)
|
|||||||
}
|
}
|
||||||
if (lines) {
|
if (lines) {
|
||||||
Syslog('+', "Using %d FILE_ID.DIZ lines for description", lines);
|
Syslog('+', "Using %d FILE_ID.DIZ lines for description", lines);
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
|
||||||
/* Found FILE_ID.DIZ in */
|
/* Found FILE_ID.DIZ in */
|
||||||
printf("%s %s\n", (char *) Language(257), File);
|
sprintf(msg, "%s %s", (char *) Language(257), File);
|
||||||
fflush(stdout);
|
pout(CFG.TextColourF, CFG.TextColourB, msg);
|
||||||
|
Enter(1);
|
||||||
} else {
|
} else {
|
||||||
Syslog('!', "No FILE_ID.DIZ lines left to use");
|
Syslog('!', "No FILE_ID.DIZ lines left to use");
|
||||||
GotId = FALSE;
|
GotId = FALSE;
|
||||||
@ -1012,15 +1005,16 @@ int Addfile(char *File, int AreaNum, int fileid)
|
|||||||
for (i = 0; i < 26; i++)
|
for (i = 0; i < 26; i++)
|
||||||
*(Desc + i) = (char *) calloc(49, sizeof(char));
|
*(Desc + i) = (char *) calloc(49, sizeof(char));
|
||||||
|
|
||||||
colour(12,0);
|
Enter(1);
|
||||||
/* Please enter description of file */
|
/* Please enter description of file */
|
||||||
printf("\n%s %s\n\n", (char *) Language(287), File);
|
sprintf(msg, "%s %s", (char *) Language(287), File);
|
||||||
while (TRUE) {
|
pout(LIGHTRED, BLACK, msg);
|
||||||
colour(10,0);
|
Enter(2);
|
||||||
printf("%2d> ", iDesc);
|
|
||||||
fflush(stdout);
|
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
|
sprintf(msg, "%2d> ", iDesc);
|
||||||
|
pout(LIGHTGREEN, BLACK, msg);
|
||||||
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(*(Desc + iDesc), 47);
|
GetstrC(*(Desc + iDesc), 47);
|
||||||
|
|
||||||
if ((strcmp(*(Desc + iDesc), "")) == 0)
|
if ((strcmp(*(Desc + iDesc), "")) == 0)
|
||||||
@ -1061,7 +1055,7 @@ int Addfile(char *File, int AreaNum, int fileid)
|
|||||||
|
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Your upload time has been returned to you. Thank you for your upload! */
|
/* Your upload time has been returned to you. Thank you for your upload! */
|
||||||
pout(10, 0, (char *) Language(288));
|
pout(LIGHTGREEN, BLACK, (char *) Language(288));
|
||||||
Enter(1);
|
Enter(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
108
mbsebbs/fsedit.c
108
mbsebbs/fsedit.c
@ -39,46 +39,54 @@
|
|||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "fsedit.h"
|
#include "fsedit.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
void Show_Ins(void)
|
void Show_Ins(void)
|
||||||
{
|
{
|
||||||
locate(1, 70);
|
locate(1, 70);
|
||||||
colour(YELLOW, BLUE);
|
colour(YELLOW, BLUE);
|
||||||
printf("%s", InsMode ? "INS": "OVR");
|
if (InsMode)
|
||||||
fflush(stdout);
|
PUTSTR((char *)"INS");
|
||||||
|
else
|
||||||
|
PUTSTR((char *)"OVR");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Top_Help()
|
void Top_Help()
|
||||||
{
|
{
|
||||||
|
char temp[81];
|
||||||
|
|
||||||
locate(1,1);
|
locate(1,1);
|
||||||
colour(YELLOW, BLUE);
|
colour(YELLOW, BLUE);
|
||||||
printf("%s", padleft((char *)"Press ESC for menu, other keys is edit text", 80, ' '));
|
sprintf(temp, "%s", padleft((char *)"Press ESC for menu, other keys is edit text", 79, ' '));
|
||||||
|
PUTSTR(temp);
|
||||||
Show_Ins();
|
Show_Ins();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Top_Menu(void)
|
void Top_Menu(void)
|
||||||
{
|
{
|
||||||
|
char temp[81];
|
||||||
|
|
||||||
locate(1,1);
|
locate(1,1);
|
||||||
colour(WHITE, RED);
|
colour(WHITE, RED);
|
||||||
printf("%s", padleft((char *)"(A)bort (H)elp (S)ave - Any other key is continue edit", 80, ' '));
|
sprintf(temp, "%s", padleft((char *)"(A)bort (H)elp (S)ave - Any other key is continue edit", 79, ' '));
|
||||||
fflush(stdout);
|
PUTSTR(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Ls(int a, int y)
|
void Ls(int a, int y)
|
||||||
{
|
{
|
||||||
locate(y, 10);
|
locate(y, 10);
|
||||||
printf("%c ", a ? 179 : '|');
|
PUTCHAR(a ? 179 : '|');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Rs(int a)
|
void Rs(int a)
|
||||||
{
|
{
|
||||||
colour(LIGHTGREEN, BLUE);
|
colour(LIGHTGREEN, BLUE);
|
||||||
printf("%c", a ? 179 : '|');
|
PUTCHAR(a ? 179 : '|');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,8 +95,8 @@ void Ws(int a, int y)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
Ls(a, y);
|
Ls(a, y);
|
||||||
for (i = 0; i < 57; i++)
|
for (i = 0; i < 58; i++)
|
||||||
printf(" ");
|
PUTCHAR(' ');
|
||||||
Rs(a);
|
Rs(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +105,7 @@ void Hl(int a, int y, char *txt)
|
|||||||
{
|
{
|
||||||
Ls(a, y);
|
Ls(a, y);
|
||||||
colour(WHITE, BLUE);
|
colour(WHITE, BLUE);
|
||||||
printf("%s", padleft(txt, 57, ' '));
|
PUTSTR(padleft(txt, 58, ' '));
|
||||||
Rs(a);
|
Rs(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,16 +120,16 @@ void Full_Help(void)
|
|||||||
|
|
||||||
/* Top row */
|
/* Top row */
|
||||||
locate(1, 10);
|
locate(1, 10);
|
||||||
printf("%c", a ? 213 : '+');
|
PUTCHAR(a ? 213 : '+');
|
||||||
for (i = 0; i < 58; i++)
|
for (i = 0; i < 58; i++)
|
||||||
printf("%c", a ? 205 : '=');
|
PUTCHAR(a ? 205 : '=');
|
||||||
printf("%c", a ? 184 : '+');
|
PUTCHAR(a ? 184 : '+');
|
||||||
|
|
||||||
Ws(a, 2);
|
Ws(a, 2);
|
||||||
|
|
||||||
Ls(a, 3);
|
Ls(a, 3);
|
||||||
colour(YELLOW, BLUE);
|
colour(YELLOW, BLUE);
|
||||||
printf("%s", padleft((char *)" Editor Help", 57, ' '));
|
PUTSTR(padleft((char *)" Editor Help", 58, ' '));
|
||||||
Rs(a);
|
Rs(a);
|
||||||
|
|
||||||
Ws(a, 4);
|
Ws(a, 4);
|
||||||
@ -138,26 +146,24 @@ void Full_Help(void)
|
|||||||
Ws(a, 15);
|
Ws(a, 15);
|
||||||
|
|
||||||
locate(16,10);
|
locate(16,10);
|
||||||
printf("%c", a ? 212 : '+');
|
PUTCHAR(a ? 212 : '+');
|
||||||
for (i = 0; i < 58; i++)
|
for (i = 0; i < 58; i++)
|
||||||
printf("%c", a ? 205 : '=');
|
PUTCHAR(a ? 205 : '=');
|
||||||
printf("%c", a ? 190 : '+');
|
PUTCHAR(a ? 190 : '+');
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Setcursor(void)
|
void Setcursor(void)
|
||||||
{
|
{
|
||||||
CurRow = Row + TopVisible - 1;
|
CurRow = Row + TopVisible - 1;
|
||||||
locate(Row + 1, Col);
|
locate(Row + 1, Col);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Beep(void)
|
void Beep(void)
|
||||||
{
|
{
|
||||||
printf("\007");
|
PUTCHAR('\007');
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +183,7 @@ void Refresh(void)
|
|||||||
if ((i >= TopVisible) && (i < (TopVisible + exitinfo.iScreenLen -1))) {
|
if ((i >= TopVisible) && (i < (TopVisible + exitinfo.iScreenLen -1))) {
|
||||||
locate(j, 1);
|
locate(j, 1);
|
||||||
j++;
|
j++;
|
||||||
printf("%s", Message[i]);
|
PUTSTR(Message[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Setcursor();
|
Setcursor();
|
||||||
@ -195,12 +201,11 @@ void GetstrLC(char *sStr, int iMaxlen)
|
|||||||
|
|
||||||
while (ch != 13) {
|
while (ch != 13) {
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
ch = Readkey();
|
ch = Readkey();
|
||||||
|
|
||||||
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
||||||
if (iPos > 0) {
|
if (iPos > 0) {
|
||||||
printf("\b \b");
|
BackErase();
|
||||||
sStr[--iPos] = '\0';
|
sStr[--iPos] = '\0';
|
||||||
} else {
|
} else {
|
||||||
Beep();
|
Beep();
|
||||||
@ -211,14 +216,14 @@ void GetstrLC(char *sStr, int iMaxlen)
|
|||||||
if (iPos <= iMaxlen) {
|
if (iPos <= iMaxlen) {
|
||||||
iPos++;
|
iPos++;
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
printf("%c", ch);
|
PUTCHAR(ch);
|
||||||
} else {
|
} else {
|
||||||
Beep();
|
Beep();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
Enter(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -403,12 +408,6 @@ int Fs_Edit()
|
|||||||
|
|
||||||
Syslog('b', "FSEDIT: Entering FullScreen editor");
|
Syslog('b', "FSEDIT: Entering FullScreen editor");
|
||||||
clear();
|
clear();
|
||||||
fflush(stdout);
|
|
||||||
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
|
||||||
WriteError("$Can't open tty");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
InsMode = TRUE;
|
InsMode = TRUE;
|
||||||
TopVisible = 1;
|
TopVisible = 1;
|
||||||
Col = 1;
|
Col = 1;
|
||||||
@ -521,9 +520,10 @@ int Fs_Edit()
|
|||||||
Setcursor();
|
Setcursor();
|
||||||
for (i = Col; i <= strlen(Message[CurRow]); i++) {
|
for (i = Col; i <= strlen(Message[CurRow]); i++) {
|
||||||
Message[CurRow][i-1] = Message[CurRow][i];
|
Message[CurRow][i-1] = Message[CurRow][i];
|
||||||
printf("%c", Message[CurRow][i]);
|
PUTCHAR(Message[CurRow][i]);
|
||||||
}
|
}
|
||||||
printf(" \b");
|
PUTCHAR(' ');
|
||||||
|
PUTCHAR('\b');
|
||||||
Message[CurRow][i-1] = '\0';
|
Message[CurRow][i-1] = '\0';
|
||||||
Setcursor();
|
Setcursor();
|
||||||
} else if (((strlen(Message[CurRow]) + strlen(Message[CurRow+1]) < 75)
|
} else if (((strlen(Message[CurRow]) + strlen(Message[CurRow+1]) < 75)
|
||||||
@ -572,8 +572,7 @@ int Fs_Edit()
|
|||||||
} else {
|
} else {
|
||||||
if (Col == strlen(Message[CurRow]) + 1) {
|
if (Col == strlen(Message[CurRow]) + 1) {
|
||||||
/* BS at end of line */
|
/* BS at end of line */
|
||||||
printf("\b \b");
|
BackErase();
|
||||||
fflush(stdout);
|
|
||||||
Col--;
|
Col--;
|
||||||
Message[CurRow][Col-1] = '\0';
|
Message[CurRow][Col-1] = '\0';
|
||||||
Changed = TRUE;
|
Changed = TRUE;
|
||||||
@ -583,9 +582,10 @@ int Fs_Edit()
|
|||||||
Setcursor();
|
Setcursor();
|
||||||
for (i = Col; i <= strlen(Message[CurRow]); i++) {
|
for (i = Col; i <= strlen(Message[CurRow]); i++) {
|
||||||
Message[CurRow][i-1] = Message[CurRow][i];
|
Message[CurRow][i-1] = Message[CurRow][i];
|
||||||
printf("%c", Message[CurRow][i]);
|
PUTCHAR(Message[CurRow][i]);
|
||||||
}
|
}
|
||||||
printf(" \b");
|
PUTCHAR(' ');
|
||||||
|
PUTCHAR('\b');
|
||||||
Message[CurRow][strlen(Message[CurRow])] = '\0';
|
Message[CurRow][strlen(Message[CurRow])] = '\0';
|
||||||
Setcursor();
|
Setcursor();
|
||||||
Changed = TRUE;
|
Changed = TRUE;
|
||||||
@ -617,16 +617,17 @@ int Fs_Edit()
|
|||||||
tmpname = calloc(PATH_MAX, sizeof(char));
|
tmpname = calloc(PATH_MAX, sizeof(char));
|
||||||
filname = calloc(PATH_MAX, sizeof(char));
|
filname = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
colour(14, 0);
|
Enter(1);
|
||||||
/* Please enter filename: */
|
/* Please enter filename: */
|
||||||
printf("\n%s", (char *) Language(245));
|
pout(YELLOW, BLACK, (char *) Language(245));
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrLC(filname, 80);
|
GetstrLC(filname, 80);
|
||||||
|
|
||||||
if ((strcmp(filname, "") == 0)) {
|
if ((strcmp(filname, "") == 0)) {
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
Enter(2);
|
||||||
/* No filename entered, aborting */
|
/* No filename entered, aborting */
|
||||||
printf("\n\n%s\n", (char *) Language(246));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(246));
|
||||||
|
Enter(1);
|
||||||
Pause();
|
Pause();
|
||||||
free(filname);
|
free(filname);
|
||||||
free(tmpname);
|
free(tmpname);
|
||||||
@ -635,9 +636,10 @@ int Fs_Edit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*(filname) == '/' || *(filname) == ' ') {
|
if (*(filname) == '/' || *(filname) == ' ') {
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
Enter(2);
|
||||||
/* Illegal filename */
|
/* Illegal filename */
|
||||||
printf("\n\n%s\n", (char *) Language(247));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(247));
|
||||||
|
Enter(1);
|
||||||
Pause();
|
Pause();
|
||||||
free(tmpname);
|
free(tmpname);
|
||||||
free(filname);
|
free(filname);
|
||||||
@ -648,9 +650,10 @@ int Fs_Edit()
|
|||||||
sprintf(tmpname, "%s/%s/wrk/%s", CFG.bbs_usersdir, exitinfo.Name, filname);
|
sprintf(tmpname, "%s/%s/wrk/%s", CFG.bbs_usersdir, exitinfo.Name, filname);
|
||||||
if ((fd = fopen(tmpname, "r")) == NULL) {
|
if ((fd = fopen(tmpname, "r")) == NULL) {
|
||||||
WriteError("$Can't open %s", tmpname);
|
WriteError("$Can't open %s", tmpname);
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
Enter(2);
|
||||||
/* File does not exist, please try again */
|
/* File does not exist, please try again */
|
||||||
printf("\n\n%s\n", (char *) Language(296));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(296));
|
||||||
|
Enter(1);
|
||||||
Pause();
|
Pause();
|
||||||
} else {
|
} else {
|
||||||
while ((fgets(filname, 80, fd)) != NULL) {
|
while ((fgets(filname, 80, fd)) != NULL) {
|
||||||
@ -692,10 +695,7 @@ int Fs_Edit()
|
|||||||
ch = toupper(Readkey());
|
ch = toupper(Readkey());
|
||||||
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);
|
||||||
Unsetraw();
|
|
||||||
close(ttyfd);
|
|
||||||
clear();
|
clear();
|
||||||
fflush(stdout);
|
|
||||||
if (ch == 'S' && Changed) {
|
if (ch == 'S' && Changed) {
|
||||||
Syslog('+', "FSEDIT: Message will be saved");
|
Syslog('+', "FSEDIT: Message will be saved");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -732,8 +732,7 @@ int Fs_Edit()
|
|||||||
Refresh();
|
Refresh();
|
||||||
} else {
|
} else {
|
||||||
Col++;
|
Col++;
|
||||||
printf("%c", ch);
|
PUTCHAR(ch);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
Changed = TRUE;
|
Changed = TRUE;
|
||||||
} else {
|
} else {
|
||||||
@ -763,14 +762,13 @@ int Fs_Edit()
|
|||||||
Refresh();
|
Refresh();
|
||||||
} else {
|
} else {
|
||||||
locate(Row + 1, 1);
|
locate(Row + 1, 1);
|
||||||
printf(Message[CurRow]);
|
PUTSTR(Message[CurRow]);
|
||||||
Setcursor();
|
Setcursor();
|
||||||
}
|
}
|
||||||
Changed = TRUE;
|
Changed = TRUE;
|
||||||
} else {
|
} else {
|
||||||
Message[CurRow][Col-1] = ch;
|
Message[CurRow][Col-1] = ch;
|
||||||
printf("%c", ch);
|
PUTCHAR(ch);
|
||||||
fflush(stdout);
|
|
||||||
Col++;
|
Col++;
|
||||||
Changed = TRUE;
|
Changed = TRUE;
|
||||||
}
|
}
|
||||||
@ -780,8 +778,6 @@ int Fs_Edit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
WriteError("FsEdit(): Impossible to be here");
|
WriteError("FsEdit(): Impossible to be here");
|
||||||
Unsetraw();
|
|
||||||
close(ttyfd);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
#include "../lib/msgtext.h"
|
#include "../lib/msgtext.h"
|
||||||
#include "../lib/msg.h"
|
#include "../lib/msg.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern pid_t mypid; /* Original pid */
|
extern pid_t mypid; /* Original pid */
|
||||||
@ -54,20 +56,23 @@ void UserSilent(int flag)
|
|||||||
*/
|
*/
|
||||||
int CheckStatus()
|
int CheckStatus()
|
||||||
{
|
{
|
||||||
static char buf[81];
|
static char buf[81], msg[81];
|
||||||
|
|
||||||
sprintf(buf, "SBBS:0;");
|
sprintf(buf, "SBBS:0;");
|
||||||
if (socket_send(buf) == 0) {
|
if (socket_send(buf) == 0) {
|
||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
if (strncmp(buf, "100:2,0", 7) == 0)
|
if (strncmp(buf, "100:2,0", 7) == 0)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh))
|
if ((strncmp(buf, "100:2,2", 7) == 0) && (!ttyinfo.honor_zmh))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
buf[strlen(buf) -1] = '\0';
|
buf[strlen(buf) -1] = '\0';
|
||||||
printf("\n\n\007*** %s ***\n\n\n", buf+8);
|
Enter(2);
|
||||||
fflush(stdout);
|
PUTCHAR('\007');
|
||||||
}
|
sprintf(msg, "*** %s ***", buf+8);
|
||||||
return FALSE;
|
PUTSTR(msg);
|
||||||
|
Enter(3);
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
579
mbsebbs/input.c
579
mbsebbs/input.c
@ -36,6 +36,243 @@
|
|||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Wait for a character for a maximum of wtime * 10 mSec.
|
||||||
|
*/
|
||||||
|
int Waitchar(unsigned char *ch, int wtime)
|
||||||
|
{
|
||||||
|
int i, rc = TIMEOUT;
|
||||||
|
|
||||||
|
for (i = 0; i < wtime; i++) {
|
||||||
|
rc = GETCHAR(0);
|
||||||
|
// Syslog('t', "Waitchar(): after GETCHAR() tty_status = %d, rc = %d", tty_status, rc);
|
||||||
|
if (tty_status == STAT_SUCCESS) {
|
||||||
|
// Syslog('t', "Waitchar(): return %d", rc);
|
||||||
|
memcpy(ch, &rc, sizeof(unsigned char));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (tty_status != STAT_TIMEOUT) {
|
||||||
|
Syslog('t', "Waitchar(): error rc=%d", rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
msleep(10);
|
||||||
|
}
|
||||||
|
// Syslog('t', "Waitchar() timeout returns %d", rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int Escapechar(unsigned char *ch)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
unsigned char c;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Escape character, if nothing follows within
|
||||||
|
* 50 mSec, the user really pressed <esc>.
|
||||||
|
*/
|
||||||
|
if ((rc = Waitchar(ch, 5)) == TIMEOUT)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
if (*ch == '[') {
|
||||||
|
/*
|
||||||
|
* Start of CSI sequence. If nothing follows,
|
||||||
|
* return immediatly.
|
||||||
|
*/
|
||||||
|
if ((rc = Waitchar(ch, 5)) == TIMEOUT)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Test for the most important keys. Note
|
||||||
|
* that only the cursor movement keys are
|
||||||
|
* guaranteed to work with PC-clients.
|
||||||
|
*/
|
||||||
|
c = *ch;
|
||||||
|
if (c == 'A')
|
||||||
|
c = KEY_UP;
|
||||||
|
if (c == 'B')
|
||||||
|
c = KEY_DOWN;
|
||||||
|
if (c == 'C')
|
||||||
|
c = KEY_RIGHT;
|
||||||
|
if (c == 'D')
|
||||||
|
c = KEY_LEFT;
|
||||||
|
if ((c == '1') || (c == 'H') || (c == 0))
|
||||||
|
c = KEY_HOME;
|
||||||
|
if ((c == '4') || (c == 'K') || (c == 101) || (c == 144))
|
||||||
|
c = KEY_END;
|
||||||
|
if (c == '2')
|
||||||
|
c = KEY_INS;
|
||||||
|
if (c == '3')
|
||||||
|
c = KEY_DEL;
|
||||||
|
if (c == '5')
|
||||||
|
c = KEY_PGUP;
|
||||||
|
if (c == '6')
|
||||||
|
c = KEY_PGDN;
|
||||||
|
memcpy(ch, &c, sizeof(unsigned char));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This next function will detect the grey keys on the keyboard for
|
||||||
|
* VT100, VT220, Xterm, PC-ANSI, and Linux console. Works with
|
||||||
|
* several terminals on serial lines (tested 1200 bps).
|
||||||
|
* If for example cursur keys are detected, this function returns
|
||||||
|
* a translated value.
|
||||||
|
*/
|
||||||
|
unsigned char Readkey(void)
|
||||||
|
{
|
||||||
|
unsigned char ch = 0;
|
||||||
|
int rc = TIMEOUT;
|
||||||
|
|
||||||
|
Syslog('t', "Readkey()");
|
||||||
|
while (rc == TIMEOUT) {
|
||||||
|
rc = Waitchar(&ch, 5);
|
||||||
|
// Syslog('t', "rc = %d, ch = %d", rc, ch);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the character is not an Escape character,
|
||||||
|
* then this function is finished.
|
||||||
|
*/
|
||||||
|
if ((rc == 1) && (ch != KEY_ESCAPE)) {
|
||||||
|
Syslog('t', "Readkey() returns %d", ch);
|
||||||
|
return ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((rc == 1) && (ch == KEY_ESCAPE)) {
|
||||||
|
rc = Escapechar(&ch);
|
||||||
|
if (rc == 1) {
|
||||||
|
Syslog('t', "Readkey() returns %d", ch);
|
||||||
|
return ch;
|
||||||
|
} else {
|
||||||
|
Syslog('t', "Readkey() returns %d", KEY_ESCAPE);
|
||||||
|
return KEY_ESCAPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Syslog('t', "Readkey() returns %d", rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the (locked) speed from the tty
|
||||||
|
*/
|
||||||
|
long Speed(void)
|
||||||
|
{
|
||||||
|
speed_t mspeed;
|
||||||
|
|
||||||
|
mspeed = cfgetospeed(&tbufs);
|
||||||
|
#ifdef CBAUD
|
||||||
|
switch (mspeed & CBAUD) {
|
||||||
|
#else
|
||||||
|
switch (mspeed) {
|
||||||
|
#endif
|
||||||
|
case B0: return 0;
|
||||||
|
#if defined(B50)
|
||||||
|
case B50: return 50;
|
||||||
|
#endif
|
||||||
|
#if defined(B75)
|
||||||
|
case B75: return 75;
|
||||||
|
#endif
|
||||||
|
#if defined(B110)
|
||||||
|
case B110: return 110;
|
||||||
|
#endif
|
||||||
|
#if defined(B134)
|
||||||
|
case B134: return 134;
|
||||||
|
#endif
|
||||||
|
#if defined(B150)
|
||||||
|
case B150: return 150;
|
||||||
|
#endif
|
||||||
|
#if defined(B200)
|
||||||
|
case B200: return 200;
|
||||||
|
#endif
|
||||||
|
#if defined(B300)
|
||||||
|
case B300: return 300;
|
||||||
|
#endif
|
||||||
|
#if defined(B600)
|
||||||
|
case B600: return 600;
|
||||||
|
#endif
|
||||||
|
#if defined(B1200)
|
||||||
|
case B1200: return 1200;
|
||||||
|
#endif
|
||||||
|
#if defined(B1800)
|
||||||
|
case B1800: return 1800;
|
||||||
|
#endif
|
||||||
|
#if defined(B2400)
|
||||||
|
case B2400: return 2400;
|
||||||
|
#endif
|
||||||
|
#if defined(B4800)
|
||||||
|
case B4800: return 4800;
|
||||||
|
#endif
|
||||||
|
#if defined(B9600)
|
||||||
|
case B9600: return 9600;
|
||||||
|
#endif
|
||||||
|
#if defined(B19200)
|
||||||
|
case B19200: return 19200;
|
||||||
|
#endif
|
||||||
|
#if defined(B38400)
|
||||||
|
case B38400: return 38400;
|
||||||
|
#endif
|
||||||
|
#if defined(B57600)
|
||||||
|
case B57600: return 57600;
|
||||||
|
#endif
|
||||||
|
#if defined(B115200)
|
||||||
|
case B115200: return 115200;
|
||||||
|
#endif
|
||||||
|
#if defined(B230400)
|
||||||
|
case B230400: return 203400;
|
||||||
|
#endif
|
||||||
|
#if defined(B460800)
|
||||||
|
case B460800: return 460800;
|
||||||
|
#endif
|
||||||
|
#if defined(B500000)
|
||||||
|
case B500000: return 500000;
|
||||||
|
#endif
|
||||||
|
#if defined(B576000)
|
||||||
|
case B576000: return 576000;
|
||||||
|
#endif
|
||||||
|
#if defined(B921600)
|
||||||
|
case B921600: return 921600;
|
||||||
|
#endif
|
||||||
|
#if defined(B1000000)
|
||||||
|
case B1000000: return 1000000;
|
||||||
|
#endif
|
||||||
|
#if defined(B1152000)
|
||||||
|
case B1152000: return 1152000;
|
||||||
|
#endif
|
||||||
|
#if defined(B1500000)
|
||||||
|
case B1500000: return 1500000;
|
||||||
|
#endif
|
||||||
|
#if defined(B2000000)
|
||||||
|
case B2000000: return 2000000;
|
||||||
|
#endif
|
||||||
|
#if defined(B2500000)
|
||||||
|
case B2500000: return 2500000;
|
||||||
|
#endif
|
||||||
|
#if defined(B3000000)
|
||||||
|
case B3000000: return 3000000;
|
||||||
|
#endif
|
||||||
|
#if defined(B3500000)
|
||||||
|
case B3500000: return 3500000;
|
||||||
|
#endif
|
||||||
|
#if defined(B4000000)
|
||||||
|
case B4000000: return 4000000;
|
||||||
|
#endif
|
||||||
|
default: return 9600;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +293,16 @@ int traduce(char *ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void BackErase(void)
|
||||||
|
{
|
||||||
|
PUTCHAR('\b');
|
||||||
|
PUTCHAR(' ');
|
||||||
|
PUTCHAR('\b');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a character string with cursor position
|
* Get a character string with cursor position
|
||||||
*/
|
*/
|
||||||
@ -64,40 +311,34 @@ void GetstrP(char *sStr, int iMaxLen, int Position)
|
|||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int iPos = Position;
|
int iPos = Position;
|
||||||
|
|
||||||
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
FLUSHIN();
|
||||||
perror("open 1");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
|
|
||||||
while (ch != KEY_ENTER) {
|
while (ch != KEY_ENTER) {
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
ch = Readkey();
|
ch = Readkey();
|
||||||
|
|
||||||
if ((ch == KEY_BACKSPACE) || (ch == KEY_DEL) || (ch == KEY_RUBOUT)) {
|
if ((ch == KEY_BACKSPACE) || (ch == KEY_DEL) || (ch == KEY_RUBOUT)) {
|
||||||
if (iPos > 0) {
|
if (iPos > 0) {
|
||||||
printf("\b \b");
|
BackErase();
|
||||||
sStr[--iPos] = '\0';
|
sStr[--iPos] = '\0';
|
||||||
} else
|
} else
|
||||||
putchar('\007');
|
PUTCHAR('\007');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ch > 31 && ch < 127) || traduce(&ch)) {
|
if ((ch > 31 && ch < 127) || traduce(&ch)) {
|
||||||
if (iPos <= iMaxLen) {
|
if (iPos <= iMaxLen) {
|
||||||
iPos++;
|
iPos++;
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
printf("%c", ch);
|
PUTCHAR(ch);
|
||||||
} else
|
} else {
|
||||||
putchar('\007');
|
PUTCHAR('\007');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
PUTCHAR('\r');
|
||||||
close(ttyfd);
|
PUTCHAR('\n');
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -110,42 +351,34 @@ void GetstrC(char *sStr, int iMaxlen)
|
|||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
|
|
||||||
fflush(stdout);
|
FLUSHIN();
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
|
||||||
perror("open 6");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
|
|
||||||
strcpy(sStr, "");
|
strcpy(sStr, "");
|
||||||
alarm_on();
|
alarm_on();
|
||||||
|
|
||||||
while (ch != 13) {
|
while (ch != 13) {
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
ch = Readkey();
|
ch = Readkey();
|
||||||
|
|
||||||
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
||||||
if (iPos > 0) {
|
if (iPos > 0) {
|
||||||
printf("\b \b");
|
BackErase();
|
||||||
sStr[--iPos] = '\0';
|
sStr[--iPos] = '\0';
|
||||||
} else
|
} else
|
||||||
putchar('\007');
|
PUTCHAR('\007');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ch > 31) && (ch < 127) && (ch != ',')) {
|
if ((ch > 31) && (ch < 127) && (ch != ',')) {
|
||||||
if (iPos <= iMaxlen) {
|
if (iPos <= iMaxlen) {
|
||||||
iPos++;
|
iPos++;
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
printf("%c", ch);
|
PUTCHAR(ch);
|
||||||
} else
|
} else
|
||||||
putchar('\007');
|
PUTCHAR('\007');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
PUTCHAR('\r');
|
||||||
close(ttyfd);
|
PUTCHAR('\n');
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -158,42 +391,34 @@ void GetstrU(char *sStr, int iMaxlen)
|
|||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
|
|
||||||
fflush(stdout);
|
FLUSHIN();
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
|
||||||
perror("open 6");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
|
|
||||||
strcpy(sStr, "");
|
strcpy(sStr, "");
|
||||||
alarm_on();
|
alarm_on();
|
||||||
|
|
||||||
while (ch != 13) {
|
while (ch != 13) {
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
ch = Readkey();
|
ch = Readkey();
|
||||||
|
|
||||||
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
||||||
if (iPos > 0) {
|
if (iPos > 0) {
|
||||||
printf("\b \b");
|
BackErase();
|
||||||
sStr[--iPos] = '\0';
|
sStr[--iPos] = '\0';
|
||||||
} else
|
} else
|
||||||
putchar('\007');
|
PUTCHAR('\007');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isalnum(ch) || (ch == '@') || (ch == '.') || (ch == '-') || (ch == '_')) {
|
if (isalnum(ch) || (ch == '@') || (ch == '.') || (ch == '-') || (ch == '_')) {
|
||||||
if (iPos <= iMaxlen) {
|
if (iPos <= iMaxlen) {
|
||||||
iPos++;
|
iPos++;
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
printf("%c", ch);
|
PUTCHAR(ch);
|
||||||
} else
|
} else
|
||||||
putchar('\007');
|
PUTCHAR('\007');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
PUTCHAR('\r');
|
||||||
close(ttyfd);
|
PUTCHAR('\n');
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -203,46 +428,38 @@ void GetstrU(char *sStr, int iMaxlen)
|
|||||||
*/
|
*/
|
||||||
void GetPhone(char *sStr, int iMaxlen)
|
void GetPhone(char *sStr, int iMaxlen)
|
||||||
{
|
{
|
||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
|
|
||||||
fflush(stdout);
|
FLUSHIN();
|
||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
strcpy(sStr, "");
|
||||||
perror("open 5");
|
alarm_on();
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
|
|
||||||
strcpy(sStr, "");
|
while (ch != 13) {
|
||||||
alarm_on();
|
|
||||||
|
|
||||||
while (ch != 13) {
|
ch = Readkey();
|
||||||
|
|
||||||
fflush(stdout);
|
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
||||||
ch = Readkey();
|
if (iPos > 0) {
|
||||||
|
BackErase();
|
||||||
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
sStr[--iPos]='\0';
|
||||||
if (iPos > 0) {
|
} else
|
||||||
printf("\b \b");
|
PUTCHAR('\007');
|
||||||
sStr[--iPos]='\0';
|
|
||||||
} else
|
|
||||||
putchar('\007');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == '+')) {
|
|
||||||
if (iPos <= iMaxlen) {
|
|
||||||
iPos++;
|
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
|
||||||
printf("%c", ch);
|
|
||||||
} else
|
|
||||||
putchar('\007');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == '+')) {
|
||||||
close(ttyfd);
|
if (iPos <= iMaxlen) {
|
||||||
printf("\n");
|
iPos++;
|
||||||
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
|
PUTCHAR(ch);
|
||||||
|
} else
|
||||||
|
PUTCHAR('\007');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PUTCHAR('\r');
|
||||||
|
PUTCHAR('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -252,48 +469,39 @@ void GetPhone(char *sStr, int iMaxlen)
|
|||||||
*/
|
*/
|
||||||
void Getnum(char *sStr, int iMaxlen)
|
void Getnum(char *sStr, int iMaxlen)
|
||||||
{
|
{
|
||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
|
|
||||||
fflush(stdout);
|
FLUSHIN();
|
||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
strcpy(sStr, "");
|
||||||
perror("open 5");
|
alarm_on();
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
|
|
||||||
strcpy(sStr, "");
|
while (ch != 13) {
|
||||||
alarm_on();
|
|
||||||
|
|
||||||
while (ch != 13) {
|
ch = Readkey();
|
||||||
|
|
||||||
fflush(stdout);
|
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
||||||
ch = Readkey();
|
if (iPos > 0) {
|
||||||
|
BackErase();
|
||||||
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
sStr[--iPos]='\0';
|
||||||
if (iPos > 0) {
|
} else
|
||||||
printf("\b \b");
|
PUTCHAR('\007');
|
||||||
sStr[--iPos]='\0';
|
|
||||||
} else
|
|
||||||
putchar('\007');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == ' ') \
|
|
||||||
|| (ch == ',') || (ch == '.')) {
|
|
||||||
|
|
||||||
if (iPos <= iMaxlen) {
|
|
||||||
iPos++;
|
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
|
||||||
printf("%c", ch);
|
|
||||||
} else
|
|
||||||
putchar('\007');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == ' ') || (ch == ',') || (ch == '.')) {
|
||||||
close(ttyfd);
|
|
||||||
printf("\n");
|
if (iPos <= iMaxlen) {
|
||||||
|
iPos++;
|
||||||
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
|
PUTCHAR(ch);
|
||||||
|
} else
|
||||||
|
PUTCHAR('\007');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PUTCHAR('\r');
|
||||||
|
PUTCHAR('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -304,57 +512,48 @@ void Getnum(char *sStr, int iMaxlen)
|
|||||||
*/
|
*/
|
||||||
void GetDate(char *sStr, int iMaxlen)
|
void GetDate(char *sStr, int iMaxlen)
|
||||||
{
|
{
|
||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
|
|
||||||
fflush(stdout);
|
FLUSHIN();
|
||||||
|
strcpy(sStr, "");
|
||||||
|
|
||||||
strcpy(sStr, "");
|
alarm_on();
|
||||||
|
while (ch != 13) {
|
||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
ch = Readkey();
|
||||||
perror("open 4");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
|
|
||||||
alarm_on();
|
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
||||||
while (ch != 13) {
|
if (iPos > 0)
|
||||||
|
BackErase();
|
||||||
|
else
|
||||||
|
PUTCHAR('\007');
|
||||||
|
|
||||||
fflush(stdout);
|
if (iPos == 3 || iPos == 6) {
|
||||||
ch = Readkey();
|
BackErase();
|
||||||
|
--iPos;
|
||||||
|
}
|
||||||
|
|
||||||
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
|
sStr[--iPos]='\0';
|
||||||
if (iPos > 0)
|
|
||||||
printf("\b \b");
|
|
||||||
else
|
|
||||||
putchar('\007');
|
|
||||||
|
|
||||||
if (iPos == 3 || iPos == 6) {
|
|
||||||
printf("\b \b");
|
|
||||||
--iPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
sStr[--iPos]='\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ch >= '0' && ch <= '9') {
|
|
||||||
if (iPos < iMaxlen) {
|
|
||||||
iPos++;
|
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
|
||||||
printf("%c", ch);
|
|
||||||
if (iPos == 2 || iPos == 5) {
|
|
||||||
printf("-");
|
|
||||||
sprintf(sStr, "%s-", sStr);
|
|
||||||
iPos++;
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
putchar('\007');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
if (ch >= '0' && ch <= '9') {
|
||||||
close(ttyfd);
|
if (iPos < iMaxlen) {
|
||||||
printf("\n");
|
iPos++;
|
||||||
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
|
PUTCHAR(ch);
|
||||||
|
if (iPos == 2 || iPos == 5) {
|
||||||
|
PUTCHAR('-');
|
||||||
|
sprintf(sStr, "%s-", sStr);
|
||||||
|
iPos++;
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
PUTCHAR('\007');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PUTCHAR('\r');
|
||||||
|
PUTCHAR('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -371,11 +570,6 @@ void Getname(char *sStr, int iMaxlen)
|
|||||||
|
|
||||||
strcpy(sStr, "");
|
strcpy(sStr, "");
|
||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
|
||||||
perror("open 2");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
|
|
||||||
while (ch != 13) {
|
while (ch != 13) {
|
||||||
@ -418,8 +612,6 @@ void Getname(char *sStr, int iMaxlen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
|
||||||
close(ttyfd);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -438,11 +630,6 @@ void GetnameNE(char *sStr, int iMaxlen)
|
|||||||
|
|
||||||
strcpy(sStr, "");
|
strcpy(sStr, "");
|
||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
|
|
||||||
perror("open 2");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
|
|
||||||
while (ch != 13) {
|
while (ch != 13) {
|
||||||
@ -485,8 +672,6 @@ void GetnameNE(char *sStr, int iMaxlen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
|
||||||
close(ttyfd);
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,17 +689,6 @@ void Getpass(char *theword)
|
|||||||
int counter = 0;
|
int counter = 0;
|
||||||
char password[Max_passlen+1];
|
char password[Max_passlen+1];
|
||||||
|
|
||||||
/*
|
|
||||||
* Open the device that we want to read the password from, you can't use
|
|
||||||
* stdin as this might change in a pipe
|
|
||||||
*/
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR)) < 0) {
|
|
||||||
perror("open 7");
|
|
||||||
ExitClient(MBERR_TTYIO_ERROR);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set Raw mode so that the characters don't echo */
|
|
||||||
Setraw();
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -543,8 +717,6 @@ void Getpass(char *theword)
|
|||||||
printf("%c", CFG.iPasswd_Char);
|
printf("%c", CFG.iPasswd_Char);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Unsetraw(); /* Go normal */
|
|
||||||
close(ttyfd);
|
|
||||||
|
|
||||||
password[counter] = '\0'; /* Make sure the string has a NULL at the end*/
|
password[counter] = '\0'; /* Make sure the string has a NULL at the end*/
|
||||||
strcpy(theword,password);
|
strcpy(theword,password);
|
||||||
@ -554,33 +726,30 @@ void Getpass(char *theword)
|
|||||||
|
|
||||||
void Pause()
|
void Pause()
|
||||||
{
|
{
|
||||||
int i, x;
|
int i, x;
|
||||||
char *string;
|
char *string;
|
||||||
|
|
||||||
string = malloc(81);
|
string = malloc(81);
|
||||||
|
|
||||||
/* Press (Enter) to continue: */
|
/* Press (Enter) to continue: */
|
||||||
sprintf(string, "\r%s", (char *) Language(375));
|
sprintf(string, "\r%s", (char *) Language(375));
|
||||||
colour(CFG.CRColourF, CFG.CRColourB);
|
colour(CFG.CRColourF, CFG.CRColourB);
|
||||||
printf(string);
|
PUTSTR(string);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
fflush(stdout);
|
alarm_on();
|
||||||
fflush(stdin);
|
i = Readkey();
|
||||||
alarm_on();
|
} while ((i != '\r') && (i != '\n'));
|
||||||
i = Getone();
|
|
||||||
} while ((i != '\r') && (i != '\n'));
|
|
||||||
|
|
||||||
x = strlen(string);
|
x = strlen(string);
|
||||||
for(i = 0; i < x; i++)
|
for(i = 0; i < x; i++)
|
||||||
printf("\b");
|
PUTCHAR('\b');
|
||||||
for(i = 0; i < x; i++)
|
for(i = 0; i < x; i++)
|
||||||
printf(" ");
|
PUTCHAR(' ');
|
||||||
for(i = 0; i < x; i++)
|
for(i = 0; i < x; i++)
|
||||||
printf("\b");
|
PUTCHAR('\b');
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
free(string);
|
free(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,13 @@
|
|||||||
#define _INPUT_H
|
#define _INPUT_H
|
||||||
|
|
||||||
|
|
||||||
|
long Speed(void); /* Get (locked) tty speed */
|
||||||
|
int Waitchar(unsigned char *, int); /* Wait n* 10mSec for char */
|
||||||
|
int Escapechar(unsigned char *); /* Escape sequence test */
|
||||||
|
unsigned char Readkey(void); /* Read a translated key */
|
||||||
|
|
||||||
|
|
||||||
|
void BackErase(void); /* Send backspace with erase */
|
||||||
void GetstrU(char *, int); /* Get string, forbid spaces */
|
void GetstrU(char *, int); /* Get string, forbid spaces */
|
||||||
void GetstrP(char *, int, int); /* Get string with cursor position */
|
void GetstrP(char *, int, int); /* Get string with cursor position */
|
||||||
void GetstrC(char *, int); /* Get string, length, clear string */
|
void GetstrC(char *, int); /* Get string, length, clear string */
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -84,30 +84,32 @@ int Keystroke(int lRecord, int Pos)
|
|||||||
*/
|
*/
|
||||||
void Set_Language(int iLanguage)
|
void Set_Language(int iLanguage)
|
||||||
{
|
{
|
||||||
FILE *pLang;
|
FILE *pLang;
|
||||||
char *temp;
|
char *temp;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(temp, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/language.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if ((pLang = fopen(temp, "rb")) == NULL) {
|
|
||||||
WriteError("Language: Can't open file: %s", temp);
|
|
||||||
printf("\nLanguage: Can't open language file\n\n");
|
|
||||||
free(temp);
|
|
||||||
Pause();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fread(&langhdr, sizeof(langhdr), 1, pLang);
|
|
||||||
while (fread(&lang, langhdr.recsize, 1, pLang) == 1) {
|
|
||||||
if ((lang.LangKey[0] == iLanguage) && (lang.Available)) {
|
|
||||||
strcpy(CFG.current_language, lang.Filename);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if ((pLang = fopen(temp, "rb")) == NULL) {
|
||||||
|
WriteError("Language: Can't open file: %s", temp);
|
||||||
|
Enter(1);
|
||||||
|
PUTSTR((char *)"Language: Can't open language file");
|
||||||
|
Enter(2);
|
||||||
free(temp);
|
free(temp);
|
||||||
fclose(pLang);
|
Pause();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fread(&langhdr, sizeof(langhdr), 1, pLang);
|
||||||
|
while (fread(&lang, langhdr.recsize, 1, pLang) == 1) {
|
||||||
|
if ((lang.LangKey[0] == iLanguage) && (lang.Available)) {
|
||||||
|
strcpy(CFG.current_language, lang.Filename);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
free(temp);
|
||||||
|
fclose(pLang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -118,34 +120,36 @@ void Set_Language(int iLanguage)
|
|||||||
*/
|
*/
|
||||||
void InitLanguage()
|
void InitLanguage()
|
||||||
{
|
{
|
||||||
FILE *pLang;
|
FILE *pLang;
|
||||||
int iLang = 0;
|
int iLang = 0;
|
||||||
char *temp;
|
char *temp;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
sprintf(temp, "%s/etc/%s", getenv("MBSE_ROOT"), CFG.current_language);
|
sprintf(temp, "%s/etc/%s", getenv("MBSE_ROOT"), CFG.current_language);
|
||||||
if ((pLang = fopen(temp, "rb")) == NULL) {
|
if ((pLang = fopen(temp, "rb")) == NULL) {
|
||||||
WriteError("$FATAL: Can't open %s", temp);
|
WriteError("$FATAL: Can't open %s", temp);
|
||||||
ExitClient(MBERR_INIT_ERROR);
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
while (fread(&ldata, sizeof(ldata), 1, pLang) == 1) {
|
||||||
|
*(mLanguage + iLang) = (char *) calloc(strlen(ldata.sString) + 1, sizeof(char));
|
||||||
|
*(mKeystroke + iLang) = (char *) calloc(strlen(ldata.sKey) + 1, sizeof(char));
|
||||||
|
strcpy(mLanguage[iLang], ldata.sString);
|
||||||
|
strcpy(mKeystroke[iLang], ldata.sKey);
|
||||||
|
iLang++;
|
||||||
|
|
||||||
|
if (iLang >= LANG) {
|
||||||
|
Enter(1);
|
||||||
|
PUTSTR((char *)"FATAL: Language file has to many lines in it");
|
||||||
|
Enter(2);
|
||||||
|
ExitClient(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
while (fread(&ldata, sizeof(ldata), 1, pLang) == 1) {
|
fclose(pLang);
|
||||||
*(mLanguage + iLang) = (char *) calloc(strlen(ldata.sString) + 1, sizeof(char));
|
Syslog('b', "%d language lines read (%s)", iLang, CFG.current_language);
|
||||||
*(mKeystroke + iLang) = (char *) calloc(strlen(ldata.sKey) + 1, sizeof(char));
|
free(temp);
|
||||||
strcpy(mLanguage[iLang], ldata.sString);
|
|
||||||
strcpy(mKeystroke[iLang], ldata.sKey);
|
|
||||||
iLang++;
|
|
||||||
|
|
||||||
if(iLang >= LANG) {
|
|
||||||
printf("FATAL: Language file has to many lines in it");
|
|
||||||
ExitClient(MBERR_INIT_ERROR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose(pLang);
|
|
||||||
Syslog('b', "%d language lines read (%s)", iLang, CFG.current_language);
|
|
||||||
free(temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "lastcallers.h"
|
#include "lastcallers.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -86,7 +87,7 @@ void LastCallers(char *OpData)
|
|||||||
colour(LIGHTRED, BLACK);
|
colour(LIGHTRED, BLACK);
|
||||||
Center(Underline);
|
Center(Underline);
|
||||||
|
|
||||||
printf("\n");
|
Enter(1);
|
||||||
|
|
||||||
/* # User Name Device timeOn Calls Location */
|
/* # User Name Device timeOn Calls Location */
|
||||||
pout(LIGHTGREEN, BLACK, (char *) Language(85));
|
pout(LIGHTGREEN, BLACK, (char *) Language(85));
|
||||||
@ -100,31 +101,34 @@ void LastCallers(char *OpData)
|
|||||||
count++;
|
count++;
|
||||||
|
|
||||||
colour(WHITE, BLACK);
|
colour(WHITE, BLACK);
|
||||||
printf("%-5d", count);
|
sprintf(Heading, "%-5d", count);
|
||||||
|
PUTSTR(Heading);
|
||||||
|
|
||||||
colour(LIGHTCYAN, BLACK);
|
colour(LIGHTCYAN, BLACK);
|
||||||
if ((strcasecmp(OpData, "/H")) == 0) {
|
if ((strcasecmp(OpData, "/H")) == 0) {
|
||||||
if ((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
|
if ((strcmp(lcall.Handle, "") != 0 && *(lcall.Handle) != ' '))
|
||||||
printf("%-20s", lcall.Handle);
|
sprintf(Heading, "%-20s", lcall.Handle);
|
||||||
else
|
else
|
||||||
printf("%-20s", lcall.UserName);
|
sprintf(Heading, "%-20s", lcall.UserName);
|
||||||
} else if (strcasecmp(OpData, "/U") == 0) {
|
} else if (strcasecmp(OpData, "/U") == 0) {
|
||||||
printf("%-20s", lcall.Name);
|
sprintf(Heading, "%-20s", lcall.Name);
|
||||||
} else {
|
} else {
|
||||||
printf("%-20s", lcall.UserName);
|
sprintf(Heading, "%-20s", lcall.UserName);
|
||||||
}
|
}
|
||||||
|
PUTSTR(Heading);
|
||||||
|
|
||||||
colour(LIGHTBLUE, BLACK);
|
sprintf(Heading, "%-8s", lcall.Device);
|
||||||
printf("%-8s", lcall.Device);
|
pout(LIGHTBLUE, BLACK, Heading);
|
||||||
|
|
||||||
colour(LIGHTMAGENTA, BLACK);
|
sprintf(Heading, "%-8s", lcall.TimeOn);
|
||||||
printf("%-8s", lcall.TimeOn);
|
pout(LIGHTMAGENTA, BLACK, Heading);
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
sprintf(Heading, "%-7d", lcall.Calls);
|
||||||
printf("%-7d", lcall.Calls);
|
pout(YELLOW, BLACK, Heading);
|
||||||
|
|
||||||
colour(LIGHTRED, BLACK);
|
sprintf(Heading, "%-32s", lcall.Location);
|
||||||
printf("%-32s\n", lcall.Location);
|
pout(LIGHTRED, BLACK, Heading);
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
LineCount++;
|
LineCount++;
|
||||||
if (LineCount == exitinfo.iScreenLen) {
|
if (LineCount == exitinfo.iScreenLen) {
|
||||||
@ -138,7 +142,7 @@ void LastCallers(char *OpData)
|
|||||||
fLine(79);
|
fLine(79);
|
||||||
|
|
||||||
fclose(pLC);
|
fclose(pLC);
|
||||||
printf("\n");
|
Enter(1);
|
||||||
Pause();
|
Pause();
|
||||||
}
|
}
|
||||||
free(sFileName);
|
free(sFileName);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "lineedit.h"
|
#include "lineedit.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern int Line;
|
extern int Line;
|
||||||
@ -60,516 +61,516 @@ void Line_Edit_Center(void); /* Center a line */
|
|||||||
|
|
||||||
void Line_Edit_Append()
|
void Line_Edit_Append()
|
||||||
{
|
{
|
||||||
if((Line - 1) == TEXTBUFSIZE) {
|
char msg[41];
|
||||||
Enter(1);
|
|
||||||
/* Maximum message length exceeded */
|
if ((Line - 1) == TEXTBUFSIZE) {
|
||||||
pout(3, 0, (char *) Language(166));
|
Enter(1);
|
||||||
Enter(1);
|
/* Maximum message length exceeded */
|
||||||
return;
|
pout(CYAN, BLACK, (char *) Language(166));
|
||||||
}
|
Enter(1);
|
||||||
|
return;
|
||||||
while (TRUE) {
|
}
|
||||||
colour(10, 0);
|
|
||||||
printf("%-2d : ", Line);
|
while (TRUE) {
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
sprintf(msg, "%-2d : ", Line);
|
||||||
fflush(stdout);
|
pout(LIGHTGREEN, BLACK, msg);
|
||||||
alarm_on();
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
GetstrP(Message[Line], 72, 0);
|
alarm_on();
|
||||||
|
GetstrP(Message[Line], 72, 0);
|
||||||
if((strcmp(Message[Line], "")) == 0)
|
|
||||||
return;
|
if ((strcmp(Message[Line], "")) == 0)
|
||||||
|
return;
|
||||||
Line++;
|
|
||||||
if((Line - 1) == TEXTBUFSIZE) {
|
Line++;
|
||||||
Enter(1);
|
if ((Line - 1) == TEXTBUFSIZE) {
|
||||||
/* Maximum message length exceeded */
|
Enter(1);
|
||||||
pout(12, 0, (char *) Language(166));
|
/* Maximum message length exceeded */
|
||||||
Enter(1);
|
pout(LIGHTRED, BLACK, (char *) Language(166));
|
||||||
return;
|
Enter(1);
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Line_Edit_Delete()
|
void Line_Edit_Delete()
|
||||||
{
|
{
|
||||||
int i, start, end = 0, total;
|
int i, start, end = 0, total, Loop;
|
||||||
int Loop;
|
char temp[81];
|
||||||
char temp[81];
|
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
colour(10, 0);
|
Enter(2);
|
||||||
/* Delete starting at line */
|
/* Delete starting at line */
|
||||||
printf("\n\n%s#(1 - %d): ", (char *) Language(176), (Line - 1) );
|
sprintf(temp, "%s#(1 - %d): ", (char *) Language(176), (Line - 1) );
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
GetstrC(temp, 80);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
if((strcmp(temp, "")) == 0) {
|
GetstrC(temp, 80);
|
||||||
/* Aborted. */
|
if ((strcmp(temp, "")) == 0) {
|
||||||
pout(15, 0, (char *) Language(177));
|
/* Aborted. */
|
||||||
Enter(1);
|
pout(WHITE, BLACK, (char *) Language(177));
|
||||||
return;
|
Enter(1);
|
||||||
}
|
return;
|
||||||
|
|
||||||
start = atoi(temp);
|
|
||||||
colour(10, 0);
|
|
||||||
if(start > (Line - 1) )
|
|
||||||
/* Please enter a number in the range of */
|
|
||||||
printf("\n%s(1 - %d)", (char *) Language(178), (Line - 1) );
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
while (TRUE) {
|
start = atoi(temp);
|
||||||
colour(10, 0);
|
if (start > (Line - 1)) {
|
||||||
/* Delete ending at line */
|
Enter(1);
|
||||||
printf("%s# (1 - %d): ", (char *) Language(179), (Line - 1) );
|
/* Please enter a number in the range of */
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
sprintf(temp, "%s(1 - %d)", (char *) Language(178), (Line - 1) );
|
||||||
GetstrC(temp, 80);
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
if((strcmp(temp, "")) == 0) {
|
} else
|
||||||
/* Aborted. */
|
break;
|
||||||
pout(15, 0, (char *) Language(176));
|
}
|
||||||
Enter(1);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
end = atoi(temp);
|
|
||||||
|
|
||||||
colour(10, 0);
|
|
||||||
if(end > (Line - 1))
|
|
||||||
/* Please enter a number in the range of */
|
|
||||||
printf("\n%s(1 - %d)\n\n", (char *) Language(179), (Line - 1) );
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
|
/* Delete ending at line */
|
||||||
|
sprintf(temp, "%s# (1 - %d): ", (char *) Language(179), (Line - 1) );
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
|
GetstrC(temp, 80);
|
||||||
|
if ((strcmp(temp, "")) == 0) {
|
||||||
|
/* Aborted. */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(176));
|
||||||
|
Enter(1);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get total by minusing the end line from the start line */
|
end = atoi(temp);
|
||||||
/* and + 1 will give you total lines between start and end */
|
|
||||||
total = (end - start) + 1;
|
|
||||||
|
|
||||||
/* Define loop by minusing total lines from end which will */
|
if(end > (Line - 1)) {
|
||||||
/* do a loop for only the amount of lines left after the */
|
Enter(1);
|
||||||
/* end line */
|
/* Please enter a number in the range of */
|
||||||
Loop = Line - end++;
|
sprintf(temp, "%s(1 - %d)", (char *) Language(179), (Line - 1) );
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
Enter(2);
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Minus the total amount of deleted lines from the current */
|
/* Get total by minusing the end line from the start line */
|
||||||
/* amount of lines to keep track of how many lines you are */
|
/* and + 1 will give you total lines between start and end */
|
||||||
/* working with */
|
total = (end - start) + 1;
|
||||||
Line -= total;
|
|
||||||
|
|
||||||
/* Do loop to copy the current message over the deleted lines */
|
/* Define loop by minusing total lines from end which will */
|
||||||
|
/* do a loop for only the amount of lines left after the */
|
||||||
|
/* end line */
|
||||||
|
Loop = Line - end++;
|
||||||
|
|
||||||
for (i = 0; i < Loop; i++)
|
/* Minus the total amount of deleted lines from the current */
|
||||||
strcpy(*(Message + start++), *(Message + end++));
|
/* amount of lines to keep track of how many lines you are */
|
||||||
|
/* working with */
|
||||||
|
Line -= total;
|
||||||
|
|
||||||
|
/* Do loop to copy the current message over the deleted lines */
|
||||||
|
|
||||||
|
for (i = 0; i < Loop; i++)
|
||||||
|
strcpy(*(Message + start++), *(Message + end++));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Line_Edit_Edit()
|
void Line_Edit_Edit()
|
||||||
{
|
{
|
||||||
int j, edit;
|
int j, edit;
|
||||||
char temp[81];
|
char temp[81];
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
while (TRUE) {
|
Enter(1);
|
||||||
colour(10, 0);
|
/* Enter line # to edit */
|
||||||
/* Enter line # to edit */
|
sprintf(temp, "%s(1 - %d): ", (char *) Language(181), (Line - 1) );
|
||||||
printf("\n%s(1 - %d): ", (char *) Language(181), (Line - 1) );
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(temp, 80);
|
GetstrC(temp, 80);
|
||||||
if((strcmp(temp, "")) == 0)
|
if ((strcmp(temp, "")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
edit = atoi(temp);
|
edit = atoi(temp);
|
||||||
|
|
||||||
colour(10, 0);
|
if (edit > Line) {
|
||||||
if(edit > Line)
|
Enter(1);
|
||||||
/* Please enter a number in the range of */
|
/* Please enter a number in the range of */
|
||||||
printf("\n%s(1 - %d) ", (char *) Language(178), (Line - 1) );
|
sprintf(temp, "%s(1 - %d) ", (char *) Language(178), (Line - 1) );
|
||||||
else
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
break;
|
} else
|
||||||
}
|
break;
|
||||||
|
|
||||||
colour(10, 0);
|
|
||||||
printf("\n%d : ", edit);
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
printf("%s", Message[edit]);
|
|
||||||
fflush(stdout);
|
|
||||||
j = strlen(Message[edit]);
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
alarm_on();
|
|
||||||
GetstrP(Message[edit], 81, j);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
sprintf(temp, "%d : ", edit);
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
|
PUTSTR(Message[edit]);
|
||||||
|
j = strlen(Message[edit]);
|
||||||
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
|
alarm_on();
|
||||||
|
GetstrP(Message[edit], 80, j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Line_Edit_Insert()
|
void Line_Edit_Insert()
|
||||||
{
|
{
|
||||||
int i, j, start, end = 0, total;
|
int i, j, start, end = 0, total;
|
||||||
char temp[81];
|
char temp[81];
|
||||||
|
|
||||||
if((Line - 1) == TEXTBUFSIZE) {
|
if ((Line - 1) == TEXTBUFSIZE) {
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Maximum message length exceeded */
|
/* Maximum message length exceeded */
|
||||||
pout(3, 0, (char *) Language(166));
|
pout(CYAN, BLACK, (char *) Language(166));
|
||||||
Enter(1);
|
Enter(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
colour(10, 0);
|
Enter(2);
|
||||||
/* Enter line # to insert text before */
|
/* Enter line # to insert text before */
|
||||||
printf("\n\n%s(1 - %d): ", (char *) Language(183), (Line - 1));
|
sprintf(temp, "%s(1 - %d): ", (char *) Language(183), (Line - 1));
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
GetstrC(temp, 80);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
if((strcmp(temp, "")) == 0) {
|
|
||||||
/* Aborted. */
|
|
||||||
pout(15, 0, (char *) Language(177));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
start = atoi(temp);
|
|
||||||
|
|
||||||
colour(10, 0);
|
|
||||||
if(start > (Line - 1))
|
|
||||||
/* Please enter a number in the range of */
|
|
||||||
printf("\n%s(1 - %d)", (char *) Language(178), (Line - 1));
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
j = start;
|
|
||||||
colour(10, 0);
|
|
||||||
printf("\n%-2d : ", start);
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
GetstrC(temp, 80);
|
GetstrC(temp, 80);
|
||||||
|
if ((strcmp(temp, "")) == 0) {
|
||||||
if((strcmp(temp, "")) == 0)
|
/* Aborted. */
|
||||||
return;
|
pout(WHITE, BLACK, (char *) Language(177));
|
||||||
|
return;
|
||||||
total = Line - start;
|
|
||||||
end = Line;
|
|
||||||
Line++;
|
|
||||||
start = Line;
|
|
||||||
|
|
||||||
for (i = 0; i < total + 1; i++) {
|
|
||||||
strcpy(Message[start], Message[end]);
|
|
||||||
start--;
|
|
||||||
end--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(Message[j], temp);
|
start = atoi(temp);
|
||||||
|
|
||||||
|
if (start > (Line - 1)) {
|
||||||
|
Enter(1);
|
||||||
|
/* Please enter a number in the range of */
|
||||||
|
sprintf(temp, "%s(1 - %d)", (char *) Language(178), (Line - 1));
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
j = start;
|
||||||
|
sprintf(temp, "%-2d : ", start);
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
|
GetstrC(temp, 80);
|
||||||
|
|
||||||
|
if ((strcmp(temp, "")) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
total = Line - start;
|
||||||
|
end = Line;
|
||||||
|
Line++;
|
||||||
|
start = Line;
|
||||||
|
|
||||||
|
for (i = 0; i < total + 1; i++) {
|
||||||
|
strcpy(Message[start], Message[end]);
|
||||||
|
start--;
|
||||||
|
end--;
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy(Message[j], temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Line_Edit_Replace()
|
void Line_Edit_Replace()
|
||||||
{
|
{
|
||||||
int edit;
|
int edit;
|
||||||
char temp[81];
|
char temp[81];
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
while (TRUE) {
|
Enter(2);
|
||||||
colour(10, 0);
|
/* Enter line # to replace */
|
||||||
/* Enter line # to replace */
|
sprintf(temp, "%s(1 - %d): ", (char *) Language(185), (Line - 1) );
|
||||||
printf("\n\n%s(1 - %d): ", (char *) Language(185), (Line - 1) );
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(temp, 80);
|
GetstrC(temp, 80);
|
||||||
if((strcmp(temp, "")) == 0)
|
if ((strcmp(temp, "")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
edit = atoi(temp);
|
edit = atoi(temp);
|
||||||
|
|
||||||
colour(10, 0);
|
|
||||||
if(edit > Line)
|
|
||||||
/* Please enter a number in the range of */
|
|
||||||
printf("\n%s(1 - %d) ", (char *) Language(178), (Line - 1));
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (edit > Line) {
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Line reads: */
|
/* Please enter a number in the range of */
|
||||||
pout(15, 0, (char *) Language(186));
|
sprintf(temp, "%s(1 - %d) ", (char *) Language(178), (Line - 1));
|
||||||
Enter(1);
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
} else
|
||||||
colour(10, 0);
|
break;
|
||||||
printf("%d : ", edit);
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
printf("%s\n\n", Message[edit]);
|
|
||||||
|
|
||||||
colour(10, 0);
|
|
||||||
printf("%d : ", edit);
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
GetstrC(temp, 80);
|
|
||||||
if((strcmp(temp, "")) == 0) {
|
|
||||||
Enter(1);
|
|
||||||
/* Unchanged. */
|
|
||||||
pout(15, 0, (char *) Language(187));
|
|
||||||
Enter(1);
|
|
||||||
} else
|
|
||||||
strcpy(Message[edit], temp);
|
|
||||||
|
|
||||||
Enter(1);
|
|
||||||
/* Line now reads: */
|
|
||||||
pout(15, 0, (char *) Language(188));
|
|
||||||
Enter(1);
|
|
||||||
|
|
||||||
colour(10, 0);
|
|
||||||
printf("%d : ", edit);
|
|
||||||
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
printf("%s", Message[edit]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
/* Line reads: */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(186));
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
|
sprintf(temp, "%d : ", edit);
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
|
PUTSTR(Message[edit]);
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
|
sprintf(temp, "%d : ", edit);
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
|
GetstrC(temp, 80);
|
||||||
|
if ((strcmp(temp, "")) == 0) {
|
||||||
|
Enter(1);
|
||||||
|
/* Unchanged. */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(187));
|
||||||
|
Enter(1);
|
||||||
|
} else
|
||||||
|
strcpy(Message[edit], temp);
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
/* Line now reads: */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(188));
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
|
sprintf(temp, "%d : ", edit);
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
|
||||||
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
|
PUTSTR(Message[edit]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Line_Edit_Text()
|
void Line_Edit_Text()
|
||||||
{
|
{
|
||||||
int edit;
|
int edit;
|
||||||
char temp[81];
|
char temp[81], temp1[81];
|
||||||
char temp1[81];
|
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
while (TRUE) {
|
Enter(2);
|
||||||
colour(10, 0);
|
/* Enter line # to edit */
|
||||||
/* Enter line # to edit */
|
sprintf(temp, "%s(1 - %d): ", (char *) Language(194), (Line - 1));
|
||||||
printf("\n\n%s(1 - %d): ", (char *) Language(194), (Line - 1));
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(temp, 80);
|
GetstrC(temp, 80);
|
||||||
if((strcmp(temp, "")) == 0)
|
if ((strcmp(temp, "")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
edit = atoi(temp);
|
edit = atoi(temp);
|
||||||
|
|
||||||
colour(10, 0);
|
|
||||||
if(edit > Line)
|
|
||||||
/* Please enter a number in the range of */
|
|
||||||
printf("\n%s(1 - %d) ", (char *) Language(178), (Line - 1) );
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (edit > Line) {
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Line reads: */
|
/* Please enter a number in the range of */
|
||||||
pout(15, 0, (char *) Language(186));
|
sprintf(temp, "%s(1 - %d) ", (char *) Language(178), (Line - 1) );
|
||||||
Enter(1);
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
colour(10, 0);
|
} else
|
||||||
printf("%d : ", edit);
|
break;
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
printf("%s\n\n", Message[edit]);
|
|
||||||
|
|
||||||
/* Text to replace: */
|
|
||||||
pout(10, 0, (char *) Language(195));
|
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
|
||||||
GetstrC(temp, 80);
|
|
||||||
/* Replacement text: */
|
|
||||||
pout(10, 0, (char *) Language(196));
|
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
|
||||||
GetstrC(temp1, 80);
|
|
||||||
|
|
||||||
strreplace(Message[edit], temp, temp1);
|
|
||||||
|
|
||||||
Enter(1);
|
|
||||||
/* Line now reads: */
|
|
||||||
pout(15, 0, (char *) Language(197));
|
|
||||||
Enter(1);
|
|
||||||
colour(10, 0);
|
|
||||||
printf("%d : ", edit);
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
printf("%s", Message[edit]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
/* Line reads: */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(186));
|
||||||
|
Enter(1);
|
||||||
|
sprintf(temp, "%d : ", edit);
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
|
PUTSTR(Message[edit]);
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
|
/* Text to replace: */
|
||||||
|
pout(LIGHTGREEN, BLACK, (char *) Language(195));
|
||||||
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
|
GetstrC(temp, 80);
|
||||||
|
/* Replacement text: */
|
||||||
|
pout(LIGHTGREEN, BLACK, (char *) Language(196));
|
||||||
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
|
GetstrC(temp1, 80);
|
||||||
|
|
||||||
|
strreplace(Message[edit], temp, temp1);
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
/* Line now reads: */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(197));
|
||||||
|
Enter(1);
|
||||||
|
sprintf(temp, "%d : ", edit);
|
||||||
|
pout(LIGHTGREEN, BLACK, temp);
|
||||||
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
|
PUTSTR(Message[edit]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Line_Edit_Center()
|
void Line_Edit_Center()
|
||||||
{
|
{
|
||||||
int i, j, z, center;
|
int i, j, z, center, maxlen = 78;
|
||||||
int maxlen = 78;
|
char *CEnter, temp[81];
|
||||||
char *CEnter;
|
|
||||||
char temp[81];
|
|
||||||
|
|
||||||
colour(15, 0);
|
Enter(2);
|
||||||
/* Enter line # to center */
|
/* Enter line # to center */
|
||||||
printf("\n\n%s(1 - %d): ", (char *) Language(203), (Line - 1));
|
sprintf(temp, "%s(1 - %d): ", (char *) Language(203), (Line - 1));
|
||||||
fflush(stdout);
|
pout(WHITE, BLACK, temp);
|
||||||
GetstrC(temp, 80);
|
GetstrC(temp, 80);
|
||||||
if((strcmp(temp, "")) == 0)
|
if ((strcmp(temp, "")) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CEnter = calloc(81, sizeof(char));
|
CEnter = calloc(81, sizeof(char));
|
||||||
center = atoi(temp);
|
center = atoi(temp);
|
||||||
j = strlen(Message[center]);
|
j = strlen(Message[center]);
|
||||||
if (j >= maxlen)
|
if (j >= maxlen) {
|
||||||
/* Line is maximum length and cannot be centered */
|
Enter(1);
|
||||||
printf("\n%s\n", (char *) Language(204));
|
/* Line is maximum length and cannot be centered */
|
||||||
else {
|
pout(LIGHTGREEN, BLACK, (char *) Language(204));
|
||||||
z = 35 - (j / 2);
|
Enter(1);
|
||||||
|
} else {
|
||||||
|
z = 35 - (j / 2);
|
||||||
|
|
||||||
for(i = 0; i < z; i++)
|
for (i = 0; i < z; i++)
|
||||||
strcat(CEnter," ");
|
strcat(CEnter," ");
|
||||||
strcat(CEnter, Message[center]);
|
strcat(CEnter, Message[center]);
|
||||||
strcpy(Message[center], CEnter);
|
strcpy(Message[center], CEnter);
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
Enter(1);
|
||||||
printf("\n%s\n", Message[center]);
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
free(CEnter);
|
PUTSTR(Message[center]);
|
||||||
|
Enter(1);
|
||||||
|
free(CEnter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int Line_Edit()
|
int Line_Edit()
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
char msg[81];
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
colour(12, 0);
|
colour(LIGHTRED, BLACK);
|
||||||
/* Begin your message now, Blank line to end */
|
/* Begin your message now, Blank line to end */
|
||||||
Center((char *) Language(164));
|
Center((char *) Language(164));
|
||||||
/* Maximum of TEXTBUFSIZE lines, 73 chars per line */
|
/* Maximum of TEXTBUFSIZE lines, 73 chars per line */
|
||||||
Center((char *) Language(165));
|
Center((char *) Language(165));
|
||||||
colour(14, 0);
|
colour(YELLOW, BLACK);
|
||||||
printf(" (");
|
PUTSTR((char *)" (");
|
||||||
for (i = 0; i < 74; i++)
|
for (i = 0; i < 74; i++)
|
||||||
printf("-");
|
PUTSTR((char *)"-");
|
||||||
printf(")\n");
|
PUTSTR((char *)")");
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
Line_Edit_Append();
|
Line_Edit_Append();
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
colour(14, 0);
|
Enter(1);
|
||||||
/* Functions available: (Current Message: */
|
/* Functions available: (Current Message: */ /* Lines) */
|
||||||
printf("\n%s%d ", (char *) Language(167), (Line - 1));
|
sprintf(msg, "%s%d %s", (char *) Language(167), (Line - 1), (char *) Language(168));
|
||||||
/* Lines) */
|
pout(YELLOW, BLACK, msg);
|
||||||
printf("%s\n\n", (char *) Language(168));
|
Enter(2);
|
||||||
colour(11, 0);
|
|
||||||
/* L - List message S - Save message C - Continue message */
|
|
||||||
printf("%s\n", (char *) Language(169));
|
|
||||||
|
|
||||||
/* Q - Quit message D - Delete line I - Insert line */
|
/* L - List message S - Save message C - Continue message */
|
||||||
printf("%s\n", (char *) Language(170));
|
pout(LIGHTCYAN, BLACK, (char *) Language(169));
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
/* T - Text edit E - Edit line R - Replace line */
|
/* Q - Quit message D - Delete line I - Insert line */
|
||||||
printf("%s\n", (char *) Language(171));
|
pout(LIGHTCYAN, BLACK, (char *) Language(170));
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
/* Z - Center line */
|
/* T - Text edit E - Edit line R - Replace line */
|
||||||
printf("%s\n", (char *) Language(172));
|
pout(LIGHTCYAN, BLACK, (char *) Language(171));
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
colour(15, 0);
|
/* Z - Center line */
|
||||||
printf("\n%s [", (char *) Language(173));
|
pout(LIGHTCYAN, BLACK, (char *) Language(172));
|
||||||
for (i = 0; i < 10; i++)
|
Enter(2);
|
||||||
putchar(Keystroke(172, i));
|
|
||||||
printf("]: ");
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
alarm_on();
|
sprintf(msg, "%s [", (char *) Language(173));
|
||||||
j = toupper(Getone());
|
pout(WHITE, BLACK, msg);
|
||||||
|
for (i = 0; i < 10; i++)
|
||||||
|
PUTCHAR(Keystroke(172, i));
|
||||||
|
PUTSTR((char *)"]: ");
|
||||||
|
|
||||||
if (j == Keystroke(172, 2)) {
|
alarm_on();
|
||||||
/* Continue */
|
j = toupper(Readkey());
|
||||||
pout(15, 0, (char *) Language(174));
|
|
||||||
Enter(1);
|
|
||||||
Line_Edit_Append();
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (j == Keystroke(172, 4)) {
|
if (j == Keystroke(172, 2)) {
|
||||||
/* Delete */
|
/* Continue */
|
||||||
pout(15, 0, (char *) Language(175));
|
pout(WHITE, BLACK, (char *) Language(174));
|
||||||
Enter(1);
|
Enter(1);
|
||||||
Line_Edit_Delete();
|
Line_Edit_Append();
|
||||||
} else
|
} else if (j == Keystroke(172, 4)) {
|
||||||
|
/* Delete */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(175));
|
||||||
|
Enter(1);
|
||||||
|
Line_Edit_Delete();
|
||||||
|
} else if (j == Keystroke(172, 7)) {
|
||||||
|
/* Edit */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(180));
|
||||||
|
Enter(1);
|
||||||
|
Line_Edit_Edit();
|
||||||
|
} else if (j == Keystroke(172, 5)) {
|
||||||
|
/* Insert */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(182));
|
||||||
|
Enter(1);
|
||||||
|
Line_Edit_Insert();
|
||||||
|
} else if (j == Keystroke(172, 0)) {
|
||||||
|
pout(WHITE, BLACK, (char *) Language(184));
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
if (j == Keystroke(172, 7)) {
|
for (i = 1; i < Line; i++) {
|
||||||
/* Edit */
|
sprintf(msg, "%d: ", i);
|
||||||
pout(15, 0, (char *) Language(180));
|
pout(LIGHTGREEN, BLACK, msg);
|
||||||
Enter(1);
|
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
||||||
Line_Edit_Edit();
|
PUTSTR(Message[i]);
|
||||||
} else
|
Enter(1);
|
||||||
|
}
|
||||||
|
} else if (j == Keystroke(172, 8)) {
|
||||||
|
/* Replace */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(362));
|
||||||
|
Enter(1);
|
||||||
|
Line_Edit_Replace();
|
||||||
|
} else if (j == Keystroke(172, 3)) {
|
||||||
|
/* Quit */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(189));
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
if (j == Keystroke(172, 5)) {
|
/* Are you sure [y/N] */
|
||||||
/* Insert */
|
PUTSTR((char *) Language(190));
|
||||||
pout(15, 0, (char *) Language(182));
|
alarm_on();
|
||||||
Enter(1);
|
|
||||||
Line_Edit_Insert();
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (j == Keystroke(172, 0)) {
|
if (toupper(Readkey()) == Keystroke(190, 0)) {
|
||||||
pout(15, 0, (char *) Language(184));
|
/* Yes */
|
||||||
Enter(2);
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(356));
|
||||||
|
Enter(1);
|
||||||
|
/* Message aborted. */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(191));
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
for(i = 1; i < Line; i++) {
|
sleep(1);
|
||||||
colour(10, 0);
|
return FALSE;
|
||||||
printf("%d: ", i);
|
}
|
||||||
colour(CFG.MsgInputColourF, CFG.MsgInputColourB);
|
|
||||||
printf("%s\n", Message[i]);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (j == Keystroke(172, 8)) {
|
/* No */
|
||||||
/* Replace */
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(192));
|
||||||
pout(15, 0, (char *) Language(362));
|
Enter(1);
|
||||||
Enter(1);
|
} else if (j == Keystroke(172, 6)) {
|
||||||
Line_Edit_Replace();
|
/* Text Edit */
|
||||||
} else
|
pout(WHITE, BLACK, (char *) Language(193));
|
||||||
|
Line_Edit_Text();
|
||||||
|
} else if (j == Keystroke(172, 1)) {
|
||||||
|
/* Save */
|
||||||
|
pout(WHITE, BLACK, (char *) Language(198));
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
if (j == Keystroke(172, 3)) {
|
if (Line > 1)
|
||||||
/* Quit */
|
return TRUE;
|
||||||
pout(15, 0, (char *) Language(189));
|
|
||||||
Enter(2);
|
|
||||||
|
|
||||||
/* Are you sure [y/N] */
|
return FALSE;
|
||||||
printf("%s", (char *) Language(190));
|
} else if (j == Keystroke(172, 9)) {
|
||||||
fflush(stdout);
|
/* Center */
|
||||||
alarm_on();
|
pout(WHITE, BLACK, (char *) Language(376));
|
||||||
|
Enter(1);
|
||||||
if (toupper(Getone()) == Keystroke(190, 0)) {
|
Line_Edit_Center();
|
||||||
/* Yes */
|
|
||||||
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(356));
|
|
||||||
Enter(1);
|
|
||||||
/* Message aborted. */
|
|
||||||
pout(15, 0, (char *) Language(191));
|
|
||||||
Enter(2);
|
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
sleep(1);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
|
||||||
/* No */
|
|
||||||
printf("%s\n", (char *) Language(192));
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (j == Keystroke(172, 6)) {
|
|
||||||
/* Text Edit */
|
|
||||||
pout(15, 0, (char *) Language(193));
|
|
||||||
Line_Edit_Text();
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (j == Keystroke(172, 1)) {
|
|
||||||
/* Save */
|
|
||||||
pout(15, 0, (char *) Language(198));
|
|
||||||
Enter(1);
|
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
if (Line > 1)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
} else
|
|
||||||
|
|
||||||
if (j == Keystroke(172, 9)) {
|
|
||||||
/* Center */
|
|
||||||
pout(15, 0, (char *) Language(376));
|
|
||||||
Enter(1);
|
|
||||||
Line_Edit_Center();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1222
mbsebbs/mail.c
1222
mbsebbs/mail.c
File diff suppressed because it is too large
Load Diff
@ -40,7 +40,8 @@
|
|||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "newuser.h"
|
#include "newuser.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
#include "openport.h"
|
||||||
|
|
||||||
|
|
||||||
extern int do_quiet; /* Logging quiet flag */
|
extern int do_quiet; /* Logging quiet flag */
|
||||||
@ -52,10 +53,9 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
char *p, *tty, temp[PATH_MAX];
|
char *p, *tty, temp[PATH_MAX];
|
||||||
FILE *pTty;
|
FILE *pTty;
|
||||||
int i;
|
int i, rc = 0;
|
||||||
struct passwd *pw;
|
struct passwd *pw;
|
||||||
|
|
||||||
printf("\n\nLoading MBSE BBS New User Registration ...\n\n");
|
|
||||||
pTTY = calloc(15, sizeof(char));
|
pTTY = calloc(15, sizeof(char));
|
||||||
tty = ttyname(1);
|
tty = ttyname(1);
|
||||||
|
|
||||||
@ -105,6 +105,15 @@ int main(int argc, char **argv)
|
|||||||
Syslog(' ', " ");
|
Syslog(' ', " ");
|
||||||
Syslog(' ', "MBNEWUSR v%s", VERSION);
|
Syslog(' ', "MBNEWUSR v%s", VERSION);
|
||||||
|
|
||||||
|
if ((rc = rawport()) != 0) {
|
||||||
|
WriteError("Unable to set raw mode");
|
||||||
|
Fast_Bye(MBERR_OK);;
|
||||||
|
}
|
||||||
|
|
||||||
|
Enter(2);
|
||||||
|
PUTSTR((char *)"Loading MBSE BBS New User Registration ...");
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
if ((p = getenv("CONNECT")) != NULL)
|
if ((p = getenv("CONNECT")) != NULL)
|
||||||
Syslog('+', "CONNECT %s", p);
|
Syslog('+', "CONNECT %s", p);
|
||||||
if ((p = getenv("CALLER_ID")) != NULL)
|
if ((p = getenv("CALLER_ID")) != NULL)
|
||||||
@ -137,7 +146,7 @@ int main(int argc, char **argv)
|
|||||||
* Trap signals
|
* Trap signals
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM) || (i == SIGKILL))
|
if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else if (i == SIGCHLD)
|
else if (i == SIGCHLD)
|
||||||
signal(i, SIG_DFL);
|
signal(i, SIG_DFL);
|
||||||
@ -160,10 +169,10 @@ int main(int argc, char **argv)
|
|||||||
Fast_Bye(MBERR_OK);
|
Fast_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
sprintf(temp, "MBSE BBS v%s (Release: %s) on %s/%s", VERSION, ReleaseDate, OsName(), OsCPU());
|
||||||
printf("MBSE BBS v%s (Release: %s) on %s/%s\n", VERSION, ReleaseDate, OsName(), OsCPU());
|
poutCR(YELLOW, BLACK, temp);
|
||||||
colour(WHITE, BLACK);
|
pout(WHITE, BLACK, (char *)COPYRIGHT);
|
||||||
printf("%s\n\n", COPYRIGHT);
|
Enter(2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if this port is available.
|
* Check if this port is available.
|
||||||
@ -183,7 +192,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
||||||
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
||||||
printf("No BBS on this port allowed!\n\n");
|
PUTSTR((char *)"No BBS on this port allowed!");
|
||||||
|
Enter(2);
|
||||||
Fast_Bye(MBERR_OK);
|
Fast_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,10 +202,12 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (CFG.iConnectString) {
|
if (CFG.iConnectString) {
|
||||||
/* Connected on port */
|
/* Connected on port */
|
||||||
colour(CYAN, BLACK);
|
sprintf(temp, "%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
|
||||||
printf("%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
|
pout(CYAN, BLACK, temp);
|
||||||
/* on */
|
/* on */
|
||||||
printf("%s %s\n", (char *) Language(135), ctime(<ime));
|
sprintf(temp, "%s %s", (char *) Language(135), ctime(<ime));
|
||||||
|
PUTSTR(temp);
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
#include "openport.h"
|
||||||
|
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#include <langinfo.h>
|
#include <langinfo.h>
|
||||||
@ -57,10 +59,9 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
FILE *pTty;
|
FILE *pTty;
|
||||||
char *p, *tty, temp[PATH_MAX];
|
char *p, *tty, temp[PATH_MAX];
|
||||||
int i;
|
int i, rc;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
|
|
||||||
printf("Loading MBSE BBS ...\n");
|
|
||||||
pTTY = calloc(15, sizeof(char));
|
pTTY = calloc(15, sizeof(char));
|
||||||
tty = ttyname(1);
|
tty = ttyname(1);
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ int main(int argc, char **argv)
|
|||||||
} else if (getenv("USER") != NULL) {
|
} else if (getenv("USER") != NULL) {
|
||||||
strcpy(sUnixName, getenv("USER"));
|
strcpy(sUnixName, getenv("USER"));
|
||||||
} else {
|
} else {
|
||||||
WriteError("No username in environment");
|
fprintf(stderr, "No username in environment\n");
|
||||||
Quick_Bye(MBERR_OK);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,10 +105,18 @@ int main(int argc, char **argv)
|
|||||||
InitClient(sUnixName, (char *)"mbsebbs", (char *)"Unknown", CFG.logfile,
|
InitClient(sUnixName, (char *)"mbsebbs", (char *)"Unknown", CFG.logfile,
|
||||||
CFG.bbs_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
CFG.bbs_loglevel, CFG.error_log, CFG.mgrlog, CFG.debuglog);
|
||||||
IsDoing("Loging in");
|
IsDoing("Loging in");
|
||||||
|
|
||||||
Syslog(' ', " ");
|
Syslog(' ', " ");
|
||||||
Syslog(' ', "MBSEBBS v%s", VERSION);
|
Syslog(' ', "MBSEBBS v%s", VERSION);
|
||||||
|
|
||||||
|
if ((rc = rawport()) != 0) {
|
||||||
|
WriteError("Unable to set raw mode");
|
||||||
|
Quick_Bye(MBERR_OK);;
|
||||||
|
}
|
||||||
|
|
||||||
|
PUTSTR((char *)"Loading MBSE BBS ...");
|
||||||
|
PUTCHAR('\r');
|
||||||
|
PUTCHAR('\n');
|
||||||
|
|
||||||
if ((p = getenv("CONNECT")) != NULL)
|
if ((p = getenv("CONNECT")) != NULL)
|
||||||
Syslog('+', "CONNECT %s", p);
|
Syslog('+', "CONNECT %s", p);
|
||||||
if ((p = getenv("CALLER_ID")) != NULL)
|
if ((p = getenv("CALLER_ID")) != NULL)
|
||||||
@ -142,8 +151,8 @@ int main(int argc, char **argv)
|
|||||||
/*
|
/*
|
||||||
* Trap signals
|
* Trap signals
|
||||||
*/
|
*/
|
||||||
for(i = 0; i < NSIG; i++) {
|
for (i = 0; i < NSIG; i++) {
|
||||||
if ((i == SIGHUP) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
if ((i == SIGHUP) || (i == SIGPIPE) || (i == SIGBUS) || (i == SIGILL) || (i == SIGSEGV) || (i == SIGTERM))
|
||||||
signal(i, (void (*))die);
|
signal(i, (void (*))die);
|
||||||
else if (i == SIGCHLD)
|
else if (i == SIGCHLD)
|
||||||
signal(i, SIG_DFL);
|
signal(i, SIG_DFL);
|
||||||
@ -170,10 +179,10 @@ int main(int argc, char **argv)
|
|||||||
clear();
|
clear();
|
||||||
DisplayLogo();
|
DisplayLogo();
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
sprintf(temp, "MBSE BBS v%s (Release: %s) on %s/%s", VERSION, ReleaseDate, OsName(), OsCPU());
|
||||||
printf("MBSE BBS v%s (Release: %s) on %s/%s\n", VERSION, ReleaseDate, OsName(), OsCPU());
|
poutCR(YELLOW, BLACK, temp);
|
||||||
colour(WHITE, BLACK);
|
pout(WHITE, BLACK, (char *)COPYRIGHT);
|
||||||
printf("%s\n\n", COPYRIGHT);
|
Enter(2);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check users homedirectory, some *nix systems let users in if no
|
* Check users homedirectory, some *nix systems let users in if no
|
||||||
@ -181,7 +190,8 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
sprintf(temp, "%s/%s", CFG.bbs_usersdir, sUnixName);
|
sprintf(temp, "%s/%s", CFG.bbs_usersdir, sUnixName);
|
||||||
if (stat(temp, &sb)) {
|
if (stat(temp, &sb)) {
|
||||||
printf("No homedirectory\n\n");
|
sprintf(temp, "No homedirectory\r\n\r\n");
|
||||||
|
PUTSTR(temp);
|
||||||
WriteError("homedirectory %s doesn't exist", temp);
|
WriteError("homedirectory %s doesn't exist", temp);
|
||||||
Quick_Bye(MBERR_OK);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
@ -204,7 +214,8 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
if ((strcmp(ttyinfo.tty, pTTY) != 0) || (!ttyinfo.available)) {
|
||||||
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
Syslog('+', "No BBS allowed on port \"%s\"", pTTY);
|
||||||
printf("No BBS on this port allowed!\n\n");
|
sprintf(temp, "No BBS on this port allowed!\r\n\r\n");
|
||||||
|
PUTSTR(temp);
|
||||||
Free_Language();
|
Free_Language();
|
||||||
Quick_Bye(MBERR_OK);
|
Quick_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
@ -214,10 +225,12 @@ int main(int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (CFG.iConnectString) {
|
if (CFG.iConnectString) {
|
||||||
/* Connected on port */
|
/* Connected on port */
|
||||||
colour(CYAN, BLACK);
|
sprintf(temp, "%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
|
||||||
printf("%s\"%s\" ", (char *) Language(348), ttyinfo.comment);
|
pout(CYAN, BLACK, temp);
|
||||||
/* on */
|
/* on */
|
||||||
printf("%s %s\n", (char *) Language(135), ctime(<ime));
|
sprintf(temp, "%s %s", (char *) Language(135), ctime(<ime));
|
||||||
|
PUTSTR(temp);
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
#include "lastcallers.h"
|
#include "lastcallers.h"
|
||||||
#include "signature.h"
|
#include "signature.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern pid_t mypid;
|
extern pid_t mypid;
|
||||||
@ -90,7 +91,7 @@ void menu()
|
|||||||
{
|
{
|
||||||
FILE *pMenuFile;
|
FILE *pMenuFile;
|
||||||
int iFoundKey = FALSE, Key, IsANSI;
|
int iFoundKey = FALSE, Key, IsANSI;
|
||||||
char *Input, *sMenuPathFileName, buf[81];
|
char temp[81], *Input, *sMenuPathFileName, buf[81];
|
||||||
|
|
||||||
Input = calloc(PATH_MAX, sizeof(char));
|
Input = calloc(PATH_MAX, sizeof(char));
|
||||||
sMenuPathFileName = calloc(PATH_MAX, sizeof(char));
|
sMenuPathFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -127,7 +128,8 @@ void menu()
|
|||||||
*/
|
*/
|
||||||
if (MenuError == 10) {
|
if (MenuError == 10) {
|
||||||
WriteError("FATAL ERROR: Too many menu errors");
|
WriteError("FATAL ERROR: Too many menu errors");
|
||||||
printf("Too many menu errors, notifying Sysop\n\n");
|
sprintf(temp, "Too many menu errors, notifying Sysop\r\n\r\n");
|
||||||
|
PUTSTR(temp);
|
||||||
sleep(3);
|
sleep(3);
|
||||||
die(MBERR_CONFIG_ERROR);
|
die(MBERR_CONFIG_ERROR);
|
||||||
}
|
}
|
||||||
@ -179,7 +181,9 @@ void menu()
|
|||||||
if (IsSema((char *)"upsdown")) {
|
if (IsSema((char *)"upsdown")) {
|
||||||
fclose(pMenuFile);
|
fclose(pMenuFile);
|
||||||
Syslog('+', "Kicking user out, upsdown semafore detected");
|
Syslog('+', "Kicking user out, upsdown semafore detected");
|
||||||
printf("System power failure, closing the bbs\n\n");
|
sprintf(temp, "System power failure, closing the bbs");
|
||||||
|
PUTSTR(temp);
|
||||||
|
Enter(2);
|
||||||
sleep(3);
|
sleep(3);
|
||||||
Good_Bye(MBERR_OK);
|
Good_Bye(MBERR_OK);
|
||||||
}
|
}
|
||||||
@ -205,10 +209,9 @@ void menu()
|
|||||||
alarm_on();
|
alarm_on();
|
||||||
|
|
||||||
if (exitinfo.HotKeys) {
|
if (exitinfo.HotKeys) {
|
||||||
fflush(stdout);
|
Key = Readkey();
|
||||||
Key = Getone();
|
|
||||||
sprintf(Input, "%c", Key);
|
sprintf(Input, "%c", Key);
|
||||||
printf("\n");
|
Enter(1);
|
||||||
} else {
|
} else {
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(Input, 80);
|
GetstrC(Input, 80);
|
||||||
@ -381,7 +384,8 @@ void DoMenu(int Type)
|
|||||||
for (i = 0; i < strlen(menus.OptionalData); i++)
|
for (i = 0; i < strlen(menus.OptionalData); i++)
|
||||||
if (*(menus.OptionalData + i) == '@')
|
if (*(menus.OptionalData + i) == '@')
|
||||||
*(menus.OptionalData + i) = '\n';
|
*(menus.OptionalData + i) = '\n';
|
||||||
printf("%s\n", menus.OptionalData);
|
sprintf(temp, "%s\r\n", menus.OptionalData);
|
||||||
|
PUTSTR(temp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -743,7 +747,7 @@ void DisplayMenu(void)
|
|||||||
if ( ( dpos + 1 ) == maxdpos ) {
|
if ( ( dpos + 1 ) == maxdpos ) {
|
||||||
skipCRLF=1;
|
skipCRLF=1;
|
||||||
} else {
|
} else {
|
||||||
printf("%c",menus.Display[ dpos ]);
|
PUTCHAR(menus.Display[ dpos ]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -751,7 +755,7 @@ void DisplayMenu(void)
|
|||||||
escaped = 1;
|
escaped = 1;
|
||||||
} else {
|
} else {
|
||||||
escaped = 0;
|
escaped = 0;
|
||||||
printf("%c",menus.Display[ dpos ]);
|
PUTCHAR(menus.Display[ dpos ]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -767,17 +771,17 @@ void DisplayMenu(void)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
escaped=0;
|
escaped=0;
|
||||||
printf("%c",menus.Display[ dpos ]);
|
PUTCHAR(menus.Display[ dpos ]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: /* all other characters */
|
default: /* all other characters */
|
||||||
printf("%c",menus.Display[ dpos ]);
|
PUTCHAR(menus.Display[ dpos ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !skipCRLF ) {
|
if ( !skipCRLF ) {
|
||||||
printf("\n");
|
Enter(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,12 +32,15 @@
|
|||||||
#include "../lib/mbselib.h"
|
#include "../lib/mbselib.h"
|
||||||
#include "../lib/mbse.h"
|
#include "../lib/mbse.h"
|
||||||
#include "../lib/users.h"
|
#include "../lib/users.h"
|
||||||
|
#include "../lib/msg.h"
|
||||||
#include "funcs.h"
|
#include "funcs.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "exitinfo.h"
|
#include "exitinfo.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
#include "term.h"
|
||||||
|
|
||||||
|
|
||||||
extern char *StartTime; /* Time user logged in */
|
extern char *StartTime; /* Time user logged in */
|
||||||
@ -113,14 +116,17 @@ void DisplayLogo()
|
|||||||
char *sString, *temp;
|
char *sString, *temp;
|
||||||
|
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
sString = calloc(81, sizeof(char));
|
sString = calloc(1024, sizeof(char));
|
||||||
|
|
||||||
sprintf(temp, "%s/%s", CFG.bbs_txtfiles, CFG.welcome_logo);
|
sprintf(temp, "%s/%s", CFG.bbs_txtfiles, CFG.welcome_logo);
|
||||||
if ((pLogo = fopen(temp,"rb")) == NULL)
|
if ((pLogo = fopen(temp,"rb")) == NULL)
|
||||||
WriteError("$DisplayLogo: Can't open %s", temp);
|
WriteError("$DisplayLogo: Can't open %s", temp);
|
||||||
else {
|
else {
|
||||||
while (fgets(sString, 80, pLogo) != NULL)
|
while (Fgets(sString, 1023, pLogo) != NULL) {
|
||||||
printf("%s", sString);
|
// Striplf(sString);
|
||||||
|
PUTSTR(sString);
|
||||||
|
Enter(1);
|
||||||
|
}
|
||||||
fclose(pLogo);
|
fclose(pLogo);
|
||||||
}
|
}
|
||||||
free(sString);
|
free(sString);
|
||||||
|
@ -36,62 +36,61 @@
|
|||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "morefile.h"
|
#include "morefile.h"
|
||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
int MoreFile(char *filename)
|
int MoreFile(char *filename)
|
||||||
{
|
{
|
||||||
char Buf[81];
|
char Buf[81];
|
||||||
static FILE *fptr;
|
static FILE *fptr;
|
||||||
int lines;
|
int lines, input, ignore = FALSE, maxlines;
|
||||||
int input;
|
|
||||||
int ignore = FALSE;
|
|
||||||
int maxlines;
|
|
||||||
|
|
||||||
maxlines = lines = exitinfo.iScreenLen - 2;
|
maxlines = lines = exitinfo.iScreenLen - 2;
|
||||||
|
|
||||||
if ((fptr = fopen(filename,"r")) == NULL) {
|
if ((fptr = fopen(filename,"r")) == NULL) {
|
||||||
printf("%s%s\n", (char *) Language(72), filename);
|
sprintf(Buf, "%s%s", (char *) Language(72), filename);
|
||||||
|
pout(LIGHTRED, BLACK, Buf);
|
||||||
|
Enter(2);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
|
while (fgets(Buf,80,fptr) != NULL) {
|
||||||
|
if ((lines != 0) || (ignore)) {
|
||||||
|
lines--;
|
||||||
|
PUTSTR(Buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strlen(Buf) == 0) {
|
||||||
|
fclose(fptr);
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
if (lines == 0) {
|
||||||
|
/* More (Y/n/=) */
|
||||||
|
sprintf(Buf, " %sY\x08", (char *) Language(61));
|
||||||
|
PUTSTR(Buf);
|
||||||
|
alarm_on();
|
||||||
|
input = toupper(getchar());
|
||||||
|
|
||||||
|
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
||||||
|
lines = maxlines;
|
||||||
|
|
||||||
|
if (input == Keystroke(61, 1)) {
|
||||||
|
fclose(fptr);
|
||||||
return(0);
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (input == Keystroke(61, 2))
|
||||||
|
ignore = TRUE;
|
||||||
|
else
|
||||||
|
lines = maxlines;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
printf("\n");
|
Pause();
|
||||||
|
fclose(fptr);
|
||||||
while (fgets(Buf,80,fptr) != NULL) {
|
return 1;
|
||||||
if ((lines != 0) || (ignore)) {
|
|
||||||
lines--;
|
|
||||||
printf("%s",Buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen(Buf) == 0) {
|
|
||||||
fclose(fptr);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
if (lines == 0) {
|
|
||||||
fflush(stdin);
|
|
||||||
/* More (Y/n/=) */
|
|
||||||
printf(" %sY\x08", (char *) Language(61));
|
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
|
||||||
input = toupper(getchar());
|
|
||||||
|
|
||||||
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
|
||||||
lines = maxlines;
|
|
||||||
|
|
||||||
if (input == Keystroke(61, 1)) {
|
|
||||||
fclose(fptr);
|
|
||||||
return(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input == Keystroke(61, 2))
|
|
||||||
ignore = TRUE;
|
|
||||||
else
|
|
||||||
lines = maxlines;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Pause();
|
|
||||||
fclose(fptr);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
#include "change.h"
|
#include "change.h"
|
||||||
#include "dispfile.h"
|
#include "dispfile.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
#include "openport.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -105,7 +108,6 @@ int newuser()
|
|||||||
|
|
||||||
/* Please enter your First and Last name: */
|
/* Please enter your First and Last name: */
|
||||||
language(CYAN, BLACK, 0);
|
language(CYAN, BLACK, 0);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
Getname(temp, 35);
|
Getname(temp, 35);
|
||||||
strcpy(FullName, tlcap(temp));
|
strcpy(FullName, tlcap(temp));
|
||||||
@ -148,14 +150,12 @@ int newuser()
|
|||||||
Enter(1);
|
Enter(1);
|
||||||
/* Please enter new password : */
|
/* Please enter new password : */
|
||||||
language(LIGHTCYAN, BLACK, 39);
|
language(LIGHTCYAN, BLACK, 39);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
Getpass(temp1);
|
Getpass(temp1);
|
||||||
if ((x = strlen(temp1)) >= CFG.password_length) {
|
if ((x = strlen(temp1)) >= CFG.password_length) {
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Please enter password again : */
|
/* Please enter password again : */
|
||||||
language(LIGHTCYAN, BLACK, 40);
|
language(LIGHTCYAN, BLACK, 40);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
Getpass(temp2);
|
Getpass(temp2);
|
||||||
if ((i = strcmp(temp1,temp2)) != 0) {
|
if ((i = strcmp(temp1,temp2)) != 0) {
|
||||||
@ -171,7 +171,8 @@ int newuser()
|
|||||||
Enter(2);
|
Enter(2);
|
||||||
/* Your password must contain at least */
|
/* Your password must contain at least */
|
||||||
language(LIGHTRED, BLACK, 42);
|
language(LIGHTRED, BLACK, 42);
|
||||||
printf("%d ", CFG.password_length);
|
sprintf(temp, "%d ", CFG.password_length);
|
||||||
|
PUTSTR(temp);
|
||||||
/* characters! Try again. */
|
/* characters! Try again. */
|
||||||
language(WHITE, BLACK, 43);
|
language(WHITE, BLACK, 43);
|
||||||
Enter(1);
|
Enter(1);
|
||||||
@ -218,7 +219,6 @@ int newuser()
|
|||||||
|
|
||||||
pout(LIGHTGREEN, BLACK, (char *)": ");
|
pout(LIGHTGREEN, BLACK, (char *)": ");
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
GetPhone(temp, 16);
|
GetPhone(temp, 16);
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ int newuser()
|
|||||||
} /* End of if Statement */
|
} /* End of if Statement */
|
||||||
|
|
||||||
if (!CFG.iDataPhone)
|
if (!CFG.iDataPhone)
|
||||||
printf("\n");
|
Enter(1);
|
||||||
|
|
||||||
if (CFG.iLocation) {
|
if (CFG.iLocation) {
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
@ -279,7 +279,6 @@ int newuser()
|
|||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
alarm_on();
|
alarm_on();
|
||||||
if (CFG.iCapLocation) { /* Cap Location is turned on, Capitalise first letter */
|
if (CFG.iCapLocation) { /* Cap Location is turned on, Capitalise first letter */
|
||||||
fflush(stdout);
|
|
||||||
GetnameNE(temp, 24);
|
GetnameNE(temp, 24);
|
||||||
} else
|
} else
|
||||||
GetstrC(temp, 80);
|
GetstrC(temp, 80);
|
||||||
@ -289,7 +288,8 @@ int newuser()
|
|||||||
/* Please enter a longer location */
|
/* Please enter a longer location */
|
||||||
language(LIGHTRED, BLACK, 50);
|
language(LIGHTRED, BLACK, 50);
|
||||||
Enter(1);
|
Enter(1);
|
||||||
printf("%s%d)", (char *) Language(74), CFG.CityLen);
|
sprintf(temp, "%s%d)", (char *) Language(74), CFG.CityLen);
|
||||||
|
PUTSTR(temp);
|
||||||
Enter(1);
|
Enter(1);
|
||||||
} else {
|
} else {
|
||||||
strcpy(usrconfig.sLocation, temp);
|
strcpy(usrconfig.sLocation, temp);
|
||||||
@ -306,10 +306,9 @@ int newuser()
|
|||||||
language(LIGHTMAGENTA, BLACK, 474);
|
language(LIGHTMAGENTA, BLACK, 474);
|
||||||
Enter(1);
|
Enter(1);
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
colour(YELLOW, BLACK);
|
sprintf(temp, "%d: ", i+1);
|
||||||
printf("%d: ", i+1);
|
pout(YELLOW, BLACK, temp);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
GetstrC(usrconfig.address[i], 40);
|
GetstrC(usrconfig.address[i], 40);
|
||||||
}
|
}
|
||||||
@ -328,7 +327,6 @@ int newuser()
|
|||||||
/* Enter a handle (Enter to Quit): */
|
/* Enter a handle (Enter to Quit): */
|
||||||
language(LIGHTRED, BLACK, 412);
|
language(LIGHTRED, BLACK, 412);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
Getname(temp, 34);
|
Getname(temp, 34);
|
||||||
|
|
||||||
@ -356,9 +354,8 @@ int newuser()
|
|||||||
/* What is your sex? (M)ale or (F)emale: */
|
/* What is your sex? (M)ale or (F)emale: */
|
||||||
language(LIGHTBLUE, BLACK, 51);
|
language(LIGHTBLUE, BLACK, 51);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
i = toupper(Getone());
|
i = toupper(Readkey());
|
||||||
|
|
||||||
if (i == Keystroke(51, 0)) {
|
if (i == Keystroke(51, 0)) {
|
||||||
/* Male */
|
/* Male */
|
||||||
@ -388,7 +385,6 @@ int newuser()
|
|||||||
/* Please enter your Date of Birth DD-MM-YYYY: */
|
/* Please enter your Date of Birth DD-MM-YYYY: */
|
||||||
pout(CYAN, BLACK, (char *) Language(56));
|
pout(CYAN, BLACK, (char *) Language(56));
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
GetDate(temp, 10);
|
GetDate(temp, 10);
|
||||||
|
|
||||||
@ -454,7 +450,6 @@ int newuser()
|
|||||||
/* Please enter your Screen Length [24]: */
|
/* Please enter your Screen Length [24]: */
|
||||||
pout(LIGHTMAGENTA, BLACK, (char *) Language(64));
|
pout(LIGHTMAGENTA, BLACK, (char *) Language(64));
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
Getnum(temp, 3);
|
Getnum(temp, 3);
|
||||||
|
|
||||||
@ -572,15 +567,16 @@ int newuser()
|
|||||||
/* Login Name : */
|
/* Login Name : */
|
||||||
pout(LIGHTBLUE, BLACK, (char *) Language(68));
|
pout(LIGHTBLUE, BLACK, (char *) Language(68));
|
||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
printf("%s (%s)\n", UnixName, FullName);
|
sprintf(temp, "%s (%s)", UnixName, FullName);
|
||||||
|
PUTSTR(temp);
|
||||||
|
Enter(1);
|
||||||
/* Password : */
|
/* Password : */
|
||||||
pout(LIGHTBLUE, BLACK, (char *) Language(69));
|
pout(LIGHTBLUE, BLACK, (char *) Language(69));
|
||||||
pout(CYAN, BLACK, (char *)"<");
|
pout(CYAN, BLACK, (char *)"<");
|
||||||
/* not displayed */
|
/* not displayed */
|
||||||
pout(WHITE, BLACK, (char *) Language(70));
|
pout(WHITE, BLACK, (char *) Language(70));
|
||||||
pout(CYAN, BLACK, (char *)">\n\n");
|
pout(CYAN, BLACK, (char *)">");
|
||||||
fflush(stdout);
|
Enter(2);
|
||||||
fflush(stdin);
|
|
||||||
|
|
||||||
if (CFG.iVoicePhone && TelephoneScan(Phone1, FullName))
|
if (CFG.iVoicePhone && TelephoneScan(Phone1, FullName))
|
||||||
Syslog('!', "Duplicate phone numbers found");
|
Syslog('!', "Duplicate phone numbers found");
|
||||||
@ -597,8 +593,7 @@ int newuser()
|
|||||||
|
|
||||||
Syslog('+', "Completed new-user procedure");
|
Syslog('+', "Completed new-user procedure");
|
||||||
/* New user registration completed. */
|
/* New user registration completed. */
|
||||||
pout(LIGHTGREEN, BLACK, (char *) Language(71));
|
poutCR(LIGHTGREEN, BLACK, (char *) Language(71));
|
||||||
Enter(1);
|
|
||||||
/* You need to login again with the name: */
|
/* You need to login again with the name: */
|
||||||
pout(LIGHTRED, BLACK, (char *) Language(5));
|
pout(LIGHTRED, BLACK, (char *) Language(5));
|
||||||
pout(YELLOW, BLACK, UnixName);
|
pout(YELLOW, BLACK, UnixName);
|
||||||
@ -606,7 +601,7 @@ int newuser()
|
|||||||
alarm_on();
|
alarm_on();
|
||||||
Pause();
|
Pause();
|
||||||
alarm_off();
|
alarm_off();
|
||||||
printf("\n");
|
Enter(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -615,7 +610,7 @@ int newuser()
|
|||||||
void Fast_Bye(int onsig)
|
void Fast_Bye(int onsig)
|
||||||
{
|
{
|
||||||
char *temp;
|
char *temp;
|
||||||
time_t t_end;
|
time_t t_end;
|
||||||
|
|
||||||
t_end = time(NULL);
|
t_end = time(NULL);
|
||||||
Syslog(' ', "MBNEWUSR finished in %s", t_elapsed(t_start, t_end));
|
Syslog(' ', "MBNEWUSR finished in %s", t_elapsed(t_start, t_end));
|
||||||
@ -627,10 +622,11 @@ void Fast_Bye(int onsig)
|
|||||||
free(temp);
|
free(temp);
|
||||||
|
|
||||||
colour(LIGHTGRAY, BLACK);
|
colour(LIGHTGRAY, BLACK);
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
|
cookedport();
|
||||||
|
hangup();
|
||||||
|
|
||||||
Free_Language();
|
Free_Language();
|
||||||
free(pTTY);
|
free(pTTY);
|
||||||
exit(MBERR_OK);
|
exit(MBERR_OK);
|
||||||
@ -661,24 +657,22 @@ char *NameGen(char *FidoName)
|
|||||||
Syslog('+', "NameGen(%s)", FidoName);
|
Syslog('+', "NameGen(%s)", FidoName);
|
||||||
|
|
||||||
while ((strcmp(sUserName, "") == 0) || (CheckUnixNames(sUserName)) || (strlen(sUserName) < 3)) {
|
while ((strcmp(sUserName, "") == 0) || (CheckUnixNames(sUserName)) || (strlen(sUserName) < 3)) {
|
||||||
colour(LIGHTRED, BLACK);
|
Enter(1);
|
||||||
printf("\n%s\n\n", (char *) Language(381));
|
pout(LIGHTRED, BLACK, (char *) Language(381));
|
||||||
colour(WHITE, BLACK);
|
Enter(2);
|
||||||
/* Please enter a login name (Maximum 8 characters) */
|
/* Please enter a login name (Maximum 8 characters) */
|
||||||
printf("\n%s\n", (char *) Language(383));
|
poutCR(WHITE, BLACK, (char *) Language(383));
|
||||||
/* ie. John Doe, login = jdoe */
|
/* ie. John Doe, login = jdoe */
|
||||||
printf("%s\n", (char *) Language(384));
|
poutCR(WHITE, BLACK, (char *) Language(384));
|
||||||
colour(LIGHTGREEN, BLACK);
|
|
||||||
/* login > */
|
/* login > */
|
||||||
printf("%s", (char *) Language(385));
|
pout(LIGHTGREEN, BLACK, (char *) Language(385));
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
GetstrU(sUserName, 7);
|
GetstrU(sUserName, 7);
|
||||||
|
|
||||||
if (CheckUnixNames(sUserName)) {
|
if (CheckUnixNames(sUserName)) {
|
||||||
|
Enter(1);
|
||||||
/* That login name already exists, please choose another one. */
|
/* That login name already exists, please choose another one. */
|
||||||
colour(LIGHTRED, BLACK);
|
poutCR(LIGHTRED, BLACK, (char *) Language(386));
|
||||||
printf("\n%s\n", (char *) Language(386));
|
|
||||||
Syslog('+', "Users tried to use \"%s\" as Unix name", MBSE_SS(sUserName));
|
Syslog('+', "Users tried to use \"%s\" as Unix name", MBSE_SS(sUserName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -705,8 +699,6 @@ char *NameCreate(char *Name, char *Comment, char *Password)
|
|||||||
*/
|
*/
|
||||||
sprintf(progname, "%s/bin/mbuseradd", getenv("MBSE_ROOT"));
|
sprintf(progname, "%s/bin/mbuseradd", getenv("MBSE_ROOT"));
|
||||||
sprintf(gidstr, "%d", getgid());
|
sprintf(gidstr, "%d", getgid());
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
args[0] = progname;
|
args[0] = progname;
|
||||||
args[1] = gidstr;
|
args[1] = gidstr;
|
||||||
args[2] = Name;
|
args[2] = Name;
|
||||||
@ -729,8 +721,6 @@ char *NameCreate(char *Name, char *Comment, char *Password)
|
|||||||
args[2] = Name;
|
args[2] = Name;
|
||||||
args[3] = Password;
|
args[3] = Password;
|
||||||
args[4] = NULL;
|
args[4] = NULL;
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
|
|
||||||
if ((err = execute(args, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))) {
|
if ((err = execute(args, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))) {
|
||||||
WriteError("Failed to set unix password");
|
WriteError("Failed to set unix password");
|
||||||
@ -738,9 +728,9 @@ char *NameCreate(char *Name, char *Comment, char *Password)
|
|||||||
ExitClient(MBERR_GENERAL);
|
ExitClient(MBERR_GENERAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
Enter(1);
|
||||||
/* Your "Unix Account" is created, you may use it the next time you call */
|
/* Your "Unix Account" is created, you may use it the next time you call */
|
||||||
printf("\n%s\n", (char *) Language(382));
|
poutCR(YELLOW, BLACK, (char *) Language(382));
|
||||||
Syslog('+', "Created Unix account %s for %s", Name, Comment);
|
Syslog('+', "Created Unix account %s for %s", Name, Comment);
|
||||||
|
|
||||||
free(progname);
|
free(progname);
|
||||||
@ -770,7 +760,9 @@ int BadNames(char *Username)
|
|||||||
strcpy(String, tl(String));
|
strcpy(String, tl(String));
|
||||||
Striplf(String);
|
Striplf(String);
|
||||||
if ((strstr(User, String)) != NULL) {
|
if ((strstr(User, String)) != NULL) {
|
||||||
printf("\nSorry that name is not acceptable on this system\n");
|
Enter(1);
|
||||||
|
pout(LIGHTRED, BLACK, (char *)"Sorry that name is not acceptable on this system");
|
||||||
|
Enter(1);
|
||||||
Syslog('+', "User tried username \"%s\", found in %s", Username, temp);
|
Syslog('+', "User tried username \"%s\", found in %s", Username, temp);
|
||||||
iFoundName = TRUE;
|
iFoundName = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -48,6 +48,9 @@
|
|||||||
#include "offline.h"
|
#include "offline.h"
|
||||||
#include "whoson.h"
|
#include "whoson.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
#include "openport.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
long Total, TotalPersonal, Current, Personal;
|
long Total, TotalPersonal, Current, Personal;
|
||||||
@ -100,7 +103,6 @@ void AddArc(char *Temp, char *Pktname)
|
|||||||
execute_str((char *)archiver.marc, Pktname, Temp, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
execute_str((char *)archiver.marc, Pktname, Temp, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
||||||
unlink(Temp);
|
unlink(Temp);
|
||||||
printf(".");
|
printf(".");
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -140,14 +142,12 @@ void UpdateLR(msg_high *mhl, FILE *mf)
|
|||||||
char *p;
|
char *p;
|
||||||
msg_high *tmp;
|
msg_high *tmp;
|
||||||
|
|
||||||
colour(YELLOW, BLACK);
|
|
||||||
/* Updating lastread pointer */
|
/* Updating lastread pointer */
|
||||||
printf("%s\n", (char *)Language(449));
|
poutCR(YELLOW, BLACK, (char *)Language(449));
|
||||||
colour(LIGHTMAGENTA, BLACK);
|
colour(LIGHTMAGENTA, BLACK);
|
||||||
|
|
||||||
for (tmp = mhl; tmp; tmp = tmp->next) {
|
for (tmp = mhl; tmp; tmp = tmp->next) {
|
||||||
printf(".");
|
PUTCHAR('.');
|
||||||
fflush(stdout);
|
|
||||||
fseek(mf, ((tmp->Area -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET);
|
fseek(mf, ((tmp->Area -1) * (msgshdr.recsize + msgshdr.syssize)) + msgshdr.hdrsize, SEEK_SET);
|
||||||
fread(&msgs, msgshdr.recsize, 1, mf);
|
fread(&msgs, msgshdr.recsize, 1, mf);
|
||||||
if (Msg_Open(msgs.Base)) {
|
if (Msg_Open(msgs.Base)) {
|
||||||
@ -224,7 +224,7 @@ void OLR_TagArea()
|
|||||||
{
|
{
|
||||||
char *Msgname, *Tagname;
|
char *Msgname, *Tagname;
|
||||||
FILE *ma, *tf;
|
FILE *ma, *tf;
|
||||||
char *buf;
|
char *buf, msg[81];
|
||||||
long total, Offset, Area;
|
long total, Offset, Area;
|
||||||
int lines, input, ignore = FALSE, maxlines;
|
int lines, input, ignore = FALSE, maxlines;
|
||||||
|
|
||||||
@ -238,22 +238,20 @@ void OLR_TagArea()
|
|||||||
sprintf(Tagname, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
sprintf(Tagname, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
colour(YELLOW, BLACK);
|
|
||||||
/* Tag Offline Reader message areas */
|
/* Tag Offline Reader message areas */
|
||||||
printf("%s\n", (char *)Language(66));
|
poutCR(YELLOW, BLACK, (char *)Language(66));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
colour(WHITE, BLACK);
|
Enter(1);
|
||||||
/* Enter the name of the conference, or ? for a list: */
|
/* Enter the name of the conference, or ? for a list: */
|
||||||
printf("\n%s", (char *)Language(228));
|
pout(WHITE, BLACK, (char *)Language(228));
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(buf, 20);
|
GetstrC(buf, 20);
|
||||||
|
|
||||||
if (buf[0] == '?') {
|
if (buf[0] == '?') {
|
||||||
maxlines = lines = exitinfo.iScreenLen - 1;
|
maxlines = lines = exitinfo.iScreenLen - 1;
|
||||||
colour(LIGHTCYAN, BLACK);
|
|
||||||
/* Conference Area Msgs Description */
|
/* Conference Area Msgs Description */
|
||||||
printf("%s\n", (char *)Language(229));
|
poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
|
||||||
if ((ma = fopen(Msgname, "r")) != NULL) {
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
||||||
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
||||||
Area = 0;
|
Area = 0;
|
||||||
@ -267,21 +265,20 @@ void OLR_TagArea()
|
|||||||
Msg_Close();
|
Msg_Close();
|
||||||
} else
|
} else
|
||||||
total = 0;
|
total = 0;
|
||||||
colour(CYAN, BLACK);
|
|
||||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && (!olrtagrec.Tagged) && strlen(msgs.QWKname)) {
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && (!olrtagrec.Tagged) && strlen(msgs.QWKname)) {
|
||||||
if ( (lines != 0) || (ignore) ) {
|
if ( (lines != 0) || (ignore) ) {
|
||||||
lines--;
|
lines--;
|
||||||
printf("%-20.20s %-5ld %-5ld %s\n", msgs.QWKname, Area, total, msgs.Name);
|
sprintf(msg, "%-20.20s %-5ld %-5ld %s", msgs.QWKname, Area, total, msgs.Name);
|
||||||
|
poutCR(CYAN, BLACK, msg);
|
||||||
}
|
}
|
||||||
if (lines == 0) {
|
if (lines == 0) {
|
||||||
fflush(stdin);
|
|
||||||
colour(WHITE, BLACK);
|
|
||||||
/* More (Y/n/=) */
|
/* More (Y/n/=) */
|
||||||
printf("%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
sprintf(msg, "%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
||||||
fflush(stdout);
|
pout(WHITE, BLACK, msg);
|
||||||
alarm_on();
|
alarm_on();
|
||||||
input = toupper(Getone());
|
input = toupper(Readkey());
|
||||||
printf("%c\r",input);
|
PUTCHAR(input);
|
||||||
|
PUTCHAR('\r');
|
||||||
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
||||||
lines = maxlines;
|
lines = maxlines;
|
||||||
|
|
||||||
@ -366,7 +363,7 @@ void OLR_TagArea()
|
|||||||
*/
|
*/
|
||||||
void OLR_UntagArea()
|
void OLR_UntagArea()
|
||||||
{
|
{
|
||||||
char *Msgname, *Tagname, *buf;
|
char *Msgname, *Tagname, *buf, msg[81];
|
||||||
FILE *ma, *tf;
|
FILE *ma, *tf;
|
||||||
long total, Offset, Area;
|
long total, Offset, Area;
|
||||||
int lines, input, ignore = FALSE, maxlines;
|
int lines, input, ignore = FALSE, maxlines;
|
||||||
@ -381,22 +378,20 @@ void OLR_UntagArea()
|
|||||||
sprintf(Tagname, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
sprintf(Tagname, "%s/%s/.olrtags", CFG.bbs_usersdir, exitinfo.Name);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
colour(YELLOW, BLACK);
|
|
||||||
/* Untag Offline Reader message areas */
|
/* Untag Offline Reader message areas */
|
||||||
printf("%s\n", (char *)Language(256));
|
poutCR(YELLOW, BLACK, (char *)Language(256));
|
||||||
|
|
||||||
do {
|
do {
|
||||||
colour(WHITE, BLACK);
|
Enter(1);
|
||||||
/* Enter the name of the conference, or ? for a list: */
|
/* Enter the name of the conference, or ? for a list: */
|
||||||
printf("\n%s", (char *)Language(228));
|
pout(WHITE, BLACK, (char *)Language(228));
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(buf, 20);
|
GetstrC(buf, 20);
|
||||||
|
|
||||||
if (buf[0] == '?') {
|
if (buf[0] == '?') {
|
||||||
maxlines = lines = exitinfo.iScreenLen - 1;
|
maxlines = lines = exitinfo.iScreenLen - 1;
|
||||||
colour(LIGHTCYAN, BLACK);
|
|
||||||
/* Conference Area Msgs Description */
|
/* Conference Area Msgs Description */
|
||||||
printf("%s\n", (char *)Language(229));
|
poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
|
||||||
if ((ma = fopen(Msgname, "r")) != NULL) {
|
if ((ma = fopen(Msgname, "r")) != NULL) {
|
||||||
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
||||||
Area = 0;
|
Area = 0;
|
||||||
@ -410,21 +405,20 @@ void OLR_UntagArea()
|
|||||||
Msg_Close();
|
Msg_Close();
|
||||||
} else
|
} else
|
||||||
total = 0;
|
total = 0;
|
||||||
colour(CYAN, BLACK);
|
|
||||||
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && olrtagrec.Tagged && strlen(msgs.QWKname)) {
|
if (msgs.Active && Access(exitinfo.Security, msgs.RDSec) && olrtagrec.Tagged && strlen(msgs.QWKname)) {
|
||||||
if ( (lines != 0) || (ignore) ) {
|
if ( (lines != 0) || (ignore) ) {
|
||||||
lines--;
|
lines--;
|
||||||
printf("%-20.20s %-5ld %-5ld %s\n", msgs.QWKname, Area, total, msgs.Name);
|
sprintf(msg, "%-20.20s %-5ld %-5ld %s", msgs.QWKname, Area, total, msgs.Name);
|
||||||
|
poutCR(CYAN, BLACK, msg);
|
||||||
}
|
}
|
||||||
if (lines == 0) {
|
if (lines == 0) {
|
||||||
fflush(stdin);
|
|
||||||
colour(WHITE, BLACK);
|
|
||||||
/* More (Y/n/=) */
|
/* More (Y/n/=) */
|
||||||
printf("%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
sprintf(msg, "%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
||||||
fflush(stdout);
|
pout(WHITE, BLACK, msg);
|
||||||
alarm_on();
|
alarm_on();
|
||||||
input = toupper(Getone());
|
input = toupper(Readkey());
|
||||||
printf("%c\r",input);
|
PUTCHAR(input);
|
||||||
|
PUTCHAR('\r');
|
||||||
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
||||||
lines = maxlines;
|
lines = maxlines;
|
||||||
|
|
||||||
@ -485,7 +479,7 @@ void OLR_UntagArea()
|
|||||||
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
fread(&olrtagrec, sizeof(olrtagrec), 1, tf);
|
||||||
if (olrtagrec.Tagged) {
|
if (olrtagrec.Tagged) {
|
||||||
if (msgs.OLR_Forced) {
|
if (msgs.OLR_Forced) {
|
||||||
printf("Area cannot be switched off\n");
|
poutCR(LIGHTRED, BLACK, (char *)"Area cannot be switched off");
|
||||||
} else {
|
} else {
|
||||||
olrtagrec.Tagged = FALSE;
|
olrtagrec.Tagged = FALSE;
|
||||||
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
fseek(tf, - sizeof(olrtagrec), SEEK_CUR);
|
||||||
@ -523,11 +517,12 @@ void New_Hdr()
|
|||||||
/* New or deleted mail areas at */
|
/* New or deleted mail areas at */
|
||||||
sprintf(temp, "%s%s", (char *) Language(364), CFG.bbs_name);
|
sprintf(temp, "%s%s", (char *) Language(364), CFG.bbs_name);
|
||||||
Center(temp);
|
Center(temp);
|
||||||
free(temp);
|
Enter(1);
|
||||||
printf("\n");
|
|
||||||
colour(WHITE, BLUE);
|
colour(WHITE, BLUE);
|
||||||
/* Area State Type Description */
|
/* Area State Type Description */
|
||||||
printf("%-79s\n", (char *) Language(365));
|
sprintf(temp, "%-79s", (char *) Language(365));
|
||||||
|
poutCR(WHITE, BLUE, temp);
|
||||||
|
free(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -535,21 +530,25 @@ void New_Hdr()
|
|||||||
void New_Area(long);
|
void New_Area(long);
|
||||||
void New_Area(long Area)
|
void New_Area(long Area)
|
||||||
{
|
{
|
||||||
colour(LIGHTCYAN, BLACK);
|
char msg[81];
|
||||||
|
|
||||||
/* New */
|
/* New */
|
||||||
printf("%4ld %s", Area, (char *)Language(391));
|
sprintf(msg, "%4ld %s", Area, (char *)Language(391));
|
||||||
|
pout(LIGHTCYAN, BLACK, msg);
|
||||||
|
|
||||||
switch (msgs.Type) {
|
switch (msgs.Type) {
|
||||||
case LOCALMAIL: printf(Language(392)); /* Local */
|
case LOCALMAIL: PUTSTR((char *)Language(392)); /* Local */
|
||||||
break;
|
break;
|
||||||
case NETMAIL: printf(Language(393)); /* Netmail */
|
case NETMAIL: PUTSTR((char *)Language(393)); /* Netmail */
|
||||||
break;
|
break;
|
||||||
case LIST:
|
case LIST:
|
||||||
case ECHOMAIL: printf(Language(394)); /* Echomail */
|
case ECHOMAIL: PUTSTR((char *)Language(394)); /* Echomail */
|
||||||
break;
|
break;
|
||||||
case NEWS: printf(Language(395)); /* News */
|
case NEWS: PUTSTR((char *)Language(395)); /* News */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
printf("%s\n", msgs.Name);
|
PUTSTR(msgs.Name);
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -557,9 +556,11 @@ void New_Area(long Area)
|
|||||||
void Old_Area(long);
|
void Old_Area(long);
|
||||||
void Old_Area(long Area)
|
void Old_Area(long Area)
|
||||||
{
|
{
|
||||||
colour(LIGHTRED, BLACK);
|
char msg[81];
|
||||||
|
|
||||||
/* Del */
|
/* Del */
|
||||||
printf("%4ld %s\n", Area, (char *)Language(397));
|
sprintf(msg, "%4ld %s", Area, (char *)Language(397));
|
||||||
|
poutCR(LIGHTRED, BLACK, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -710,7 +711,7 @@ void OLR_SyncTags()
|
|||||||
*/
|
*/
|
||||||
void OLR_ViewTags()
|
void OLR_ViewTags()
|
||||||
{
|
{
|
||||||
char *Tagname, *Msgname;
|
char *Tagname, *Msgname, msg[81];
|
||||||
FILE *tf, *ma;
|
FILE *tf, *ma;
|
||||||
long total, Area = 0;
|
long total, Area = 0;
|
||||||
int lines, input, ignore = FALSE, maxlines;
|
int lines, input, ignore = FALSE, maxlines;
|
||||||
@ -739,14 +740,12 @@ void OLR_ViewTags()
|
|||||||
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
fread(&msgshdr, sizeof(msgshdr), 1, ma);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
colour(YELLOW, BLACK);
|
|
||||||
/* You have selected the following Conference(s): */
|
/* You have selected the following Conference(s): */
|
||||||
printf ("%s\n", (char *)Language(260));
|
poutCR(YELLOW, BLACK, (char *)Language(260));
|
||||||
colour(LIGHTCYAN, BLACK);
|
Enter(1);
|
||||||
/* Conference Area Msgs Description */
|
/* Conference Area Msgs Description */
|
||||||
printf ("\n%s\n", (char *)Language(229));
|
poutCR(LIGHTCYAN, BLACK, (char *)Language(229));
|
||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
fflush(stdout);
|
|
||||||
maxlines = lines = exitinfo.iScreenLen - 1;
|
maxlines = lines = exitinfo.iScreenLen - 1;
|
||||||
|
|
||||||
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
while (fread(&msgs, msgshdr.recsize, 1, ma) == 1) {
|
||||||
@ -762,17 +761,18 @@ void OLR_ViewTags()
|
|||||||
total = 0;
|
total = 0;
|
||||||
if ( (lines != 0) || (ignore) ) {
|
if ( (lines != 0) || (ignore) ) {
|
||||||
lines--;
|
lines--;
|
||||||
printf("%-20.20s %-5ld %-5ld %s\n", msgs.QWKname, Area, total, msgs.Name);
|
sprintf(msg, "%-20.20s %-5ld %-5ld %s", msgs.QWKname, Area, total, msgs.Name);
|
||||||
|
PUTSTR(msg);
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
if (lines == 0) {
|
if (lines == 0) {
|
||||||
fflush(stdin);
|
|
||||||
colour(WHITE, BLACK);
|
|
||||||
/* More (Y/n/=) */
|
/* More (Y/n/=) */
|
||||||
printf("%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
sprintf(msg, "%s%c\x08", (char *) Language(61),Keystroke(61,0));
|
||||||
fflush(stdout);
|
pout(WHITE, BLACK, msg);
|
||||||
alarm_on();
|
alarm_on();
|
||||||
input = toupper(Getone());
|
input = toupper(Readkey());
|
||||||
printf("%c\r",input);
|
PUTCHAR(input);
|
||||||
|
PUTCHAR('\r');
|
||||||
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
if ((input == Keystroke(61, 0)) || (input == '\r'))
|
||||||
lines = maxlines;
|
lines = maxlines;
|
||||||
|
|
||||||
@ -785,7 +785,6 @@ void OLR_ViewTags()
|
|||||||
lines = maxlines;
|
lines = maxlines;
|
||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,16 +804,15 @@ int OLR_Prescan()
|
|||||||
{
|
{
|
||||||
unsigned short RetVal = FALSE, Areas;
|
unsigned short RetVal = FALSE, Areas;
|
||||||
unsigned long Number;
|
unsigned long Number;
|
||||||
char *Temp;
|
char *Temp, msg[81];
|
||||||
FILE *mf, *tf;
|
FILE *mf, *tf;
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
WhosDoingWhat(OLR, NULL);
|
WhosDoingWhat(OLR, NULL);
|
||||||
clear();
|
clear();
|
||||||
colour(LIGHTMAGENTA, BLACK);
|
|
||||||
/* Offline Reader Download */
|
/* Offline Reader Download */
|
||||||
printf("%s\n\n", (char *)Language(277));
|
pout(LIGHTMAGENTA, BLACK, (char *)Language(277));
|
||||||
fflush(stdout);
|
Enter(2);
|
||||||
|
|
||||||
if (exitinfo.Email)
|
if (exitinfo.Email)
|
||||||
check_popmail(exitinfo.Name, exitinfo.Password);
|
check_popmail(exitinfo.Name, exitinfo.Password);
|
||||||
@ -828,9 +826,10 @@ int OLR_Prescan()
|
|||||||
tf = fopen(Temp, "r");
|
tf = fopen(Temp, "r");
|
||||||
Total = TotalPersonal = Areas = 0;
|
Total = TotalPersonal = Areas = 0;
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
colour(WHITE, BLUE);
|
colour(WHITE, BLUE);
|
||||||
/* Forum Description Msgs. Pers. */
|
/* Forum Description Msgs. Pers. */
|
||||||
printf("\n%s\n", (char *)Language(297));
|
poutCR(WHITE, BLUE, (char *)Language(297));
|
||||||
|
|
||||||
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
while (fread(&msgs, msgshdr.recsize, 1, mf) == 1) {
|
||||||
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
fseek(mf, msgshdr.syssize, SEEK_CUR);
|
||||||
@ -840,9 +839,8 @@ int OLR_Prescan()
|
|||||||
if (Msg_Open(msgs.Base)) {
|
if (Msg_Open(msgs.Base)) {
|
||||||
Areas++;
|
Areas++;
|
||||||
Current = Personal = 0;
|
Current = Personal = 0;
|
||||||
colour(LIGHTCYAN, BLACK);
|
sprintf(msg, "%-20.20s %-41.41s ", msgs.QWKname, msgs.Name);
|
||||||
printf("%-20.20s %-41.41s ", msgs.QWKname, msgs.Name);
|
pout(LIGHTCYAN, BLACK, msg);
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
memset(&LR, 0, sizeof(LR));
|
memset(&LR, 0, sizeof(LR));
|
||||||
LR.UserID = grecno;
|
LR.UserID = grecno;
|
||||||
@ -867,9 +865,8 @@ int OLR_Prescan()
|
|||||||
} while (Msg_Next(&Number));
|
} while (Msg_Next(&Number));
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(LIGHTGREEN, BLACK);
|
sprintf(msg, "%5lu %5lu", Current, Personal);
|
||||||
printf("%5lu %5lu\n", Current, Personal);
|
poutCR(LIGHTGREEN, BLACK, msg);
|
||||||
fflush(stdout);
|
|
||||||
Msg_Close();
|
Msg_Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -877,27 +874,30 @@ int OLR_Prescan()
|
|||||||
|
|
||||||
Syslog('+', "OLR Prescan: %u Areas, %lu Messages", Areas, Total);
|
Syslog('+', "OLR Prescan: %u Areas, %lu Messages", Areas, Total);
|
||||||
|
|
||||||
colour(LIGHTBLUE, BLACK);
|
Enter(1);
|
||||||
/* Total messages found: */
|
/* Total messages found: */
|
||||||
printf("\n%s %lu\n\n", (char *)Language(338), Total);
|
sprintf(msg, "%s %lu", (char *)Language(338), Total);
|
||||||
|
pout(LIGHTBLUE, BLACK, msg);
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
if (Total == 0L) {
|
if (Total == 0L) {
|
||||||
colour(YELLOW, BLACK);
|
|
||||||
/* No messages found to download! */
|
/* No messages found to download! */
|
||||||
printf("%s\n\007", (char *)Language(374));
|
poutCR(YELLOW, BLACK, (char *)Language(374));
|
||||||
|
PUTCHAR('\007');
|
||||||
Pause();
|
Pause();
|
||||||
} else {
|
} else {
|
||||||
if (CFG.OLR_MaxMsgs != 0 && Total > CFG.OLR_MaxMsgs) {
|
if (CFG.OLR_MaxMsgs != 0 && Total > CFG.OLR_MaxMsgs) {
|
||||||
/* Too much messages. Only the first will be packed! */
|
/* Too much messages. Only the first will be packed! */
|
||||||
printf("%s %d %s\n\n\007", (char *)Language(377), CFG.OLR_MaxMsgs, (char *)Language(411));
|
sprintf(msg, "%s %d %s", (char *)Language(377), CFG.OLR_MaxMsgs, (char *)Language(411));
|
||||||
|
PUTCHAR('\007');
|
||||||
|
Enter(2);
|
||||||
Total = CFG.OLR_MaxMsgs;
|
Total = CFG.OLR_MaxMsgs;
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
|
||||||
/* Do you want to download these messages [Y/n]? */
|
/* Do you want to download these messages [Y/n]? */
|
||||||
printf("%s", (char *)Language(425));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *)Language(425));
|
||||||
fflush(stdout);
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
x = toupper(Getone());
|
x = toupper(Readkey());
|
||||||
|
|
||||||
if (x != Keystroke(425, 1)) {
|
if (x != Keystroke(425, 1)) {
|
||||||
RetVal = TRUE;
|
RetVal = TRUE;
|
||||||
@ -922,13 +922,16 @@ int OLR_Prescan()
|
|||||||
*/
|
*/
|
||||||
void DrawBar(char *Pktname)
|
void DrawBar(char *Pktname)
|
||||||
{
|
{
|
||||||
colour(YELLOW, BLACK);
|
char msg[81];
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
/* Preparing packet */
|
/* Preparing packet */
|
||||||
printf("\n%s %s...\n\n", (char *)Language(445), Pktname);
|
sprintf(msg, "%s %s...", (char *)Language(445), Pktname);
|
||||||
colour(LIGHTGREEN, BLACK);
|
pout(YELLOW, BLACK, msg);
|
||||||
printf("0%% 10%% 20%% 30%% 40%% 50%% 60%% 70%% 80%% 90%% 100%%\n");
|
Enter(2);
|
||||||
printf("|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|\r");
|
poutCR(LIGHTGREEN, BLACK, (char *)"0%% 10%% 20%% 30%% 40%% 50%% 60%% 70%% 80%% 90%% 100%%");
|
||||||
fflush(stdout);
|
PUTSTR((char *)"|-----|-----|-----|-----|-----|-----|-----|-----|-----|-----|");
|
||||||
|
PUTCHAR('\r');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -937,7 +940,8 @@ void OLR_RestrictDate()
|
|||||||
{
|
{
|
||||||
WhosDoingWhat(OLR, NULL);
|
WhosDoingWhat(OLR, NULL);
|
||||||
|
|
||||||
printf("Not Yet Implemented\n");
|
PUTSTR((char *)"Not Yet Implemented");
|
||||||
|
Enter(1);
|
||||||
Pause();
|
Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1006,13 +1010,14 @@ USHORT TOffline::TooOld (ULONG Restrict, class TMsgBase *Msg)
|
|||||||
*/
|
*/
|
||||||
void OLR_Upload(void)
|
void OLR_Upload(void)
|
||||||
{
|
{
|
||||||
char *File, *temp, *Arc, Dirpath[PATH_MAX], Filename[81];
|
char *File, *temp, *Arc, Dirpath[PATH_MAX], Filename[81], msg[81];
|
||||||
time_t ElapstimeStart, ElapstimeFin, iTime;
|
time_t ElapstimeStart, ElapstimeFin, iTime;
|
||||||
int err, Strlen, RetVal = FALSE;
|
int err, Strlen, RetVal = FALSE;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
if (strlen(CFG.bbsid) == 0) {
|
if (strlen(CFG.bbsid) == 0) {
|
||||||
printf("System configuration error, inform sysop\n");
|
PUTSTR((char *)"System configuration error, inform sysop");
|
||||||
|
Enter(1);
|
||||||
WriteError("Config OLR bbsid not configured");
|
WriteError("Config OLR bbsid not configured");
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
@ -1020,9 +1025,8 @@ void OLR_Upload(void)
|
|||||||
|
|
||||||
WhosDoingWhat(OLR, NULL);
|
WhosDoingWhat(OLR, NULL);
|
||||||
clear();
|
clear();
|
||||||
colour(LIGHTMAGENTA, BLACK);
|
|
||||||
/* Offline Reader Upload */
|
/* Offline Reader Upload */
|
||||||
printf("%s\n", (char *)Language(439));
|
poutCR(LIGHTMAGENTA, BLACK, (char *)Language(439));
|
||||||
|
|
||||||
if (!ForceProtocol())
|
if (!ForceProtocol())
|
||||||
return;
|
return;
|
||||||
@ -1044,9 +1048,10 @@ void OLR_Upload(void)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (File[0] == '.' || File[0] == '*' || File[0] == ' ') {
|
if (File[0] == '.' || File[0] == '*' || File[0] == ' ') {
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
Enter(1);
|
||||||
/* Illegal filename! */
|
/* Illegal filename! */
|
||||||
printf("\n%s\n\n", (char *) Language(247));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(247));
|
||||||
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1055,26 +1060,30 @@ void OLR_Upload(void)
|
|||||||
Strlen--;
|
Strlen--;
|
||||||
|
|
||||||
if (File[Strlen] == '.' || File[Strlen] == '/' || File[Strlen] == ' ') {
|
if (File[Strlen] == '.' || File[Strlen] == '/' || File[Strlen] == ' ') {
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
Enter(1);
|
||||||
/* Illegal Filename! */
|
/* Illegal Filename! */
|
||||||
printf("\n%s\n\n", (char *) Language(247));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(247));
|
||||||
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strncasecmp(File, CFG.bbsid, strlen(CFG.bbsid))) {
|
if (strncasecmp(File, CFG.bbsid, strlen(CFG.bbsid))) {
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
Enter(1);
|
||||||
/* Illegal filename! */
|
/* Illegal filename! */
|
||||||
printf("\n%s\n\n", (char *) Language(247));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(247));
|
||||||
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Syslog('+', "Filename accepted");
|
Syslog('+', "Filename accepted");
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
Enter(1);
|
||||||
/* Please start your upload now */
|
/* Please start your upload now */
|
||||||
printf("\n%s, %s\n\n", sProtAdvice, (char *) Language(283));
|
sprintf(msg, "%s, %s", sProtAdvice, (char *) Language(283));
|
||||||
|
pout(CFG.HiliteF, CFG.HiliteB, msg);
|
||||||
|
Enter(2);
|
||||||
if (uProtBatch)
|
if (uProtBatch)
|
||||||
Syslog('+', "Upload using %s", sProtName);
|
Syslog('+', "Upload using %s", sProtName);
|
||||||
else
|
else
|
||||||
@ -1087,8 +1096,6 @@ void OLR_Upload(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(stdout);
|
|
||||||
fflush(stdin);
|
|
||||||
sleep(2);
|
sleep(2);
|
||||||
ElapstimeStart = time(NULL);
|
ElapstimeStart = time(NULL);
|
||||||
|
|
||||||
@ -1097,16 +1104,18 @@ void OLR_Upload(void)
|
|||||||
*/
|
*/
|
||||||
Altime(7200);
|
Altime(7200);
|
||||||
alarm_set(7190);
|
alarm_set(7190);
|
||||||
if ((err = execute_str(sProtUp, (char *)"", NULL, NULL, NULL, NULL))) {
|
err = execute_str(sProtUp, (char *)"", NULL, NULL, NULL, NULL);
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
if (rawport() != 0) {
|
||||||
|
WriteError("Unable to set raw mode");
|
||||||
|
}
|
||||||
|
if (err) {
|
||||||
WriteError("$Upload error %d, prot: %s", err, sProtUp);
|
WriteError("$Upload error %d, prot: %s", err, sProtUp);
|
||||||
}
|
}
|
||||||
Altime(0);
|
Altime(0);
|
||||||
alarm_off();
|
alarm_off();
|
||||||
alarm_on();
|
alarm_on();
|
||||||
printf("\n");
|
|
||||||
fflush(stdout);
|
Enter(1);
|
||||||
fflush(stdin);
|
|
||||||
ElapstimeFin = time(NULL);
|
ElapstimeFin = time(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1136,7 +1145,8 @@ void OLR_Upload(void)
|
|||||||
if (RetVal == FALSE) {
|
if (RetVal == FALSE) {
|
||||||
WriteError("Invalid OLR packed received");
|
WriteError("Invalid OLR packed received");
|
||||||
/* Invalid packet received */
|
/* Invalid packet received */
|
||||||
printf("%s\n\n", (char *)Language(440));
|
pout(LIGHTRED, BLACK, (char *)Language(440));
|
||||||
|
Enter(2);
|
||||||
sleep(2);
|
sleep(2);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1146,7 +1156,7 @@ void OLR_Upload(void)
|
|||||||
|
|
||||||
if ((Arc = GetFileType(File)) == NULL) {
|
if ((Arc = GetFileType(File)) == NULL) {
|
||||||
/* Unknown compression type */
|
/* Unknown compression type */
|
||||||
printf("%s\n", (char *)Language(441));
|
poutCR(LIGHTRED, BLACK, (char *)Language(441));
|
||||||
Syslog('+', "Unknown compression type");
|
Syslog('+', "Unknown compression type");
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
@ -1169,7 +1179,7 @@ void OLR_Upload(void)
|
|||||||
if (strcmp(Arc, archiver.name) || (!archiver.available)) {
|
if (strcmp(Arc, archiver.name) || (!archiver.available)) {
|
||||||
Syslog('+', "Archiver %s not available", Arc);
|
Syslog('+', "Archiver %s not available", Arc);
|
||||||
/* Archiver not available */
|
/* Archiver not available */
|
||||||
printf("%s\n", (char *)Language(442));
|
poutCR(LIGHTRED, BLACK, (char *)Language(442));
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1178,24 +1188,27 @@ void OLR_Upload(void)
|
|||||||
|
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
colour(CFG.TextColourF, CFG.TextColourB);
|
||||||
/* Unpacking archive */
|
/* Unpacking archive */
|
||||||
printf("%s ", (char *) Language(201));
|
pout(CFG.TextColourF, CFG.TextColourB, (char *) Language(201));
|
||||||
fflush(stdout);
|
PUTCHAR(' ');
|
||||||
sprintf(temp, "%s %s", archiver.funarc, File);
|
sprintf(temp, "%s %s", archiver.funarc, File);
|
||||||
Syslog('m', "Unarc %s", temp);
|
Syslog('m', "Unarc %s", temp);
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
colour(CFG.HiliteF, CFG.HiliteB);
|
||||||
|
|
||||||
if ((err = execute_str(archiver.funarc, File, NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null"))) {
|
err = execute_str(archiver.funarc, File, NULL, (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
||||||
|
if (rawport() != 0) {
|
||||||
|
WriteError("Unable to set raw mode");
|
||||||
|
}
|
||||||
|
if (err) {
|
||||||
WriteError("$Failed %s", temp);
|
WriteError("$Failed %s", temp);
|
||||||
/* ERROR */
|
/* ERROR */
|
||||||
printf("%s\n", (char *) Language(217));
|
poutCR(LIGHTRED, BLACK, (char *) Language(217));
|
||||||
fflush(stdout);
|
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ok */
|
/* Ok */
|
||||||
printf("%s\n", (char *) Language(200));
|
PUTSTR((char *) Language(200));
|
||||||
fflush(stdout);
|
Enter(1);
|
||||||
unlink(File);
|
unlink(File);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1244,7 +1257,7 @@ void OLR_Upload(void)
|
|||||||
|
|
||||||
WriteError("OLR_Upload: Garbage in mailpacket, clean directory!");
|
WriteError("OLR_Upload: Garbage in mailpacket, clean directory!");
|
||||||
/* Unknown type mailpacket */
|
/* Unknown type mailpacket */
|
||||||
printf("%s\n", (char *)Language(443));
|
poutCR(LIGHTRED, BLACK, (char *)Language(443));
|
||||||
Pause();
|
Pause();
|
||||||
free(File);
|
free(File);
|
||||||
free(temp);
|
free(temp);
|
||||||
@ -1281,7 +1294,8 @@ void OLR_DownBW()
|
|||||||
msg_high *mhl = NULL;
|
msg_high *mhl = NULL;
|
||||||
|
|
||||||
if (strlen(CFG.bbsid) == 0) {
|
if (strlen(CFG.bbsid) == 0) {
|
||||||
printf("System configuration error, inform sysop\n");
|
PUTSTR((char *)"System configuration error, inform sysop");
|
||||||
|
Enter(1);
|
||||||
WriteError("Config OLR bbsid not configured");
|
WriteError("Config OLR bbsid not configured");
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
@ -1292,9 +1306,8 @@ void OLR_DownBW()
|
|||||||
|
|
||||||
Total = TotalPersonal = 0;
|
Total = TotalPersonal = 0;
|
||||||
clear();
|
clear();
|
||||||
colour(LIGHTBLUE, BLACK);
|
|
||||||
/* BlueWave Offline download */
|
/* BlueWave Offline download */
|
||||||
printf("%s\n", (char *)Language(444));
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(444));
|
||||||
|
|
||||||
Work = calloc(PATH_MAX, sizeof(char));
|
Work = calloc(PATH_MAX, sizeof(char));
|
||||||
Temp = calloc(PATH_MAX, sizeof(char));
|
Temp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -1476,14 +1489,17 @@ void OLR_DownBW()
|
|||||||
|
|
||||||
if (Total) {
|
if (Total) {
|
||||||
/* Packing with */
|
/* Packing with */
|
||||||
printf("\n%s ", (char *)Language(446));
|
Enter(1);
|
||||||
|
PUTSTR((char *)Language(446));
|
||||||
|
PUTCHAR(' ');
|
||||||
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
||||||
if ((af = fopen(Temp, "r")) != NULL) {
|
if ((af = fopen(Temp, "r")) != NULL) {
|
||||||
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
||||||
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
||||||
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
||||||
Syslog('+', "Archiver %s", archiver.comment);
|
Syslog('+', "Archiver %s", archiver.comment);
|
||||||
printf("%s ", archiver.comment);
|
PUTSTR(archiver.comment);
|
||||||
|
PUTCHAR(' ');
|
||||||
sprintf(Temp, "%s/%s.DAT", Work, CFG.bbsid);
|
sprintf(Temp, "%s/%s.DAT", Work, CFG.bbsid);
|
||||||
AddArc(Temp, Pktname);
|
AddArc(Temp, Pktname);
|
||||||
alarm_on();
|
alarm_on();
|
||||||
@ -1503,15 +1519,15 @@ void OLR_DownBW()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
|
||||||
if (rc == FALSE) {
|
if (rc == FALSE) {
|
||||||
Syslog('+', "BlueWave download failed");
|
Syslog('+', "BlueWave download failed");
|
||||||
/* Download failed */
|
/* Download failed */
|
||||||
printf("%s", (char *)Language(447));
|
poutCR(CFG.HiliteF, CFG.HiliteB, (char *)Language(447));
|
||||||
} else {
|
} else {
|
||||||
Syslog('+', "BlueWave download successfull");
|
Syslog('+', "BlueWave download successfull");
|
||||||
|
PUTCHAR('\r');
|
||||||
/* Download successfull */
|
/* Download successfull */
|
||||||
printf("\r%s\n", (char *)Language(448));
|
poutCR(CFG.HiliteF, CFG.HiliteB, (char *)Language(448));
|
||||||
|
|
||||||
if (mhl != NULL)
|
if (mhl != NULL)
|
||||||
UpdateLR(mhl, mf);
|
UpdateLR(mhl, mf);
|
||||||
@ -1522,7 +1538,7 @@ void OLR_DownBW()
|
|||||||
|
|
||||||
free(Temp);
|
free(Temp);
|
||||||
free(Work);
|
free(Work);
|
||||||
printf("\n\n");
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1543,9 +1559,8 @@ void BlueWave_Fetch()
|
|||||||
time_t now;
|
time_t now;
|
||||||
struct tm *tm;
|
struct tm *tm;
|
||||||
|
|
||||||
colour(LIGHTBLUE, BLACK);
|
|
||||||
/* Processing BlueWave reply packet */
|
/* Processing BlueWave reply packet */
|
||||||
printf("%s\n", (char *)Language(450));
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(450));
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
b = calloc(256, sizeof(char));
|
b = calloc(256, sizeof(char));
|
||||||
buffer = b;
|
buffer = b;
|
||||||
@ -1568,7 +1583,7 @@ void BlueWave_Fetch()
|
|||||||
fclose(up);
|
fclose(up);
|
||||||
free(temp);
|
free(temp);
|
||||||
/* ERROR in packet */
|
/* ERROR in packet */
|
||||||
printf("%s\n", (char *)Language(451));
|
poutCR(LIGHTRED, BLACK, (char *)Language(451));
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1581,15 +1596,14 @@ void BlueWave_Fetch()
|
|||||||
|
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
colour(CFG.TextColourF, CFG.TextColourB);
|
||||||
/* Import messages */
|
/* Import messages */
|
||||||
printf("%s ", (char *)Language(452));
|
pout(CFG.TextColourF, CFG.TextColourB, (char *)Language(452));
|
||||||
|
PUTCHAR(' ');
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
colour(CFG.HiliteF, CFG.HiliteB);
|
||||||
fflush(stdout);
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
memset(&Upr, 0, sizeof(UPL_REC));
|
memset(&Upr, 0, sizeof(UPL_REC));
|
||||||
while (fread(&Upr, Uph.upl_rec_len, 1, up) == 1) {
|
while (fread(&Upr, Uph.upl_rec_len, 1, up) == 1) {
|
||||||
printf(".");
|
PUTCHAR('.');
|
||||||
fflush(stdout);
|
|
||||||
Syslog('m', " From : %s", Upr.from);
|
Syslog('m', " From : %s", Upr.from);
|
||||||
Syslog('m', " To : %s", Upr.to);
|
Syslog('m', " To : %s", Upr.to);
|
||||||
Syslog('m', " Subj : %s", Upr.subj);
|
Syslog('m', " Subj : %s", Upr.subj);
|
||||||
@ -1692,8 +1706,10 @@ void BlueWave_Fetch()
|
|||||||
Close_Msgbase(msgs.Base);
|
Close_Msgbase(msgs.Base);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Enter(1);
|
||||||
/* No Write access to area */
|
/* No Write access to area */
|
||||||
printf("\n%s %s\n", (char *)Language(453), msgs.Name);
|
sprintf(temp, "%s %s", (char *)Language(453), msgs.Name);
|
||||||
|
poutCR(LIGHTRED, BLACK, temp);
|
||||||
WriteError("No Write Access to area %s", msgs.Name);
|
WriteError("No Write Access to area %s", msgs.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1701,17 +1717,16 @@ void BlueWave_Fetch()
|
|||||||
}
|
}
|
||||||
memset(&Upr, 0, sizeof(UPL_REC));
|
memset(&Upr, 0, sizeof(UPL_REC));
|
||||||
}
|
}
|
||||||
printf("\n");
|
Enter(1);
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
|
||||||
if (i) {
|
if (i) {
|
||||||
/* Messages imported */
|
/* Messages imported */
|
||||||
printf("%d %s\n", i, (char *)Language(454));
|
sprintf(temp, "%d %s", i, (char *)Language(454));
|
||||||
|
poutCR(CFG.TextColourF, CFG.TextColourB, temp);
|
||||||
ReadExitinfo();
|
ReadExitinfo();
|
||||||
exitinfo.iPosted += i;
|
exitinfo.iPosted += i;
|
||||||
WriteExitinfo();
|
WriteExitinfo();
|
||||||
do_mailout = TRUE;
|
do_mailout = TRUE;
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
|
||||||
fclose(up);
|
fclose(up);
|
||||||
sprintf(temp, "%s/%s", Dirpath, Filename);
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
||||||
unlink(temp);
|
unlink(temp);
|
||||||
@ -1731,9 +1746,8 @@ void BlueWave_Fetch()
|
|||||||
iol = fopen(temp, "r");
|
iol = fopen(temp, "r");
|
||||||
}
|
}
|
||||||
if (iol != NULL) {
|
if (iol != NULL) {
|
||||||
colour(LIGHTBLUE, BLACK);
|
|
||||||
/* Processing Offline Configuration */
|
/* Processing Offline Configuration */
|
||||||
printf("%s\n", (char *)Language(455));
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(455));
|
||||||
Syslog('+', "Processing BlueWave v3 configuration file \"%s\"", Filename);
|
Syslog('+', "Processing BlueWave v3 configuration file \"%s\"", Filename);
|
||||||
OLC_head = FALSE;
|
OLC_head = FALSE;
|
||||||
|
|
||||||
@ -1869,9 +1883,9 @@ void BlueWave_Fetch()
|
|||||||
fclose(iol);
|
fclose(iol);
|
||||||
sprintf(temp, "%s/%s", Dirpath, Filename);
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
||||||
unlink(temp);
|
unlink(temp);
|
||||||
colour(CYAN, BLACK);
|
|
||||||
/* Message areas selected */
|
/* Message areas selected */
|
||||||
printf("%d %s\n", i, (char *)Language(456));
|
sprintf(temp, "%d %s", i, (char *)Language(456));
|
||||||
|
poutCR(CYAN, BLACK, temp);
|
||||||
Syslog('+', " %d active message areas.", i);
|
Syslog('+', " %d active message areas.", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1891,12 +1905,11 @@ void BlueWave_Fetch()
|
|||||||
|
|
||||||
while (fread(&Req, sizeof(REQ_REC), 1, tp) == 1) {
|
while (fread(&Req, sizeof(REQ_REC), 1, tp) == 1) {
|
||||||
Syslog('m', " File %s", Req.filename);
|
Syslog('m', " File %s", Req.filename);
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
sprintf(temp, "%-12s ", Req.filename);
|
||||||
printf("%-12s ", Req.filename);
|
pout(CFG.TextColourF, CFG.TextColourB, temp);
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
colour(CFG.HiliteF, CFG.HiliteB);
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
printf("\n");
|
Enter(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(tp);
|
fclose(tp);
|
||||||
@ -1915,7 +1928,7 @@ void BlueWave_Fetch()
|
|||||||
unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
|
unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
|
||||||
{
|
{
|
||||||
FILE *fdm, *fdfti, *fdmix;
|
FILE *fdm, *fdfti, *fdmix;
|
||||||
char *Temp, *Text;
|
char *Temp, *Text, msg[81];
|
||||||
unsigned long Number;
|
unsigned long Number;
|
||||||
MIX_REC Mix;
|
MIX_REC Mix;
|
||||||
FTI_REC Fti;
|
FTI_REC Fti;
|
||||||
@ -1998,9 +2011,8 @@ unsigned long BlueWave_PackArea(unsigned long ulLast, long Area)
|
|||||||
|
|
||||||
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
||||||
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
||||||
colour(CYAN, BLACK);
|
sprintf(msg, "\r%.*s", BarWidth, "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
|
||||||
printf("\r%.*s", BarWidth, "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
|
pout(CYAN, BLACK, msg);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
} while (Msg_Next(&Number));
|
} while (Msg_Next(&Number));
|
||||||
}
|
}
|
||||||
@ -2044,7 +2056,7 @@ void OLR_DownQWK(void)
|
|||||||
msg_high *tmp, *mhl = NULL;
|
msg_high *tmp, *mhl = NULL;
|
||||||
|
|
||||||
if (strlen(CFG.bbsid) == 0) {
|
if (strlen(CFG.bbsid) == 0) {
|
||||||
printf("System configuration error, inform sysop\n");
|
poutCR(LIGHTRED, BLACK, (char *)"System configuration error, inform sysop");
|
||||||
WriteError("Config OLR bbsid not configured");
|
WriteError("Config OLR bbsid not configured");
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
@ -2055,9 +2067,8 @@ void OLR_DownQWK(void)
|
|||||||
|
|
||||||
Total = TotalPersonal = 0L;
|
Total = TotalPersonal = 0L;
|
||||||
clear();
|
clear();
|
||||||
colour(LIGHTBLUE, BLACK);
|
|
||||||
/* QWK Offline Download */
|
/* QWK Offline Download */
|
||||||
printf("%s\n", (char *)Language(458));
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(458));
|
||||||
|
|
||||||
Work = calloc(PATH_MAX, sizeof(char));
|
Work = calloc(PATH_MAX, sizeof(char));
|
||||||
Temp = calloc(PATH_MAX, sizeof(char));
|
Temp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -2199,15 +2210,18 @@ void OLR_DownQWK(void)
|
|||||||
fclose(tf);
|
fclose(tf);
|
||||||
|
|
||||||
if (Total) {
|
if (Total) {
|
||||||
|
Enter(1);
|
||||||
/* Packing with */
|
/* Packing with */
|
||||||
printf("\n%s ", (char *)Language(446));
|
PUTSTR((char *)Language(446));
|
||||||
|
PUTCHAR(' ');
|
||||||
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
||||||
if ((af = fopen(Temp, "r")) != NULL) {
|
if ((af = fopen(Temp, "r")) != NULL) {
|
||||||
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
||||||
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
||||||
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
||||||
Syslog('+', "Archiver %s", archiver.comment);
|
Syslog('+', "Archiver %s", archiver.comment);
|
||||||
printf("%s ", archiver.comment);
|
PUTSTR(archiver.comment);
|
||||||
|
PUTCHAR(' ');
|
||||||
sprintf(Temp, "%s/CONTROL.DAT", Work);
|
sprintf(Temp, "%s/CONTROL.DAT", Work);
|
||||||
AddArc(Temp, Pktname);
|
AddArc(Temp, Pktname);
|
||||||
alarm_on();
|
alarm_on();
|
||||||
@ -2237,15 +2251,15 @@ void OLR_DownQWK(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
|
||||||
if (rc == FALSE) {
|
if (rc == FALSE) {
|
||||||
Syslog('+', "QWK download failed");
|
Syslog('+', "QWK download failed");
|
||||||
/* Download failed */
|
/* Download failed */
|
||||||
printf("%s", (char *)Language(447));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *)Language(447));
|
||||||
} else {
|
} else {
|
||||||
Syslog('+', "QWK download successfull");
|
Syslog('+', "QWK download successfull");
|
||||||
|
PUTCHAR('\r');
|
||||||
/* Download successfull */
|
/* Download successfull */
|
||||||
printf("\r%s\n", (char *)Language(448));
|
poutCR(CFG.HiliteF, CFG.HiliteB, (char *)Language(448));
|
||||||
|
|
||||||
if (mhl != NULL)
|
if (mhl != NULL)
|
||||||
UpdateLR(mhl, mf);
|
UpdateLR(mhl, mf);
|
||||||
@ -2255,7 +2269,7 @@ void OLR_DownQWK(void)
|
|||||||
|
|
||||||
free(Temp);
|
free(Temp);
|
||||||
free(Work);
|
free(Work);
|
||||||
printf("\n\n");
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2274,9 +2288,8 @@ void QWK_Fetch()
|
|||||||
fidoaddr dest;
|
fidoaddr dest;
|
||||||
int HasTear;
|
int HasTear;
|
||||||
|
|
||||||
colour(LIGHTBLUE, BLACK);
|
|
||||||
/* Processing BlueWave reply packet */
|
/* Processing BlueWave reply packet */
|
||||||
printf("%s\n", (char *)Language(459));
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(459));
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
otemp = calloc(PATH_MAX, sizeof(char));
|
otemp = calloc(PATH_MAX, sizeof(char));
|
||||||
nWidth = 78;
|
nWidth = 78;
|
||||||
@ -2298,7 +2311,7 @@ void QWK_Fetch()
|
|||||||
fclose(up);
|
fclose(up);
|
||||||
unlink(temp);
|
unlink(temp);
|
||||||
/* ERROR in packet */
|
/* ERROR in packet */
|
||||||
printf("%s\n", (char *)Language(451));
|
poutCR(LIGHTRED, BLACK, (char *)Language(451));
|
||||||
free(temp);
|
free(temp);
|
||||||
free(otemp);
|
free(otemp);
|
||||||
Pause();
|
Pause();
|
||||||
@ -2509,17 +2522,16 @@ void QWK_Fetch()
|
|||||||
fclose(up);
|
fclose(up);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
Enter(1);
|
||||||
colour(CFG.TextColourF, CFG.TextColourB);
|
|
||||||
if (nPosted) {
|
if (nPosted) {
|
||||||
/* Messages imported */
|
/* Messages imported */
|
||||||
printf("%d %s\n", nPosted, (char *)Language(454));
|
sprintf(temp, "%d %s", nPosted, (char *)Language(454));
|
||||||
|
poutCR(CFG.TextColourF, CFG.TextColourB, temp);
|
||||||
ReadExitinfo();
|
ReadExitinfo();
|
||||||
exitinfo.iPosted += nPosted;
|
exitinfo.iPosted += nPosted;
|
||||||
WriteExitinfo();
|
WriteExitinfo();
|
||||||
do_mailout = TRUE;
|
do_mailout = TRUE;
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
|
||||||
sprintf(temp, "%s/%s", Dirpath, Filename);
|
sprintf(temp, "%s/%s", Dirpath, Filename);
|
||||||
Syslog('m', "Unlink %s rc=%d", temp, unlink(temp));
|
Syslog('m', "Unlink %s rc=%d", temp, unlink(temp));
|
||||||
free(temp);
|
free(temp);
|
||||||
@ -2575,7 +2587,7 @@ unsigned long QWK_PackArea(unsigned long ulLast, long Area)
|
|||||||
{
|
{
|
||||||
FILE *fdm, *fdi, *fdp;
|
FILE *fdm, *fdi, *fdp;
|
||||||
float out, in;
|
float out, in;
|
||||||
char *Work, *Temp, *Text;
|
char *Work, *Temp, *Text, msg[81];
|
||||||
unsigned long Number, Pos, Size, Blocks;
|
unsigned long Number, Pos, Size, Blocks;
|
||||||
int Pack = FALSE;
|
int Pack = FALSE;
|
||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
@ -2695,9 +2707,9 @@ unsigned long QWK_PackArea(unsigned long ulLast, long Area)
|
|||||||
|
|
||||||
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
||||||
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
||||||
colour(CYAN, BLACK);
|
PUTCHAR('\r');
|
||||||
printf("\r%.*s", BarWidth, "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
|
sprintf(msg, "%.*s", BarWidth, "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
|
||||||
fflush(stdout);
|
pout(CYAN, BLACK, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (Msg_Next(&Number));
|
} while (Msg_Next(&Number));
|
||||||
@ -2754,7 +2766,7 @@ void OLR_DownASCII(void)
|
|||||||
msg_high *tmp, *mhl = NULL;
|
msg_high *tmp, *mhl = NULL;
|
||||||
|
|
||||||
if (strlen(CFG.bbsid) == 0) {
|
if (strlen(CFG.bbsid) == 0) {
|
||||||
printf("System configuration error, inform sysop\n");
|
poutCR(LIGHTRED, BLACK, (char *)"System configuration error, inform sysop");
|
||||||
WriteError("Config OLR bbsid not configured");
|
WriteError("Config OLR bbsid not configured");
|
||||||
Pause();
|
Pause();
|
||||||
return;
|
return;
|
||||||
@ -2765,9 +2777,8 @@ void OLR_DownASCII(void)
|
|||||||
|
|
||||||
Total = TotalPersonal = 0L;
|
Total = TotalPersonal = 0L;
|
||||||
clear();
|
clear();
|
||||||
colour(LIGHTBLUE, BLACK);
|
|
||||||
/* ASCII Offline Download */
|
/* ASCII Offline Download */
|
||||||
printf("%s\n", (char *)Language(460));
|
poutCR(LIGHTBLUE, BLACK, (char *)Language(460));
|
||||||
|
|
||||||
Work = calloc(PATH_MAX, sizeof(char));
|
Work = calloc(PATH_MAX, sizeof(char));
|
||||||
Temp = calloc(PATH_MAX, sizeof(char));
|
Temp = calloc(PATH_MAX, sizeof(char));
|
||||||
@ -2829,15 +2840,18 @@ void OLR_DownASCII(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Total) {
|
if (Total) {
|
||||||
|
Enter(1);
|
||||||
/* Packing with */
|
/* Packing with */
|
||||||
printf("\n%s ", (char *)Language(446));
|
PUTSTR((char *)Language(446));
|
||||||
|
PUTCHAR(' ');
|
||||||
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
sprintf(Temp, "%s/etc/archiver.data", getenv("MBSE_ROOT"));
|
||||||
if ((af = fopen(Temp, "r")) != NULL) {
|
if ((af = fopen(Temp, "r")) != NULL) {
|
||||||
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
fread(&archiverhdr, sizeof(archiverhdr), 1, af);
|
||||||
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
while (fread(&archiver, archiverhdr.recsize, 1, af) == 1) {
|
||||||
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
if (archiver.available && (!strcmp(archiver.name, exitinfo.Archiver))) {
|
||||||
Syslog('+', "Archiver %s", archiver.comment);
|
Syslog('+', "Archiver %s", archiver.comment);
|
||||||
printf("%s ", archiver.comment);
|
PUTSTR(archiver.comment);
|
||||||
|
PUTCHAR(' ');
|
||||||
alarm_on();
|
alarm_on();
|
||||||
|
|
||||||
for (tmp = mhl; tmp; tmp = tmp->next) {
|
for (tmp = mhl; tmp; tmp = tmp->next) {
|
||||||
@ -2853,15 +2867,15 @@ void OLR_DownASCII(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
|
||||||
if (rc == FALSE) {
|
if (rc == FALSE) {
|
||||||
Syslog('+', "ASCII download failed");
|
Syslog('+', "ASCII download failed");
|
||||||
/* Download failed */
|
/* Download failed */
|
||||||
printf("%s", (char *)Language(447));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *)Language(447));
|
||||||
} else {
|
} else {
|
||||||
Syslog('+', "ASCII download successfull");
|
Syslog('+', "ASCII download successfull");
|
||||||
|
PUTCHAR('\r');
|
||||||
/* Download successfull */
|
/* Download successfull */
|
||||||
printf("\r%s\n", (char *)Language(448));
|
poutCR(CFG.HiliteF, CFG.HiliteB, (char *)Language(448));
|
||||||
|
|
||||||
if (mhl != NULL)
|
if (mhl != NULL)
|
||||||
UpdateLR(mhl, mf);
|
UpdateLR(mhl, mf);
|
||||||
@ -2870,7 +2884,7 @@ void OLR_DownASCII(void)
|
|||||||
tidy_high(&mhl);
|
tidy_high(&mhl);
|
||||||
free(Temp);
|
free(Temp);
|
||||||
free(Work);
|
free(Work);
|
||||||
printf("\n\n");
|
Enter(2);
|
||||||
Pause();
|
Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2882,7 +2896,7 @@ void OLR_DownASCII(void)
|
|||||||
unsigned long ASCII_PackArea(unsigned long ulLast, long Area)
|
unsigned long ASCII_PackArea(unsigned long ulLast, long Area)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char *Work, *Temp, *Text;
|
char *Work, *Temp, *Text, msg[81];
|
||||||
unsigned long Number;
|
unsigned long Number;
|
||||||
int Pack = FALSE;
|
int Pack = FALSE;
|
||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
@ -2938,9 +2952,9 @@ unsigned long ASCII_PackArea(unsigned long ulLast, long Area)
|
|||||||
|
|
||||||
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
if (BarWidth != (unsigned short)((Total * 61L) / TotalPack)) {
|
||||||
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
BarWidth = (unsigned short)((Total * 61L) / TotalPack);
|
||||||
colour(CYAN, BLACK);
|
PUTCHAR('\r');
|
||||||
printf("\r%.*s", BarWidth, "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
|
sprintf(msg, "%.*s", BarWidth, "ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ");
|
||||||
fflush(stdout);
|
pout(CYAN, BLACK, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (Msg_Next(&Number));
|
} while (Msg_Next(&Number));
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
char sOneliner[81];
|
char sOneliner[81];
|
||||||
@ -71,66 +72,64 @@ void Oneliner_Check()
|
|||||||
|
|
||||||
void Oneliner_Add()
|
void Oneliner_Add()
|
||||||
{
|
{
|
||||||
FILE *pOneline;
|
FILE *pOneline;
|
||||||
char *sFileName;
|
char *sFileName;
|
||||||
int x;
|
int x;
|
||||||
char temp[81];
|
char temp[81];
|
||||||
|
|
||||||
Oneliner_Check();
|
Oneliner_Check();
|
||||||
|
|
||||||
sFileName = calloc(128, sizeof(char));
|
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if((pOneline = fopen(sFileName, "a+")) == NULL) {
|
if ((pOneline = fopen(sFileName, "a+")) == NULL) {
|
||||||
WriteError("Can't open file: %s", sFileName);
|
WriteError("Can't open file: %s", sFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
free(sFileName);
|
free(sFileName);
|
||||||
|
|
||||||
memset(&ol, 0, sizeof(ol));
|
memset(&ol, 0, sizeof(ol));
|
||||||
clear();
|
clear();
|
||||||
/* MBSE BBS Oneliners will randomly appear on the main menu. */
|
/* MBSE BBS Oneliners will randomly appear on the main menu. */
|
||||||
poutCR(15, 0, Language(341));
|
poutCR(WHITE, BLACK, Language(341));
|
||||||
Enter(1);
|
Enter(1);
|
||||||
|
|
||||||
/* Obscene or libellous oneliners will be deleted!! */
|
/* Obscene or libellous oneliners will be deleted!! */
|
||||||
poutCR(15, 1, Language(342));
|
poutCR(WHITE, BLUE, Language(342));
|
||||||
Enter(1);
|
Enter(1);
|
||||||
|
|
||||||
/* Please enter your oneliner below. You have 75 characters.*/
|
/* Please enter your oneliner below. You have 75 characters.*/
|
||||||
pout(12, 0, Language(343));
|
poutCR(LIGHTRED, BLACK, Language(343));
|
||||||
Enter(1);
|
pout(WHITE, BLACK, (char *)"> ");
|
||||||
pout(15, 0, (char *)"> ");
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
GetstrC(temp, 75);
|
||||||
fflush(stdout);
|
|
||||||
GetstrC(temp, 75);
|
|
||||||
|
|
||||||
if((strcmp(temp, "")) == 0) {
|
if ((strcmp(temp, "")) == 0) {
|
||||||
fclose(pOneline);
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
x = strlen(temp);
|
|
||||||
if(x >= 78)
|
|
||||||
temp[78] = '\0';
|
|
||||||
|
|
||||||
strcpy(ol.Oneline, temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
Enter(1);
|
|
||||||
/* Oneliner added */
|
|
||||||
pout(3, 0, Language(344));
|
|
||||||
Enter(2);
|
|
||||||
Pause();
|
|
||||||
|
|
||||||
Syslog('!', "User added oneliner:");
|
|
||||||
Syslog('!', ol.Oneline);
|
|
||||||
|
|
||||||
sprintf(ol.UserName,"%s", exitinfo.sUserName);
|
|
||||||
sprintf(ol.DateOfEntry,"%02d-%02d-%04d",l_date->tm_mday,l_date->tm_mon+1,l_date->tm_year+1900);
|
|
||||||
ol.Available = TRUE;
|
|
||||||
|
|
||||||
fwrite(&ol, sizeof(ol), 1, pOneline);
|
|
||||||
fclose(pOneline);
|
fclose(pOneline);
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
x = strlen(temp);
|
||||||
|
if (x >= 78)
|
||||||
|
temp[78] = '\0';
|
||||||
|
|
||||||
|
strcpy(ol.Oneline, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
/* Oneliner added */
|
||||||
|
pout(CYAN, BLACK, Language(344));
|
||||||
|
Enter(2);
|
||||||
|
Pause();
|
||||||
|
|
||||||
|
Syslog('!', "User added oneliner:");
|
||||||
|
Syslog('!', ol.Oneline);
|
||||||
|
|
||||||
|
sprintf(ol.UserName,"%s", exitinfo.sUserName);
|
||||||
|
sprintf(ol.DateOfEntry,"%02d-%02d-%04d",l_date->tm_mday,l_date->tm_mon+1,l_date->tm_year+1900);
|
||||||
|
ol.Available = TRUE;
|
||||||
|
|
||||||
|
fwrite(&ol, sizeof(ol), 1, pOneline);
|
||||||
|
fclose(pOneline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -141,43 +140,43 @@ void Oneliner_Add()
|
|||||||
*/
|
*/
|
||||||
void Oneliner_Print()
|
void Oneliner_Print()
|
||||||
{
|
{
|
||||||
int i, x, z;
|
int i, x, z, Strlen, Maxlen = 80;
|
||||||
int Strlen;
|
char sNewOneliner[81] = "";
|
||||||
int Maxlen = 80;
|
|
||||||
char sNewOneliner[81] = "";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Select a new colour
|
* Select a new colour
|
||||||
*/
|
*/
|
||||||
if (iColour < 8)
|
if (iColour < 8)
|
||||||
iColour = 8;
|
iColour = 8;
|
||||||
|
else
|
||||||
|
if (iColour == 15)
|
||||||
|
iColour = 8;
|
||||||
else
|
else
|
||||||
if (iColour == 15)
|
iColour++;
|
||||||
iColour = 8;
|
|
||||||
else
|
|
||||||
iColour++;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a random oneliner
|
* Get a random oneliner
|
||||||
*/
|
*/
|
||||||
strcpy(sOneliner, Oneliner_Get());
|
strcpy(sOneliner, Oneliner_Get());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now display it on screen
|
* Now display it on screen
|
||||||
*/
|
*/
|
||||||
Strlen = strlen(sOneliner);
|
Strlen = strlen(sOneliner);
|
||||||
|
|
||||||
if(Strlen == Maxlen)
|
if (Strlen == Maxlen) {
|
||||||
printf("%s\n", sOneliner);
|
PUTSTR(sOneliner);
|
||||||
else {
|
Enter(1);
|
||||||
x = Maxlen - Strlen;
|
} else {
|
||||||
z = x / 2;
|
x = Maxlen - Strlen;
|
||||||
for(i = 0; i < z; i++)
|
z = x / 2;
|
||||||
strcat(sNewOneliner," ");
|
for(i = 0; i < z; i++)
|
||||||
strcat(sNewOneliner, sOneliner);
|
strcat(sNewOneliner," ");
|
||||||
colour(iColour, 0);
|
strcat(sNewOneliner, sOneliner);
|
||||||
printf("%s\n", sNewOneliner);
|
colour(iColour, 0);
|
||||||
}
|
PUTSTR(sNewOneliner);
|
||||||
|
Enter(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -187,57 +186,56 @@ void Oneliner_Print()
|
|||||||
*/
|
*/
|
||||||
char *Oneliner_Get()
|
char *Oneliner_Get()
|
||||||
{
|
{
|
||||||
FILE *pOneline;
|
FILE *pOneline;
|
||||||
int i, j, in, id;
|
int i, j, in, id, recno = 0;
|
||||||
int recno = 0;
|
long offset;
|
||||||
long offset;
|
int nrecno;
|
||||||
int nrecno;
|
char *sFileName;
|
||||||
char *sFileName;
|
static char temp[81];
|
||||||
static char temp[81];
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get a random oneliner
|
* Get a random oneliner
|
||||||
*/
|
*/
|
||||||
sFileName = calloc(128, sizeof(char));
|
sFileName = calloc(128, sizeof(char));
|
||||||
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if((pOneline = fopen(sFileName, "r+")) == NULL) {
|
if ((pOneline = fopen(sFileName, "r+")) == NULL) {
|
||||||
WriteError("Can't open file: %s", sFileName);
|
WriteError("Can't open file: %s", sFileName);
|
||||||
return '\0';
|
return '\0';
|
||||||
}
|
}
|
||||||
fread(&olhdr, sizeof(olhdr), 1, pOneline);
|
fread(&olhdr, sizeof(olhdr), 1, pOneline);
|
||||||
|
|
||||||
while (fread(&ol, olhdr.recsize, 1, pOneline) == 1) {
|
while (fread(&ol, olhdr.recsize, 1, pOneline) == 1) {
|
||||||
recno++;
|
recno++;
|
||||||
}
|
}
|
||||||
nrecno = recno;
|
nrecno = recno;
|
||||||
fseek(pOneline, olhdr.hdrsize, 0);
|
fseek(pOneline, olhdr.hdrsize, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate random record number
|
* Generate random record number
|
||||||
*/
|
*/
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
in = nrecno;
|
in = nrecno;
|
||||||
id = getpid();
|
id = getpid();
|
||||||
|
|
||||||
i = rand();
|
i = rand();
|
||||||
j = i % id;
|
j = i % id;
|
||||||
if ((j <= in))
|
if ((j <= in))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
offset = olhdr.hdrsize + (j * olhdr.recsize);
|
offset = olhdr.hdrsize + (j * olhdr.recsize);
|
||||||
if (fseek(pOneline, offset, 0) != 0) {
|
if (fseek(pOneline, offset, 0) != 0) {
|
||||||
WriteError("Can't move pointer in %s", sFileName);
|
WriteError("Can't move pointer in %s", sFileName);
|
||||||
return '\0';
|
return '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
fread(&ol, olhdr.recsize, 1, pOneline);
|
fread(&ol, olhdr.recsize, 1, pOneline);
|
||||||
memset(&temp, 0, sizeof(temp));
|
memset(&temp, 0, sizeof(temp));
|
||||||
strcpy(temp, ol.Oneline);
|
strcpy(temp, ol.Oneline);
|
||||||
fclose(pOneline);
|
fclose(pOneline);
|
||||||
free(sFileName);
|
free(sFileName);
|
||||||
return temp;
|
return temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -247,203 +245,200 @@ char *Oneliner_Get()
|
|||||||
*/
|
*/
|
||||||
void Oneliner_List()
|
void Oneliner_List()
|
||||||
{
|
{
|
||||||
FILE *pOneline;
|
FILE *pOneline;
|
||||||
int recno = 0;
|
int recno = 0, Colour = 1;
|
||||||
int Colour = 1;
|
char *sFileName, msg[81];
|
||||||
char *sFileName;
|
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
sFileName = calloc(128, sizeof(char));
|
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if((pOneline = fopen(sFileName, "r+")) == NULL) {
|
if ((pOneline = fopen(sFileName, "r+")) == NULL) {
|
||||||
WriteError("Can't open file: %s", sFileName);
|
WriteError("Can't open file: %s", sFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fread(&olhdr, sizeof(olhdr), 1, pOneline);
|
fread(&olhdr, sizeof(olhdr), 1, pOneline);
|
||||||
|
|
||||||
if((SYSOP == TRUE) || (exitinfo.Security.level >= CFG.sysop_access)) {
|
if ((SYSOP == TRUE) || (exitinfo.Security.level >= CFG.sysop_access)) {
|
||||||
/* # A Date User Description */
|
/* # A Date User Description */
|
||||||
pout(10, 0, Language(345));
|
pout(LIGHTGREEN, BLACK, Language(345));
|
||||||
Enter(1);
|
} else {
|
||||||
|
/* # Description */
|
||||||
|
pout(LIGHTGREEN, BLACK, Language(346));
|
||||||
|
}
|
||||||
|
Enter(1);
|
||||||
|
colour(GREEN, BLACK);
|
||||||
|
sLine();
|
||||||
|
|
||||||
|
while (fread(&ol, olhdr.recsize, 1, pOneline) == 1) {
|
||||||
|
if ((SYSOP == TRUE) || (exitinfo.Security.level >= CFG.sysop_access)) {
|
||||||
|
sprintf(msg, "%2d", recno);
|
||||||
|
pout(WHITE, BLACK, msg);
|
||||||
|
|
||||||
|
sprintf(msg, "%2d ", ol.Available);
|
||||||
|
pout(LIGHTBLUE, BLACK, msg);
|
||||||
|
|
||||||
|
pout(LIGHTCYAN, BLACK, ol.DateOfEntry);
|
||||||
|
|
||||||
|
sprintf(msg, "%-15s ", ol.UserName);
|
||||||
|
pout(CYAN, BLACK, msg);
|
||||||
|
|
||||||
|
sprintf(msg, "%-.48s", ol.Oneline);
|
||||||
|
poutCR(Colour, BLACK, msg);
|
||||||
} else {
|
} else {
|
||||||
/* # Description */
|
sprintf(msg, "%2d ", recno);
|
||||||
pout(10, 0, Language(346));
|
pout(WHITE, BLACK, msg);
|
||||||
Enter(1);
|
sprintf(msg, "%-.76s", ol.Oneline);
|
||||||
|
poutCR(Colour, BLACK, msg);
|
||||||
}
|
}
|
||||||
colour(2, 0);
|
|
||||||
sLine();
|
|
||||||
|
|
||||||
while (fread(&ol, olhdr.recsize, 1, pOneline) == 1) {
|
recno++;
|
||||||
if((SYSOP == TRUE) || (exitinfo.Security.level >= CFG.sysop_access)) {
|
Colour++;
|
||||||
colour(15, 0);
|
if (Colour >= 16)
|
||||||
printf("%2d", recno);
|
Colour = 1;
|
||||||
|
}
|
||||||
colour(9, 0);
|
fclose(pOneline);
|
||||||
printf("%2d ", ol.Available);
|
Enter(1);
|
||||||
|
Pause();
|
||||||
colour(11, 0);
|
free(sFileName);
|
||||||
printf("%s ", ol.DateOfEntry);
|
|
||||||
|
|
||||||
colour(3, 0);
|
|
||||||
printf("%-15s ", ol.UserName);
|
|
||||||
|
|
||||||
colour(Colour, 0);
|
|
||||||
printf("%-.48s\n", ol.Oneline);
|
|
||||||
} else {
|
|
||||||
colour(15, 0);
|
|
||||||
printf("%2d ", recno);
|
|
||||||
colour(Colour, 0);
|
|
||||||
printf("%-.76s\n", ol.Oneline);
|
|
||||||
}
|
|
||||||
|
|
||||||
recno++;
|
|
||||||
Colour++;
|
|
||||||
if(Colour >= 16)
|
|
||||||
Colour = 1;
|
|
||||||
}
|
|
||||||
fclose(pOneline);
|
|
||||||
printf("\n");
|
|
||||||
Pause();
|
|
||||||
free(sFileName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Oneliner_Show()
|
void Oneliner_Show()
|
||||||
{
|
{
|
||||||
FILE *pOneline;
|
FILE *pOneline;
|
||||||
int recno = 0;
|
int recno = 0;
|
||||||
long offset;
|
long offset;
|
||||||
char *sFileName;
|
char *sFileName, msg[11];
|
||||||
|
|
||||||
sFileName = calloc(128, sizeof(char));
|
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if((pOneline = fopen(sFileName, "r+")) == NULL) {
|
if ((pOneline = fopen(sFileName, "r+")) == NULL) {
|
||||||
WriteError("Can't open file: %s", sFileName);
|
WriteError("Can't open file: %s", sFileName);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fread(&olhdr, sizeof(olhdr), 1, pOneline);
|
fread(&olhdr, sizeof(olhdr), 1, pOneline);
|
||||||
|
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Please enter number to list: */
|
/* Please enter number to list: */
|
||||||
pout(15, 0, Language(347));
|
pout(WHITE, BLACK, Language(347));
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
scanf("%d", &recno);
|
scanf("%d", &recno);
|
||||||
|
|
||||||
offset = olhdr.hdrsize + (recno * olhdr.recsize);
|
offset = olhdr.hdrsize + (recno * olhdr.recsize);
|
||||||
if (fseek(pOneline, offset, 0) != 0)
|
if (fseek(pOneline, offset, 0) != 0)
|
||||||
WriteError("Can't move pointer in %s",sFileName);
|
WriteError("Can't move pointer in %s",sFileName);
|
||||||
|
|
||||||
fread(&ol, olhdr.recsize, 1, pOneline);
|
fread(&ol, olhdr.recsize, 1, pOneline);
|
||||||
|
|
||||||
colour(15, 0);
|
Enter(1);
|
||||||
printf("\n%d ", recno);
|
sprintf(msg, "%d ", recno);
|
||||||
colour(12, 0);
|
pout(WHITE, BLACK, msg);
|
||||||
printf("%s\n\n", ol.Oneline);
|
pout(LIGHTRED, BLACK, ol.Oneline);
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
Pause();
|
Pause();
|
||||||
fclose(pOneline);
|
fclose(pOneline);
|
||||||
free(sFileName);
|
free(sFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Oneliner_Delete()
|
void Oneliner_Delete()
|
||||||
{
|
{
|
||||||
FILE *pOneline;
|
FILE *pOneline;
|
||||||
int recno = 0;
|
int recno = 0, nrecno = 0;
|
||||||
long offset;
|
long offset;
|
||||||
int nrecno = 0;
|
char srecno[7], *sFileName, stemp[50], sUser[36], msg[81];
|
||||||
char srecno[7];
|
|
||||||
char *sFileName;
|
|
||||||
char stemp[50];
|
|
||||||
char sUser[35];
|
|
||||||
|
|
||||||
sFileName = calloc(128, sizeof(char));
|
sFileName = calloc(PATH_MAX, sizeof(char));
|
||||||
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
sprintf(sFileName,"%s/etc/oneline.data", getenv("MBSE_ROOT"));
|
||||||
|
|
||||||
if((pOneline = fopen(sFileName, "r+")) == NULL) {
|
if ((pOneline = fopen(sFileName, "r+")) == NULL) {
|
||||||
WriteError("Can't open file: %s", sFileName);
|
WriteError("Can't open file: %s", sFileName);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
fread(&olhdr, sizeof(olhdr), 1, pOneline);
|
||||||
|
|
||||||
|
Enter(1);
|
||||||
|
/* Please enter number to delete: */
|
||||||
|
pout(WHITE, BLACK, Language(331));
|
||||||
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
|
GetstrC(srecno, 6);
|
||||||
|
|
||||||
|
if ((strcmp(srecno,"")) == 0) {
|
||||||
|
fclose(pOneline);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
recno = atoi(srecno);
|
||||||
|
|
||||||
|
nrecno = recno;
|
||||||
|
recno = 0;
|
||||||
|
|
||||||
|
while (fread(&ol, olhdr.recsize, 1, pOneline) == 1) {
|
||||||
|
recno++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nrecno >= recno) {
|
||||||
|
Enter(1);
|
||||||
|
/* Record does not exist */
|
||||||
|
pout(LIGHTRED, BLACK, Language(319));
|
||||||
|
Enter(2);
|
||||||
|
fclose(pOneline);
|
||||||
|
Pause();
|
||||||
|
} else {
|
||||||
|
offset = olhdr.hdrsize + (nrecno * olhdr.recsize);
|
||||||
|
if (fseek(pOneline, offset, 0) != 0) {
|
||||||
|
WriteError("Can't move pointer in %s",sFileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
fread(&ol, olhdr.recsize, 1, pOneline);
|
||||||
|
|
||||||
|
/* Convert Record Int to string, so we can print to logfiles */
|
||||||
|
sprintf(stemp,"%d", nrecno);
|
||||||
|
|
||||||
|
/* Print UserName to String, so we can compare for deletion */
|
||||||
|
sprintf(sUser,"%s", exitinfo.sUserName);
|
||||||
|
|
||||||
|
if ((strcmp(sUser, ol.UserName)) != 0) {
|
||||||
|
if ((!SYSOP) && (exitinfo.Security.level < CFG.sysop_access)) {
|
||||||
|
Enter(1);
|
||||||
|
/* Record *//* does not belong to you.*/
|
||||||
|
sprintf(msg, "%s%s %s", (char *) Language(332), stemp, (char *) Language(333));
|
||||||
|
pout(LIGHTRED, BLACK, msg);
|
||||||
|
Enter(2);
|
||||||
|
Syslog('!', "User tried to delete somebody else's record: %s", stemp);
|
||||||
|
Pause();
|
||||||
|
fclose(pOneline);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fread(&olhdr, sizeof(olhdr), 1, pOneline);
|
|
||||||
|
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Please enter number to delete: */
|
if ((ol.Available ) == FALSE) {
|
||||||
pout(15, 0, Language(331));
|
/* Record: %d already marked for deletion */
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
sprintf(msg, "%s%d %s", (char *) Language(332), nrecno, (char *) Language(334));
|
||||||
GetstrC(srecno, 6);
|
pout(LIGHTRED, BLACK, msg);
|
||||||
|
Syslog('!', "User tried to mark an already marked record: %s", stemp);
|
||||||
if((strcmp(srecno,"")) == 0) {
|
|
||||||
fclose(pOneline);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
recno = atoi(srecno);
|
|
||||||
|
|
||||||
nrecno = recno;
|
|
||||||
recno = 0;
|
|
||||||
|
|
||||||
while (fread(&ol, olhdr.recsize, 1, pOneline) == 1) {
|
|
||||||
recno++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(nrecno >= recno) {
|
|
||||||
Enter(1);
|
|
||||||
/* Record does not exist */
|
|
||||||
pout(12, 0, Language(319));
|
|
||||||
Enter(2);
|
|
||||||
fclose(pOneline);
|
|
||||||
Pause();
|
|
||||||
} else {
|
} else {
|
||||||
offset = olhdr.hdrsize + (nrecno * olhdr.recsize);
|
ol.Available = FALSE;
|
||||||
if (fseek(pOneline, offset, 0) != 0) {
|
/* Record *//* marked for deletion */
|
||||||
WriteError("Can't move pointer in %s",sFileName);
|
sprintf(msg, "%s%d %s", (char *) Language(332), nrecno, (char *) Language(334));
|
||||||
}
|
pout(LIGHTGREEN, BLACK, msg);
|
||||||
|
Syslog('+', "User marked oneliner record for deletion: %s", stemp);
|
||||||
fread(&ol, olhdr.recsize, 1, pOneline);
|
|
||||||
|
|
||||||
/* Convert Record Int to string, so we can print to logfiles */
|
|
||||||
sprintf(stemp,"%d", nrecno);
|
|
||||||
|
|
||||||
/* Print UserName to String, so we can compare for deletion */
|
|
||||||
sprintf(sUser,"%s", exitinfo.sUserName);
|
|
||||||
|
|
||||||
if((strcmp(sUser, ol.UserName)) != 0) {
|
|
||||||
if((!SYSOP) && (exitinfo.Security.level < CFG.sysop_access)) {
|
|
||||||
colour(12, 0);
|
|
||||||
/* Record *//* does not belong to you.*/
|
|
||||||
printf("\n%s%s %s\n\n", (char *) Language(332), stemp, (char *) Language(333));
|
|
||||||
Syslog('!', "User tried to delete somebody else's record: %s", stemp);
|
|
||||||
Pause();
|
|
||||||
fclose(pOneline);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((ol.Available ) == FALSE) {
|
|
||||||
colour(12, 0);
|
|
||||||
/* Record: %d already marked for deletion */
|
|
||||||
printf("\n%s%d %s\n\n", (char *) Language(332), nrecno, (char *) Language(334));
|
|
||||||
Syslog('!', "User tried to mark an already marked record: %s", stemp);
|
|
||||||
Pause();
|
|
||||||
} else {
|
|
||||||
ol.Available = FALSE;
|
|
||||||
colour(10, 0);
|
|
||||||
/* Record *//* marked for deletion */
|
|
||||||
printf("\n%s%d %s\n\n", (char *) Language(332), nrecno, (char *) Language(334));
|
|
||||||
Syslog('+', "User marked oneliner record for deletion: %s", stemp);
|
|
||||||
Pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fseek(pOneline, offset, 0) != 0)
|
|
||||||
WriteError("Can't move pointer in %s",sFileName);
|
|
||||||
fwrite(&ol, olhdr.recsize, 1, pOneline);
|
|
||||||
}
|
}
|
||||||
fclose(pOneline);
|
Enter(2);
|
||||||
free(sFileName);
|
Pause();
|
||||||
|
|
||||||
|
if (fseek(pOneline, offset, 0) != 0)
|
||||||
|
WriteError("Can't move pointer in %s",sFileName);
|
||||||
|
fwrite(&ol, olhdr.recsize, 1, pOneline);
|
||||||
|
}
|
||||||
|
fclose(pOneline);
|
||||||
|
free(sFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
162
mbsebbs/openport.c
Normal file
162
mbsebbs/openport.c
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*****************************************************************************
|
||||||
|
* Copyright (C) 1997-2004
|
||||||
|
*
|
||||||
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
|
* Beekmansbos 10
|
||||||
|
* 1971 BV IJmuiden
|
||||||
|
* the Netherlands
|
||||||
|
*
|
||||||
|
* This file is part of MBSE BBS.
|
||||||
|
*
|
||||||
|
* This BBS is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2, or (at your option) any
|
||||||
|
* later version.
|
||||||
|
*
|
||||||
|
* MBSE BBS is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
||||||
|
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
#include "../lib/mbselib.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
#include "openport.h"
|
||||||
|
|
||||||
|
|
||||||
|
int hanged_up = 0;
|
||||||
|
|
||||||
|
static struct termios savetios;
|
||||||
|
static struct termios tios;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set port to local, hangup using DTR drop.
|
||||||
|
*/
|
||||||
|
void hangup(void)
|
||||||
|
{
|
||||||
|
struct termios Tios;
|
||||||
|
tcflag_t cflag;
|
||||||
|
speed_t ispeed, ospeed;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
Syslog('t', "Setting port local");
|
||||||
|
|
||||||
|
if (isatty(0)) {
|
||||||
|
if ((rc = tcgetattr(0,&Tios))) {
|
||||||
|
WriteError("$tcgetattr(0,save) return %d",rc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Syslog('+', "Lowering DTR to hangup");
|
||||||
|
|
||||||
|
cflag = Tios.c_cflag | CLOCAL;
|
||||||
|
|
||||||
|
ispeed = cfgetispeed(&tios);
|
||||||
|
ospeed = cfgetospeed(&tios);
|
||||||
|
cfsetispeed(&Tios,0);
|
||||||
|
cfsetospeed(&Tios,0);
|
||||||
|
if ((rc = tcsetattr(0,TCSADRAIN,&Tios)))
|
||||||
|
WriteError("$tcsetattr(0,TCSADRAIN,hangup) return %d",rc);
|
||||||
|
|
||||||
|
sleep(1); /* as far as I notice, DTR goes back high on next op. */
|
||||||
|
|
||||||
|
Tios.c_cflag = cflag;
|
||||||
|
cfsetispeed(&Tios,ispeed);
|
||||||
|
cfsetospeed(&Tios,ospeed);
|
||||||
|
if ((rc = tcsetattr(0,TCSADRAIN,&Tios)))
|
||||||
|
Syslog('t', "$tcsetattr(0,TCSADRAIN,clocal) return %d",rc);
|
||||||
|
} else {
|
||||||
|
Syslog('t', "Not at a tty");
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Put the current opened tty in raw mode.
|
||||||
|
*/
|
||||||
|
int rawport(void)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
Syslog('t', "rawport()");
|
||||||
|
tty_status = 0;
|
||||||
|
|
||||||
|
Syslog('t', "ttyname 0 %s", ttyname(0));
|
||||||
|
Syslog('t', "ttyname 1 %s", ttyname(1));
|
||||||
|
Syslog('t', "fd = %d", fileno(stdin));
|
||||||
|
Syslog('t', "fd = %d", fileno(stdout));
|
||||||
|
Syslog('t', "fd = %d", fileno(stderr));
|
||||||
|
|
||||||
|
if (isatty(0)) {
|
||||||
|
if ((rc = tcgetattr(0,&savetios))) {
|
||||||
|
WriteError("$tcgetattr(0,save) return %d",rc);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
tios = savetios;
|
||||||
|
tios.c_iflag &= ~(INLCR | ICRNL | ISTRIP | IXON ); /* IUCLC removed for FreeBSD */
|
||||||
|
/*
|
||||||
|
* Map CRNL modes strip control characters and flow control
|
||||||
|
*/
|
||||||
|
tios.c_oflag &= ~OPOST; /* Don't do ouput character translation */
|
||||||
|
tios.c_lflag &= ~(ICANON | ECHO); /* No canonical input and no echo */
|
||||||
|
tios.c_cc[VMIN] = 1; /* Receive 1 character at a time */
|
||||||
|
tios.c_cc[VTIME] = 0; /* No time limit per character */
|
||||||
|
|
||||||
|
if ((rc = tcsetattr(0,TCSADRAIN,&tios)))
|
||||||
|
WriteError("$tcsetattr(0,TCSADRAIN,raw) return %d",rc);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Syslog('t', "not at a tty");
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int cookedport(void)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
Syslog('t', "cookedport()");
|
||||||
|
if (isatty(0)) {
|
||||||
|
if ((rc = tcsetattr(0,TCSAFLUSH,&savetios)))
|
||||||
|
Syslog('t', "$tcsetattr(0,TCSAFLUSH,save) return %d", rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void sendbrk(void)
|
||||||
|
{
|
||||||
|
Syslog('t', "Send break");
|
||||||
|
|
||||||
|
if (isatty(0)) {
|
||||||
|
#if (defined(TIOCSBRK))
|
||||||
|
Syslog('t', "TIOCSBRK");
|
||||||
|
ioctl(0, TIOCSBRK, 0L);
|
||||||
|
#elif (defined(TCSBRK))
|
||||||
|
Syslog('t', "TCSBRK");
|
||||||
|
ioctl(0, TCSBRK, 0L);
|
||||||
|
#else /* any ideas about BSD? */
|
||||||
|
;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
11
mbsebbs/openport.h
Normal file
11
mbsebbs/openport.h
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef _OPENPORT_H
|
||||||
|
#define _OPENPORT_H
|
||||||
|
|
||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
void hangup(void);
|
||||||
|
int rawport(void);
|
||||||
|
int cookedport(void);
|
||||||
|
void sendbrk(void);
|
||||||
|
|
||||||
|
#endif
|
@ -41,6 +41,7 @@
|
|||||||
#include "mail.h"
|
#include "mail.h"
|
||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern pid_t mypid;
|
extern pid_t mypid;
|
||||||
@ -65,33 +66,34 @@ void Page_Sysop(char *String)
|
|||||||
if (CFG.iAskReason) {
|
if (CFG.iAskReason) {
|
||||||
locate(6, 0);
|
locate(6, 0);
|
||||||
colour(BLUE, BLACK);
|
colour(BLUE, BLACK);
|
||||||
printf("%c", 213);
|
PUTCHAR(213);
|
||||||
for (i = 0; i < 78; i++)
|
for (i = 0; i < 78; i++)
|
||||||
printf("%c", 205);
|
PUTCHAR(205);
|
||||||
printf("%c\n", 184);
|
PUTCHAR(184);
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
colour(LIGHTGRAY, BLACK);
|
colour(LIGHTGRAY, BLACK);
|
||||||
for (i = 0; i < 78; i++)
|
for (i = 0; i < 78; i++)
|
||||||
printf("%c", 250);
|
PUTCHAR(250);
|
||||||
printf("\n");
|
Enter(1);
|
||||||
|
|
||||||
colour(BLUE, BLACK);
|
colour(BLUE, BLACK);
|
||||||
printf("%c", 212);
|
PUTCHAR(212);
|
||||||
for (i = 0; i < 78; i++)
|
for (i = 0; i < 78; i++)
|
||||||
printf("%c", 205);
|
PUTCHAR(205);
|
||||||
printf("%c\n", 190);
|
PUTCHAR(190);
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
locate(7, 2);
|
locate(7, 2);
|
||||||
|
|
||||||
colour(LIGHTGRAY, BLACK);
|
colour(LIGHTGRAY, BLACK);
|
||||||
fflush(stdout);
|
|
||||||
GetPageStr(temp, 76);
|
GetPageStr(temp, 76);
|
||||||
|
|
||||||
colour(BLUE, BLACK);
|
colour(BLUE, BLACK);
|
||||||
printf("%c", 212);
|
PUTCHAR(212);
|
||||||
for (i = 0; i < 78; i++)
|
for (i = 0; i < 78; i++)
|
||||||
printf("%c", 205);
|
PUTCHAR(205);
|
||||||
printf("%c\n", 190);
|
PUTCHAR(190);
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
if ((strcmp(temp, "")) == 0)
|
if ((strcmp(temp, "")) == 0)
|
||||||
return;
|
return;
|
||||||
@ -102,7 +104,6 @@ void Page_Sysop(char *String)
|
|||||||
sprintf(Reason, "User want's to chat");
|
sprintf(Reason, "User want's to chat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CFG.iMaxPageTimes--;
|
CFG.iMaxPageTimes--;
|
||||||
|
|
||||||
if (CFG.iMaxPageTimes <= 0) {
|
if (CFG.iMaxPageTimes <= 0) {
|
||||||
@ -129,7 +130,7 @@ void Page_Sysop(char *String)
|
|||||||
pout(WHITE, BLACK, (char *)"[");
|
pout(WHITE, BLACK, (char *)"[");
|
||||||
colour(BLUE, BLACK);
|
colour(BLUE, BLACK);
|
||||||
for (i = 0; i < CFG.iPageLength; i++)
|
for (i = 0; i < CFG.iPageLength; i++)
|
||||||
printf("%c", 176);
|
PUTCHAR(176);
|
||||||
pout(WHITE, BLACK, (char *)"]");
|
pout(WHITE, BLACK, (char *)"]");
|
||||||
|
|
||||||
locate(16, ((80 - CFG.iPageLength) / 2 - 2) + 1);
|
locate(16, ((80 - CFG.iPageLength) / 2 - 2) + 1);
|
||||||
@ -168,8 +169,7 @@ void Page_Sysop(char *String)
|
|||||||
* Check for other errors
|
* Check for other errors
|
||||||
*/
|
*/
|
||||||
if (strcmp(buf, "100:1,3;") == 0) {
|
if (strcmp(buf, "100:1,3;") == 0) {
|
||||||
colour(LIGHTRED, BLACK);
|
pout(LIGHTRED, BLACK, (char *)"Internal system error, the sysop is informed");
|
||||||
printf("Internal system error, the sysop is informed");
|
|
||||||
Enter(2);
|
Enter(2);
|
||||||
Syslog('!', "Got error on page sysop command");
|
Syslog('!', "Got error on page sysop command");
|
||||||
Pause();
|
Pause();
|
||||||
@ -183,8 +183,7 @@ void Page_Sysop(char *String)
|
|||||||
*/
|
*/
|
||||||
colour(LIGHTBLUE, BLACK);
|
colour(LIGHTBLUE, BLACK);
|
||||||
for (i = 0; i < CFG.iPageLength; i++) {
|
for (i = 0; i < CFG.iPageLength; i++) {
|
||||||
printf("%c", 219);
|
PUTCHAR(219);
|
||||||
fflush(stdout);
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
|
||||||
sprintf(buf, "CISC:1,%d", mypid);
|
sprintf(buf, "CISC:1,%d", mypid);
|
||||||
@ -214,7 +213,7 @@ void Page_Sysop(char *String)
|
|||||||
}
|
}
|
||||||
|
|
||||||
PageReason();
|
PageReason();
|
||||||
printf("\n\n\n");
|
Enter(3);
|
||||||
Pause();
|
Pause();
|
||||||
if (strlen(Reason))
|
if (strlen(Reason))
|
||||||
SysopComment(Reason);
|
SysopComment(Reason);
|
||||||
@ -235,12 +234,6 @@ void GetPageStr(char *sStr, int iMaxlen)
|
|||||||
unsigned char ch = 0;
|
unsigned char ch = 0;
|
||||||
int iPos = 0;
|
int iPos = 0;
|
||||||
|
|
||||||
if ((ttyfd = open ("/dev/tty", O_RDWR)) < 0) {
|
|
||||||
perror("open 6");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Setraw();
|
|
||||||
|
|
||||||
strcpy(sStr, "");
|
strcpy(sStr, "");
|
||||||
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
@ -248,8 +241,9 @@ void GetPageStr(char *sStr, int iMaxlen)
|
|||||||
ch = Readkey();
|
ch = Readkey();
|
||||||
|
|
||||||
if (((ch == 8) || (ch == KEY_DEL) || (ch == 127)) && (iPos > 0)) {
|
if (((ch == 8) || (ch == KEY_DEL) || (ch == 127)) && (iPos > 0)) {
|
||||||
printf("\b%c\b", 250);
|
PUTCHAR('\b');
|
||||||
fflush(stdout);
|
PUTCHAR(250);
|
||||||
|
PUTCHAR('\b');
|
||||||
sStr[--iPos]='\0';
|
sStr[--iPos]='\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,16 +251,14 @@ void GetPageStr(char *sStr, int iMaxlen)
|
|||||||
if (iPos <= iMaxlen) {
|
if (iPos <= iMaxlen) {
|
||||||
iPos++;
|
iPos++;
|
||||||
sprintf(sStr, "%s%c", sStr, ch);
|
sprintf(sStr, "%s%c", sStr, ch);
|
||||||
printf("%c", ch);
|
PUTCHAR(ch);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
} else
|
} else
|
||||||
ch=13;
|
ch=13;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
Enter(1);
|
||||||
close(ttyfd);
|
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -309,9 +301,9 @@ void PageReason()
|
|||||||
if (Lines == j) {
|
if (Lines == j) {
|
||||||
Striplf(String);
|
Striplf(String);
|
||||||
locate(18, ((78 - strlen(String) ) / 2));
|
locate(18, ((78 - strlen(String) ) / 2));
|
||||||
pout(15, 0, (char *)"[");
|
pout(WHITE, BLACK, (char *)"[");
|
||||||
pout(9, 0, String);
|
pout(LIGHTBLUE, BLACK, String);
|
||||||
pout(15, 0, (char *)"]");
|
pout(WHITE, BLACK, (char *)"]");
|
||||||
iFoundString = TRUE;
|
iFoundString = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,9 +315,9 @@ void PageReason()
|
|||||||
/* Sysop currently is not available ... please leave a comment */
|
/* Sysop currently is not available ... please leave a comment */
|
||||||
sprintf(String, "%s", (char *) Language(155));
|
sprintf(String, "%s", (char *) Language(155));
|
||||||
locate(18, ((78 - strlen(String) ) / 2));
|
locate(18, ((78 - strlen(String) ) / 2));
|
||||||
pout(15, 0, (char *)"[");
|
pout(WHITE, BLACK, (char *)"[");
|
||||||
pout(9, 0, String);
|
pout(LIGHTBLUE, BLACK, String);
|
||||||
pout(15, 0, (char *)"]");
|
pout(WHITE, BLACK, (char *)"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
free(temp);
|
free(temp);
|
||||||
|
153
mbsebbs/pinfo.c
153
mbsebbs/pinfo.c
@ -35,31 +35,33 @@
|
|||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
void ls(int a)
|
void ls(int a)
|
||||||
{
|
{
|
||||||
printf("%c ", a ? 179 : '|');
|
PUTCHAR(a ? 179 : '|');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void rs(int a)
|
void rs(int a)
|
||||||
{
|
{
|
||||||
colour(8, 0);
|
colour(DARKGRAY, BLACK);
|
||||||
printf("%c\n", a ? 179 : '|');
|
PUTCHAR(a ? 179 : '|');
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void wl(int a)
|
void wl(int a)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ls(a);
|
ls(a);
|
||||||
for(i = 0; i < 76; i++)
|
for(i = 0; i < 76; i++)
|
||||||
printf(" ");
|
PUTCHAR(' ');
|
||||||
rs(a);
|
rs(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -69,80 +71,81 @@ void wl(int a)
|
|||||||
*/
|
*/
|
||||||
void cr(void)
|
void cr(void)
|
||||||
{
|
{
|
||||||
int a, i;
|
int a, i;
|
||||||
char *string, *temp;
|
char *string, *temp;
|
||||||
|
|
||||||
a = exitinfo.GraphMode;
|
a = exitinfo.GraphMode;
|
||||||
|
|
||||||
string = calloc(81, sizeof(char));
|
string = calloc(81, sizeof(char));
|
||||||
temp = calloc(81, sizeof(char));
|
temp = calloc(81, sizeof(char));
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
colour(8, 0);
|
colour(DARKGRAY, BLACK);
|
||||||
|
|
||||||
/* Print top row */
|
/* Print top row */
|
||||||
printf("%c", a ? 213 : '+');
|
PUTCHAR(a ? 213 : '+');
|
||||||
for(i = 0; i < 77; i++)
|
for (i = 0; i < 76; i++)
|
||||||
printf("%c", a ? 205 : '=');
|
PUTCHAR(a ? 205 : '=');
|
||||||
printf("%c\n", a ? 184 : '+');
|
PUTCHAR(a ? 184 : '+');
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
wl(a);
|
wl(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
sprintf(temp, "MBSE Bulletin Board System %s (%s-%s)", VERSION, OsName(), OsCPU());
|
sprintf(temp, "MBSE Bulletin Board System %s (%s-%s)", VERSION, OsName(), OsCPU());
|
||||||
pout(14, 0, padleft(temp, 76, ' '));
|
pout(YELLOW, BLACK, padleft(temp, 76, ' '));
|
||||||
rs(a);
|
rs(a);
|
||||||
wl(a);
|
wl(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
sprintf(temp, "%s", COPYRIGHT);
|
sprintf(temp, "%s", COPYRIGHT);
|
||||||
pout(11, 0, padleft(temp, 76, ' '));
|
pout(LIGHTCYAN, BLACK, padleft(temp, 76, ' '));
|
||||||
rs(a);
|
rs(a);
|
||||||
wl(a);
|
wl(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
sprintf(temp, "Compiled on %s at %s", __DATE__, __TIME__);
|
sprintf(temp, "Compiled on %s at %s", __DATE__, __TIME__);
|
||||||
pout(14, 0, padleft(temp, 76, ' '));
|
pout(LIGHTRED, BLACK, padleft(temp, 76, ' '));
|
||||||
rs(a);
|
rs(a);
|
||||||
wl(a);
|
wl(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(11, 0, (char *)"MBSE has been written and designed by Michiel Broek. Many others have given ");
|
pout(LIGHTCYAN, BLACK, (char *)"MBSE has been written and designed by Michiel Broek. Many others have given ");
|
||||||
rs(a);
|
rs(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(11, 0, (char *)"valuable time in the form of new ideas and suggestions on how to make MBSE ");
|
pout(LIGHTCYAN, BLACK, (char *)"valuable time in the form of new ideas and suggestions on how to make MBSE ");
|
||||||
rs(a);
|
rs(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(11, 0, (char *)"BBS a better BBS ");
|
pout(LIGHTCYAN, BLACK, (char *)"BBS a better BBS ");
|
||||||
rs(a);
|
rs(a);
|
||||||
wl(a);
|
wl(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(15, 0, (char *)"Available from http://www.mbse.dds.nl or 2:280/2802 ");
|
pout(WHITE, BLACK, (char *)"Available from http://www.mbse.dds.nl or 2:280/2802 ");
|
||||||
rs(a);
|
rs(a);
|
||||||
wl(a);
|
wl(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(12, 0, (char *)"JAM(mbp) - Copyright 1993 Joaquim Homrighausen, Andrew Milner, ");
|
pout(LIGHTRED, BLACK, (char *)"JAM(mbp) - Copyright 1993 Joaquim Homrighausen, Andrew Milner, ");
|
||||||
rs(a);
|
rs(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(12, 0, (char *)" Mats Birch, Mats Wallin. ");
|
pout(LIGHTRED, BLACK, (char *)" Mats Birch, Mats Wallin. ");
|
||||||
rs(a);
|
rs(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(12, 0, (char *)" ALL RIGHTS RESERVED. ");
|
pout(LIGHTRED, BLACK, (char *)" ALL RIGHTS RESERVED. ");
|
||||||
rs(a);
|
rs(a);
|
||||||
wl(a);
|
wl(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(9, 0, (char *)"This is free software; released under the terms of the GNU General Public ");
|
pout(LIGHTBLUE, BLACK, (char *)"This is free software; released under the terms of the GNU General Public ");
|
||||||
rs(a);
|
rs(a);
|
||||||
ls(a);
|
ls(a);
|
||||||
pout(9, 0, (char *)"License as published by the Free Software Foundation. ");
|
pout(LIGHTBLUE, BLACK, (char *)"License as published by the Free Software Foundation. ");
|
||||||
rs(a);
|
rs(a);
|
||||||
wl(a);
|
wl(a);
|
||||||
|
|
||||||
printf("%c", a ? 212 : '+');
|
PUTCHAR(a ? 212 : '+');
|
||||||
for(i = 0; i < 77; i++)
|
for (i = 0; i < 76; i++)
|
||||||
printf("%c", a ? 205 : '=');
|
PUTCHAR(a ? 205 : '=');
|
||||||
printf("%c", a ? 190 : '+');
|
PUTCHAR(a ? 190 : '+');
|
||||||
|
|
||||||
free(string);
|
free(string);
|
||||||
free(temp);
|
free(temp);
|
||||||
printf("\n");
|
Enter(1);
|
||||||
Pause();
|
Pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -38,15 +38,14 @@
|
|||||||
#include "msgutil.h"
|
#include "msgutil.h"
|
||||||
#include "pop3.h"
|
#include "pop3.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
void error_popmail(char *);
|
void error_popmail(char *);
|
||||||
void error_popmail(char *umsg)
|
void error_popmail(char *umsg)
|
||||||
{
|
{
|
||||||
pop3_close();
|
pop3_close();
|
||||||
colour(LIGHTRED, BLACK);
|
poutCR(LIGHTRED, BLACK, umsg);
|
||||||
printf("%s\r\n", umsg);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -185,9 +184,9 @@ void check_popmail(char *user, char *pass)
|
|||||||
/*
|
/*
|
||||||
* Show progress
|
* Show progress
|
||||||
*/
|
*/
|
||||||
colour(color, BLACK);
|
PUTCHAR('\r');
|
||||||
printf("\rFetching message %02d/%02d, total %d bytes", msgnum, tmsgs, size);
|
sprintf(temp, "Fetching message %02d/%02d, total %d bytes", msgnum, tmsgs, size);
|
||||||
fflush(stdout);
|
pout(color, BLACK, temp);
|
||||||
if (color < WHITE)
|
if (color < WHITE)
|
||||||
color++;
|
color++;
|
||||||
else
|
else
|
||||||
@ -197,16 +196,16 @@ void check_popmail(char *user, char *pass)
|
|||||||
fclose(tp);
|
fclose(tp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pop3_cmd((char *)"QUIT\r\n");
|
pop3_cmd((char *)"QUIT\r\n");
|
||||||
pop3_close();
|
pop3_close();
|
||||||
|
|
||||||
if (tmsgs) {
|
if (tmsgs) {
|
||||||
|
PUTCHAR('\r');
|
||||||
colour(LIGHTMAGENTA, BLACK);
|
colour(LIGHTMAGENTA, BLACK);
|
||||||
printf("\r \r");
|
pout(LIGHTMAGENTA, BLACK, (char *)" ");
|
||||||
fflush(stdout);
|
PUTCHAR('\r');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAXSIGLINES 4
|
#define MAXSIGLINES 4
|
||||||
@ -83,8 +84,9 @@ void toprow(void)
|
|||||||
|
|
||||||
pout(YELLOW, BLACK, (char *)" Õ");
|
pout(YELLOW, BLACK, (char *)" Õ");
|
||||||
for (i = 0; i < LENSIGLINES; i++)
|
for (i = 0; i < LENSIGLINES; i++)
|
||||||
printf("Í");
|
PUTCHAR('Í');
|
||||||
printf("¸\n");
|
PUTCHAR('¸');
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,8 +98,9 @@ void botrow(void)
|
|||||||
|
|
||||||
pout(YELLOW, BLACK, (char *)" Ô");
|
pout(YELLOW, BLACK, (char *)" Ô");
|
||||||
for (i = 0; i < LENSIGLINES; i++)
|
for (i = 0; i < LENSIGLINES; i++)
|
||||||
printf("Í");
|
PUTCHAR('Í');
|
||||||
printf("¾\n");
|
PUTCHAR('¾');
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -139,11 +142,9 @@ int loadsignature(void)
|
|||||||
|
|
||||||
toprow();
|
toprow();
|
||||||
for (i = 0; i < MAXSIGLINES; i++) {
|
for (i = 0; i < MAXSIGLINES; i++) {
|
||||||
colour(LIGHTRED, BLACK);
|
sprintf(temp, "%d:", i+1);
|
||||||
printf("%d:", i+1);
|
pout(LIGHTRED, BLACK, temp);
|
||||||
colour(CFG.MoreF, CFG.MoreB);
|
poutCR(CFG.MoreF, CFG.MoreB, sLiNE[i]);
|
||||||
printf("%s\n", sLiNE[i]);
|
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
botrow();
|
botrow();
|
||||||
|
|
||||||
@ -176,10 +177,9 @@ int editsignature(void)
|
|||||||
|
|
||||||
/* Select: */
|
/* Select: */
|
||||||
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(115));
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(115));
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
alarm_on();
|
alarm_on();
|
||||||
i = toupper(Getone());
|
i = toupper(Readkey());
|
||||||
Enter(1);
|
Enter(1);
|
||||||
|
|
||||||
if (i == Keystroke(114, 3)) {
|
if (i == Keystroke(114, 3)) {
|
||||||
@ -191,9 +191,10 @@ int editsignature(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} else if (i == Keystroke(114, 2)) {
|
} else if (i == Keystroke(114, 2)) {
|
||||||
|
Enter(1);
|
||||||
/* Edit which line: */
|
/* Edit which line: */
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
sprintf(temp, " %s", (char *) Language(118));
|
||||||
printf("\n %s", (char *) Language(118));
|
pout(CFG.HiliteF, CFG.HiliteB, temp);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(temp, 3);
|
GetstrC(temp, 3);
|
||||||
|
|
||||||
@ -202,27 +203,25 @@ int editsignature(void)
|
|||||||
|
|
||||||
i = atoi(temp);
|
i = atoi(temp);
|
||||||
if ((i < 1) || (i > MAXSIGLINES)) {
|
if ((i < 1) || (i > MAXSIGLINES)) {
|
||||||
|
Enter(1);
|
||||||
/* Line does not exist. */
|
/* Line does not exist. */
|
||||||
printf("%s\n", (char *) Language(119));
|
poutCR(LIGHTRED, BLACK, (char *) Language(119));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = strlen(sLiNE[i-1]);
|
x = strlen(sLiNE[i-1]);
|
||||||
colour(LIGHTRED, BLACK);
|
sprintf(temp, "%d:", i);
|
||||||
printf("%d:", i);
|
pout(LIGHTRED, BLACK, temp);
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
pout(CFG.InputColourF, CFG.InputColourB, sLiNE[i-1]);
|
||||||
printf("%s", sLiNE[i-1]);
|
|
||||||
fflush(stdout);
|
|
||||||
GetstrP(sLiNE[i-1], LENSIGLINES-1, x);
|
GetstrP(sLiNE[i-1], LENSIGLINES-1, x);
|
||||||
|
|
||||||
} else if (i == Keystroke(114, 0)) {
|
} else if (i == Keystroke(114, 0)) {
|
||||||
/* List lines */
|
/* List lines */
|
||||||
toprow();
|
toprow();
|
||||||
for (i = 0; i < MAXSIGLINES; i++) {
|
for (i = 0; i < MAXSIGLINES; i++) {
|
||||||
colour(LIGHTRED, BLACK);
|
sprintf(temp, "%d:", i+1);
|
||||||
printf("%d:", i+1);
|
pout(LIGHTRED, BLACK, temp);
|
||||||
colour(CFG.MoreF, CFG.MoreB);
|
poutCR(CFG.MoreF, CFG.MoreB, sLiNE[i]);
|
||||||
printf("%s\n", sLiNE[i]);
|
|
||||||
}
|
}
|
||||||
botrow();
|
botrow();
|
||||||
|
|
||||||
@ -251,9 +250,9 @@ int editsignature(void)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} else if (i == Keystroke(114, 1)) {
|
} else if (i == Keystroke(114, 1)) {
|
||||||
|
Enter(1);
|
||||||
/* Edit which line: */
|
/* Edit which line: */
|
||||||
colour(CFG.HiliteF, CFG.HiliteB);
|
pout(CFG.HiliteF, CFG.HiliteB, (char *) Language(118));
|
||||||
printf("\n%s", (char *) Language(118));
|
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
GetstrC(temp, 3);
|
GetstrC(temp, 3);
|
||||||
|
|
||||||
@ -263,15 +262,17 @@ int editsignature(void)
|
|||||||
i = atoi(temp);
|
i = atoi(temp);
|
||||||
|
|
||||||
if ((i < 1) || (i > MAXSIGLINES)) {
|
if ((i < 1) || (i > MAXSIGLINES)) {
|
||||||
|
Enter(1);
|
||||||
/* Line does not exist. */
|
/* Line does not exist. */
|
||||||
printf("\n%s", (char *) Language(119));
|
poutCR(LIGHTRED, BLACK, (char *) Language(119));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Line reads: */
|
/* Line reads: */
|
||||||
poutCR(CFG.MoreF, CFG.MoreB, (char *) Language(186));
|
poutCR(CFG.MoreF, CFG.MoreB, (char *) Language(186));
|
||||||
printf("%d:%s\n", i, sLiNE[i-1]);
|
sprintf(temp, "%d:%s", i, sLiNE[i-1]);
|
||||||
|
poutCR(CFG.MoreF, CFG.MoreB, temp);
|
||||||
|
|
||||||
Enter(1);
|
Enter(1);
|
||||||
/* Text to replace: */
|
/* Text to replace: */
|
||||||
@ -292,7 +293,7 @@ int editsignature(void)
|
|||||||
strreplace(sLiNE[i-1], temp, temp1);
|
strreplace(sLiNE[i-1], temp, temp1);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
printf("\n");
|
Enter(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(temp);
|
free(temp);
|
||||||
|
@ -33,6 +33,7 @@
|
|||||||
#include "../lib/mbselib.h"
|
#include "../lib/mbselib.h"
|
||||||
#include "../lib/users.h"
|
#include "../lib/users.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
int termmode; /* 0 = tty, 1 = ANSI */
|
int termmode; /* 0 = tty, 1 = ANSI */
|
||||||
@ -56,9 +57,10 @@ void Enter(int num)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < num; i++)
|
for (i = 0; i < num; i++) {
|
||||||
fprintf(stdout, "\n");
|
PUTCHAR('\r');
|
||||||
fflush(stdout);
|
PUTCHAR('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -67,8 +69,7 @@ void Enter(int num)
|
|||||||
void pout(int fg, int bg, char *Str)
|
void pout(int fg, int bg, char *Str)
|
||||||
{
|
{
|
||||||
colour(fg, bg);
|
colour(fg, bg);
|
||||||
fprintf(stdout, Str);
|
PUTSTR(Str);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -84,9 +85,9 @@ void poutCenter(int fg, int bg, char *Str)
|
|||||||
void poutCR(int fg, int bg, char *Str)
|
void poutCR(int fg, int bg, char *Str)
|
||||||
{
|
{
|
||||||
colour(fg, bg);
|
colour(fg, bg);
|
||||||
fputs(Str, stdout);
|
PUTSTR(Str);
|
||||||
fprintf(stdout, "\n");
|
PUTCHAR('\r');
|
||||||
fflush(stdout);
|
PUTCHAR('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -96,19 +97,21 @@ void poutCR(int fg, int bg, char *Str)
|
|||||||
*/
|
*/
|
||||||
void colour(int fg, int bg)
|
void colour(int fg, int bg)
|
||||||
{
|
{
|
||||||
|
char temp[61];
|
||||||
|
|
||||||
if (termmode == 1) {
|
if (termmode == 1) {
|
||||||
|
|
||||||
int att=0, fore=37, back=40;
|
int att=0, fore=37, back=40;
|
||||||
|
|
||||||
if (fg<0 || fg>31 || bg<0 || bg>7) {
|
if (fg<0 || fg>31 || bg<0 || bg>7) {
|
||||||
fprintf(stdout, "ANSI: Illegal colour specified: %i, %i\n", fg, bg);
|
sprintf(temp, "ANSI: Illegal colour specified: %i, %i\n", fg, bg);
|
||||||
fflush(stdout);
|
PUTSTR(temp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stdout, "[");
|
PUTSTR((char *)"[");
|
||||||
if ( fg > WHITE) {
|
if ( fg > WHITE) {
|
||||||
fprintf(stdout, "5;");
|
PUTSTR((char *)"5;");
|
||||||
fg-= 16;
|
fg-= 16;
|
||||||
}
|
}
|
||||||
if (fg > LIGHTGRAY) {
|
if (fg > LIGHTGRAY) {
|
||||||
@ -134,8 +137,8 @@ void colour(int fg, int bg)
|
|||||||
else if (bg == LIGHTGRAY) back=47;
|
else if (bg == LIGHTGRAY) back=47;
|
||||||
else back=40;
|
else back=40;
|
||||||
|
|
||||||
fprintf(stdout, "%d;%d;%dm", att, fore, back);
|
sprintf(temp, "%d;%d;%dm", att, fore, back);
|
||||||
fflush(stdout);
|
PUTSTR(temp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,17 +155,17 @@ void Center(char *string)
|
|||||||
Strlen = strlen(string);
|
Strlen = strlen(string);
|
||||||
|
|
||||||
if (Strlen == Maxlen)
|
if (Strlen == Maxlen)
|
||||||
fprintf(stdout, "%s\n", string);
|
PUTSTR(string);
|
||||||
else {
|
else {
|
||||||
x = Maxlen - Strlen;
|
x = Maxlen - Strlen;
|
||||||
z = x / 2;
|
z = x / 2;
|
||||||
for (i = 0; i < z; i++)
|
for (i = 0; i < z; i++)
|
||||||
strcat(Str, " ");
|
strcat(Str, " ");
|
||||||
strcat(Str, string);
|
strcat(Str, string);
|
||||||
fprintf(stdout, "%s\n", Str);
|
PUTSTR(Str);
|
||||||
}
|
}
|
||||||
|
PUTCHAR('\r');
|
||||||
fflush(stdout);
|
PUTCHAR('\n');
|
||||||
free(Str);
|
free(Str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,9 +175,8 @@ void clear()
|
|||||||
{
|
{
|
||||||
if (termmode == 1) {
|
if (termmode == 1) {
|
||||||
colour(LIGHTGRAY, BLACK);
|
colour(LIGHTGRAY, BLACK);
|
||||||
fprintf(stdout, ANSI_HOME);
|
PUTSTR((char *)ANSI_HOME);
|
||||||
fprintf(stdout, ANSI_CLEAR);
|
PUTSTR((char *)ANSI_CLEAR);
|
||||||
fflush(stdout);
|
|
||||||
} else
|
} else
|
||||||
Enter(1);
|
Enter(1);
|
||||||
}
|
}
|
||||||
@ -186,14 +188,15 @@ void clear()
|
|||||||
*/
|
*/
|
||||||
void locate(int y, int x)
|
void locate(int y, int x)
|
||||||
{
|
{
|
||||||
|
char temp[61];
|
||||||
|
|
||||||
if (termmode > 0) {
|
if (termmode > 0) {
|
||||||
if (y > termy || x > termx) {
|
if (y > termy || x > termx) {
|
||||||
fprintf(stdout, "ANSI: Invalid screen coordinates: %i, %i\n", y, x);
|
sprintf(temp, "ANSI: Invalid screen coordinates: %i, %i\n", y, x);
|
||||||
fflush(stdout);
|
} else {
|
||||||
return;
|
sprintf(temp, "\x1B[%i;%iH", y, x);
|
||||||
}
|
}
|
||||||
fprintf(stdout, "\x1B[%i;%iH", y, x);
|
PUTSTR(temp);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,19 +208,18 @@ void fLine(int Len)
|
|||||||
|
|
||||||
if (termmode == 0)
|
if (termmode == 0)
|
||||||
for (x = 0; x < Len; x++)
|
for (x = 0; x < Len; x++)
|
||||||
fprintf(stdout, "-");
|
PUTCHAR('-');
|
||||||
|
|
||||||
if (termmode == 1)
|
if (termmode == 1)
|
||||||
for (x = 0; x < Len; x++)
|
for (x = 0; x < Len; x++)
|
||||||
fprintf(stdout, "%c", 196);
|
PUTCHAR(196);
|
||||||
|
|
||||||
fprintf(stdout, " \n");
|
PUTCHAR('\r');
|
||||||
fflush(stdout);
|
PUTCHAR('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void sLine()
|
void sLine()
|
||||||
{
|
{
|
||||||
fLine(termx -1);
|
fLine(termx -1);
|
||||||
@ -240,9 +242,8 @@ void mvprintw(int y, int x, const char *format, ...)
|
|||||||
va_end(va_ptr);
|
va_end(va_ptr);
|
||||||
|
|
||||||
locate(y, x);
|
locate(y, x);
|
||||||
fprintf(stdout, outputstr);
|
PUTSTR(outputstr);
|
||||||
free(outputstr);
|
free(outputstr);
|
||||||
fflush(stdout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#include "language.h"
|
#include "language.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern pid_t mypid; /* Pid of this program */
|
extern pid_t mypid; /* Pid of this program */
|
||||||
@ -53,7 +54,7 @@ void Check_PM(void);
|
|||||||
void Check_PM(void)
|
void Check_PM(void)
|
||||||
{
|
{
|
||||||
static char buf[200];
|
static char buf[200];
|
||||||
char resp[128];
|
char resp[128], msg[81];
|
||||||
|
|
||||||
sprintf(buf, "CIPM:1,%d;", mypid);
|
sprintf(buf, "CIPM:1,%d;", mypid);
|
||||||
if (socket_send(buf) == 0) {
|
if (socket_send(buf) == 0) {
|
||||||
@ -64,12 +65,17 @@ void Check_PM(void)
|
|||||||
strncpy(resp, strtok(buf, ":"), 5); /* Should be 100 */
|
strncpy(resp, strtok(buf, ":"), 5); /* Should be 100 */
|
||||||
strncpy(resp, strtok(NULL, ","), 3); /* Should be 2 */
|
strncpy(resp, strtok(NULL, ","), 3); /* Should be 2 */
|
||||||
strncpy(resp, strtok(NULL, ","), 36); /* From Name */
|
strncpy(resp, strtok(NULL, ","), 36); /* From Name */
|
||||||
|
|
||||||
|
Enter(2);
|
||||||
|
PUTCHAR('\007');
|
||||||
colour(CYAN, BLACK);
|
colour(CYAN, BLACK);
|
||||||
/* ** Message ** from */
|
/* ** Message ** from */
|
||||||
printf("\n\n\007%s %s:\n", (char *)Language(434), resp);
|
sprintf(msg, "%s %s:", (char *)Language(434), resp);
|
||||||
|
poutCR(CYAN, BLACK, msg);
|
||||||
strncpy(resp, strtok(NULL, "\0"), 80); /* The real message */
|
strncpy(resp, strtok(NULL, "\0"), 80); /* The real message */
|
||||||
resp[strlen(resp)-1] = '\0';
|
resp[strlen(resp)-1] = '\0';
|
||||||
printf("%s\n", resp);
|
PUTSTR(resp);
|
||||||
|
Enter(1);
|
||||||
Pause();
|
Pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,7 +116,8 @@ void TimeCheck(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (exitinfo.iTimeLeft <= 0) {
|
if (exitinfo.iTimeLeft <= 0) {
|
||||||
printf("\n%s\n", (char *) Language(130));
|
Enter(1);
|
||||||
|
poutCR(YELLOW, BLACK, (char *) Language(130));
|
||||||
sleep(3);
|
sleep(3);
|
||||||
Syslog('!', "Users time limit exceeded ... user disconnected!");
|
Syslog('!', "Users time limit exceeded ... user disconnected!");
|
||||||
iExpired = TRUE;
|
iExpired = TRUE;
|
||||||
|
@ -41,93 +41,96 @@
|
|||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
|
||||||
|
|
||||||
extern int e_pid; /* Pid of external program */
|
extern int e_pid; /* Pid of external program */
|
||||||
|
extern int hanged_up; /* Hanged up status */
|
||||||
|
|
||||||
|
|
||||||
void die(int onsig)
|
void die(int onsig)
|
||||||
{
|
{
|
||||||
/*
|
if (onsig <= NSIG)
|
||||||
* First check if there is a child running, if so, kill it.
|
|
||||||
*/
|
|
||||||
if (e_pid) {
|
|
||||||
if ((kill(e_pid, SIGTERM)) == 0)
|
|
||||||
Syslog('+', "SIGTERM to pid %d succeeded", e_pid);
|
|
||||||
else {
|
|
||||||
if ((kill(e_pid, SIGKILL)) == 0)
|
|
||||||
Syslog('+', "SIGKILL to pid %d succeeded", e_pid);
|
|
||||||
else
|
|
||||||
WriteError("Failed to kill pid %d", e_pid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In case the child had the tty in raw mode, reset the tty
|
|
||||||
*/
|
|
||||||
execute_pth((char *)"stty", (char *)"sane", (char *)"/dev/null", (char *)"/dev/null", (char *)"/dev/null");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (MsgBase.Locked)
|
|
||||||
Msg_UnLock();
|
|
||||||
if (MsgBase.Open)
|
|
||||||
Msg_Close();
|
|
||||||
|
|
||||||
Home();
|
|
||||||
signal(onsig, SIG_IGN);
|
signal(onsig, SIG_IGN);
|
||||||
if (onsig)
|
|
||||||
if (onsig == SIGHUP) {
|
|
||||||
Syslog('+', "Lost Carrier");
|
|
||||||
} else if (onsig == SIGALRM) {
|
|
||||||
Syslog('+', "User inactivity timeout");
|
|
||||||
} else {
|
|
||||||
if (onsig <= NSIG)
|
|
||||||
WriteError("Terminated on signal %d (%s)", onsig, SigName[onsig]);
|
|
||||||
else
|
|
||||||
WriteError("Terminated with error %d", onsig);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Syslog(' ', "Terminated by user");
|
|
||||||
|
|
||||||
if (onsig == SIGSEGV) {
|
/*
|
||||||
Syslog('+', "Last msg area %s", msgs.Name);
|
* First check if there is a child running, if so, kill it.
|
||||||
|
*/
|
||||||
|
if (e_pid) {
|
||||||
|
if ((kill(e_pid, SIGTERM)) == 0)
|
||||||
|
Syslog('+', "SIGTERM to pid %d succeeded", e_pid);
|
||||||
|
else {
|
||||||
|
if ((kill(e_pid, SIGKILL)) == 0)
|
||||||
|
Syslog('+', "SIGKILL to pid %d succeeded", e_pid);
|
||||||
|
else
|
||||||
|
WriteError("Failed to kill pid %d", e_pid);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Good_Bye(onsig);
|
if (MsgBase.Locked)
|
||||||
|
Msg_UnLock();
|
||||||
|
if (MsgBase.Open)
|
||||||
|
Msg_Close();
|
||||||
|
|
||||||
|
Home();
|
||||||
|
if (onsig) {
|
||||||
|
if (onsig == SIGHUP) {
|
||||||
|
hanged_up = 1;
|
||||||
|
Syslog('+', "Lost Carrier");
|
||||||
|
} else if (onsig == SIGPIPE) {
|
||||||
|
hanged_up = 1;
|
||||||
|
Syslog('+', "Broken Pipe");
|
||||||
|
} else if (onsig == SIGALRM) {
|
||||||
|
Syslog('+', "User inactivity timeout");
|
||||||
|
} else {
|
||||||
|
if (onsig <= NSIG)
|
||||||
|
WriteError("Terminated on signal %d (%s)", onsig, SigName[onsig]);
|
||||||
|
else
|
||||||
|
WriteError("Terminated with error %d", onsig);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Syslog(' ', "Terminated by user");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onsig == SIGSEGV) {
|
||||||
|
Syslog('+', "Last msg area %s", msgs.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
Good_Bye(onsig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void alarm_sig()
|
void alarm_sig()
|
||||||
{
|
{
|
||||||
colour(LIGHTRED, BLACK);
|
Enter(2);
|
||||||
/* Autologout: idletime reached.*/
|
/* Autologout: idletime reached.*/
|
||||||
printf("\r\n%s\r\n", (char *) Language(410));
|
pout(LIGHTRED, BLACK, (char *) Language(410));
|
||||||
|
Enter(2);
|
||||||
|
|
||||||
Syslog('!', "Autologout: idletime reached");
|
Syslog('!', "Autologout: idletime reached");
|
||||||
die(SIGALRM);
|
die(SIGALRM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void alarm_set(int val)
|
void alarm_set(int val)
|
||||||
{
|
{
|
||||||
signal(SIGALRM, (void (*))alarm_sig);
|
signal(SIGALRM, (void (*))alarm_sig);
|
||||||
alarm(val);
|
alarm(val);
|
||||||
Syslog('S', "Alarm set for %d seconds", val);
|
Syslog('S', "Alarm set for %d seconds", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void alarm_on()
|
void alarm_on()
|
||||||
{
|
{
|
||||||
alarm_set(60 * CFG.idleout);
|
alarm_set(60 * CFG.idleout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void alarm_off()
|
void alarm_off()
|
||||||
{
|
{
|
||||||
alarm(0);
|
alarm(0);
|
||||||
signal(SIGALRM, SIG_IGN);
|
signal(SIGALRM, SIG_IGN);
|
||||||
Syslog('S', "Alarm is off");
|
Syslog('S', "Alarm is off");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,49 +42,56 @@
|
|||||||
|
|
||||||
void TimeStats()
|
void TimeStats()
|
||||||
{
|
{
|
||||||
char Logdate[15];
|
char Logdate[21], msg[81];
|
||||||
|
|
||||||
Time_Now = time(NULL);
|
Time_Now = time(NULL);
|
||||||
l_date = localtime(&Time_Now);
|
l_date = localtime(&Time_Now);
|
||||||
sprintf(Logdate,"%02d-%s %02d:%02d:%02d", l_date->tm_mday, GetMonth(l_date->tm_mon+1),
|
sprintf(Logdate, "%02d-%s %02d:%02d:%02d", l_date->tm_mday, GetMonth(l_date->tm_mon+1),
|
||||||
l_date->tm_hour, l_date->tm_min, l_date->tm_sec);
|
l_date->tm_hour, l_date->tm_min, l_date->tm_sec);
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
ReadExitinfo();
|
ReadExitinfo();
|
||||||
|
|
||||||
colour(15, 0);
|
Enter(1);
|
||||||
/* TIME STATISTICS for */
|
/* TIME STATISTICS for */
|
||||||
printf("\n%s%s ", (char *) Language(134), exitinfo.sUserName);
|
sprintf(msg, "%s%s ", (char *) Language(134), exitinfo.sUserName);
|
||||||
/* on */
|
pout(WHITE, BLACK, msg);
|
||||||
printf("%s %s\n", (char *) Language(135), Logdate);
|
/* on */
|
||||||
|
sprintf(msg, "%s %s", (char *) Language(135), Logdate);
|
||||||
|
poutCR(WHITE, BLACK, msg);
|
||||||
|
|
||||||
colour(12, 0);
|
colour(LIGHTRED, BLACK);
|
||||||
fLine(79);
|
fLine(79);
|
||||||
|
|
||||||
printf("\n");
|
Enter(1);
|
||||||
|
|
||||||
colour(10, 0);
|
/* Current Time */
|
||||||
|
sprintf(msg, "%s %s", (char *) Language(136), (char *) GetLocalHMS());
|
||||||
|
poutCR(LIGHTGREEN, BLACK, msg);
|
||||||
|
|
||||||
/* Current Time */
|
/* Current Date */
|
||||||
printf("%s %s\n", (char *) Language(136), (char *) GetLocalHMS());
|
sprintf(msg, "%s %s", (char *) Language(137), (char *) GLCdateyy());
|
||||||
|
poutCR(LIGHTGREEN, BLACK, msg);
|
||||||
|
Enter(1);
|
||||||
|
|
||||||
/* Current Date */
|
/* Connect time */
|
||||||
printf("%s %s\n\n", (char *) Language(137), (char *) GLCdateyy());
|
sprintf(msg, "%s %d %s", (char *) Language(138), exitinfo.iConnectTime, (char *) Language(471));
|
||||||
|
poutCR(LIGHTGREEN, BLACK, msg);
|
||||||
|
|
||||||
/* Connect time */
|
/* Time used today */
|
||||||
printf("%s %d %s\n", (char *) Language(138), exitinfo.iConnectTime, (char *) Language(471));
|
sprintf(msg, "%s %d %s", (char *) Language(139), exitinfo.iTimeUsed, (char *) Language(471));
|
||||||
|
poutCR(LIGHTGREEN, BLACK, msg);
|
||||||
|
|
||||||
/* Time used today */
|
/* Time remaining today */
|
||||||
printf("%s %d %s\n", (char *) Language(139), exitinfo.iTimeUsed, (char *) Language(471));
|
sprintf(msg, "%s %d %s", (char *) Language(140), exitinfo.iTimeLeft, (char *) Language(471));
|
||||||
|
poutCR(LIGHTGREEN, BLACK, msg);
|
||||||
|
|
||||||
/* Time remaining today */
|
/* Daily time limit */
|
||||||
printf("%s %d %s\n", (char *) Language(140), exitinfo.iTimeLeft, (char *) Language(471));
|
sprintf(msg, "%s %d %s", (char *) Language(141), exitinfo.iTimeUsed + exitinfo.iTimeLeft, (char *) Language(471));
|
||||||
|
poutCR(LIGHTGREEN, BLACK, msg);
|
||||||
|
|
||||||
/* Daily time limit */
|
Enter(1);
|
||||||
printf("%s %d %s\n", (char *) Language(141), exitinfo.iTimeUsed + exitinfo.iTimeLeft, (char *) Language(471));
|
Pause();
|
||||||
|
|
||||||
printf("\n");
|
|
||||||
Pause();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
594
mbsebbs/ttyio.c
Normal file
594
mbsebbs/ttyio.c
Normal file
@ -0,0 +1,594 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
* Purpose ...............: tty I/O for mbsebbs and mbnewusr
|
||||||
|
*
|
||||||
|
*****************************************************************************
|
||||||
|
* Copyright (C) 1997-2004
|
||||||
|
*
|
||||||
|
* Michiel Broek FIDO: 2:280/2802
|
||||||
|
* Beekmansbos 10
|
||||||
|
* 1971 BV IJmuiden
|
||||||
|
* the Netherlands
|
||||||
|
*
|
||||||
|
* This file is part of MBSE BBS.
|
||||||
|
*
|
||||||
|
* This BBS is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2, or (at your option) any
|
||||||
|
* later version.
|
||||||
|
*
|
||||||
|
* MBSE BBS is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with MBSE BBS; see the file COPYING. If not, write to the Free
|
||||||
|
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "../config.h"
|
||||||
|
#include "../lib/mbselib.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
|
extern int hanged_up;
|
||||||
|
extern char *inetaddr;
|
||||||
|
|
||||||
|
#define TT_BUFSIZ 1024
|
||||||
|
#define NUMTIMERS 3
|
||||||
|
|
||||||
|
|
||||||
|
int tty_status = 0;
|
||||||
|
int f_flags;
|
||||||
|
static char buffer[TT_BUFSIZ];
|
||||||
|
static char *next;
|
||||||
|
static int left = 0;
|
||||||
|
|
||||||
|
|
||||||
|
static time_t timer[NUMTIMERS];
|
||||||
|
|
||||||
|
char *ttystat[]= {(char *)"Ok",
|
||||||
|
(char *)"Error",
|
||||||
|
(char *)"TimeOut",
|
||||||
|
(char *)"EOF",
|
||||||
|
(char *)"Hangup",
|
||||||
|
(char *)"Empty",
|
||||||
|
(char *)"UnCompress"};
|
||||||
|
|
||||||
|
int tty_resettimer(int tno);
|
||||||
|
void tty_resettimers(void);
|
||||||
|
int tty_settimer(int,int);
|
||||||
|
int tty_expired(int);
|
||||||
|
int tty_running(int);
|
||||||
|
|
||||||
|
#define RESETTIMER(x) tty_resettimer(x)
|
||||||
|
#define RESETTIMERS() tty_resettimers()
|
||||||
|
#define SETTIMER(x,y) tty_settimer(x,y)
|
||||||
|
#define EXPIRED(x) tty_expired(x)
|
||||||
|
#define RUNNING(x) tty_running(x)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* timer functions
|
||||||
|
*/
|
||||||
|
int tty_resettimer(int tno)
|
||||||
|
{
|
||||||
|
if (tno >= NUMTIMERS) {
|
||||||
|
errno = EINVAL;
|
||||||
|
WriteError("ttyio: invalid timer No for resettimer(%d)", tno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
timer[tno] = (time_t) 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void tty_resettimers(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < NUMTIMERS; i++)
|
||||||
|
timer[i] = (time_t)0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_settimer(int tno, int interval)
|
||||||
|
{
|
||||||
|
if (tno >= NUMTIMERS) {
|
||||||
|
errno = EINVAL;
|
||||||
|
WriteError("ttyio: invalid timer No for settimer(%d)", tno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
timer[tno]=time((time_t*)NULL)+interval;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_expired(int tno)
|
||||||
|
{
|
||||||
|
time_t now;
|
||||||
|
|
||||||
|
if (tno >= NUMTIMERS) {
|
||||||
|
errno = EINVAL;
|
||||||
|
WriteError("ttyio: invalid timer No for expired(%d)", tno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if timer is running
|
||||||
|
*/
|
||||||
|
if (timer[tno] == (time_t) 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
now = time(NULL);
|
||||||
|
return (now >= timer[tno]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_running(int tno)
|
||||||
|
{
|
||||||
|
if (tno > NUMTIMERS) {
|
||||||
|
errno = EINVAL;
|
||||||
|
WriteError("ttyio: invalid timer for tty_running(%d)", tno);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* check if timer is running
|
||||||
|
*/
|
||||||
|
if (timer[tno] == (time_t) 0)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* private r/w functions
|
||||||
|
*/
|
||||||
|
static int tty_read(char *buf, int size, int tot)
|
||||||
|
{
|
||||||
|
time_t timeout, now;
|
||||||
|
int i, rc;
|
||||||
|
fd_set readfds, writefds, exceptfds;
|
||||||
|
struct timeval seltimer;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
return 0;
|
||||||
|
tty_status = 0;
|
||||||
|
|
||||||
|
now = time(NULL);
|
||||||
|
timeout = (time_t)300; /* maximum of 5 minutes */
|
||||||
|
|
||||||
|
for (i = 0; i < NUMTIMERS; i++) {
|
||||||
|
if (timer[i]) {
|
||||||
|
if (now >= timer[i]) {
|
||||||
|
tty_status=STAT_TIMEOUT;
|
||||||
|
Syslog('!', "tty_read: timer %d already expired, return", i);
|
||||||
|
return -tty_status;
|
||||||
|
} else {
|
||||||
|
if (timeout > (timer[i]-now))
|
||||||
|
timeout=timer[i]-now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((tot != -1) && (timeout > tot))
|
||||||
|
timeout=tot;
|
||||||
|
|
||||||
|
FD_ZERO(&readfds);
|
||||||
|
FD_ZERO(&writefds);
|
||||||
|
FD_ZERO(&exceptfds);
|
||||||
|
FD_SET(0,&readfds);
|
||||||
|
FD_SET(0,&exceptfds);
|
||||||
|
seltimer.tv_sec=timeout;
|
||||||
|
seltimer.tv_usec=0;
|
||||||
|
|
||||||
|
rc = select(1,&readfds,&writefds,&exceptfds,&seltimer);
|
||||||
|
|
||||||
|
if (rc < 0) {
|
||||||
|
if (hanged_up) {
|
||||||
|
tty_status=STAT_HANGUP;
|
||||||
|
WriteError("tty_read: hanged_up flag");
|
||||||
|
} else {
|
||||||
|
WriteError("$tty_read: select for read failed");
|
||||||
|
tty_status = STAT_ERROR;
|
||||||
|
}
|
||||||
|
} else if (rc == 0) {
|
||||||
|
tty_status = STAT_TIMEOUT;
|
||||||
|
} else { /* rc > 0 */
|
||||||
|
if (FD_ISSET(0,&exceptfds)) {
|
||||||
|
Syslog('!', "$tty_read: exeption error");
|
||||||
|
tty_status = STAT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tty_status) {
|
||||||
|
return -tty_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!FD_ISSET(0,&readfds)) {
|
||||||
|
WriteError("tty_read: Cannot be: select returned but read fd not set");
|
||||||
|
tty_status = STAT_ERROR;
|
||||||
|
return -tty_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = read(0,buf,size);
|
||||||
|
|
||||||
|
if (rc <= 0) {
|
||||||
|
Syslog('t', "tty_read: return %d",rc);
|
||||||
|
if (hanged_up || (errno == EPIPE) || (errno == ECONNRESET)) {
|
||||||
|
tty_status = STAT_HANGUP;
|
||||||
|
WriteError("tty_read: hanged_up flag");
|
||||||
|
} else {
|
||||||
|
tty_status = STAT_ERROR;
|
||||||
|
Syslog('!', "tty_read: error flag");
|
||||||
|
}
|
||||||
|
rc=-tty_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_write(char *buf, int size)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
|
tty_status=0;
|
||||||
|
result = write(1, buf, size);
|
||||||
|
|
||||||
|
if (result != size) {
|
||||||
|
if (hanged_up || (errno == EPIPE) || (errno == ECONNRESET)) {
|
||||||
|
tty_status = STAT_HANGUP;
|
||||||
|
WriteError("tty_write: hanged_up flag");
|
||||||
|
} else {
|
||||||
|
tty_status=STAT_ERROR;
|
||||||
|
Syslog('!', "tty_write: error flag");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tty_status)
|
||||||
|
Syslog('t', "tty_write: error %s", ttystat[tty_status]);
|
||||||
|
|
||||||
|
return -tty_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* public r/w functions */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check if there is data available on stdin.
|
||||||
|
*/
|
||||||
|
int tty_check(void)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
// try to read available (timeout = 0) data if we have no data in
|
||||||
|
// our buffer
|
||||||
|
|
||||||
|
if (!left) {
|
||||||
|
rc = tty_read(buffer, TT_BUFSIZ, 0);
|
||||||
|
if (rc > 0) {
|
||||||
|
left = rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return (left > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_putcheck(int size)
|
||||||
|
{
|
||||||
|
fd_set set;
|
||||||
|
struct timeval timeout;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the file descriptor set.
|
||||||
|
*/
|
||||||
|
FD_ZERO(&set);
|
||||||
|
FD_SET(1, &set);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the timeout data structure.
|
||||||
|
*/
|
||||||
|
timeout.tv_sec = 0;
|
||||||
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* `select' returns 0 if timeout, 1 if input available, -1 if error.
|
||||||
|
*/
|
||||||
|
return select(FD_SETSIZE, NULL, &set, NULL, &timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_waitputget(int tot)
|
||||||
|
{
|
||||||
|
int i, rc;
|
||||||
|
time_t timeout, now;
|
||||||
|
fd_set readfds, writefds, exceptfds;
|
||||||
|
struct timeval seltimer;
|
||||||
|
|
||||||
|
tty_status=0;
|
||||||
|
now = time(NULL);
|
||||||
|
timeout=(time_t)300; /* maximum of 5 minutes */
|
||||||
|
|
||||||
|
for (i = 0; i < NUMTIMERS; i++) {
|
||||||
|
if (timer[i]) {
|
||||||
|
if (now >= timer[i]) {
|
||||||
|
tty_status = STAT_TIMEOUT;
|
||||||
|
WriteError("tty_waitputget: timer %d already expired, return",i);
|
||||||
|
return -tty_status;
|
||||||
|
} else {
|
||||||
|
if (timeout > (timer[i]-now))
|
||||||
|
timeout = timer[i]-now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((tot != -1) && (timeout > tot))
|
||||||
|
timeout=tot;
|
||||||
|
Syslog('t', "tty_waitputget: timeout=%d",timeout);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the file descriptor set.
|
||||||
|
*/
|
||||||
|
FD_ZERO(&readfds);
|
||||||
|
FD_ZERO(&writefds);
|
||||||
|
FD_ZERO(&exceptfds);
|
||||||
|
|
||||||
|
FD_SET(0, &readfds);
|
||||||
|
FD_SET(1, &writefds);
|
||||||
|
FD_SET(0, &exceptfds);
|
||||||
|
FD_SET(1, &exceptfds);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Initialize the timeout data structure.
|
||||||
|
*/
|
||||||
|
seltimer.tv_sec = timeout;
|
||||||
|
seltimer.tv_usec = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* `select' returns 0 if timeout, 1 if input available, -1 if error.
|
||||||
|
*/
|
||||||
|
rc = select(FD_SETSIZE, &readfds, &writefds, &exceptfds, &seltimer);
|
||||||
|
|
||||||
|
if (rc < 0) {
|
||||||
|
if (hanged_up) {
|
||||||
|
tty_status=STAT_HANGUP;
|
||||||
|
WriteError("tty_waitputget: hanged_up flag");
|
||||||
|
} else {
|
||||||
|
WriteError("$tty_waitputget: select failed");
|
||||||
|
tty_status=STAT_ERROR;
|
||||||
|
}
|
||||||
|
} else if (rc == 0) {
|
||||||
|
tty_status=STAT_TIMEOUT;
|
||||||
|
} else {
|
||||||
|
/* rc > 0 */
|
||||||
|
if ((FD_ISSET(0,&exceptfds)) || (FD_ISSET(1,&exceptfds))) {
|
||||||
|
WriteError("$tty_waitputget: exeption error");
|
||||||
|
tty_status=STAT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tty_status) {
|
||||||
|
Syslog('t', "tty_waitputget: return after select status %s",ttystat[tty_status]);
|
||||||
|
return -tty_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = 0;
|
||||||
|
|
||||||
|
if (FD_ISSET(0,&readfds))
|
||||||
|
rc |= 1;
|
||||||
|
|
||||||
|
if (FD_ISSET(1,&writefds))
|
||||||
|
rc |= 2;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Discard all available input characters
|
||||||
|
*/
|
||||||
|
void tty_flushin(void)
|
||||||
|
{
|
||||||
|
tcflush(0, TCIFLUSH);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Discard all available characters in output buffer.
|
||||||
|
*/
|
||||||
|
void tty_flushout(void)
|
||||||
|
{
|
||||||
|
tcflush(1, TCOFLUSH);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_ungetc(int c)
|
||||||
|
{
|
||||||
|
if (next == buffer) {
|
||||||
|
if (left >= TT_BUFSIZ) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
next = buffer + TT_BUFSIZ - left;
|
||||||
|
memcpy(next, buffer, left);
|
||||||
|
}
|
||||||
|
|
||||||
|
next--;
|
||||||
|
*next = c;
|
||||||
|
left++;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_getc(int tot)
|
||||||
|
{
|
||||||
|
if (!left) {
|
||||||
|
left=tty_read(buffer,TT_BUFSIZ,tot);
|
||||||
|
next=buffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (left <= 0) {
|
||||||
|
left=0;
|
||||||
|
return -tty_status;
|
||||||
|
} else {
|
||||||
|
left--;
|
||||||
|
return (*next++)&0xff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_get(char *buf, int size, int tot)
|
||||||
|
{
|
||||||
|
int result=0;
|
||||||
|
|
||||||
|
if (left >= size) {
|
||||||
|
memcpy(buf,next,size);
|
||||||
|
next += size;
|
||||||
|
left -= size;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (left > 0) {
|
||||||
|
memcpy(buf,next,left);
|
||||||
|
buf += left;
|
||||||
|
next += left;
|
||||||
|
size -= left;
|
||||||
|
left=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((result=tty_read(buf,size,tot)) > 0) {
|
||||||
|
buf += result;
|
||||||
|
size -= result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_putc(int c)
|
||||||
|
{
|
||||||
|
char buf = c;
|
||||||
|
|
||||||
|
return tty_write(&buf,1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_put(char *buf, int size)
|
||||||
|
{
|
||||||
|
return tty_write(buf,size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int tty_putget(char **obuf, int *osize, char **ibuf, int *isize)
|
||||||
|
{
|
||||||
|
time_t timeout, now;
|
||||||
|
int i, rc;
|
||||||
|
fd_set readfds, writefds, exceptfds;
|
||||||
|
struct timeval seltimer;
|
||||||
|
|
||||||
|
tty_status = 0;
|
||||||
|
now = time(NULL);
|
||||||
|
timeout = (time_t)300; /* maximum of 5 minutes */
|
||||||
|
|
||||||
|
for (i = 0; i < NUMTIMERS; i++) {
|
||||||
|
if (timer[i]) {
|
||||||
|
if (now >= timer[i]) {
|
||||||
|
tty_status = STAT_TIMEOUT;
|
||||||
|
WriteError("tty_putget: timer %d already expired, return",i);
|
||||||
|
return -tty_status;
|
||||||
|
} else {
|
||||||
|
if (timeout > (timer[i]-now))
|
||||||
|
timeout=timer[i]-now;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Syslog('t', "tty_putget: timeout=%d",timeout);
|
||||||
|
|
||||||
|
FD_ZERO(&readfds);
|
||||||
|
FD_ZERO(&writefds);
|
||||||
|
FD_ZERO(&exceptfds);
|
||||||
|
FD_SET(0,&readfds);
|
||||||
|
FD_SET(1,&writefds);
|
||||||
|
FD_SET(0,&exceptfds);
|
||||||
|
FD_SET(1,&exceptfds);
|
||||||
|
seltimer.tv_sec=timeout;
|
||||||
|
seltimer.tv_usec=0;
|
||||||
|
|
||||||
|
rc=select(2,&readfds,&writefds,&exceptfds,&seltimer);
|
||||||
|
if (rc < 0) {
|
||||||
|
if (hanged_up) {
|
||||||
|
tty_status=STAT_HANGUP;
|
||||||
|
WriteError("tty_putget: hanged_up flag");
|
||||||
|
} else {
|
||||||
|
WriteError("$tty_putget: select failed");
|
||||||
|
tty_status=STAT_ERROR;
|
||||||
|
}
|
||||||
|
} else if (rc == 0) {
|
||||||
|
tty_status=STAT_TIMEOUT;
|
||||||
|
} else {
|
||||||
|
/* rc > 0 */
|
||||||
|
if ((FD_ISSET(0,&exceptfds)) || (FD_ISSET(1,&exceptfds))) {
|
||||||
|
WriteError("$tty_putget: exeption error");
|
||||||
|
tty_status=STAT_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tty_status) {
|
||||||
|
Syslog('t', "tty_putget: return after select status %s",ttystat[tty_status]);
|
||||||
|
return -tty_status;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FD_ISSET(0,&readfds) && *isize) {
|
||||||
|
rc = read(0, *ibuf, *isize);
|
||||||
|
if (rc < 0) {
|
||||||
|
WriteError("$tty_putget: read failed");
|
||||||
|
tty_status=STAT_ERROR;
|
||||||
|
} else {
|
||||||
|
(*ibuf)+=rc;
|
||||||
|
(*isize)-=rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (FD_ISSET(1,&writefds) && *osize) {
|
||||||
|
rc=write(1, *obuf, *osize);
|
||||||
|
if (rc < 0) {
|
||||||
|
WriteError("$tty_putget: write failed");
|
||||||
|
tty_status=STAT_ERROR;
|
||||||
|
} else {
|
||||||
|
(*obuf)+=rc;
|
||||||
|
(*osize)-=rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tty_status)
|
||||||
|
return -tty_status;
|
||||||
|
else
|
||||||
|
return ((*isize == 0) | ((*osize == 0) << 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
115
mbsebbs/ttyio.h
Normal file
115
mbsebbs/ttyio.h
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/* $Id */
|
||||||
|
|
||||||
|
#ifndef TTYIO_H
|
||||||
|
#define TTYIO_H
|
||||||
|
|
||||||
|
#define TIMERNO_BRAIN 0 /* BRAIN timerno */
|
||||||
|
#define TIMERNO_RX 1 /* Receiver timerno */
|
||||||
|
#define TIMERNO_TX 2 /* Transmitter timerno */
|
||||||
|
|
||||||
|
#define RESETTIMER(x) tty_resettimer(x)
|
||||||
|
#define RESETTIMERS() tty_resettimers()
|
||||||
|
#define SETTIMER(x,y) tty_settimer(x,y)
|
||||||
|
#define EXPIRED(x) tty_expired(x)
|
||||||
|
#define RUNNING(x) tty_running(x)
|
||||||
|
|
||||||
|
#define TCHECK() tty_check()
|
||||||
|
#define PUTCHECK(x) tty_putcheck(x)
|
||||||
|
#define WAITPUTGET(x) tty_waitputget(x)
|
||||||
|
#define FLUSHOUT() tty_flushout()
|
||||||
|
#define FLUSHIN() tty_flushin()
|
||||||
|
#define PUTCHAR(x) tty_putc(x)
|
||||||
|
#define PUT(x,y) tty_put(x,y)
|
||||||
|
#define PUTSTR(x) tty_put(x,strlen(x))
|
||||||
|
#define GETCHAR(x) tty_getc(x)
|
||||||
|
#define UNGETCHAR(x) tty_ungetc(x)
|
||||||
|
#define GET(x,y,z) tty_get(x,y,z)
|
||||||
|
#define PUTGET(a,b,x,y) tty_putget(a,b,x,y)
|
||||||
|
#define STATUS tty_status
|
||||||
|
|
||||||
|
#define STAT_SUCCESS 0
|
||||||
|
#define STAT_ERROR 1
|
||||||
|
#define STAT_TIMEOUT 2
|
||||||
|
#define STAT_EOFILE 3
|
||||||
|
#define STAT_HANGUP 4
|
||||||
|
#define STAT_EMPTY 5
|
||||||
|
#define STAT_UNCOMP 6
|
||||||
|
|
||||||
|
#define SUCCESS (STATUS == 0)
|
||||||
|
#define TERROR (-STAT_ERROR)
|
||||||
|
#define TIMEOUT (-STAT_TIMEOUT)
|
||||||
|
#define EOFILE (-STAT_EOFILE)
|
||||||
|
#define HANGUP (-STAT_HANGUP)
|
||||||
|
#define EMPTY (-STAT_EMPTY)
|
||||||
|
|
||||||
|
#define GET_COMPLETE(x) (x & 1)
|
||||||
|
#define PUT_COMPLETE(x) (x & 2)
|
||||||
|
|
||||||
|
#ifndef NUL
|
||||||
|
#define NUL 0x00
|
||||||
|
#endif
|
||||||
|
#define SOH 0x01
|
||||||
|
#define STX 0x02
|
||||||
|
#define ETX 0x03
|
||||||
|
#define EOT 0x04
|
||||||
|
#define ENQ 0x05
|
||||||
|
#define ACK 0x06
|
||||||
|
#define BEL 0x07
|
||||||
|
#define BS 0x08
|
||||||
|
#define HT 0x09
|
||||||
|
#define LF 0x0a
|
||||||
|
#define VT 0x0b
|
||||||
|
#ifndef FF
|
||||||
|
#define FF 0x0c
|
||||||
|
#endif
|
||||||
|
#ifndef CR
|
||||||
|
#define CR 0x0d
|
||||||
|
#endif
|
||||||
|
#define SO 0x0e
|
||||||
|
#define SI 0x0f
|
||||||
|
#define DLE 0x10
|
||||||
|
#ifndef XON
|
||||||
|
#define XON 0x11
|
||||||
|
#endif
|
||||||
|
#define DC1 0x11
|
||||||
|
#define DC2 0x12
|
||||||
|
#ifndef XOFF
|
||||||
|
#define XOFF 0x13
|
||||||
|
#endif
|
||||||
|
#define DC3 0x13
|
||||||
|
#define DC4 0x14
|
||||||
|
#define NAK 0x15
|
||||||
|
#define SYN 0x16
|
||||||
|
#define ETB 0x17
|
||||||
|
#define CAN 0x18
|
||||||
|
#define EM 0x19
|
||||||
|
#define SUB 0x1a
|
||||||
|
#ifndef ESC
|
||||||
|
#define ESC 0x1b
|
||||||
|
#endif
|
||||||
|
#define RS 0x1e
|
||||||
|
#define US 0x1f
|
||||||
|
#define TSYNC 0xae
|
||||||
|
#define YOOHOO 0xf1
|
||||||
|
|
||||||
|
extern int tty_status;
|
||||||
|
|
||||||
|
extern int tty_resettimer(int tno);
|
||||||
|
extern void tty_resettimers(void);
|
||||||
|
extern int tty_settimer(int,int);
|
||||||
|
extern int tty_expired(int);
|
||||||
|
extern int tty_running(int);
|
||||||
|
extern int tty_check(void);
|
||||||
|
extern int tty_waitputget(int);
|
||||||
|
extern int tty_ungetc(int);
|
||||||
|
extern int tty_getc(int);
|
||||||
|
extern int tty_get(char*,int,int);
|
||||||
|
extern int tty_putcheck(int);
|
||||||
|
extern int tty_putc(int);
|
||||||
|
extern int tty_put(char*,int);
|
||||||
|
extern int tty_putget(char**,int*,char**,int*);
|
||||||
|
extern void tty_flushout(void);
|
||||||
|
extern void tty_flushin(void);
|
||||||
|
extern void sendbrk(void);
|
||||||
|
|
||||||
|
#endif
|
@ -50,6 +50,7 @@
|
|||||||
#include "offline.h"
|
#include "offline.h"
|
||||||
#include "email.h"
|
#include "email.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern int sock;
|
extern int sock;
|
||||||
@ -184,7 +185,8 @@ void user()
|
|||||||
* This should not happen.
|
* This should not happen.
|
||||||
*/
|
*/
|
||||||
WriteError("$Can't open %s", temp);
|
WriteError("$Can't open %s", temp);
|
||||||
printf("Can't open userfile, run \"newuser\" first");
|
PUTSTR((char *)"Can't open userfile, run \"newuser\" first");
|
||||||
|
Enter(1);
|
||||||
ExitClient(MBERR_OK);
|
ExitClient(MBERR_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,11 +201,14 @@ void user()
|
|||||||
|
|
||||||
if (!FoundName) {
|
if (!FoundName) {
|
||||||
fclose(pUsrConfig);
|
fclose(pUsrConfig);
|
||||||
printf("Unknown username: %s\n", sUnixName);
|
sprintf(temp, "Unknown username: %s\r\n", sUnixName);
|
||||||
|
PUTSTR(temp);
|
||||||
/* FATAL ERROR: You are not in the BBS users file.*/
|
/* FATAL ERROR: You are not in the BBS users file.*/
|
||||||
printf("%s\n", (char *) Language(389));
|
sprintf(temp, "%s\r\n", (char *) Language(389));
|
||||||
|
PUTSTR(temp);
|
||||||
/* Please run 'newuser' to create an account */
|
/* Please run 'newuser' to create an account */
|
||||||
printf("%s\n", (char *) Language(390));
|
sprintf(temp, "%s\r\n", (char *) Language(390));
|
||||||
|
PUTSTR(temp);
|
||||||
Syslog('?', "FATAL: Could not find user in BBS users file.");
|
Syslog('?', "FATAL: Could not find user in BBS users file.");
|
||||||
Syslog('?', " and system is using unix accounts\n");
|
Syslog('?', " and system is using unix accounts\n");
|
||||||
Free_Language();
|
Free_Language();
|
||||||
@ -285,7 +290,8 @@ void user()
|
|||||||
if (CFG.max_logins && (logins > CFG.max_logins)) {
|
if (CFG.max_logins && (logins > CFG.max_logins)) {
|
||||||
Syslog('+', "User logins %d, allowed %d, disconnecting", logins, CFG.max_logins);
|
Syslog('+', "User logins %d, allowed %d, disconnecting", logins, CFG.max_logins);
|
||||||
colour(LIGHTRED, BLACK);
|
colour(LIGHTRED, BLACK);
|
||||||
printf("%s %d %s\n", (char *) Language(18), CFG.max_logins, (char *) Language(19));
|
sprintf(temp, "%s %d %s\r\n", (char *) Language(18), CFG.max_logins, (char *) Language(19));
|
||||||
|
PUTSTR(temp);
|
||||||
Quick_Bye(MBERR_INIT_ERROR);
|
Quick_Bye(MBERR_INIT_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,13 +37,14 @@
|
|||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "timeout.h"
|
#include "timeout.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
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;
|
char *Name, *sTemp, *User, *temp, msg[81];
|
||||||
struct userhdr uhdr;
|
struct userhdr uhdr;
|
||||||
struct userrec u;
|
struct userrec u;
|
||||||
|
|
||||||
@ -93,16 +94,18 @@ void UserList(char *OpData)
|
|||||||
if ((!u.Hidden) && (!u.Deleted)) {
|
if ((!u.Hidden) && (!u.Deleted)) {
|
||||||
if ((strcasecmp(OpData, "/H")) == 0) {
|
if ((strcasecmp(OpData, "/H")) == 0) {
|
||||||
if ((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
|
if ((strcmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
|
||||||
printf("%-25s", u.sHandle);
|
sprintf(msg, "%-25s", u.sHandle);
|
||||||
else
|
else
|
||||||
printf("%-25s", u.sUserName);
|
sprintf(msg, "%-25s", u.sUserName);
|
||||||
} else if (strcasecmp(OpData, "/U") == 0) {
|
} else if (strcasecmp(OpData, "/U") == 0) {
|
||||||
printf("%-25s", u.Name);
|
sprintf(msg, "%-25s", u.Name);
|
||||||
} else {
|
} else {
|
||||||
printf("%-25s", u.sUserName);
|
sprintf(msg, "%-25s", u.sUserName);
|
||||||
}
|
}
|
||||||
|
PUTSTR(msg);
|
||||||
|
|
||||||
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
|
sprintf(msg, "%-30s%-14s%-10d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
|
||||||
|
PUTSTR(msg);
|
||||||
iFoundName = TRUE;
|
iFoundName = TRUE;
|
||||||
LineCount++;
|
LineCount++;
|
||||||
iNameCount++;
|
iNameCount++;
|
||||||
@ -112,16 +115,18 @@ void UserList(char *OpData)
|
|||||||
} else if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
|
} else if ((!u.Hidden) && (!u.Deleted) && (strlen(u.sUserName) > 0)) {
|
||||||
if ((strcmp(OpData, "/H")) == 0) {
|
if ((strcmp(OpData, "/H")) == 0) {
|
||||||
if ((strcasecmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
|
if ((strcasecmp(u.sHandle, "") != 0 && *(u.sHandle) != ' '))
|
||||||
printf("%-25s", u.sHandle);
|
sprintf(msg, "%-25s", u.sHandle);
|
||||||
else
|
else
|
||||||
printf("%-25s", u.sUserName);
|
sprintf(msg, "%-25s", u.sUserName);
|
||||||
} else if (strcasecmp(OpData, "/U") == 0) {
|
} else if (strcasecmp(OpData, "/U") == 0) {
|
||||||
printf("%-25s", u.Name);
|
sprintf(msg, "%-25s", u.Name);
|
||||||
} else {
|
} else {
|
||||||
printf("%-25s", u.sUserName);
|
sprintf(msg, "%-25s", u.sUserName);
|
||||||
}
|
}
|
||||||
|
PUTSTR(msg);
|
||||||
|
|
||||||
printf("%-30s%-14s%-11d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
|
sprintf(msg, "%-30s%-14s%-10d", u.sLocation, StrDateDMY(u.tLastLoginDate), u.iTotalCalls);
|
||||||
|
PUTSTR(msg);
|
||||||
iFoundName = TRUE;
|
iFoundName = TRUE;
|
||||||
LineCount++;
|
LineCount++;
|
||||||
iNameCount++;
|
iNameCount++;
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
#include "exitinfo.h"
|
#include "exitinfo.h"
|
||||||
#include "whoson.h"
|
#include "whoson.h"
|
||||||
#include "term.h"
|
#include "term.h"
|
||||||
|
#include "ttyio.h"
|
||||||
|
|
||||||
|
|
||||||
extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
|
extern int LC_Download, LC_Upload, LC_Read, LC_Chat, LC_Olr, LC_Door;
|
||||||
@ -50,7 +51,7 @@ 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, *Underline, *cnt, *isdoing, *location, *device;
|
||||||
char *fullname, *temp;
|
char *fullname, *temp, msg[81];
|
||||||
int i, x, Start = TRUE;
|
int i, x, Start = TRUE;
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
struct userhdr ushdr;
|
struct userhdr ushdr;
|
||||||
@ -73,7 +74,7 @@ void WhosOn(char *OpData)
|
|||||||
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
|
sprintf(Underline, "%s%c", Underline, exitinfo.GraphMode ? 196 : 45);
|
||||||
colour(LIGHTRED, BLACK);
|
colour(LIGHTRED, BLACK);
|
||||||
Center(Underline);
|
Center(Underline);
|
||||||
printf("\n");
|
Enter(1);
|
||||||
|
|
||||||
/* Name Device Status Location */
|
/* Name Device Status Location */
|
||||||
pout(LIGHTGREEN, BLACK, (char *) Language(415));
|
pout(LIGHTGREEN, BLACK, (char *) Language(415));
|
||||||
@ -126,51 +127,51 @@ void WhosOn(char *OpData)
|
|||||||
}
|
}
|
||||||
free(temp);
|
free(temp);
|
||||||
}
|
}
|
||||||
colour(LIGHTCYAN, BLACK);
|
sprintf(msg, "%-30s", fullname);
|
||||||
printf("%-30s", fullname);
|
pout(LIGHTCYAN, BLACK, msg);
|
||||||
free(fullname);
|
free(fullname);
|
||||||
|
|
||||||
colour(LIGHTBLUE, BLACK);
|
sprintf(msg, "%-9s", device);
|
||||||
printf("%-9s", device);
|
pout(LIGHTBLUE, BLACK, msg);
|
||||||
free(device);
|
free(device);
|
||||||
|
|
||||||
strtok(NULL, ",");
|
strtok(NULL, ",");
|
||||||
location = xstrcpy(strtok(NULL, ","));
|
location = xstrcpy(strtok(NULL, ","));
|
||||||
isdoing = xstrcpy(strtok(NULL, ","));
|
isdoing = xstrcpy(strtok(NULL, ","));
|
||||||
|
|
||||||
colour(WHITE, BLACK);
|
|
||||||
if (strstr(isdoing, "Browsing"))
|
if (strstr(isdoing, "Browsing"))
|
||||||
/* Browseng */
|
/* Browseng */
|
||||||
printf("%-15s", (char *) Language(418));
|
sprintf(msg, "%-15s", (char *) Language(418));
|
||||||
else if (strstr(isdoing, "Downloading"))
|
else if (strstr(isdoing, "Downloading"))
|
||||||
/* Downloading */
|
/* Downloading */
|
||||||
printf("%-15s", (char *) Language(419));
|
sprintf(msg, "%-15s", (char *) Language(419));
|
||||||
else if (strstr(isdoing, "Uploading"))
|
else if (strstr(isdoing, "Uploading"))
|
||||||
/* Uploading */
|
/* Uploading */
|
||||||
printf("%-15s", (char *) Language(420));
|
sprintf(msg, "%-15s", (char *) Language(420));
|
||||||
else if (strstr(isdoing, "Read"))
|
else if (strstr(isdoing, "Read"))
|
||||||
/* Msg Section */
|
/* Msg Section */
|
||||||
printf("%-15s", (char *) Language(421));
|
sprintf(msg, "%-15s", (char *) Language(421));
|
||||||
else if (strstr(isdoing, "External"))
|
else if (strstr(isdoing, "External"))
|
||||||
/* External Door */
|
/* External Door */
|
||||||
printf("%-15s", (char *) Language(422));
|
sprintf(msg, "%-15s", (char *) Language(422));
|
||||||
else if (strstr(isdoing, "Chat"))
|
else if (strstr(isdoing, "Chat"))
|
||||||
/* Chatting */
|
/* Chatting */
|
||||||
printf("%-15s", (char *) Language(423));
|
sprintf(msg, "%-15s", (char *) Language(423));
|
||||||
else if (strstr(isdoing, "Files"))
|
else if (strstr(isdoing, "Files"))
|
||||||
/* Listing Files */
|
/* Listing Files */
|
||||||
printf("%-15s", (char *) Language(424));
|
sprintf(msg, "%-15s", (char *) Language(424));
|
||||||
else if (strstr(isdoing, "Time"))
|
else if (strstr(isdoing, "Time"))
|
||||||
/* Banking Door */
|
/* Banking Door */
|
||||||
printf("%-15s", (char *) Language(426));
|
sprintf(msg, "%-15s", (char *) Language(426));
|
||||||
else if (strstr(isdoing, "Safe"))
|
else if (strstr(isdoing, "Safe"))
|
||||||
/* Safe Door */
|
/* Safe Door */
|
||||||
printf("%-15s", (char *) Language(427));
|
sprintf(msg, "%-15s", (char *) Language(427));
|
||||||
else if (strstr(isdoing, "Whoson"))
|
else if (strstr(isdoing, "Whoson"))
|
||||||
/* WhosOn List */
|
/* WhosOn List */
|
||||||
printf("%-15s", (char *) Language(428));
|
sprintf(msg, "%-15s", (char *) Language(428));
|
||||||
else if (strstr(isdoing, "Offline"))
|
else if (strstr(isdoing, "Offline"))
|
||||||
/* Offline Reader */
|
/* Offline Reader */
|
||||||
printf("%-15s", (char *) Language(429));
|
sprintf(msg, "%-15s", (char *) Language(429));
|
||||||
else {
|
else {
|
||||||
/*
|
/*
|
||||||
* This is default when nothing matches, with doors this
|
* This is default when nothing matches, with doors this
|
||||||
@ -178,11 +179,13 @@ void WhosOn(char *OpData)
|
|||||||
*/
|
*/
|
||||||
if (strlen(isdoing) > 15)
|
if (strlen(isdoing) > 15)
|
||||||
isdoing[15] = '\0';
|
isdoing[15] = '\0';
|
||||||
printf("%-15s", isdoing);
|
sprintf(msg, "%-15s", isdoing);
|
||||||
}
|
}
|
||||||
|
pout(WHITE, BLACK, msg);
|
||||||
|
|
||||||
colour(LIGHTRED, BLACK);
|
sprintf(msg, "%-25s", location);
|
||||||
printf("%-25s\n", location);
|
pout(LIGHTRED, BLACK, msg);
|
||||||
|
Enter(1);
|
||||||
free(location);
|
free(location);
|
||||||
free(isdoing);
|
free(isdoing);
|
||||||
}
|
}
|
||||||
@ -194,8 +197,7 @@ void WhosOn(char *OpData)
|
|||||||
|
|
||||||
free(Underline);
|
free(Underline);
|
||||||
free(Heading);
|
free(Heading);
|
||||||
|
Enter(1);
|
||||||
printf("\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -277,20 +279,19 @@ void SendOnlineMsg(char *OpData)
|
|||||||
/* Please enter username to send message to: */
|
/* Please enter username to send message to: */
|
||||||
pout(CYAN, BLACK, (char *) Language(430));
|
pout(CYAN, BLACK, (char *) Language(430));
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
fflush(stdout);
|
|
||||||
GetstrC(User, 35);
|
GetstrC(User, 35);
|
||||||
if (!strcmp(User, "")) {
|
if (!strcmp(User, "")) {
|
||||||
free(User);
|
free(User);
|
||||||
free(String);
|
free(String);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
temp = calloc(PATH_MAX, sizeof(char));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we were displaying handles or real names, then lookup the
|
* If we were displaying handles or real names, then lookup the
|
||||||
* users unix name to send to mbtask.
|
* users unix name to send to mbtask.
|
||||||
*/
|
*/
|
||||||
if ((strcasecmp(OpData, "/H") == 0) || (strlen(OpData) == 0)) {
|
if ((strcasecmp(OpData, "/H") == 0) || (strlen(OpData) == 0)) {
|
||||||
temp = calloc(PATH_MAX, sizeof(char));
|
|
||||||
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
sprintf(temp, "%s/etc/users.data", getenv("MBSE_ROOT"));
|
||||||
if ((fp = fopen(temp, "rb")) != NULL) {
|
if ((fp = fopen(temp, "rb")) != NULL) {
|
||||||
fread(&ushdr, sizeof(ushdr), 1, fp);
|
fread(&ushdr, sizeof(ushdr), 1, fp);
|
||||||
@ -307,14 +308,13 @@ void SendOnlineMsg(char *OpData)
|
|||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
free(temp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Please enter message to send (Max 76 Characters) */
|
/* Please enter message to send (Max 76 Characters) */
|
||||||
pout(LIGHTGREEN, BLACK, (char *)Language(433));
|
pout(LIGHTGREEN, BLACK, (char *)Language(433));
|
||||||
pout(LIGHTGREEN, BLACK, (char *)"\n> ");
|
Enter(1);
|
||||||
|
pout(LIGHTGREEN, BLACK, (char *)"> ");
|
||||||
colour(CFG.InputColourF, CFG.InputColourB);
|
colour(CFG.InputColourF, CFG.InputColourB);
|
||||||
fflush(stdout);
|
|
||||||
GetstrC(String, 76);
|
GetstrC(String, 76);
|
||||||
|
|
||||||
if ((strcmp(String, "")) != 0) {
|
if ((strcmp(String, "")) != 0) {
|
||||||
@ -330,24 +330,33 @@ void SendOnlineMsg(char *OpData)
|
|||||||
strcpy(buf, socket_receive());
|
strcpy(buf, socket_receive());
|
||||||
|
|
||||||
if (strncmp(buf, "100:1,3;", 8) == 0) {
|
if (strncmp(buf, "100:1,3;", 8) == 0) {
|
||||||
|
Enter(1);
|
||||||
/* Sorry, there is no user on */
|
/* Sorry, there is no user on */
|
||||||
printf("\n%s %s\n\n", (char *) Language(431), User);
|
sprintf(temp, "%s %s", (char *) Language(431), User);
|
||||||
|
PUTSTR(temp);
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
if (strncmp(buf, "100:1,2;", 8) == 0) {
|
if (strncmp(buf, "100:1,2;", 8) == 0) {
|
||||||
printf("\nNo more room in users message buffer\n\n");
|
Enter(1);
|
||||||
|
PUTSTR((char *)"No more room in users message buffer");
|
||||||
|
Enter(2);
|
||||||
}
|
}
|
||||||
if (strncmp(buf, "100:1,1;", 8) == 0) {
|
if (strncmp(buf, "100:1,1;", 8) == 0) {
|
||||||
colour(LIGHTRED, BLACK);
|
Enter(1);
|
||||||
/* doesn't wish to be disturbed */
|
/* doesn't wish to be disturbed */
|
||||||
printf("\n%s %s\n", User, (char *) Language(432));
|
sprintf(temp, "%s %s", User, (char *) Language(432));
|
||||||
|
pout(LIGHTRED, BLACK, temp);
|
||||||
|
Enter(1);
|
||||||
}
|
}
|
||||||
if (strncmp(buf, "100:0;", 6) == 0) {
|
if (strncmp(buf, "100:0;", 6) == 0) {
|
||||||
printf("Message Sent!\n");
|
PUTSTR((char *)"Message Sent!");
|
||||||
|
Enter(1);
|
||||||
Syslog('+', "Online msg to %s: \"%s\"", User, String);
|
Syslog('+', "Online msg to %s: \"%s\"", User, String);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(temp);
|
||||||
free(User);
|
free(User);
|
||||||
free(String);
|
free(String);
|
||||||
Pause();
|
Pause();
|
||||||
|
@ -47,7 +47,7 @@ unsigned char readkey(int y, int x, int fg, int bg)
|
|||||||
perror("open 9");
|
perror("open 9");
|
||||||
exit(MBERR_TTYIO_ERROR);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
mbse_Setraw();
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (rc == -1) {
|
while (rc == -1) {
|
||||||
@ -56,12 +56,12 @@ unsigned char readkey(int y, int x, int fg, int bg)
|
|||||||
|
|
||||||
mbse_locate(y, x);
|
mbse_locate(y, x);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
rc = Waitchar(&ch, 5);
|
rc = mbse_Waitchar(&ch, 5);
|
||||||
if ((rc == 1) && (ch != KEY_ESCAPE))
|
if ((rc == 1) && (ch != KEY_ESCAPE))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ((rc == 1) && (ch == KEY_ESCAPE))
|
if ((rc == 1) && (ch == KEY_ESCAPE))
|
||||||
rc = Escapechar(&ch);
|
rc = mbse_Escapechar(&ch);
|
||||||
|
|
||||||
if (rc == 1)
|
if (rc == 1)
|
||||||
break;
|
break;
|
||||||
@ -69,7 +69,7 @@ unsigned char readkey(int y, int x, int fg, int bg)
|
|||||||
Nopper();
|
Nopper();
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
mbse_Unsetraw();
|
||||||
close(ttyfd);
|
close(ttyfd);
|
||||||
|
|
||||||
return ch;
|
return ch;
|
||||||
@ -89,15 +89,15 @@ unsigned char testkey(int y, int x)
|
|||||||
perror("open 9");
|
perror("open 9");
|
||||||
exit(MBERR_TTYIO_ERROR);
|
exit(MBERR_TTYIO_ERROR);
|
||||||
}
|
}
|
||||||
Setraw();
|
mbse_Setraw();
|
||||||
|
|
||||||
rc = Waitchar(&ch, 100);
|
rc = mbse_Waitchar(&ch, 100);
|
||||||
if (rc == 1) {
|
if (rc == 1) {
|
||||||
if (ch == KEY_ESCAPE)
|
if (ch == KEY_ESCAPE)
|
||||||
rc = Escapechar(&ch);
|
rc = mbse_Escapechar(&ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
Unsetraw();
|
mbse_Unsetraw();
|
||||||
close(ttyfd);
|
close(ttyfd);
|
||||||
|
|
||||||
if (rc == 1)
|
if (rc == 1)
|
||||||
|
Reference in New Issue
Block a user