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 | void 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 | * Nothing -- perhaps make this return 0 on successful * 61 | * completion ? * 62 | * * 63 | ****************************************************************/ 64 | { 65 | /* 66 | * We use CA_NUMBEROFSYMBOLS instead. 67 | * int varNo = VARS; 68 | */ 69 | 70 | int varNo = CA_NUMBEROFSYMBOLS; 71 | 72 | /* 73 | * We do not need this function now; the dictionary is hardcoded. 74 | * 75 | * ca_populateDictionary(dictionary, varNo); 76 | */ 77 | 78 | #ifdef DEBUG 79 | ca_getDictionary(dictionary, varNo); 80 | #endif /* DEBUG */ 81 | 82 | ca_readConfig(configFile, confVars, varNo); 83 | /* 84 | * ca_sanityChk(confVars); 85 | */ 86 | if (ca_mandVarChk() != 0) 87 | { 88 | fprintf(stderr, "Mandatory variable(s) undefined\n\n"); 89 | fprintf(stderr, "<<<<<<<<<<<<<<< >>>>>>>>>>>\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 | }