Remove all optional compile flags from dtwm that are not referenced anywhere, and...
[oweals/cde.git] / cde / lib / DtSearch / ausexit.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 libraries 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 /*
24  *   COMPONENT_NAME: austext
25  *
26  *   FUNCTIONS: DtSearchExit
27  *              DtSearchAddUserExit
28  *              DtSearchRemoveUserExit
29  *
30  *   ORIGINS: 27
31  *
32  *
33  *   (C) COPYRIGHT International Business Machines Corp. 1993,1996
34  *   All Rights Reserved
35  *   Licensed Materials - Property of IBM
36  *   US Government Users Restricted Rights - Use, duplication or
37  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
38  */
39 /********************* AUSEXIT.C ************************
40  * $XConsortium: ausexit.c /main/6 1996/06/23 16:47:24 cde-ibm $
41  * August 1993.
42  * Performs generic exit function for AusText system ensuring
43  * graceful shutdown for vista database, curses lib, etc.
44  * Declares several global function pointers.
45  * Austext_exit has been renamed to DtSearchExit to support
46  * it's public visibility in DtSearch.
47  *
48  * Replaces both exitop.c and exitopv.c and changes the name
49  * of the function from opera_exit() to austext_exit().
50  * The name change ensures that the linker will catch all
51  * the places we have to set global 'austext_exit_dbms' to d_close().
52  * These were the former exitopV.c links; the plain exitop.c
53  * links were non-vista programs so only the name has to be changed.
54  *
55  * If austext_exit_endwin is not NULL, then a windows-oriented UI
56  * is executing and austext_exit_endwin should be called before
57  * shutting down to ensure restoration of normal terminal mode.
58  * For curses, austext_exit_endwin is set to the curses endwin()
59  * function immediately after curses initialization (initscr() call).
60  *
61  * If austext_exit_dbms is not NULL, then current process
62  * is linked to database api and function should be called
63  * to flush and close databases.  For vista, austext_exit_dbms
64  * is set to d_close() at beginning of vista-using program.
65  *
66  * If austext_exit_mem is not NULL, then current process
67  * is using shared memory and function should be called
68  * to release it to the system.
69  *
70  * If austext_exit_comm is not NULL, then current process
71  * is communicating to a remote process over a network.
72  * The function is in a local communications package and
73  * should be called to gracefully shutdown local child/parent 
74  * processes and daemons and allow a message to be sent to
75  * the remote process to do the same.
76  *
77  * Austext_exit_first and last are miscellaneous private
78  * exits which get called first and last respectively.
79  * Austext_exit_user is called just before 'last',
80  * but 'user' is public, ie known to customer developers
81  * using the DtSearch/ausapi interface, whereas 'first' and 'last'
82  * are private, reserved for the ausapi developers themselves.
83  *
84  * $Log$
85  * Revision 2.3  1996/04/10  19:45:58  miker
86  * Added DtSearchAddUserExit and DtSearchRemoveUserExit.
87  *
88  * Revision 2.2  1995/10/25  22:20:53  miker
89  * Added prolog.
90  *
91  * Revision 2.1  1995/09/22  18:51:11  miker
92  * Freeze DtSearch 0.1, AusText 2.1.8
93  *
94  * Revision 1.4  1995/08/31  21:54:23  miker
95  * Rename austext_exit() to DtSearchExit().
96  */
97 #include <stdlib.h>
98 #include "Search.h"
99
100 void    (*austext_exit_first) (int) =   NULL;
101 void    (*austext_exit_dbms) (int) =    NULL;
102 void    (*austext_exit_comm) (int) =    NULL;
103 void    (*austext_exit_endwin) (int) =  NULL;
104 void    (*austext_exit_mem) (int) =     NULL;
105 void    (*austext_exit_user) (int) =    NULL;
106 void    (*austext_exit_last) (int) =    NULL;
107
108
109 /****************************************/
110 /*                                      */
111 /*              DtSearchExit            */
112 /*                                      */
113 /****************************************/
114 void    DtSearchExit (int return_code)
115 {
116     if (austext_exit_first != NULL)
117         austext_exit_first (return_code);
118     if (austext_exit_dbms != NULL)
119         austext_exit_dbms (return_code);
120     if (austext_exit_comm != NULL)
121         austext_exit_comm (return_code);
122     if (austext_exit_endwin != NULL)
123         austext_exit_endwin (return_code);
124     if (austext_exit_mem != NULL)
125         austext_exit_mem (return_code);
126     if (austext_exit_user != NULL)
127         austext_exit_user (return_code);
128     if (austext_exit_last != NULL)
129         austext_exit_last (return_code);
130     exit (return_code);
131 }
132
133 /****************************************/
134 /*                                      */
135 /*          DtSearchAddUserExit         */
136 /*                                      */
137 /****************************************/
138 void    DtSearchAddUserExit (void (*user_exit)(int))
139 { austext_exit_user = user_exit; }
140
141
142 /****************************************/
143 /*                                      */
144 /*        DtSearchRemoveUserExit        */
145 /*                                      */
146 /****************************************/
147 void    DtSearchRemoveUserExit (void)
148 { austext_exit_user = NULL; }
149
150 /********************* AUSEXIT.C ************************/