Add GNU LGPL headers to all .c .C and .h files
[oweals/cde.git] / cde / lib / tt / lib / tttk / eclipse.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 //%%  (c) Copyright 1993, 1994 Hewlett-Packard Company                  
24 //%%  (c) Copyright 1993, 1994 International Business Machines Corp.    
25 //%%  (c) Copyright 1993, 1994 Sun Microsystems, Inc.                   
26 //%%  (c) Copyright 1993, 1994 Novell, Inc.                             
27 //%%  $XConsortium: eclipse.C /main/3 1995/10/23 10:31:20 rswiston $                                                    
28 /*
29  * @(#)eclipse.C        1.3 93/09/07
30  * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
31  */                                                             
32 #include "ttdt.h"
33 #include "ttdtprocid.h"
34 #include "ttdtutils.h"
35
36 TtDtProcIDEclipse::TtDtProcIDEclipse(
37         const char *procID2Install,
38         Tt_status  *status
39 )
40 {
41         static const char *here = "TtDtProcIDEclipse::TtDtProcIDEclipse()";
42
43         _occultedProcID = tt_default_procid();
44         *status = tt_ptr_error( _occultedProcID );
45         if (*status != TT_OK) {
46                 _occultedProcID = 0;
47                 if ((procID2Install == 0) && (*status == TT_ERR_NOMP)) {
48                         //
49                         // There is no default procid to eclipse.  OK.
50                         //
51                         *status = TT_OK;
52                 } else {
53                         ttDtPrintStatus( here, "tt_default_procid()", *status);
54                         return;
55                 }
56         }
57         if (procID2Install != 0) {
58                 *status = tt_default_procid_set( procID2Install );
59                 if (*status != TT_OK) {
60                         ttDtPrintStatus( here, "tt_default_procid_set()",
61                                          *status );
62                         tt_free( (caddr_t)_occultedProcID );
63                         _occultedProcID = 0;
64                 }
65         }
66 }
67
68 TtDtProcIDEclipse::~TtDtProcIDEclipse()
69 {
70         static const char *here = "TtDtProcIDEclipse::~TtDtProcIDEclipse()";
71
72         if (_occultedProcID != 0) {
73                 Tt_status status = tt_default_procid_set( _occultedProcID );
74                 if (status != TT_OK) {
75                         ttDtPrintStatus( here, "tt_default_procid_set()",
76                                          status );
77                 }
78                 tt_free( (caddr_t)_occultedProcID );
79                 _occultedProcID = 0;
80         }
81 }