[BusyBox-cvs] busybox/textutils tail.c,1.42,1.43

Glenn McGrath bug1 at busybox.net
Mon Dec 23 11:55:00 UTC 2002


Update of /var/cvs/busybox/textutils
In directory winder:/tmp/cvs-serv22445/textutils

Modified Files:
	tail.c 
Log Message:
Support the obsolete '+' option


Index: tail.c
===================================================================
RCS file: /var/cvs/busybox/textutils/tail.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- tail.c	27 May 2002 22:24:53 -0000	1.42
+++ tail.c	23 Dec 2002 11:54:56 -0000	1.43
@@ -69,12 +69,27 @@
 	char *s, *start, *end, buf[BUFSIZ];
 	int i, opt;
 
-	if (( argc >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
-		count = atoi ( &argv [1][1] );
-		optind = 2;
+	if (argc >= 2) {
+		int line_num;
+		switch (argv[1][0]) {
+			case '+':
+				from_top = 1;
+				/* FALLS THROUGH */
+			case '-':
+				line_num = atoi(&argv[1][1]);
+				if (line_num != 0) {
+					optind = 2;
+					count = line_num;
+				}
+				break;
+		}
 	}
 
-	while ((opt = getopt(argc, argv, "c:fhn:q:s:v")) > 0) {
+#ifdef CONFIG_FEATURE_FANCY_TAIL
+	while ((opt = getopt(argc, argv, "c:fn:q:s:v")) > 0) {
+#else
+	while ((opt = getopt(argc, argv, "fn:")) > 0) {
+#endif
 		switch (opt) {
 			case 'f':
 				follow = 1;




More information about the busybox-cvs mailing list