00001
00002
00003
00004
00005 #ifndef dsPopen_h
00006 #define dsPopen_h
00007
00008 #ifdef HAVE_CONFIG_H
00009 # include <config.h>
00010 #endif
00011
00012 #include <stdio.h>
00013 #include <stdlib.h>
00014 #include <signal.h>
00015
00016 #include <sys/types.h>
00017 #include <sys/wait.h>
00018
00019 #ifdef HAVE_UNISTD_H
00020 # include <unistd.h>
00021 #endif
00022
00023 #include <dsSmartException.h>
00024 #include <dsutil.h>
00025
00026 DECLARE_EXCEPTION(dsPopen);
00027
00034 class dsPopen
00035 {
00036 pid_t _child_pid;
00037 int _pipe_fd, _pipe_fd_in, _pipe_fd_out;
00038
00039 public:
00040
00045 int break_up(const char *str, char *argv[], int max_args);
00046
00050 void clean(char *argv[]);
00051
00052 FILE *open(char *program, char *env, char *type);
00053 FILE *open(char *program, char *type){ return open(program,0,type); }
00054
00055 void open2(char *program, char *env, FILE **sf, FILE **df);
00056 void open2(char *program, FILE **sf, FILE **df){ open2(program,0,sf,df); }
00057
00058 int close(FILE *iop);
00059 int close2(FILE *sf, FILE *df);
00060
00061 };
00062
00063 #endif