aboutsummaryrefslogtreecommitdiff
path: root/sys/fmtio/gargstr.x
blob: 9ae3046258e09bd433b44859e725b72f211d8912 (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
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

# GARGSTR -- Return the remainder of the scanned input line as a string.

procedure gargstr (outstr, maxch)

char	outstr[ARB]
int	maxch, op
include	"scan.com"

begin
	if (sc_stopscan)
	    return

	for (op=1;  op <= maxch && sc_scanbuf[sc_ip] != EOS;  op=op+1) {
	    if (sc_scanbuf[sc_ip] == '\n')
		break					# don't keep newlines
	    outstr[op] = sc_scanbuf[sc_ip]
	    sc_ip = sc_ip + 1
	}

	outstr[op] = EOS
	sc_ntokens = sc_ntokens + 1			# null strings are ok
end