Source File modules/ca/ca_initFn.c

    1    | /***************************************
    2    |   $Revision:
    3    |
    4    |   CA module: a wrapper for the functions which parse the
    5    |              dictionary, configuration and source files.
    6    |
    7    |   Status: NOT REVIEWED, NOT TESTED
    8    |
    9    |   Author(s):       Ambrose Magee
    10   |
    11   | ******************//******************
    12   | Modification History:
    13   |
    14   | ******************/
    15   |
    16   | /************************************
    17   | Copyright (c) 2000                              RIPE NCC
    18   |
    19   | All Rights Reserved
    20   |
    21   | Permission to use, copy, modify, and distribute this software and its
    22   | documentation for any purpose and without fee is hereby granted,
    23   | provided that the above copyright notice appear in all copies and that
    24   | both that copyright notice and this permission notice appear in
    25   | supporting documentation, and that the name of the author not be
    26   | used in advertising or publicity pertaining to distribution of the
    27   | software without specific, written prior permission.
    28   |
    29   | THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
    30   | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
    31   | AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
    32   | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
    33   | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
    34   | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
    35   | ***************************************/
    36   |
    37   | #include <stdio.h>
    38   | #include <string.h>
    39   | #include "ca_defs.h"
    40   | #include "ca_configFns.h"
    41   | #include "ca_dictionary.h"
    42   |
    43   | /* #define DEBUG */
    44   |
    45   | /*
    46   |  * The initialization function.
    47   |  */
    48   |
    49   | int ca_init(const char *configFile)
    50   | /****************************************************************
    51   |  * ca_init() -- Initialisation function;                *
    52   |   *          - a wrapper for the ca_populateDictionary,`    *
    53   |   *            the ca_readConfig and the ca_readSources    *
    54   |  *            functions.                        *
    55   |  *                                          *
    56   |  * Parameters                                  *
    57   |   *      configFile -- the name of the configuration file    *
    58   |  *                                          *
    59   |  * Returns                                    *
    60   |   *    An integer; the return value of ca_mandVarChk().
    61   |  *                                          *
    62   |  ****************************************************************/
    63   | {
    64   | 	/*
    65   | 	 * We use CA_NUMBEROFSYMBOLS instead.
    66   | 	 * int varNo = VARS;
    67   | 	 */
    68   |
    69   | int varNo = CA_NUMBEROFSYMBOLS;
    70   |
    71   | 	/*
    72   | 	 * We do not need this function now; the dictionary is hardcoded.
    73   | 	 *
    74   | 	 * ca_populateDictionary(dictionary, varNo);
    75   |   */
    76   |
    77   |  #ifdef DEBUG
    78   |  ca_getDictionary(dictionary, varNo);
    79   | 	#endif /* DEBUG */
    80   |
    81   | 	ca_readConfig(configFile, confVars, varNo);
    82   |  /*
    83   | 	 * ca_sanityChk(confVars);
    84   | 	 */
    85   | if (ca_mandVarChk() != 0)
    86   | 		{
    87   | 		fprintf(stderr, "Mandatory variable(s) undefined\n\n");
    88   | 		fprintf(stderr, "<<<<<<<<<<<<<<<     >>>>>>>>>>>\n\n");
    89   | 		fprintf(stderr, "Continuing ..... \n\n");
    90   |
    91   | 		}
    92   | 	/*
    93   | 	 * sourcesFile = ca_get_dirlist(94);
    94   | 	 */
    95   | 		sourcesFile = ca_get_dirlist(CA_SOURCEFILE);
    96   | 		ca_readSources(sourcesFile, confVars);
    97   | 		return(ca_mandVarChk());
    98   | }