Commit Graph

174 Commits

Author SHA1 Message Date
Max Kellermann
5609a1fcd0 command: pass struct client to all commands
Pass the client struct to CommandHandlerFunction and
CommandListHandlerFunction.  Most commands cannot take real advantage
of that yet, since most of them still work with the raw file
descriptor.
2008-09-07 13:52:48 +02:00
Max Kellermann
d2543f03f5 command: pass struct client to getCommandEntryAnd...()
Instead of passing the file descriptor, pass the client struct to
getCommandEntryAndCheckArgcAndPermission().
2008-09-07 13:52:36 +02:00
Max Kellermann
54371add13 command: added command_success() and command_error()
These two functions take a client struct instead of the file
descriptor.  We will now begin passing the client struct around
instead of a raw file descriptor (which needed a linear lookup in the
client list to be useful).
2008-09-07 13:51:59 +02:00
Max Kellermann
4ddc0a48e2 audio: don't pass "fd" to {en,dis}ableAudioDevice()
No protocol code in the audio output library.
2008-09-07 13:51:50 +02:00
Max Kellermann
f7e414d934 volume: don't pass "fd" to changeVolumeLevel()
The "volume" library shouldn't talk to the client.  Move error
handling to command.c.
2008-09-07 13:50:16 +02:00
Max Kellermann
8e3c40f032 directory: don't pass "fd" to updateInit()
Again, move error handling to command.c.
2008-09-07 13:50:06 +02:00
Max Kellermann
17b6491bcf directory: printDirectoryInfo() does not call commandError()
Move another ocurrence of error handling over to command.c.
2008-09-07 13:49:01 +02:00
Max Kellermann
f320c9fa1d directory: don't pass fd to traverseAllIn()
This patch continues the work of the previous patch: don't pass a file
descriptor at all to traverseAllIn().  Since this fd was only used to
report "directory not found" errors, we can easily move that check to
the caller.  This is a great relief, since it removes the dependency
on a client connection from a lot of enumeration functions.
2008-09-07 13:48:37 +02:00
Max Kellermann
d8ef33b710 playlist: PlaylistInfo() does not call commandError()
Continuing the effort of removing protocol specific calls from the
core libraries: let the command.c code call commandError() based on
PlaylistInfo's return value.
2008-09-07 13:44:20 +02:00
Max Kellermann
a8b225f947 playlist: don't pass "fd" to storedPlaylist.c functions
Return an "enum playlist_result" value instead of calling
commandError() in storedPlaylist.c.
2008-09-07 13:44:12 +02:00
Max Kellermann
8d2830b3f9 playlist: don't pass "fd" to playlist.c functions
The playlist library shouldn't talk to the client if possible.
Introduce the "enum playlist_result" type which the caller
(i.e. command.c) may use to generate an error message.
2008-09-07 13:39:31 +02:00
Max Kellermann
20feb0cbba playlist: showPlaylist() and shufflePlaylist() cannot fail
Make them both return void.
2008-09-07 13:39:19 +02:00
Max Kellermann
e1bf96672e playlist: moved "repeat" and "random" value checks to command.c
Client's input values should be validated by the command
implementation, and the core libraries shouldn't talk to the client
directly if possible.  Thus, setPlaylistRepeatStatus() and
setPlaylistRandomStatus() don't get the file descriptor, and cannot
fail (return void).
2008-09-07 13:38:59 +02:00
Max Kellermann
386c303121 tag: moved code to tag_print.c
Move everything which dumps a tag to a file descriptor to tag_print.c.
This relaxes dependencies and splits the code into smaller parts.
2008-09-07 13:28:01 +02:00
Max Kellermann
33aec0d673 client: added client_write() and client_puts()
client_write() writes a buffer to the client and buffers it if
required.  client_puts() does the same for a C string.  The next patch
will add more tools which will replace fdprintf() later.
2008-09-07 13:24:51 +02:00
Max Kellermann
a34e1d2b84 include cleanup
As usual, include only headers which are really needed.
2008-09-06 20:28:31 +02:00
Max Kellermann
91502cd71e tag: renamed functions, no CamelCase 2008-08-29 09:38:21 +02:00
Max Kellermann
8811c0e059 export the function client_is_expired()
Instead of passing the pointer to the "expired" flag to
processListOfCommands(), this function should use the client API to
check this flag.  We can now remove the "global_expired" hack
introduced recently.
2008-08-29 09:37:11 +02:00
Max Kellermann
8b1b82b363 client: pass the client struct to processCommand()
Start exporting the client struct as an opaque struct.  For now, pass
it only to processCommand() and processListOfCommands(), and provide a
function to extract the socket handle.  Later, we will propagate the
pointer to all command implementations, and of course to
client_print() etc.
2008-08-29 09:36:42 +02:00
Max Kellermann
1560a70b01 include cleanup
Only include headers which are really needed.
2008-08-28 20:01:08 +02:00
Max Kellermann
5e51fa020d renamed player.c to player_control.c
Give player.c a better name, meaning that the code is used to control
the player thread.
2008-08-26 08:44:38 +02:00
Max Kellermann
cff923b9d8 playlist: eliminate unused fd parameters
Again, remove file descriptor parameters, which are not actually
used.  These functions can also be converted to return void.
2008-08-26 08:27:16 +02:00
Max Kellermann
3db333b5a4 player: no "fd" and no return value
Most player*() functions do not actually use the file descriptor, and
always return 0 (success).  Eliminate them to get a leaner interface.
2008-08-26 08:27:16 +02:00
Max Kellermann
1b845f94a0 moved struct AudioFormat to audio_format.h
We want to expose the AudioFormat structure to plugins; remove some
clutter by moving its declaration to a separate header file.
2008-08-26 08:27:06 +02:00
Max Kellermann
a383f45117 enable -Wpointer-arith, -Wstrict-prototypes
Also enable -Wunused-parameter - this forces us to add the gcc
"unused" attribute to a lot of parameters (mostly library callback
functions), but it's worth it during code refactorizations.
2008-08-26 08:27:02 +02:00
Eric Wong
93fee6fc85 command.c: remove dead commented code
We have revision control for a reason :)

git-svn-id: https://svn.musicpd.org/mpd/trunk@7357 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-14 06:41:00 +00:00
Max Kellermann
c89b358c8a clean up CPP includes
Try to only include headers which are really needed.  We should
particularly check all "headers including other headers".  The
long-term goal is to have a manageable, small API for plugins
(decoders, output) without so many mpd internals cluttering the
namespace.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12 04:19:26 +00:00
Max Kellermann
c5b524e376 eliminated duplicate initialization
Local variables which are never read before the first assignment don't
need initialization.  Saves a few bytes of text.  Also don't reset
variables which are never read until function return.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7199 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26 10:37:36 +00:00
Max Kellermann
6fbdc721d9 fix -Wconst warnings
[ew: cleaned up the dirty union hack a bit]
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-02-05 10:17:33 +00:00
Eric Wong
688289b295 Revert the queue implementation and commands
It's too ugly and broken (both technically and usability-wise)
to be worth supporting in any stable release.

In one sentence: The queue is a very crippled version of the
playlist that takes precedence over the normal playlist.

How is it crippled?

* The "queueid" command only allows the queuing of songs
ALREADY IN THE PLAYLIST!  This promotes having the entire mpd
database of songs in the playlist, which is a stupid practice
to begin with.

* It doesn't allow for meaningful rearranging and movement
of songs within the queue.  To move a song, you'd need to
dequeue and requeue it (and other songs on the list).
Why?  The playlist already allows _all_ these features
and shows everything a client needs to know about the ordering
of songs in a _single_ command!

* Random was a stupid idea to begin with and unfortunately
we're stuck supporting it since we've always had it.  Users
should learn to use "shuffle" instead and not look at their
playlists.  Implementing queue because we have the problem of
random is just a bandage fix and digging ourselves a new hole.

This protocol addition was never in a stable release of mpd, so
reverting it will only break things for people following trunk;
which I'm not too worried about.  I am however worried about
long-term support of this misfeature, so I'm removing it.

Additionally, there are other points:

* It's trivially DoS-able:

(while true; do echo queueid $song_id; done) | nc $MPD_HOST $MPD_PORT

The above commands would cause the queue to become infinitely
expanding, taking up all available memory in the system.  The
mpd playlist was implemented as an array with a fixed (but
configurable) size limit for this reason.

* It's not backwards-compatible.  All clients would require
upgrades (and additional complexity) to even know what the
next song in the playlist is.  mpd is a shared architecture,
and we should not violate the principle of least astonishment
here.

This removes the following commands:
queueid, dequeue, queueinfo

Additionally, the status field of "playlistqueue: " is removed
from the status command.

While this DoS is trivial to fix, the design is simply too
broken to ever support in a real release.

The overloading of the "addid" command and the allowing of
negative numbers to be used as offsets is far more flexible.

This improved "addid" is completely backwards-compatible with
all clients, and does not require clients to have UI changes or
run additional commands to display the queue.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7155 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-26 20:21:07 +00:00
Eric Wong
9eee1a81cf command: allow "addid" command to take an optional second argument, position
This will allow "addid \"song_url\" <pos>" to atomically insert a
song at any given playlist position.

If the add succeeds, but the actual movement fails (due to
invalid position), then the song_id will be deleted before
the command returns back to the client, and the client
will get an error response.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7151 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-26 12:46:56 +00:00
Eric Wong
2889b576eb command: cleanup integer argument validation for commands
git-svn-id: https://svn.musicpd.org/mpd/trunk@7150 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-26 12:46:53 +00:00
Eric Wong
2f0e5bfd85 addToPlaylist/addSongToPlaylist: printId argument changed to added_id
Instead of printing out the Id from playlist.c, instead set
the integer that added_id poitns to if added_id is non-NULL.

This makes the API cleaner and will allow us to use additional
commands to manipulate the newly-added song_id.  Callers
(handleAddId) that relied on printId to print it to the given
fd have now been modified to print the ID at a higher-level;
making playlist.c less-dependent on protocol details.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7149 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-26 12:46:49 +00:00
Max Kellermann
07adb14e3c fixed -Wshadow warnings
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-26 12:46:21 +00:00
Eric Wong
cb8f1af3bd Cleanup #includes of standard system headers and put them in one place
This will make refactoring features easier, especially now that
pthreads support and larger refactorings are on the horizon.

Hopefully, this will make porting to other platforms (even
non-UNIX-like ones for masochists) easier, too.

os_compat.h will house all the #includes for system headers
considered to be the "core" of MPD.  Headers for optional
features will be left to individual source files.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03 07:29:49 +00:00
Qball Cow
cb9d1b3d27 Playlist queue patch (http://musicpd.org/mantis/view.php?id=1478) version 11.
This adds the following commands:
* queueid <id>		Add song <id> to the queue.
* dequeue <pos>		Remove song from <pos> from the queue
* queueinfo			List the queue

To the statusfield it adds the following entry:
playlistqueue:	<uid>		UID can be used by clients to track changes in the playlist queue.



git-svn-id: https://svn.musicpd.org/mpd/trunk@6927 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-09-26 08:25:35 +00:00
J. Alexander Treuman
7ba357a04e Adding rename command, for renaming stored playlists.
git-svn-id: https://svn.musicpd.org/mpd/trunk@6246 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-24 18:07:19 +00:00
J. Alexander Treuman
c408bd5e90 Don't list playlists in lsinfo if the path isn't the root directory (they
can't be loaded anyway).

git-svn-id: https://svn.musicpd.org/mpd/trunk@6244 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-24 17:06:59 +00:00
J. Alexander Treuman
6cfe421cd6 Committing pat's rewrite of the stored playlist code. This also adds two
new commands: playlistmove and playlistdelete.

git-svn-id: https://svn.musicpd.org/mpd/trunk@6116 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-16 12:02:10 +00:00
J. Alexander Treuman
7a8a9c10e1 Adding count command. It's usage is identical to find, but instead of
returning a list of matching songs, the number of results and total play
time of the results are returned.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5950 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-25 23:46:11 +00:00
J. Alexander Treuman
7dadabca8a When calling commandError(STDERR_FILENO, ...), don't set current_command to
NULL.  Doing so would mean future calls to commandError with a socket as an
argument will still write the error message to the error log, and not the
socket.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5891 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-08 15:41:38 +00:00
J. Alexander Treuman
74e75378ae If current_command is NULL when calling commandError, print the error
message and trailing new line to STDERR_FILENO along with the ACK, instead
of sending them over the socket.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5890 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-08 15:26:48 +00:00
Avuton Olrich
a061da8fb5 The massive copyright update
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05 03:22:33 +00:00
J. Alexander Treuman
e3e4964f59 Adding tagtypes command to list available tag types (takes metadata_to_use
into account).

git-svn-id: https://svn.musicpd.org/mpd/trunk@5792 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-03-31 18:43:16 +00:00
J. Alexander Treuman
6e64bac7b6 Adding playlistfind and playlistsearch commands for searching the current
playlist.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5420 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-24 02:00:03 +00:00
Eric Wong
b443363aa6 Don't initialize globals to zero (or NULL)
Some compilers and linkers aren't smart enough to optimize this,
as global variables are implictly initialized to zero.  As a
result, binaries are a bit smaller as more goes in the .bss and
less in the text section.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14 03:07:53 +00:00
J. Alexander Treuman
4479ece74d Making "list any" fail with an error instead of OK with no results.
git-svn-id: https://svn.musicpd.org/mpd/trunk@5139 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-12-11 20:18:04 +00:00
J. Alexander Treuman
ec45950b36 Oops, forgot to add an interface to stored playlist editing. Here it is.
git-svn-id: https://svn.musicpd.org/mpd/trunk@5128 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-12-07 14:41:40 +00:00
Warren Dukes
e198826606 put back np's supperrior buffer2array, and fix my bug fix from change 4872
git-svn-id: https://svn.musicpd.org/mpd/trunk@4875 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-06 10:33:27 +00:00
Eric Wong
e3222d807a Revert buffer2array() behavior back to tried and true 0.11.x version
Warren's fix in r4872 made phpMp work again, but also broke
the unit tests completely (they work in this version).

The version in 0.12.0 is far too buggy (it was from mpd-ke, what
do you expect?).  This one passes all the unit tests that the
mpd-ke one passed, and should also work with phpMp when used
with PHP magic quotes.

This also means we can search on 100 (or more) tags at once, so
no more arbitrary limits other than system memory.

To run the unit tests, just do this:
gcc -o t -DUNIT_TEST=1 src/buffer2array.c && ./t && echo OK

git-svn-id: https://svn.musicpd.org/mpd/trunk@4874 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-10-06 08:54:43 +00:00
Eric Wong
90847fc881 Replace strdup and {c,re,m}alloc with x* variants to check for OOM errors
I'm checking for zero-size allocations and assert()-ing them,
so we can more easily get backtraces and debug problems, but we'll
also allow -DNDEBUG people to live on the edge if they wish.

We do not rely on errno when checking for OOM errors because
some implementations of malloc do not set it, and malloc
is commonly overridden by userspace wrappers.

I've spent some time looking through the source and didn't find any
obvious places where we would explicitly allocate 0 bytes, so we
shouldn't trip any of those assertions.

We also avoid allocating zero bytes because C libraries don't
handle this consistently (some return NULL, some not); and it's
dangerous either way.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26 06:25:57 +00:00
Eric Wong
45f28394c0 command.c: rerun mpd-indent.sh, no code changes
leave out initCommands to keep jat happy, and keep labels
at the left hand side

git-svn-id: https://svn.musicpd.org/mpd/trunk@4687 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26 06:25:44 +00:00
Avuton Olrich
f79a70d1b9 Fix warnings for -Wmissing-prototypes
Add -Wmissing-prototypes if compiling with gcc
Static where possible

git-svn-id: https://svn.musicpd.org/mpd/trunk@4657 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-20 00:50:44 +00:00
Eric Wong
5f1e53e887 command: static-fication since commandError is no longer a macro
git-svn-id: https://svn.musicpd.org/mpd/trunk@4593 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 20:06:46 +00:00
J. Alexander Treuman
7f4f3010a5 Add PERMISSION_NONE define, for commands that require no permission
git-svn-id: https://svn.musicpd.org/mpd/trunk@4583 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 15:48:16 +00:00
J. Alexander Treuman
7c9d3c4186 Reformatting initCommands and fillBuffer
git-svn-id: https://svn.musicpd.org/mpd/trunk@4582 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 15:46:35 +00:00
Warren Dukes
b9f13d568a remove overzealous asserts (wait for np to clean up his COMMAND_MAX_ARGS stuff)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4575 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 14:41:11 +00:00
Warren Dukes
8e53406774 renamce cstrtok to buffer2array. please don't rename functions; especially to names that look extremely std-lib-ish. also, don't use isspace, apparently it's local dependent and potentially consideres ' ' or '\t' not to be a space, or considers other characters to be a space.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4574 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 13:53:53 +00:00
Eric Wong
a80168a15b gcc signedness and sparse fixes
git-svn-id: https://svn.musicpd.org/mpd/trunk@4489 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 08:56:55 +00:00
Eric Wong
e86fd65c81 commandError() cleanups, fixup gcc checks
stripped binary size reduced by 9k on my machine from making
commandError a function.  We'll print out error messages slightly
slower before, but the smaller binary is more than worth it.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4488 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 08:47:50 +00:00
Eric Wong
b38c3fa1bb command: fix find/search commands from the malloc reduction patch
The most we ever use is for search/find, and that limits it to the
number of tags we can have.  Add one for the command, and one extra
to catch errors clients may send us.

Thanks to Qball for reporting this bug

git-svn-id: https://svn.musicpd.org/mpd/trunk@4486 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 05:00:56 +00:00
Eric Wong
4cf5d04ca1 interface/connection malloc reductions from mpd-ke
This patch massively reduces the amount of heap allocations at
the interface/command layer.  Most commands with minimal output
should not allocate memory from the heap at all.  Things like
repeatedly polling status, currentsong, and volume changes
should be faster as a result, and more importantly, not a source
of memory fragmentation.

These changes should be safe in that there's no way for a
remote-client to corrupt memory or otherwise do bad stuff to
MPD, but an extra set of eyes to review would be good.  Of
course there's never any warranty :)

No longer do we use FILE * structures in the interface, which means
we don't have to allocate any new memory for most connections.

Now, before you go on about losing the buffering that FILE *
+implies+, remember that myfprintf() never took advantage of
any of the stdio buffering features.

To reduce the diff and make bugs easier to spot in the diff,
I've kept myfprintf in places where we write to files (and not
network interfaces).  Expect myfprintf to go away entirely soon
(we'll use fprintf for writing regular files).

git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 03:43:38 +00:00
Eric Wong
f08342c11f replace buffer2array() with cstrtok() from mpd-ke
This modifies the string in place, and does not allocate any memory from
the heap.  This is considerably smaller than the function it replaces,
and will be instrumental in getting the commands/conf malloc reductions
done.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4481 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-29 18:55:00 +00:00
Eric Wong
f05166a6a0 command.c: shorten common variable names to argc and argv
Any C programmer with half a clue knows they mean argArrayLength
and argArray, and I find the code much easier to read and work with.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4480 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-29 18:54:56 +00:00
Avuton Olrich
29a25b9933 Add mpd-indent.sh
Indent the entire tree, hopefully we can keep
it indented.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20 16:02:40 +00:00
Warren Dukes
0bf396d610 some quick hacks to avoid signedness warnings with gcc4
git-svn-id: https://svn.musicpd.org/mpd/trunk@4387 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-17 21:46:32 +00:00
Eric Wong
a234780aab sparse: ANSI-fy function declarations
These are just warnings from sparse, but it makes the output
easier to read.  I ran this through a quick perl script, but
of course verified the output by looking at the diff and making
sure the thing still compiles.

here's the quick perl script I wrote to generate this patch:
----------- 8< -----------
use Tie::File;
defined(my $pid = open my $fh, '-|') or die $!;
if (!$pid) {
open STDERR, '>&STDOUT' or die $!;
exec 'sparse', @ARGV or die $!;
}
my $na = 'warning: non-ANSI function declaration of function';
while (<$fh>) {
print STDERR $_;
if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) {
my ($f, $l, $pos, $func) = ($1, $2, $3, $4);
$l--;
tie my @x, 'Tie::File', $f or die "$!: $f";
print '-', $x[$l], "\n";
$x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/;
print '+', $x[$l], "\n";
untie @x;
}
}

git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-17 00:15:34 +00:00
Eric Wong
5070f8bc78 command.c: fix a format-string error (go sparse!)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4356 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-15 13:58:02 +00:00
J. Alexander Treuman
2fa7125cce Change shank's email address
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 19:37:45 +00:00
Avuton Olrich
e39289a987 [CLEANUP] Remove unnecessary includes, static
functions that don't need to be exported, rename
misspelled function

git-svn-id: https://svn.musicpd.org/mpd/trunk@4325 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14 18:47:55 +00:00
Avuton Olrich
a37348a74f Huge header update, update the copyright and add
the GPL header where necessary

git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13 19:20:34 +00:00
Qball Cow
751368f257 outputs now only needs read permission
git-svn-id: https://svn.musicpd.org/mpd/trunk@4127 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-04-27 22:28:26 +00:00
Qball Cow
5416d00bcd Adding of plchangesposid command, this is a stripped down version of the plchanges command, it only sends the pos and id of the changed command. Libmpd allready has support for it, and libmpdclient in libmpd too
git-svn-id: https://svn.musicpd.org/mpd/trunk@4101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-04-23 11:10:41 +00:00
Eric Wong
10afe91c64 src/command.c: protocol commands are all lowercase, _always_
git-svn-id: https://svn.musicpd.org/mpd/trunk@3950 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-26 17:43:52 +00:00
Qball Cow
09929b6f82 Support for fetching the content of a stored playlist (patch by qball), this adds listPlaylist and listPlaylistInfo
git-svn-id: https://svn.musicpd.org/mpd/trunk@3947 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-26 13:46:05 +00:00
Eric Wong
97e355e362 command.c: remove unnecessary strdup()
git-svn-id: https://svn.musicpd.org/mpd/trunk@3924 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-16 06:41:45 +00:00
Warren Dukes
536c97f0bc fix addid crash ( found by qball )
git-svn-id: https://svn.musicpd.org/mpd/trunk@3805 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-01-07 03:26:12 +00:00
Qball Cow
6723e65cdf Fix AddId handler, It tried to add the first argument instead of the 2nd. Resulting it tries to add "addid"
git-svn-id: https://svn.musicpd.org/mpd/trunk@3427 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-08-07 18:47:49 +00:00
Warren Dukes
986a0ffc24 fix spelling error
git-svn-id: https://svn.musicpd.org/mpd/trunk@3245 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-05-07 00:46:44 +00:00
Warren Dukes
6db819cefe 'add' command now requires one argument
git-svn-id: https://svn.musicpd.org/mpd/trunk@3236 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-05-03 02:35:19 +00:00
Warren Dukes
d4352ac996 undo change 3081
git-svn-id: https://svn.musicpd.org/mpd/trunk@3085 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-15 23:18:23 +00:00
Avuton Olrich
593e1343da - Add 'mute' command for testing
- Revamp AUTHORS file

git-svn-id: https://svn.musicpd.org/mpd/trunk@3081 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-14 02:35:46 +00:00
Warren Dukes
23eef1f732 fix logic for commands and notcommands for real this time
git-svn-id: https://svn.musicpd.org/mpd/trunk@2740 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-23 20:54:20 +00:00
Warren Dukes
e034e2889c fix a little logic bomb in commands && notcommands
git-svn-id: https://svn.musicpd.org/mpd/trunk@2739 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-23 19:48:34 +00:00
Warren Dukes
498fe12702 added "notcommands" command
git-svn-id: https://svn.musicpd.org/mpd/trunk@2738 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-23 19:46:33 +00:00
Warren Dukes
86afc13c7e optimized read() on clients, should be much, much faster now
git-svn-id: https://svn.musicpd.org/mpd/trunk@2649 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-14 05:38:49 +00:00
Warren Dukes
4735ddce40 correct a type in the error message
git-svn-id: https://svn.musicpd.org/mpd/trunk@2625 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-12 01:47:52 +00:00
Warren Dukes
1f118ea90d now more flexible list, search, find, where you can enter pairs of
"conditionals".  Note that logical and is implied.

git-svn-id: https://svn.musicpd.org/mpd/trunk@2624 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-12 01:44:27 +00:00
Warren Dukes
d6a87f538d ok, now song->url is only the filename, not the full path to the song
git-svn-id: https://svn.musicpd.org/mpd/trunk@2602 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-11 02:59:16 +00:00
Warren Dukes
c5d27d8eaa merge changes from metadata-rewrite branch
git-svn-id: https://svn.musicpd.org/mpd/trunk@2589 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-10 21:58:27 +00:00
Warren Dukes
b3f3f35f99 new command "commands" for avuton
git-svn-id: https://svn.musicpd.org/mpd/trunk@2547 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-08 18:01:36 +00:00
Warren Dukes
f468aba16e new command "addid", this is the same as "add" command, except it also returns the songid of the added song. Note that "addid" does not work on directories
git-svn-id: https://svn.musicpd.org/mpd/trunk@2487 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02 23:44:33 +00:00
Warren Dukes
78c5d884d2 new command "devices", prints devices and their states
git-svn-id: https://svn.musicpd.org/mpd/trunk@2486 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02 23:08:00 +00:00
Warren Dukes
44eb26c16f new commands: enalbe_device, and disable_device, (maybe these commands should be toggles instead of two seperate commands?)
also, on close device, close the shout connection

git-svn-id: https://svn.musicpd.org/mpd/trunk@2485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02 22:13:58 +00:00
Warren Dukes
3af870a14c fix playlistid command so it can take an argument
git-svn-id: https://svn.musicpd.org/mpd/trunk@1575 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-19 23:59:26 +00:00
Warren Dukes
80dd76db7f fix C99 stuff for commandError
also some slight optimizations to interfacePrintWithFD() and myfprintf()

git-svn-id: https://svn.musicpd.org/mpd/trunk@1503 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-15 18:06:21 +00:00
Warren Dukes
c024bca2d6 make swapid and deleteid actually work
git-svn-id: https://svn.musicpd.org/mpd/trunk@1461 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-13 13:05:19 +00:00
Warren Dukes
593cf2ac86 make seekid actually work
git-svn-id: https://svn.musicpd.org/mpd/trunk@1460 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-13 13:03:37 +00:00
Warren Dukes
edbe24e2f7 make playid actually work
git-svn-id: https://svn.musicpd.org/mpd/trunk@1459 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-13 13:02:00 +00:00
Warren Dukes
21703b5edc change 'current' command to 'currentsong'
git-svn-id: https://svn.musicpd.org/mpd/trunk@1447 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-12 13:30:16 +00:00