dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / ipf / lib / common / loglevel.c
blob47dd8bac0273669d4ff7d06c1e8369448b9540d6
1 /*
2 * Copyright (C) 1993-2001 by Darren Reed.
4 * See the IPFILTER.LICENCE file for details on licencing.
6 * $Id: loglevel.c,v 1.5 2001/06/09 17:09:24 darrenr Exp $
7 */
9 #include "ipf.h"
12 int loglevel(cpp, facpri, linenum)
13 char **cpp;
14 u_int *facpri;
15 int linenum;
17 int fac, pri;
18 char *s;
20 fac = 0;
21 pri = 0;
22 if (!*++cpp) {
23 fprintf(stderr, "%d: %s\n", linenum,
24 "missing identifier after level");
25 return -1;
28 s = strchr(*cpp, '.');
29 if (s) {
30 *s++ = '\0';
31 fac = fac_findname(*cpp);
32 if (fac == -1) {
33 fprintf(stderr, "%d: %s %s\n", linenum,
34 "Unknown facility", *cpp);
35 return -1;
37 pri = pri_findname(s);
38 if (pri == -1) {
39 fprintf(stderr, "%d: %s %s\n", linenum,
40 "Unknown priority", s);
41 return -1;
43 } else {
44 pri = pri_findname(*cpp);
45 if (pri == -1) {
46 fprintf(stderr, "%d: %s %s\n", linenum,
47 "Unknown priority", *cpp);
48 return -1;
51 *facpri = fac|pri;
52 return 0;