1
/*===========================================================================
2
Copyright (C) 1993-2009 European Southern Observatory (ESO)
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU General Public License as
6
published by the Free Software Foundation; either version 2 of
7
the License, or (at your option) any later version.
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
14
You should have received a copy of the GNU General Public
15
License along with this program; if not, write to the Free
16
Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
19
Correspondence concerning ESO-MIDAS should be addressed as follows:
20
Internet e-mail: midas@eso.org
21
Postal address: European Southern Observatory
22
Data Management Division
23
Karl-Schwarzschild-Strasse 2
24
D 85748 Garching bei Muenchen
26
===========================================================================*/
28
/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
30
/* .AUTHORS Cristian Levin (ESO/La Silla) */
31
/* .KEYWORDS XIrspec */
33
/* .VERSION 1.0 Package Creation 27-OCT-1993
36
------------------------------------------------------- */
43
#include <irspec_defs.h>
45
#include <midas_def.h>
48
void IrspecSave( file, obj, sky, ststar, stsky, dark, flat )
50
char *obj, *sky, *ststar, *stsky, *dark, *flat;
55
for ( i = 0; file[i] != '\0'; i++ )
56
if ( file[i] == '.' ) {
63
if ( (fp = fopen(file, "w")) == NULL ) {
64
SCTPUT("*** Error: file could not be opened ***");
67
fprintf(fp, "#\n# File generated by the Irspec graphical interface\n#\n");
68
fprintf(fp, "object = %s\n", obj);
69
fprintf(fp, "sky = %s\n", sky);
70
fprintf(fp, "ststar = %s\n", ststar);
71
fprintf(fp, "stsky = %s\n", stsky);
72
fprintf(fp, "dark = %s\n", dark);
73
fprintf(fp, "flat = %s\n", flat);
78
void IrspecOpen( file )
83
char s[MAXLINE], str[MAXLINE], line[MAXLINE];
84
char type[MAXLINE], name[MAXLINE];
86
if ( (fp = fopen(file, "r")) == NULL ) {
87
SCTPUT("*** Error: file could not be opened ***");
91
while ( fgets(s, MAXLINE, fp) != NULL ) {
94
for ( i = 0, j = 0; s[i] != '\0'; i++ )
104
sscanf(line, "%s = %s", type, name);
105
if ( ! strcmp(type, "object") )
107
else if ( ! strcmp(type, "sky") )
109
else if ( ! strcmp(type, "ststar") )
110
strcpy(InStstar, name);
111
else if ( ! strcmp(type, "stsky") )
112
strcpy(InStsky, name);
113
else if ( ! strcmp(type, "dark") )
115
else if ( ! strcmp(type, "flat") )
118
sprintf(str, "*** line [%s] discarded ***", s);