summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Robert S. French <rfrench@mit.edu>1987-06-30 21:49:13 +0000
committerGravatar Robert S. French <rfrench@mit.edu>1987-06-30 21:49:13 +0000
commit273243bb3b49c5a41363d7d43aaf0925db0d19ae (patch)
tree5d30d3b54784b93361010915613a5ea0c2aa2f03
parent7f773a438f9c3848a6cbce6ec9574ad60e753ec4 (diff)
release time...
-rw-r--r--lib/ZFlsLocs.c7
-rw-r--r--lib/ZGetLocs.c2
-rw-r--r--lib/ZLocateU.c16
-rw-r--r--lib/ZLocations.c32
4 files changed, 22 insertions, 35 deletions
diff --git a/lib/ZFlsLocs.c b/lib/ZFlsLocs.c
index 2f162c1..40a9c43 100644
--- a/lib/ZFlsLocs.c
+++ b/lib/ZFlsLocs.c
@@ -23,8 +23,11 @@ Code_t ZFlushLocations()
if (!__locate_list)
return (ZERR_NONE);
- for (i=0;i<__locate_num;i++)
- free(__locate_list[i]);
+ for (i=0;i<__locate_num;i++) {
+ free(__locate_list[i].host);
+ free(__locate_list[i].time);
+ }
+
free(__locate_list);
__locate_list = 0;
diff --git a/lib/ZGetLocs.c b/lib/ZGetLocs.c
index 3c2c3c9..bf9109d 100644
--- a/lib/ZGetLocs.c
+++ b/lib/ZGetLocs.c
@@ -19,7 +19,7 @@
#define min(a,b) ((a)<(b)?(a):(b))
Code_t ZGetLocations(location,numlocs)
- char *location[];
+ ZLocations_t *location;
int *numlocs;
{
int i;
diff --git a/lib/ZLocateU.c b/lib/ZLocateU.c
index 42a1218..351ad09 100644
--- a/lib/ZLocateU.c
+++ b/lib/ZLocateU.c
@@ -63,15 +63,23 @@ Code_t ZLocateUser(user,nlocs)
if (!*ptr)
__locate_num++;
- __locate_list = (char **)malloc(__locate_num*sizeof(char *));
+ __locate_num /= 2;
+
+ __locate_list = (ZLocations_t *)malloc(__locate_num*
+ sizeof(ZLocations_t));
if (!__locate_list)
return (ENOMEM);
for (ptr=retnotice.z_message,i=0;i<__locate_num;i++) {
- __locate_list[i] = (char *)malloc(strlen(ptr)+1);
- if (!__locate_list[i])
+ __locate_list[i].host = (char *)malloc(strlen(ptr)+1);
+ if (!__locate_list[i].host)
+ return (ENOMEM);
+ strcpy(__locate_list[i].host,ptr);
+ ptr += strlen(ptr)+1;
+ __locate_list[i].time = (char *)malloc(strlen(ptr)+1);
+ if (!__locate_list[i].time)
return (ENOMEM);
- strcpy(__locate_list[i],ptr);
+ strcpy(__locate_list[i].time,ptr);
ptr += strlen(ptr)+1;
}
diff --git a/lib/ZLocations.c b/lib/ZLocations.c
index 0da0f90..9530c08 100644
--- a/lib/ZLocations.c
+++ b/lib/ZLocations.c
@@ -1,5 +1,5 @@
/* This file is part of the Project Athena Zephyr Notification System.
- * It contains source for the ZSetLocation.c function.
+ * It contains source for the ZSetLocation function.
*
* Created by: Robert French
*
@@ -21,10 +21,8 @@
Code_t ZSetLocation()
{
- int retval,quiet;
- ZNotice_t notice,retnotice;
- ZPacket_t buffer;
char bfr[BUFSIZ];
+ int quiet;
struct passwd *pw;
quiet = 0;
@@ -32,29 +30,7 @@ Code_t ZSetLocation()
sprintf(bfr,"%s/.hideme",pw->pw_dir);
quiet = !access(bfr,F_OK);
}
-
- notice.z_kind = ACKED;
- notice.z_port = 0;
- notice.z_class = LOGIN_CLASS;
- notice.z_class_inst = ZGetSender();
- notice.z_opcode = quiet?LOGIN_QUIET_LOGIN:LOGIN_USER_LOGIN;
- notice.z_sender = 0;
- notice.z_recipient = "";
- notice.z_message_len = 0;
-
- if ((retval = ZSendNotice(&notice,1)) != ZERR_NONE)
- return (retval);
-
- if ((retval = ZIfNotice(buffer,sizeof buffer,&retnotice,0,
- ZCompareUIDPred,(char *)&notice.z_uid)) !=
- ZERR_NONE)
- return (retval);
-
- if (retnotice.z_kind == SERVNAK)
- return (ZERR_SERVNAK);
-
- if (retnotice.z_kind != SERVACK)
- return (ZERR_INTERNAL);
- return (ZERR_NONE);
+ return (Z_SendLocation(LOGIN_CLASS,quiet?LOGIN_QUIET_LOGIN:
+ LOGIN_USER_LOGIN));
}