Commit 2428c242 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Some trivial bug-fixes.

parent 9d43e410
#
# $Id: Makefile,v 0.27 1992/12/19 00:32:36 ceder Exp $
# $Id: Makefile,v 0.28 1992/12/19 01:56:20 ceder Exp $
# Copyright (C) 1991 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
......@@ -22,7 +22,7 @@
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
#
# $Id: Makefile,v 0.27 1992/12/19 00:32:36 ceder Exp $
# $Id: Makefile,v 0.28 1992/12/19 01:56:20 ceder Exp $
include Topdir.make
SCRIPTDIR = $(TOPDIR)/scripts
......@@ -41,7 +41,7 @@ HDRS = admin.h isc-parse.h prot-a-output.h async.h isc-interface.h \
LIBS = -lisc-new$(PROFILE-LIB-SUFFIX) -lmisc$(PROFILE-LIB-SUFFIX) \
-llyskom-server$(PROFILE-LIB-SUFFIX) -lansi$(PROFILE-LIB-SUFFIX) \
$(LIBRESOLV) $(LIBIDENT)
$(LIBRESOLV) $(LIBIDENT) -lregex
TARGET = -DSERVER
......
/*
* $Id: regex-match.c,v 1.1 1992/12/19 00:32:39 ceder Exp $
* $Id: regex-match.c,v 1.2 1992/12/19 01:56:23 ceder Exp $
* Copyright (C) 1992 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -27,7 +27,7 @@
* Regexp matching
*/
static char *rcsid = "$Id: regex-match.c,v 1.1 1992/12/19 00:32:39 ceder Exp $";
static char *rcsid = "$Id: regex-match.c,v 1.2 1992/12/19 01:56:23 ceder Exp $";
#include <sys/types.h>
#include <regex.h>
......@@ -37,40 +37,50 @@ static char *rcsid = "$Id: regex-match.c,v 1.1 1992/12/19 00:32:39 ceder Exp $";
#include "s-string.h"
#include "s-collat-tabs.h"
#include <services.h>
static const int CHUNK = 10;
#include <server/smalloc.h>
#include "cache.h"
#include "log.h"
#include "manipulate.h"
#include "com.h"
#include "connections.h"
static Success
lookup_regexp (const String regexp,
Conf_no_list *result,
Boolean want_persons)
Bool want_persons)
{
struct re_pattern_buffer pat_buf;
Conf_no conf;
Small_conf *small;
Conf_no conf_no;
String name = EMPTY_STRING;
char *errmsg;
/* +++ Unnecessary to allocate this much if only one conference matches. */
result->conf_nos = tmp_alloc (cached_no_of_existing_conferences()
* sizeof(Conf_no));
result->no_of_confs = 0;
re_syntax_options = RE_SYNTAX_GREP;
pat_buf.translate = swedish_collate_tab;
pat_buf.fastmap = 1;
pat_buf.translate = NULL;
pat_buf.fastmap = 0;
pat_buf.allocated = 0;
pat_buf.buffer = 0;
if (re_compile_pattern(regexp.string, s_strlen(regexp), pat_buf))
if (errmsg = re_compile_pattern(regexp.string, s_strlen(regexp), &pat_buf))
{
regfree(&pat_buf);
kom_errno = KOM_REGEX_ERROR;
return FAILURE;
}
for (conf_no = 0; (conf_no = traverse_conference(conf_no)) != 0;)
{
if (cached_get_conf_type(conf_no).letter_box == want_persons)
if (cached_get_conf_type(conf_no).letter_box == want_persons
&& fast_access_perm (conf_no, ACTPERS, ACT_P) > none )
{
name = cached_get_conf_name(conf_no);
switch ( re_search (pat_buf, name.string, s_strlen(name), 0,
name = cached_get_name(conf_no);
switch ( re_search (&pat_buf, name.string, s_strlen(name), 0,
s_strlen(name), NULL) )
{
case -1:
......@@ -86,7 +96,9 @@ lookup_regexp (const String regexp,
}
}
return SUCCESS;
regfree(&pat_buf);
return OK;
}
Success
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment