home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / amiga / programm / 17637 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  1.8 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!cbmvax!jesup
  2. From: jesup@cbmvax.commodore.com (Randell Jesup)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: THANK YOU!! (ReadArgs()).. but I'm handling something wrong
  5. Message-ID: <38083@cbmvax.commodore.com>
  6. Date: 21 Dec 92 03:54:37 GMT
  7. References: <BzHsLC.8rJ@usenet.ucs.indiana.edu>
  8. Reply-To: jesup@cbmvax.commodore.com (Randell Jesup)
  9. Organization: Commodore, West Chester, PA
  10. Lines: 31
  11.  
  12. shulick@navajo.ucs.indiana.edu writes:
  13. >Well, the /M/A works and everything.  Umm, something stopped working,
  14. >though.  :)  My template has gotten big, and I have these switches..
  15. >
  16. >".....,B=Blah/S,F=Foobar/S,....."
  17. >
  18. >Well, I used to check them like this:
  19. >
  20. >   blah_mode = arr[1] == -1;   /* assume 'B=Blah/S' was the second in */
  21. >                               /* the template */
  22.  
  23.     Two things: 1) check for 0/non-0, not exactly -1.  All the autodoc
  24. promises is non-0.  2) It's best to define an enum or a bunch of defines, one
  25. for each parameter in the template.  This means that if you change the
  26. template, all you have to do is change the enum/defines, instead of searching
  27. through your source code.
  28.  
  29. >Well, it used to work, but now I have lots of things in my template, and
  30. >even though I DON'T specify a switch, it gets set -1 anyway!  So what's
  31. >the REAL way to check if a switch is specified?  Please POST, do NOT
  32. >reply via e-mail.. I get way too many responses to read. :)   Thanks.
  33.  
  34.     Make sure the array is set to all 0's before calling ReadArgs.  Other
  35. than that, it must be some sort of bug in your program.
  36.  
  37. -- 
  38. To be or not to be = 0xff
  39. -
  40. Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
  41. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com  BIX: rjesup  
  42. Disclaimer: Nothing I say is anything other than my personal opinion.
  43.