Xref: utzoo comp.sources.d:1918 comp.unix.wizards:7602 comp.lang.c:8944 Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!amdcad!ames!ll-xn!mit-eddie!uw-beaver!cornell!rochester!srs!dan From: dan@srs.UUCP (Dan Kegel) Newsgroups: comp.sources.d,comp.unix.wizards,comp.lang.c Subject: Bug in demo.c of argproc.shar Message-ID: <770@srs.UUCP> Date: 6 Apr 88 13:46:55 GMT Reply-To: srs!dan@cs.rochester.edu (Dan Kegel) Organization: S.R.Systems Lines: 20 The package 'argproc' recently posted to comp.sources.misc contains a bug in the demo program 'demo.c'. On line 62 where it reads argproc(argc, argv, "=bc {=help} =s%s -x%d {-pi%lf} %s", it should really read arg_string[0] = '\0'; /* clear so we can see if user gave it */ argproc(argc, argv, "=bc {=help} =s%s -x%d {-pi%lf} %s", The documentation also fails to explicitly say that o the variable associated with scanf-style parameters (%s, %d...) is only altered if the user typed the corresponding value. Thus, in demo.c, the string arg_string should be cleared before calling argproc(). o the boolean variable associated with =switch is always altered; it is set TRUE if the switch is given, FALSE if it is not. I'll be over in the back eating humble pie if you need me. - A. Nonymous -- Dan Kegel "... earn it anew if thou wouldst possess it." - Goethe: Faust srs!dan@cs.rochester.edu rochester!srs!dan dan%srs.uucp@harvard.harvard.edu