pass through indent and then clean up after some of indent's insanity

This commit is contained in:
Bill Currie 2001-10-05 20:29:55 +00:00
parent aa5c52db35
commit 042a036964

View file

@ -72,12 +72,14 @@ static plugin_data_t plugin_info_data;
static plugin_funcs_t plugin_info_funcs;
static general_data_t plugin_info_general_data;
static general_funcs_t plugin_info_general_funcs;
//static cd_data_t plugin_info_cd_data;
static cd_funcs_t plugin_info_cd_funcs;
static char *xmms_cmd = "xmms";
static char *xmms_arg = " "; // Please tell me if i am being dumb
static char *xmms_args[1];
// this appears to be the only way to get this thingy _not_ to segfault on
// execvp, :/ xmms_args[0] = xmms_arg; is further down
@ -88,6 +90,7 @@ static char *xmms_args[1];
static qboolean playing = false;
// no idea why i have wasPlaying, prolly cos this code was based on
// cd_linux.c :/
static qboolean wasPlaying = false;
@ -114,10 +117,11 @@ I_XMMS_Running (void)
if (!xmms_remote_is_running (0)) {
// this method is used over a system() call, so that we know child's pid
// (not that is partic important) but so we can close(net_socket)
// this method is used over a system() call, so that we know child's
// pid (not that is particularly important) but so we can close
// unneeded descriptors
res = fork(); // fork
res = fork ();
switch (res) {
@ -130,17 +134,20 @@ I_XMMS_Running (void)
close (i);
// run xmms
if(execvp(xmms_cmd, xmms_args)) { // Oh dear
// can we even use Sys_DPrinf ?, we are child so
// we have access to them ? but wouldn't it just try rendering it
if (execvp (xmms_cmd, xmms_args)) {
// Oh dear, can we even use Sys_DPrinf ?, we are child so
// we have access to them ? but wouldn't it just try
// rendering it
// and screw stuff up ? better not find out
exit(1); // Well, we can't just hang about causing trouble can we ?
exit (1); // Well, we can't just hang about
// causing trouble can we ?
}
break;
case -1: // ICH !
Sys_DPrintf("XMMSAudio: error, can't fork !?\n"); // inform user
// inform user
Sys_DPrintf ("XMMSAudio: error, can't fork !?\n");
break;
default: // Parent
// don't need now :/
@ -161,9 +168,12 @@ static void
I_XMMS_Stop (void) // stop playing
{
if(!musEnabled) return; // don't try if "xmms off" has been called
// don't try if "xmms off" has been called
if (!musEnabled)
return;
I_XMMS_Running ();
if(!xmms_remote_is_playing(0)) return; // check that its actually playing
if (!xmms_remote_is_playing (0))
return; // check that its actually playing
xmms_remote_stop (0); // stop it
@ -172,18 +182,21 @@ I_XMMS_Stop (void) // stop playing
return;
}
static void // Play, don't use track and looping atm, :/
// Play, don't use track and looping atm, :/
static void
I_XMMS_Play (byte track, qboolean looping)
{
if(!musEnabled) return; // don't try if "xmms off" has been called
// don't try if "xmms off" has been called
if (!musEnabled)
return;
I_XMMS_Running (); // Check its on
/* i think this will fix some wierdness */
if (xmms_remote_is_paused (0)) {
xmms_remote_pause (0);
return;
}
if(xmms_remote_is_playing(0)) return;
if (xmms_remote_is_playing (0))
return;
xmms_remote_play (0);
@ -195,10 +208,12 @@ I_XMMS_Play (byte track, qboolean looping)
static void
I_XMMS_Pause (void)
{
if(!musEnabled) return; // don't try if "xmms off" has been called
// don't try if "xmms off" has been called
if (!musEnabled)
return;
I_XMMS_Running (); // It runnin ?
if(!xmms_remote_is_playing(0)) return;
if (!xmms_remote_is_playing (0))
return;
xmms_remote_pause (0);
@ -212,14 +227,17 @@ static void
I_XMMS_Resume (void)
{
if(!musEnabled) return; // don't try if "xmms off" has been called
// don't try if "xmms off" has been called
if (!musEnabled)
return;
I_XMMS_Running (); // Is it on ? if not, make it so
/* i think this will fix some wierdness */
if (xmms_remote_is_paused (0)) {
xmms_remote_pause (0);
return;
}
if(xmms_remote_is_playing(0)) return;
if (xmms_remote_is_playing (0))
return;
xmms_remote_play (0);
@ -231,7 +249,9 @@ I_XMMS_Resume (void)
static void
I_XMMS_Prev (void)
{
if(!musEnabled) return; // don't try if "xmms off" has been called
// don't try if "xmms off" has been called
if (!musEnabled)
return;
I_XMMS_Running (); // Running ?
xmms_remote_playlist_prev (0);
@ -243,7 +263,9 @@ I_XMMS_Prev (void)
static void
I_XMMS_Next (void)
{
if(!musEnabled) return; // don't try if "xmms off" has been called
// don't try if "xmms off" has been called
if (!musEnabled)
return;
I_XMMS_Running (); // Running or not ?
xmms_remote_playlist_next (0);
@ -264,8 +286,7 @@ I_XMMS_Init (void)
{
xmms_args[0] = xmms_arg;
I_XMMS_Running ();
Cmd_AddCommand (
"xmms", I_XMMS_f, "Control the XMMS player.\n"
Cmd_AddCommand ("xmms", I_XMMS_f, "Control the XMMS player.\n"
"Commands:\n"
"resume - Will resume playback after pause.\n"
"off - Stops control and playback of XMMS.\n"
@ -323,13 +344,18 @@ I_XMMS_Shuffle (void)
// SO, we check before, and assuming it works, we know that it will be the
// opposite of what it _WAS_, if you get my meaning :/
if(!musEnabled) return; // don't try if "xmms off" has been called
// don't try if "xmms off" has been called
if (!musEnabled)
return;
I_XMMS_Running (); // It even running ?
shuf = xmms_remote_is_shuffle (0);
xmms_remote_toggle_shuffle (0);
if(shuf==1) Sys_Printf("XMMSAudio: Shuffling Disabled\n");
else if(shuf==0) Sys_Printf("XMMSAudio: Shuffling Enabled\n");
else return; // ACH !
if (shuf == 1)
Sys_Printf ("XMMSAudio: Shuffling Disabled\n");
else if (shuf == 0)
Sys_Printf ("XMMSAudio: Shuffling Enabled\n");
else
return; // ACH !
return;
@ -343,13 +369,18 @@ I_XMMS_Repeat (void)
int rep;
if(!musEnabled) return; // don't try if "xmms off" has been called
// don't try if "xmms off" has been called
if (!musEnabled)
return;
I_XMMS_Running (); // It even running ?
rep = xmms_remote_is_repeat (0);
xmms_remote_toggle_repeat (0);
if(rep==1) Sys_Printf("XMMSAudio: Repeat Disabled\n");
else if(rep==0) Sys_Printf("XMMSAudio: Repeat Enabled\n");
else return; // ACH !
if (rep == 1)
Sys_Printf ("XMMSAudio: Repeat Disabled\n");
else if (rep == 0)
Sys_Printf ("XMMSAudio: Repeat Enabled\n");
else
return; // ACH !
return;
}
@ -359,6 +390,7 @@ I_XMMS_f (void)
{
const char *command;
/* int ret;
int n; */