-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhds1_cleanup.c
109 lines (84 loc) · 3.17 KB
/
hds1_cleanup.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
101
102
103
104
105
106
107
108
109
#if HAVE_CONFIG_H
# include <config.h>
#endif
#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 */
int hds1_cleanup( int *status )
{
/*
*+
* Name:
* hds1_cleanup
* Purpose:
* Close down and clean up HDS.
* Language:
* ANSI C
* Invocation:
* hds1_cleanup( status )
* Description:
* This routine closes down HDS, annulling all active locators,
* closing all container files and releasing all associated
* resources. It returns without action if HDS is not active.
* Arguments:
* STATUS = INTEGER (Given and Returned)
* The global status.
* Notes:
* This routine attempts to execute even if STATUS is set on entry,
* although no further error report will be made if it subsequently
* fails under these circumstances.
* Copyright:
* Copyright (C) 2006 Particle Physics and Astronomy Research 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:
* BC: Brad Cavanagh (JAC, Hawaii)
* {enter_new_authors_here}
* History:
* 28-NOV-2006 (BC):
* Code moved from hdsStop().
* {enter_changes_here}
* Bugs:
* {note_any_bugs_here}
*-
*/
/* Local Variables: */
struct LCP *lcp;
/* Dereference the status pointer. */
hds_gl_status = *status;
/* Check that HDS is active. There is nothing to do if it is not. */
if ( hds_gl_active )
{
/* Defuse all Locator Control Packets. */
while ( dat_ga_wlq != NULL )
{
lcp = dat_ga_wlq;
dau_defuse_lcp( &lcp );
}
/* Free memory associated with Locator Control Queue */
dau_free_flq( );
/* Close down the rec_ facility. */
rec_stop( );
/* Note that HDS is no longer active. */
hds_gl_active = 0;
}
*status = hds_gl_status;
/* Exit the routine. */
return *status;
}