~andreserl/ubuntu/lucid/bind9/bind9-apport-533601

« back to all changes in this revision

Viewing changes to lib/isc/lex.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, LaMont Jones, Internet Software Consortium, Inc, localization folks
  • Date: 2008-08-02 14:20:20 UTC
  • mfrom: (1.2.1 upstream) (6.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080802142020-l1hon9jy8lbbjxmg
[LaMont Jones]

* default to using resolvconf if it is installed
* fix sonames and dependencies.  Closes: #149259, #492418
* Do not build-depend libcap2-dev on non-linux.  Closes: #493392
* drop unused query-loc manpage.  Closes: #492564
* lwresd: Deliver /etc/bind directory.  Closes: #490027
* fix query-source comment in default install

[Internet Software Consortium, Inc]

* 9.5.0-P2.  Closes: #492949

[localization folks]

* l10n: Spanish debconf translation.  Closes: #492425 (Ignacio Mondino)
* l10n: Swedish debconf templates.  Closes: #491369 (Martin Ågren)
* l10n: Japanese debconf translations.  Closes: #492048 (Hideki Yamane
  (Debian-JP))
* l10n: Finnish translation.  Closes: #490630 (Esko Arajärvi)
* l10n: Italian debconf translations.  Closes: #492587 (Alessandro Vietta)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2004  Internet Systems Consortium, Inc. ("ISC")
 
2
 * Copyright (C) 2004, 2005, 2007  Internet Systems Consortium, Inc. ("ISC")
3
3
 * Copyright (C) 1998-2003  Internet Software Consortium.
4
4
 *
5
 
 * Permission to use, copy, modify, and distribute this software for any
 
5
 * Permission to use, copy, modify, and/or distribute this software for any
6
6
 * purpose with or without fee is hereby granted, provided that the above
7
7
 * copyright notice and this permission notice appear in all copies.
8
8
 *
15
15
 * PERFORMANCE OF THIS SOFTWARE.
16
16
 */
17
17
 
18
 
/* $Id: lex.c,v 1.66.2.6.2.8 2004/08/28 06:25:21 marka Exp $ */
 
18
/* $Id: lex.c,v 1.86 2007/09/17 09:56:29 shane Exp $ */
 
19
 
 
20
/*! \file */
19
21
 
20
22
#include <config.h>
21
23
 
372
374
        source = HEAD(lex->sources);
373
375
        REQUIRE(tokenp != NULL);
374
376
 
375
 
        lex->saved_paren_count = lex->paren_count;
376
 
        source->saved_line = source->line;
377
 
 
378
377
        if (source == NULL) {
379
378
                if ((options & ISC_LEXOPT_NOMORE) != 0) {
380
379
                        tokenp->type = isc_tokentype_nomore;
386
385
        if (source->result != ISC_R_SUCCESS)
387
386
                return (source->result);
388
387
 
 
388
        lex->saved_paren_count = lex->paren_count;
 
389
        source->saved_line = source->line;
 
390
 
389
391
        if (isc_buffer_remaininglength(source->pushback) == 0 &&
390
392
            source->at_eof)
391
393
        {
563
565
                        } else if (isdigit((unsigned char)c) &&
564
566
                                   (options & ISC_LEXOPT_NUMBER) != 0) {
565
567
                                lex->last_was_eol = ISC_FALSE;
566
 
                                state = lexstate_number;
 
568
                                if ((options & ISC_LEXOPT_OCTAL) != 0 &&
 
569
                                    (c == '8' || c == '9'))
 
570
                                        state = lexstate_string;
 
571
                                else
 
572
                                        state = lexstate_number;
567
573
                                goto no_read;
568
574
                        } else {
569
575
                                lex->last_was_eol = ISC_FALSE;
584
590
                                    c == '\n' || c == EOF ||
585
591
                                    lex->specials[c]) {
586
592
                                        int base;
587
 
                                        if ((options & ISC_LEXOPT_CNUMBER) != 0)
 
593
                                        if ((options & ISC_LEXOPT_OCTAL) != 0)
 
594
                                                base = 8;
 
595
                                        else if ((options & ISC_LEXOPT_CNUMBER) != 0)
588
596
                                                base = 0;
589
597
                                        else
590
598
                                                base = 10;
620
628
                                        /* Above test supports hex numbers */
621
629
                                        state = lexstate_string;
622
630
                                }
 
631
                        } else if ((options & ISC_LEXOPT_OCTAL) != 0 &&
 
632
                                   (c == '8' || c == '9')) {
 
633
                                state = lexstate_string;
623
634
                        }
624
635
                        if (remaining == 0U) {
625
636
                                result = grow_data(lex, &remaining,
633
644
                        remaining--;
634
645
                        break;
635
646
                case lexstate_string:
636
 
                        if ((!escaped &&
637
 
                             (c == ' ' || c == '\t' || lex->specials[c])) ||
638
 
                            c == '\r' || c == '\n' || c == EOF) {
 
647
                        /*
 
648
                         * EOF needs to be checked before lex->specials[c]
 
649
                         * as lex->specials[EOF] is not a good idea.
 
650
                         */
 
651
                        if (c == '\r' || c == '\n' || c == EOF ||
 
652
                            (!escaped &&
 
653
                             (c == ' ' || c == '\t' || lex->specials[c]))) {
639
654
                                pushback(source, c);
640
655
                                if (source->result != ISC_R_SUCCESS) {
641
656
                                        result = source->result;
705
720
                                state = lexstate_ccomment;
706
721
                        break;
707
722
                case lexstate_eatline:
708
 
                        if (c == EOF) {
709
 
                                result = ISC_R_UNEXPECTEDEND;
710
 
                                goto done;
711
 
                        }
712
 
                        if (c == '\n') {
 
723
                        if ((c == '\n') || (c == EOF)) {
713
724
                                no_comments = ISC_FALSE;
714
725
                                state = saved_state;
715
726
                                goto no_read;
817
828
        return (ISC_R_SUCCESS);
818
829
}
819
830
 
 
831
isc_result_t
 
832
isc_lex_getoctaltoken(isc_lex_t *lex, isc_token_t *token, isc_boolean_t eol)
 
833
{
 
834
        unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF |
 
835
                               ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE|
 
836
                               ISC_LEXOPT_NUMBER | ISC_LEXOPT_OCTAL;
 
837
        isc_result_t result;
 
838
 
 
839
        result = isc_lex_gettoken(lex, options, token);
 
840
        if (result == ISC_R_RANGE)
 
841
                isc_lex_ungettoken(lex, token);
 
842
        if (result != ISC_R_SUCCESS)
 
843
                return (result);
 
844
 
 
845
        if (eol && ((token->type == isc_tokentype_eol) ||
 
846
                    (token->type == isc_tokentype_eof)))
 
847
                return (ISC_R_SUCCESS);
 
848
        if (token->type != isc_tokentype_number) {
 
849
                isc_lex_ungettoken(lex, token);
 
850
                if (token->type == isc_tokentype_eol ||
 
851
                    token->type == isc_tokentype_eof)
 
852
                        return (ISC_R_UNEXPECTEDEND);
 
853
                return (ISC_R_BADNUMBER);
 
854
        }
 
855
        return (ISC_R_SUCCESS);
 
856
}
 
857
 
820
858
void
821
859
isc_lex_ungettoken(isc_lex_t *lex, isc_token_t *tokenp) {
822
860
        inputsource *source;