Fold mkpasswd applet into cryptpw.

mkpasswd is in Debian, OTOH cryptpw was added to busybox earlier.
Trying to make both camps happy by making those two applets just aliases.
They are command-line compatible. We can decide whether we want to drop one
(and which one) later.

function                                             old     new   delta
cryptpw_main                                         183     314    +131
static.methods                                        21       -     -21
packed_usage                                       25707   25648     -59
mkpasswd_main                                        307       -    -307
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 1/1 up/down: 131/-387)         Total: -256 bytes
This commit is contained in:
Denis Vlasenko
2008-12-04 12:05:26 +00:00
parent 196a953f21
commit e45930e890
6 changed files with 132 additions and 161 deletions

View File

@ -573,18 +573,45 @@
"\n -r Delete crontab" \
"\n FILE Replace crontab by FILE ('-': stdin)" \
#if !ENABLE_USE_BB_CRYPT || ENABLE_USE_BB_CRYPT_SHA
#define cryptpw_trivial_usage \
"[-a des|md5|sha256/512] [string]"
#else
#define cryptpw_trivial_usage \
"[-a des|md5] [string]"
#endif
"[OPTIONS] [PASSWORD] [SALT]"
/* We do support -s, we just don't mention it */
#define cryptpw_full_usage "\n\n" \
"Output crypted string.\n" \
"If string isn't supplied on cmdline, read it from stdin.\n" \
"Crypt the PASSWORD using crypt(3)\n" \
"\nOptions:" \
"\n -a Algorithm to use (default: md5)" \
USE_GETOPT_LONG( \
"\n -P,--password-fd=NUM Read password from fd NUM" \
/* "\n -s,--stdin Use stdin; like -P0" */ \
"\n -m,--method=TYPE Encryption method TYPE" \
"\n -S,--salt=SALT" \
) \
SKIP_GETOPT_LONG( \
"\n -P NUM Read password from fd NUM" \
/* "\n -s Use stdin; like -P0" */ \
"\n -m TYPE Encryption method TYPE" \
"\n -S SALT" \
) \
/* mkpasswd is an alias to cryptpw */
#define mkpasswd_trivial_usage \
"[OPTIONS] [PASSWORD] [SALT]"
/* We do support -s, we just don't mention it */
#define mkpasswd_full_usage "\n\n" \
"Crypt the PASSWORD using crypt(3)\n" \
"\nOptions:" \
USE_GETOPT_LONG( \
"\n -P,--password-fd=NUM Read password from fd NUM" \
/* "\n -s,--stdin Use stdin; like -P0" */ \
"\n -m,--method=TYPE Encryption method TYPE" \
"\n -S,--salt=SALT" \
) \
SKIP_GETOPT_LONG( \
"\n -P NUM Read password from fd NUM" \
/* "\n -s Use stdin; like -P0" */ \
"\n -m TYPE Encryption method TYPE" \
"\n -S SALT" \
) \
#define cttyhack_trivial_usage NOUSAGE_STR
#define cttyhack_full_usage ""
@ -2618,20 +2645,6 @@
"$ mknod /dev/fd0 b 2 0\n" \
"$ mknod -m 644 /tmp/pipe p\n"
#define mkpasswd_trivial_usage \
"[OPTIONS] [PASSWORD]"
#define mkpasswd_full_usage "\n\n" \
"Crypts the PASSWORD using crypt(3)\n" \
"\nOptions:" \
"\n\t-P"USE_GETOPT_LONG(", --password-fd=")"NUM\tread password from fd NUM" \
"\n\t-s"USE_GETOPT_LONG(", --stdin")"\t\tuse stdin; like -P0" \
"\n\t-m"USE_GETOPT_LONG(", --method=")"TYPE\tEncryption method TYPE" \
"\n\t-S"USE_GETOPT_LONG(", --salt=")"SALT\t\tuse SALT"
#define mkpasswd_example_usage \
"$ mkpasswd -m md5\n" \
"$ mkpasswd -l 12\n"
#define mkswap_trivial_usage \
"DEVICE"
#define mkswap_full_usage "\n\n" \