[BusyBox] Re: [BusyBox-cvs] busybox/applets busybox.c,1.139,1.140

Erik Andersen andersen at codepoet.org
Fri Oct 3 08:37:23 UTC 2003


On Fri Oct 03, 2003 at 03:25:33AM +0000, Glenn McGrath wrote:
> Update of /var/cvs/busybox/applets
> In directory winder:/tmp/cvs-serv376/applets
> 
> Modified Files:
> 	busybox.c 
> Log Message:
> Patch from Rob Landley, Simplify organisation of arguments.
> 
> 
> Index: busybox.c
> ===================================================================
> RCS file: /var/cvs/busybox/applets/busybox.c,v
> retrieving revision 1.139
> retrieving revision 1.140
> diff -u -d -r1.139 -r1.140
> --- busybox.c	19 Mar 2003 09:11:13 -0000	1.139
> +++ busybox.c	3 Oct 2003 03:25:30 -0000	1.140
> @@ -98,7 +98,7 @@
>  
>  int busybox_main(int argc, char **argv)
>  {
> -	int col = 0, len, i;
> +	int col = 0;
>  
>  #ifdef CONFIG_FEATURE_INSTALLER	
>  	/* 
> @@ -161,18 +161,7 @@
>  	/* Flag that we've been here already */
>  	been_there_done_that = 1;
>  	
> -	/* Move the command line down a notch */
> -	len = argv[argc] + strlen(argv[argc]) - argv[1];
> -	memmove(argv[0], argv[1], len);
> -	memset(argv[0] + len, 0, argv[1] - argv[0]);
> -
> -	/* Fix up the argv pointers */
> -	len = argv[1] - argv[0];
> -	memmove(argv, argv + 1, sizeof(char *) * (argc + 1));
> -	for (i = 0; i < argc; i++)
> -		argv[i] -= len;
> -
> -	return (main(argc, argv));
> +	return (main(argc-1, argv+1));
>  }

The point of all of this moving and memsetting was to make
certain that 'ps' output would show the applet name when you run
'busybox applet'.  I suppose that isn't an especially critical
feature, but it did have its uses.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the busybox mailing list