nfs-ganesha 1.4

verif_syntax.c

Go to the documentation of this file.
00001 
00029 #include "config_parsing.h"
00030 #include "log.h"
00031 #include <errno.h>
00032 
00033 int main(int argc, char **argv)
00034 {
00035 
00036   SetDefaultLogging("TEST");
00037   SetNamePgm("verif_syntax");
00038   char *errtxt;
00039   char *fichier;
00040 
00041   config_file_t config;
00042 
00043   if((argc > 1) && (argv[1]))
00044     {
00045       fichier = argv[1];
00046     }
00047   else
00048     {
00049       LogTest("Usage %s <config_file>", argv[0]);
00050       exit(EINVAL);
00051     }
00052 
00053   /* test de la syntaxe du fichier */
00054   config = config_ParseFile(fichier);
00055   if(config == NULL)
00056     {
00057       errtxt = config_GetErrorMsg();
00058       LogTest("Error parsing %s : %s", argv[1], errtxt);
00059       exit(EINVAL);
00060     }
00061   else
00062     {
00063       LogTest("The syntax of the file %s is correct!", argv[1]);
00064       exit(0);
00065     }
00066 
00067   return 0;
00068 
00069 }