+long ft_newhighest = 0L;
+long *ft_newmsgs = NULL;
+int ft_num_msgs = 0;
+int ft_num_alloc = 0;
+
+
+void ft_index_msg(long msgnum, void *userdata) {
+
+ if ((msgnum > CitControl.MMfulltext) && (msgnum <= ft_newhighest)) {
+ ++ft_num_msgs;
+ if (ft_num_msgs > ft_num_alloc) {
+ ft_num_alloc += 1024;
+ ft_newmsgs = realloc(ft_newmsgs, (ft_num_alloc * sizeof(long)));
+ }
+ ft_newmsgs[ft_num_msgs - 1] = msgnum;
+ }
+
+}
+
+/*
+ * Scan a room for messages to index.
+ */
+void ft_index_room(struct ctdlroom *qrbuf, void *data)
+{
+ getroom(&CC->room, qrbuf->QRname);
+ CtdlForEachMessage(MSGS_ALL, 0L, NULL, NULL, ft_index_msg, NULL);
+}
+
+
+/*
+ * Compare function
+ */
+int longcmp(const void *rec1, const void *rec2) {
+ long i1, i2;
+
+ i1 = *(const long *)rec1;
+ i2 = *(const long *)rec2;
+
+ if (i1 > i2) return(1);
+ if (i1 < i2) return(-1);
+ return(0);
+}
+
+
+