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. 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: upgrade:
Start mbsetup, go into global configuration, leave it and 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! this setting now also affects echomail!
general: general:
This may become release 0.36.00
There is now a mberrors.h file that defines all errorcodes There is now a mberrors.h file that defines all errorcodes
returned by all programs. returned by all programs.

View File

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