X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.0%2Fcinelerra%2Fthreadexec.C;fp=cinelerra-5.0%2Fcinelerra%2Fthreadexec.C;h=0000000000000000000000000000000000000000;hb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;hp=ead12048783aa516fa7f8b916b48c04214d35c4d;hpb=52fcc46226f9df46f9ce9d0566dc568455a7db0b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.0/cinelerra/threadexec.C b/cinelerra-5.0/cinelerra/threadexec.C deleted file mode 100644 index ead12048..00000000 --- a/cinelerra-5.0/cinelerra/threadexec.C +++ /dev/null @@ -1,162 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "mutex.h" -#include "threadexec.h" - -#include -#include -#include -#include -#include - -#define MAX_ARGS 32 - - - - - -ThreadExec::ThreadExec() - : Thread(1, 0, 0) -{ - Thread::set_synchronous(1); - arguments = new char*[MAX_ARGS]; - total_arguments = 0; - start_lock = new Mutex; - stdin_fd = 0; - pipe_stdin = 0; - command_line = ""; -} - -ThreadExec::~ThreadExec() -{ - if(pipe_stdin) - { - fflush(stdin_fd); - fclose(stdin_fd); - close(filedes[0]); - close(filedes[1]); - } - - Thread::join(); - - for(int i = 0; i < total_arguments; i++) - delete [] arguments[i]; - - delete start_lock; - delete [] arguments; -} - - - -void ThreadExec::start_command(const char *command_line, int pipe_stdin) -{ - this->command_line = command_line; - this->pipe_stdin = pipe_stdin; - - Thread::start(); - - start_lock->lock(); - start_lock->lock(); - start_lock->unlock(); -} - - -void ThreadExec::run() -{ - char *path_ptr; - char *ptr; - char *argument_ptr; - char argument[BCTEXTLEN]; - char command_line[BCTEXTLEN]; - - strcpy(command_line, this->command_line); - - - -// Set up arguments for exec - ptr = command_line; - path_ptr = path; - while(*ptr != ' ' && *ptr != 0) - { - *path_ptr++ = *ptr++; - } - *path_ptr = 0; - - arguments[total_arguments] = new char[strlen(path) + 1]; - strcpy(arguments[total_arguments], path); -//printf("%s\n", arguments[total_arguments]); - total_arguments++; - arguments[total_arguments] = 0; - - while(*ptr != 0) - { - ptr++; - argument_ptr = argument; - while(*ptr != ' ' && *ptr != 0) - { - *argument_ptr++ = *ptr++; - } - *argument_ptr = 0; -//printf("%s\n", argument); - - arguments[total_arguments] = new char[strlen(argument) + 1]; - strcpy(arguments[total_arguments], argument); - total_arguments++; - arguments[total_arguments] = 0; - } - - - - - - - - - - - if(pipe_stdin) - { - (void)pipe(filedes); - stdin_fd = fdopen(filedes[1], "w"); - } - - start_lock->unlock(); - -printf("ThreadExec::run 1\n"); - run_program(total_arguments, arguments, filedes[0]); - -printf("ThreadExec::run 2\n"); - - -} - - -FILE* ThreadExec::get_stdin() -{ - return stdin_fd; -} - - - -void ThreadExec::run_program(int argc, char *argv[], int stdin_fd) -{ -}