1
/* @(#)tbgetpar.c 19.1 (ES0-DMD) 02/25/03 14:11:13 */
2
/*===========================================================================
3
Copyright (C) 1995 European Southern Observatory (ESO)
5
This program is free software; you can redistribute it and/or
6
modify it under the terms of the GNU General Public License as
7
published by the Free Software Foundation; either version 2 of
8
the License, or (at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public
16
License along with this program; if not, write to the Free
17
Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
20
Corresponding concerning ESO-MIDAS should be addressed as follows:
21
Internet e-mail: midas@eso.org
22
Postal address: European Southern Observatory
23
Data Management Division
24
Karl-Schwarzschild-Strasse 2
25
D 85748 Garching bei Muenchen
27
===========================================================================*/
29
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
33
.AUTHOR IPG-ESO Garching
34
.CATEGORY table utilities
36
Interfaces to parmeter access.
38
.VERSION 1.0 25-Mar-1989 Definition J.D. Ponz
39
.VERSION 1.1 04-Jul-1990 Added tbl_getarg, tbl_argc
40
.VERSION 1.1 09-Oct-1990: arg#2 of tbl_getpar is LENGTH, not SIZE.
41
------------------------------------------------------------*/
43
#include <midas_def.h>
45
/*=================================================================*/
46
tbl_getpar(par,len,value)
48
.PURPOSE Read named parameter
51
char *par; /* IN: Name of parameter to read */
52
int len; /* IN: maximum length of the parameter */
53
char value[]; /* OUT: parameter value */
56
int status, iav, knul;
59
status = SCKRDC(par,1,1,len,&iav,value,&kunit,&knul);
61
if (status != ERR_NORMAL) {
62
SCTPUT(" Error reading parameter ");
66
while ((iav > 0) && (value[--iav] == ' ')) value[iav] = '\0';
71
tbl_getarg(argno, len, value)
73
.PURPOSE Read specified argument, i.e. parameter Pn
76
int argno; /* IN: Number of Argument to read */
77
int len; /* IN: maximum size of the parameter */
78
char value[]; /* OUT: parameter value */
83
sprintf(field, "P%d", argno);
84
return (tbl_getpar(field, len-1, value));
89
.PURPOSE Read how many arguments exist.
90
.RETURNS Number of arguments
93
int nar,npar,kunit,knul;
95
SCKRDI("PCOUNT",1,1,&nar,&npar,&kunit,&knul);