Fixed mbsetup '%' output

This commit is contained in:
Michiel Broek 2002-01-15 21:32:07 +00:00
parent 0c57e334fd
commit 4a4154acc0
5 changed files with 51 additions and 38 deletions

View File

@ -4310,6 +4310,8 @@ v0.33.19 26-Oct-2001
Rewrote calling of the color editor for Sparc systems. Rewrote calling of the color editor for Sparc systems.
Added setup items in global and message areas to limit the Added setup items in global and message areas to limit the
fetching of newsgroups headers. fetching of newsgroups headers.
The edit field now shows the contents correctly if the field
contains the % character.
mbsebbs: mbsebbs:
Added menu 317, change FS editor shortcut keys to (Emacs/ Added menu 317, change FS editor shortcut keys to (Emacs/

View File

@ -4,7 +4,7 @@
* Purpose ...............: Mangle a unix name to DOS 8.3 filename * Purpose ...............: Mangle a unix name to DOS 8.3 filename
* *
***************************************************************************** *****************************************************************************
* Copyright (C) 1997-2001 * Copyright (C) 1997-2002
* *
* Michiel Broek FIDO: 2:280/2802 * Michiel Broek FIDO: 2:280/2802
* Beekmansbos 10 * Beekmansbos 10
@ -391,7 +391,7 @@ void mangle_name_83(char *s)
for (i = 0; i < strlen(q); i++) for (i = 0; i < strlen(q); i++)
*p++ = q[i]; *p++ = q[i];
*p++ = '\0'; *p++ = '\0';
Syslog('f', "name with new extension => \"%s\"", s); // Syslog('f', "name with new extension => \"%s\"", s);
} }
/* /*
@ -474,7 +474,7 @@ void name_mangle(char *OutName)
tu(OutName); tu(OutName);
} }
Syslog('f',"name_mangle(%s) ==> [%s]", p, OutName); // Syslog('f',"name_mangle(%s) ==> [%s]", p, OutName);
free(p); free(p);
} }

View File

@ -48,7 +48,7 @@ int Magics = 0; /* Processed magics */
char *Magic_Macro(int); char *Magic_Macro(int);
char *Magic_Macro(int C) char *Magic_Macro(int C)
{ {
static char buf[81]; static char buf[PATH_MAX];
buf[0] = '\0'; buf[0] = '\0';
switch(toupper(C)) { switch(toupper(C)) {
@ -197,6 +197,7 @@ void MagicResult(char *format, ...)
} }
void Magic_CheckCompile(void); void Magic_CheckCompile(void);
void Magic_CheckCompile(void) void Magic_CheckCompile(void)
{ {
@ -224,7 +225,7 @@ void Magic_ExecCommand(void)
{ {
int i, j, k, Err, First = TRUE; int i, j, k, Err, First = TRUE;
char Line[256]; char Line[256];
char Temp[81]; char Temp[PATH_MAX];
char *cmd, *opts; char *cmd, *opts;
while (GetMagicRec(MG_EXEC, First)) { while (GetMagicRec(MG_EXEC, First)) {
@ -273,8 +274,8 @@ void Magic_CopyFile(void)
int First = TRUE; int First = TRUE;
char *From, *To; char *From, *To;
From = calloc(256, sizeof(char)); From = calloc(PATH_MAX, sizeof(char));
To = calloc(256, sizeof(char)); To = calloc(PATH_MAX, sizeof(char));
while (GetMagicRec(MG_COPY, First)) { while (GetMagicRec(MG_COPY, First)) {
First = FALSE; First = FALSE;
@ -298,11 +299,11 @@ void Magic_UnpackFile(void)
{ {
int rc, First = TRUE; int rc, First = TRUE;
char *buf = NULL, *unarc = NULL, *cmd = NULL; char *buf = NULL, *unarc = NULL, *cmd = NULL;
char Fn[128]; char Fn[PATH_MAX];
while (GetMagicRec(MG_UNPACK, First)) { while (GetMagicRec(MG_UNPACK, First)) {
First = FALSE; First = FALSE;
buf = calloc(PATH_MAX, sizeof(char)); /* 06-01-2001 MB. Test if NULL pointer free'd message goes away */ buf = calloc(PATH_MAX, sizeof(char));
getcwd(buf, 128); getcwd(buf, 128);
if (chdir(magic.Path) == 0) { if (chdir(magic.Path) == 0) {
@ -358,7 +359,7 @@ void Magic_AdoptFile(void)
char *temp; char *temp;
FILE *Tf; FILE *Tf;
temp = calloc(256, sizeof(char)); temp = calloc(PATH_MAX, sizeof(char));
while (GetMagicRec(MG_ADOPT, First)) { while (GetMagicRec(MG_ADOPT, First)) {
First = FALSE; First = FALSE;

View File

@ -200,7 +200,7 @@ int LoadTic(char *inb, char *tfn)
} }
Temp[j] = '\0'; Temp[j] = '\0';
Syslog('f', "TIC: %s", Temp); // Syslog('f', "TIC: %s", Temp);
if (strncasecmp(Temp, "hatch", 5) == 0) { if (strncasecmp(Temp, "hatch", 5) == 0) {
TIC.TicIn.Hatch = TRUE; TIC.TicIn.Hatch = TRUE;

View File

@ -94,9 +94,19 @@ void errmsg(const char *format, ...)
/*
* Safe field display, does not format % characters but displays it.
*/
void show_field(int y, int x, char *str, int length, int fill) void show_field(int y, int x, char *str, int length, int fill)
{ {
mvprintw(y, x, padleft(str, length, fill)); int i;
locate(y, x);
for (i = 0; i < strlen(str); i++)
putchar(str[i]);
if (strlen(str) < length)
for (i = strlen(str); i < length; i++)
putchar(fill);
} }