From 476d410bb37b1f8fe1bbfd824f6e1371c9baf603 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Thu, 14 Nov 2002 21:49:48 +0000 Subject: [PATCH] Fixes for comma in bbs input lines --- ChangeLog | 12 ++- mbsebbs/input.c | 233 ++++++++++++++++++++++++------------------------ 2 files changed, 127 insertions(+), 118 deletions(-) diff --git a/ChangeLog b/ChangeLog index 595cec6e..37139f53 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/mbsebbs/input.c b/mbsebbs/input.c index 62863482..af342f62 100644 --- a/mbsebbs/input.c +++ b/mbsebbs/input.c @@ -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"); }