~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to prim/table/libsrc/tbgetpar.c

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)tbgetpar.c       19.1 (ES0-DMD) 02/25/03 14:11:13 */
 
2
/*===========================================================================
 
3
  Copyright (C) 1995 European Southern Observatory (ESO)
 
4
 
 
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.
 
9
 
 
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.
 
14
 
 
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, 
 
18
  MA 02139, USA.
 
19
 
 
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 
 
26
                        GERMANY
 
27
===========================================================================*/
 
28
 
 
29
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
30
.TYPE        Module
 
31
.NAME        tbgetpar.c
 
32
.LANGUAGE    C
 
33
.AUTHOR      IPG-ESO Garching
 
34
.CATEGORY    table utilities
 
35
.COMMENTS
 
36
        Interfaces to parmeter access.
 
37
 
 
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
------------------------------------------------------------*/
 
42
 
 
43
#include <midas_def.h>
 
44
 
 
45
/*=================================================================*/
 
46
tbl_getpar(par,len,value)
 
47
/*++++++++++++++++++
 
48
.PURPOSE Read named parameter
 
49
.RETURNS Status
 
50
------------------*/
 
51
    char *par;          /* IN: Name of parameter to read */
 
52
    int  len;           /* IN: maximum length of the parameter */
 
53
    char value[];       /* OUT: parameter value */
 
54
 
55
  char *kunit;
 
56
  int  status, iav, knul;
 
57
 
 
58
                                                /* read parameter */
 
59
  status = SCKRDC(par,1,1,len,&iav,value,&kunit,&knul);
 
60
 
 
61
  if (status != ERR_NORMAL) {
 
62
        SCTPUT(" Error reading parameter ");
 
63
        return (status);
 
64
  }
 
65
  value[iav] = '\0';
 
66
  while ((iav > 0) && (value[--iav] == ' '))    value[iav] = '\0';
 
67
 
 
68
  return (status);
 
69
}
 
70
 
 
71
tbl_getarg(argno, len, value)
 
72
/*++++++++++++++++++
 
73
.PURPOSE Read specified argument, i.e. parameter Pn
 
74
.RETURNS Status
 
75
------------------*/
 
76
    int argno;          /* IN: Number of Argument to read */
 
77
    int  len;           /* IN: maximum size of the parameter */
 
78
    char value[];       /* OUT: parameter value */
 
79
 
80
  
 
81
  char field[16];
 
82
 
 
83
  sprintf(field, "P%d", argno);
 
84
  return (tbl_getpar(field, len-1, value));
 
85
}
 
86
 
 
87
int tbl_argc()
 
88
/*++++++++++++++++++
 
89
.PURPOSE Read how many arguments exist.
 
90
.RETURNS Number of arguments
 
91
------------------*/
 
92
 
93
        int     nar,npar,kunit,knul;
 
94
  
 
95
  SCKRDI("PCOUNT",1,1,&nar,&npar,&kunit,&knul);
 
96
  return (npar);
 
97
}