aboutsummaryrefslogtreecommitdiff
path: root/sys/libc/cvfnbrk.c
blob: 346b07fb17645070265a29876ec83d09324a8de0 (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
/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
*/

#define	import_spp
#define	import_libc
#define import_knames
#include <iraf.h>


/* C_VFNBRK -- Break a virtual filename (or host filename) into its component
** parts, i.e., logical directory (ldir), root, and extension.  No characters
** are actually moved, rather, the offsets to the root and extn fields are
** returned as output arguments.
*/
void
c_vfnbrk (
  char	*vfn,			/* virtual filename (or osfn)	*/
  int	*root,			/* offset of root field.	*/
  int	*extn			/* offset of extn field.	*/
)
{
	XCHAR	sppvfn[SZ_PATHNAME];
	XINT    x_root = *root, x_extn = extn;

	ZFNBRK (c_strupk(vfn,sppvfn,SZ_PATHNAME), &x_root, &x_extn);

	/* Make offsets zero-indexed. */
	*root -= 1;
	*extn -= 1;
}