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,2001,2002 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 "rip.h" 38 | 39 | #include <stdio.h> 40 | #include <string.h> 41 | 42 | /* #define DEBUG */ 43 | 44 | /* 45 | * The initialization function. 46 | */ 47 | 48 | int ca_init(const char *configFile) 49 | /**************************************************************** 50 | * ca_init() -- Initialisation function; * 51 | * - a wrapper for the ca_populateDictionary,` * 52 | * the ca_readConfig and the ca_readSources * 53 | * functions. * 54 | * * 55 | * Parameters * 56 | * configFile -- the name of the configuration file * 57 | * * 58 | * Returns * 59 | * An integer; the return value of ca_mandVarChk(). 60 | * * 61 | ****************************************************************/ 62 | { 63 | /* 64 | * We use CA_NUMBEROFSYMBOLS instead. 65 | * int varNo = VARS; 66 | */ 67 | 68 | int varNo = CA_NUMBEROFSYMBOLS; 69 | 70 | /* 71 | * We do not need this function now; the dictionary is hardcoded. 72 | * 73 | * ca_populateDictionary(dictionary, varNo); 74 | */ 75 | 76 | #ifdef DEBUG 77 | ca_getDictionary(dictionary, varNo); 78 | #endif /* DEBUG */ 79 | 80 | ca_readConfig(configFile, confVars, varNo); 81 | /* 82 | * ca_sanityChk(confVars); 83 | */ 84 | if (ca_mandVarChk() != 0) 85 | { 86 | fprintf(stderr, "Mandatory variable(s) undefined\n\n"); 87 | fprintf(stderr, "<<<<<<<<<<<<<<< >>>>>>>>>>>\n\n"); 88 | fprintf(stderr, "Continuing ..... \n\n"); 89 | 90 | } 91 | /* 92 | * sourcesFile = ca_get_dirlist(94); 93 | */ 94 | sourcesFile = ca_get_dirlist(CA_SOURCEFILE); 95 | ca_readSources(sourcesFile, confVars); 96 | return(ca_mandVarChk()); 97 | }