From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/fio/fnroot.x | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 sys/fio/fnroot.x (limited to 'sys/fio/fnroot.x') diff --git a/sys/fio/fnroot.x b/sys/fio/fnroot.x new file mode 100644 index 00000000..91042e87 --- /dev/null +++ b/sys/fio/fnroot.x @@ -0,0 +1,21 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# FNROOT -- Extract the root file name from a virtual file name (or from a +# machine dependent filename. If the VFN contains no root name, the null +# string is returned. This occurs when the VFN refers to a directory or +# device, or when the VFN string is a null string. The number of chars in +# the root file name is returned as the function value. + +int procedure fnroot (vfn, outstr, maxch) + +char vfn[ARB], outstr[maxch] +int maxch +int root_offset, extn_offset, nchars_root +int gstrcpy() + +begin + call zfnbrk (vfn, root_offset, extn_offset) + nchars_root = max(0, min(maxch, extn_offset - root_offset)) + + return (gstrcpy (vfn[root_offset], outstr, nchars_root)) +end -- cgit