From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Thu, 24 Nov 2005 16:53:34 +0100 Subject: [U-Boot-Users] u-boot 1.1.2 and atoi in exports not working In-Reply-To: Your message of "Thu, 24 Nov 2005 09:37:58 EST." <6a7ac2300511240637p1b281106k2849ac3bb5a96715@mail.gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 /* 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 /* getenv, atoi */ you should check the context: ... 100 #ifdef CFG_HUSH_PARSER 101 #ifndef __U_BOOT__ 102 #include /* isalpha, isdigit */ 103 #include /* getpid */ 104 #include /* 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