Bug#446519: saytime: alternate way of calling sox
Holger Levsen hol...@layer-acht.org writes: For the future, I think it would make sense to release a new 1.1 of saytime, and include all those debian patches, what do you think? I haven't looked through all the other patches, but if we're likely the new upstream, then I doubt it's likely to be past time for a new release. -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
Hi Rob, (sorry for the delay...) On Samstag, 3. März 2012, Rob Browning wrote: OK, then here are some initial patches. I've also included checks for unexpected arguments, and support (assuming ?= is ok) for overriding CFLAGS. Let me know if you see anything you'd like fixed. thanks, I've applied these patches now to ssh://git.debian.org/srv/git.debian.org/git/collab-maint/saytime.git (which you can also access just via git://git.debian.org/git/collab-maint/saytime.git) and am about to upload to sid. For the future, I think it would make sense to release a new 1.1 of saytime, and include all those debian patches, what do you think? cheers, Holger -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
On Samstag, 3. März 2012, Rob Browning wrote: By the way -- does saytime still have an upstream that might also care about any of this? AFAICS, saytime is dead upstream. So you are free to become the new upstream ;) -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
Holger Levsen hol...@layer-acht.org writes: On Samstag, 3. März 2012, Rob Browning wrote: By the way -- does saytime still have an upstream that might also care about any of this? AFAICS, saytime is dead upstream. So you are free to become the new upstream OK, then how about this: - Use sox' -d for the output if saytime -o and -b aren't specified. This hopefully makes the most common case just DTRT. - Add a -t [foo] option that's passed straight through to sox (rather than hard-coding alsa/oss). - Rely on sox's default output-file whenever -o is not specified (instead of just hard-coding /dev/audio)). This won't break existing invocations of saytime, but there is a possibility it will change their behavior. i.e. say someone was using saytime which right now defaults to OSS and /dev/audio. These changes will cause it to switch to sox's default, which might or might not be the same. Of course, it also makes sox even more overtly dependent on sox, but the alternative is to hard-code/validate the backend set, which I'm not sure is better. Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
Hi Rob, On Samstag, 3. März 2012, Rob Browning wrote: OK, then how about this: sounds good to me. Of course, it also makes sox even more overtly dependent on sox, but the alternative is to hard-code/validate the backend set, which I'm not sure is better. indeed. Thanks thank you! :-) cheers, Holger -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
Holger Levsen hol...@layer-acht.org writes: sounds good to me. OK, then here are some initial patches. I've also included checks for unexpected arguments, and support (assuming ?= is ok) for overriding CFLAGS. Let me know if you see anything you'd like fixed. From d3067c4bf1c17c7ea7eda8e90819b0cb94c2172f Mon Sep 17 00:00:00 2001 From: Rob Browning r...@defaultvalue.org Date: Wed, 29 Feb 2012 21:44:36 -0600 Subject: [PATCH 1/4] Use CFLAGS when building saytime. --- Makefile |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index 91217d8..85762b8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ # Makefile for saytime. +CFLAGS ?= -O + saytime: saytime.c - cc -O -DSOUND_DIR=\/usr/share/saytime\ saytime.c -o saytime + cc ${CFLAGS} -DSOUND_DIR=\/usr/share/saytime\ saytime.c -o saytime clean: rm -f saytime -- 1.7.9.1 From 51ca759fa086165776241f68bb65251d0b17dd4f Mon Sep 17 00:00:00 2001 From: Rob Browning r...@defaultvalue.org Date: Wed, 29 Feb 2012 22:11:41 -0600 Subject: [PATCH 2/4] Check for unhandled arguments. --- saytime.c |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/saytime.c b/saytime.c index d84f17e..c08e587 100644 --- a/saytime.c +++ b/saytime.c @@ -160,6 +160,15 @@ char *argv[]; } } +if(optind != argc) { +int i; + fprintf(stderr, Unexpected arguments:); +for(i = optind; i argc; i++) + fprintf(stderr, %s, argv[i]); +fputc('\n', stderr); + usage(); +} + if (opt_to_stdout opt_sound_device != NULL) { printf(Specifying alternate device and stdout makes no sense.\n); usage(); -- 1.7.9.1 From 81c5ccf9716d88ef17e7f988747e7ba2ac23d332 Mon Sep 17 00:00:00 2001 From: Rob Browning r...@defaultvalue.org Date: Sat, 3 Mar 2012 14:45:03 -0600 Subject: [PATCH 3/4] Add alsa support; allow selection of output type via '-t'. See the changes to the saytime.1 manpage for further information. --- debian/saytime.1 | 11 ++- saytime.c| 47 ++- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/debian/saytime.1 b/debian/saytime.1 index 945f73d..c0ebcdd 100644 --- a/debian/saytime.1 +++ b/debian/saytime.1 @@ -15,6 +15,9 @@ saytime \- audio time check [ .BI \-o dev ] +[ +.BI \-t output\-type +] .br .SH DESCRIPTION .I saytime @@ -43,7 +46,13 @@ below). Display simple help. .TP .BI \-o dev -Output to alternate file (default /dev/audio). +Output to alternate file. If \-t is not specified with \-o, \-t +defaults to ossdsp. +.TP +.BI \-t output\-type +Specify the output type (oss, alsa, etc.); this is passed directly to +sox. If neither \-t nor \-o is specified, saytime will pick a default +destination via sox \-d. .SH FORMAT STRING A format string can be specified to control the time message. Valid format characters are: diff --git a/saytime.c b/saytime.c index c08e587..d4241eb 100644 --- a/saytime.c +++ b/saytime.c @@ -29,7 +29,6 @@ #include sys/wait.h #include signal.h -#define DEFAULT_SOUND_DEVICE /dev/audio #define DEFAULT_SOUND_DIR /usr/share/saytime #define DEFAULT_TIME_FORMAT %P%l%M%S #define DEFAULT_INTERVAL 1 @@ -94,6 +93,7 @@ It took about 10 minutes. #define PH_PM 36 int opt_to_stdout = 0; +char *opt_output_type = NULL; char *opt_sound_device = NULL; char *opt_sound_dir = DEFAULT_SOUND_DIR; char *opt_time_format = NULL; @@ -115,9 +115,9 @@ char *argv[]; long clock; struct tm *t; #if defined TTEST -char *opt_string=v:r:co:d:f:h:H:N:C:; +char *opt_string=v:t:r:co:d:f:h:H:N:C:; #else -char *opt_string=v:r:co:d:f:h; +char *opt_string=v:t:r:co:d:f:h; #endif int op ; pid_t fpid; @@ -149,6 +149,8 @@ char *argv[]; break; case 'c' : opt_to_stdout = 1; break; + case 't' : opt_output_type = optarg; + break; case 'o' : opt_sound_device = optarg; break; case 'd' : opt_sound_dir = optarg; @@ -173,8 +175,11 @@ char *argv[]; printf(Specifying alternate device and stdout makes no sense.\n); usage(); } -else if (opt_sound_device == NULL) - opt_sound_device = DEFAULT_SOUND_DEVICE; + +if (opt_to_stdout opt_output_type != NULL) { + printf(Specifying output type and stdout makes no sense.\n); + usage(); +} if (opt_time_format == NULL) opt_time_format = DEFAULT_TIME_FORMAT; @@ -231,7 +236,7 @@ char *argv[]; void usage( ) { -fprintf( stderr, Usage: saytime [-ch] [-v lvl] [-r sec] [-d dir] [-f fmt] [-o dev]\n ); +fprintf( stderr, Usage: saytime [-ch] [-v lvl] [-r sec] [-d dir] [-f fmt] [-o dev] [-t type]\n ); fprintf( stderr, Speak the current time through the computer's sound device.\n\n ); fprintf( stderr, Options:\n ); fprintf( stderr, -v lvl\tset volume level\n ); @@ -242,8 +247,8 @@ usage( )
Bug#446519: saytime: alternate way of calling sox
Ariel asdeb...@dsgml.com writes: On Thu, 1 Mar 2012, Rob Browning wrote: If we want -b [foo], I'll need to specify b to getopt (no colons) and handle any subsequent oss|alsa value manually (increment optind, etc.). That works -- or we can just require -balsa/-boss. Are you sure about that with getopt? The manual shows differently: http://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html#Example-of-Getopt -cfoo and -c foo were parsed the same in the example. With option pattern b::, only -bfoo appears to work; -b foo works if the argument to -b is not optional, i.e. if you specify pattern b:. Though as I mentioned, with a bit of extra code in the 'b' case in the getopt() loop, we can implement the -b [foo] semantics manually if we like. For backward compatibility, I imagine we shouldn't require -o, and should just default to oss when -b isn't specified. Nah, oss is dead, it's not useful as a default and backwards compatibility is not really that necessary. Right, but I'm thinking about existing systems that are still running saytime, perhaps as part of some larger cron/at based alert system (I used to use it as a simple alarm). Say they're calling saytime -o /dev/theircard; I'd rather not force that to break without a good reason. Of course, if we didn't have to worry about backward compatibility at all, it'd be nicest to have saytime default to sox -d whenever -b and -o aren't specified, since that's probably more portable. No, don't worry about backward compatibility at all. If it bothers you, then put in a NEWS file that lets people know the options changed. If we were fairly certain that sox -d was the same or better on the vast majority of systems, then that might be worth thinking about for the case where neither -b nor -o is specified. Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
Holger Levsen hol...@layer-acht.org writes: Of course, if we didn't have to worry about backward compatibility at all, I think we don't. Saytime wasnt included in squeeze (sadly) anyway, so... Hmm, I'd still be tempted to care somewhat if it doesn't cost too much. I have any number of systems that still have it installed (and where I've used it). At the moment, I don't have it integrated into anything where breakage would be annoying, but I wonder if someone else might. By the way -- does saytime still have an upstream that might also care about any of this? Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
Hi Bob, On Donnerstag, 1. März 2012, Rob Browning wrote: So somehow I missed Ariel and your earlier messages, but I'm poking at this again now... :-) Of course, if we didn't have to worry about backward compatibility at all, I think we don't. Saytime wasnt included in squeeze (sadly) anyway, so... cheers, Holger -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
On Thu, 1 Mar 2012, Rob Browning wrote: Ariel asdeb...@dsgml.com writes: I had thought that getopt() supported -b [foo] style arguments, but I must have misremembered. It looks like it only supports -b[foo]. If we want -b [foo], I'll need to specify b to getopt (no colons) and handle any subsequent oss|alsa value manually (increment optind, etc.). That works -- or we can just require -balsa/-boss. Are you sure about that with getopt? The manual shows differently: http://www.gnu.org/software/libc/manual/html_node/Example-of-Getopt.html#Example-of-Getopt -cfoo and -c foo were parsed the same in the example. Make a note in the man page that -o requires -b and error if -o is used without -b. For backward compatibility, I imagine we shouldn't require -o, and should just default to oss when -b isn't specified. Nah, oss is dead, it's not useful as a default and backwards compatibility is not really that necessary. Of course, if we didn't have to worry about backward compatibility at all, it'd be nicest to have saytime default to sox -d whenever -b and -o aren't specified, since that's probably more portable. No, don't worry about backward compatibility at all. If it bothers you, then put in a NEWS file that lets people know the options changed. -Ariel -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
So somehow I missed Ariel and your earlier messages, but I'm poking at this again now... Ariel asdeb...@dsgml.com writes: Just do -d instead of -t alsa and it will pick the output device automatically. Nice. I hadn't noticed -d. I would structure it like this: If nothing is passed to -b then use -d in sox, and -o is ignored. I had thought that getopt() supported -b [foo] style arguments, but I must have misremembered. It looks like it only supports -b[foo]. If we want -b [foo], I'll need to specify b to getopt (no colons) and handle any subsequent oss|alsa value manually (increment optind, etc.). That works -- or we can just require -balsa/-boss. Other possibilities: saytime -b alsa|oss|default # common case is more verbose than I'd like saytime -b alsa|oss # -b argument mandatory saytime -s# use default system device (i.e. sox -d) Make a note in the man page that -o requires -b and error if -o is used without -b. For backward compatibility, I imagine we shouldn't require -o, and should just default to oss when -b isn't specified. Of course, if we didn't have to worry about backward compatibility at all, it'd be nicest to have saytime default to sox -d whenever -b and -o aren't specified, since that's probably more portable. In any case, I should be able to finish this fairly quickly once we know what we want. Thanks -- Rob Browning rlb @defaultvalue.org and @debian.org GPG as of 2002-11-03 14DD 432F AE39 534D B592 F9A0 25C8 D377 8C7E 73A4 -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#446519: saytime: alternate way of calling sox
Hi Ariel, On Freitag, 25. Juni 2010, Ariel wrote: Rob - you are working way too hard to determine the sox output device. [...] I wonder if this message will reach you considering the bug is from 3 years ago. I could probably fix up this patch myself if you like. I've took over saytime maintainance in Debian some days ago and would be happy to get your patch. cheers, Holger signature.asc Description: This is a digitally signed message part.
Bug#446519: saytime: alternate way of calling sox
Rob - you are working way too hard to determine the sox output device. Just do -d instead of -t alsa and it will pick the output device automatically. I would structure it like this: If nothing is passed to -b then use -d in sox, and -o is ignored. If an option is passed to -b then use it, and if -o has an option then add it as well. Make a note in the man page that -o requires -b and error if -o is used without -b. I wonder if this message will reach you considering the bug is from 3 years ago. I could probably fix up this patch myself if you like. -Ariel -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org