2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
24 * COMPONENT_NAME: austext
26 * FUNCTIONS: DtSearchExit
28 * DtSearchRemoveUserExit
33 * (C) COPYRIGHT International Business Machines Corp. 1993,1996
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.
39 /********************* AUSEXIT.C ************************
40 * $XConsortium: ausexit.c /main/6 1996/06/23 16:47:24 cde-ibm $
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.
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.
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).
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.
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.
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.
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.
85 * Revision 2.3 1996/04/10 19:45:58 miker
86 * Added DtSearchAddUserExit and DtSearchRemoveUserExit.
88 * Revision 2.2 1995/10/25 22:20:53 miker
91 * Revision 2.1 1995/09/22 18:51:11 miker
92 * Freeze DtSearch 0.1, AusText 2.1.8
94 * Revision 1.4 1995/08/31 21:54:23 miker
95 * Rename austext_exit() to DtSearchExit().
99 void (*austext_exit_first) (int) = NULL;
100 void (*austext_exit_dbms) (int) = NULL;
101 void (*austext_exit_comm) (int) = NULL;
102 void (*austext_exit_endwin) (int) = NULL;
103 void (*austext_exit_mem) (int) = NULL;
104 void (*austext_exit_user) (int) = NULL;
105 void (*austext_exit_last) (int) = NULL;
108 /****************************************/
112 /****************************************/
113 void DtSearchExit (int return_code)
115 if (austext_exit_first != NULL)
116 austext_exit_first (return_code);
117 if (austext_exit_dbms != NULL)
118 austext_exit_dbms (return_code);
119 if (austext_exit_comm != NULL)
120 austext_exit_comm (return_code);
121 if (austext_exit_endwin != NULL)
122 austext_exit_endwin (return_code);
123 if (austext_exit_mem != NULL)
124 austext_exit_mem (return_code);
125 if (austext_exit_user != NULL)
126 austext_exit_user (return_code);
127 if (austext_exit_last != NULL)
128 austext_exit_last (return_code);
132 /****************************************/
134 /* DtSearchAddUserExit */
136 /****************************************/
137 void DtSearchAddUserExit (void (*user_exit)(int))
138 { austext_exit_user = user_exit; }
141 /****************************************/
143 /* DtSearchRemoveUserExit */
145 /****************************************/
146 void DtSearchRemoveUserExit (void)
147 { austext_exit_user = NULL; }
149 /********************* AUSEXIT.C ************************/