summaryrefslogtreecommitdiff
path: root/bin/ACEutils.pm
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-08-06 19:44:53 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-08-06 19:44:53 +0000
commitba7741adca66d7e8cdb01987a20bbeda57796db7 (patch)
tree21b78e6a379278b636c42db318b5340b8f6cd3fe /bin/ACEutils.pm
parent484cc79f39edb592aeaf962c7e99982d32eec687 (diff)
downloadATCD-ba7741adca66d7e8cdb01987a20bbeda57796db7.tar.gz
This is where all the useful Perl subroutines will be put.
Diffstat (limited to 'bin/ACEutils.pm')
-rw-r--r--bin/ACEutils.pm37
1 files changed, 37 insertions, 0 deletions
diff --git a/bin/ACEutils.pm b/bin/ACEutils.pm
new file mode 100644
index 00000000000..3109aad3504
--- /dev/null
+++ b/bin/ACEutils.pm
@@ -0,0 +1,37 @@
+# $Id$
+
+# Returns a unique id, uid for unix, last digit of IP for NT
+sub uniqueid
+{
+ if ($^O eq "MSWin32")
+ {
+ my $uid = 1;
+
+ open (IPNUM, "ipconfig|") || die "Can't run ipconfig: $!\n";
+
+ while (<IPNUM>)
+ {
+ if (/Address/)
+ {
+ $uid = (split (/: (\d+)\.(\d+)\.(\d+)\.(\d+)/))[4];
+ }
+ }
+
+ close IPNUM;
+
+ return $uid;
+ }
+ else
+ {
+ return getpwnam (getlogin ());
+ }
+}
+
+# Waits until a file exists
+sub waitforfile
+{
+ local($file) = @_;
+ sleep 1 while (!(-e $file));
+}
+
+1; \ No newline at end of file