[1372] in Moira
Re: change pobox eit
daemon@ATHENA.MIT.EDU (Robert A Basch)
Fri Feb 18 16:27:18 2000
Message-Id: <200002182127.QAA41160@aupair.mit.edu>
To: Garry Zacheiss <zacheiss@MIT.EDU>
cc: moiradev@MIT.EDU
In-Reply-To: Your message of "Thu, 17 Feb 2000 16:02:24 EST."
<200002172102.QAA02087@sweet-transvestite.mit.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Date: Fri, 18 Feb 2000 16:27:14 -0500
From: Robert A Basch <rbasch@MIT.EDU>
> Foreign PO Box for this user? zacheiss
> moira: No at sign (@) in address "".
>
> That last line should presumably be ...in address "zacheiss".
> Foreign PO Box for this user? zacheiss@
> moira: Warning: hostname canonicalized to c;v' Px' Tz' Xp' Dr' Ht' LP^G D"
In both cases, the error message is garbled because of varargs mishandling
in the com_err hook function. The following patch fixes the problem.
Tested on an 8.3 Sun. Note that this could declare the hook functions
as com_err_handler_t, but that typedef doesn't seem to be in the 8.2
com_err.h header.
(The fact that it accepts an address ending in @, and canonicalizes it to
foo@.MIT.EDU, is a separate problem, not addressed here).
Index: menu.c
===================================================================
RCS file: /afs/athena.mit.edu/astaff/project/moiradev/repository/moira/clients/moira/menu.c,v
retrieving revision 1.56
diff -c -r1.56 menu.c
*** menu.c 1999/08/04 15:10:23 1.56
--- menu.c 2000/02/18 20:33:21
***************
*** 63,69 ****
int Parse_words(char *buf, char *argv[], int n);
void refresh_ms(struct menu_screen *ms);
void Put_line(char *msg);
! void menu_com_err_hook(const char *who, long code, const char *fmt, ...);
struct menu_screen *make_ms(int length);
void destroy_ms(struct menu_screen *ms);
struct menu_line *find_command_from(char *c, struct menu *m, int d);
--- 63,70 ----
int Parse_words(char *buf, char *argv[], int n);
void refresh_ms(struct menu_screen *ms);
void Put_line(char *msg);
! void menu_com_err_hook(const char *who, long code,
! const char *fmt, va_list ap);
struct menu_screen *make_ms(int length);
void destroy_ms(struct menu_screen *ms);
struct menu_line *find_command_from(char *c, struct menu *m, int d);
***************
*** 72,85 ****
/*
* Hook function to cause error messages to be printed through
! * curses instead of around it. Takes at most 5 args to the
! * printf string (crock...)
*/
! void menu_com_err_hook(const char *who, long code, const char *fmt, ...)
{
char buf[BUFSIZ], *cp;
- va_list ap;
if (who)
{
--- 73,84 ----
/*
* Hook function to cause error messages to be printed through
! * curses instead of around it.
*/
! void menu_com_err_hook(const char *who, long code, const char *fmt, va_list ap)
{
char buf[BUFSIZ], *cp;
if (who)
{
***************
*** 100,108 ****
while (*cp)
cp++;
}
- va_start(ap, fmt);
vsprintf(cp, fmt, ap);
- va_end(ap);
Put_message(buf);
}
--- 99,105 ----
***************
*** 116,122 ****
void Start_menu(Menu *m)
{
void (*old_hook)(const char *, long, const char *, va_list) =
! set_com_err_hook((void (*) (const char *, long, const char *, va_list))menu_com_err_hook);
#ifdef CURSES_HAS_NEWTERM
SCREEN *scrn = newterm(NULL, stdout, stdin);
#else
--- 113,119 ----
void Start_menu(Menu *m)
{
void (*old_hook)(const char *, long, const char *, va_list) =
! set_com_err_hook(menu_com_err_hook);
#ifdef CURSES_HAS_NEWTERM
SCREEN *scrn = newterm(NULL, stdout, stdin);
#else