[BusyBox-cvs] busybox/coreutils seq.c, NONE, 1.1 Config.in, 1.21, 1.22 Makefile.in, 1.7, 1.8

Glenn McGrath bug1 at busybox.net
Tue Jan 27 09:22:22 UTC 2004


Update of /var/cvs/busybox/coreutils
In directory nail:/tmp/cvs-serv9911/coreutils

Modified Files:
	Config.in Makefile.in 
Added Files:
	seq.c 
Log Message:
New applet, seq. No options, just the basics.


Index: Makefile.in
===================================================================
RCS file: /var/cvs/busybox/coreutils/Makefile.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- Makefile.in	27 Jan 2004 07:36:07 -0000	1.7
+++ Makefile.in	27 Jan 2004 09:22:20 -0000	1.8
@@ -63,6 +63,7 @@
 COREUTILS-$(CONFIG_REALPATH)	+= realpath.o
 COREUTILS-$(CONFIG_RM)      	+= rm.o
 COREUTILS-$(CONFIG_RMDIR)   	+= rmdir.o
+COREUTILS-$(CONFIG_SEQ)     	+= seq.o
 COREUTILS-$(CONFIG_SHA1SUM) 	+= md5_sha1_sum.o
 COREUTILS-$(CONFIG_SLEEP)   	+= sleep.o
 COREUTILS-$(CONFIG_SORT)    	+= sort.o

Index: Config.in
===================================================================
RCS file: /var/cvs/busybox/coreutils/Config.in,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- Config.in	8 Dec 2003 20:11:55 -0000	1.21
+++ Config.in	27 Jan 2004 09:22:20 -0000	1.22
@@ -367,6 +367,12 @@
 	help
 	  rmdir is used to remove empty directories.
 
+config CONFIG_SEQ
+	bool "seq"
+	default n
+	help
+	  print a sequence of numbers
+
 config CONFIG_SHA1SUM
 	bool "sha1sum"
 	default n

--- NEW FILE: seq.c ---
/*
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of version 2 of the GNU General Public License as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include <stdio.h>
#include <stdlib.h>
#include "busybox.h"

extern int seq_main(int argc, char **argv)
{
	double last;
	double first = 1;
	double increment = 1;
	double i;

	if (argc == 4) {
		first = atof(argv[1]);
		increment = atof(argv[2]);
	}
	else if (argc == 3) {
		first = atof(argv[1]);
	}
	else if (argc != 2) {
		bb_show_usage();
	}
	last = atof(argv[argc - 1]);

	for (i = first; ((first < last) ? (i <= last): (i >= last));i += increment) {
		printf("%g\n", i);
	}

	return(EXIT_SUCCESS);
}




More information about the busybox-cvs mailing list