source: trunk/minix/commands/i386/mtools-3.9.7/precmd.c@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 433 bytes
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
10void 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.