aboutsummaryrefslogtreecommitdiff
path: root/tail.c
diff options
context:
space:
mode:
Diffstat (limited to 'tail.c')
-rw-r--r--tail.c26
1 files changed, 3 insertions, 23 deletions
diff --git a/tail.c b/tail.c
index 1091d28ed..a9da95462 100644
--- a/tail.c
+++ b/tail.c
@@ -61,7 +61,7 @@ static char verbose = 0;
61 61
62static off_t units=0; 62static off_t units=0;
63 63
64int tail_stream(int fd) 64static int tail_stream(int fd)
65{ 65{
66 ssize_t startpoint; 66 ssize_t startpoint;
67 ssize_t endpoint=0; 67 ssize_t endpoint=0;
@@ -155,18 +155,6 @@ void add_file(char *name)
155 strcpy(files[n_files - 1], name); 155 strcpy(files[n_files - 1], name);
156} 156}
157 157
158void checknumbers(const char* name)
159{
160 int test=atoi(name);
161 if(test){
162 units=test;
163 if(units<0)
164 units=units-1;
165 } else {
166 fatalError("Unrecognised number '%s'\n", name);
167 }
168}
169
170int tail_main(int argc, char **argv) 158int tail_main(int argc, char **argv)
171{ 159{
172 int show_headers = 1; 160 int show_headers = 1;
@@ -178,14 +166,9 @@ int tail_main(int argc, char **argv)
178 166
179 opterr = 0; 167 opterr = 0;
180 168
181 while ((opt=getopt(argc,argv,"c:fhn:s:q:v123456789+")) >0) { 169 while ((opt=getopt(argc,argv,"c:fhn:s:q:v")) >0) {
182 170
183 switch (opt) { 171 switch (opt) {
184 case '1':case '2':case '3':case '4':case '5':
185 case '6':case '7':case '8':case '9':case '0':
186 checknumbers(argv[optind-1]);
187 break;
188
189#ifndef BB_FEATURE_SIMPLE_TAIL 172#ifndef BB_FEATURE_SIMPLE_TAIL
190 case 'c': 173 case 'c':
191 unit_type = BYTES; 174 unit_type = BYTES;
@@ -253,10 +236,7 @@ int tail_main(int argc, char **argv)
253 else 236 else
254 break; 237 break;
255 }else { 238 }else {
256 if (*argv[optind] == '+') { 239 if (!strcmp(argv[optind], "-")) {
257 checknumbers(argv[optind]);
258 }
259 else if (!strcmp(argv[optind], "-")) {
260 add_file(STDIN); 240 add_file(STDIN);
261 } else { 241 } else {
262 add_file(argv[optind]); 242 add_file(argv[optind]);