1C Copyright 1981-2016 ECMWF.
2C
3C This software is licensed under the terms of the Apache Licence
4C Version 2.0 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
5C
6C In applying this licence, ECMWF does not waive the privileges and immunities
7C granted to it by virtue of its status as an intergovernmental organisation
8C nor does it submit to any jurisdiction.
9C
10
11      LOGICAL FUNCTION JFINDIR( ENVNAME, DIRNAME)
12C
13C---->
14C**** JFINDIR
15C
16C     Purpose
17C     _______
18C
19C     This routine finds the directory specified by an environment
20C     variable.
21C
22C     Interface
23C     _________
24C
25C     LFOUND = JFINDIR( ENVNAME, DIRNAME)
26C
27C     Input parameters
28C     ________________
29C
30C     ENVNAME - The environment variable.
31C
32C     Output parameters
33C     _________________
34C
35C     DIRNAME - The directory name (if found).
36C
37C     The function returns .TRUE. if the environment variable gives
38C     a directory name; otherwise it returns .FALSE.
39C
40C     Common block usage
41C     __________________
42C
43C     None.
44C
45C     Externals
46C     _________
47C
48C     Reference
49C     _________
50C
51C     GETENV  - to read the envirment variable.
52C
53C     Comments
54C     ________
55C
56C     None.
57C
58C     Author
59C     ______
60C
61C     J.D.Chambers      *ECMWF*      Mar 1996
62C
63C----<
64C     _______________________________________________________
65C
66      IMPLICIT NONE
67C
68C     Parameters
69Cjdc  INTEGER JPROUTINE
70Cjdc  PARAMETER ( JPROUTINE = 30800 )
71C
72C     Subroutine arguments
73      CHARACTER*(*) ENVNAME, DIRNAME
74C
75C     Local variables
76      INTEGER IBLANK
77C
78C     _______________________________________________________
79C
80C*    Section 1. Try the environment variable.
81C     _______________________________________________________
82C
83  100 CONTINUE
84C
85      JFINDIR = .TRUE.
86C
87      CALL GETENV(ENVNAME, DIRNAME)
88C
89C     See if a name was returned.
90      IBLANK = INDEX(DIRNAME, ' ')
91      IF ( IBLANK.LE.1 ) JFINDIR = .FALSE.
92C
93C     _______________________________________________________
94C
95C*    Section 9. Return.
96C     _______________________________________________________
97C
98  900 CONTINUE
99C
100      RETURN
101      END
102