[7231] in Athena Bugs
olc
daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Sat Mar 2 21:09:56 1991
To: bugs@ATHENA.MIT.EDU
Date: Sat, 02 Mar 91 21:09:42 EST
From: John Carr <jfc@ATHENA.MIT.EDU>
This bug report is for olcr version 3.0c, Athena software RT 7.2. To
make olcr dump core, run
olcr grab 12345678 a
I tried to track down the bug, but I was unable to make sense of the
olc code. Some macros which appears to have been intended to make the
code faster or easier to read in fact do neither.
The following is a change to one of the olc source files. Please
forward it to the olc developers with the comment that most of the
other olc client files need similar cleanups.
Changes I made:
use "register" declarations
the string_equiv macros compile 3 calls to strlen when one is needed
errors should go to stderr
fputs is preferred to fprintf for constant strings
"x = y; return x;" should be replaced by "return y;"
*** /source/athena/usr.athena/olc/clients/parser/p_connect.c Wed Nov 14 12:23:42 1990
--- p_connect.c Sat Mar 2 21:07:18 1991
***************
*** 44,50 ****
ERRCODE
do_olc_grab(arguments)
! char **arguments;
{
REQUEST Request;
int status;
--- 44,50 ----
ERRCODE
do_olc_grab(arguments)
! register char **arguments;
{
REQUEST Request;
int status;
***************
*** 57,64 ****
arguments++;
while(*arguments != (char *) NULL)
{
! if(string_equiv(*arguments,"-create_new_instance",
! max(strlen(*arguments),2)))
{
flag = 1;
arguments++;
--- 57,64 ----
arguments++;
while(*arguments != (char *) NULL)
{
! register int len = strlen(*arguments);
! if(strncmp(*arguments, "-create_new_instance", max(len, 2)))
{
flag = 1;
arguments++;
***************
*** 65,72 ****
continue;
}
! if(string_equiv(*arguments,"-do_not_change_instance",
! max(strlen(*arguments),2)))
{
hold = 1;
arguments++;
--- 65,71 ----
continue;
}
! if(strncmp(*arguments,"-do_not_change_instance", max(len, 2)))
{
hold = 1;
arguments++;
***************
*** 81,95 ****
if(arguments == (char **) NULL)
{
! printf("Usage is: \tgrab [<username> <instance id>] ");
! printf("[-create_new_instance]\n");
! printf("\t\t[-do_not_change_instance] [-instance <instance id>]\n");
return(ERROR);
}
}
! status = t_grab(&Request,flag,hold);
! return(status);
}
/*
--- 80,94 ----
if(arguments == (char **) NULL)
{
! fputs("Usage is: \tgrab [<username> <instance id>] [-create_new_instance]\n",
! stderr);
! fputs("\t\t[-do_not_change_instance] [-instance <instance id>]\n",
! stderr);
return(ERROR);
}
}
! return t_grab(&Request,flag,hold);
}
/*
***************
*** 109,115 ****
ERRCODE
do_olc_forward(arguments)
! char **arguments;
{
REQUEST Request;
int status;
--- 108,114 ----
ERRCODE
do_olc_forward(arguments)
! register char **arguments;
{
REQUEST Request;
int status;
***************
*** 120,126 ****
arguments++;
while(*arguments != (char *)NULL)
{
! if (string_equiv(*arguments, "-off", max(strlen(*arguments), 2)))
{
set_option(Request.options, OFF_OPT);
arguments++;
--- 119,126 ----
arguments++;
while(*arguments != (char *)NULL)
{
! register int len = strlen(*arguments);
! if (strncmp(*arguments, "-off", max(len, 2)) == 0)
{
set_option(Request.options, OFF_OPT);
arguments++;
***************
*** 127,133 ****
continue;
}
! if(string_equiv(*arguments, "-unanswered", max(strlen(*arguments), 2)))
{
set_option(Request.options, FORWARD_UNANSWERED);
arguments++;
--- 127,133 ----
continue;
}
! if(strncmp(*arguments, "-unanswered", max(len,2)) == 0)
{
set_option(Request.options, FORWARD_UNANSWERED);
arguments++;
***************
*** 134,140 ****
continue;
}
! if(string_equiv(*arguments,"-status",max(strlen(*arguments),2)))
{
arguments++;
status = t_input_status(&Request, *arguments);
--- 134,140 ----
continue;
}
! if(strncmp(*arguments, "-status", max(len,2)) == 0)
{
arguments++;
status = t_input_status(&Request, *arguments);
***************
*** 153,167 ****
if(arguments == (char **) NULL) /* error */
{
! printf("Usage is: \tforward [<username> <instance id>] ");
! printf("[-status <status>]\n\t\t[-off] [-unanswered] ");
! printf("[-instance <instance id>]\n");
return(ERROR);
}
}
! status = t_forward(&Request);
! return(status);
}
--- 153,166 ----
if(arguments == (char **) NULL) /* error */
{
! fputs ("Usage is: \tforward [<username> <instance id>] ", stderr);
! fputs ("[-status <status>]\n\t\t[-off] [-unanswered] ", stderr);
! fputs ("[-instance <instance id>]\n", stderr);
return(ERROR);
}
}
! return t_forward(&Request);
}