Re: CONFIG_FEATURE_FLOAT_SLEEP

2008-07-16 Thread Loïc Grenié
2008/7/16 Denys Vlasenko <[EMAIL PROTECTED]>:
> Applied. But I changed these options to boolean.
> It's easier to do randomconfig tests this way.
> Also, one option less to record in .config

Fine with me.

  Loïc
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: CONFIG_FEATURE_FLOAT_SLEEP

2008-07-15 Thread Denys Vlasenko
On Tuesday 15 July 2008 09:24, Loïc Grenié wrote:
> 2008/7/15 Denys Vlasenko <[EMAIL PROTECTED]>:
> > On Tuesday 15 July 2008 08:58, Loïc Grenié wrote:
> >>  This is a patch that implements a config option for the
> >>   fractional sleep arguments.
> >
> > -#if ENABLE_FEATURE_FANCY_SLEEP
> > +#if ENABLE_FEATURE_FANCY_SLEEP && !ENABLE_FEATURE_FLOAT_SLEEP
> >  static const struct suffix_mult sfx[] = {
> >
> > But fractional second sleep needs sfx[],
> > because "sleep 0.9m" should work too (coreutils does that).
> > You might also wat to mention that in help text.
> 
> My bad.

Applied. But I changed these options to boolean.
It's easier to do randomconfig tests this way.
Also, one option less to record in .config
--
vda
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: CONFIG_FEATURE_FLOAT_SLEEP

2008-07-15 Thread Loïc Grenié
2008/7/15 Bernhard Fischer <[EMAIL PROTECTED]>:
> On Tue, Jul 15, 2008 at 09:24:00AM +0200, Loïc Grenié wrote:
>>2008/7/15 Denys Vlasenko <[EMAIL PROTECTED]>:
>>> On Tuesday 15 July 2008 08:58, Loïc Grenié wrote:
  This is a patch that implements a config option for the
   fractional sleep arguments.
>>>
>>> -#if ENABLE_FEATURE_FANCY_SLEEP
>>> +#if ENABLE_FEATURE_FANCY_SLEEP && !ENABLE_FEATURE_FLOAT_SLEEP
>>>  static const struct suffix_mult sfx[] = {
>>>
>>> But fractional second sleep needs sfx[],
>>> because "sleep 0.9m" should work too (coreutils does that).
>>> You might also wat to mention that in help text.
>>
>>My bad.
>
> It should not be FANCY_SLEEP || FLOAT_SLEEP but independent options so
> one can have FANCY && FLOAT if desired.
>
> Can you send an updated patch, please?

 FLOAT contains FANCY (I had missed it at the beginning, but FLOAT has
  the functionality of FANCY). I thing making FLOAT depends on FANCY is
  not a very good idea (someone looking for the FLOAT functionality will
  probably not think about enabling FANCY).

 Btw the name FLOAT is not cast in stone obviously.

   Loïc
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: CONFIG_FEATURE_FLOAT_SLEEP

2008-07-15 Thread Bernhard Fischer
On Tue, Jul 15, 2008 at 09:24:00AM +0200, Loïc Grenié wrote:
>2008/7/15 Denys Vlasenko <[EMAIL PROTECTED]>:
>> On Tuesday 15 July 2008 08:58, Loïc Grenié wrote:
>>>  This is a patch that implements a config option for the
>>>   fractional sleep arguments.
>>
>> -#if ENABLE_FEATURE_FANCY_SLEEP
>> +#if ENABLE_FEATURE_FANCY_SLEEP && !ENABLE_FEATURE_FLOAT_SLEEP
>>  static const struct suffix_mult sfx[] = {
>>
>> But fractional second sleep needs sfx[],
>> because "sleep 0.9m" should work too (coreutils does that).
>> You might also wat to mention that in help text.
>
>My bad.

It should not be FANCY_SLEEP || FLOAT_SLEEP but independent options so
one can have FANCY && FLOAT if desired.

Can you send an updated patch, please?
TIA,
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


Re: CONFIG_FEATURE_FLOAT_SLEEP

2008-07-15 Thread Loïc Grenié
2008/7/15 Denys Vlasenko <[EMAIL PROTECTED]>:
> On Tuesday 15 July 2008 08:58, Loïc Grenié wrote:
>>  This is a patch that implements a config option for the
>>   fractional sleep arguments.
>
> -#if ENABLE_FEATURE_FANCY_SLEEP
> +#if ENABLE_FEATURE_FANCY_SLEEP && !ENABLE_FEATURE_FLOAT_SLEEP
>  static const struct suffix_mult sfx[] = {
>
> But fractional second sleep needs sfx[],
> because "sleep 0.9m" should work too (coreutils does that).
> You might also wat to mention that in help text.

My bad.

   Loïc
Index: coreutils/sleep.c
===
--- coreutils/sleep.c	(révision 22832)
+++ coreutils/sleep.c	(copie de travail)
@@ -23,7 +23,7 @@
 /* This is a NOFORK applet. Be very careful! */
 
 
-#if ENABLE_FEATURE_FANCY_SLEEP
+#if ENABLE_FEATURE_FANCY_SLEEP || ENABLE_FEATURE_FLOAT_SLEEP
 static const struct suffix_mult sfx[] = {
 	{ "s", 1 },
 	{ "m", 60 },
@@ -36,7 +36,7 @@
 int sleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int sleep_main(int argc UNUSED_PARAM, char **argv)
 {
-#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
+#if ENABLE_FEATURE_FLOAT_SLEEP
 	double duration;
 	struct timespec ts;
 #else
@@ -47,7 +47,7 @@
 	if (!*argv)
 		bb_show_usage();
 
-#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
+#if ENABLE_FEATURE_FLOAT_SLEEP
 
 	duration = 0;
 	do {
Index: coreutils/Config.in
===
--- coreutils/Config.in	(révision 22832)
+++ coreutils/Config.in	(copie de travail)
@@ -514,13 +514,36 @@
 	help
 	  sleep is used to pause for a specified number of seconds,
 
+choice
+	prompt "Options for sleep"
+	default FEATURE_SMALL_SLEEP
+	help
+	  sleep comes in 3 versions:
+	  - The small one with no fancy features.
+	  - The fancy one which allows multiple arguments with time suffixes:
+	  sleep 1d 2h 3m 15s will sleep for 1 day 2 hours 3 minutes and
+	  15 seconds.
+	  - The floating one which allows multiple fractional times:
+	  sleep 2.3s 4.5h will sleep for 16202.3 seconds.
+
+config FEATURE_SMALL_SLEEP
+	bool "Small sleep"
+	help
+	  Most compact version of sleep.
+
 config FEATURE_FANCY_SLEEP
 	bool "Enable multiple integer args and optional time suffixes"
-	default n
-	depends on SLEEP
 	help
 	  Allow sleep to pause for specified minutes, hours, and days.
 
+config FEATURE_FLOAT_SLEEP
+	bool "Enable multiple fractional arguments"
+	help
+	  Allow sleep to pause for non integer time with optional trailing
+	  units for minutes, hours and days.
+
+endchoice
+
 config SORT
 	bool "sort"
 	default n
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Re: CONFIG_FEATURE_FLOAT_SLEEP

2008-07-15 Thread Denys Vlasenko
On Tuesday 15 July 2008 08:58, Loïc Grenié wrote:
>  This is a patch that implements a config option for the
>   fractional sleep arguments.

-#if ENABLE_FEATURE_FANCY_SLEEP
+#if ENABLE_FEATURE_FANCY_SLEEP && !ENABLE_FEATURE_FLOAT_SLEEP
 static const struct suffix_mult sfx[] = {

But fractional second sleep needs sfx[],
because "sleep 0.9m" should work too (coreutils does that).
You might also wat to mention that in help text.
--
vda
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


CONFIG_FEATURE_FLOAT_SLEEP

2008-07-14 Thread Loïc Grenié
 This is a patch that implements a config option for the
  fractional sleep arguments.

   Hope this helps,

  Loïc
Index: coreutils/sleep.c
===
--- coreutils/sleep.c	(révision 22832)
+++ coreutils/sleep.c	(copie de travail)
@@ -23,7 +23,7 @@
 /* This is a NOFORK applet. Be very careful! */
 
 
-#if ENABLE_FEATURE_FANCY_SLEEP
+#if ENABLE_FEATURE_FANCY_SLEEP && !ENABLE_FEATURE_FLOAT_SLEEP
 static const struct suffix_mult sfx[] = {
 	{ "s", 1 },
 	{ "m", 60 },
@@ -36,7 +36,7 @@
 int sleep_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
 int sleep_main(int argc UNUSED_PARAM, char **argv)
 {
-#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
+#if ENABLE_FEATURE_FLOAT_SLEEP
 	double duration;
 	struct timespec ts;
 #else
@@ -47,7 +47,7 @@
 	if (!*argv)
 		bb_show_usage();
 
-#if ENABLE_FEATURE_FANCY_SLEEP && ENABLE_DESKTOP
+#if ENABLE_FEATURE_FLOAT_SLEEP
 
 	duration = 0;
 	do {
Index: coreutils/Config.in
===
--- coreutils/Config.in	(révision 22832)
+++ coreutils/Config.in	(copie de travail)
@@ -514,13 +514,35 @@
 	help
 	  sleep is used to pause for a specified number of seconds,
 
+choice
+	prompt "Options for sleep"
+	default FEATURE_SMALL_SLEEP
+	help
+	  sleep comes in 3 versions:
+	  - The small one with no fancy features.
+	  - The fancy one which allows multiple arguments with time suffixes:
+	  sleep 1d 2h 3m 15s will sleep for 1 day 2 hours 3 minutes and
+	  15 seconds.
+	  - The floating one which allows multiple fractional time:
+	  sleep 2.3 4.5 will sleep for 6.8 seconds.
+
+config FEATURE_SMALL_SLEEP
+	bool "Small sleep"
+	help
+	  Most compact version of sleep.
+
 config FEATURE_FANCY_SLEEP
 	bool "Enable multiple integer args and optional time suffixes"
-	default n
-	depends on SLEEP
 	help
 	  Allow sleep to pause for specified minutes, hours, and days.
 
+config FEATURE_FLOAT_SLEEP
+	bool "Enable multiple fractional arguments"
+	help
+	  Allow sleep to pause for non integer time.
+
+endchoice
+
 config SORT
 	bool "sort"
 	default n
___
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox