On Tuesday, December 4, 2012, David Seikel wrote:

> On Tue, 4 Dec 2012 19:22:58 -0200 Gustavo Sverzut Barbieri
> <[email protected] <javascript:;>> wrote:
>
> > On Tue, Dec 4, 2012 at 6:30 PM, Eduardo Lima (Etrunko)
> > <[email protected] <javascript:;>> wrote:
> > > On Tue, Dec 4, 2012 at 6:21 PM, Enlightenment SVN
> > > <[email protected] <javascript:;>> wrote:
> > >> Log:
> > >> New embryo function: get_program_id
> > >>
> > >>   It is now you can run programs with names generated dinamically.
> > >> Say that you have 10 programs indexed somehow. You can now call
> > >> them using the following snippet:
> > >>
> > >>   script {
> > >>      new program_id[15], i;
> > >>      for (i = 0; i < 10; i++) {
> > >>         snprintf(program_id, 15, "my_program_%d", i+1);
> > >>         run_program(get_program_id(program_id));
> > >>      }
> > >>   }
> > >>
> > >
> > > By the way, I noticed a bug in Embryo's snprintf. I can specify
> > > something like "my_program_%02d" as format string and it will
> > > generate as result "my_program_01", "my_program_02", and so on. It
> > > will use '0' to the left of the number if it is less than 2 chars
> > > long. See test code attached.
> >
> > sorry if that bite you, but it's a "known issue". If you look at some
> > e17 themes or even outside people doing clocks (hint: canola2) there
> > are snippets:
> >
> >  if (x < 10)
> >     snprintf(buf, sizeof(buf), "0%d", x);
> > else
> >     snprintf(buf, sizeof(buf), "%d", x);
> >
> > :-/
>
> Er, isn't that the way it's supposed to work?  From man 3 snprintf -
>
> "The value should be zero padded.  For d, i, o, u, x, X, a, A, e,
> E, f, F, g, and G conversions, the converted value is padded on the
> left with zeros rather than blanks."
>
> so "%02d" means print a number into a space two characters wide, padded
> on the left with 0s.  Which is what you are getting.


Embryo doesn't use libc sprintf. It's implemented inependently because
embryo strings are made of int, not char.




>
> --
> A big old stinking pile of genius that no one wants
> coz there are too many silver coated monkeys in the world.
>


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [email protected]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to