1 /* This is the wrapper program for LyX on Win32. Using this
2 * wrapper program no DOS window will be present running LyX.
3 * The bad side of this: no error output could be seen ;-)
5 * compile this sourec with following options set:
7 * gcc lyxwin32.c -O2 -o lyxwin32 -static -Wall -Wno-format \
8 * -Wstrict-prototypes -Wmissing-prototypes \
9 * -mwindows -e _mainCRTStartup
11 * Claus Hentschel, 2002-01-17
13 #include <stdio.h> /* standard io library */
14 #include <stdlib.h> /* standard library */
15 #include <unistd.h> /* sleep , fork & exec */
16 #include <string.h> /* standard string library */
19 int main ( int argc, char *argv[] )
21 char cmd [32000] = "lyx " ; /* user command */
22 char *nargs [5 ] = { /* execute with login /bin/bash */
23 "/bin/bash", "--login",
27 int i = 1; /* just to count */
29 /* ensure bash reads my global env changes */
30 putenv ( "BASH_ENV=/etc/lyxprofile" ) ;
32 /* do for all "real" args */
35 strcat ( cmd , "\"" ) ; /* add quote before */
36 strcat ( cmd , argv [ i ] ) ; /* add the argument */
37 strcat ( cmd , "\" " ) ; /* add closing quote */
41 strcat ( cmd, "</dev/null 2>/tmp/lyx.out");
43 fprintf ( stderr , "Command is: |%s|\n" , cmd );
44 execv ( "/bin/bash" , nargs ) ; /* exec sub command */
46 /* we should never reach here */
47 perror ( "Execute failed") ;
48 return ( 0 ) ; /* exit with no error */