aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/getuid.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/etc/getuid.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/etc/getuid.x')
-rw-r--r--sys/etc/getuid.x24
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/etc/getuid.x b/sys/etc/getuid.x
new file mode 100644
index 00000000..3da5bbba
--- /dev/null
+++ b/sys/etc/getuid.x
@@ -0,0 +1,24 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# GETUID -- Get user id, i.e., return the name of the user. We do this by
+# creating a temporary file and calling fowner to get the name of the file
+# owner.
+
+procedure getuid (user_name, maxch)
+
+char user_name[ARB]
+int maxch
+pointer sp, tempfile
+int open()
+
+begin
+ call smark (sp)
+ call salloc (tempfile, SZ_FNAME, TY_CHAR)
+
+ call mktemp ("tmp$uid", Memc[tempfile], SZ_FNAME)
+ call close (open (Memc[tempfile], NEW_FILE, BINARY_FILE))
+ call fowner (Memc[tempfile], user_name, maxch)
+ call delete (Memc[tempfile])
+
+ call sfree (sp)
+end