Mercurial > hg > toybox
comparison toys/posix/head.c @ 1744:0c30e5484516 draft
Add -123 support to head (suggested by Elliott Hughes).
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 19 Mar 2015 13:57:02 -0500 |
parents | 6cc69be43c42 |
children | 28806689547b |
comparison
equal
deleted
inserted
replaced
1743:da1296acc73e | 1744:0c30e5484516 |
---|---|
2 * | 2 * |
3 * Copyright 2006 Timothy Elliott <tle@holymonkey.com> | 3 * Copyright 2006 Timothy Elliott <tle@holymonkey.com> |
4 * | 4 * |
5 * See http://opengroup.org/onlinepubs/9699919799/utilities/head.html | 5 * See http://opengroup.org/onlinepubs/9699919799/utilities/head.html |
6 | 6 |
7 USE_HEAD(NEWTOY(head, "n#<0=10", TOYFLAG_BIN)) | 7 USE_HEAD(NEWTOY(head, "?n#<0=10", TOYFLAG_BIN)) |
8 | 8 |
9 config HEAD | 9 config HEAD |
10 bool "head" | 10 bool "head" |
11 default y | 11 default y |
12 help | 12 help |
48 } | 48 } |
49 } | 49 } |
50 | 50 |
51 void head_main(void) | 51 void head_main(void) |
52 { | 52 { |
53 loopfiles(toys.optargs, do_head); | 53 char *arg = *toys.optargs; |
54 | |
55 // handle old "-42" style arguments | |
56 if (arg && *arg == '-' && arg[1]) { | |
57 TT.lines = atolx(arg+1); | |
58 toys.optc--; | |
59 } | |
60 loopfiles(toys.optargs+!!arg, do_head); | |
54 } | 61 } |