lib/verbose.c File Reference

#include "common.h"
#include "verbose.h"

Include dependency graph for verbose.c:

Go to the source code of this file.

Functions

void verboseVa (int verbosity, char *format, va_list args)
void verbose (int verbosity, char *format,...)
boolean verboseDotsEnabled ()
void verboseDot ()
void verboseSetLevel (int verbosity)
int verboseLevel (void)
void verboseSetLogFile (char *name)
FILE * verboseLogFile ()

Variables

static char const rcsid [] = "$Id: verbose.c,v 1.5 2005/10/17 15:46:41 markd Exp $"
static int logVerbosity = 1
static FILE * logFile
static boolean checkedDotsEnabled = FALSE
static boolean dotsEnabled = FALSE


Function Documentation

void verbose ( int  verbosity,
char *  format,
  ... 
)

Definition at line 28 of file verbose.c.

References verboseVa().

00032 {
00033 va_list args;
00034 va_start(args, format);
00035 verboseVa(verbosity, format, args);
00036 va_end(args);
00037 }

Here is the call graph for this function:

void verboseDot (  ) 

Definition at line 64 of file verbose.c.

References verbose(), and verboseDotsEnabled().

00066 {
00067 if (verboseDotsEnabled())
00068     verbose(1, ".");
00069 }

Here is the call graph for this function:

boolean verboseDotsEnabled (  ) 

Definition at line 39 of file verbose.c.

References checkedDotsEnabled, dotsEnabled, FALSE, logFile, logVerbosity, sameString, and TRUE.

Referenced by verboseDot().

00043 {
00044 if (!checkedDotsEnabled)
00045     {
00046     if (logFile == NULL)
00047         logFile = stderr;
00048     dotsEnabled = (logVerbosity > 0) && isatty(fileno(logFile));
00049     if (dotsEnabled)
00050         {
00051         /* check for an possible emacs shell */
00052         char *emacs = getenv("emacs");
00053         char *term = getenv("TERM");
00054         if ((emacs != NULL) && (emacs[0] == 't'))
00055             dotsEnabled = FALSE;
00056         else if ((term != NULL) && sameString(term, "dumb"))
00057             dotsEnabled = FALSE;
00058         }
00059     checkedDotsEnabled = TRUE;
00060     }
00061 return dotsEnabled;
00062 }

Here is the caller graph for this function:

int verboseLevel ( void   ) 

Definition at line 79 of file verbose.c.

References logVerbosity.

00081 {
00082 return logVerbosity;
00083 }

FILE* verboseLogFile (  ) 

Definition at line 96 of file verbose.c.

References logFile.

00098 {
00099 if (logFile == NULL)
00100     logFile = stderr;
00101 return logFile;
00102 }

void verboseSetLevel ( int  verbosity  ) 

Definition at line 71 of file verbose.c.

References checkedDotsEnabled, FALSE, and logVerbosity.

00074 {
00075 logVerbosity = verbosity;
00076 checkedDotsEnabled = FALSE; /* force rechecking of dots enabled */
00077 }

void verboseSetLogFile ( char *  name  ) 

Definition at line 85 of file verbose.c.

References logFile, mustOpen(), and sameString.

00087 {
00088 if (sameString(name, "stdout"))
00089     logFile = stdout;
00090 else if (sameString(name, "stderr"))
00091     logFile = stderr;
00092 else
00093     logFile = mustOpen(name, "w");
00094 }

Here is the call graph for this function:

void verboseVa ( int  verbosity,
char *  format,
va_list  args 
)

Definition at line 16 of file verbose.c.

References logFile, and logVerbosity.

Referenced by verbose().

00018 {
00019 if (verbosity <= logVerbosity)
00020     {
00021     if (logFile == NULL)
00022         logFile = stderr;
00023     vfprintf(logFile, format, args);
00024     fflush(logFile);
00025     }
00026 }

Here is the caller graph for this function:


Variable Documentation

boolean checkedDotsEnabled = FALSE [static]

Definition at line 12 of file verbose.c.

Referenced by verboseDotsEnabled(), and verboseSetLevel().

boolean dotsEnabled = FALSE [static]

Definition at line 14 of file verbose.c.

Referenced by verboseDotsEnabled().

FILE* logFile [static]

Definition at line 10 of file verbose.c.

Referenced by verboseDotsEnabled(), verboseLogFile(), verboseSetLogFile(), and verboseVa().

int logVerbosity = 1 [static]

Definition at line 9 of file verbose.c.

Referenced by verboseDotsEnabled(), verboseLevel(), verboseSetLevel(), and verboseVa().

char const rcsid[] = "$Id: verbose.c,v 1.5 2005/10/17 15:46:41 markd Exp $" [static]

Definition at line 7 of file verbose.c.


Generated on Tue Dec 25 20:21:04 2007 for blat by  doxygen 1.5.2