00001 /* 00002 * $Id: execute.c,v 1.3 2005/12/16 16:02:29 ghost666 Exp $ 00003 * 00004 * rssbgr - RSS backgroud reader 00005 * Copyright (C) 2005 Piotr 'GhosT' Wydrych 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 */ 00021 00022 #include "execute.h" 00023 00024 void *execute_thread(void *parameters) 00025 { 00026 FILE *p; 00027 00028 if ((p = popen((char *)parameters, "w")) != NULL) 00029 pclose(p); 00030 free(parameters); 00031 return NULL; 00032 } 00033 00034 void execute(char *command) 00035 { 00036 pthread_t execute_thr; 00037 char *command_copy = (char *)malloc(strlen(command)+1); 00038 00039 strcpy(command_copy, command); 00040 pthread_create(&execute_thr, NULL, execute_thread, (void *)command_copy); 00041 }