Ensure PyEPG does not appear in basic list unless its installed.

This commit is contained in:
Adam Sutton 2012-09-14 12:02:04 +01:00
parent fbb96482ec
commit 86b1a3afc5
3 changed files with 11 additions and 7 deletions

View file

@ -419,10 +419,12 @@ static int _pyepg_parse
void pyepg_init ( void )
{
char buf[256];
/* Internal module */
epggrab_module_int_create(NULL, "/usr/bin/pyepg", "PyEPG", 4,
"/usr/bin/pyepg",
NULL, _pyepg_parse, NULL, NULL);
if (find_exec("pyepg", buf, sizeof(buf)-1))
epggrab_module_int_create(NULL, "pyepg-internal", "PyEPG", 4, buf,
NULL, _pyepg_parse, NULL, NULL);
/* External module */
_pyepg_module = (epggrab_module_t*)

View file

@ -48,8 +48,8 @@ typedef struct spawn {
/*
* Search PATH for executable
*/
static int
_find_exec ( const char *name, char *out, size_t len )
int
find_exec ( const char *name, char *out, size_t len )
{
int ret = 0;
char bin[512];
@ -161,7 +161,7 @@ spawn_and_store_stdout(const char *prog, char *argv[], char **outp)
const char *local_argv[2] = { NULL, NULL };
if (*prog != '/' && *prog != '.') {
if (!_find_exec(prog, bin, sizeof(bin))) return -1;
if (!find_exec(prog, bin, sizeof(bin))) return -1;
prog = bin;
}
@ -233,7 +233,7 @@ spawnv(const char *prog, char *argv[])
const char *local_argv[2] = { NULL, NULL };
if (*prog != '/' && *prog != '.') {
if (!_find_exec(prog, bin, sizeof(bin))) return -1;
if (!find_exec(prog, bin, sizeof(bin))) return -1;
prog = bin;
}

View file

@ -19,6 +19,8 @@
#ifndef SPAWN_H
#define SPAWN_H
int find_exec ( const char *name, char *out, size_t len );
int spawn_and_store_stdout(const char *prog, char *argv[], char **outp);
int spawnv(const char *prog, char *argv[]);