*NIX用コマンドライン手順書自動作成ツール開発
Revisión | f0489859cd91b1a948484fbedec1774cc2564887 (tree) |
---|---|
Tiempo | 2016-09-04 14:19:11 |
Autor | Koine Yuusuke(koinec) <koinec@user...> |
Commiter | Koine Yuusuke(koinec) |
* Implement: Output Only Command Line String (in ESC code)
@@ -100,6 +100,7 @@ int | ||
100 | 100 | int i_err; |
101 | 101 | int i_result; |
102 | 102 | int i_pos; |
103 | + int i_pid_grandchild; | |
103 | 104 | struct termios t_stt; |
104 | 105 | struct timeval t_tmval; |
105 | 106 | struct timeval *pt_tmval; |
@@ -115,7 +116,8 @@ int | ||
115 | 116 | } |
116 | 117 | |
117 | 118 | // Proc. Master-Process --- |
118 | - i_readstdin = 1; | |
119 | + i_readstdin = 1; | |
120 | + i_pid_grandchild = -1; | |
119 | 121 | do { |
120 | 122 | FD_ZERO( &t_rfd ); |
121 | 123 | FD_SET( gi_fd_master, &t_rfd ); |
@@ -154,14 +156,15 @@ int | ||
154 | 156 | if( 0x0d == str_inbuf[i_pos] ) { break; } |
155 | 157 | } |
156 | 158 | if( 0 < i_pos ) { |
159 | + // Keyboard input for Terminal --- | |
160 | + i_pid_grandchild | |
161 | + = CheckGrandchildProcess( gi_pid_child, i_pid_grandchild ); | |
162 | + | |
157 | 163 | (void)write( gi_fd_master, str_inbuf, i_pos ); |
158 | 164 | i_rdsz_inbuf -= i_pos; |
159 | 165 | } |
160 | 166 | pstr_in = (str_inbuf + i_pos); |
161 | - //(void)write( gi_fd_master, str_inbuf, i_rdsz_inbuf ); | |
162 | - //(void)fwrite(str_inbuf, 1, i_readsz, fscript); | |
163 | 167 | } |
164 | - | |
165 | 168 | } |
166 | 169 | |
167 | 170 | if(( 0 < i_fds ) && FD_ISSET( gi_fd_master, &t_rfd )) { |
@@ -170,12 +173,20 @@ int | ||
170 | 173 | if( 0 >= i_rdsz_outbuf ) { break; } |
171 | 174 | |
172 | 175 | (void)write(STDOUT_FILENO, str_outbuf, i_rdsz_outbuf ); |
173 | - (void)fwrite( str_outbuf, 1, i_rdsz_outbuf, fscript); | |
176 | + | |
177 | + if( 0 == i_pid_grandchild ) { | |
178 | + (void)CmdLine_AddCmdLineString( str_outbuf, i_rdsz_outbuf ); | |
179 | + } | |
180 | + | |
181 | + //(void)fwrite( str_outbuf, 1, i_rdsz_outbuf, fscript); | |
174 | 182 | } |
175 | 183 | fflush(fscript); |
176 | 184 | |
177 | 185 | if( 0 < i_rdsz_inbuf ) { |
186 | + i_pid_grandchild = -0xff; | |
178 | 187 | (void)write( gi_fd_master, pstr_in, i_rdsz_inbuf ); |
188 | + (void)fprintf( fscript, "**Command: %s\n", CmdLine_GetCmdLineString( NULL )); | |
189 | + CmdLine_ClearCmdLineString(); | |
179 | 190 | } |
180 | 191 | |
181 | 192 | } while(1); |