changeset 42:d318f8048925

Let find_subscriber return the offset of the subscriber in the subscriber file.
author mmj
date Sun, 25 Apr 2004 01:17:56 +1000
parents 57cc975a4721
children 3927a32c3361
files src/subscriberfuncs.c
diffstat 1 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/subscriberfuncs.c	Sat Apr 24 20:27:16 2004 +1000
+++ b/src/subscriberfuncs.c	Sun Apr 25 01:17:56 2004 +1000
@@ -19,8 +19,9 @@
 #include "subscriberfuncs.h"
 #include "mygetline.h"
 #include "log_error.h"
+#include "wrappers.h"
 
-int find_subscriber(int fd, const char *address)
+off_t find_subscriber(int fd, const char *address)
 {
 	char *start, *cur, *next;
 	struct stat st;
@@ -43,7 +44,7 @@
 			if((strlen(address) == len) &&
 			   (strncasecmp(address, cur, len) == 0)) {
 				munmap(start, st.st_size);
-				return 0;
+				return (off_t)(cur - start);
 			}
 			cur = next + 1;
 		}
@@ -54,10 +55,10 @@
 		if((strlen(address) == len) &&
 		   (strncasecmp(address, cur, len) == 0)) {
 			munmap(start, st.st_size);
-			return 0;
+			return (off_t)(cur - start);
 		}
 	}
 	
 	munmap(start, st.st_size);
-	return 1;
+	return (off_t)-1;
 }