Re: [CODE] Better argument processing

From: Angus Mezick (angus@EDGIL.CCMAIL.COMPUSERVE.COM)
Date: 09/22/97


Be very careful.  as far as I know, it is bad style for a function to change the
contents of a variable of some thing that is passed to it.  I know it happens
alot, but it is dangerous.  At some point the original value might be needed
again.
--Angus
______________________________ Reply Separator _________________________________
Consider the following:

char *two_args(char *inp)
{
  char *p;

  for(p = inp; *p && *p != ' '; p++);

  if(*p)
    *(p++) = '\0';

  if(*p == ' ')
    for(;*p == ' '; p++);

  return p;
}

This is my idea of a better two_arguments() function.  It's meant to act
on the original "argument" paramter passed to all the ACMD functions, or
you can pass it a copy of argument for nondestructive processing (for
spec_procs).


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST