summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2011-03-21 15:00:18 +0000
committerMichael Meeks <michael.meeks@novell.com>2011-03-21 21:18:41 +0000
commit1df79912a5503f3f5f3c87bac3258e1c5eff93dc (patch)
treea8903dd1517f604b753bc1542345900774e9188f /desktop
parent4e81ce572f16622fbd8a56f45c0a59b343a09c5c (diff)
re-work start process to enable earlier splash and faster start
Diffstat (limited to 'desktop')
-rwxr-xr-xdesktop/prj/build.lst2
-rwxr-xr-xdesktop/scripts/soffice.sh123
-rwxr-xr-xdesktop/source/pagein/makefile.mk5
-rw-r--r--desktop/source/pagein/pagein-main.c12
-rwxr-xr-xdesktop/source/pagein/pagein.c5
-rwxr-xr-xdesktop/unx/source/makefile.mk20
-rwxr-xr-xdesktop/unx/source/splashx.c27
-rwxr-xr-xdesktop/unx/source/start.c287
8 files changed, 304 insertions, 177 deletions
diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst
index bef09600c2..26e9e04653 100755
--- a/desktop/prj/build.lst
+++ b/desktop/prj/build.lst
@@ -20,9 +20,9 @@ dt desktop\win32\source\rebase nmake - w dt_rebase dt_inc NULL
dt desktop\os2\source\applauncher nmake - p dt_applauncher dt_inc NULL
dt desktop\unx\source\officeloader nmake - u dt_officeloader_unx dt_inc NULL
dt desktop\unx\source nmake - u dt_uwrapper dt_inc NULL
-dt desktop\unx\splash nmake - u dt_usplash dt_inc NULL
dt desktop\source\pagein nmake - u dt_pagein dt_inc NULL
dt desktop\source\pkgchk\unopkg nmake - all dt_unopkg dt_dp_misc dt_app dt_inc dt_guiloader.w NULL
+dt desktop\unx\splash nmake - u dt_usplash dt_pagein.u dt_inc NULL
dt desktop\source\deployment nmake - all dt_deployment dt_dp_manager dt_dp_registry dt_dp_registry_package dt_dp_registry_executable dt_dp_registry_help dt_dp_registry_script dt_dp_registry_sfwk dt_dp_registry_component dt_dp_registry_configuration dt_dp_unopkg dt_inc dt_dp_misc NULL
dt desktop\source\deployment\misc nmake - all dt_dp_misc dt_inc NULL
dt desktop\source\deployment\unopkg nmake - all dt_dp_unopkg dt_inc NULL
diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh
index 8e16ed1be8..76af9bc19a 100755
--- a/desktop/scripts/soffice.sh
+++ b/desktop/scripts/soffice.sh
@@ -39,6 +39,19 @@ export SAL_ENABLE_FILE_LOCKING
# working on your system.
# SAL_NOOPENGL=true; export SAL_NOOPENGL
+unset XENVIRONMENT
+
+# uncomment line below to disable anti aliasing of fonts
+# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
+
+# uncomment line below if you encounter problems starting soffice on your system
+# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
+
+# read database entries for Adabas D
+if [ -f /etc/adabasrc ]; then
+ . /etc/adabasrc
+fi
+
# The following is needed on Linux PPC with IBM j2sdk142:
#@# export JITC_PROCESSOR_TYPE=6
@@ -66,8 +79,6 @@ if [ "$VALGRIND" != "" ]; then
export G_SLICE
fi
-sd_binary=`basename "$0" | sed 's/libreoffice/soffice/g'`.bin
-
case "`uname -s`" in
NetBSD|OpenBSD|FreeBSD|DragonFly)
# this is a temporary hack until we can live with the default search paths
@@ -86,109 +97,5 @@ AIX)
;;
esac
-#collect all bootstrap variables specified on the command line
-#so that they can be passed as arguments to javaldx later on
-for arg in $@
-do
- case "$arg" in
- -env:*) BOOTSTRAPVARS=$BOOTSTRAPVARS" ""$arg";;
- esac
-done
-
-# test for availability of the fast external splash
-for arg in $@; do
- case "$arg" in
- --nologo|-nologo|--no-oosplash|-no-oosplash|--version|-version|--help|-help|-h|-\?)
- no_oosplash=y
- ;;
- esac
-done
-
-# Setup our app as oosplash, but try to avoid executing pagein,
-# and other expensive environment setup pieces wherever possible
-# for a second started office
-if [ "$sd_binary" = "soffice.bin" -a -x "$sd_prog/oosplash.bin" ] && [ "$no_oosplash" != "y" ] ; then
- sd_binary="oosplash.bin"
-
- # try to connect to a running instance early
- if $VALGRINDCHECK "$sd_prog/$sd_binary" -qsend-and-report "$@" ; then
- exit 0
- fi
-fi
-
-# pagein
-sd_pagein_args=@pagein-common
-for sd_arg in "$@"; do
- case ${sd_arg} in
- --calc|-calc)
- sd_pagein_args="${sd_pagein_args} @pagein-calc"
- break;
- ;;
- --draw|-draw)
- sd_pagein_args="${sd_pagein_args} @pagein-draw"
- break;
- ;;
- --impress|-impress)
- sd_pagein_args="${sd_pagein_args} @pagein-impress"
- break;
- ;;
- --writer|-writer)
- sd_pagein_args="${sd_pagein_args} @pagein-writer"
- break;
- ;;
- esac
-done
-"$sd_prog/../basis-link/program/pagein" -L"$sd_prog/../basis-link/program" \
- ${sd_pagein_args}
-
-# extend the ld_library_path for java: javaldx checks the sofficerc for us
-if [ -x "$sd_prog/../basis-link/ure-link/bin/javaldx" ] ; then
- my_path=`"$sd_prog/../basis-link/ure-link/bin/javaldx" $BOOTSTRAPVARS \
- "-env:INIFILENAME=vnd.sun.star.pathname:$sd_prog/redirectrc"`
- if [ -n "$my_path" ] ; then
- sd_platform=`uname -s`
- case $sd_platform in
- AIX)
- LIBPATH=$my_path${LIBPATH:+:$LIBPATH}
- export LIBPATH
- ;;
- *)
- LD_LIBRARY_PATH=$my_path${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
- export LD_LIBRARY_PATH
- ;;
- esac
- fi
-fi
-
-unset XENVIRONMENT
-
-# uncomment line below to disable anti aliasing of fonts
-# SAL_ANTIALIAS_DISABLE=true; export SAL_ANTIALIAS_DISABLE
-
-# uncomment line below if you encounter problems starting soffice on your system
-# SAL_NO_XINITTHREADS=true; export SAL_NO_XINITTHREADS
-
-# read database entries for Adabas D
-if [ -f /etc/adabasrc ]; then
- . /etc/adabasrc
-fi
-
-# execute soffice binary
-$VALGRINDCHECK "$sd_prog/$sd_binary" "$@" &
-trap 'kill -9 $!' TERM
-wait $!
-sd_ret=$?
-
-while [ $sd_ret -eq 79 -o $sd_ret -eq 81 ]
-do
- if [ $sd_ret -eq 79 ]; then
- $VALGRINDCHECK "$sd_prog/$sd_binary" ""$BOOTSTRAPVARS"" &
- elif [ $sd_ret -eq 81 ]; then
- $VALGRINDCHECK "$sd_prog/$sd_binary" "$@" &
- fi
-
- wait $!
- sd_ret=$?
-done
-
-exit $sd_ret
+# oosplash does the rest: forcing pages in, javaldx etc. are
+exec $VALGRINDCHECK "$sd_prog/oosplash.bin" "$@"
diff --git a/desktop/source/pagein/makefile.mk b/desktop/source/pagein/makefile.mk
index 09248d4f94..205e03c958 100755
--- a/desktop/source/pagein/makefile.mk
+++ b/desktop/source/pagein/makefile.mk
@@ -45,6 +45,7 @@ LIBSALCPPRT=$(0)
OBJFILES= \
$(OBJ)$/pagein.obj \
+ $(OBJ)$/pagein-main.obj \
$(OBJ)$/file_image_unx.obj
APP1TARGET=$(TARGET)
@@ -77,24 +78,28 @@ UREMISCPATH=..$/ure-link$/share$/misc
$(MISC)$/$(TARGET)-calc : makefile.mk
@echo Making: $@
@-echo $(DLLPRE)sc$(DFTDLLPOST) > $@
+ @-echo $(DLLPRE)scui$(DFTDLLPOST) >> $@
@-echo $(DLLPRE)svx$(DFTDLLPOST) >> $@
@-echo $(DLLPRE)svxcore$(DFTDLLPOST) >> $@
$(MISC)$/$(TARGET)-draw : makefile.mk
@echo Making: $@
@-echo $(DLLPRE)sd$(DFTDLLPOST) > $@
+ @-echo $(DLLPRE)sdui$(DFTDLLPOST) >> $@
@-echo $(DLLPRE)svx$(DFTDLLPOST) >> $@
@-echo $(DLLPRE)svxcore$(DFTDLLPOST) >> $@
$(MISC)$/$(TARGET)-impress : makefile.mk
@echo Making: $@
@-echo $(DLLPRE)sd$(DFTDLLPOST) > $@
+ @-echo $(DLLPRE)sdui$(DFTDLLPOST) >> $@
@-echo $(DLLPRE)svx$(DFTDLLPOST) >> $@
@-echo $(DLLPRE)svxcore$(DFTDLLPOST) >> $@
$(MISC)$/$(TARGET)-writer : makefile.mk
@echo Making: $@
@-echo $(DLLPRE)sw$(DFTDLLPOST) > $@
+ @-echo $(DLLPRE)swui$(DFTDLLPOST) >> $@
@-echo $(DLLPRE)svx$(DFTDLLPOST) >> $@
@-echo $(DLLPRE)svxcore$(DFTDLLPOST) >> $@
diff --git a/desktop/source/pagein/pagein-main.c b/desktop/source/pagein/pagein-main.c
new file mode 100644
index 0000000000..f8fe82ab0a
--- /dev/null
+++ b/desktop/source/pagein/pagein-main.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+/*
+ * De-coupled to allow pagein to be re-used in the unx
+ * splash / quick-starter
+ */
+extern int pagein_execute (int argc, char **argv);
+
+int main (int argc, char **argv)
+{
+ return pagein_execute (argc, argv);
+}
+
diff --git a/desktop/source/pagein/pagein.c b/desktop/source/pagein/pagein.c
index 15623bfd8d..9e3b610a59 100755
--- a/desktop/source/pagein/pagein.c
+++ b/desktop/source/pagein/pagein.c
@@ -58,8 +58,10 @@ cleanup_and_leave:
return (result);
}
+extern int pagein_execute (int argc, char **argv);
+
/* main */
-int main (int argc, char **argv)
+int pagein_execute (int argc, char **argv)
{
int i, v = 0;
size_t nfiles = 0, nbytes = 0;
@@ -102,7 +104,6 @@ int main (int argc, char **argv)
/* next argv */
continue;
}
-
if ((argv[i][0] == '@') && ((fp = fopen (argv[i], "r")) == 0))
{
diff --git a/desktop/unx/source/makefile.mk b/desktop/unx/source/makefile.mk
index 494477a0c4..820520153a 100755
--- a/desktop/unx/source/makefile.mk
+++ b/desktop/unx/source/makefile.mk
@@ -32,33 +32,31 @@ NO_DEFAULT_STL=TRUE
.INCLUDE : settings.mk
-.IF "$(ENABLE_UNIX_QUICKSTARTER)"!="TRUE"
-
-dummy:
- @echo "Unix quickstarter disabled"
-
-.ELSE
+.IF "$(ENABLE_QUICKSTART_LIBPNG)"!="TRUE"
+CFLAGS+=-DENABLE_QUICKSTART_LIBPNG
+.ENDIF
STDLIB=
-
CFLAGS+=$(LIBPNG_CFLAGS)
OBJFILES= \
$(OBJ)$/splashx.obj \
$(OBJ)$/start.obj
+PAGEIN_OBJS= \
+ $(OBJ)$/pagein.obj \
+ $(OBJ)$/file_image_unx.obj
+
APP1TARGET = $(TARGET)
APP1RPATH = BRAND
-APP1OBJS = $(OBJFILES)
+APP1OBJS = $(OBJFILES) $(PAGEIN_OBJS)
APP1LIBSALCPPRT=
APP1CODETYPE = C
-APP1STDLIBS = $(SALLIB) -lX11 $(LIBPNG_LIBS)
+APP1STDLIBS = $(STDLIBGUIMT) $(SALLIB) $(LIBPNG_LIBS)
.IF "$(OS)"=="SOLARIS"
APP1STDLIBS+= -lsocket
.ENDIF
-.ENDIF # ENABLE_UNIX_QUICKSTARTER
-
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c
index 4aa562269a..9cc6832399 100755
--- a/desktop/unx/source/splashx.c
+++ b/desktop/unx/source/splashx.c
@@ -25,6 +25,9 @@
* in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
* instead of those above.
*/
+
+#ifdef ENABLE_QUICKSTART_LIBPNG
+
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
@@ -620,4 +623,28 @@ void splash_close_window()
bitmap_rows = NULL;
}
+#else /* not ENABLE_QUICKSTART_LIBPNG */
+
+/* Stubs that will never be called in this case */
+
+int splash_load_bmp( const char *filename )
+{
+ return 1;
+}
+void splash_setup( int barc[3], int framec[3], int posx, int posy, int w, int h )
+{
+}
+int splash_create_window( int argc, char** argv )
+{
+ return 1;
+}
+void splash_close_window()
+{
+}
+void splash_draw_progress( int progress )
+{
+}
+
+#endif // ENABLE_QUICKSTART_LIBPNG
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/desktop/unx/source/start.c b/desktop/unx/source/start.c
index d7820339c3..7e550b3172 100755
--- a/desktop/unx/source/start.c
+++ b/desktop/unx/source/start.c
@@ -49,14 +49,7 @@
#include "splashx.h"
-/*
- * magic argument - if passed, not passed onto soffice.bin but we exit
- * immediately if we fail to control the process. Used to avoid doing
- * an un-conditional pagein
- */
-#define QSEND_AND_REPORT "-qsend-and-report"
-
-#define IMG_SUFFIX ".png"
+#define IMG_SUFFIX ".png"
#define PIPEDEFAULTPATH "/tmp"
#define PIPEALTERNATEPATH "/var/tmp"
@@ -353,10 +346,6 @@ send_args( int fd, rtl_uString *pCwdPath )
osl_getCommandArg( nArg, &pTmp );
- if ( rtl_uString_getLength( pTmp ) == 0 ||
- !rtl_ustr_ascii_compare( pTmp->buffer, QSEND_AND_REPORT ) )
- continue;
-
// this is not a param, we have to prepend filenames with file://
// FIXME: improve the check
if ( ( pTmp->buffer[0] != (sal_Unicode)'-' ) )
@@ -651,25 +640,174 @@ system_checks( void )
/* check proc is mounted - lots of things fail otherwise */
if ( stat( "/proc/version", &buf ) != 0 )
{
- fprintf( stderr, "ERROR: /proc not mounted - OO.o is unlikely to work well if at all" );
+ fprintf( stderr, "ERROR: /proc not mounted - LibreOffice is unlikely to work well if at all" );
exit( 1 );
}
#endif
}
-/* Start the OOo application */
-static sal_Bool
-fork_app( rtl_uString *pAppPath, int *status_fd )
+/* re-use the pagein code */
+extern int pagein_execute (int argc, char **argv);
+
+/* parameters from the main thread */
+int status_fd = 0;
+int status_pipe[2];
+rtl_uString *pAppPath = NULL;
+
+void
+exec_pagein (void)
+{
+ char buffer[64] = "";
+ char *argv[5];
+ sal_uInt32 nArgs, i, j;
+ static const char *cmd_names[] = { "writer", "impress", "draw", "calc" };
+
+ argv[0] = "dummy-pagein";
+ argv[1] = "-L../basis-link/program";
+ argv[2] = "@pagein-common";
+ argv[3] = buffer;
+ argv[4] = NULL;
+
+ nArgs = osl_getCommandArgCount();
+ for ( i = 0; i < nArgs; ++i )
+ {
+ rtl_uString *pArg = NULL;
+ osl_getCommandArg( i, &pArg );
+
+ sal_Int32 length = pArg->length;
+ const sal_Unicode *arg = pArg->buffer;
+ while (length > 2 && arg[0] == '-') {
+ arg++; length--;
+ }
+
+ for ( j = 0; j < SAL_N_ELEMENTS (cmd_names); ++j ) {
+ if (!rtl_ustr_indexOfAscii_WithLength(
+ arg, length, cmd_names[j], strlen (cmd_names[j]))) {
+ strcpy (buffer, "@pagein-");
+ strcat (buffer, cmd_names[j]);
+ goto found_app;
+ }
+ }
+ }
+ found_app:
+ pagein_execute (buffer[0] != '\0' ? 4 : 3, argv);
+}
+
+static void extend_library_path (const char *new_element)
+{
+ const char *pathname;
+#ifdef AIX
+ pathname = "LIBPATH";
+#else
+ pathname = "LD_LIBRARY_PATH";
+#endif
+ char *buffer;
+ char *oldpath;
+
+ oldpath = getenv (pathname);
+ buffer = malloc (strlen (new_element) + strlen (pathname) +
+ (oldpath ? strlen (oldpath) : 0)+ 4);
+ strcpy (buffer, pathname);
+ strcpy (buffer, "=");
+ strcpy (buffer, new_element);
+ if (oldpath) {
+ strcat (buffer, ":");
+ strcat (buffer, oldpath);
+ }
+
+ /* deliberately leak buffer - many OS' don't dup at this point */
+ putenv (buffer);
+}
+
+static void
+exec_javaldx (void)
+{
+ char *newpath;
+ sal_Sequence *line;
+ sal_uInt32 i, j, nArgs;
+ rtl_uString *pApp = NULL;
+ rtl_uString **ppArgs;
+ rtl_uString *pEnvironment[1] = { NULL };
+
+ nArgs = osl_getCommandArgCount();
+ ppArgs = (rtl_uString **)calloc( nArgs + 2, sizeof( rtl_uString* ) );
+
+#warning FIXME - copy this and just sort the arguments globally first ...
+
+ for ( j = i = 0; i < nArgs; ++i )
+ {
+ rtl_uString *pTmp = NULL;
+ osl_getCommandArg( i, &pTmp );
+ if (rtl_ustr_ascii_compare_WithLength (pTmp->buffer, 5, "-env:"))
+ {
+ rtl_uString_acquire (pTmp);
+ ppArgs[j++] = pTmp;
+ }
+ rtl_uString_release (pTmp);
+ }
+
+ /* FIXME: do we need to check / turn program/redirectrc into an absolute path ? */
+ rtl_uString_newFromAscii( &ppArgs[j++], "-env:INIFILENAME=vnd.sun.star.pathname:./redirectrc" );
+
+ oslProcess javaldx = NULL;
+ oslFileHandle fileOut= 0;
+ oslProcessError err;
+
+ rtl_uString_newFromAscii( &pApp, "../ure/bin/javaldx" );
+ /* unset to avoid bogus output */
+ rtl_uString_newFromAscii( &pEnvironment[0], "G_SLICE" );
+ err = osl_executeProcess_WithRedirectedIO( pApp, ppArgs, j,
+ osl_Process_HIDDEN,
+ NULL, // security
+ NULL, // work dir
+ pEnvironment, 1,
+ &javaldx, // handle
+ NULL,
+ &fileOut,
+ NULL);
+
+ if( err != osl_Process_E_None)
+ {
+ fprintf (stderr, "Warning: failed to launch javaldx - java may not fuction correctly\n");
+ return;
+ }
+
+ line = NULL;
+ if (!osl_readLine (fileOut, &line) || !line) {
+ fprintf (stderr, "Warning: failed to read path from javaldx\n");
+ return;
+ }
+
+ if (!line->nElements)
+ fprintf (stderr, "curious - javaldx returns zero length path\n");
+ else {
+ newpath = malloc (line->nElements + 1);
+ strncpy (newpath, line->elements, line->nElements);
+ newpath[line->nElements] = '\0';
+
+ fprintf (stderr, "Adding javaldx path of '%s'\n", newpath);
+ extend_library_path (newpath);
+ }
+
+ /* FIXME: should we join it first ? */
+ osl_freeProcessHandle(javaldx);
+}
+
+static void SAL_CALL
+fork_app_thread( void *dummy )
{
+ (void)dummy;
rtl_uString *pApp = NULL, *pTmp = NULL, *pArg = NULL;
rtl_uString **ppArgs;
sal_uInt32 nArgs, i;
+ sal_Bool restart;
- oslProcess aProcess;
+ oslProcess child;
oslProcessError nError;
- int status_pipe[2];
- system_checks();
+ exec_pagein ();
+
+ exec_javaldx ();
/* application name */
rtl_uString_newFromAscii( &pApp, "file://" );
@@ -689,13 +827,6 @@ fork_app( rtl_uString *pAppPath, int *status_fd )
rtl_uString_newFromString( &(ppArgs[i]), pTmp );
}
- /* create pipe */
- if ( pipe( status_pipe ) < 0 )
- {
- fprintf( stderr, "ERROR: no file handles\n");
- exit( 1 );
- }
-
/* add the pipe arg */
sal_Unicode pUnicode[RTL_USTR_MAX_VALUEOFINT32];
rtl_ustr_valueOfInt32( pUnicode, status_pipe[1], 10 );
@@ -708,25 +839,50 @@ fork_app( rtl_uString *pAppPath, int *status_fd )
rtl_uString_newFromString( &(ppArgs[nArgs]), pArg );
++nArgs;
- /* start the OOo process */
- nError = osl_executeProcess( pApp, ppArgs, nArgs,
- osl_Process_DETACHED | osl_Process_NORMAL,
- NULL,
- NULL,
- NULL, 0,
- &aProcess );
+ restart = sal_False;
+ do
+ {
+ oslProcessInfo info;
- *status_fd = status_pipe[0];
- close( status_pipe[1] );
+ /* start the main process */
+ nError = osl_executeProcess( pApp, ppArgs, nArgs,
+ osl_Process_NORMAL,
+ NULL,
+ NULL,
+ NULL, 0,
+ &child );
- if ( nError != osl_Process_E_None )
- {
- fprintf( stderr, "ERROR %d forking process", nError );
- ustr_debug( "", pApp );
- return sal_False;
+ if ( nError != osl_Process_E_None )
+ {
+ fprintf( stderr, "ERROR %d forking process", nError );
+ ustr_debug( "", pApp );
+ _exit (1);
+ }
+
+ /* wait for it to complete */
+ osl_joinProcess (child);
+
+ info.Size = sizeof (info);
+ info.Code = 0;
+ if (osl_getProcessInfo (child, osl_Process_EXITCODE, &info) != osl_Process_E_None)
+ fprintf (stderr, "Warning: failed to fetch libreoffice exit status\n");
+
+ switch (info.Code) {
+ case 79: // re-start with just -env: parameters
+ fprintf (stderr, "FIXME: re-start with just -env: params !\n");
+ restart = sal_True;
+ break;
+ case 81: // re-start with all arguments
+ fprintf (stderr, "FIXME: re-start with all params !\n");
+ restart = sal_True;
+ break;
+ default:
+ break;
+ }
}
+ while (restart);
- return sal_True;
+ close( status_pipe[1] );
}
/* Check if 'pArg' is -pCmpWith or --pCmpWith */
@@ -748,11 +904,12 @@ arg_check( rtl_uString *pArg, const char *pCmpWith )
}
static const char *ppInhibit[] = {
- "nologo", "headless", "invisible", "help", "h", "?", "minimized",
- NULL };
+ "nologo", "headless", "invisible", "help", "h", "?",
+ "minimized", "version", NULL
+};
static const char *ppTwoArgs[] = {
- "pt", "display",
- NULL };
+ "pt", "display", NULL
+};
/* Read command line parameters and return whether we display the splash. */
static sal_Bool
@@ -804,18 +961,24 @@ get_inhibit_splash()
SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
{
- int fd = 0, status_fd = 0;
- sal_Bool bInhibitSplash, bSendAndReport;
+ int fd = 0;
+ sal_Bool bInhibitSplash;
sal_Bool bSentArgs = sal_False;
- rtl_uString *pAppPath = NULL;
rtl_uString *pPipePath = NULL;
ProgressStatus eResult = ProgressExit;
+ fprintf (stderr, "start !\n");
+
/* turn SIGPIPE into an error */
signal( SIGPIPE, SIG_IGN );
bInhibitSplash = get_inhibit_splash();
+#ifndef ENABLE_QUICKSTART_LIBPNG
+ /* we can't load and render it anyway */
+ bInhibitSplash = sal_True;
+#endif
+
pAppPath = get_app_path( argv[0] );
if ( !pAppPath )
{
@@ -824,15 +987,17 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
}
ustr_debug( "App path", pAppPath );
- bSendAndReport = argc > 1 && !strcmp (argv[1], QSEND_AND_REPORT);
-
pPipePath = get_pipe_path( pAppPath );
+ fprintf (stderr, "try pipe !\n");
+
if ( ( fd = connect_pipe( pPipePath ) ) >= 0 )
{
rtl_uString *pCwdPath = NULL;
osl_getProcessWorkingDir( &pCwdPath );
+ fprintf (stderr, "send args !\n");
+
bSentArgs = send_args( fd, pCwdPath );
}
#if OSL_DEBUG_LEVEL > 0
@@ -840,12 +1005,21 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
ustr_debug( "Failed to connect to pipe", pPipePath );
#endif
- if ( !bSendAndReport && !bSentArgs )
+ if ( !bSentArgs )
{
- /* we have to exec the binary */
+ /* we have to prepare for, and exec the binary */
do {
- if ( !fork_app( pAppPath, &status_fd ) )
- return 1;
+ /* sanity check pieces */
+ system_checks();
+
+ /* create pipe */
+ if ( pipe( status_pipe ) < 0 )
+ {
+ fprintf( stderr, "ERROR: no file handles\n");
+ exit( 1 );
+ }
+ int status_fd = status_pipe[0];
+ osl_createThread( fork_app_thread, NULL );
if ( !bInhibitSplash )
{
@@ -861,6 +1035,9 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
}
close( status_fd );
+
+ fprintf (stderr, "sleep!\n");
+ sleep (100);
} while ( eResult == ProgressRestart );
}
@@ -870,7 +1047,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS( argc, argv )
close( fd );
- return bSendAndReport? !bSentArgs : 0;
+ return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */