/* $Id: plugin_exec.c,v 1.2 2004/04/08 10:48:25 reinelt Exp $ * * plugin for external processes * * Copyright 2004 Michael Reinelt * Copyright 2004 The LCD4Linux Team * * based on the old 'exec' client which is * Copyright 2001 Leopold Tötsch * * * This file is part of LCD4Linux. * * LCD4Linux is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * LCD4Linux is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * $Log: plugin_exec.c,v $ * Revision 1.2 2004/04/08 10:48:25 reinelt * finished plugin_exec * modified thread handling * added '%x' format to qprintf (hexadecimal) * * Revision 1.1 2004/03/20 11:49:40 reinelt * forgot to add plugin_exec.c ... * */ /* * exported functions: * * int plugin_init_exec (void) * adds functions to start external pocesses * */ #include "config.h" #include #include #include #include #include #include "debug.h" #include "plugin.h" #include "hash.h" #include "cfg.h" #include "thread.h" #include "qprintf.h" #define NUM_THREADS 16 #define SHM_SIZE 256 typedef struct { int delay; int mutex; pid_t pid; int shmid; char *cmd; char *key; char *ret; } EXEC_THREAD; static EXEC_THREAD Thread[NUM_THREADS]; static int max_thread = -1; static HASH EXEC = { 0, }; // x^0 + x^5 + x^12 #define CRCPOLY 0x8408 static unsigned short CRC (unsigned char *s) { int i; unsigned short crc; // seed value crc=0xffff; while (*s!='\0') { crc ^= *s++; for (i = 0; i < 8; i++) crc = (crc >> 1) ^ ((crc & 1) ? CRCPOLY : 0); } return crc; } static void exec_thread (void *data) { EXEC_THREAD *Thread = (EXEC_THREAD*)data; FILE *pipe; char buffer[SHM_SIZE]; int len; // use a safe path putenv ("PATH=/usr/local/bin:/usr/bin:/bin"); // forever... while (1) { pipe = popen(Thread->cmd, "r"); if (pipe == NULL) { error("exec error: could not run pipe '%s': %s", Thread->cmd, strerror(errno)); len = 0; } else { len = fread(buffer, 1, SHM_SIZE-1, pipe); if (len <= 0) { error("exec error: could not read from pipe '%s': %s", Thread->cmd, strerror(errno)); len = 0; } pclose(pipe); } // force trailing zero buffer[len] = '\0'; // remove trailing CR/LF while (len>0 && (buffer[len-1]=='\n' || buffer[len-1]=='\r')) { buffer[--len]='\0'; } // loc
# automatically generated from http://www.digitv.fi/sivu.asp?path=1;8224;9519
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
T 514000000 8MHz 2/3 NONE QAM64 8k 1/8 NONE
T 562000000 8MHz 2/3 NONE QAM64 8k 1/8 NONE