nl: new applet; also implement cat -nb (similar functionality to nl)

function                                             old     new   delta
nl_main                                                -     201    +201
print_numbered_lines                                   -     115    +115
cat_main                                              36     149    +113
static.nl_longopts                                     -     106    +106
packed_usage                                       31081   31182    +101
applet_main                                         1488    1492      +4
applet_names                                        2575    2578      +3
applet_suid                                           93      94      +1
applet_install_loc                                   186     187      +1
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 6/0 up/down: 645/0)             Total: 645 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko
2017-04-05 18:17:17 +02:00
parent 5d561ef634
commit d88f94a5df
3 changed files with 149 additions and 4 deletions

View File

@@ -1271,6 +1271,16 @@ int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
void bb_displayroutes(int noresolve, int netstatfmt) FAST_FUNC;
#endif
struct number_state {
unsigned width;
unsigned start;
unsigned inc;
const char *sep;
const char *empty_str;
smallint all, nonempty;
};
void print_numbered_lines(struct number_state *ns, const char *filename) FAST_FUNC;
/* Networking */
/* This structure defines protocol families and their handlers. */