// pipex_open()
-void pipex_open(pipex_t *pipex, const char *name, const char *command){
+void pipex_open(pipex_t *pipex,
+ const char *name,
+ const char *working_dir,
+ const char *command){
char string[StringSize];
int argc;
char * ptr;
/* my_dup2(STDOUT_FILENO,STDERR_FILENO); */
- // launch the new executable file
+ if(chdir(working_dir)){
+ my_fatal("pipex_open(): cannot change directory: %s\n",
+ strerror(errno));
+ }
+ // launch the new executable file
+
execvp(argv[0],&argv[0]);
// execvp() only returns when an error has occured
}
}
+// pipex_write()
+
+void pipex_write(pipex_t *pipex, const char *string){
+ io_send_queue(pipex->io,"%s",string);
+}
+
+
// pipex_writeln()
void pipex_writeln(pipex_t *pipex, const char *string){