1 /* $XConsortium: Main.C /main/5 1996/10/17 17:00:51 drk $ */
5 * $XConsortium: Main.C /main/5 1996/10/17 17:00:51 drk $
7 * RESTRICTED CONFIDENTIAL INFORMATION:
9 * The information in this document is subject to special
10 * restrictions in a confidential disclosure agreement bertween
11 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
12 * document outside HP, IBM, Sun, USL, SCO, or Univel wihtout
13 * Sun's specific written approval. This documment and all copies
14 * and derivative works thereof must be returned or destroyed at
17 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
21 ///////////////////////////////////////////////////////////////////////////////
22 //////////////////////////////////////////////////////////////////////////////
23 // This example code is from the book:
25 // Object-Oriented Programming with C++ and OSF/Motif
28 // Prentice Hall, 1992
31 // Copyright 1991 by Prentice Hall
32 // All Rights Reserved
34 // Permission to use, copy, modify, and distribute this software for
35 // any purpose except publication and without fee is hereby granted, provided
36 // that the above copyright notice appear in all copies of the software.
37 ///////////////////////////////////////////////////////////////////////////////
38 //////////////////////////////////////////////////////////////////////////////
41 //////////////////////////////////////////////////////////
42 // Main.C: Generic main program used by all applications
43 //////////////////////////////////////////////////////////
44 #include "Application.h"
47 // We can implement main() in the library because the
48 // framework completely encapsulates all Xt boilerplate
49 // and all central flow of control.
56 static struct sigaction action;
58 void _signal( int Sig )
60 if ( getenv( "_ILS_DEBUG_" ) ) {
61 printf( "Got signal[%d]. Generate full core...\n", Sig );
62 sigaction( SIGIOT, NULL, &action );
63 action.sa_flags |= SA_FULLDUMP;
64 action.sa_flags &= ~SA_PARTDUMP;
65 sigaction( SIGIOT, &action, NULL );
72 int main ( int argc, char **argv )
77 // With Defect 174851, a lot of codes are changed to make dtmail i18n'ze.
78 // Especially, dtmail allocates the memory dynamically to convert the mail
79 // body. Therefore, I believe no defects there, but it will cause the
80 // potential coredump. If coredump will happen, to get the FULLCORE image,
81 // please set // _ILS_DEBUG_ environment variable on, like
82 // export _ILS_DEBUG_=:
84 // and do the same operation as that of when coredump will have occured.
85 // If the signal will be received, dtmail generates full core dump image.
86 // Note: This core file size will be big. So be aware of "ulimit" of sh.
88 if ( getenv( "_ILS_DEBUG_" ) )
89 (void)signal( SIGILL|SIGIOT|SIGKILL|SIGBUS|SIGSEGV, _signal );
92 // Make sure the programmer has remembered to
93 // instantiate an Application object
95 assert ( theApplication != NULL );
97 // Init Intrinsics, build all windows, and enter event loop
99 theApplication->initialize ( &argc, argv );
101 theApplication->handleEvents();