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

« back to all changes in this revision

Viewing changes to libsrc/agl/aglunix.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
/* @(#)aglunix.c        19.1 (ES0-DMD) 02/25/03 13:53:05 */
 
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
/* @(#)aglunix.c        19.1  (OAA-ASTRONET) 02/25/03 13:53:05   */
 
30
/*
 
31
 * HEADER : aglunix.c      - Vers 3.6.001  - Oct 1992 -  L. Fini, OAA
 
32
 *
 
33
 * This file contains system dependent features which are common to all
 
34
 * blends of Unix systems
 
35
 *
 
36
 */
 
37
 
 
38
 
 
39
 
 
40
void AGL_trns(inpname,maxlng,trnslnam)  /* Get environment variable        */
 
41
                                        /* Returns equivalence string (or  */
 
42
                                        /* the input string if not defined)*/
 
43
char *inpname;                          /* Input name (Environment var.)   */
 
44
int  maxlng;                            /* Max output string length        */
 
45
char *trnslnam;                         /* Output equivalence name         */
 
46
{
 
47
char wrk_str[PHNAMLNG];
 
48
char *getenv();
 
49
char *work;
 
50
int retlng;
 
51
 
 
52
strncpy(wrk_str,inpname,PHNAMLNG);
 
53
 
 
54
work=getenv(wrk_str);
 
55
 
 
56
if(work==NULL) 
 
57
        work=wrk_str;
 
58
 
 
59
retlng=strlen(work);
 
60
 
 
61
if(retlng>=maxlng) 
 
62
        retlng=maxlng-1;
 
63
 
 
64
strncpy(trnslnam,work,retlng);
 
65
*(trnslnam+retlng)='\0';
 
66
}
 
67
 
 
68
 
 
69
 
 
70
/***************************************************************************/
 
71
/*                              AGL_fopen                                   */
 
72
 
 
73
/* This routine is used to open an i/o channel to a terminal. It must take */
 
74
/* into account system specific details. E.g. VMS systems will always open */
 
75
/* an I/O channel to be used for subsequent SYS$QIO calls, whereas Unix    */
 
76
/* systems will probably simply issue a standard open call.                */
 
77
/* The function must recognize the device name "tt" and return stdout      */
 
78
 
 
79
FILE *AGL_fopen (fname)
 
80
char * fname;                 /* Device name (if it is tt, unix systems    */
 
81
                              /* will simply return stdout)                */
 
82
{
 
83
if((*fname == 't')&&(*(fname+1)=='t')) 
 
84
        return(stdout);
 
85
else
 
86
        return(fopen(fname,"w+"));
 
87
}
 
88