]> andersk Git - splint.git/blobdiff - src/llmain.c
Fixed all /*@i...@*/ tags (except 1).
[splint.git] / src / llmain.c
index 8b177b16577e755f3407b335d58b31528914c77f..5a389160ab56cebfec5716662427a61ccbfa95b8 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** Copyright (C) 1994-2003 University of Virginia,
 **         Massachusetts Institute of Technology
 **
 ** This program is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
 # endif
 
 # include "splintMacros.nf"
-# include "llbasic.h"
+# include "basic.h"
 # include "osd.h"
 # include "help.h"
 
@@ -554,7 +554,7 @@ int main (int argc, char *argv[])
                    if (++i < argc)
                      {
                        fname = cstring_fromChars (argv[i]);
-                       setStringFlag (opt, fname);
+                       flags_setStringFlag (opt, fname);
                      }
                    else
                      {
@@ -673,7 +673,29 @@ int main (int argc, char *argv[])
                      argc - 1, argv + 1);
 
   showHerald (); 
-  
+
+  if (context_getFlag (FLG_CSV)) {
+    cstring fname = context_getString (FLG_CSV);
+
+    if (cstring_isDefined (fname)) {
+      if (osd_fileExists (fname) && !context_getFlag (FLG_CSVOVERWRITE)) {
+       lldiagmsg (message ("Specified CSV output file already exists (use +csvoverwrite to automatically overwrite): %s",
+                           fname));
+      } else {
+       g_csvstream = fopen (cstring_toCharsSafe (fname), "w");
+       
+       DPRINTF (("Creating: %s", fname));
+       if (g_csvstream == NULL) {
+         lldiagmsg (message ("Cannot open file for CSV output: %s", fname));
+       } else {
+         displayScan (message ("Starting CSV output file: %s", context_getString (FLG_CSV)));
+         fprintf (g_csvstream, 
+                  "Warning, Flag Code, Flag Name, Priority, File, Line, Column, Warning Text, Additional Text\n");
+       }
+      }
+    }
+  }
+
 # ifdef DOANNOTS
   initAnnots ();
 # endif
@@ -928,12 +950,16 @@ int main (int argc, char *argv[])
 # endif
 
   cleanupFiles ();
-
+  
+  if (g_csvstream != NULL) {
+    displayScan (message ("Closing CSV file: %s", context_getString (FLG_CSV)));
+    check (fclose (g_csvstream) == 0);
+  }
+  
   if (context_getFlag (FLG_SHOWSUMMARY))
     {
       summarizeErrors (); 
     }
-
   
   {
     bool isQuiet = context_getFlag (FLG_QUIET);
@@ -1117,7 +1143,12 @@ int main (int argc, char *argv[])
          
          if (anylcl)
            {
+             /* Gack: really should figure out how to make configure find snprintf... */
+# ifdef WIN32
+             (void) _snprintf (msg, 256,
+# else
              (void) snprintf (msg, 256,
+# endif
                        "Time distribution (percent): initialize %.2f / lcl %.2f / "
                        "pre-process %.2f / c check %.2f / finalize %.2f \n", 
                        (100.0 * (double) (libtime - before) / ttime),
@@ -1128,7 +1159,11 @@ int main (int argc, char *argv[])
            }
          else
            {
+# ifdef WIN32
+             (void) _snprintf (msg, 256,
+# else
              (void) snprintf (msg, 256,
+# endif
                        "Time distribution (percent): initialize %.2f / "
                        "pre-process %.2f / c check %.2f / finalize %.2f \n", 
                        (100.0 * (double) (libtime - before) / ttime),
This page took 0.038469 seconds and 4 git commands to generate.