aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/sysid.x
blob: 94bd77bcec2856a2f0c2288d94eec25f56b9b8f3 (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
51
52
53
54
55
56
57
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.

# SYSID -- Return a line of text identifying the current user, machine, and
# version of IRAF, and containing the current date and time.  The format is
# as follows:
#
#	NOAO/IRAF V1.3 username@lyra Tue 09:47:50 27-Aug-85
#
# The string "NOAO/IRAF V1.3" is given by the value of the environment variable
# "version", defined in lib$clpackage.cl (unless redefined by the user).  The
# string "username" is the value of the environment variable "userid", defined
# by the user in the login.cl file.  The output string is not terminated by a
# newline.

procedure sysid (outstr, maxch)

char	outstr[maxch]			# receives id string
int	maxch

pointer	sp, buf
int	op, nchars
int	envfind(), gstrcpy()
long	clktime()

begin
	call smark (sp)
	call salloc (buf, SZ_LINE, TY_CHAR)

	nchars = envfind ("version", outstr, maxch)
	if (nchars <= 0)
	    nchars = gstrcpy ("NOAO/IRAF", outstr, maxch)

	op = nchars + 1
	outstr[op] = ' '
	op = op + 1

	# The variable "userid" is defined in the user's login.cl file.  This
	# gives the user the opportunity to set the value of this string to
	# something other than their host system login name.

	nchars = envfind ("userid", Memc[buf], SZ_LINE)

	op = op + gstrcpy (Memc[buf], outstr[op], maxch-op+1)
	outstr[op] = '@'
	op = op + 1

	call gethost (Memc[buf], SZ_LINE)
	op = op + gstrcpy (Memc[buf], outstr[op], maxch-op+1)
	outstr[op] = ' '
	op = op + 1

	call cnvtime (clktime(long(0)), Memc[buf], SZ_LINE)
	op = op + gstrcpy (Memc[buf], outstr[op], maxch-op+1)
	outstr[op] = EOS

	call sfree (sp)
end