Annotation of src/usr.bin/m4/expr.c, Revision 1.18
1.18 ! marco 1: /* $OpenBSD: expr.c,v 1.17 2006/01/20 23:10:19 espie Exp $ */
1.1 deraadt 2: /*
1.16 espie 3: * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
1.1 deraadt 4: *
1.16 espie 5: * Permission to use, copy, modify, and distribute this software for any
6: * purpose with or without fee is hereby granted, provided that the above
7: * copyright notice and this permission notice appear in all copies.
8: *
9: * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10: * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11: * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12: * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13: * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14: * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15: * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1 deraadt 16: */
1.17 espie 17: #include <stdint.h>
1.16 espie 18: #include <stdio.h>
1.10 espie 19: #include <stddef.h>
1.5 espie 20: #include "mdef.h"
1.10 espie 21: #include "extern.h"
1.1 deraadt 22:
1.16 espie 23: int32_t end_result;
24: const char *copy_toeval;
1.1 deraadt 25:
1.16 espie 26: extern void yy_scan_string(const char *);
27: extern int yyparse(void);
1.1 deraadt 28:
29: int
1.16 espie 30: yyerror(const char *msg)
1.1 deraadt 31: {
1.16 espie 32: fprintf(stderr, "m4: %s in expr %s\n", msg, copy_toeval);
33: return(0);
1.1 deraadt 34: }
35:
1.18 ! marco 36: int
1.16 espie 37: expr(const char *toeval)
1.1 deraadt 38: {
1.16 espie 39: copy_toeval = toeval;
40: yy_scan_string(toeval);
41: yyparse();
42: return end_result;
1.1 deraadt 43: }