[Musicpd-dev-team] [PATCH 1/1] Added the 'single' command

2009-03-29 Thread Romain Bignon
It also removes some trailing spaces...

Signed-off-by: Romain Bignon rom...@peerfuse.org
---
 doc/mpc-bashrc |8 
 doc/mpc.1  |7 +--
 src/command.c  |   42 --
 src/command.h  |3 ++-
 src/libmpdclient.c |   14 +-
 src/libmpdclient.h |4 
 src/main.c |3 ++-
 src/status.c   |   16 ++--
 8 files changed, 72 insertions(+), 25 deletions(-)

diff --git a/doc/mpc-bashrc b/doc/mpc-bashrc
index 946c85a..07f2580 100644
--- a/doc/mpc-bashrc
+++ b/doc/mpc-bashrc
@@ -9,13 +9,13 @@
cur=${COMP_WORDS[COMP_CWORD]}
first=${COMP_WORDS[1]}
hold=;
-   
+
# add more escape stuff as it's needed
# because bash is a woman:
scrub=s/\([()\;\`']\)/\\\1/g;
-   
+
case $first in
-   add) 
+   add)
hold=`mpc tab ${cur} | sed $scrub`;
COMPREPLY=($(compgen -W ${hold}))
return 0
@@ -57,7 +57,7 @@
COMPREPLY=($(compgen -W ${hold} | sed $scrub))
return 0
;;
-   repeat|random)
+   repeat|random|single)
COMPREPLY=($(compgen -W 0 1 true false yes no on off 
${cur}))
return 0
;;
diff --git a/doc/mpc.1 b/doc/mpc.1
index dd5d88b..77740a5 100644
--- a/doc/mpc.1
+++ b/doc/mpc.1
@@ -34,7 +34,7 @@ This command also takes the following defined escape 
sequences:
 .br
 Prevents the current song status from being printed on completion of some of
 the commands.
-.SH COMMANDS 
+.SH COMMANDS
 .TP
 .B add file
 Adds a song from the music database to the playlist. Can also read input from 
pipes. Use mpc ls | mpc add to add all files to the playlist.
@@ -71,7 +71,7 @@ Lists all files/folders in directory. If no directory is 
specified, lists al
 .TP
 .B lsplaylists
 Lists available playlists.
-.TP 
+.TP
 .B move from to
 Moves song at position from to the position to in the playlist.
 .TP
@@ -99,6 +99,9 @@ Toggle random mode if state (on or off) is not specified.
 .B repeat on|off
 Toggle repeat mode if state (on or off) is not specified.
 .TP
+.B single on|off
+Toggle single mode if state (on or off) is not specified.
+.TP
 .B rm file
 Deletes a specific playlist.
 .TP
diff --git a/src/command.c b/src/command.c
index 2f40aa6..1cdef39 100644
--- a/src/command.c
+++ b/src/command.c
@@ -4,7 +4,7 @@
Daniel Brown d...@cs.utexas.edu
  * Copyright (C) 2008-2009 Max Kellermann m...@duempel.org
  * Project homepage: http://musicpd.org
- 
+
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -84,7 +84,7 @@ static mpd_Status * getStatus(mpd_Connection * conn) {
return ret;
 }
 
-int cmd_add (int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_add (int argc, char ** argv, mpd_Connection * conn )
 {
int i;
 
@@ -136,7 +136,7 @@ cmd_crop(mpd_unused int argc, mpd_unused char **argv, 
mpd_Connection *conn)
 
} else {
 
-   mpd_freeStatus(status); 
+   mpd_freeStatus(status);
DIE( You need to be playing to crop the playlist\n );
 
}
@@ -579,7 +579,7 @@ int cmd_listall ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-int cmd_update ( int argc, char ** argv, mpd_Connection * conn) 
+int cmd_update ( int argc, char ** argv, mpd_Connection * conn)
 {
const char * update = ;
int i = 0;
@@ -705,7 +705,7 @@ int cmd_load ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-static int do_search ( int argc, char ** argv, mpd_Connection * conn, int 
exact ) 
+static int do_search ( int argc, char ** argv, mpd_Connection * conn, int 
exact )
 {
Constraint *constraints;
int numconstraints;
@@ -737,17 +737,17 @@ static int do_search ( int argc, char ** argv, 
mpd_Connection * conn, int exact
return 0;
 }
 
-int cmd_search ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_search ( int argc, char ** argv, mpd_Connection * conn )
 {
return do_search(argc, argv, conn, 0);
 }
 
-int cmd_find ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_find ( int argc, char ** argv, mpd_Connection * conn )
 {
return do_search(argc, argv, conn, 1);
 }
 
-int cmd_list ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_list ( int argc, char ** argv, mpd_Connection * conn )
 {
Constraint *constraints;
int numconstraints = 0;
@@ -798,7 +798,7 @@ int cmd_list ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-int cmd_volume ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_volume ( int argc, char ** argv, mpd_Connection * conn )
 {
 struct int_value_change ch;
 
@@ -819,7 

[Musicpd-dev-team] [PATCH 1/1] Added the 'single' command

2009-03-29 Thread Romain Bignon
It also removes some trailing spaces...

Signed-off-by: Romain Bignon rom...@peerfuse.org
---
 doc/mpc-bashrc |8 
 doc/mpc.1  |7 +--
 src/command.c  |   42 --
 src/command.h  |3 ++-
 src/libmpdclient.c |   14 +-
 src/libmpdclient.h |4 
 src/main.c |3 ++-
 src/status.c   |   16 ++--
 8 files changed, 72 insertions(+), 25 deletions(-)

diff --git a/doc/mpc-bashrc b/doc/mpc-bashrc
index 946c85a..07f2580 100644
--- a/doc/mpc-bashrc
+++ b/doc/mpc-bashrc
@@ -9,13 +9,13 @@
cur=${COMP_WORDS[COMP_CWORD]}
first=${COMP_WORDS[1]}
hold=;
-   
+
# add more escape stuff as it's needed
# because bash is a woman:
scrub=s/\([()\;\`']\)/\\\1/g;
-   
+
case $first in
-   add) 
+   add)
hold=`mpc tab ${cur} | sed $scrub`;
COMPREPLY=($(compgen -W ${hold}))
return 0
@@ -57,7 +57,7 @@
COMPREPLY=($(compgen -W ${hold} | sed $scrub))
return 0
;;
-   repeat|random)
+   repeat|random|single)
COMPREPLY=($(compgen -W 0 1 true false yes no on off 
${cur}))
return 0
;;
diff --git a/doc/mpc.1 b/doc/mpc.1
index dd5d88b..77740a5 100644
--- a/doc/mpc.1
+++ b/doc/mpc.1
@@ -34,7 +34,7 @@ This command also takes the following defined escape 
sequences:
 .br
 Prevents the current song status from being printed on completion of some of
 the commands.
-.SH COMMANDS 
+.SH COMMANDS
 .TP
 .B add file
 Adds a song from the music database to the playlist. Can also read input from 
pipes. Use mpc ls | mpc add to add all files to the playlist.
@@ -71,7 +71,7 @@ Lists all files/folders in directory. If no directory is 
specified, lists al
 .TP
 .B lsplaylists
 Lists available playlists.
-.TP 
+.TP
 .B move from to
 Moves song at position from to the position to in the playlist.
 .TP
@@ -99,6 +99,9 @@ Toggle random mode if state (on or off) is not specified.
 .B repeat on|off
 Toggle repeat mode if state (on or off) is not specified.
 .TP
+.B single on|off
+Toggle single mode if state (on or off) is not specified.
+.TP
 .B rm file
 Deletes a specific playlist.
 .TP
diff --git a/src/command.c b/src/command.c
index 2f40aa6..1cdef39 100644
--- a/src/command.c
+++ b/src/command.c
@@ -4,7 +4,7 @@
Daniel Brown d...@cs.utexas.edu
  * Copyright (C) 2008-2009 Max Kellermann m...@duempel.org
  * Project homepage: http://musicpd.org
- 
+
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -84,7 +84,7 @@ static mpd_Status * getStatus(mpd_Connection * conn) {
return ret;
 }
 
-int cmd_add (int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_add (int argc, char ** argv, mpd_Connection * conn )
 {
int i;
 
@@ -136,7 +136,7 @@ cmd_crop(mpd_unused int argc, mpd_unused char **argv, 
mpd_Connection *conn)
 
} else {
 
-   mpd_freeStatus(status); 
+   mpd_freeStatus(status);
DIE( You need to be playing to crop the playlist\n );
 
}
@@ -579,7 +579,7 @@ int cmd_listall ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-int cmd_update ( int argc, char ** argv, mpd_Connection * conn) 
+int cmd_update ( int argc, char ** argv, mpd_Connection * conn)
 {
const char * update = ;
int i = 0;
@@ -705,7 +705,7 @@ int cmd_load ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-static int do_search ( int argc, char ** argv, mpd_Connection * conn, int 
exact ) 
+static int do_search ( int argc, char ** argv, mpd_Connection * conn, int 
exact )
 {
Constraint *constraints;
int numconstraints;
@@ -737,17 +737,17 @@ static int do_search ( int argc, char ** argv, 
mpd_Connection * conn, int exact
return 0;
 }
 
-int cmd_search ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_search ( int argc, char ** argv, mpd_Connection * conn )
 {
return do_search(argc, argv, conn, 0);
 }
 
-int cmd_find ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_find ( int argc, char ** argv, mpd_Connection * conn )
 {
return do_search(argc, argv, conn, 1);
 }
 
-int cmd_list ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_list ( int argc, char ** argv, mpd_Connection * conn )
 {
Constraint *constraints;
int numconstraints = 0;
@@ -798,7 +798,7 @@ int cmd_list ( int argc, char ** argv, mpd_Connection * 
conn )
return 0;
 }
 
-int cmd_volume ( int argc, char ** argv, mpd_Connection * conn ) 
+int cmd_volume ( int argc, char ** argv, mpd_Connection * conn )
 {
 struct int_value_change ch;
 
@@ -819,7