Fixes for comma in bbs input lines

This commit is contained in:
Michiel Broek 2002-11-14 21:49:48 +00:00
parent 2c15bbd7ff
commit 476d410bb3
2 changed files with 127 additions and 118 deletions

View File

@ -3,8 +3,17 @@ $Id$
MBSEBBS History.
v0.35.06
v0.35.05 19-Oct-2002
general:
This may become release 0.36.00 (again).
mbsebbs:
Several user input functions don't allow comma's anymore.
v0.35.05 19-Oct-2002 - 13-Nov-2002.
upgrade:
Start mbsetup, go into global configuration, leave it and
@ -13,7 +22,6 @@ v0.35.05 19-Oct-2002
this setting now also affects echomail!
general:
This may become release 0.36.00
There is now a mberrors.h file that defines all errorcodes
returned by all programs.

View File

@ -50,43 +50,43 @@
*/
void GetstrP(char *sStr, int iMaxLen, int Position)
{
unsigned char ch = 0;
int iPos = Position;
unsigned char ch = 0;
int iPos = Position;
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 1");
return;
}
Setraw();
if ((ttyfd = open("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 1");
return;
}
Setraw();
alarm_on();
alarm_on();
while (ch != KEY_ENTER) {
while (ch != KEY_ENTER) {
fflush(stdout);
ch = Readkey();
fflush(stdout);
ch = Readkey();
if ((ch == KEY_BACKSPACE) || (ch == KEY_DEL) || (ch == KEY_RUBOUT)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos <= iMaxLen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
if ((ch == KEY_BACKSPACE) || (ch == KEY_DEL) || (ch == KEY_RUBOUT)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
Unsetraw();
close(ttyfd);
printf("\n");
if (ch > 31 && ch < 127) {
if (iPos <= iMaxLen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
@ -96,45 +96,45 @@ void GetstrP(char *sStr, int iMaxLen, int Position)
*/
void GetstrC(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0;
unsigned char ch = 0;
int iPos = 0;
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 6");
return;
}
Setraw();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 6");
return;
}
Setraw();
ch = Readkey();
strcpy(sStr, "");
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos] = '\0';
} else
putchar('\007');
}
Unsetraw();
close(ttyfd);
printf("\n");
if ((ch > 31) && (ch < 127) && (ch != ',')) {
if (iPos <= iMaxlen) {
iPos++;
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}
@ -416,66 +416,67 @@ void Getname(char *sStr, int iMaxlen)
/*
* Get a Fidonet style username, always capitalize.
* Also used for Location Names.
*/
void GetnameNE(char *sStr, int iMaxlen)
{
unsigned char ch = 0;
int iPos = 0, iNewPos = 0;
unsigned char ch = 0;
int iPos = 0, iNewPos = 0;
fflush(stdout);
strcpy(sStr, "");
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 2");
return;
}
Setraw();
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
strcpy(sStr, "");
if ((ttyfd = open ("/dev/tty", O_RDWR|O_NONBLOCK)) < 0) {
perror("open 2");
return;
}
Setraw();
alarm_on();
while (ch != 13) {
fflush(stdout);
ch = Readkey();
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
if (ch > 31 && ch < 127) {
if (iPos < iMaxlen) {
iPos++;
if (iPos == 1)
ch = toupper(ch);
if (ch == 32) {
iNewPos = iPos;
iNewPos++;
}
if (iNewPos == iPos)
ch = toupper(ch);
else
ch = tolower(ch);
if (iPos == 1)
ch = toupper(ch);
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
if ((ch == 8) || (ch == KEY_DEL) || (ch == 127)) {
if (iPos > 0) {
printf("\b \b");
sStr[--iPos]='\0';
} else
putchar('\007');
}
Unsetraw();
close(ttyfd);
printf("\n");
if ((ch > 31) && (ch < 127) && (ch != ',')) {
if (iPos < iMaxlen) {
iPos++;
if (iPos == 1)
ch = toupper(ch);
if (ch == 32) {
iNewPos = iPos;
iNewPos++;
}
if (iNewPos == iPos)
ch = toupper(ch);
else
ch = tolower(ch);
if (iPos == 1)
ch = toupper(ch);
sprintf(sStr, "%s%c", sStr, ch);
printf("%c", ch);
} else
putchar('\007');
}
}
Unsetraw();
close(ttyfd);
printf("\n");
}