1 /********************************************************************
3 Copyright (C) 2007 Lubos Lunak <l.lunak@kde.org>
5 Please see file LICENSE for the licensing terms of ksplashx as a whole.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *********************************************************************/
27 static void usage( char* name
)
29 fprintf( stderr
, "Usage: %s <theme> [--test] [--pid]\n", name
);
33 int main( int argc
, char* argv
[] )
35 if( argc
!= 2 && argc
!= 3 && argc
!= 4 )
38 bool print_pid
= false;
39 for( int i
= 2; // 1 is the theme
43 if( strcmp( argv
[ i
], "--test" ) == 0 )
45 else if( strcmp( argv
[ i
], "--pid" ) == 0 )
50 const char* theme
= argv
[ 1 ];
51 if( strcmp( theme
, "DefaultFullscreen" ) == 0 )
52 theme
= "Default"; // these are now the same
57 if( pipe( pipes
) < 0 )
71 parent_pipe
= pipes
[ 1 ];
72 close( 0 ); // close stdin,stdout,stderr, otherwise startkde will block
80 while( read( pipes
[ 0 ], &buf
, 1 ) < 0
81 && ( errno
== EINTR
|| errno
== EAGAIN
|| errno
== ECHILD
))
84 printf( "%d\n", pid
);
91 XSynchronize( qt_xdisplay(), True
);
92 runSplash( theme
, test
, parent_pipe
);