Fixed input editors

This commit is contained in:
Michiel Broek 2005-08-29 13:42:56 +00:00
parent 2806a27734
commit ce6749c55c
5 changed files with 21 additions and 16 deletions

View File

@ -111,7 +111,7 @@ void GetstrD(char *sStr, int iMaxlen)
if (ch > 31 && ch < 127) {
if (iPos <= iMaxlen) {
iPos++;
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
} else
PUTCHAR(7);

View File

@ -215,7 +215,7 @@ void GetstrLC(char *sStr, int iMaxlen)
if ((ch > 31 && ch < 127) || traduce(&ch)) {
if (iPos <= iMaxlen) {
iPos++;
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
} else {
Beep();

View File

@ -352,7 +352,7 @@ void GetstrP(char *sStr, int iMaxLen, int Position)
} else if ((ch > 31 && ch < 127) || traduce(&ch)) {
if (iPos <= iMaxLen) {
iPos++;
snprintf(sStr, iMaxLen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
} else {
PUTCHAR('\007');
@ -393,7 +393,7 @@ void GetstrC(char *sStr, int iMaxlen)
if ((ch > 31) && (ch < 127) && (ch != ',')) {
if (iPos <= iMaxlen) {
iPos++;
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
} else
PUTCHAR('\007');
@ -433,7 +433,7 @@ void GetstrU(char *sStr, int iMaxlen)
if (isalnum(ch) || (ch == '@') || (ch == '.') || (ch == '-') || (ch == '_')) {
if (iPos <= iMaxlen) {
iPos++;
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
} else
PUTCHAR('\007');
@ -474,7 +474,7 @@ void GetPhone(char *sStr, int iMaxlen)
if ((ch >= '0' && ch <= '9') || (ch == '-') || (ch == '+')) {
if (iPos <= iMaxlen) {
iPos++;
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
} else
PUTCHAR('\007');
@ -516,7 +516,7 @@ void Getnum(char *sStr, int iMaxlen)
if (iPos <= iMaxlen) {
iPos++;
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
} else
PUTCHAR('\007');
@ -563,11 +563,11 @@ void GetDate(char *sStr, int iMaxlen)
if (ch >= '0' && ch <= '9') {
if (iPos < iMaxlen) {
iPos++;
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
if (iPos == 2 || iPos == 5) {
PUTCHAR('-');
snprintf(sStr, iMaxlen, "%s-", sStr);
snprintf(sStr + strlen(sStr), 1, "-");
iPos++;
}
} else
@ -628,7 +628,7 @@ void Getname(char *sStr, int iMaxlen)
if (iPos == 1 && CFG.iCapUserName)
ch = toupper(ch);
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
printf("%c", ch);
} else
putchar('\007');
@ -688,7 +688,7 @@ void GetnameNE(char *sStr, int iMaxlen)
if (iPos == 1)
ch = toupper(ch);
snprintf(sStr, iMaxlen, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
printf("%c", ch);
} else
putchar('\007');

View File

@ -310,7 +310,7 @@ void Oneliner_Show()
FILE *pOneline;
int recno = 0;
long offset;
char *sFileName, msg[11];
char *sFileName, msg[81];
sFileName = calloc(PATH_MAX, sizeof(char));
snprintf(sFileName, PATH_MAX, "%s/etc/oneline.data", getenv("MBSE_ROOT"));
@ -320,15 +320,20 @@ void Oneliner_Show()
return;
}
fread(&olhdr, sizeof(olhdr), 1, pOneline);
fseek(pOneline, 0, SEEK_END);
recno = (ftell(pOneline) - olhdr.hdrsize) / olhdr.recsize;
Enter(1);
/* Please enter number to list: */
pout(WHITE, BLACK, Language(347));
snprintf(msg, 81, "%s (1..%d) ", Language(347), recno -1);
pout(WHITE, BLACK, msg);
colour(CFG.InputColourF, CFG.InputColourB);
scanf("%d", &recno);
msg[0] = '\0';
Getnum(msg, 10);
recno = atoi(msg);
offset = olhdr.hdrsize + (recno * olhdr.recsize);
if (fseek(pOneline, offset, 0) != 0)
if (fseek(pOneline, offset, SEEK_SET) != 0)
WriteError("Can't move pointer in %s",sFileName);
fread(&ol, olhdr.recsize, 1, pOneline);

View File

@ -247,7 +247,7 @@ void GetPageStr(char *sStr, int iMaxlen)
if (ch > 31 && ch < 127) {
if (iPos <= iMaxlen) {
iPos++;
snprintf(sStr, 4, "%s%c", sStr, ch);
snprintf(sStr + strlen(sStr), 5, "%c", ch);
PUTCHAR(ch);
fflush(stdout);
} else