aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/command.c198
1 files changed, 129 insertions, 69 deletions
diff --git a/src/command.c b/src/command.c
index a7e5b38fd..3ea46dfd4 100644
--- a/src/command.c
+++ b/src/command.c
@@ -233,18 +233,21 @@ static void addCommand(const char *name,
insertInList(commandList, cmd->cmd, cmd);
}
-static int handleUrlHandlers(int fd, int *permission, int argc, char *argv[])
+static int handleUrlHandlers(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return printRemoteUrlHandlers(fd);
}
-static int handleTagTypes(int fd, int *permission, int argc, char *argv[])
+static int handleTagTypes(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
printTagTypes(fd);
return 0;
}
-static int handlePlay(int fd, int *permission, int argc, char *argv[])
+static int handlePlay(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int song = -1;
@@ -253,7 +256,8 @@ static int handlePlay(int fd, int *permission, int argc, char *argv[])
return playPlaylist(fd, song, 0);
}
-static int handlePlayId(int fd, int *permission, int argc, char *argv[])
+static int handlePlayId(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int id = -1;
@@ -263,12 +267,14 @@ static int handlePlayId(int fd, int *permission, int argc, char *argv[])
return playPlaylistById(fd, id, 0);
}
-static int handleStop(int fd, int *permission, int argc, char *argv[])
+static int handleStop(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return stopPlaylist(fd);
}
-static int handleCurrentSong(int fd, int *permission, int argc, char *argv[])
+static int handleCurrentSong(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
int song = getPlaylistCurrentSong();
@@ -278,7 +284,8 @@ static int handleCurrentSong(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handlePause(int fd, int *permission, int argc, char *argv[])
+static int handlePause(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
if (argc == 2) {
int pause_flag;
@@ -289,7 +296,8 @@ static int handlePause(int fd, int *permission, int argc, char *argv[])
return playerPause(fd);
}
-static int commandStatus(int fd, int *permission, int argc, char *argv[])
+static int commandStatus(mpd_unused int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
const char *state = NULL;
int updateJobId;
@@ -351,17 +359,20 @@ static int commandStatus(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handleKill(int fd, int *permission, int argc, char *argv[])
+static int handleKill(mpd_unused int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return COMMAND_RETURN_KILL;
}
-static int handleClose(int fd, int *permission, int argc, char *argv[])
+static int handleClose(mpd_unused int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return COMMAND_RETURN_CLOSE;
}
-static int handleAdd(int fd, int *permission, int argc, char *argv[])
+static int handleAdd(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
char *path = argv[1];
@@ -371,7 +382,8 @@ static int handleAdd(int fd, int *permission, int argc, char *argv[])
return addAllIn(fd, path);
}
-static int handleAddId(int fd, int *permission, int argc, char *argv[])
+static int handleAddId(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int added_id;
int ret = addToPlaylist(fd, argv[1], &added_id);
@@ -393,7 +405,8 @@ static int handleAddId(int fd, int *permission, int argc, char *argv[])
return ret;
}
-static int handleDelete(int fd, int *permission, int argc, char *argv[])
+static int handleDelete(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int song;
@@ -402,7 +415,8 @@ static int handleDelete(int fd, int *permission, int argc, char *argv[])
return deleteFromPlaylist(fd, song);
}
-static int handleDeleteId(int fd, int *permission, int argc, char *argv[])
+static int handleDeleteId(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int id;
@@ -411,43 +425,50 @@ static int handleDeleteId(int fd, int *permission, int argc, char *argv[])
return deleteFromPlaylistById(fd, id);
}
-static int handlePlaylist(int fd, int *permission, int argc, char *argv[])
+static int handlePlaylist(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return showPlaylist(fd);
}
-static int handleShuffle(int fd, int *permission, int argc, char *argv[])
+static int handleShuffle(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return shufflePlaylist(fd);
}
-static int handleClear(int fd, int *permission, int argc, char *argv[])
+static int handleClear(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return clearPlaylist(fd);
}
-static int handleSave(int fd, int *permission, int argc, char *argv[])
+static int handleSave(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
return savePlaylist(fd, argv[1]);
}
-static int handleLoad(int fd, int *permission, int argc, char *argv[])
+static int handleLoad(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
return loadPlaylist(fd, argv[1]);
}
-static int handleListPlaylist(int fd, int *permission, int argc, char *argv[])
+static int handleListPlaylist(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
return PlaylistInfo(fd, argv[1], 0);
}
-static int handleListPlaylistInfo(int fd, int *permission,
- int argc, char *argv[])
+static int handleListPlaylistInfo(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
return PlaylistInfo(fd, argv[1], 1);
}
-static int handleLsInfo(int fd, int *permission, int argc, char *argv[])
+static int handleLsInfo(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
const char *path = "";
@@ -463,18 +484,20 @@ static int handleLsInfo(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handleRm(int fd, int *permission, int argc, char *argv[])
+static int handleRm(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
return deletePlaylist(fd, argv[1]);
}
-static int handleRename(int fd, int *permission, int argc, char *argv[])
+static int handleRename(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
return renameStoredPlaylist(fd, argv[1], argv[2]);
}
-static int handlePlaylistChanges(int fd, int *permission,
- int argc, char *argv[])
+static int handlePlaylistChanges(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
mpd_uint32 version;
@@ -483,8 +506,8 @@ static int handlePlaylistChanges(int fd, int *permission,
return playlistChanges(fd, version);
}
-static int handlePlaylistChangesPosId(int fd, int *permission,
- int argc, char *argv[])
+static int handlePlaylistChangesPosId(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
mpd_uint32 version;
@@ -493,7 +516,8 @@ static int handlePlaylistChangesPosId(int fd, int *permission,
return playlistChangesPosId(fd, version);
}
-static int handlePlaylistInfo(int fd, int *permission, int argc, char *argv[])
+static int handlePlaylistInfo(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int song = -1;
@@ -502,7 +526,8 @@ static int handlePlaylistInfo(int fd, int *permission, int argc, char *argv[])
return playlistInfo(fd, song);
}
-static int handlePlaylistId(int fd, int *permission, int argc, char *argv[])
+static int handlePlaylistId(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int id = -1;
@@ -511,7 +536,8 @@ static int handlePlaylistId(int fd, int *permission, int argc, char *argv[])
return playlistId(fd, id);
}
-static int handleFind(int fd, int *permission, int argc, char *argv[])
+static int handleFind(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int ret;
@@ -532,7 +558,8 @@ static int handleFind(int fd, int *permission, int argc, char *argv[])
return ret;
}
-static int handleSearch(int fd, int *permission, int argc, char *argv[])
+static int handleSearch(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int ret;
@@ -553,7 +580,8 @@ static int handleSearch(int fd, int *permission, int argc, char *argv[])
return ret;
}
-static int handleCount(int fd, int *permission, int argc, char *argv[])
+static int handleCount(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int ret;
@@ -574,7 +602,8 @@ static int handleCount(int fd, int *permission, int argc, char *argv[])
return ret;
}
-static int handlePlaylistFind(int fd, int *permission, int argc, char *argv[])
+static int handlePlaylistFind(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
LocateTagItem *items;
int numItems = newLocateTagItemArrayFromArgArray(argv + 1,
@@ -593,7 +622,8 @@ static int handlePlaylistFind(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handlePlaylistSearch(int fd, int *permission, int argc, char *argv[])
+static int handlePlaylistSearch(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
LocateTagItem *items;
int numItems = newLocateTagItemArrayFromArgArray(argv + 1,
@@ -612,7 +642,8 @@ static int handlePlaylistSearch(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handlePlaylistDelete(int fd, int *permission, int argc, char *argv[]) {
+static int handlePlaylistDelete(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[]) {
char *playlist = argv[1];
int from;
@@ -622,7 +653,8 @@ static int handlePlaylistDelete(int fd, int *permission, int argc, char *argv[])
return removeOneSongFromStoredPlaylistByPath(fd, playlist, from);
}
-static int handlePlaylistMove(int fd, int *permission, int argc, char *argv[])
+static int handlePlaylistMove(int fd, mpd_unused int *permission,
+ mpd_unused mpd_unused int argc, char *argv[])
{
char *playlist = argv[1];
int from, to;
@@ -636,8 +668,8 @@ static int handlePlaylistMove(int fd, int *permission, int argc, char *argv[])
}
static int listHandleUpdate(int fd,
- int *permission,
- int argc,
+ mpd_unused int *permission,
+ mpd_unused int argc,
char *argv[],
struct strnode *cmdnode, CommandEntry * cmd)
{
@@ -666,7 +698,8 @@ static int listHandleUpdate(int fd,
return 0;
}
-static int handleUpdate(int fd, int *permission, int argc, char *argv[])
+static int handleUpdate(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
if (argc == 2) {
int ret;
@@ -679,17 +712,20 @@ static int handleUpdate(int fd, int *permission, int argc, char *argv[])
return updateInit(fd, NULL);
}
-static int handleNext(int fd, int *permission, int argc, char *argv[])
+static int handleNext(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return nextSongInPlaylist(fd);
}
-static int handlePrevious(int fd, int *permission, int argc, char *argv[])
+static int handlePrevious(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return previousSongInPlaylist(fd);
}
-static int handleListAll(int fd, int *permission, int argc, char *argv[])
+static int handleListAll(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
char *directory = NULL;
@@ -698,7 +734,8 @@ static int handleListAll(int fd, int *permission, int argc, char *argv[])
return printAllIn(fd, directory);
}
-static int handleVolume(int fd, int *permission, int argc, char *argv[])
+static int handleVolume(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int change;
@@ -707,7 +744,8 @@ static int handleVolume(int fd, int *permission, int argc, char *argv[])
return changeVolumeLevel(fd, change, 1);
}
-static int handleSetVol(int fd, int *permission, int argc, char *argv[])
+static int handleSetVol(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int level;
@@ -716,7 +754,8 @@ static int handleSetVol(int fd, int *permission, int argc, char *argv[])
return changeVolumeLevel(fd, level, 0);
}
-static int handleRepeat(int fd, int *permission, int argc, char *argv[])
+static int handleRepeat(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int status;
@@ -725,7 +764,8 @@ static int handleRepeat(int fd, int *permission, int argc, char *argv[])
return setPlaylistRepeatStatus(fd, status);
}
-static int handleRandom(int fd, int *permission, int argc, char *argv[])
+static int handleRandom(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int status;
@@ -734,18 +774,21 @@ static int handleRandom(int fd, int *permission, int argc, char *argv[])
return setPlaylistRandomStatus(fd, status);
}
-static int handleStats(int fd, int *permission, int argc, char *argv[])
+static int handleStats(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return printStats(fd);
}
-static int handleClearError(int fd, int *permission, int argc, char *argv[])
+static int handleClearError(mpd_unused int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
clearPlayerError();
return 0;
}
-static int handleList(int fd, int *permission, int argc, char *argv[])
+static int handleList(int fd, mpd_unused int *permission,
+ int argc, char *argv[])
{
int numConditionals;
LocateTagItem *conditionals = NULL;
@@ -794,7 +837,8 @@ static int handleList(int fd, int *permission, int argc, char *argv[])
return ret;
}
-static int handleMove(int fd, int *permission, int argc, char *argv[])
+static int handleMove(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int from, to;
@@ -805,7 +849,8 @@ static int handleMove(int fd, int *permission, int argc, char *argv[])
return moveSongInPlaylist(fd, from, to);
}
-static int handleMoveId(int fd, int *permission, int argc, char *argv[])
+static int handleMoveId(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int id, to;
@@ -816,7 +861,8 @@ static int handleMoveId(int fd, int *permission, int argc, char *argv[])
return moveSongInPlaylistById(fd, id, to);
}
-static int handleSwap(int fd, int *permission, int argc, char *argv[])
+static int handleSwap(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int song1, song2;
@@ -827,7 +873,8 @@ static int handleSwap(int fd, int *permission, int argc, char *argv[])
return swapSongsInPlaylist(fd, song1, song2);
}
-static int handleSwapId(int fd, int *permission, int argc, char *argv[])
+static int handleSwapId(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int id1, id2;
@@ -838,7 +885,8 @@ static int handleSwapId(int fd, int *permission, int argc, char *argv[])
return swapSongsInPlaylistById(fd, id1, id2);
}
-static int handleSeek(int fd, int *permission, int argc, char *argv[])
+static int handleSeek(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int song, seek_time;
@@ -849,7 +897,8 @@ static int handleSeek(int fd, int *permission, int argc, char *argv[])
return seekSongInPlaylist(fd, song, seek_time);
}
-static int handleSeekId(int fd, int *permission, int argc, char *argv[])
+static int handleSeekId(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int id, seek_time;
@@ -860,7 +909,8 @@ static int handleSeekId(int fd, int *permission, int argc, char *argv[])
return seekSongInPlaylistById(fd, id, seek_time);
}
-static int handleListAllInfo(int fd, int *permission, int argc, char *argv[])
+static int handleListAllInfo(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
char *directory = NULL;
@@ -869,12 +919,14 @@ static int handleListAllInfo(int fd, int *permission, int argc, char *argv[])
return printInfoForAllIn(fd, directory);
}
-static int handlePing(int fd, int *permission, int argc, char *argv[])
+static int handlePing(mpd_unused int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
return 0;
}
-static int handlePassword(int fd, int *permission, int argc, char *argv[])
+static int handlePassword(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
if (getPermissionFromPassword(argv[1], permission) < 0) {
commandError(fd, ACK_ERROR_PASSWORD, "incorrect password");
@@ -884,7 +936,8 @@ static int handlePassword(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handleCrossfade(int fd, int *permission, int argc, char *argv[])
+static int handleCrossfade(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int xfade_time;
@@ -895,7 +948,8 @@ static int handleCrossfade(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handleEnableDevice(int fd, int *permission, int argc, char *argv[])
+static int handleEnableDevice(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int device;
@@ -904,7 +958,8 @@ static int handleEnableDevice(int fd, int *permission, int argc, char *argv[])
return enableAudioDevice(fd, device);
}
-static int handleDisableDevice(int fd, int *permission, int argc, char *argv[])
+static int handleDisableDevice(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
int device;
@@ -913,7 +968,8 @@ static int handleDisableDevice(int fd, int *permission, int argc, char *argv[])
return disableAudioDevice(fd, device);
}
-static int handleDevices(int fd, int *permission, int argc, char *argv[])
+static int handleDevices(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
printAudioDevices(fd);
@@ -921,7 +977,8 @@ static int handleDevices(int fd, int *permission, int argc, char *argv[])
}
/* don't be fooled, this is the command handler for "commands" command */
-static int handleCommands(int fd, int *permission, int argc, char *argv[])
+static int handleCommands(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
ListNode *node = commandList->firstNode;
CommandEntry *cmd;
@@ -938,7 +995,8 @@ static int handleCommands(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handleNotcommands(int fd, int *permission, int argc, char *argv[])
+static int handleNotcommands(int fd, mpd_unused int *permission,
+ mpd_unused int argc, mpd_unused char *argv[])
{
ListNode *node = commandList->firstNode;
CommandEntry *cmd;
@@ -956,12 +1014,14 @@ static int handleNotcommands(int fd, int *permission, int argc, char *argv[])
return 0;
}
-static int handlePlaylistClear(int fd, int *permission, int argc, char *argv[])
+static int handlePlaylistClear(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
return clearStoredPlaylist(fd, argv[1]);
}
-static int handlePlaylistAdd(int fd, int *permission, int argc, char *argv[])
+static int handlePlaylistAdd(int fd, mpd_unused int *permission,
+ mpd_unused int argc, char *argv[])
{
char *playlist = argv[1];
char *path = argv[2];
@@ -1135,7 +1195,7 @@ static CommandEntry *getCommandEntryFromString(char *string, int *permission)
return cmd;
}
-static int processCommandInternal(int fd, int *permission,
+static int processCommandInternal(int fd, mpd_unused int *permission,
char *commandString, struct strnode *cmdnode)
{
int argc;