[patch] New-applet howto. (and new applet)

Tito farmatito at tiscali.it
Tue May 8 13:22:46 PDT 2007


On Tuesday 08 May 2007 21:32:28 Tito wrote:
> On Tuesday 08 May 2007 19:52:31 Denis Vlasenko wrote:
> > On Tuesday 08 May 2007 15:15, Thomas Lundquist wrote:
> > > On Tue, May 08, 2007 at 12:39:55AM +0200, Denis Vlasenko wrote:
> > > > 
> > > > string is optional, thus should be [string].
> > > > "This also takes stdin as password\n" - what does this exactly mean?
> > > 
> > > Just wanted to describe that you can do 
> > > 
> > > BAR='echo "foo" | ./ cryptpw'
> > > 
> > > somehow.
> > > 
> > > but it's still a unix applet so it's supposed to do that anyway. 
> > > 
> > > Just remove the line I guess.
> > > 
> > > tested your patch and it's working and a nice lession in cutting.
> > > 
> > > Your patch, with a line less in usage.h attached.
> > 
> > Applied, thanks!
> > --
> > vda
> Hi,
> Denis, maybe you forgot to svn add cryptpw.c ?

and libbb/crypt_make_salt.c  !!! 

> Ciao,
> Tito

BTW:

scripts/bloat-o-meter busybox_old busybox_unstripped
function                                             old     new   delta
cryptpw_main                                         207     164     -43
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-43)             Total: -43 bytes


int cryptpw_main(int argc, char **argv)
{
	char salt[11] = "$1$\0\0\0\0\0\0\0\0";

	getopt32(argc, argv, "a:", NULL);

	crypt_make_salt(salt + 3, 4); /* md5 */
	if (argc > 2 && argv[2][0] == 'd')	/* des */
		crypt_make_salt(salt, 1);
	
	puts(pw_encrypt(argv[argc - 1] ? argv[argc - 1] : xmalloc_getline(stdin), salt));

	return 0;
} 

Ciao,
Tito


More information about the busybox mailing list