Renamed 'Command' to 'Script'.

This commit is contained in:
Rolf Ahrenberg 2007-10-21 09:24:24 +00:00
parent 63ad1a66d7
commit 7330887512
2 changed files with 15 additions and 15 deletions

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolext.c,v 1.16 2007/10/20 23:25:14 ajhseppa Exp $ * $Id: protocolext.c,v 1.17 2007/10/21 09:24:24 rahrenbe Exp $
*/ */
#include <sys/wait.h> #include <sys/wait.h>
@ -82,12 +82,12 @@ void cIptvProtocolExt::CloseSocket(void)
} }
} }
void cIptvProtocolExt::ExecuteCommand(void) void cIptvProtocolExt::ExecuteScript(void)
{ {
debug("cIptvProtocolExt::ExecuteCommand()\n"); debug("cIptvProtocolExt::ExecuteScript()\n");
// Check if already executing // Check if already executing
if (pid > 0) { if (pid > 0) {
error("ERROR: Cannot execute command!"); error("ERROR: Cannot execute script!");
return; return;
} }
// Let's fork // Let's fork
@ -101,9 +101,9 @@ void cIptvProtocolExt::ExecuteCommand(void)
// Execute the external script // Execute the external script
char* cmd = NULL; char* cmd = NULL;
asprintf(&cmd, "%s %d %d", scriptFile, scriptParameter, listenPort); asprintf(&cmd, "%s %d %d", scriptFile, scriptParameter, listenPort);
debug("cIptvProtocolExt::ExecuteCommand(child): %s\n", cmd); debug("cIptvProtocolExt::ExecuteScript(child): %s\n", cmd);
if (execl("/bin/sh", "sh", "-c", cmd, NULL) == -1) { if (execl("/bin/sh", "sh", "-c", cmd, NULL) == -1) {
error("ERROR: Command failed: %s", cmd); error("ERROR: Script executionfailed: %s", cmd);
free(cmd); free(cmd);
_exit(-1); _exit(-1);
} }
@ -111,13 +111,13 @@ void cIptvProtocolExt::ExecuteCommand(void)
_exit(0); _exit(0);
} }
else { else {
debug("cIptvProtocolExt::ExecuteCommand(): pid=%d\n", pid); debug("cIptvProtocolExt::ExecuteScript(): pid=%d\n", pid);
} }
} }
void cIptvProtocolExt::TerminateCommand(void) void cIptvProtocolExt::TerminateScript(void)
{ {
debug("cIptvProtocolExt::TerminateCommand(): pid=%d\n", pid); debug("cIptvProtocolExt::TerminateScript(): pid=%d\n", pid);
if (pid > 0) { if (pid > 0) {
const unsigned int timeoutms = 100; const unsigned int timeoutms = 100;
unsigned int waitms = 0; unsigned int waitms = 0;
@ -221,8 +221,8 @@ bool cIptvProtocolExt::Open(void)
return false; return false;
// Create the listening socket // Create the listening socket
OpenSocket(); OpenSocket();
// Execute the external command // Execute the external script
ExecuteCommand(); ExecuteScript();
isActive = true; isActive = true;
return true; return true;
} }
@ -233,7 +233,7 @@ bool cIptvProtocolExt::Close(void)
// Close the socket // Close the socket
CloseSocket(); CloseSocket();
// Terminate the external script // Terminate the external script
TerminateCommand(); TerminateScript();
isActive = false; isActive = false;
return true; return true;
} }

View File

@ -3,7 +3,7 @@
* *
* See the README file for copyright information and how to reach the author. * See the README file for copyright information and how to reach the author.
* *
* $Id: protocolext.h,v 1.5 2007/10/19 22:18:55 rahrenbe Exp $ * $Id: protocolext.h,v 1.6 2007/10/21 09:24:24 rahrenbe Exp $
*/ */
#ifndef __IPTV_PROTOCOLEXT_H #ifndef __IPTV_PROTOCOLEXT_H
@ -28,8 +28,8 @@ private:
private: private:
bool OpenSocket(void); bool OpenSocket(void);
void CloseSocket(void); void CloseSocket(void);
void TerminateCommand(void); void TerminateScript(void);
void ExecuteCommand(void); void ExecuteScript(void);
public: public:
cIptvProtocolExt(); cIptvProtocolExt();