summaryrefslogtreecommitdiff
path: root/bin/Uniqueid.pm
diff options
context:
space:
mode:
authorbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-07-20 22:25:25 +0000
committerbrunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-07-20 22:25:25 +0000
commita0ec8021f8840e4591cac91def3200ea8ac79c82 (patch)
tree9494c5492212dc0024d11da4d1bf1c2088ce06ba /bin/Uniqueid.pm
parent55e7da4f8bbc5499270246819d5028b2d72753d5 (diff)
downloadATCD-a0ec8021f8840e4591cac91def3200ea8ac79c82.tar.gz
Common functionality for perl files
Diffstat (limited to 'bin/Uniqueid.pm')
-rw-r--r--bin/Uniqueid.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/Uniqueid.pm b/bin/Uniqueid.pm
new file mode 100644
index 00000000000..f1367caa6e4
--- /dev/null
+++ b/bin/Uniqueid.pm
@@ -0,0 +1,28 @@
+# $Id$
+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 ());
+ }
+}
+
+1; \ No newline at end of file