diff options
author | Robert S. French <rfrench@mit.edu> | 1987-10-24 16:15:12 +0000 |
---|---|---|
committer | Robert S. French <rfrench@mit.edu> | 1987-10-24 16:15:12 +0000 |
commit | e2900ab316048cde6276b6c667cb20acf18cc8cd (patch) | |
tree | d2e587bab6ff1096fad72bd8302fce3a16a244e3 /lib/ZGetWGPort.c | |
parent | 2c820cf3a321c88a1ba334583dc0dbe2f930d4b8 (diff) |
Initial revision
Diffstat (limited to 'lib/ZGetWGPort.c')
-rw-r--r-- | lib/ZGetWGPort.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/ZGetWGPort.c b/lib/ZGetWGPort.c new file mode 100644 index 0000000..fbbff1f --- /dev/null +++ b/lib/ZGetWGPort.c @@ -0,0 +1,40 @@ +/* This file is part of the Project Athena Zephyr Notification System. + * It contains source for the ZGetWGPort function. + * + * Created by: Robert French + * + * $Source$ + * $Author$ + * + * Copyright (c) 1987 by the Massachusetts Institute of Technology. + * For copying and distribution information, see the file + * "mit-copyright.h". + */ +/* $Header$ */ + +#ifndef lint +static char rcsid_ZGetWGPort_c[] = "$Header$"; +#endif lint + +#include <zephyr/mit-copyright.h> + +#include <zephyr/zephyr_internal.h> + +int ZGetWGPort() +{ + char *envptr,name[128]; + FILE *fp; + int wgport; + + envptr = (char *)getenv("WGFILE"); + if (!envptr) { + sprintf(name,"/tmp/wg.%d",getuid()); + envptr = name; + } + if (!(fp = fopen(envptr,"r"))) + return (-1); + fscanf(fp,"%d",&wgport); + fclose(fp); + + return (wgport); +} |