169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
}else{
zExternalCommand = db_get("gdiff-command", 0);
}
if( zExternalCommand==0 ){
internalDiff=1;
}
blob_zero(&cmd);
blob_appendf(&cmd, "%s ", zExternalCommand);
}
zFile = g.argv[g.argc-1];
file_tree_name(zFile, &fname, 1);
blob_zero(&vname);
do{
blob_reset(&vname);
|
|
>
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
}else{
zExternalCommand = db_get("gdiff-command", 0);
}
if( zExternalCommand==0 ){
internalDiff=1;
}
blob_zero(&cmd);
shell_escape(&cmd, zExternalCommand);
blob_append(&cmd, " ", 1);
}
zFile = g.argv[g.argc-1];
file_tree_name(zFile, &fname, 1);
blob_zero(&vname);
do{
blob_reset(&vname);
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
blob_reset(&out);
}else{
blob_write_to_file(&record, blob_str(&vname));
blob_reset(&record);
shell_escape(&cmd, blob_str(&vname));
blob_appendf(&cmd, " ");
shell_escape(&cmd, zFile);
system(blob_str(&cmd));
unlink(blob_str(&vname));
blob_reset(&vname);
blob_reset(&cmd);
}
blob_reset(&fname);
}
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
|
blob_reset(&out);
}else{
blob_write_to_file(&record, blob_str(&vname));
blob_reset(&record);
shell_escape(&cmd, blob_str(&vname));
blob_appendf(&cmd, " ");
shell_escape(&cmd, zFile);
portable_system(blob_str(&cmd));
unlink(blob_str(&vname));
blob_reset(&vname);
blob_reset(&cmd);
}
blob_reset(&fname);
}
/*
** This function implements a cross-platform "system()" interface.
*/
void portable_system(char *zOrigCmd){
#ifdef __MINGW32__
/* On windows, we have to put double-quotes around the entire command.
** Who knows why - this is just the way windows works.
*/
char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
system(zNewCmd);
free(zNewCmd);
#else
/* On unix, evaluate the command directly.
*/
system(zOrigCmd);
#endif
}
|