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-69229a6c92a2d73bcee7c06eb79bd0a4f40d4e16.tar.gz
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[] =
"\t-c=N[kbm]\toutput the last N bytes\n"
#endif
"\t-n NUM\t\tPrint last NUM lines instead of first 10\n"
- "\t\t\tAlso can be -NUM or +NUM.\n"
"\t-f\t\tOutput data as the file grows.\n"
#ifndef BB_FEATURE_SIMPLE_TAIL
"\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;
static off_t units=0;
-int tail_stream(int fd)
+static int tail_stream(int fd)
{
ssize_t startpoint;
ssize_t endpoint=0;
@@ -155,18 +155,6 @@ void add_file(char *name)
strcpy(files[n_files - 1], name);
}
-void checknumbers(const char* name)
-{
- int test=atoi(name);
- if(test){
- units=test;
- if(units<0)
- units=units-1;
- } else {
- fatalError("Unrecognised number '%s'\n", name);
- }
-}
-
int tail_main(int argc, char **argv)
{
int show_headers = 1;
@@ -178,14 +166,9 @@ int tail_main(int argc, char **argv)
opterr = 0;
- while ((opt=getopt(argc,argv,"c:fhn:s:q:v123456789+")) >0) {
+ while ((opt=getopt(argc,argv,"c:fhn:s:q:v")) >0) {
switch (opt) {
- case '1':case '2':case '3':case '4':case '5':
- case '6':case '7':case '8':case '9':case '0':
- checknumbers(argv[optind-1]);
- break;
-
#ifndef BB_FEATURE_SIMPLE_TAIL
case 'c':
unit_type = BYTES;
@@ -253,10 +236,7 @@ int tail_main(int argc, char **argv)
else
break;
}else {
- if (*argv[optind] == '+') {
- checknumbers(argv[optind]);
- }
- else if (!strcmp(argv[optind], "-")) {
+ if (!strcmp(argv[optind], "-")) {
add_file(STDIN);
} else {
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;
static off_t units=0;
-int tail_stream(int fd)
+static int tail_stream(int fd)
{
ssize_t startpoint;
ssize_t endpoint=0;
@@ -155,18 +155,6 @@ void add_file(char *name)
strcpy(files[n_files - 1], name);
}
-void checknumbers(const char* name)
-{
- int test=atoi(name);
- if(test){
- units=test;
- if(units<0)
- units=units-1;
- } else {
- fatalError("Unrecognised number '%s'\n", name);
- }
-}
-
int tail_main(int argc, char **argv)
{
int show_headers = 1;
@@ -178,14 +166,9 @@ int tail_main(int argc, char **argv)
opterr = 0;
- while ((opt=getopt(argc,argv,"c:fhn:s:q:v123456789+")) >0) {
+ while ((opt=getopt(argc,argv,"c:fhn:s:q:v")) >0) {
switch (opt) {
- case '1':case '2':case '3':case '4':case '5':
- case '6':case '7':case '8':case '9':case '0':
- checknumbers(argv[optind-1]);
- break;
-
#ifndef BB_FEATURE_SIMPLE_TAIL
case 'c':
unit_type = BYTES;
@@ -253,10 +236,7 @@ int tail_main(int argc, char **argv)
else
break;
}else {
- if (*argv[optind] == '+') {
- checknumbers(argv[optind]);
- }
- else if (!strcmp(argv[optind], "-")) {
+ if (!strcmp(argv[optind], "-")) {
add_file(STDIN);
} else {
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[] =
"\t-c=N[kbm]\toutput the last N bytes\n"
#endif
"\t-n NUM\t\tPrint last NUM lines instead of first 10\n"
- "\t\t\tAlso can be -NUM or +NUM.\n"
"\t-f\t\tOutput data as the file grows.\n"
#ifndef BB_FEATURE_SIMPLE_TAIL
"\t-q\t\tnever output headers giving file names\n"