- Timestamp:
- 2010-05-26T23:52:09+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/recpt/os_process.cpp
r22173 r22177 26 26 #include "os_process.h" 27 27 28 osprocess::osprocess(char* cmd)29 {}30 28 osprocess::osprocess(char* cmdline, OSProcessPipeMode mode) 31 29 : mode_(mode) … … 36 34 } 37 35 38 /* 39 bool osprocess::eop() 36 bool osprocess::close() 40 37 { 38 // close any file handles that are still open 39 40 bool write_close_rv = close_write_pipe(withoutWarning); 41 bool read_close_rv = close_read_pipe(withoutWarning); 42 43 return (write_close_rv && read_close_rv); 41 44 } 42 45 43 bool osprocess::eop(OSProcessPipeMode) 46 47 48 49 #if 1 50 51 #include "os_process_windows.h" 52 #include "os_process_unix.h" 53 #include <iostream> 54 using namespace std; 55 56 void test_uni_write_pipe() 44 57 { 58 #ifdef __WIN32__ 59 char* prog_name = "c:\\Windows\\system32\\java.exe"; 60 char* cmd_line = "java"; 61 62 //char* input_line = "echo hi there\n"; 63 //char* prog_name = "c:\\cygwin\\bin\\cat.exe"; 64 //char* cmd_line = "cat"; 65 #else 66 char* cmd_line = "/usr/bin/java"; 67 //char* cmd_line = "java"; 68 #endif 69 70 #ifdef __WIN32__ 71 osprocesswindows* process = new osprocesswindows(cmd_line,uniRead); 72 #else 73 osprocessunix* process = new osprocessunix(cmd_line,uniRead); 74 #endif 75 76 const int BufferSize = 1024; 77 char buffer[BufferSize]; 78 79 int bytes_read = 0; 80 do { 81 bytes_read = process->read(buffer,BufferSize); 82 if (bytes_read>0) { 83 fwrite(buffer,1,bytes_read,stdout); 84 } 85 } while (bytes_read==BufferSize); 86 87 88 delete process; 89 45 90 } 46 */47 91 48 int osprocess::read(char* buffer, const int buffer_len)92 int main() 49 93 { 94 printf("Content-type: text/html\n\n"); 95 96 printf( "<html>\n"); 97 printf( " <head>\n"); 98 printf( " <title>Testing</title>\n"); 99 printf( " </head>\n"); 100 printf( " <body>\n"); 101 102 test_uni_write_pipe(); 103 104 printf( " </body>\n"); 105 printf( "</html>\n"); 106 50 107 return 0; 51 108 } 52 109 53 int osprocess::write(char* buffer, const int buffer_len) 54 { 55 return 0; 56 } 57 58 bool osprocess::close() 59 { 60 return true; 61 } 110 #endif 62 111 63 bool osprocess::close(OSProcessPipeMode mode)64 {65 return true;66 }67
Note:
See TracChangeset
for help on using the changeset viewer.