public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] u-boot 1.1.2 and atoi in exports not working
Date: Thu, 24 Nov 2005 16:53:34 +0100	[thread overview]
Message-ID: <E1EfJo3-0005yS-Cl@mail.sourceforge.net> (raw)
In-Reply-To: Your message of "Thu, 24 Nov 2005 09:37:58 EST." <6a7ac2300511240637p1b281106k2849ac3bb5a96715@mail.gmail.com>

Dear John,

in message <6a7ac2300511240637p1b281106k2849ac3bb5a96715@mail.gmail.com> you wrote:
> 
> > What makes you think atoi() is available in U-Boot?
> 
> I see all these other routines using it.  I figured I could use it as well. ie.

Be careful! Just running "grep" does not mean anything. You  have  to
check on which #ifdef's these lines depend.

> common/hush.c:104:#include <stdlib.h>    /* getenv, atoi */
> common/hush.c:606:      exit (atoi(child->argv[1]));
> common/hush.c:803:              n=atoi(child->argv[1]);
> common/hush.c:2667:     num=atoi(o->data);

For example, the hush shell is a port from the busybox  project,  and
was  changed  only  in the minimal necessary way. And if you look for
example at

common/hush.c:104:#include <stdlib.h>    /* getenv, atoi */

you should check the context:

    ...
    100 #ifdef CFG_HUSH_PARSER
    101 #ifndef __U_BOOT__
    102 #include <ctype.h>     /* isalpha, isdigit */
    103 #include <unistd.h>    /* getpid */
    104 #include <stdlib.h>    /* getenv, atoi */
    ...

Note the "#ifndef __U_BOOT__" part!

> tools/mpc86x_clk.c:205: xin  = atoi(argv[1]);
> tools/mpc86x_clk.c:206: want_gclk2 = atoi(argv[2]);
> tools/mpc86x_clk.c:208:         ppm = atoi(argv[3]);
> tools/ncb.c:14:         port = atoi (argv[1]);

Also, tools/ are tools that are running on the  host  system  -  they
don't have anything in common with U-Boot code.


Summary: there is no atoi() in U-Boot.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In an organization, each person rises to the level of his own  incom-
petency                                         - The Peter Principle

      parent reply	other threads:[~2005-11-24 15:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-24 14:23 [U-Boot-Users] u-boot 1.1.2 and atoi in exports not working John Davis
2005-11-24 14:35 ` Wolfgang Denk
     [not found]   ` <6a7ac2300511240637p1b281106k2849ac3bb5a96715@mail.gmail.com>
2005-11-24 14:52     ` Fwd: " John Davis
2005-11-24 16:16       ` David Jander
2005-11-24 16:42         ` Wolfgang Denk
2005-11-28 15:30           ` John Davis
2005-11-24 15:53     ` Wolfgang Denk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1EfJo3-0005yS-Cl@mail.sourceforge.net \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox