1 #include <stdio.h> /* standard io library */
2 #include <stdlib.h> /* standard library */
3 #include <unistd.h> /* sleep , fork & exec */
4 #include <string.h> /* standard string library */
7 int main ( int argc, char *argv[] )
9 char cmd [32000] = "lyx " ; /* user command */
10 char *nargs [4 ] = { /* execute with login /bin/bash */
15 int i = 1; /* just to count */
17 /* ensure bash reads my global env changes */
18 putenv ( "BASH_ENV=/etc/lyxprofile" ) ;
20 /* do for all "real" args */
23 strcat ( cmd , "\"" ) ; /* add quote before */
24 strcat ( cmd , argv [ i ] ) ; /* add the argument */
25 strcat ( cmd , "\" " ) ; /* add closing quote */
29 strcat ( cmd, "</dev/null 2>/dev/null");
31 fprintf ( stderr , "Command is: |%s|\n" , cmd );
32 execv ( "/bin/bash" , nargs ) ; /* exec sub command */
34 /* Oops: we should never reach here */
35 perror ( "Execute failed") ;
36 return ( 1 ) ; /* exit with an error */