2006-06-05 04:30:16 +00:00
|
|
|
// switcher.C
|
|
|
|
//
|
|
|
|
// When run as
|
2006-06-17 11:51:48 +00:00
|
|
|
// switcher Path X1 ... Xn
|
|
|
|
// runs program at Path with args X1. ... Xn
|
2006-06-05 04:30:16 +00:00
|
|
|
|
|
|
|
#include <unistd.h>
|
2006-06-17 11:51:48 +00:00
|
|
|
#include <stdio.h>
|
2006-06-05 04:30:16 +00:00
|
|
|
|
2006-06-17 11:51:48 +00:00
|
|
|
int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
#if 0 // For debugging
|
|
|
|
for (int i=0; i<argc; i++) {
|
|
|
|
fprintf(stderr, "switcher arg %d: %s\n", i, argv[i]);
|
|
|
|
}
|
|
|
|
fflush(stderr);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
execv(argv[1], argv+2);
|
2006-06-05 04:30:16 +00:00
|
|
|
}
|