aboutsummaryrefslogtreecommitdiff
path: root/sys/fio/fstrfp.x
blob: 851bb6b1ec447a167edf562af3e261b2991e3acf (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

include	<config.h>
include	<fio.h>

# FSTRFP -- Get a dummy file descriptor for use by STROPEN "files".
# The static part of the descriptor is returned to later be allocated
# by STROPEN.  The dynamic part is permanently allocated, and is used to
# make the string look more like a regular file.

procedure fstrfp (newfp)

pointer	newfp
pointer	str_fp
int	fd, fgetfd()
data	str_fp /NULL/
include	<fio.com>

begin
	if (str_fp == NULL) {
	    fd = fgetfd ("String_File", STRING_FILE, STRING_FILE)
	    str_fp = fiodes[fd]
	    fiodes[fd] = NULL
	}

	newfp = str_fp
end