lex_test.c revision f73e404eb9e1d314f85128cae48cdee036b405ec
5cd4555ad444fd391002ae32450572054369fd42Rob Austein * Copyright (C) 1998, 1999, 2000 Internet Software Consortium.
689023771c563d8660e45d439a207e06e96de28fMark Andrews * Permission to use, copy, modify, and distribute this software for any
869a7fe8e0eb29a55f5e73dc8ba73a668df412ebTinderbox User * purpose with or without fee is hereby granted, provided that the above
689023771c563d8660e45d439a207e06e96de28fMark Andrews * copyright notice and this permission notice appear in all copies.
689023771c563d8660e45d439a207e06e96de28fMark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
689023771c563d8660e45d439a207e06e96de28fMark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
689023771c563d8660e45d439a207e06e96de28fMark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
689023771c563d8660e45d439a207e06e96de28fMark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
689023771c563d8660e45d439a207e06e96de28fMark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
689023771c563d8660e45d439a207e06e96de28fMark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
689023771c563d8660e45d439a207e06e96de28fMark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
869a7fe8e0eb29a55f5e73dc8ba73a668df412ebTinderbox User fprintf(stream, "NUMBER %lu", tokenp->value.as_ulong);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein fprintf(stream, "SPECIAL %c", tokenp->value.as_char);
689023771c563d8660e45d439a207e06e96de28fMark Andrews FATAL_ERROR(__FILE__, __LINE__, "Unexpected type %d",
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein unsigned int options = 0;
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein while ((c = isc_commandline_parse(argc, argv, "qmcs")) != -1) {
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein switch (c) {
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS);
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein /* Set up to lex DNS master file. */
08c90261660649ca7d92065f6f13a61ec5a9a86dMark Andrews options = ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE |
689023771c563d8660e45d439a207e06e96de28fMark Andrews isc_lex_setcomments(lex, ISC_LEXCOMMENT_DNSMASTERFILE);
689023771c563d8660e45d439a207e06e96de28fMark Andrews /* Set up to lex DNS config file. */
268a4475065fe6a8cd7cc707820982cf5e98f430Rob Austein RUNTIME_CHECK(isc_lex_openstream(lex, stdin) == ISC_R_SUCCESS);
689023771c563d8660e45d439a207e06e96de28fMark Andrews while ((result = isc_lex_gettoken(lex, options, &token)) ==
689023771c563d8660e45d439a207e06e96de28fMark Andrews printf("Result: %s\n", isc_result_totext(result));