blob: 76d669298613eac42a6bcf5ad92ed919ce49e6d2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
*/
#include <stdio.h>
#include <ctype.h>
#define import_spp
#define import_kernel
#define import_knames
#include <iraf.h>
/* ZFPATH -- Return the absolute pathname equivalent of an OSFN. If the null
* string is given the OSFN of the current working directory is returned.
*/
int
ZFPATH (
XCHAR *osfn, /* input OS filename [NOT PACKED] */
XCHAR *pathname, /* output pathname [NOT PACKED] */
XINT *maxch,
XINT *nchars
)
{
register char *cp;
register XCHAR *ip, *op;
register int n = *maxch;
PKCHAR cwd[SZ_PATHNAME+1];
extern int ZFGCWD();
op = pathname;
for (ip=osfn; *ip == ' '; ip++)
;
/* If the OSFN begins with a / it is already an absolute pathname.
*/
if (*ip != '/') {
ZFGCWD (cwd, maxch, nchars);
for (cp=(char *)cwd; --n >= 0 && (*op = *cp++); op++)
;
}
/* Append the filename */
while (--n >= 0 && (*op = *ip++) != XEOS)
op++;
*op = XEOS;
*nchars = (op - pathname);
return (XOK);
}
|