view lib/xregcomp.c @ 1025:f19286ac3e7f draft

syslogd: cleanup - simplify resolveconfig() -> now logger_lookup is also used in syslogd.c - inline addrfds - small cosmetical changes in parse_config_file()
author Felix Janda <felix.janda at posteo.de>
date Fri, 23 Aug 2013 22:19:55 +0200
parents 786841fdb1e0
children
line wrap: on
line source

/* Call regcomp() and handle errors.
 *
 * Copyright 2007 Rob Landley <rob@landley.net>
 *
 * This is a separate file so environments that haven't got regular expression
 * support can configure this out and avoid a build break.
 */

#include "toys.h"
#include "xregcomp.h"

void xregcomp(regex_t *preg, char *regex, int cflags)
{
  int rc = regcomp(preg, regex, cflags);

  if (rc) {
    char msg[256];
    regerror(rc, preg, msg, 255);
    msg[255]=0;
    error_exit("xregcomp: %s", msg);
  }
}