-
Notifications
You must be signed in to change notification settings - Fork 1
/
hds1_exit.c
100 lines (80 loc) · 5.64 KB
/
hds1_exit.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include "ems.h" /* EMS error reporting routines */
#include "hds1.h" /* Global definitions for HDS */
#include "rec.h" /* Public rec_ definitions */
#include "str.h" /* Character string import/export macros */
#include "dat1.h" /* Internal dat_ definitions */
#include "dat_err.h" /* DAT__ error code definitions */
#include "hds.h"
void hds1_exit( void )
{
/*+ */
/* Name: */
/* hds1_exit */
/* Purpose: */
/* HDS exit handler - close down HDS. */
/* Invocation: */
/* hds1_exit( ) */
/* Description: */
/* This function acts as an exit handler for HDS. It is intended to */
/* execute immediately before a program terminates, at which point it */
/* will close HDS down, annulling all Locator Control Packets and */
/* flushing all internal buffers as if HDS_STOP had been called. */
/* Parameters: */
/* void */
/* Returned Value: */
/* void */
/* Notes: */
/* This routine takes no action if HDS is not active. */
/* Copyright: */
/* Copyright (C) 1992 Science & Engineering Research Council */
/* Copyright (C) 2006 Particle Physics and Astronomy Research Council */
/* Copyright (C) 2007 Science and Technology Facilities Council */
/* All Rights Reserved */
/* Licence: */
/* This program is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU General Public License as */
/* published by the Free Software Foundation; either version 2 of */
/* the License, or (at your option) any later version. */
/* This program is distributed in the hope that it will be */
/* useful, but WITHOUT ANY WARRANTY; without even the implied */
/* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR */
/* PURPOSE. See the GNU General Public License for more details. */
/* You should have received a copy of the GNU General Public */
/* License along with this program; if not, write to the Free */
/* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, */
/* MA 02110-1301, USA */
/* Authors: */
/* RFWS: R.F. Warren-Smith (STARLINK) */
/* TIMJ: Tim Jenness (JAC, Hawaii) */
/* BC: Brad Cavanagh (JAC, Hawaii) */
/* {@enter_new_authors_here@} */
/* History: */
/* 4-APR-1991 (RFWS): */
/* Original version. */
/* 25-SEP-1992 (RFWS): */
/* Revised method of traversing working locator queue. */
/* 01-FEB-2006 (TIMJ): */
/* Call hdsStop rather than duplicating code */
/* 28-NOV-2006 (BC): */
/* Replace hdsStop with hds1_cleanup. */
/* 14-JUN-2006 (BC): */
/* Allow for HDS_DISABLE_CLEANUP environment variable to disable HDS */
/* cleanup from happening. */
/* 20-JUN-2006 (TIMJ): */
/* Move exit handler disabling to dat1_init.c. It seems that a SEGV */
/* can corrupt the environment which leads to a getenv segv. */
/* {@enter_changes_here@} */
/* Bugs: */
/* {@note_any_bugs_here@} */
/*- */
/* Local Variables: */
int status = DAT__OK; /* Local status for hdsStop */
/*. */
/* Close down everything */
hds1_cleanup( &status );
/* Exit the routine. */
return;
}