Exemplo n.º 1
0
Arquivo: rcfile.c Projeto: E-LLP/QuIP
static int read_global_startup(SINGLE_QSP_ARG_DECL)
{
#ifdef BUILD_FOR_OBJC
#ifdef BUILD_FOR_IOS
	// this is called from the main thread at startup...
	return ios_read_global_startup(SINGLE_QSP_ARG);	// in .m file
#endif // BUILD_FOR_IOS
#ifdef BUILD_FOR_MACOS
	// this is called from the main thread at startup...
	return macos_read_global_startup(SINGLE_QSP_ARG);
#endif // BUILD_FOR_MACOS
#else /* ! BUILD_FOR_OBJC */

	char *home;
	char filename[MAXPATHLEN];
	FILE *fp;

	home=getenv("HOME");

	if( home == NULL ){
		WARN("read_global_startup:  no HOME in environment");
		return -1;
	}

	// In the IOS simulator, HOME expands to a very long and strange path...
	// There is an install script to copy the file, but this fails when
	// we copy the file to the device...

	sprintf(filename,"%s/.coqrc",home);	// BUG possible buffer overrun
	fp=fopen(filename,"r");

	if( fp!=NULL ) {
//		int lvl;

		/* We might like to interpret commands here,
		 * but no menus have been pushed, so we can't!?
		 * Could perhaps use builtin menu only?
		 */
		redir(QSP_ARG  fp, filename );

		// If the startup file contains widget creation commands,
		// they can't run before the appDelegate has started (ios).
		// Therefore, we defer execution of the startup commands
		// until later.

		return 0;
	}
	return -1;
#endif /* ! BUILD_FOR_OBJC */

}
Exemplo n.º 2
0
static int read_global_startup(QSP_ARG_DECL const char *progname)
{
#ifdef BUILD_FOR_CMD_LINE

	return read_traditional_startup(QSP_ARG  progname);

#else // ! BUILD_FOR_CMD_LINE

#ifdef BUILD_FOR_IOS
	// this is called from the main thread at startup...
	return ios_read_global_startup(SINGLE_QSP_ARG);	// in .m file
#endif // BUILD_FOR_IOS

#ifdef BUILD_FOR_MACOS_APP
	// We do this only when building a cocoa app, but not
	// for the native Mac command line version...
	//
	// this is called from the main thread at startup...
	return macos_read_global_startup(SINGLE_QSP_ARG);
#endif // BUILD_FOR_MACOS_APP

#endif /* ! BUILD_FOR_CMD_LINE */

}