ARGC/ARGV Strangeness - Code is working

William Park opengeometry-FFYn/CNdgSA at public.gmane.org
Wed Sep 21 05:18:24 UTC 2005


On Wed, Sep 21, 2005 at 12:20:03AM -0400, Chris F.A. Johnson wrote:
> >>      strcpy(p1, argv[count]);
> >
> >Bad habit.  What happens if your argument is longer than 4 chars?  Try
> >using strncpy(3).
> 
>    But why copy it at all?
> 
>        num = atoi(argv[count]);

True.

> >Of course, in shell script, it becomes
> >   ascii()
> >   {
> >	for i; do
> >	    echo "$i	`tostring $i`"
> 
>    "tostring"? Is that part of your bash extension, William?

Yes.
    tonumber abc	--> 97 98 99
    tostring 97 98 99	--> abc

Ref:
    http://home.eol.ca/~parkw/index.html#ctype.h

-- 
William Park <opengeometry-FFYn/CNdgSA at public.gmane.org>, Toronto, Canada
ThinFlash: Linux thin-client on USB key (flash) drive
	   http://home.eol.ca/~parkw/thinflash.html
BashDiff: Super Bash shell
	  http://freshmeat.net/projects/bashdiff/
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list