aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2000-10-19 21:28:32 +0000
committerMatt Kraai <kraai@debian.org>2000-10-19 21:28:32 +0000
commit69229a6c92a2d73bcee7c06eb79bd0a4f40d4e16 (patch)
tree1c5f6a1d99853496e728915d1a1faa90bb3c231a
parent4f94e826cf61086639bddcd2cd44bd40faee0712 (diff)
downloadbusybox-w32-69229a6c92a2d73bcee7c06eb79bd0a4f40d4e16.tar.gz
busybox-w32-69229a6c92a2d73bcee7c06eb79bd0a4f40d4e16.tar.bz2
busybox-w32-69229a6c92a2d73bcee7c06eb79bd0a4f40d4e16.zip
Piss people off by removing [+-][0-9]+ options from tail.
-rw-r--r--applets/usage.c1
-rw-r--r--coreutils/tail.c26
-rw-r--r--tail.c26
-rw-r--r--usage.c1
4 files changed, 6 insertions, 48 deletions
diff --git a/applets/usage.c b/applets/usage.c
index 51ab9a813..11326432c 100644
--- a/applets/usage.c
+++ b/applets/usage.c
@@ -1164,7 +1164,6 @@ const char tail_usage[] =
1164 "\t-c=N[kbm]\toutput the last N bytes\n" 1164 "\t-c=N[kbm]\toutput the last N bytes\n"
1165#endif 1165#endif
1166 "\t-n NUM\t\tPrint last NUM lines instead of first 10\n" 1166 "\t-n NUM\t\tPrint last NUM lines instead of first 10\n"
1167 "\t\t\tAlso can be -NUM or +NUM.\n"
1168 "\t-f\t\tOutput data as the file grows.\n" 1167 "\t-f\t\tOutput data as the file grows.\n"
1169#ifndef BB_FEATURE_SIMPLE_TAIL 1168#ifndef BB_FEATURE_SIMPLE_TAIL
1170 "\t-q\t\tnever output headers giving file names\n" 1169 "\t-q\t\tnever output headers giving file names\n"
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 1091d28ed..a9da95462 100644
--- a/coreutils/tail.c
+++ b/coreutils/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]);
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]);
diff --git a/usage.c b/usage.c
index 51ab9a813..11326432c 100644
--- a/usage.c
+++ b/usage.c
@@ -1164,7 +1164,6 @@ const char tail_usage[] =
1164 "\t-c=N[kbm]\toutput the last N bytes\n" 1164 "\t-c=N[kbm]\toutput the last N bytes\n"
1165#endif 1165#endif
1166 "\t-n NUM\t\tPrint last NUM lines instead of first 10\n" 1166 "\t-n NUM\t\tPrint last NUM lines instead of first 10\n"
1167 "\t\t\tAlso can be -NUM or +NUM.\n"
1168 "\t-f\t\tOutput data as the file grows.\n" 1167 "\t-f\t\tOutput data as the file grows.\n"
1169#ifndef BB_FEATURE_SIMPLE_TAIL 1168#ifndef BB_FEATURE_SIMPLE_TAIL
1170 "\t-q\t\tnever output headers giving file names\n" 1169 "\t-q\t\tnever output headers giving file names\n"