Skip to content
Snippets Groups Projects
Commit 056062c1 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Regular expression matching of conference and person names.

parent c0481e3b
No related branches found
No related tags found
No related merge requests found
Sat Dec 19 01:10:21 1992 Per Cederqvist (ceder@mauritz)
* src/libraries/regex: The GNU regexp package, now used in the
server.
* Config: Run ./configure in src/libraries/regex.
* src/libraries/Makefile: Enter the regex subdir.
Sun Sep 6 20:25:48 1992 Per Cederqvist (ceder@robert)
* Makefile: Server version is 1.2.5 (released beta).
......
Sat Dec 19 01:13:14 1992 Per Cederqvist (ceder@mauritz)
* services.h (re_lookup_person, re_lookup_conf): New functions.
* config.h (REGEXP_LEN): New constant.
* kom-errno.h (KOM_REGEX_ERROR): New error.
Sun Nov 22 16:04:11 1992 Per Cederqvist (ceder@mauritz)
* config.h (LOGACCESSES): New symbol.
......
Sat Dec 19 01:17:41 1992 Per Cederqvist (ceder@mauritz)
* Implement regexp matching, using GNU regex 0.11.
* cache.h, simple-cache.c (cached_no_of_existing_conferences,
cached_get_name): New functions.
* fncdef.txt (re_lookup_person, re_lookup_conf): New functions.
* prot-a.c (prot_a_is_legal_fnc): They are legal.
* regex-match.c: New file.
* server-config.c (REGEXP_LEN): Allow 1024 bytes of regexps.
* Makefile (ATOMS, ATOMS_SRCS): Include regex-match.{c,o}.
Tue Dec 1 00:17:23 1992 Linus Tolke Y (linus@mauritz)
* version.incl: Version 1.2.8.
......
#
# $Id: Makefile,v 0.26 1992/05/18 23:12:43 ceder Exp $
# $Id: Makefile,v 0.27 1992/12/19 00:32:36 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.26 1992/05/18 23:12:43 ceder Exp $
# $Id: Makefile,v 0.27 1992/12/19 00:32:36 ceder Exp $
include Topdir.make
SCRIPTDIR = $(TOPDIR)/scripts
......@@ -58,8 +58,10 @@ MUX = mux.o mux-parse.o
MUX_SRCS = mux.c mux-parse.c
# Implementations of the atomic calls.
ATOMS = text.o membership.o person.o conference.o session.o admin.o
ATOMS_SRCS = text.c membership.c person.c conference.c session.c admin.c
ATOMS = text.o membership.o person.o conference.o session.o admin.o \
regex-match.o
ATOMS_SRCS = text.c membership.c person.c conference.c session.c admin.c \
regex-match.o
# These files are needed by all versions of the LysKOM server.
GENOBJS = connections.o log.o $(ATOMS) \
......
/*
* $Id: regex-match.c,v 1.1 1992/12/19 00:32:39 ceder Exp $
* Copyright (C) 1992 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
*
* LysKOM is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* LysKOM is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License
* along with LysKOM; see the file COPYING. If not, write to
* Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
* or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
* MA 02139, USA.
*
* Please mail bug reports to bug-lyskom@lysator.liu.se.
*/
/*
* Regexp matching
*/
static char *rcsid = "$Id: regex-match.c,v 1.1 1992/12/19 00:32:39 ceder Exp $";
#include <sys/types.h>
#include <regex.h>
#include <kom-errno.h>
#include <kom-types.h>
#include "s-string.h"
#include "s-collat-tabs.h"
#include <services.h>
static const int CHUNK = 10;
static Success
lookup_regexp (const String regexp,
Conf_no_list *result,
Boolean want_persons)
{
struct re_pattern_buffer pat_buf;
Conf_no conf;
Small_conf *small;
/* +++ 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;
pat_buf.translate = swedish_collate_tab;
pat_buf.fastmap = 1;
pat_buf.allocated = 0;
pat_buf.buffer = 0;
if (re_compile_pattern(regexp.string, s_strlen(regexp), 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)
{
name = cached_get_conf_name(conf_no);
switch ( re_search (pat_buf, name.string, s_strlen(name), 0,
s_strlen(name), NULL) )
{
case -1:
break;
case -2:
log("Internal error in regex.");
break;
default:
/* It matched. (Ignore where it matched). */
result->conf_nos[result->no_of_confs++] = conf_no;
break;
}
}
}
return SUCCESS;
}
Success
re_lookup_person (const String regexp,
Conf_no_list *result)
{
return lookup_regexp(regexp, result, TRUE);
}
Success
re_lookup_conf (const String regexp,
Conf_no_list *result)
{
return lookup_regexp(regexp, result, FALSE);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment