summaryrefslogtreecommitdiff
path: root/comm
diff options
context:
space:
mode:
authorchatty1994-05-10 11:35:13 +0000
committerchatty1994-05-10 11:35:13 +0000
commit58a5b548261135451ced62ece49e6e6ac4357986 (patch)
treef88e83ce2a5ea58f6e83e42e4f28fa13340db03c /comm
parenta159d11a1f07c5e30fc8d120cd6f035b90e35d66 (diff)
downloadivy-league-58a5b548261135451ced62ece49e6e6ac4357986.zip
ivy-league-58a5b548261135451ced62ece49e6e6ac4357986.tar.gz
ivy-league-58a5b548261135451ced62ece49e6e6ac4357986.tar.bz2
ivy-league-58a5b548261135451ced62ece49e6e6ac4357986.tar.xz
replaced TRUE/FALSE by true/false
Added fcntl.h
Diffstat (limited to 'comm')
-rw-r--r--comm/error.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/comm/error.cc b/comm/error.cc
index f46ba3d..f35725a 100644
--- a/comm/error.cc
+++ b/comm/error.cc
@@ -20,6 +20,7 @@
#ifdef sun
extern "C" int rename (const char*, const char*);
#endif
+#include <fcntl.h>
#include <stdio.h>
#include <sys/file.h>
#include "ccu/Time.h"
@@ -68,7 +69,7 @@ char* ErrorTable [] = {
};
static char ProgName [256], LogFile [256];
-static bool LogOn =FALSE;
+static bool LogOn =false;
static int LogFd = -1;
static off_t LogSize = 0;
static off_t LogHalf = 0;
@@ -90,21 +91,21 @@ static bool
HandleError (errtype how, const char* who, const char* what)
{
if (how == ErrNone)
- return TRUE;
+ return true;
char *msg = MakeErrorString (how, who, what);
if (how >= ErrLog) {
LogMessage (msg);
if (how == ErrLog)
- return TRUE;
+ return true;
}
how = (*Handler) (how, who, what, msg);
switch (how) {
case ErrNone:
- return TRUE;
+ return true;
case ErrLog:
case ErrWarn:
break;
@@ -120,7 +121,7 @@ HandleError (errtype how, const char* who, const char* what)
exit (1);
break;
}
- return FALSE;
+ return false;
}
// public functions:
@@ -145,7 +146,7 @@ ProgramName (const char* name)
/*?
Set the log file name.
All messages are appended to the logfile.
-If \var{reset} is TRUE, the file is renamed to \var{file$\sim$}.
+If \var{reset} is true, the file is renamed to \var{file$\sim$}.
If this fails, the file is simply cleared.
If the \com{LOGDIR} environment variable is defined, and if \var{file}
does not start with \com{/} or \com{./}, the value of \com{LOGDIR} is
@@ -185,7 +186,7 @@ LogfileName (const char* file, bool reset)
}
strcat (LogFile, file);
- LogOn = TRUE;
+ LogOn = true;
int flags = O_RDWR | O_CREAT;
if (reset) {
flags |= O_TRUNC;
@@ -200,7 +201,7 @@ LogfileName (const char* file, bool reset)
LogFd = open (LogFile, flags, 0644);
if (LogFd < 0) {
SysError (ErrWarn, "LogfileName");
- LogOn = FALSE;
+ LogOn = false;
} else {
LogHalf = 0;
if (reset)
@@ -214,7 +215,7 @@ LogfileName (const char* file, bool reset)
} else {
if (LogOn && LogFd >= 0)
close (LogFd);
- LogOn = FALSE;
+ LogOn = false;
}
}
@@ -328,7 +329,7 @@ Emit a system error of type \var{how}, from function \var{who}.
The message is retrieved from the value of the global variable \var{errno}.
Thus, this function should be used after system calls that set \var{errno}.
\var{exc1} and \var{exc2}, if non negative, are error codes (values of \var{errno}) to be ignored:
-if the current error code is one of these, the function returns FALSE.
+if the current error code is one of these, the function returns false.
This is useful for instance to ignore interrupted system calls:
\begin{ccode}
#include <errno.h>
@@ -347,7 +348,7 @@ SysError (errtype how, const char* who, int exc1, int exc2)
char defmsg [80];
if (! errno || errno == exc1 || errno == exc2)
- return FALSE;
+ return false;
if (errno >= sys_nerr)
sprintf (msg = defmsg, "system error code %d", errno);