On Tue, 23 Nov 2010 09:34:54 -0200 Gustavo Sverzut Barbieri <barbi...@profusion.mobi> wrote:
> Ops, you've screwed it all! > > Non-opt does not include argv[0], if no opts the correct return is argc! That makes no sense. You can't do argv[argc]. If there are no other non '-' options, argv[0] IS the first arg in argv which does not have a '-', and thus must be the return. Nothing else can return 0 from the functions, so this is fine. > > The logic to users should be: > > If < 0: error > Else if == argc: no non-opt args > Else: non-opt args from it to argc No, it should be: if < 0: handle error else if 0: handle no non-opt (printf "did you mean --help?") else: use argv[return_value] and loop > > On Tuesday, November 23, 2010, Enlightenment SVN > <no-re...@enlightenment.org> wrote: > > Log: > > I'm tired of you, ecore_getopt. now you get the hammer. > > > > Author: discomfitor > > Date: 2010-11-23 03:10:41 -0800 (Tue, 23 Nov 2010) > > New Revision: 54863 > > > > Modified: > > trunk/ecore/src/lib/ecore/ecore_getopt.c > > > > Modified: trunk/ecore/src/lib/ecore/ecore_getopt.c > > =================================================================== > > --- trunk/ecore/src/lib/ecore/ecore_getopt.c 2010-11-23 10:56:50 UTC > > (rev 54862) +++ trunk/ecore/src/lib/ecore/ecore_getopt.c 2010-11-23 > > 11:10:41 UTC (rev 54863) @@ -1646,10 +1646,21 @@ > > nonargs = argc; > > > > i = 1; > > - while ((i < nonargs ? nonargs : argc) && (argv[i])) > > - if (!_ecore_getopt_parse_arg(parser, values, argc, argv, &i, > > &nonargs)) > > - goto error; > > + if (nonargs) > > + { > > + while (i < nonargs) > > + if (!_ecore_getopt_parse_arg(parser, values, argc, argv, &i, > > &nonargs)) > > + goto error; > > + } > > + else > > + { > > + int tmp = 0; > > > > + while (i < argc) > > + if (!_ecore_getopt_parse_arg(parser, values, argc, argv, &i, > > &tmp)) > > + goto error; > > + } > > + > > return nonargs; > > > > error: > > > > > > ------------------------------------------------------------------------------ > > Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! > > Tap into the largest installed PC base & get more eyes on your game by > > optimizing for Intel(R) Graphics Technology. Get started today with the > > Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. > > http://p.sf.net/sfu/intelisp-dev2dev > > _______________________________________________ > > enlightenment-svn mailing list > > enlightenment-...@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn > > > -- Mike Blumenkrantz Zentific: Our boolean values are huge. ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel