Line | |
---|
1 | /*
|
---|
2 | * Do filename expansion with the shell.
|
---|
3 | */
|
---|
4 |
|
---|
5 | #define EXPAND_BUF 2048
|
---|
6 |
|
---|
7 | #include "sysincludes.h"
|
---|
8 | #include "mtools.h"
|
---|
9 |
|
---|
10 | void precmd(struct device *dev)
|
---|
11 | {
|
---|
12 | int status;
|
---|
13 | pid_t pid;
|
---|
14 |
|
---|
15 | if(!dev || !dev->precmd)
|
---|
16 | return;
|
---|
17 |
|
---|
18 | switch((pid=fork())){
|
---|
19 | case -1:
|
---|
20 | perror("Could not fork");
|
---|
21 | exit(1);
|
---|
22 | break;
|
---|
23 | case 0: /* the son */
|
---|
24 | execl("/bin/sh", "sh", "-c", dev->precmd, 0);
|
---|
25 | break;
|
---|
26 | default:
|
---|
27 | wait(&status);
|
---|
28 | break;
|
---|
29 | }
|
---|
30 | }
|
---|
31 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.