1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-06-09 06:10:42 +00:00

Streamline -s option by always requiring an option argument

This commit is contained in:
Moritz Grimm 2015-04-16 00:08:43 +02:00
parent e3b3ed4cf9
commit 4062cc190a
3 changed files with 23 additions and 21 deletions

5
NEWS
View File

@ -1,9 +1,10 @@
Changes in X.X.X, released on XXXX-XX-XX:
* Windows is no longer actively supported.
* Certain legacy UNIX systems are no longer actively supported.
* The behaviour of the -s command line argument was changed:
To shuffle lines from standard input, the special file name "-" needs
to be provided.
Changes in 0.6.0, released on 2015-01-18:

View File

@ -23,7 +23,7 @@
.Ek
.Nm
.Bk -words
.Fl s
.Fl s Ar playlistFile
.Op Ar playlist
.Ek
.Sh DESCRIPTION
@ -53,13 +53,15 @@ Normalize metadata strings by removing excess whitespaces.
.It Fl q
Be more quiet.
Suppress the output that external programs send to standard error.
.It Fl s Op Ar playlist
.It Fl s Ar playlist
Run
.Nm
as a line-based shuffling utility.
If no
If a
.Ar playlist
argument is given, a list of media file names is read from standard input
argument of
.Dq -
is given, a list of media file names is read from standard input
instead of an input file.
After successfully reading the entire list, it is shuffled and printed to
standard output, and

View File

@ -1110,6 +1110,7 @@ main(int argc, char *argv[])
{
int c;
char *configFile = NULL;
char *playlistFile = NULL;
char *host = NULL;
unsigned short port = 0;
char *mount = NULL;
@ -1137,7 +1138,7 @@ main(int argc, char *argv[])
qFlag = 0;
vFlag = 0;
while ((c = getopt(argc, argv, "c:hmnqsVv")) != -1) {
while ((c = getopt(argc, argv, "c:hmnqs:Vv")) != -1) {
switch (c) {
case 'c':
if (configFile != NULL) {
@ -1162,6 +1163,12 @@ main(int argc, char *argv[])
break;
case 's':
sFlag = 1;
if (playlistFile != NULL) {
printf("Error: multiple -s arguments given\n");
usage();
return (ez_shutdown(2));
}
playlistFile = xstrdup(optarg);
break;
case 'V':
printf("%s\n", PACKAGE_STRING);
@ -1183,21 +1190,13 @@ main(int argc, char *argv[])
playlist_t *pl;
const char *entry;
switch (argc) {
case 0:
if (0 == strcmp(playlistFile, "-"))
pl = playlist_read(NULL);
if (pl == NULL)
return (ez_shutdown(1));
break;
case 1:
pl = playlist_read(argv[0]);
if (pl == NULL)
return (ez_shutdown(1));
break;
default:
printf("Error: Too many arguments.\n");
return (ez_shutdown(2));
}
else
pl = playlist_read(playlistFile);
if (pl == NULL)
return (ez_shutdown(1));
playlist_shuffle(pl);
while ((entry = playlist_get_next(pl)) != NULL)