From: Robert Colquhoun Date: Sun, 13 Jun 1999 07:40:57 +0000 (+0000) Subject: Massive fxBool patch X-Git-Tag: v40pl2-rjc11~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43aaa85f56ea2d00a6734884d3e2703266c1222d;p=thirdparty%2FHylaFAX.git Massive fxBool patch 12,000 line patch removes the fxBool class from the source tree. Replaces with the C++ standard type 'bool'. Also replaced the 'TRUE' & 'FALSE' defines with C++ standard true & false. --- diff --git a/config.h.in b/config.h.in index d2428b84..30a12a55 100644 --- a/config.h.in +++ b/config.h.in @@ -262,7 +262,7 @@ #define SNPP_DEFPORT 444 /* port to use if service is unknown */ #define SNPP_DEFHOST "localhost" /* default host for SNPP service */ /* default values for SNPP job scheduling and handling */ -#define SNPP_DEFQUEUE FALSE /* default is synchronous delivery */ +#define SNPP_DEFQUEUE false /* default is synchronous delivery */ #define SNPP_DEFLEVEL 1 /* default service level */ #define SNPP_DEFRETRIES 3 /* number times to retry send */ #define SNPP_DEFREDIALS 12 /* number times to dial phone */ diff --git a/faxalter/faxalter.c++ b/faxalter/faxalter.c++ index b07d810d..667478ab 100644 --- a/faxalter/faxalter.c++ +++ b/faxalter/faxalter.c++ @@ -32,7 +32,7 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg); class faxAlterApp : public FaxClient { private: - fxBool groups; // group or job id's + bool groups; // group or job id's fxStr script; // commands to send for each job void addToScript(const char* fmt ...); @@ -44,7 +44,7 @@ public: void run(int argc, char** argv); }; -faxAlterApp::faxAlterApp() { groups = FALSE; } +faxAlterApp::faxAlterApp() { groups = false; } faxAlterApp::~faxAlterApp() {} void @@ -90,7 +90,7 @@ faxAlterApp::run(int argc, char** argv) addToScript("SENDTIME NOW"); break; case 'g': // apply to groups, not jobs - groups = TRUE; + groups = true; break; case 'h': // server's host setHost(optarg); @@ -132,7 +132,7 @@ faxAlterApp::run(int argc, char** argv) addToScript("MAXDIALS %s", optarg); break; case 'v': // trace protocol - setVerbose(TRUE); + setVerbose(true); break; case '?': usage(); diff --git a/faxd/Class0.c++ b/faxd/Class0.c++ index 57ca91e1..eb5d3161 100644 --- a/faxd/Class0.c++ +++ b/faxd/Class0.c++ @@ -40,17 +40,17 @@ Class0Modem::~Class0Modem() { } -fxBool +bool Class0Modem::setupModem() { if (!selectBaudRate(conf.maxRate, conf.flowControl, conf.flowControl)) - return (FALSE); + return (false); // Query service support information fxStr s; if (doQuery(conf.classQueryCmd, s, 500) && parseRange(s, modemServices)) traceBits(modemServices & SERVICE_ALL, serviceNames); if ((modemServices & SERVICE_DATA) == 0) - return (FALSE); + return (false); atCmd(conf.class0Cmd); setupFlowControl(flowControl); @@ -70,14 +70,14 @@ Class0Modem::setupModem() if (modemRevision != "") modemCapability("Revision " | modemRevision); - return (TRUE); + return (true); } /* * Send the modem any commands needed to force use of * the specified flow control scheme. */ -fxBool +bool Class0Modem::setupFlowControl(FlowControl fc) { switch (fc) { @@ -85,7 +85,7 @@ Class0Modem::setupFlowControl(FlowControl fc) case FLOW_XONXOFF: return atCmd(conf.softFlowCmd); case FLOW_RTSCTS: return atCmd(conf.hardFlowCmd); } - return (TRUE); + return (true); } CallStatus @@ -117,4 +117,4 @@ Class0Modem::dialResponse(fxStr&) return (FAILURE); } -fxBool Class0Modem::isFaxModem() const { return FALSE; } +bool Class0Modem::isFaxModem() const { return false; } diff --git a/faxd/Class0.h b/faxd/Class0.h index 3ed1716d..d15de3cd 100644 --- a/faxd/Class0.h +++ b/faxd/Class0.h @@ -35,11 +35,11 @@ public: Class0Modem(ModemServer&, const ModemConfig&); ~Class0Modem(); - fxBool setupModem(); - virtual fxBool setupFlowControl(FlowControl fc); + bool setupModem(); + virtual bool setupFlowControl(FlowControl fc); CallStatus dial(const char* number, fxStr& emsg); CallStatus dialResponse(fxStr& emsg); - fxBool isFaxModem() const; // XXX safe to cast + bool isFaxModem() const; // XXX safe to cast }; #endif /* _Class0Modem_ */ diff --git a/faxd/Class1.c++ b/faxd/Class1.c++ index 826be14f..0bfeba5c 100644 --- a/faxd/Class1.c++ +++ b/faxd/Class1.c++ @@ -54,21 +54,21 @@ const char* Class1Modem::modulationNames[6] = { * least at 12000 and 14400. */ const Class1Cap Class1Modem::basicCaps[15] = { - { 3, 0, 0, V21, FALSE }, // v.21 - { 24, BR_2400, DCSSIGRATE_2400V27, V27FB, FALSE }, // v.27 ter - { 48, BR_4800, DCSSIGRATE_4800V27, V27, FALSE }, // v.27 ter - { 72, BR_7200, DCSSIGRATE_7200V29, V29, FALSE }, // v.29 - { 73, BR_7200, DCSSIGRATE_7200V17, V17, FALSE }, // v.17 - { 74, BR_7200, DCSSIGRATE_7200V17, V17, FALSE }, // v.17 w/st - { 96, BR_9600, DCSSIGRATE_9600V29, V29, FALSE }, // v.29 - { 97, BR_9600, DCSSIGRATE_9600V17, V17, FALSE }, // v.17 - { 98, BR_9600, DCSSIGRATE_9600V17, V17, FALSE }, // v.17 w/st - { 121, BR_12000, DCSSIGRATE_12000V33, V33, FALSE }, // v.33 - { 121, BR_12000, DCSSIGRATE_12000V17, V17, FALSE }, // v.17 - { 122, BR_12000, DCSSIGRATE_12000V17, V17, FALSE }, // v.17 w/st - { 145, BR_14400, DCSSIGRATE_14400V33, V33, FALSE }, // v.33 - { 145, BR_14400, DCSSIGRATE_14400V17, V17, FALSE }, // v.17 - { 146, BR_14400, DCSSIGRATE_14400V17, V17, FALSE }, // v.17 w/st + { 3, 0, 0, V21, false }, // v.21 + { 24, BR_2400, DCSSIGRATE_2400V27, V27FB, false }, // v.27 ter + { 48, BR_4800, DCSSIGRATE_4800V27, V27, false }, // v.27 ter + { 72, BR_7200, DCSSIGRATE_7200V29, V29, false }, // v.29 + { 73, BR_7200, DCSSIGRATE_7200V17, V17, false }, // v.17 + { 74, BR_7200, DCSSIGRATE_7200V17, V17, false }, // v.17 w/st + { 96, BR_9600, DCSSIGRATE_9600V29, V29, false }, // v.29 + { 97, BR_9600, DCSSIGRATE_9600V17, V17, false }, // v.17 + { 98, BR_9600, DCSSIGRATE_9600V17, V17, false }, // v.17 w/st + { 121, BR_12000, DCSSIGRATE_12000V33, V33, false }, // v.33 + { 121, BR_12000, DCSSIGRATE_12000V17, V17, false }, // v.17 + { 122, BR_12000, DCSSIGRATE_12000V17, V17, false }, // v.17 w/st + { 145, BR_14400, DCSSIGRATE_14400V33, V33, false }, // v.33 + { 145, BR_14400, DCSSIGRATE_14400V17, V17, false }, // v.17 + { 146, BR_14400, DCSSIGRATE_14400V17, V17, false }, // v.17 w/st }; #define NCAPS (sizeof (basicCaps) / sizeof (basicCaps[0])) @@ -92,17 +92,17 @@ Class1Modem::~Class1Modem() * Check if the modem is a Class 1 modem and, * if so, configure it for use. */ -fxBool +bool Class1Modem::setupModem() { if (!selectBaudRate(conf.maxRate, conf.flowControl, conf.flowControl)) - return (FALSE); + return (false); // Query service support information fxStr s; if (doQuery(conf.classQueryCmd, s, 500) && FaxModem::parseRange(s, modemServices)) traceBits(modemServices & SERVICE_ALL, serviceNames); if ((modemServices & SERVICE_CLASS1) == 0) - return (FALSE); + return (false); atCmd(conf.class1Cmd); /* @@ -128,7 +128,7 @@ Class1Modem::setupModem() */ if (!class1Query("AT+FTM=?", xmitCaps)) { serverTrace("Error parsing \"+FTM\" query response: \"%s\"", rbuf); - return (FALSE); + return (false); } modemParams.br = 0; u_int i; @@ -150,7 +150,7 @@ Class1Modem::setupModem() */ if (!class1Query("AT+FRM=?", recvCaps)) { serverTrace("Error parsing \"+FRM\" query response: \"%s\"", rbuf); - return (FALSE); + return (false); } u_int mods = 0; for (i = 1; i < NCAPS; i++) @@ -189,13 +189,13 @@ Class1Modem::setupModem() frameRev = TIFFGetBitRevTable(conf.frameFillOrder == FILLORDER_LSB2MSB); setupClass1Parameters(); - return (TRUE); + return (true); } /* * Send the modem the Class 1 configuration commands. */ -fxBool +bool Class1Modem::setupClass1Parameters() { if (modemServices & SERVICE_CLASS1) { @@ -203,23 +203,23 @@ Class1Modem::setupClass1Parameters() setupFlowControl(flowControl); atCmd(conf.setupAACmd); } - return (TRUE); + return (true); } /* * Setup receive-specific parameters. */ -fxBool +bool Class1Modem::setupReceive() { - return (TRUE); // nothing to do + return (true); // nothing to do } /* * Send the modem any commands needed to force use of * the specified flow control scheme. */ -fxBool +bool Class1Modem::setupFlowControl(FlowControl fc) { switch (fc) { @@ -227,14 +227,14 @@ Class1Modem::setupFlowControl(FlowControl fc) case FLOW_XONXOFF: return atCmd(conf.class1SFLOCmd); case FLOW_RTSCTS: return atCmd(conf.class1HFLOCmd); } - return (TRUE); + return (true); } /* * Place the modem into the appropriate state * for sending/received facsimile. */ -fxBool +bool Class1Modem::faxService() { return (atCmd(conf.class1Cmd) && setupFlowControl(flowControl)); @@ -249,10 +249,10 @@ Class1Modem::setLID(const fxStr& number) encodeTSI(lid, number); } -fxBool +bool Class1Modem::supportsPolling() const { - return (TRUE); + return (true); } /* @@ -303,7 +303,7 @@ Class1Modem::decodeTSI(fxStr& ascii, const HDLCFrame& binary) n = 20; ascii.resize(n); u_int d = 0; - fxBool seenDigit = FALSE; + bool seenDigit = false; for (const u_char* cp = binary.getFrameData() + n-1; n > 0; cp--, n--) { /* * Accept any printable ascii. @@ -311,7 +311,7 @@ Class1Modem::decodeTSI(fxStr& ascii, const HDLCFrame& binary) u_char c = frameRev[*cp]; if (isprint(c) || c == ' ') { if (c != ' ') - seenDigit = TRUE; + seenDigit = true; if (seenDigit) ascii[d++] = c; } @@ -355,19 +355,19 @@ Class1Modem::decodePWD(fxStr& ascii, const HDLCFrame& binary) * optionally including the end-of-data * marker . */ -fxBool +bool Class1Modem::sendClass1Data(const u_char* data, u_int cc, - const u_char* bitrev, fxBool eod) + const u_char* bitrev, bool eod) { if (!putModemDLEData(data, cc, bitrev, getDataTimeout())) - return (FALSE); + return (false); if (eod) { u_char buf[2]; buf[0] = DLE; buf[1] = ETX; return (putModemData(buf, 2)); } else - return (TRUE); + return (true); } /* @@ -377,7 +377,7 @@ Class1Modem::sendClass1Data(const u_char* data, u_int cc, void Class1Modem::abortReceive() { - fxBool b = wasTimeout(); + bool b = wasTimeout(); char c = CAN; // anything other than DC1/DC3 putModem(&c, 1, 1); /* @@ -403,7 +403,7 @@ Class1Modem::abortReceive() * is not received before the timeout, the receive * is aborted. */ -fxBool +bool Class1Modem::recvRawFrame(HDLCFrame& frame) { int c; @@ -434,7 +434,7 @@ Class1Modem::recvRawFrame(HDLCFrame& frame) } if (wasTimeout()) { abortReceive(); - return (FALSE); + return (false); } traceHDLCFrame("-->", frame); /* @@ -445,18 +445,18 @@ Class1Modem::recvRawFrame(HDLCFrame& frame) if (!waitFor(AT_OK)) { if (lastResponse == AT_ERROR) protoTrace("FCS error"); - return (FALSE); + return (false); } if (frame.getFrameDataLength() < 1) { protoTrace("HDLC frame too short (%u bytes)", frame.getLength()); - return (FALSE); + return (false); } if ((frame[1]&0xf7) != 0xc0) { protoTrace("HDLC frame with bad control field %#x", frame[1]); - return (FALSE); + return (false); } - frame.setOK(TRUE); - return (TRUE); + frame.setOK(true); + return (true); } #include "StackBuffer.h" @@ -489,21 +489,21 @@ Class1Modem::traceHDLCFrame(const char* direction, const HDLCFrame& frame) * The T.30 max frame length is enforced with a 3 second * timeout on the send. */ -fxBool +bool Class1Modem::sendRawFrame(HDLCFrame& frame) { traceHDLCFrame("<--", frame); if (frame.getLength() < 3) { protoTrace("HDLC frame too short (%u bytes)", frame.getLength()); - return (FALSE); + return (false); } if (frame[0] != 0xff) { protoTrace("HDLC frame with bad address field %#x", frame[0]); - return (FALSE); + return (false); } if ((frame[1]&0xf7) != 0xc0) { protoTrace("HDLC frame with bad control field %#x", frame[1]); - return (FALSE); + return (false); } static u_char buf[2] = { DLE, ETX }; return (putModemDLEData(frame, frame.getLength(), frameRev, 0) && @@ -514,8 +514,8 @@ Class1Modem::sendRawFrame(HDLCFrame& frame) /* * Send a single byte frame. */ -fxBool -Class1Modem::sendFrame(u_char fcf, fxBool lastFrame) +bool +Class1Modem::sendFrame(u_char fcf, bool lastFrame) { HDLCFrame frame(conf.class1FrameOverhead); frame.put(0xff); @@ -527,8 +527,8 @@ Class1Modem::sendFrame(u_char fcf, fxBool lastFrame) /* * Send a frame with DCS/DIS. */ -fxBool -Class1Modem::sendFrame(u_char fcf, u_int dcs, u_int xinfo, fxBool lastFrame) +bool +Class1Modem::sendFrame(u_char fcf, u_int dcs, u_int xinfo, bool lastFrame) { HDLCFrame frame(conf.class1FrameOverhead); frame.put(0xff); @@ -554,8 +554,8 @@ Class1Modem::sendFrame(u_char fcf, u_int dcs, u_int xinfo, fxBool lastFrame) /* * Send a frame with TSI/CSI/PWD/SUB/SEP. */ -fxBool -Class1Modem::sendFrame(u_char fcf, const fxStr& tsi, fxBool lastFrame) +bool +Class1Modem::sendFrame(u_char fcf, const fxStr& tsi, bool lastFrame) { HDLCFrame frame(conf.class1FrameOverhead); frame.put(0xff); @@ -565,11 +565,11 @@ Class1Modem::sendFrame(u_char fcf, const fxStr& tsi, fxBool lastFrame) return (sendRawFrame(frame)); } -fxBool -Class1Modem::transmitFrame(u_char fcf, fxBool lastFrame) +bool +Class1Modem::transmitFrame(u_char fcf, bool lastFrame) { startTimeout(2550); // 3.0 - 15% = 2.55 secs - fxBool frameSent = + bool frameSent = atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 0) == AT_CONNECT && sendFrame(fcf, lastFrame); @@ -577,8 +577,8 @@ Class1Modem::transmitFrame(u_char fcf, fxBool lastFrame) return (frameSent); } -fxBool -Class1Modem::transmitFrame(u_char fcf, u_int dcs, u_int xinfo, fxBool lastFrame) +bool +Class1Modem::transmitFrame(u_char fcf, u_int dcs, u_int xinfo, bool lastFrame) { /* * The T.30 spec says no frame can take more than 3 seconds @@ -586,7 +586,7 @@ Class1Modem::transmitFrame(u_char fcf, u_int dcs, u_int xinfo, fxBool lastFrame) * and guard against the send exceeding the lower bound. */ startTimeout(2550); // 3.0 - 15% = 2.55 secs - fxBool frameSent = + bool frameSent = atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 0) == AT_CONNECT && sendFrame(fcf, dcs, xinfo, lastFrame); @@ -594,11 +594,11 @@ Class1Modem::transmitFrame(u_char fcf, u_int dcs, u_int xinfo, fxBool lastFrame) return (frameSent); } -fxBool -Class1Modem::transmitFrame(u_char fcf, const fxStr& tsi, fxBool lastFrame) +bool +Class1Modem::transmitFrame(u_char fcf, const fxStr& tsi, bool lastFrame) { startTimeout(3000); // give more time than others - fxBool frameSent = + bool frameSent = atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 0) == AT_CONNECT && sendFrame(fcf, tsi, lastFrame); @@ -609,16 +609,16 @@ Class1Modem::transmitFrame(u_char fcf, const fxStr& tsi, fxBool lastFrame) /* * Send data using the specified signalling rate. */ -fxBool +bool Class1Modem::transmitData(int br, u_char* data, u_int cc, - const u_char* bitrev, fxBool eod) + const u_char* bitrev, bool eod) { if (flowControl == FLOW_XONXOFF) setXONXOFF(FLOW_XONXOFF, FLOW_NONE, ACT_FLUSH); fxStr tmCmd(br, tmCmdFmt); - fxBool ok = (atCmd(tmCmd, AT_CONNECT) && + bool ok = (atCmd(tmCmd, AT_CONNECT) && sendClass1Data(data, cc, bitrev, eod) && - (eod ? waitFor(AT_OK) : TRUE)); + (eod ? waitFor(AT_OK) : true)); if (flowControl == FLOW_XONXOFF) setXONXOFF(FLOW_NONE, FLOW_NONE, ACT_DRAIN); return (ok); @@ -632,24 +632,24 @@ Class1Modem::transmitData(int br, u_char* data, u_int cc, * is not received before the timeout, the receive * is aborted. */ -fxBool +bool Class1Modem::recvFrame(HDLCFrame& frame, long ms) { frame.reset(); startTimeout(ms); - fxBool readPending = atCmd(rhCmd, AT_NOTHING); + bool readPending = atCmd(rhCmd, AT_NOTHING); if (readPending && waitFor(AT_CONNECT,0)) return recvRawFrame(frame); // NB: stops inherited timeout stopTimeout("waiting for v.21 carrier"); if (readPending && wasTimeout()) abortReceive(); - return (FALSE); + return (false); } /* * Receive TCF data using the specified signalling rate. */ -fxBool +bool Class1Modem::recvTCF(int br, HDLCFrame& buf, const u_char* bitrev, long ms) { buf.reset(); @@ -659,7 +659,7 @@ Class1Modem::recvTCF(int br, HDLCFrame& buf, const u_char* bitrev, long ms) /* * Loop waiting for carrier or timeout. */ - fxBool readPending, gotCarrier; + bool readPending, gotCarrier; fxStr rmCmd(br, rmCmdFmt); do { readPending = atCmd(rmCmd, AT_NOTHING); @@ -668,7 +668,7 @@ Class1Modem::recvTCF(int br, HDLCFrame& buf, const u_char* bitrev, long ms) /* * If carrier was recognized, collect the data. */ - fxBool gotData = FALSE; + bool gotData = false; if (gotCarrier) { int c = getModemChar(0); // NB: timeout is to first byte stopTimeout("receiving TCF"); @@ -684,7 +684,7 @@ Class1Modem::recvTCF(int br, HDLCFrame& buf, const u_char* bitrev, long ms) if (c == DLE) { c = getModemChar(0); if (c == ETX) { - gotData = TRUE; + gotData = true; break; } } @@ -710,7 +710,7 @@ Class1Modem::recvTCF(int br, HDLCFrame& buf, const u_char* bitrev, long ms) /* * Reset a Class 1 modem. */ -fxBool +bool Class1Modem::reset(long ms) { return (FaxModem::reset(ms) && setupClass1Parameters()); @@ -727,13 +727,13 @@ Class1Modem::atResponse(char* buf, long ms) /* * Wait (carefully) for some response from the modem. */ -fxBool +bool Class1Modem::waitFor(ATResponse wanted, long ms) { for (;;) { ATResponse response = atResponse(rbuf, ms); if (response == wanted) - return (TRUE); + return (true); switch (response) { case AT_TIMEOUT: case AT_EMPTYLINE: @@ -745,7 +745,7 @@ Class1Modem::waitFor(ATResponse wanted, long ms) modemTrace("MODEM %s", ATresponses[response]); /* fall thru... */ case AT_FCERROR: - return (FALSE); + return (false); } } } @@ -753,7 +753,7 @@ Class1Modem::waitFor(ATResponse wanted, long ms) /* * Send =? and get a range response. */ -fxBool +bool Class1Modem::class1Query(const char* what, Class1Cap caps[]) { char response[1024]; @@ -761,7 +761,7 @@ Class1Modem::class1Query(const char* what, Class1Cap caps[]) sync(5000); return (parseQuery(response, caps)); } - return (FALSE); + return (false); } /* @@ -846,7 +846,7 @@ const char SPACE = ' '; /* * Parse a Class 1 parameter string. */ -fxBool +bool Class1Modem::parseQuery(const char* cp, Class1Cap caps[]) { while (cp[0]) { @@ -855,18 +855,18 @@ Class1Modem::parseQuery(const char* cp, Class1Cap caps[]) continue; } if (!isdigit(cp[0])) - return (FALSE); + return (false); int v = 0; do { v = v*10 + (cp[0] - '0'); } while (isdigit((++cp)[0])); for (u_int i = 0; i < NCAPS; i++) if (caps[i].value == v) { - caps[i].ok = TRUE; + caps[i].ok = true; break; } if (cp[0] == COMMA) // ,... cp++; } - return (TRUE); + return (true); } diff --git a/faxd/Class1.h b/faxd/Class1.h index 41409d67..e3333eb4 100644 --- a/faxd/Class1.h +++ b/faxd/Class1.h @@ -40,7 +40,7 @@ typedef struct { u_char br; // Class 2 bit rate parameter u_short sr; // T.30 DCS signalling rate u_char mod; // modulation technique - fxBool ok; // true if modem is capable + bool ok; // true if modem is capable } Class1Cap; #define HasShortTraining(c) \ ((c)->mod == V17 && ((c)->value & 1) && (c)[1].ok) @@ -59,10 +59,10 @@ protected: Class1Cap recvCaps[15]; // modem recv capabilities const Class1Cap* curcap; // capabilities being used u_int discap; // DIS signalling rate capabilities - fxBool prevPage; // a previous page was received - fxBool pageGood; // quality of last page received - fxBool recvdDCN; // received DCN frame - fxBool messageReceived; // expect/don't expect message carrier + bool prevPage; // a previous page was received + bool pageGood; // quality of last page received + bool recvdDCN; // received DCN frame + bool messageReceived; // expect/don't expect message carrier u_int lastPPM; // last PPM during receive static const u_int modemPFMCodes[8];// map T.30 FCF to Class 2 PFM @@ -82,32 +82,32 @@ protected: static const char* modulationNames[6]; // modem setup stuff - virtual fxBool setupModem(); - virtual fxBool setupClass1Parameters(); - virtual fxBool setupFlowControl(FlowControl fc); + virtual bool setupModem(); + virtual bool setupClass1Parameters(); + virtual bool setupFlowControl(FlowControl fc); // transmission support - fxBool sendPrologue(u_int dcs, u_int xinfo, const fxStr& tsi); - fxBool dropToNextBR(Class2Params&); - fxBool raiseToNextBR(Class2Params&); - fxBool sendTraining(Class2Params&, int, fxStr& emsg); - fxBool sendTCF(const Class2Params&, u_int ms); - fxBool sendPage(TIFF* tif, const Class2Params&, u_int, fxStr& emsg); - fxBool sendPageData(u_char* data, u_int cc, const u_char* bitrev); - fxBool sendRTC(fxBool is2D); - fxBool sendPPM(u_int ppm, HDLCFrame& mcf, fxStr& emsg); - fxBool decodePPM(const fxStr& pph, u_int& ppm, fxStr& emsg); + bool sendPrologue(u_int dcs, u_int xinfo, const fxStr& tsi); + bool dropToNextBR(Class2Params&); + bool raiseToNextBR(Class2Params&); + bool sendTraining(Class2Params&, int, fxStr& emsg); + bool sendTCF(const Class2Params&, u_int ms); + bool sendPage(TIFF* tif, const Class2Params&, u_int, fxStr& emsg); + bool sendPageData(u_char* data, u_int cc, const u_char* bitrev); + bool sendRTC(bool is2D); + bool sendPPM(u_int ppm, HDLCFrame& mcf, fxStr& emsg); + bool decodePPM(const fxStr& pph, u_int& ppm, fxStr& emsg); // reception support const AnswerMsg* findAnswer(const char*); - fxBool recvIdentification( + bool recvIdentification( u_int f1, const fxStr& pwd, u_int f2, const fxStr& addr, u_int f3, const fxStr& id, u_int f4, u_int dics, u_int xinfo, u_int timer, fxStr& emsg); - fxBool recvDCSFrames(HDLCFrame& frame); - fxBool recvTraining(); - fxBool recvPPM(int& ppm, fxStr& emsg); - fxBool recvPageData(TIFF*, fxStr& emsg); + bool recvDCSFrames(HDLCFrame& frame); + bool recvTraining(); + bool recvPPM(int& ppm, fxStr& emsg); + bool recvPageData(TIFF*, fxStr& emsg); void recvData(TIFF*, u_char* buf, int n); void processDCSFrame(const HDLCFrame& frame); void abortPageRecv(); @@ -116,7 +116,7 @@ protected: AT_FCERROR = 100 // "+FCERROR" }; virtual ATResponse atResponse(char* buf, long ms = 30*1000); - virtual fxBool waitFor(ATResponse wanted, long ms = 30*1000); + virtual bool waitFor(ATResponse wanted, long ms = 30*1000); void encodeTSI(fxStr& binary, const fxStr& ascii); const fxStr& decodeTSI(fxStr& ascii, const HDLCFrame& binary); void encodePWD(fxStr& binary, const fxStr& ascii); @@ -124,33 +124,33 @@ protected: const Class1Cap* findSRCapability(u_short sr, const Class1Cap[]); const Class1Cap* findBRCapability(u_short br, const Class1Cap[]); // class 1 HDLC frame support - fxBool transmitFrame(u_char fcf, fxBool lastFrame = TRUE); - fxBool transmitFrame(u_char fcf, u_int, u_int, fxBool lastFrame = TRUE); - fxBool transmitFrame(u_char fcf, const fxStr&, fxBool lastFrame=TRUE); - fxBool transmitData(int br, u_char* data, u_int cc, - const u_char* bitrev, fxBool eod); - fxBool sendFrame(u_char fcf, fxBool lastFrame = TRUE); - fxBool sendFrame(u_char fcf, u_int, u_int, fxBool lastFrame = TRUE); - fxBool sendFrame(u_char fcf, const fxStr&, fxBool lastFrame = TRUE); - fxBool sendRawFrame(HDLCFrame& frame); - fxBool sendClass1Data(const u_char* data, u_int cc, - const u_char* bitrev, fxBool eod); - fxBool recvFrame(HDLCFrame& frame, long ms = 10*1000); - fxBool recvTCF(int br, HDLCFrame&, const u_char* bitrev, long ms); - fxBool recvRawFrame(HDLCFrame& frame); + bool transmitFrame(u_char fcf, bool lastFrame = true); + bool transmitFrame(u_char fcf, u_int, u_int, bool lastFrame = true); + bool transmitFrame(u_char fcf, const fxStr&, bool lastFrame=true); + bool transmitData(int br, u_char* data, u_int cc, + const u_char* bitrev, bool eod); + bool sendFrame(u_char fcf, bool lastFrame = true); + bool sendFrame(u_char fcf, u_int, u_int, bool lastFrame = true); + bool sendFrame(u_char fcf, const fxStr&, bool lastFrame = true); + bool sendRawFrame(HDLCFrame& frame); + bool sendClass1Data(const u_char* data, u_int cc, + const u_char* bitrev, bool eod); + bool recvFrame(HDLCFrame& frame, long ms = 10*1000); + bool recvTCF(int br, HDLCFrame&, const u_char* bitrev, long ms); + bool recvRawFrame(HDLCFrame& frame); void abortReceive(); void traceHDLCFrame(const char* direction, const HDLCFrame& frame); // class 1 command support routines - fxBool class1Query(const char* what, Class1Cap caps[]); - fxBool parseQuery(const char*, Class1Cap caps[]); + bool class1Query(const char* what, Class1Cap caps[]); + bool parseQuery(const char*, Class1Cap caps[]); public: Class1Modem(FaxServer&, const ModemConfig&); virtual ~Class1Modem(); // send support - fxBool sendSetup(FaxRequest&, const Class2Params&, fxStr& emsg); + bool sendSetup(FaxRequest&, const Class2Params&, fxStr& emsg); CallStatus dialResponse(fxStr& emsg); - FaxSendStatus getPrologue(Class2Params&, fxBool&, fxStr&); + FaxSendStatus getPrologue(Class2Params&, bool&, fxStr&); void sendBegin(); void sendSetupPhaseB(const fxStr& pwd, const fxStr& sub); FaxSendStatus sendPhaseB(TIFF* tif, Class2Params&, FaxMachineInfo&, @@ -162,21 +162,21 @@ public: CallType answerCall(AnswerType, fxStr& emsg); u_int modemDIS() const; u_int modemXINFO() const; - fxBool setupReceive(); - fxBool recvBegin(fxStr& emsg); - fxBool recvPage(TIFF*, int& ppm, fxStr& emsg); - fxBool recvEnd(fxStr& emsg); + bool setupReceive(); + bool recvBegin(fxStr& emsg); + bool recvPage(TIFF*, int& ppm, fxStr& emsg); + bool recvEnd(fxStr& emsg); void recvAbort(); // polling support - fxBool requestToPoll(fxStr&); - fxBool pollBegin(const fxStr& cig, const fxStr& sep, const fxStr& pwd, + bool requestToPoll(fxStr&); + bool pollBegin(const fxStr& cig, const fxStr& sep, const fxStr& pwd, fxStr& emsg); // miscellaneous - fxBool faxService(); // switch to fax mode - fxBool reset(long ms); // reset modem + bool faxService(); // switch to fax mode + bool reset(long ms); // reset modem void setLID(const fxStr& number); // set local id string - fxBool supportsPolling() const; // modem capability + bool supportsPolling() const; // modem capability }; #endif /* _CLASS1_ */ diff --git a/faxd/Class1Poll.c++ b/faxd/Class1Poll.c++ index 22c0349a..40c6816e 100644 --- a/faxd/Class1Poll.c++ +++ b/faxd/Class1Poll.c++ @@ -28,13 +28,13 @@ #include "HDLCFrame.h" #include "t.30.h" -fxBool +bool Class1Modem::requestToPoll(fxStr&) { - return TRUE; + return true; } -fxBool +bool Class1Modem::pollBegin(const fxStr& cig0, const fxStr& sep0, const fxStr& pwd0, fxStr& emsg) { @@ -54,9 +54,9 @@ Class1Modem::pollBegin(const fxStr& cig0, send |= DIS_PWD; } - setInputBuffering(FALSE); - prevPage = FALSE; // no previous page received - pageGood = FALSE; // quality of received page + setInputBuffering(false); + prevPage = false; // no previous page received + pageGood = false; // quality of received page return atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 2550) == AT_CONNECT && diff --git a/faxd/Class1Recv.c++ b/faxd/Class1Recv.c++ index a4f54ffc..c90b84f2 100644 --- a/faxd/Class1Recv.c++ +++ b/faxd/Class1Recv.c++ @@ -77,14 +77,14 @@ Class1Modem::findAnswer(const char* s) /* * Begin the receive protocol. */ -fxBool +bool Class1Modem::recvBegin(fxStr& emsg) { - setInputBuffering(FALSE); - prevPage = FALSE; // no previous page received - pageGood = FALSE; // quality of received page - messageReceived = FALSE; // expect message carrier - recvdDCN = FALSE; // haven't seen DCN + setInputBuffering(false); + prevPage = false; // no previous page received + pageGood = false; // quality of received page + messageReceived = false; // expect message carrier + recvdDCN = false; // haven't seen DCN lastPPM = FCF_DCN; // anything will do return FaxModem::recvBegin(emsg) && recvIdentification( @@ -99,7 +99,7 @@ Class1Modem::recvBegin(fxStr& emsg) * Transmit local identification and wait for the * remote side to respond with their identification. */ -fxBool +bool Class1Modem::recvIdentification( u_int f1, const fxStr& pwd, u_int f2, const fxStr& addr, @@ -111,7 +111,7 @@ Class1Modem::recvIdentification( u_int trecovery = howmany(conf.class1TrainingRecovery, 1000); time_t start = Sys::now(); HDLCFrame frame(conf.class1FrameOverhead); - fxBool framesSent; + bool framesSent; emsg = "No answer (T.30 T1 timeout)"; /* @@ -120,27 +120,27 @@ Class1Modem::recvIdentification( */ if (f1) { startTimeout(3000); - framesSent = sendFrame(f1, pwd, FALSE); + framesSent = sendFrame(f1, pwd, false); stopTimeout("sending PWD frame"); } else if (f2) { startTimeout(3000); - framesSent = sendFrame(f2, addr, FALSE); + framesSent = sendFrame(f2, addr, false); stopTimeout("sending SUB/SEP frame"); } else { startTimeout(3000); - framesSent = sendFrame(f3, id, FALSE); + framesSent = sendFrame(f3, id, false); stopTimeout("sending CSI/CIG frame"); } for (;;) { if (framesSent) { if (f1) { startTimeout(2550); - framesSent = sendFrame(f2, addr, FALSE); + framesSent = sendFrame(f2, addr, false); stopTimeout("sending SUB/SEP frame"); } if (framesSent && f2) { startTimeout(2550); - framesSent = sendFrame(f3, id, FALSE); + framesSent = sendFrame(f3, id, false); stopTimeout("sending CSI/CIG frame"); } if (framesSent) { @@ -162,14 +162,14 @@ Class1Modem::recvIdentification( if (!recvDCSFrames(frame)) { if (frame.getFCF() == FCF_DCN) { emsg = "RSPREC error/got DCN"; - recvdDCN = TRUE; + recvdDCN = true; } else // XXX DTC/DIS not handled emsg = "RSPREC invalid response received"; break; } if (recvTraining()) { emsg = ""; - return (TRUE); + return (true); } emsg = "Failure to train modems"; /* @@ -203,19 +203,19 @@ Class1Modem::recvIdentification( * Retransmit ident frames. */ if (f1) - framesSent = transmitFrame(f1, pwd, FALSE); + framesSent = transmitFrame(f1, pwd, false); else if (f2) - framesSent = transmitFrame(f2, addr, FALSE); + framesSent = transmitFrame(f2, addr, false); else - framesSent = transmitFrame(f3, id, FALSE); + framesSent = transmitFrame(f3, id, false); } - return (FALSE); + return (false); } /* * Receive DCS preceded by any optional frames. */ -fxBool +bool Class1Modem::recvDCSFrames(HDLCFrame& frame) { fxStr s; @@ -241,14 +241,14 @@ Class1Modem::recvDCSFrames(HDLCFrame& frame) /* * Receive training and analyze TCF. */ -fxBool +bool Class1Modem::recvTraining() { protoTrace("RECV training at %s %s", modulationNames[curcap->mod], Class2Params::bitRateNames[curcap->br]); HDLCFrame buf(conf.class1FrameOverhead); - fxBool ok = recvTCF(curcap->value, buf, frameRev, conf.class1TCFRecvTimeout); + bool ok = recvTCF(curcap->value, buf, frameRev, conf.class1TCFRecvTimeout); if (ok) { // check TCF data u_int n = buf.getLength(); u_int nonzero = 0; @@ -293,11 +293,11 @@ Class1Modem::recvTraining() if (nonzero > conf.class1TCFMaxNonZero) { protoTrace("RECV: reject TCF (too many non-zero, max %u%%)", conf.class1TCFMaxNonZero); - ok = FALSE; + ok = false; } if (zerorun < minrun) { protoTrace("RECV: reject TCF (zero run too short, min %u)", minrun); - ok = FALSE; + ok = false; } (void) waitFor(AT_NOCARRIER); // wait for message carrier to drop } @@ -346,7 +346,7 @@ const u_int Class1Modem::modemPPMCodes[8] = { * This routine is called after receiving training or after * sending a post-page response in a multi-page document. */ -fxBool +bool Class1Modem::recvPage(TIFF* tif, int& ppm, fxStr& emsg) { top: @@ -356,7 +356,7 @@ top: /* * Look for message carrier and receive Phase C data. */ - setInputBuffering(TRUE); + setInputBuffering(true); if (flowControl == FLOW_XONXOFF) (void) setXONXOFF(FLOW_NONE, FLOW_XONXOFF, ACT_FLUSH); /* @@ -384,13 +384,13 @@ top: */ messageReceived = waitFor(AT_NOCARRIER, 2*1000); if (messageReceived) - prevPage = TRUE; + prevPage = true; timer = conf.t1Timer; // wait longer for PPM } } if (flowControl == FLOW_XONXOFF) (void) setXONXOFF(FLOW_NONE, FLOW_NONE, ACT_DRAIN); - setInputBuffering(FALSE); + setInputBuffering(false); if (!messageReceived && rmResponse != AT_FCERROR) { /* * One of many things may have happened: @@ -419,7 +419,7 @@ top: if (abortRequested()) { // XXX no way to purge TIFF directory emsg = "Receive aborted due to operator intervention"; - return (FALSE); + return (false); } /* * Do command received logic. @@ -430,7 +430,7 @@ top: case FCF_DIS: // XXX no support protoTrace("RECV DIS/DTC"); emsg = "Can not continue after DIS/DTC"; - return (FALSE); + return (false); case FCF_PWD: case FCF_SUB: case FCF_NSS: @@ -456,7 +456,7 @@ top: * was received--this violates the protocol. */ emsg = "COMREC invalid response received"; - return (FALSE); + return (false); } /* * [Re]transmit post page response. @@ -478,7 +478,7 @@ top: */ messageReceived = (lastPPM == FCF_EOM); ppm = modemPPMCodes[lastPPM&7]; - return (TRUE); + return (true); } } else { /* @@ -492,17 +492,17 @@ top: * writes will overwrite the previous data. */ recvResetPage(tif); - messageReceived = TRUE; // expect DCS next + messageReceived = true; // expect DCS next } break; case FCF_DCN: // DCN protoTrace("RECV recv DCN"); emsg = "COMREC received DCN"; - recvdDCN = TRUE; - return (FALSE); + recvdDCN = true; + return (false); default: emsg = "COMREC invalid response received"; - return (FALSE); + return (false); } } } while (!wasTimeout() && lastResponse != AT_EMPTYLINE); @@ -517,7 +517,7 @@ top: goto top; } else emsg = "T.30 T2 timeout, expected page not received"; - return (FALSE); + return (false); } void @@ -530,10 +530,10 @@ Class1Modem::abortPageRecv() /* * Receive Phase C data w/ or w/o copy quality checking. */ -fxBool +bool Class1Modem::recvPageData(TIFF* tif, fxStr& emsg) { - fxBool pageRecvd = recvPageDLEData(tif, checkQuality(), params, emsg); + bool pageRecvd = recvPageDLEData(tif, checkQuality(), params, emsg); TIFFSetField(tif, TIFFTAG_IMAGELENGTH, getRecvEOLCount()); TIFFSetField(tif, TIFFTAG_CLEANFAXDATA, getRecvBadLineCount() ? CLEANFAXDATA_REGENERATED : CLEANFAXDATA_CLEAN); @@ -548,7 +548,7 @@ Class1Modem::recvPageData(TIFF* tif, fxStr& emsg) /* * Complete a receive session. */ -fxBool +bool Class1Modem::recvEnd(fxStr&) { if (!recvdDCN) { @@ -583,8 +583,8 @@ Class1Modem::recvEnd(fxStr&) } while (Sys::now()-start < t1 && (!frame.isOK() || frame.getFCF() == FCF_EOP)); } - setInputBuffering(TRUE); - return (TRUE); + setInputBuffering(true); + return (true); } /* @@ -594,5 +594,5 @@ void Class1Modem::recvAbort() { transmitFrame(FCF_DCN|FCF_RCVR); - recvdDCN = TRUE; // don't hang around in recvEnd + recvdDCN = true; // don't hang around in recvEnd } diff --git a/faxd/Class1Send.c++ b/faxd/Class1Send.c++ index b20cf146..d67578bb 100644 --- a/faxd/Class1Send.c++ +++ b/faxd/Class1Send.c++ @@ -38,7 +38,7 @@ /* * Force the tty into a known flow control state. */ -fxBool +bool Class1Modem::sendSetup(FaxRequest& req, const Class2Params& dis, fxStr& emsg) { if (flowControl == FLOW_XONXOFF) @@ -88,7 +88,7 @@ void Class1Modem::sendBegin() { FaxModem::sendBegin(); - setInputBuffering(FALSE); + setInputBuffering(false); // polling accounting? params.br = (u_int) -1; // force initial training } @@ -97,14 +97,14 @@ Class1Modem::sendBegin() * Get the initial DIS command. */ FaxSendStatus -Class1Modem::getPrologue(Class2Params& params, fxBool& hasDoc, fxStr& emsg) +Class1Modem::getPrologue(Class2Params& params, bool& hasDoc, fxStr& emsg) { u_int t1 = howmany(conf.t1Timer, 1000); // T1 timer in seconds time_t start = Sys::now(); HDLCFrame frame(conf.class1FrameOverhead); startTimeout(conf.t2Timer); - fxBool framerecvd = recvRawFrame(frame); + bool framerecvd = recvRawFrame(frame); stopTimeout("receiving id frame"); for (;;) { if (framerecvd) { @@ -198,14 +198,14 @@ const u_int Class1Modem::modemPFMCodes[8] = { FCF_EOP, // 7 ??? XXX }; -fxBool +bool Class1Modem::decodePPM(const fxStr& pph, u_int& ppm, fxStr& emsg) { if (FaxModem::decodePPM(pph, ppm, emsg)) { ppm = modemPFMCodes[ppm]; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* @@ -218,7 +218,7 @@ Class1Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info, fxStr& pph, fxStr& emsg) { int ntrys = 0; // # retraining/command repeats - fxBool morePages = TRUE; // more pages still to send + bool morePages = true; // more pages still to send HDLCFrame frame(conf.class1FrameOverhead); do { @@ -319,7 +319,7 @@ Class1Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info, } if (!sendTraining(params, 3, emsg)) return (send_retry); - morePages = TRUE; // force continuation + morePages = true; // force continuation next = params; // avoid retraining above break; case FCF_PIN: // nak, retry w/ operator intervention @@ -346,13 +346,13 @@ Class1Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info, * Note that we send real zero data here rather than using * the Class 1 modem facility to do zero fill. */ -fxBool +bool Class1Modem::sendTCF(const Class2Params& params, u_int ms) { u_int tcfLen = params.transferSize(ms); u_char* tcf = new u_char[tcfLen]; memset(tcf, 0, tcfLen); - fxBool ok = transmitData(curcap->value, tcf, tcfLen, frameRev, TRUE); + bool ok = transmitData(curcap->value, tcf, tcfLen, frameRev, true); delete tcf; return ok; } @@ -364,34 +364,34 @@ Class1Modem::sendTCF(const Class2Params& params, u_int ms) * TSI transmitter subscriber id * DCS digital command signal */ -fxBool +bool Class1Modem::sendPrologue(u_int dcs, u_int dcs_xinfo, const fxStr& tsi) { - fxBool frameSent = ( + bool frameSent = ( atCmd(thCmd, AT_NOTHING) && atResponse(rbuf, 2550) == AT_CONNECT ); if (!frameSent) - return (FALSE); + return (false); if (pwd != fxStr::null) { startTimeout(2550); // 3.0 - 15% = 2.55 secs - fxBool frameSent = sendFrame(FCF_PWD|FCF_SNDR, pwd, FALSE); + bool frameSent = sendFrame(FCF_PWD|FCF_SNDR, pwd, false); stopTimeout("sending PWD frame"); if (!frameSent) - return (FALSE); + return (false); } if (sub != fxStr::null) { startTimeout(2550); // 3.0 - 15% = 2.55 secs - fxBool frameSent = sendFrame(FCF_SUB|FCF_SNDR, sub, FALSE); + bool frameSent = sendFrame(FCF_SUB|FCF_SNDR, sub, false); stopTimeout("sending SUB frame"); if (!frameSent) - return (FALSE); + return (false); } startTimeout(2550); // 3.0 - 15% = 2.55 secs - frameSent = sendFrame(FCF_TSI|FCF_SNDR, tsi, FALSE); + frameSent = sendFrame(FCF_TSI|FCF_SNDR, tsi, false); stopTimeout("sending TSI frame"); if (!frameSent) - return (FALSE); + return (false); startTimeout(2550); // 3.0 - 15% = 2.55 secs frameSent = sendFrame(FCF_DCS|FCF_SNDR, dcs, dcs_xinfo); stopTimeout("sending DCS frame"); @@ -402,14 +402,14 @@ Class1Modem::sendPrologue(u_int dcs, u_int dcs_xinfo, const fxStr& tsi) * Return whether or not the previously received DIS indicates * the remote side is capable of the T.30 DCS signalling rate. */ -static fxBool +static bool isCapable(u_int sr, u_int dis) { dis = (dis & DIS_SIGRATE) >> 10; switch (sr) { case DCSSIGRATE_2400V27: if (dis == DISSIGRATE_V27FB) - return (TRUE); + return (true); /* fall thru... */ case DCSSIGRATE_4800V27: return ((dis & DISSIGRATE_V27) != 0); @@ -419,7 +419,7 @@ isCapable(u_int sr, u_int dis) case DCSSIGRATE_14400V33: case DCSSIGRATE_12000V33: if (dis == DISSIGRATE_V33) - return (TRUE); + return (true); /* fall thru... */ case DCSSIGRATE_14400V17: case DCSSIGRATE_12000V17: @@ -427,18 +427,18 @@ isCapable(u_int sr, u_int dis) case DCSSIGRATE_7200V17: return (dis == DISSIGRATE_V17); } - return (FALSE); + return (false); } /* * Send capabilities and do training. */ -fxBool +bool Class1Modem::sendTraining(Class2Params& params, int tries, fxStr& emsg) { if (tries == 0) { emsg = "DIS/DTC received 3 times; DCS not recognized"; - return (FALSE); + return (false); } u_int dcs = params.getDCS(); // NB: 24-bit DCS and u_int dcs_xinfo = params.getXINFO(); // 32-bit extension @@ -514,7 +514,7 @@ Class1Modem::sendTraining(Class2Params& params, int tries, fxStr& emsg) case FCF_CFR: // training confirmed protoTrace("TRAINING succeeded"); setDataTimeout(60, params.br); - return (TRUE); + return (true); case FCF_FTT: // failure to train, retry break; case FCF_DIS: // new capabilities, maybe @@ -548,26 +548,26 @@ failed: emsg = "Failure to train remote modem at 2400 bps or minimum speed"; done: protoTrace("TRAINING failed"); - return (FALSE); + return (false); } /* * Select the next lower signalling rate that's * acceptable to both local and remote machines. */ -fxBool +bool Class1Modem::dropToNextBR(Class2Params& params) { for (;;) { if (params.br == minsp) - return (FALSE); + return (false); // get ``best capability'' of modem at this baud rate curcap = findBRCapability(--params.br, xmitCaps); if (curcap) { // hunt for compatibility with remote at this baud rate do { if (isCapable(curcap->sr, dis)) - return (TRUE); + return (true); curcap--; } while (curcap->br == params.br); } @@ -579,19 +579,19 @@ Class1Modem::dropToNextBR(Class2Params& params) * Select the next higher signalling rate that's * acceptable to both local and remote machines. */ -fxBool +bool Class1Modem::raiseToNextBR(Class2Params& params) { for (;;) { if (params.br == BR_14400) // highest speed - return (FALSE); + return (false); // get ``best capability'' of modem at this baud rate curcap = findBRCapability(++params.br, xmitCaps); if (curcap) { // hunt for compatibility with remote at this baud rate do { if (isCapable(curcap->sr, dis)) - return (TRUE); + return (true); curcap--; } while (curcap->br == params.br); } @@ -602,11 +602,11 @@ Class1Modem::raiseToNextBR(Class2Params& params) /* * Send data for the current page. */ -fxBool +bool Class1Modem::sendPageData(u_char* data, u_int cc, const u_char* bitrev) { beginTimedTransfer(); - fxBool rc = sendClass1Data(data, cc, bitrev, FALSE); + bool rc = sendClass1Data(data, cc, bitrev, false); endTimedTransfer(); protoTrace("SENT %u bytes of data", cc); return rc; @@ -618,8 +618,8 @@ Class1Modem::sendPageData(u_char* data, u_int cc, const u_char* bitrev) * seems that some Class 1 modems do not immediately * send all the data they are presented. */ -fxBool -Class1Modem::sendRTC(fxBool is2D) +bool +Class1Modem::sendRTC(bool is2D) { static const u_char RTC1D[9+20] = { 0x00,0x10,0x01,0x00,0x10,0x01,0x00,0x10,0x01 }; @@ -627,13 +627,13 @@ Class1Modem::sendRTC(fxBool is2D) { 0x00,0x18,0x00,0xC0,0x06,0x00,0x30,0x01,0x80,0x0C }; protoTrace("SEND %s RTC", is2D ? "2D" : "1D"); if (is2D) - return sendClass1Data(RTC2D, sizeof (RTC2D), frameRev, TRUE); + return sendClass1Data(RTC2D, sizeof (RTC2D), frameRev, true); else - return sendClass1Data(RTC1D, sizeof (RTC1D), frameRev, TRUE); + return sendClass1Data(RTC1D, sizeof (RTC1D), frameRev, true); } #define EOLcheck(w,mask,code) \ - if ((w & mask) == code) { w |= mask; return (TRUE); } + if ((w & mask) == code) { w |= mask; return (true); } /* * Check the last 24 bits of received T.4-encoded @@ -642,7 +642,7 @@ Class1Modem::sendRTC(fxBool is2D) * to insure future calls do not re-recognize an * EOL code. */ -static fxBool +static bool EOLcode(u_long& w) { if ((w & 0x00f00f) == 0) { @@ -663,14 +663,14 @@ EOLcode(u_long& w) EOLcheck(w, 0xfc3f00, 0x002000); EOLcheck(w, 0xfe1f00, 0x001000); } - return (FALSE); + return (false); } #undef EOLcheck /* * Send a page of data. */ -fxBool +bool Class1Modem::sendPage(TIFF* tif, const Class2Params& params, u_int pageChop, fxStr& emsg) { /* @@ -682,9 +682,9 @@ Class1Modem::sendPage(TIFF* tif, const Class2Params& params, u_int pageChop, fxS fxStr tmCmd(curcap[HasShortTraining(curcap)].value, tmCmdFmt); if (!atCmd(tmCmd, AT_CONNECT)) { emsg = "Unable to establish message carrier"; - return (FALSE); + return (false); } - fxBool rc = TRUE; + bool rc = true; protoTrace("SEND begin page"); if (flowControl == FLOW_XONXOFF) setXONXOFF(FLOW_XONXOFF, FLOW_NONE, ACT_FLUSH); @@ -701,7 +701,7 @@ Class1Modem::sendPage(TIFF* tif, const Class2Params& params, u_int pageChop, fxS /* * Setup tag line processing. */ - fxBool doTagLine = setupTagLineSlop(params); + bool doTagLine = setupTagLineSlop(params); u_int ts = getTagLineSlop(); /* * Calculate total amount of space needed to read @@ -834,18 +834,18 @@ Class1Modem::sendPage(TIFF* tif, const Class2Params& params, u_int pageChop, fxS /* * Send the post-page-message and wait for a response. */ -fxBool +bool Class1Modem::sendPPM(u_int ppm, HDLCFrame& mcf, fxStr& emsg) { for (int t = 0; t < 3; t++) { tracePPM("SEND send", ppm); if (transmitFrame(ppm|FCF_SNDR) && recvFrame(mcf, conf.t4Timer)) - return (TRUE); + return (true); if (abortRequested()) - return (FALSE); + return (false); } emsg = "No response to MPS or EOP repeated 3 tries"; - return (FALSE); + return (false); } /* @@ -855,7 +855,7 @@ void Class1Modem::sendEnd() { transmitFrame(FCF_DCN|FCF_SNDR); // disconnect - setInputBuffering(TRUE); + setInputBuffering(true); } /* diff --git a/faxd/Class2.c++ b/faxd/Class2.c++ index 28524402..ec31dfb9 100644 --- a/faxd/Class2.c++ +++ b/faxd/Class2.c++ @@ -54,17 +54,17 @@ Class2Modem::setupDefault(fxStr& s, const fxStr& configured, const char* def) * the manufacturer-specific bogosity here and leave * the remainder of the Class 2 support fairly generic. */ -fxBool +bool Class2Modem::setupModem() { if (!selectBaudRate(conf.maxRate, conf.flowControl, conf.flowControl)) - return (FALSE); + return (false); // Query service support information fxStr s; if (doQuery(conf.classQueryCmd, s, 500) && FaxModem::parseRange(s, modemServices)) traceBits(modemServices & SERVICE_ALL, serviceNames); if ((modemServices & serviceType) == 0) - return (FALSE); + return (false); atCmd(classCmd); /* @@ -91,7 +91,7 @@ Class2Modem::setupModem() fxStr t30parms; if (!doQuery(dccQueryCmd, t30parms, 500)) { serverTrace("Error getting modem capabilities"); - return (FALSE); + return (false); } /* * Syntax: (vr),(br),(wd),(ln),(df),(ec),(bf),(st) @@ -108,7 +108,7 @@ Class2Modem::setupModem() if (!parseRange(t30parms, modemParams)) { serverTrace("Error parsing " | dccQueryCmd | " response: " "\"" | t30parms | "\""); - return (FALSE); + return (false); } traceModemParams(); /* @@ -177,15 +177,15 @@ Class2Modem::setupModem() * during a transmission. This went away in SP-2388-B and in * the final Class 2.0 spec. Consequently we configure the * modem either to ignore it (Class 2.0) or to use whatever - * is configured (it defaults to TRUE). + * is configured (it defaults to true). */ if (serviceType == SERVICE_CLASS20) - xmitWaitForXON = FALSE; + xmitWaitForXON = false; else xmitWaitForXON = conf.class2XmitWaitForXON; setupClass2Parameters(); // send parameters to the modem - return (TRUE); + return (true); } /* @@ -197,7 +197,7 @@ Class2Modem::setupModem() * 0. This interface is used only for outbound use or when * followed by setup of receive-specific parameters. */ -fxBool +bool Class2Modem::setupClass2Parameters() { if (modemServices & serviceType) { // when resetting at startup @@ -227,13 +227,13 @@ Class2Modem::setupClass2Parameters() */ setupDCC(); } - return (TRUE); + return (true); } /* * Setup receive-specific parameters. */ -fxBool +bool Class2Modem::setupReceive() { /* @@ -270,7 +270,7 @@ Class2Modem::setupReceive() * Send the modem any commands needed to force use of * the specified flow control scheme. */ -fxBool +bool Class2Modem::setupFlowControl(FlowControl fc) { switch (fc) { @@ -278,13 +278,13 @@ Class2Modem::setupFlowControl(FlowControl fc) case FLOW_XONXOFF: return atCmd(softFlowCmd); case FLOW_RTSCTS: return atCmd(hardFlowCmd); } - return (TRUE); + return (true); } /* * Setup DCC to reflect best capabilities of the server. */ -fxBool +bool Class2Modem::setupDCC() { params.vr = getBestVRes(); @@ -302,7 +302,7 @@ Class2Modem::setupDCC() * Parse a ``capabilities'' string from the modem and * return the values through the params parameter. */ -fxBool +bool Class2Modem::parseClass2Capabilities(const char* cap, Class2Params& params) { int n = sscanf(cap, "%d,%d,%d,%d,%d,%d,%d,%d", @@ -323,10 +323,10 @@ Class2Modem::parseClass2Capabilities(const char* cap, Class2Params& params) if (params.bf > BF_ENABLE) params.bf = BF_DISABLE; params.st = fxmin(params.st, (u_int) ST_40MS); - return (TRUE); + return (true); } else { protoTrace("MODEM protocol botch, can not parse \"%s\"", cap); - return (FALSE); + return (false); } } @@ -334,13 +334,13 @@ Class2Modem::parseClass2Capabilities(const char* cap, Class2Params& params) * Place the modem into the appropriate state * for sending/received facsimile. */ -fxBool +bool Class2Modem::faxService() { return setupClass2Parameters() && class2Cmd(lidCmd, lid); } -fxBool +bool Class2Modem::setupRevision(fxStr& revision) { if (FaxModem::setupRevision(revision)) { @@ -355,12 +355,12 @@ Class2Modem::setupRevision(fxStr& revision) modemRevision.remove(0, pos); } } - return (TRUE); + return (true); } else - return (FALSE); + return (false); } -fxBool +bool Class2Modem::setupModel(fxStr& model) { if (FaxModem::setupModel(model)) { @@ -370,12 +370,12 @@ Class2Modem::setupModel(fxStr& model) */ if (modemMfr == "ZYXEL") modemModel.resize(modemModel.next(0, ' ')); // model is first word - return (TRUE); + return (true); } else - return (FALSE); + return (false); } -fxBool +bool Class2Modem::supportsPolling() const { return (hasPolling); @@ -425,7 +425,7 @@ Class2Modem::setLID(const fxStr& number) /* * Reset a Class 2 modem. */ -fxBool +bool Class2Modem::reset(long ms) { return (FaxModem::reset(ms) && setupClass2Parameters()); @@ -439,13 +439,13 @@ Class2Modem::reset(long ms) * us an unsolicited NO CARRIER message. Isn't life * wondeful? */ -fxBool +bool Class2Modem::waitFor(ATResponse wanted, long ms) { for (;;) { ATResponse response = atResponse(rbuf, ms); if (response == wanted) - return (TRUE); + return (true); switch (response) { case AT_TIMEOUT: case AT_EMPTYLINE: @@ -454,7 +454,7 @@ Class2Modem::waitFor(ATResponse wanted, long ms) case AT_NODIALTONE: case AT_NOANSWER: modemTrace("MODEM %s", ATresponses[response]); - return (FALSE); + return (false); case AT_FHNG: // return hangup status, but try to wait for requested response { char buf[1024]; (void) atResponse(buf, 2*1000); } @@ -470,7 +470,7 @@ Class2Modem::waitFor(ATResponse wanted, long ms) /* * Send = and wait for response. */ -fxBool +bool Class2Modem::class2Cmd(const fxStr& cmd, int a0, ATResponse r, long ms) { return atCmd(cmd | fxStr(a0, "=%u"), r, ms); @@ -479,7 +479,7 @@ Class2Modem::class2Cmd(const fxStr& cmd, int a0, ATResponse r, long ms) /* * Send = and wait response. */ -fxBool +bool Class2Modem::class2Cmd(const fxStr& cmd, const Class2Params& p, ATResponse r, long ms) { return atCmd(cmd | "=" | p.cmd(), r, ms); @@ -488,7 +488,7 @@ Class2Modem::class2Cmd(const fxStr& cmd, const Class2Params& p, ATResponse r, lo /* * Send ="" and wait for response. */ -fxBool +bool Class2Modem::class2Cmd(const fxStr& cmd, const fxStr& s, ATResponse r, long ms) { return atCmd(cmd | "=\"" | s | "\"", r, ms); // XXX handle escapes @@ -498,11 +498,11 @@ Class2Modem::class2Cmd(const fxStr& cmd, const fxStr& s, ATResponse r, long ms) * Parse a Class 2 parameter specification * and return the resulting bit masks. */ -fxBool +bool Class2Modem::parseRange(const char* cp, Class2Params& p) { if (!vparseRange(cp, 8, &p.vr,&p.br,&p.wd,&p.ln,&p.df,&p.ec,&p.bf,&p.st)) - return (FALSE); + return (false); p.vr &= VR_ALL; p.br &= BR_ALL; p.wd &= WD_ALL; @@ -511,7 +511,7 @@ Class2Modem::parseRange(const char* cp, Class2Params& p) p.ec &= EC_ALL; p.bf &= BF_ALL; p.st &= ST_ALL; - return TRUE; + return true; } const char* @@ -652,7 +652,7 @@ Class2Modem::processHangup(const char* cp) * that the remote side hung up the phone in a * "normal and proper way". */ -fxBool +bool Class2Modem::isNormalHangup() { // normal hangup is "", "0", or "00" diff --git a/faxd/Class2.h b/faxd/Class2.h index d92b6526..02b1e8ba 100644 --- a/faxd/Class2.h +++ b/faxd/Class2.h @@ -61,36 +61,36 @@ protected: u_int serviceType; // modem service required u_int modemCQ; // copy quality capabilities mask - fxBool xmitWaitForXON; // if true, wait for XON when sending - fxBool hostDidCQ; // if true, copy quality done on host - fxBool hasPolling; // if true, modem does polled recv + bool xmitWaitForXON; // if true, wait for XON when sending + bool hostDidCQ; // if true, copy quality done on host + bool hasPolling; // if true, modem does polled recv char recvDataTrigger; // char to send to start recv'ing data char hangupCode[4]; // hangup reason (from modem) - fxBool hadHangup; // true if +FHNG:/+FHS: received + bool hadHangup; // true if +FHNG:/+FHS: received const u_char* rtcRev; // bit reversal table for RTC fxStr lid; // prepared local identifier string // modem setup stuff void setupDefault(fxStr&, const fxStr&, const char*); - virtual fxBool setupModem(); - virtual fxBool setupModel(fxStr& model); - virtual fxBool setupRevision(fxStr& rev); - virtual fxBool setupDCC(); - virtual fxBool setupClass2Parameters(); - virtual fxBool setupFlowControl(FlowControl fc); + virtual bool setupModem(); + virtual bool setupModel(fxStr& model); + virtual bool setupRevision(fxStr& rev); + virtual bool setupDCC(); + virtual bool setupClass2Parameters(); + virtual bool setupFlowControl(FlowControl fc); // transmission support - fxBool dataTransfer(); - fxBool sendRTC(fxBool is2D); - fxBool sendPageData(TIFF* tif, u_int pageChop); + bool dataTransfer(); + bool sendRTC(bool is2D); + bool sendPageData(TIFF* tif, u_int pageChop); - virtual fxBool sendPage(TIFF* tif, u_int pageChop) = 0; - virtual fxBool pageDone(u_int ppm, u_int& ppr) = 0; + virtual bool sendPage(TIFF* tif, u_int pageChop) = 0; + virtual bool pageDone(u_int ppm, u_int& ppr) = 0; // reception support const AnswerMsg* findAnswer(const char*); - fxBool recvDCS(const char*); - fxBool recvPageData(TIFF*, fxStr& emsg); - fxBool recvPPM(TIFF*, int& ppr); - fxBool parseFPTS(TIFF*, const char* cp, int& ppr); + bool recvDCS(const char*); + bool recvPageData(TIFF*, fxStr& emsg); + bool recvPPM(TIFF*, int& ppr); + bool parseFPTS(TIFF*, const char* cp, int& ppr); void abortPageRecv(); // miscellaneous enum { // Class 2-specific AT responses @@ -111,24 +111,24 @@ protected: AT_FPW = 114 // password status }; virtual ATResponse atResponse(char* buf, long ms = 30*1000) = 0; - fxBool waitFor(ATResponse wanted, long ms = 30*1000); + bool waitFor(ATResponse wanted, long ms = 30*1000); fxStr stripQuotes(const char*); // hangup processing void processHangup(const char*); - fxBool isNormalHangup(); + bool isNormalHangup(); const char* hangupCause(const char* code); void tracePPR(const char* dir, u_int ppr); void tracePPM(const char* dir, u_int ppm); // class 2 command support routines - fxBool class2Cmd(const fxStr& cmd, int a0, + bool class2Cmd(const fxStr& cmd, int a0, ATResponse = AT_OK, long ms = 30*1000); - fxBool class2Cmd(const fxStr& cmd, const fxStr& a0, + bool class2Cmd(const fxStr& cmd, const fxStr& a0, ATResponse = AT_OK, long ms = 30*1000); - fxBool class2Cmd(const fxStr& cmd, const Class2Params&, + bool class2Cmd(const fxStr& cmd, const Class2Params&, ATResponse =AT_OK, long ms = 30*1000); // parsing routines for capability¶meter strings - fxBool parseClass2Capabilities(const char* cap, Class2Params&); - fxBool parseRange(const char*, Class2Params&); + bool parseClass2Capabilities(const char* cap, Class2Params&); + bool parseRange(const char*, Class2Params&); const char* skipStatus(const char*); Class2Modem(FaxServer&, const ModemConfig&); @@ -136,29 +136,29 @@ public: virtual ~Class2Modem(); // send support - fxBool sendSetup(FaxRequest&, const Class2Params&, fxStr& emsg); + bool sendSetup(FaxRequest&, const Class2Params&, fxStr& emsg); CallStatus dialResponse(fxStr& emsg); - FaxSendStatus getPrologue(Class2Params&, fxBool&, fxStr&); + FaxSendStatus getPrologue(Class2Params&, bool&, fxStr&); FaxSendStatus sendPhaseB(TIFF* tif, Class2Params&, FaxMachineInfo&, fxStr& pph, fxStr& emsg); void sendAbort(); // receive support - fxBool setupReceive(); - fxBool recvBegin(fxStr& emsg); - fxBool recvPage(TIFF*, int& ppm, fxStr& emsg); - fxBool recvEnd(fxStr& emsg); + bool setupReceive(); + bool recvBegin(fxStr& emsg); + bool recvPage(TIFF*, int& ppm, fxStr& emsg); + bool recvEnd(fxStr& emsg); void recvAbort(); // polling support - fxBool requestToPoll(fxStr& emsg); - fxBool pollBegin(const fxStr& cig, const fxStr& sep, const fxStr& pwd, + bool requestToPoll(fxStr& emsg); + bool pollBegin(const fxStr& cig, const fxStr& sep, const fxStr& pwd, fxStr& emsg); // miscellaneous - fxBool faxService(); // switch to fax mode - fxBool reset(long ms); // reset modem + bool faxService(); // switch to fax mode + bool reset(long ms); // reset modem void setLID(const fxStr& number); // set local id string - fxBool supportsPolling() const; // modem capability + bool supportsPolling() const; // modem capability }; #endif /* _CLASS2_ */ diff --git a/faxd/Class20.c++ b/faxd/Class20.c++ index 749cdb48..b72e3665 100644 --- a/faxd/Class20.c++ +++ b/faxd/Class20.c++ @@ -75,7 +75,7 @@ Class20Modem::atResponse(char* buf, long ms) if (strneq(buf, "+FHS:", 5)) { processHangup(buf+5); lastResponse = AT_FHNG; - hadHangup = TRUE; + hadHangup = true; } else if (strneq(buf, "+FCO", 4)) lastResponse = AT_FCON; else if (strneq(buf, "+FPO", 4)) @@ -122,13 +122,13 @@ Class20Modem::abortDataTransfer() /* * Send a page of data using the ``stream interface''. */ -fxBool +bool Class20Modem::sendPage(TIFF* tif, u_int pageChop) { protoTrace("SEND begin page"); if (flowControl == FLOW_XONXOFF) setXONXOFF(FLOW_XONXOFF, FLOW_NONE, ACT_FLUSH); - fxBool rc = sendPageData(tif, pageChop); + bool rc = sendPageData(tif, pageChop); if (!rc) abortDataTransfer(); else @@ -146,7 +146,7 @@ Class20Modem::sendPage(TIFF* tif, u_int pageChop) * instead synthesize codes, ignoring whether or not the * modem does retraining on the next page transfer. */ -fxBool +bool Class20Modem::pageDone(u_int ppm, u_int& ppr) { static char ppmCodes[3] = { 0x2C, 0x3B, 0x2E }; @@ -161,14 +161,14 @@ Class20Modem::pageDone(u_int ppm, u_int& ppr) switch (atResponse(rbuf, conf.pageDoneTimeout)) { case AT_FHNG: if (!isNormalHangup()) - return (FALSE); + return (false); /* fall thru... */ case AT_OK: // page data good ppr = PPR_MCF; // could be PPR_RTP/PPR_PIP - return (TRUE); + return (true); case AT_ERROR: // page data bad ppr = PPR_RTN; // could be PPR_PIN - return (TRUE); + return (true); case AT_EMPTYLINE: case AT_TIMEOUT: case AT_NOCARRIER: @@ -180,7 +180,7 @@ Class20Modem::pageDone(u_int ppm, u_int& ppr) } bad: processHangup("50"); // Unspecified Phase D error - return (FALSE); + return (false); } /* diff --git a/faxd/Class20.h b/faxd/Class20.h index ec722673..2f5cc305 100644 --- a/faxd/Class20.h +++ b/faxd/Class20.h @@ -33,8 +33,8 @@ class Class20Modem : public Class2Modem { protected: // transmission support - fxBool sendPage(TIFF* tif, u_int pageChop); - fxBool pageDone(u_int ppm, u_int& ppr); + bool sendPage(TIFF* tif, u_int pageChop); + bool pageDone(u_int ppm, u_int& ppr); void abortDataTransfer(); // reception support diff --git a/faxd/Class2Ersatz.c++ b/faxd/Class2Ersatz.c++ index 7f262804..eb409f3a 100644 --- a/faxd/Class2Ersatz.c++ +++ b/faxd/Class2Ersatz.c++ @@ -70,7 +70,7 @@ Class2ErsatzModem::atResponse(char* buf, long ms) if (strneq(buf, "+FHNG:", 6)) { processHangup(buf+6); lastResponse = AT_FHNG; - hadHangup = TRUE; + hadHangup = true; } else if (strneq(buf, "+FCON", 5)) lastResponse = AT_FCON; else if (strneq(buf, "+FPOLL", 6)) @@ -104,7 +104,7 @@ Class2ErsatzModem::atResponse(char* buf, long ms) /* * Handle the page-end protocol. */ -fxBool +bool Class2ErsatzModem::pageDone(u_int ppm, u_int& ppr) { ppr = 0; // something invalid @@ -115,7 +115,7 @@ Class2ErsatzModem::pageDone(u_int ppm, u_int& ppr) if (sscanf(rbuf+6, "%u", &ppr) != 1) { protoTrace("MODEM protocol botch (\"%s\"), %s", rbuf, "can not parse PPR"); - return (FALSE); // force termination + return (false); // force termination } /* * (In some firmware revisions...) The ZyXEL modem @@ -129,11 +129,11 @@ Class2ErsatzModem::pageDone(u_int ppm, u_int& ppr) * page is good (i.e. we would hang up immediately anyway). */ if (ppm == PPM_EOP && ppr == PPR_MCF) - return (TRUE); + return (true); break; case AT_OK: // normal result code case AT_ERROR: // possible if page retransmit - return (TRUE); + return (true); case AT_FHNG: /* * Certain modems respond +FHNG:0 on the final page @@ -144,7 +144,7 @@ Class2ErsatzModem::pageDone(u_int ppm, u_int& ppr) */ if (ppm == PPM_EOP && ppr == 0 && isNormalHangup()) { ppr = PPR_MCF; - return (TRUE); + return (true); } return (isNormalHangup()); case AT_EMPTYLINE: @@ -158,7 +158,7 @@ Class2ErsatzModem::pageDone(u_int ppm, u_int& ppr) } bad: processHangup("50"); // Unspecified Phase D error - return (FALSE); + return (false); } /* @@ -175,7 +175,7 @@ Class2ErsatzModem::abortDataTransfer() /* * Send an end-of-transmission signal to the modem. */ -fxBool +bool Class2ErsatzModem::sendEOT() { static char EOT[] = { DLE, ETX }; @@ -185,13 +185,13 @@ Class2ErsatzModem::sendEOT() /* * Send a page of data using the ``stream interface''. */ -fxBool +bool Class2ErsatzModem::sendPage(TIFF* tif, u_int pageChop) { protoTrace("SEND begin page"); if (flowControl == FLOW_XONXOFF) setXONXOFF(FLOW_XONXOFF, FLOW_NONE, ACT_FLUSH); - fxBool rc = sendPageData(tif, pageChop); + bool rc = sendPageData(tif, pageChop); if (rc && conf.class2SendRTC) rc = sendRTC(params.is2D()); if (rc) diff --git a/faxd/Class2Ersatz.h b/faxd/Class2Ersatz.h index f6cf53c0..e0854920 100644 --- a/faxd/Class2Ersatz.h +++ b/faxd/Class2Ersatz.h @@ -33,10 +33,10 @@ class Class2ErsatzModem : public Class2Modem { protected: // transmission support - fxBool sendPage(TIFF* tif, u_int pageChop); - fxBool pageDone(u_int ppm, u_int& ppr); + bool sendPage(TIFF* tif, u_int pageChop); + bool pageDone(u_int ppm, u_int& ppr); - fxBool sendEOT(); + bool sendEOT(); void abortDataTransfer(); // miscellaneous virtual ATResponse atResponse(char* buf, long ms = 30*1000); diff --git a/faxd/Class2Poll.c++ b/faxd/Class2Poll.c++ index ab791cfb..96e93ae1 100644 --- a/faxd/Class2Poll.c++ +++ b/faxd/Class2Poll.c++ @@ -29,36 +29,36 @@ /* * Request to poll remote documents. */ -fxBool +bool Class2Modem::requestToPoll(fxStr& emsg) { if (!class2Cmd(splCmd, 1)) { emsg = "Unable to request polling operation" " (modem may not support polling)"; - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* * Startup a polled receive operation. */ -fxBool +bool Class2Modem::pollBegin(const fxStr& cig, const fxStr& sep, const fxStr& pwd, fxStr& emsg) { const char* cmdFailed = "Unable to setup %s (modem command failed)"; if (!class2Cmd(cigCmd, cig)) { // set polling ID emsg = fxStr::format(cmdFailed, "polling identifer"); - return (FALSE); + return (false); } if (sep != "" && paCmd != "" && !class2Cmd(paCmd, sep)) { emsg = fxStr::format(cmdFailed, "selective polling address"); - return (FALSE); + return (false); } if (pwd != "" && pwCmd != "" && !class2Cmd(pwCmd, pwd)) { emsg = fxStr::format(cmdFailed, "polling password"); - return (FALSE); + return (false); } - return (TRUE); + return (true); } diff --git a/faxd/Class2Recv.c++ b/faxd/Class2Recv.c++ index afaf8739..3fdb2f55 100644 --- a/faxd/Class2Recv.c++ +++ b/faxd/Class2Recv.c++ @@ -56,12 +56,12 @@ Class2Modem::findAnswer(const char* s) /* * Begin a fax receive session. */ -fxBool +bool Class2Modem::recvBegin(fxStr& emsg) { - fxBool status = FALSE; + bool status = false; hangupCode[0] = '\0'; - hadHangup = FALSE; + hadHangup = false; ATResponse r; do { switch (r = atResponse(rbuf, 3*60*1000)) { @@ -73,7 +73,7 @@ Class2Modem::recvBegin(fxStr& emsg) case AT_EMPTYLINE: processHangup("70"); emsg = hangupCause(hangupCode); - return (FALSE); + return (false); case AT_FNSS: // XXX parse and pass on to server break; @@ -95,7 +95,7 @@ Class2Modem::recvBegin(fxStr& emsg) status = recvDCS(rbuf); break; case AT_FHNG: - status = FALSE; + status = false; break; } } while (r != AT_OK); @@ -107,16 +107,16 @@ Class2Modem::recvBegin(fxStr& emsg) /* * Process a received DCS. */ -fxBool +bool Class2Modem::recvDCS(const char* cp) { if (parseClass2Capabilities(skipStatus(cp), params)) { setDataTimeout(60, params.br); FaxModem::recvDCS(params); // announce session params - return (TRUE); + return (true); } else { // protocol botch processHangup("72"); // XXX "COMREC error" - return (FALSE); + return (false); } } @@ -125,7 +125,7 @@ Class2Modem::recvDCS(const char* cp) * and then collect the data. Return the * received post-page-message. */ -fxBool +bool Class2Modem::recvPage(TIFF* tif, int& ppm, fxStr& emsg) { int ppr; @@ -201,7 +201,7 @@ Class2Modem::recvPage(TIFF* tif, int& ppm, fxStr& emsg) if (abortRequested()) { // XXX no way to purge TIFF directory emsg = "Receive aborted due to operator intervention"; - return (FALSE); + return (false); } // XXX deal with PRI interrupts /* @@ -218,13 +218,13 @@ Class2Modem::recvPage(TIFF* tif, int& ppm, fxStr& emsg) recvResetPage(tif); // reset to overwrite data tracePPR("RECV send", ppr); if (ppr & 1) // page good, work complete - return (TRUE); + return (true); } while (!hostDidCQ || class2Cmd(ptsCmd, ppr)); bad: if (hangupCode[0] == 0) processHangup("90"); // "Unspecified Phase C error" emsg = hangupCause(hangupCode); - return (FALSE); + return (false); } void @@ -237,7 +237,7 @@ Class2Modem::abortPageRecv() /* * Receive Phase C data using the Class 2 ``stream interface''. */ -fxBool +bool Class2Modem::recvPageData(TIFF* tif, fxStr& emsg) { if (flowControl == FLOW_XONXOFF) @@ -251,7 +251,7 @@ Class2Modem::recvPageData(TIFF* tif, fxStr& emsg) * parameters indicate CQ checking is to be done. */ hostDidCQ = (modemCQ && BIT(params.df)) == 0 && checkQuality(); - fxBool pageRecvd = recvPageDLEData(tif, hostDidCQ, params, emsg); + bool pageRecvd = recvPageDLEData(tif, hostDidCQ, params, emsg); // be careful about flushing here -- otherwise we lose +FPTS codes if (flowControl == FLOW_XONXOFF) @@ -262,7 +262,7 @@ Class2Modem::recvPageData(TIFF* tif, fxStr& emsg) return (pageRecvd); } -fxBool +bool Class2Modem::recvPPM(TIFF* tif, int& ppr) { for (;;) { @@ -277,21 +277,21 @@ Class2Modem::recvPPM(TIFF* tif, int& ppr) case AT_NOANSWER: case AT_ERROR: processHangup("50"); - return (FALSE); + return (false); case AT_FPTS: return parseFPTS(tif, skipStatus(rbuf), ppr); case AT_FET: protoTrace("MODEM protocol botch: +FET: without +FPTS:"); processHangup("100"); // "Unspecified Phase D error" - return (FALSE); + return (false); case AT_FHNG: waitFor(AT_OK); // resynchronize modem - return (FALSE); + return (false); } } } -fxBool +bool Class2Modem::parseFPTS(TIFF* tif, const char* cp, int& ppr) { int lc = 0; @@ -307,19 +307,19 @@ Class2Modem::parseFPTS(TIFF* tif, const char* cp, int& ppr) TIFFSetField(tif, TIFFTAG_BADFAXLINES, (u_long) blc); TIFFSetField(tif, TIFFTAG_CONSECUTIVEBADFAXLINES, cblc); } - return (TRUE); + return (true); } else { protoTrace("MODEM protocol botch: \"%s\"; can not parse line count", cp); processHangup("100"); // "Unspecified Phase D error" - return (FALSE); + return (false); } } /* * Complete a receive session. */ -fxBool +bool Class2Modem::recvEnd(fxStr&) { if (!hadHangup) { @@ -329,7 +329,7 @@ Class2Modem::recvEnd(fxStr&) } else (void) atCmd(abortCmd); // abort session } - return (TRUE); + return (true); } /* diff --git a/faxd/Class2Send.c++ b/faxd/Class2Send.c++ index be90577b..70a65faa 100644 --- a/faxd/Class2Send.c++ +++ b/faxd/Class2Send.c++ @@ -32,7 +32,7 @@ * Send Protocol for Class-2-style modems. */ -fxBool +bool Class2Modem::sendSetup(FaxRequest& req, const Class2Params& dis, fxStr& emsg) { const char* cmdFailed = " (modem command failed)"; @@ -48,26 +48,26 @@ Class2Modem::sendSetup(FaxRequest& req, const Class2Params& dis, fxStr& emsg) */ if (req.passwd != "" && pwCmd != "" && !class2Cmd(pwCmd, req.passwd)) { emsg = fxStr::format("Unable to send password%s", cmdFailed); - return (FALSE); + return (false); } if (req.subaddr != "" && saCmd != "" && !class2Cmd(saCmd, req.subaddr)) { emsg = fxStr::format("Unable to send subaddress%s", cmdFailed); - return (FALSE); + return (false); } if (minsp != BR_2400 && !class2Cmd(minspCmd, minsp)) { emsg = fxStr::format("Unable to restrict minimum transmit speed to %s", Class2Params::bitRateNames[req.minsp], cmdFailed); - return (FALSE); + return (false); } if (conf.class2DDISCmd != "") { if (!class2Cmd(conf.class2DDISCmd, dis)) { emsg = fxStr::format("Unable to setup session parameters " "prior to call%s", cmdFailed); - return (FALSE); + return (false); } params = dis; } - hadHangup = FALSE; + hadHangup = false; return (FaxModem::sendSetup(req, dis, emsg)); } @@ -117,14 +117,14 @@ Class2Modem::dialResponse(fxStr& emsg) * sent to the caller on connecting to a fax machine. */ FaxSendStatus -Class2Modem::getPrologue(Class2Params& dis, fxBool& hasDoc, fxStr& emsg) +Class2Modem::getPrologue(Class2Params& dis, bool& hasDoc, fxStr& emsg) { - fxBool gotParams = FALSE; - hasDoc = FALSE; + bool gotParams = false; + hasDoc = false; for (;;) { switch (atResponse(rbuf, conf.t1Timer)) { case AT_FPOLL: - hasDoc = TRUE; + hasDoc = true; protoTrace("REMOTE has document to POLL"); break; case AT_FDIS: @@ -161,10 +161,10 @@ Class2Modem::getPrologue(Class2Params& dis, fxBool& hasDoc, fxStr& emsg) * wait for an XON from the modem in response to the +FDT, * before actually sending any data. */ -fxBool +bool Class2Modem::dataTransfer() { - fxBool status; + bool status; if (xmitWaitForXON) { /* * Wait for XON (DC1) from the modem after receiving @@ -195,7 +195,7 @@ Class2Modem::dataTransfer() return (status); } -static fxBool +static bool pageInfoChanged(const Class2Params& a, const Class2Params& b) { return (a.vr != b.vr || a.wd != b.wd || a.ln != b.ln || a.df != b.df || a.br != b.br); @@ -215,10 +215,10 @@ Class2Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info, setDataTimeout(60, next.br); // 60 seconds for 1024 byte writes hangupCode[0] = '\0'; - fxBool transferOK; - fxBool morePages = FALSE; + bool transferOK; + bool morePages = false; do { - transferOK = FALSE; + transferOK = false; if (abortRequested()) goto failed; /* @@ -273,7 +273,7 @@ Class2Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info, return (status); } } - transferOK = TRUE; + transferOK = true; break; case PPR_RTN: // page bad, retrain requested if (++ntrys >= 3) { @@ -287,8 +287,8 @@ Class2Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info, break; } next.br--; - morePages = TRUE; // retransmit page - transferOK = TRUE; + morePages = true; // retransmit page + transferOK = true; break; case PPR_PIN: // page bad, interrupt requested emsg = "Unable to transmit page" @@ -316,7 +316,7 @@ Class2Modem::sendPhaseB(TIFF* tif, Class2Params& next, FaxMachineInfo& info, * +FHNG:0). Setup an error return so that the job will * be retried. */ - transferOK = FALSE; + transferOK = false; emsg = "Communication failure during Phase B/C (modem protocol botch)"; } return (transferOK ? send_ok : send_retry); @@ -336,10 +336,10 @@ failed: * is done to avoid timing problems when the document * is comprised of multiple strips. */ -fxBool +bool Class2Modem::sendPageData(TIFF* tif, u_int pageChop) { - fxBool rc = TRUE; + bool rc = true; tstrip_t nstrips = TIFFNumberOfStrips(tif); if (nstrips > 0) { @@ -353,7 +353,7 @@ Class2Modem::sendPageData(TIFF* tif, u_int pageChop) /* * Setup tag line processing. */ - fxBool doTagLine = setupTagLineSlop(params); + bool doTagLine = setupTagLineSlop(params); u_int ts = getTagLineSlop(); /* * Calculate total amount of space needed to read @@ -400,8 +400,8 @@ Class2Modem::sendPageData(TIFF* tif, u_int pageChop) /* * Send RTC to terminate a page. */ -fxBool -Class2Modem::sendRTC(fxBool is2D) +bool +Class2Modem::sendRTC(bool is2D) { static const u_char RTC1D[9] = { 0x00,0x10,0x01,0x00,0x10,0x01,0x00,0x10,0x01 }; diff --git a/faxd/ClassModem.c++ b/faxd/ClassModem.c++ index dede86c9..c3dbb81f 100644 --- a/faxd/ClassModem.c++ +++ b/faxd/ClassModem.c++ @@ -158,7 +158,7 @@ ClassModem::~ClassModem() * Default methods for modem driver interface. */ -fxBool +bool ClassModem::dataService() { return atCmd(conf.class0Cmd); @@ -180,7 +180,7 @@ ClassModem::dial(const char* number, fxStr& emsg) /* * Status messages to ignore when dialing. */ -fxBool +bool ClassModem::isNoise(const char* s) { static const char* noiseMsgs[] = { @@ -194,8 +194,8 @@ ClassModem::isNoise(const char* s) for (u_int i = 0; i < NNOISE; i++) if (strneq(s, noiseMsgs[i], strlen(noiseMsgs[i]))) - return (TRUE); - return (FALSE); + return (true); + return (false); } #undef NNOISE @@ -462,13 +462,13 @@ ClassModem::getModemLine(char buf[], u_int bufSize, long ms) int ClassModem::getModemChar(long ms) { return server.getModemChar(ms); } int ClassModem::getModemDataChar() { return server.getModemChar(dataTimeout); } -fxBool +bool ClassModem::putModemDLEData(const u_char* data, u_int cc, const u_char* bitrev, long ms) { u_char dlebuf[2*1024]; while (cc > 0) { if (wasTimeout() || abortRequested()) - return (FALSE); + return (false); /* * Copy to temp buffer, doubling DLE's. */ @@ -480,21 +480,21 @@ ClassModem::putModemDLEData(const u_char* data, u_int cc, const u_char* bitrev, dlebuf[++j] = DLE; } if (!putModem(dlebuf, j, ms)) - return (FALSE); + return (false); data += n; cc -= n; } - return (TRUE); + return (true); } void ClassModem::flushModemInput() { server.modemFlushInput(); } -fxBool ClassModem::putModem(void* d, int n, long ms) +bool ClassModem::putModem(void* d, int n, long ms) { return server.putModem(d, n, ms); } -fxBool ClassModem::putModemData(void* d, int n) +bool ClassModem::putModemData(void* d, int n) { return server.putModem(d, n, dataTimeout); } -fxBool +bool ClassModem::putModemLine(const char* cp) { u_int cc = strlen(cp); @@ -528,7 +528,7 @@ ClassModem::pause(u_int ms) /* * Reset the modem and set the DTE-DCE rate. */ -fxBool +bool ClassModem::selectBaudRate(BaudRate br, FlowControl i, FlowControl o) { rate = br; @@ -537,19 +537,19 @@ ClassModem::selectBaudRate(BaudRate br, FlowControl i, FlowControl o) return (reset(5*1000) || reset(5*1000)); // NB: try at most twice } -fxBool ClassModem::sendBreak(fxBool pause) +bool ClassModem::sendBreak(bool pause) { return server.sendBreak(pause); } -fxBool +bool ClassModem::setBaudRate(BaudRate r) { if (server.setBaudRate(r)) { if (conf.baudRateDelay) pause(conf.baudRateDelay); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } -fxBool +bool ClassModem::setBaudRate(BaudRate r, FlowControl i, FlowControl o) { iFlow = i; @@ -558,11 +558,11 @@ ClassModem::setBaudRate(BaudRate r, FlowControl i, FlowControl o) if (server.setBaudRate(r,i,o)) { if (conf.baudRateDelay) pause(conf.baudRateDelay); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } -fxBool +bool ClassModem::setXONXOFF(FlowControl i, FlowControl o, SetAction a) { iFlow = i; @@ -570,24 +570,24 @@ ClassModem::setXONXOFF(FlowControl i, FlowControl o, SetAction a) return server.setXONXOFF(i, o, a); } -fxBool ClassModem::setDTR(fxBool onoff) +bool ClassModem::setDTR(bool onoff) { return server.setDTR(onoff); } -fxBool ClassModem::setInputBuffering(fxBool onoff) +bool ClassModem::setInputBuffering(bool onoff) { return server.setInputBuffering(onoff); } -fxBool ClassModem::modemStopOutput() +bool ClassModem::modemStopOutput() { return server.modemStopOutput(); } /* * Miscellaneous server interfaces hooks. */ -fxBool ClassModem::abortRequested() +bool ClassModem::abortRequested() { return server.abortRequested(); } -void ClassModem::beginTimedTransfer() { server.timeout = FALSE; } +void ClassModem::beginTimedTransfer() { server.timeout = false; } void ClassModem::endTimedTransfer() {} -fxBool ClassModem::wasTimeout() { return server.timeout; } -void ClassModem::setTimeout(fxBool b) { server.timeout = b; } +bool ClassModem::wasTimeout() { return server.timeout; } +void ClassModem::setTimeout(bool b) { server.timeout = b; } /* * Parsing support routines. @@ -633,12 +633,12 @@ ClassModem::trimModemLine(char buf[], int& cc) /* * Hayes-style modem manipulation support. */ -fxBool +bool ClassModem::reset(long ms) { - setDTR(FALSE); + setDTR(false); pause(conf.resetDelay); // pause so modem can do reset - setDTR(TRUE); + setDTR(true); #ifndef CONFIG_NOREOPEN /* * On some systems lowering and raising DTR is not done @@ -648,12 +648,12 @@ ClassModem::reset(long ms) server.reopenDevice(); #endif if (!setBaudRate(rate, iFlow, oFlow)) - return (FALSE); + return (false); flushModemInput(); return atCmd(resetCmds, AT_OK, ms); } -fxBool +bool ClassModem::sync(long ms) { return waitFor(AT_OK, ms); @@ -662,7 +662,7 @@ ClassModem::sync(long ms) ATResponse ClassModem::atResponse(char* buf, long ms) { - fxBool prevTimeout = wasTimeout(); + bool prevTimeout = wasTimeout(); int n = getModemLine(buf, sizeof (rbuf), ms); if (!prevTimeout && wasTimeout()) lastResponse = AT_TIMEOUT; @@ -718,12 +718,12 @@ ClassModem::atResponse(char* buf, long ms) * changing the DCE-DTE communication rate and/or host-modem * flow control scheme are also recognized and handled. */ -fxBool +bool ClassModem::atCmd(const fxStr& cmd, ATResponse r, long ms) { u_int cmdlen = cmd.length(); u_int pos = 0; - fxBool respPending = FALSE; + bool respPending = false; /* * Scan string for line breaks and escape codes (byte w/ 0x80 set). @@ -743,16 +743,16 @@ ClassModem::atCmd(const fxStr& cmd, ATResponse r, long ms) if (conf.atCmdDelay) pause(conf.atCmdDelay); if (!putModemLine(cmd.extract(pos, i-pos))) - return (FALSE); + return (false); pos = ++i; // next segment starts after line break if (r != AT_NOTHING) { if (!waitFor(r, ms)) - return (FALSE); + return (false); } else { if (!waitFor(AT_OK, ms)) - return (FALSE); + return (false); } - respPending = FALSE; + respPending = false; } else if (isEscape(cmd[i])) { /* * Escape code; flush any partial line, process @@ -773,7 +773,7 @@ ClassModem::atCmd(const fxStr& cmd, ATResponse r, long ms) * translated to \r). */ if (!putModemLine(cmd.extract(pos, i-1-pos))) - return (FALSE); + return (false); // setup for expected response resp = (r != AT_NOTHING ? r : AT_OK); } else { @@ -787,9 +787,9 @@ ClassModem::atCmd(const fxStr& cmd, ATResponse r, long ms) const char* cp = &cmd[pos]; server.traceStatus(FAXTRACE_MODEMCOM, "<-- [%u:%s]", cc,cp); if (!server.putModem1(cp, cc)) - return (FALSE); + return (false); } - respPending = TRUE; + respPending = true; } /* * Process escape codes. @@ -823,7 +823,7 @@ ClassModem::atCmd(const fxStr& cmd, ATResponse r, long ms) if (resp != AT_NOTHING) { // XXX check return? (void) waitFor(resp, ms); // XXX ms - respPending = FALSE; + respPending = false; } break; case ESC_FLUSH: // flush input @@ -840,8 +840,8 @@ ClassModem::atCmd(const fxStr& cmd, ATResponse r, long ms) * does not get lost. */ if (resp != AT_NOTHING && !waitFor(resp, ms)) - return (FALSE); - respPending = FALSE; + return (false); + respPending = false; } } else i++; @@ -853,17 +853,17 @@ ClassModem::atCmd(const fxStr& cmd, ATResponse r, long ms) if (conf.atCmdDelay) pause(conf.atCmdDelay); if (!putModemLine(cmd.extract(pos, i-pos))) - return (FALSE); - respPending = TRUE; + return (false); + respPending = true; } /* * Wait for any pending response. */ if (respPending) { if (r != AT_NOTHING && !waitFor(r, ms)) - return (FALSE); + return (false); } - return (TRUE); + return (true); } #undef isEscape #undef isLineBreak @@ -871,13 +871,13 @@ ClassModem::atCmd(const fxStr& cmd, ATResponse r, long ms) /* * Wait (carefully) for some response from the modem. */ -fxBool +bool ClassModem::waitFor(ATResponse wanted, long ms) { for (;;) { ATResponse response = atResponse(rbuf, ms); if (response == wanted) - return (TRUE); + return (true); switch (response) { case AT_TIMEOUT: case AT_EMPTYLINE: @@ -887,7 +887,7 @@ ClassModem::waitFor(ATResponse wanted, long ms) case AT_NOANSWER: case AT_OFFHOOK: modemTrace("MODEM %s", ATresponses[response]); - return (FALSE); + return (false); } } } @@ -895,18 +895,18 @@ ClassModem::waitFor(ATResponse wanted, long ms) /* * Process a manufacturer/model/revision query. */ -fxBool +bool ClassModem::doQuery(const fxStr& queryCmd, fxStr& result, long ms) { if (queryCmd == "") - return (TRUE); + return (true); if (queryCmd[0] == '!') { /* * ``!mumble'' is interpreted as "return mumble"; * this means that you can't send ! to the modem. */ result = queryCmd.tail(queryCmd.length()-1); - return (TRUE); + return (true); } return (atQuery(queryCmd, result, ms)); } @@ -914,7 +914,7 @@ ClassModem::doQuery(const fxStr& queryCmd, fxStr& result, long ms) /* * Return modem manufacturer. */ -fxBool +bool ClassModem::setupManufacturer(fxStr& mfr) { return doQuery(mfrQueryCmd, mfr); @@ -923,7 +923,7 @@ ClassModem::setupManufacturer(fxStr& mfr) /* * Return modem model identification. */ -fxBool +bool ClassModem::setupModel(fxStr& model) { return doQuery(modelQueryCmd, model); @@ -932,7 +932,7 @@ ClassModem::setupModel(fxStr& model) /* * Return modem firmware revision. */ -fxBool +bool ClassModem::setupRevision(fxStr& rev) { return doQuery(revQueryCmd, rev); @@ -941,7 +941,7 @@ ClassModem::setupRevision(fxStr& rev) /* * Send AT? and get a string response. */ -fxBool +bool ClassModem::atQuery(const char* what, fxStr& v, long ms) { ATResponse r = AT_ERROR; @@ -961,7 +961,7 @@ ClassModem::atQuery(const char* what, fxStr& v, long ms) /* * Send AT? and get a range response. */ -fxBool +bool ClassModem::atQuery(const char* what, u_int& v, long ms) { char response[1024]; @@ -969,7 +969,7 @@ ClassModem::atQuery(const char* what, u_int& v, long ms) sync(ms); return parseRange(response, v); } - return (FALSE); + return (false); } /* @@ -992,26 +992,26 @@ const char SPACE = ' '; * in the parsed range so that modems like the ZyXEL 2864 * that indicate they support ``Class Z'' are handled. */ -fxBool +bool ClassModem::vparseRange(const char* cp, int nargs ... ) { - fxBool b = TRUE; + bool b = true; va_list ap; va_start(ap, nargs); while (nargs-- > 0) { while (cp[0] == SPACE) cp++; char matchc; - fxBool acceptList; + bool acceptList; if (cp[0] == OPAREN) { // () matchc = CPAREN; - acceptList = TRUE; + acceptList = true; cp++; } else if (isalnum(cp[0])) { // matchc = COMMA; acceptList = (nargs == 0); } else { // skip to comma - b = FALSE; + b = false; break; } int mask = 0; @@ -1021,7 +1021,7 @@ ClassModem::vparseRange(const char* cp, int nargs ... ) continue; } if (!isalnum(cp[0])) { - b = FALSE; + b = false; goto done; } int v; @@ -1039,7 +1039,7 @@ ClassModem::vparseRange(const char* cp, int nargs ... ) if (cp[0] == '-') { // - cp++; if (!isdigit(cp[0])) { - b = FALSE; + b = false; goto done; } r = 0; @@ -1075,7 +1075,7 @@ done: * Parse a single Class X range specification * and return the resulting bit mask. */ -fxBool +bool ClassModem::parseRange(const char* cp, u_int& a0) { return vparseRange(cp, 1, &a0); @@ -1093,7 +1093,7 @@ ClassModem::hangup() atCmd(conf.onHookCmd, AT_OK, 5000); } -fxBool +bool ClassModem::waitForRings(u_int n, CallType& type, CallerID& cinfo) { if (n > 0) { @@ -1120,7 +1120,7 @@ ClassModem::waitForRings(u_int n, CallType& type, CallerID& cinfo) case AT_NOCARRIER: case AT_NODIALTONE: case AT_ERROR: - return (FALSE); + return (false); } } while (n > 0 && Sys::now()-start < timeout); } diff --git a/faxd/ClassModem.h b/faxd/ClassModem.h index fa689c44..fa6eceec 100644 --- a/faxd/ClassModem.h +++ b/faxd/ClassModem.h @@ -195,17 +195,17 @@ protected: ClassModem(ModemServer&, const ModemConfig&); // setup and configuration - virtual fxBool selectBaudRate(BaudRate max, FlowControl i, FlowControl o); - virtual fxBool setupManufacturer(fxStr& mfr); - virtual fxBool setupModel(fxStr& model); - virtual fxBool setupRevision(fxStr& rev); + virtual bool selectBaudRate(BaudRate max, FlowControl i, FlowControl o); + virtual bool setupManufacturer(fxStr& mfr); + virtual bool setupModel(fxStr& model); + virtual bool setupRevision(fxStr& rev); - fxBool doQuery(const fxStr& queryCmd, fxStr& result, long ms = 30*1000); + bool doQuery(const fxStr& queryCmd, fxStr& result, long ms = 30*1000); // dial/answer interactions with derived classes virtual const AnswerMsg* findAnswer(const char* s); virtual CallType answerResponse(fxStr& emsg); virtual CallStatus dialResponse(fxStr& emsg) = 0; - virtual fxBool isNoise(const char*); + virtual bool isNoise(const char*); // miscellaneous void modemSupports(const char* fmt, ...); void modemCapability(const char* fmt, ...); @@ -213,11 +213,11 @@ protected: public: virtual ~ClassModem(); - virtual fxBool setupModem() = 0; - virtual fxBool isFaxModem() const = 0; // XXX safe to cast + virtual bool setupModem() = 0; + virtual bool isFaxModem() const = 0; // XXX safe to cast - virtual fxBool sync(long ms = 0); // synchronize (wait for "OK") - virtual fxBool reset(long ms = 5*1000); // reset modem state + virtual bool sync(long ms = 0); // synchronize (wait for "OK") + virtual bool reset(long ms = 5*1000); // reset modem state virtual void hangup(); // hangup the phone // configuration controls @@ -241,38 +241,38 @@ public: // support to write to modem w/ timeout void beginTimedTransfer(); void endTimedTransfer(); - fxBool wasTimeout(); - void setTimeout(fxBool); + bool wasTimeout(); + void setTimeout(bool); void flushModemInput(); - fxBool putModem(void* data, int n, long ms = 0); - fxBool putModemData(void* data, int n); - fxBool putModemDLEData(const u_char* data, u_int, + bool putModem(void* data, int n, long ms = 0); + bool putModemData(void* data, int n); + bool putModemDLEData(const u_char* data, u_int, const u_char* brev, long ms); - fxBool putModemLine(const char* cp); + bool putModemLine(const char* cp); int getModemChar(long ms = 0); int getModemDataChar(); void startTimeout(long ms); void stopTimeout(const char* whichdir); // host-modem protocol parsing support virtual ATResponse atResponse(char* buf, long ms = 30*1000); - fxBool waitFor(ATResponse wanted, long ms = 30*1000); - fxBool atCmd(const fxStr& cmd, ATResponse = AT_OK, long ms = 30*1000); - fxBool atQuery(const char* what, fxStr& v, long ms = 30*1000); - fxBool atQuery(const char* what, u_int& v, long ms = 30*1000); - fxBool parseRange(const char*, u_int&); - fxBool vparseRange(const char*, int nargs ...); + bool waitFor(ATResponse wanted, long ms = 30*1000); + bool atCmd(const fxStr& cmd, ATResponse = AT_OK, long ms = 30*1000); + bool atQuery(const char* what, fxStr& v, long ms = 30*1000); + bool atQuery(const char* what, u_int& v, long ms = 30*1000); + bool parseRange(const char*, u_int&); + bool vparseRange(const char*, int nargs ...); // modem line control - fxBool sendBreak(fxBool pause); - fxBool setBaudRate(BaudRate rate); - fxBool setBaudRate(BaudRate rate, FlowControl i, FlowControl o); - fxBool setXONXOFF(FlowControl i, FlowControl o, SetAction); - fxBool setDTR(fxBool on); - fxBool setInputBuffering(fxBool on); - fxBool modemStopOutput(); + bool sendBreak(bool pause); + bool setBaudRate(BaudRate rate); + bool setBaudRate(BaudRate rate, FlowControl i, FlowControl o); + bool setXONXOFF(FlowControl i, FlowControl o, SetAction); + bool setDTR(bool on); + bool setInputBuffering(bool on); + bool modemStopOutput(); FlowControl getInputFlow(); FlowControl getOutputFlow(); // server-related stuff - fxBool abortRequested(); + bool abortRequested(); /* * Send support: @@ -282,7 +282,7 @@ public: * } * hangup(); */ - virtual fxBool dataService(); + virtual bool dataService(); virtual CallStatus dial(const char* number, fxStr& emsg); /* @@ -305,7 +305,7 @@ public: * with recvAbort available to abort a receive * at any time in this procedure. */ - virtual fxBool waitForRings(u_int rings, CallType&, CallerID&); + virtual bool waitForRings(u_int rings, CallType&, CallerID&); virtual CallType answerCall(AnswerType, fxStr& emsg); virtual void answerCallCmd(CallType); }; diff --git a/faxd/CopyQuality.c++ b/faxd/CopyQuality.c++ index 9e4654f7..4778a037 100644 --- a/faxd/CopyQuality.c++ +++ b/faxd/CopyQuality.c++ @@ -44,8 +44,8 @@ static void setupCompression(TIFF*, u_int, uint32); * Receive Phase C data with or without copy * quality checking and erroneous row fixup. */ -fxBool -FaxModem::recvPageDLEData(TIFF* tif, fxBool checkQuality, +bool +FaxModem::recvPageDLEData(TIFF* tif, bool checkQuality, const Class2Params& params, fxStr& emsg) { setupDecoder(conf.recvFillOrder, params.is2D()); @@ -74,7 +74,7 @@ FaxModem::recvPageDLEData(TIFF* tif, fxBool checkQuality, abortPageRecv(); emsg = "Missing EOL after 5 seconds"; recvTrace("%s", (const char*) emsg); - return (FALSE); + return (false); } if (checkQuality) { /* @@ -122,7 +122,7 @@ FaxModem::recvPageDLEData(TIFF* tif, fxBool checkQuality, u_char* curGood = buf; // last good row memset(curGood, 0, rowSize); // initialize to all white recvBuf = NULL; // don't need raw data - lastRowBad = FALSE; // no previous row + lastRowBad = false; // no previous row cblc = 0; // current bad line run if (!RTCraised()) { for (;;) { @@ -134,13 +134,13 @@ FaxModem::recvPageDLEData(TIFF* tif, fxBool checkQuality, * later for deciding whether or not the page quality * is acceptable. */ - fxBool decodeOK = decodeRow(recvRow, rowpixels); + bool decodeOK = decodeRow(recvRow, rowpixels); if (seenRTC()) // seen RTC, flush everything continue; if (decodeOK) { curGood = recvRow; // reset last good if (lastRowBad) { // reset run statistics - lastRowBad = FALSE; + lastRowBad = false; if (cblc > recvConsecutiveBadLineCount) recvConsecutiveBadLineCount = cblc; cblc = 0; @@ -149,7 +149,7 @@ FaxModem::recvPageDLEData(TIFF* tif, fxBool checkQuality, memcpy(recvRow, curGood, rowSize);// replicate last good recvBadLineCount++; cblc++; - lastRowBad = TRUE; + lastRowBad = true; } /* * Advance forward a scanline and if necessary @@ -274,7 +274,7 @@ FaxModem::recvPageDLEData(TIFF* tif, fxBool checkQuality, TIFFSetField(tif, TIFFTAG_FAXRECVTIME, (uint32) server.getPageTransferTime()); #endif - return (TRUE); + return (true); } /* @@ -360,7 +360,7 @@ FaxModem::flushRawData(TIFF* tif, tstrip_t strip, u_char* buf, u_int cc) * Check if the configuration parameters indicate if * copy quality checking should be done on recvd pages. */ -fxBool +bool FaxModem::checkQuality() { return (conf.percentGoodLines != 0 && conf.maxConsecutiveBadLines != 0); @@ -371,7 +371,7 @@ FaxModem::checkQuality() * against the configuration parameters and return an * indication of whether or not the page quality is acceptable. */ -fxBool +bool FaxModem::isQualityOK(const Class2Params& params) { if (conf.percentGoodLines != 0 && recvEOLCount != 0) { @@ -379,7 +379,7 @@ FaxModem::isQualityOK(const Class2Params& params) if (percent < conf.percentGoodLines) { serverTrace("RECV: REJECT page quality, %u%% good lines (%u%% required)", percent, conf.percentGoodLines); - return (FALSE); + return (false); } } u_int cblc = conf.maxConsecutiveBadLines; @@ -389,10 +389,10 @@ FaxModem::isQualityOK(const Class2Params& params) if (recvConsecutiveBadLineCount > cblc) { serverTrace("RECV: REJECT page quality, %u-line run (max %u)", recvConsecutiveBadLineCount, cblc); - return (FALSE); + return (false); } } - return (TRUE); + return (true); } /* diff --git a/faxd/DestControl.c++ b/faxd/DestControl.c++ index 6abc1559..ca0df23a 100644 --- a/faxd/DestControl.c++ +++ b/faxd/DestControl.c++ @@ -187,26 +187,26 @@ DestControl::readContents() } } -fxBool +bool DestControl::readLine(FILE* fp, char line[], u_int cc) { if (fgets(line, cc, fp) == NULL) - return (FALSE); + return (false); lineno++; char* cp; if (cp = strchr(line, '#')) *cp = '\0'; if (cp = strchr(line, '\n')) *cp = '\0'; - return (TRUE); + return (true); } -static fxBool +static bool isContinued(FILE* fp) { int c = getc(fp); if (c == EOF) - return (FALSE); + return (false); ungetc(c, fp); return (isspace(c) || c == '#'); } @@ -238,13 +238,13 @@ crackArgv(fxStr& s) s.resize(cp - (char*) s); } -fxBool +bool DestControl::parseEntry(FILE* fp) { char line[1024]; for (;;) { if (!readLine(fp, line, sizeof (line)-1)) - return (FALSE); + return (false); char* cp; for (cp = line; *cp && !isspace(*cp); cp++) ; @@ -253,7 +253,7 @@ DestControl::parseEntry(FILE* fp) if (cp == line) { parseError("Missing regular expression."); skipEntry(fp, line, sizeof (line)-1); - return (TRUE); + return (true); } *cp++ = '\0'; DestControlInfo dci(line); @@ -263,7 +263,7 @@ DestControl::parseEntry(FILE* fp) re.getError(emsg); parseError("Bad regular expression: %s: " | emsg, re.pattern()); skipEntry(fp, line, sizeof (line)-1); - return (TRUE); + return (true); } for (;;) { while (isspace(*cp)) @@ -272,11 +272,11 @@ DestControl::parseEntry(FILE* fp) crackArgv(dci.args); if (!isContinued(fp)) { info.append(dci); - return (TRUE); + return (true); } if (!readLine(fp, line, sizeof (line)-1)) { info.append(dci); - return (FALSE); + return (false); } cp = line; continue; // go back and skip whitespace diff --git a/faxd/DestControl.h b/faxd/DestControl.h index b4931ada..476283f6 100644 --- a/faxd/DestControl.h +++ b/faxd/DestControl.h @@ -86,8 +86,8 @@ private: DestControlInfoArray info; // control information void readContents(); - fxBool parseEntry(FILE* fp); - fxBool readLine(FILE* fp, char line[], u_int cc); + bool parseEntry(FILE* fp); + bool readLine(FILE* fp, char line[], u_int cc); void skipEntry(FILE*, char line[], u_int cc); void parseError(const char* fmt ...); public: diff --git a/faxd/DestInfo.c++ b/faxd/DestInfo.c++ index 2bc68a11..46394640 100644 --- a/faxd/DestInfo.c++ +++ b/faxd/DestInfo.c++ @@ -58,18 +58,18 @@ DestInfo::updateConfig() info.writeConfig(); // update as necessary } -fxBool +bool DestInfo::isActive(Job& job) const { if (running == NULL) - return (FALSE); + return (false); else if (running == &job) - return (TRUE); + return (true); else { for (Job* jp = running->dnext; jp != NULL; jp = jp->dnext) if (jp == &job) - return (TRUE); - return (FALSE); + return (true); + return (false); } } diff --git a/faxd/DestInfo.h b/faxd/DestInfo.h index 26226d3b..cd0166fd 100644 --- a/faxd/DestInfo.h +++ b/faxd/DestInfo.h @@ -60,9 +60,9 @@ public: u_int getActive() const; // return count of active jobs u_int getCount() const; // return count of active+blocked jobs - fxBool isEmpty() const; // TRUE if any jobs referenced + bool isEmpty() const; // true if any jobs referenced - fxBool isActive(Job&) const; // TRUE if job is considered active + bool isActive(Job&) const; // true if job is considered active void active(Job&); // set job active to destination void done(Job&); // remove job from active set void block(Job&); // add job to blocked queue @@ -76,7 +76,7 @@ public: inline u_int DestInfo::getActive() const { return activeCount; } inline u_int DestInfo::getCount() const { return activeCount + blockedCount; } -inline fxBool DestInfo::isEmpty() const { return getCount() == 0; } +inline bool DestInfo::isEmpty() const { return getCount() == 0; } fxDECLARE_StrKeyDictionary(DestInfoDict, DestInfo) #endif /* _DestInfo_ */ diff --git a/faxd/FaxAcctInfo.c++ b/faxd/FaxAcctInfo.c++ index 1ad2021d..143a75d4 100644 --- a/faxd/FaxAcctInfo.c++ +++ b/faxd/FaxAcctInfo.c++ @@ -35,10 +35,10 @@ extern const char* fmtTime(time_t); /* * Record an activity in the transfer log file. */ -fxBool +bool FaxAcctInfo::record(const char* cmd) const { - fxBool ok = FALSE; + bool ok = false; int fd = Sys::open(FAX_XFERLOG, O_RDWR|O_CREAT|O_APPEND, 0644); if (fd >= 0) { fxStackBuffer record; diff --git a/faxd/FaxAcctInfo.h b/faxd/FaxAcctInfo.h index 1074d39c..0aa8edae 100644 --- a/faxd/FaxAcctInfo.h +++ b/faxd/FaxAcctInfo.h @@ -44,6 +44,6 @@ struct FaxAcctInfo { u_int params; // encoded transfer parameters const char* status; // status info (optional) - fxBool record(const char* cmd) const; + bool record(const char* cmd) const; }; #endif /* _FaxAcctInfo_ */ diff --git a/faxd/FaxFont.c++ b/faxd/FaxFont.c++ index 89dff232..3baa8ab8 100644 --- a/faxd/FaxFont.c++ +++ b/faxd/FaxFont.c++ @@ -28,7 +28,7 @@ FaxFont::FaxFont() { - ready = FALSE; // font not ready for use + ready = false; // font not ready for use fontAscent = fontDescent = 0; } diff --git a/faxd/FaxFont.h b/faxd/FaxFont.h index 6c6a6231..93c81810 100644 --- a/faxd/FaxFont.h +++ b/faxd/FaxFont.h @@ -32,7 +32,7 @@ class FaxFont { protected: - fxBool ready; // font ready to use + bool ready; // font ready to use short fontAscent; // font ascent metric short fontDescent; // font descent metric @@ -40,9 +40,9 @@ protected: public: virtual ~FaxFont(); - virtual fxBool read(const char* filename) = 0; + virtual bool read(const char* filename) = 0; - fxBool isReady() const; + bool isReady() const; u_int fontHeight() const; virtual u_int charWidth(u_int) const = 0; virtual void strWidth(const char* text, u_int& w, u_int& h) const = 0; @@ -52,6 +52,6 @@ public: virtual void print(FILE*) const = 0; }; -inline fxBool FaxFont::isReady() const { return ready; } +inline bool FaxFont::isReady() const { return ready; } inline u_int FaxFont::fontHeight() const { return fontAscent+fontDescent; } #endif /* _Font_ */ diff --git a/faxd/FaxMachineInfo.c++ b/faxd/FaxMachineInfo.c++ index a7a5a4bf..74a350af 100644 --- a/faxd/FaxMachineInfo.c++ +++ b/faxd/FaxMachineInfo.c++ @@ -37,7 +37,7 @@ const fxStr FaxMachineInfo::infoDir(FAX_INFODIR); FaxMachineInfo::FaxMachineInfo() { - changed = FALSE; + changed = false; resetConfig(); } FaxMachineInfo::FaxMachineInfo(const FaxMachineInfo& other) @@ -79,7 +79,7 @@ FaxMachineInfo::getMaxPageWidthInMM() const #include -fxBool +bool FaxMachineInfo::updateConfig(const fxStr& number) { fxStr canon(number); @@ -98,10 +98,10 @@ FaxMachineInfo::updateConfig(const fxStr& number) void FaxMachineInfo::resetConfig() { - supportsHighRes = TRUE; // assume 196 lpi support - supports2DEncoding = TRUE; // assume 2D-encoding support - supportsPostScript = FALSE; // no support for Adobe protocol - calledBefore = FALSE; // never called before + supportsHighRes = true; // assume 196 lpi support + supports2DEncoding = true; // assume 2D-encoding support + supportsPostScript = false; // no support for Adobe protocol + calledBefore = false; // never called before maxPageWidth = 2432; // max required width maxPageLength = -1; // infinite page length maxSignallingRate = BR_14400; // T.17 14.4KB @@ -169,7 +169,7 @@ static const char* stnames[] = #define setLocked(b,ix) locked |= b<= 3 && (pph[2] != 'Z' || pph.length() >= 2+5+1)) { switch (pph[pph[2] == 'Z' ? 2+5 : 2+0]) { - case 'P': ppm = PPM_EOP; return (TRUE); - case 'M': ppm = PPM_EOM; return (TRUE); - case 'S': ppm = PPM_MPS; return (TRUE); + case 'P': ppm = PPM_EOP; return (true); + case 'M': ppm = PPM_EOM; return (true); + case 'S': ppm = PPM_MPS; return (true); } what = "unknown"; } else what = "bad"; emsg = fxStr::format( "Internal botch; %s post-page handling string \"%s\"", what, (const char*) pph); - return (FALSE); + return (false); } /* @@ -371,7 +371,7 @@ FaxModem::getBestECM() const /* * Return whether or not the modem supports 2DMR. */ -fxBool +bool FaxModem::supports2D() const { return (modemParams.df & BIT(DF_2DMR)) != 0; @@ -380,26 +380,26 @@ FaxModem::supports2D() const /* * Return whether or not received EOLs are byte aligned. */ -fxBool +bool FaxModem::supportsEOLPadding() const { - return FALSE; + return false; } /* * Return whether or not the modem is capable of polling. */ -fxBool +bool FaxModem::supportsPolling() const { - return FALSE; + return false; } /* * Return whether or not the modem supports * the optional Error Correction Mode (ECM). */ -fxBool +bool FaxModem::supportsECM() const { return (modemParams.ec &~ BIT(EC_DISABLE)) != 0; @@ -412,7 +412,7 @@ FaxModem::supportsECM() const * problems and general sloppiness on the part of * applications writing TIFF files. */ -fxBool +bool FaxModem::supportsVRes(float res) const { if (3.0 <= res && res < 4.75) @@ -420,14 +420,14 @@ FaxModem::supportsVRes(float res) const else if (5.9 <= res && res < 9.8) return (modemParams.vr & BIT(VR_FINE)) != 0; else - return FALSE; + return false; } /* * Return whether or not the modem supports the * specified page width. */ -fxBool +bool FaxModem::supportsPageWidth(u_int w) const { switch (w) { @@ -437,7 +437,7 @@ FaxModem::supportsPageWidth(u_int w) const case 1216: return (modemParams.wd & BIT(WD_1216)) != 0; case 864: return (modemParams.wd & BIT(WD_864)) != 0; } - return FALSE; + return false; } /* @@ -445,7 +445,7 @@ FaxModem::supportsPageWidth(u_int w) const * specified page length. As above for vertical * resolution we're lenient in what we accept. */ -fxBool +bool FaxModem::supportsPageLength(u_int l) const { // XXX probably need to be more forgiving with values @@ -564,9 +564,9 @@ FaxModem::tracePPR(const char* dir, u_int ppr) /* * Miscellaneous server interfaces hooks. */ -fxBool FaxModem::isFaxModem() const { return TRUE; } +bool FaxModem::isFaxModem() const { return true; } -fxBool FaxModem::getHDLCTracing() +bool FaxModem::getHDLCTracing() { return (server.getSessionTracing() & FAXTRACE_HDLC) != 0; } FaxSendStatus diff --git a/faxd/FaxModem.h b/faxd/FaxModem.h index c8cf3fe6..44c1a768 100644 --- a/faxd/FaxModem.h +++ b/faxd/FaxModem.h @@ -61,7 +61,7 @@ private: void setupTagLine(const FaxRequest&, const fxStr& tagLineFmt); // phase c data receive & copy quality checking u_int cblc; // current count of consecutive bad lines - fxBool lastRowBad; // last decoded row was bad + bool lastRowBad; // last decoded row was bad u_long recvEOLCount; // EOL count for received page u_long recvBadLineCount; @@ -102,7 +102,7 @@ protected: void tracePPR(const char* dir, u_int ppr); void tracePPM(const char* dir, u_int ppm); // server-related stuff - fxBool getHDLCTracing(); + bool getHDLCTracing(); FaxSendStatus sendSetupParams(TIFF*, Class2Params&, FaxMachineInfo&, fxStr&); void recvTSI(const fxStr&); @@ -115,39 +115,39 @@ protected: void recvStartPage(TIFF* tif); void recvResetPage(TIFF* tif); u_int decodePageChop(const fxStr& pph, const Class2Params&); - fxBool decodePPM(const fxStr& pph, u_int& ppm, fxStr& emsg); + bool decodePPM(const fxStr& pph, u_int& ppm, fxStr& emsg); void notifyPageSent(TIFF*); // phase c data receive & copy quality checking - fxBool recvPageDLEData(TIFF* tif, fxBool checkQuality, + bool recvPageDLEData(TIFF* tif, bool checkQuality, const Class2Params& params, fxStr& emsg); virtual void abortPageRecv() = 0; virtual int nextByte(); - fxBool checkQuality(); - fxBool isQualityOK(const Class2Params&); + bool checkQuality(); + bool isQualityOK(const Class2Params&); u_long getRecvEOLCount() const; u_long getRecvBadLineCount() const; u_long getRecvConsecutiveBadLineCount() const; // tag line support - fxBool setupTagLineSlop(const Class2Params&); + bool setupTagLineSlop(const Class2Params&); u_int getTagLineSlop() const; u_char* imageTagLine(u_char* buf, u_int fillorder, const Class2Params&); public: virtual ~FaxModem(); - fxBool isFaxModem() const; + bool isFaxModem() const; // configuration controls virtual void setLID(const fxStr& number) = 0; u_int getCapabilities() const; // methods for querying modem capabilities - virtual fxBool supports2D() const; - virtual fxBool supportsEOLPadding() const; - virtual fxBool supportsVRes(float res) const; - virtual fxBool supportsPageWidth(u_int w) const; - virtual fxBool supportsPageLength(u_int l) const; - virtual fxBool supportsPolling() const; - virtual fxBool supportsECM() const; + virtual bool supports2D() const; + virtual bool supportsEOLPadding() const; + virtual bool supportsVRes(float res) const; + virtual bool supportsPageWidth(u_int w) const; + virtual bool supportsPageLength(u_int l) const; + virtual bool supportsPolling() const; + virtual bool supportsECM() const; virtual int selectSignallingRate(int br) const; u_int getBestSignallingRate() const; @@ -184,19 +184,19 @@ public: * for doing things like keeping cover pages & documents in a * single T.30 document. */ - virtual fxBool faxService() = 0; - virtual fxBool sendSetup(FaxRequest&, const Class2Params& dis, fxStr& emsg); + virtual bool faxService() = 0; + virtual bool sendSetup(FaxRequest&, const Class2Params& dis, fxStr& emsg); virtual void sendBegin(); virtual FaxSendStatus getPrologue(Class2Params&, - fxBool& hasDoc, fxStr& emsg) = 0; + bool& hasDoc, fxStr& emsg) = 0; virtual void sendSetupPhaseB(const fxStr& pwd, const fxStr& sub); virtual FaxSendStatus sendPhaseB(TIFF*, Class2Params&, FaxMachineInfo&, fxStr& pph, fxStr& emsg) = 0; virtual void sendEnd(); virtual void sendAbort() = 0; // query interfaces for optional state - virtual fxBool getSendCSI(fxStr&); - virtual fxBool getSendNSF(fxStr&); + virtual bool getSendCSI(fxStr&); + virtual bool getSendNSF(fxStr&); /* * Fax receive protocol. The expected sequence is: @@ -226,15 +226,15 @@ public: * } * } */ - virtual fxBool setupReceive() = 0; - virtual fxBool recvBegin(fxStr& emsg); - virtual fxBool recvPage(TIFF*, int& ppm, fxStr& em) = 0; - virtual fxBool recvEnd(fxStr& emsg) = 0; + virtual bool setupReceive() = 0; + virtual bool recvBegin(fxStr& emsg); + virtual bool recvPage(TIFF*, int& ppm, fxStr& em) = 0; + virtual bool recvEnd(fxStr& emsg) = 0; virtual void recvAbort() = 0; // query interfaces for optional state - virtual fxBool getRecvPWD(fxStr&); - virtual fxBool getRecvTSI(fxStr&); - virtual fxBool getRecvSUB(fxStr&); + virtual bool getRecvPWD(fxStr&); + virtual bool getRecvTSI(fxStr&); + virtual bool getRecvSUB(fxStr&); virtual const Class2Params& getRecvParams() const; /* @@ -252,8 +252,8 @@ public: * * (i.e. it's just like a receive operation.) */ - virtual fxBool requestToPoll(fxStr& emsg) = 0; - virtual fxBool pollBegin( + virtual bool requestToPoll(fxStr& emsg) = 0; + virtual bool pollBegin( const fxStr& cig, const fxStr& sep, const fxStr& pwd, fxStr& emsg); }; diff --git a/faxd/FaxPoll.c++ b/faxd/FaxPoll.c++ index d2a85ce0..764c4b80 100644 --- a/faxd/FaxPoll.c++ +++ b/faxd/FaxPoll.c++ @@ -36,10 +36,10 @@ /* * Initiate a polling receive and invoke the receiving protocol. */ -fxBool +bool FaxServer::pollFaxPhaseB(const fxStr& sep, const fxStr& pwd, FaxRecvInfoArray& docs, fxStr& emsg) { - fxBool pollOK = FALSE; + bool pollOK = false; changeState(RECEIVING); traceProtocol("POLL FAX: begin (SEP \"%s\", PWD \"%s\")", (const char*) sep, (const char*) pwd); diff --git a/faxd/FaxRecv.c++ b/faxd/FaxRecv.c++ index 7431b5c5..4bcc476c 100644 --- a/faxd/FaxRecv.c++ +++ b/faxd/FaxRecv.c++ @@ -41,7 +41,7 @@ * FAX Server Reception Protocol. */ -fxBool +bool FaxServer::recvFax() { traceProtocol("RECV FAX: begin"); @@ -49,8 +49,8 @@ FaxServer::recvFax() fxStr emsg; FaxRecvInfoArray docs; FaxRecvInfo info; - fxBool faxRecognized = FALSE; - abortCall = FALSE; + bool faxRecognized = false; + abortCall = false; /* * Create the first file ahead of time to avoid timing @@ -180,10 +180,10 @@ FaxServer::setupForRecv(FaxRecvInfo& ri, FaxRecvInfoArray& docs, fxStr& emsg) /* * Receive one or more documents. */ -fxBool +bool FaxServer::recvDocuments(TIFF* tif, FaxRecvInfo& info, FaxRecvInfoArray& docs, fxStr& emsg) { - fxBool recvOK; + bool recvOK; int ppm; pageStart = Sys::now(); for (;;) { @@ -201,7 +201,7 @@ FaxServer::recvDocuments(TIFF* tif, FaxRecvInfo& info, FaxRecvInfoArray& docs, f * NB: Caller-ID access control is done elsewhere; prior * to answering a call. */ - fxBool okToRecv = isTSIOk(info.sender); + bool okToRecv = isTSIOk(info.sender); traceServer("%s TSI \"%s\"", okToRecv ? "ACCEPT" : "REJECT", (const char*) info.sender); if (!okToRecv) { @@ -210,7 +210,7 @@ FaxServer::recvDocuments(TIFF* tif, FaxRecvInfo& info, FaxRecvInfoArray& docs, f info.reason = emsg; notifyDocumentRecvd(info); TIFFClose(tif); - return (FALSE); + return (false); } } setServerStatus("Receiving from \"%s\"", (const char*) info.sender); @@ -227,7 +227,7 @@ FaxServer::recvDocuments(TIFF* tif, FaxRecvInfo& info, FaxRecvInfoArray& docs, f */ tif = setupForRecv(info, docs, emsg); if (tif == NULL) - return (FALSE); + return (false); fileStart = pageStart = Sys::now(); } /*NOTREACHED*/ @@ -236,28 +236,28 @@ FaxServer::recvDocuments(TIFF* tif, FaxRecvInfo& info, FaxRecvInfoArray& docs, f /* * Receive Phase B protocol processing. */ -fxBool +bool FaxServer::recvFaxPhaseD(TIFF* tif, FaxRecvInfo& info, int& ppm, fxStr& emsg) { ppm = PPM_EOP; do { if (++recvPages > maxRecvPages) { emsg = "Maximum receive page count exceeded, job terminated"; - return (FALSE); + return (false); } if (!modem->recvPage(tif, ppm, emsg)) - return (FALSE); + return (false); info.npages++; info.time = (u_int) getPageTransferTime(); info.params = modem->getRecvParams(); notifyPageRecvd(tif, info, ppm); if (PPM_PRI_MPS <= ppm && ppm <= PPM_PRI_EOP) { emsg = "Procedure interrupt received, job terminated"; - return (FALSE); + return (false); } pageStart = Sys::now(); // reset for next page } while (ppm == PPM_MPS || ppm == PPM_PRI_MPS); - return (TRUE); + return (true); } void diff --git a/faxd/FaxRequest.c++ b/faxd/FaxRequest.c++ index f32c8266..26ff5a0a 100644 --- a/faxd/FaxRequest.c++ +++ b/faxd/FaxRequest.c++ @@ -67,7 +67,7 @@ FaxRequest::reset(void) desiredtl = 0; totdials = 0, maxdials = (u_short) FAX_REDIALS; tottries = 0, maxtries = (u_short) FAX_RETRIES; - useccover = TRUE; + useccover = true; pagechop = chop_default; chopthreshold = -1; notify = no_notice; @@ -162,10 +162,10 @@ const char* FaxRequest::chopVals[4] = { /* * Parse the contents of a job description file. */ -fxBool -FaxRequest::readQFile(fxBool& rejectJob) +bool +FaxRequest::readQFile(bool& rejectJob) { - rejectJob = FALSE; + rejectJob = false; lineno = 0; lseek(fd, 0L, SEEK_SET); // XXX should only for re-read /* @@ -184,7 +184,7 @@ FaxRequest::readQFile(fxBool& rejectJob) Sys::fstat(fd, sb); if (sb.st_size < 2) { error("Corrupted file (too small)"); - return (FALSE); + return (false); } char stackbuf[2048]; char* buf = stackbuf; @@ -195,7 +195,7 @@ FaxRequest::readQFile(fxBool& rejectJob) error("Read error: %s", strerror(errno)); if (bp != buf) delete bp; - return (FALSE); + return (false); } /* * Force \n-termination of the last line in the @@ -362,12 +362,12 @@ FaxRequest::readQFile(fxBool& rejectJob) */ if (state < state_suspended || state > state_done) { error("Invalid scheduler state %u in job request", state); - rejectJob = TRUE; + rejectJob = true; } #define isNull(s) ((s).length() == 0) if (isNull(number) || isNull(mailaddr) || isNull(sender) || isNull(jobid) || isNull(modem) || isNull(client) || isNull(owner)) { - rejectJob = TRUE; + rejectJob = true; error("Null or missing %s in job request", isNull(number) ? "number" : isNull(mailaddr) ? "mailaddr" : @@ -385,7 +385,7 @@ FaxRequest::readQFile(fxBool& rejectJob) if (desireddf > DF_2DMMR) desireddf = DF_2DMMR; if (buf != stackbuf) // dynamically allocated buffer delete buf; - return (TRUE); + return (true); } /* @@ -400,8 +400,8 @@ FaxRequest::readQFile(fxBool& rejectJob) * allocated and appended to. If you don't believe * this, enable the code notdef'd out below. */ -fxBool -FaxRequest::reReadQFile(fxBool& rejectJob) +bool +FaxRequest::reReadQFile(bool& rejectJob) { #ifdef notdef reset(); // non-string items @@ -516,32 +516,32 @@ FaxRequest::renameSaved(u_int fi) * Does the specified document (assumed to be send_fax) * appear to have any potential source references? */ -fxBool +bool FaxRequest::isUnreferenced(u_int fi) { if (fi > 0 && requests[fi-1].isSavedOp()) { struct stat sb; if (Sys::stat(mkbasedoc(requests[fi-1].item), sb) < 0 || sb.st_nlink == 1) - return (TRUE); + return (true); } - return (FALSE); + return (false); } -static fxBool +static bool hasDotDot(const char* pathname) { const char* cp = pathname; while (cp) { if (cp[0] == '.') // NB: good enough - return (TRUE); + return (true); if (cp = strchr(cp, '/')) cp++; } - return (FALSE); + return (false); } -fxBool +bool FaxRequest::checkDocument(const char* pathname) { /* @@ -550,16 +550,16 @@ FaxRequest::checkDocument(const char* pathname) */ if (pathname[0] == '/' || hasDotDot(pathname)) { error("Invalid document file \"%s\"", pathname); - return (FALSE); + return (false); } int fd = Sys::open(pathname, 0); if (fd == -1) { error("Can not access document file \"%s\": %s", pathname, strerror(errno)); - return (FALSE); + return (false); } Sys::close(fd); - return (TRUE); + return (true); } /* @@ -591,7 +591,7 @@ FaxRequest::addRequest(FaxSendOp op, char* tag) * Add a request entry and verify the document is valid. */ void -FaxRequest::addRequest(FaxSendOp op, char* tag, fxBool& rejectJob) +FaxRequest::addRequest(FaxSendOp op, char* tag, bool& rejectJob) { char* cp = tag; while (*cp && *cp != ':') @@ -609,31 +609,31 @@ FaxRequest::addRequest(FaxSendOp op, char* tag, fxBool& rejectJob) else cp = tag, tag = ""; if (!checkDocument(cp)) - rejectJob = TRUE; + rejectJob = true; else requests.append(faxRequest(op, dirnum, tag, cp)); } -fxBool +bool FaxRequest::isStrCmd(const char* cmd, u_int& ix) { for (int i = N(strvals)-1; i >= 0; i--) if (strcmp(strvals[i].name, cmd) == 0) { ix = i; - return (TRUE); + return (true); } - return (FALSE); + return (false); } -fxBool +bool FaxRequest::isShortCmd(const char* cmd, u_int& ix) { for (int i = N(shortvals)-1; i >= 0; i--) if (strcmp(shortvals[i].name, cmd) == 0) { ix = i; - return (TRUE); + return (true); } - return (FALSE); + return (false); } void diff --git a/faxd/FaxRequest.h b/faxd/FaxRequest.h index 1dfa1cad..79e3150e 100644 --- a/faxd/FaxRequest.h +++ b/faxd/FaxRequest.h @@ -45,7 +45,7 @@ class Class2Params; class FaxRequest { protected: void reset(void); - virtual fxBool checkDocument(const char* pathname); + virtual bool checkDocument(const char* pathname); virtual void error(const char* fmt, ...); public: enum { @@ -160,26 +160,26 @@ public: FaxRequest(const fxStr& qf, int fd = -1); virtual ~FaxRequest(); - fxBool readQFile(fxBool& rejectJob); - fxBool reReadQFile(fxBool& rejectJob); + bool readQFile(bool& rejectJob); + bool reReadQFile(bool& rejectJob); void writeQFile(); u_int findRequest(FaxSendOp, u_int start = 0) const; - fxBool isNotify(u_int what) const; + bool isNotify(u_int what) const; - static fxBool isStrCmd(const char* cmd, u_int& ix); - static fxBool isShortCmd(const char* cmd, u_int& ix); + static bool isStrCmd(const char* cmd, u_int& ix); + static bool isShortCmd(const char* cmd, u_int& ix); void insertFax(u_int ix, const fxStr& file); void addRequest(FaxSendOp op, char* tag); - void addRequest(FaxSendOp op, char* tag, fxBool& rejectJob); + void addRequest(FaxSendOp op, char* tag, bool& rejectJob); void checkNotifyValue(const char* tag); void checkChopValue(const char* tag); static fxStr mkbasedoc(const fxStr& file); void renameSaved(u_int fi); - fxBool isUnreferenced(u_int fi); + bool isUnreferenced(u_int fi); }; -inline fxBool FaxRequest::isNotify(u_int what) const +inline bool FaxRequest::isNotify(u_int what) const { return (notify & (u_short) what) != 0; } #endif /* _FaxRequest_ */ diff --git a/faxd/FaxSend.c++ b/faxd/FaxSend.c++ index 1cc032a5..42165d65 100644 --- a/faxd/FaxSend.c++ +++ b/faxd/FaxSend.c++ @@ -73,11 +73,11 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, FaxAcctInfo& ai) * time to settle. We want a handle on the modem so that we * can be prepared to answer incoming phone calls. */ - discardModem(TRUE); + discardModem(true); changeState(MODEMWAIT, 5); } else { sendFailed(fax, send_retry, "Can not setup modem", 4*pollModemWait); - discardModem(TRUE); + discardModem(true); changeState(MODEMWAIT, pollModemWait); } endSession(); @@ -174,10 +174,10 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num fax.ndials = 0; // consec. failed dial attempts fax.tottries++; // total answered calls fax.totdials++; // total attempted calls - clientInfo.setCalledBefore(TRUE); + clientInfo.setCalledBefore(true); clientInfo.setDialFailures(0); modem->sendBegin(); - fxBool remoteHasDoc = FALSE; + bool remoteHasDoc = false; notifyConnected(fax); FaxSendStatus status = modem->getPrologue( clientCapabilities, remoteHasDoc, notice); @@ -268,7 +268,7 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num break; case ClassModem::NOFCON: // carrier seen, but handshake failed case ClassModem::DATACONN: // data connection established - clientInfo.setCalledBefore(TRUE); + clientInfo.setCalledBefore(true); /* fall thru... */ case ClassModem::BUSY: // busy signal case ClassModem::NOANSWER: // no answer or ring back @@ -322,7 +322,7 @@ FaxServer::sendFax(FaxRequest& fax, FaxMachineInfo& clientInfo, const fxStr& num * Process a polling request. */ void -FaxServer::sendPoll(FaxRequest& fax, fxBool remoteHasDoc) +FaxServer::sendPoll(FaxRequest& fax, bool remoteHasDoc) { u_int ix = fax.findRequest(FaxRequest::send_poll); if (ix == fx_invalidArrayIndex) { @@ -359,7 +359,7 @@ FaxServer::sendPoll(FaxRequest& fax, fxBool remoteHasDoc) /* * Phase B of Group 3 protocol. */ -fxBool +bool FaxServer::sendFaxPhaseB(FaxRequest& fax, faxRequest& freq, FaxMachineInfo& clientInfo) { fax.status = send_failed; // assume failure @@ -411,7 +411,7 @@ FaxServer::sendFaxPhaseB(FaxRequest& fax, faxRequest& freq, FaxMachineInfo& clie * Check client's capabilities (DIS) against those of the * modem and select the parameters that are best for us. */ -fxBool +bool FaxServer::sendClientCapabilitiesOK(FaxRequest& fax, FaxMachineInfo& clientInfo, fxStr& emsg) { /* @@ -425,7 +425,7 @@ FaxServer::sendClientCapabilitiesOK(FaxRequest& fax, FaxMachineInfo& clientInfo, fxmin(clientInfo.getMaxSignallingRate(), fax.desiredbr)); if (signallingRate == -1) { emsg = "Modem does not support negotiated signalling rate"; - return (FALSE); + return (false); } clientParams.br = signallingRate; @@ -435,7 +435,7 @@ FaxServer::sendClientCapabilitiesOK(FaxRequest& fax, FaxMachineInfo& clientInfo, fxmax(clientInfo.getMinScanlineTime(), fax.desiredst)); if (minScanlineTime == -1) { emsg = "Modem does not support negotiated min scanline time"; - return (FALSE); + return (false); } clientParams.st = minScanlineTime; @@ -476,7 +476,7 @@ FaxServer::sendClientCapabilitiesOK(FaxRequest& fax, FaxMachineInfo& clientInfo, traceProtocol("USE %s", clientParams.scanlineTimeName()); if (clientParams.ec == EC_ENABLE) traceProtocol("USE error correction mode"); - return (TRUE); + return (true); } /* diff --git a/faxd/FaxServer.c++ b/faxd/FaxServer.c++ index 9b0d767c..eaab5085 100644 --- a/faxd/FaxServer.c++ +++ b/faxd/FaxServer.c++ @@ -83,21 +83,21 @@ void FaxServer::notifyConnected(const FaxRequest&) {} * just by yanking the cable and then swapping the * config file before hooking up the new modem. */ -fxBool +bool FaxServer::setupModem() { modem = NULL; if (!ModemServer::setupModem()) - return (FALSE); + return (false); if (getModem()->isFaxModem()) { modem = (FaxModem*) ModemServer::getModem(); modem->setLID(localIdentifier); } - return (TRUE); + return (true); } void -FaxServer::discardModem(fxBool dropDTR) +FaxServer::discardModem(bool dropDTR) { ModemServer::discardModem(dropDTR); modem = NULL; @@ -151,19 +151,19 @@ FaxServer::deduceModem() * are selected so that any imaged facsimile should * still be sendable. */ -fxBool FaxServer::modemSupports2D() const - { return modem ? modem->supports2D() : FALSE; } -fxBool FaxServer::modemSupportsEOLPadding() const - { return modem ? modem->supportsEOLPadding() : FALSE; } -fxBool FaxServer::modemSupportsVRes(float res) const - { return modem ? modem->supportsVRes(res) : TRUE; } -fxBool FaxServer::modemSupportsPageWidth(u_int w) const - { return modem ? modem->supportsPageWidth(w) : TRUE; } -fxBool FaxServer::modemSupportsPageLength(u_int l) const - { return modem ? modem->supportsPageLength(l) : TRUE; } - -fxBool FaxServer::modemSupportsPolling() const - { return modem ? modem->supportsPolling() : FALSE; } +bool FaxServer::modemSupports2D() const + { return modem ? modem->supports2D() : false; } +bool FaxServer::modemSupportsEOLPadding() const + { return modem ? modem->supportsEOLPadding() : false; } +bool FaxServer::modemSupportsVRes(float res) const + { return modem ? modem->supportsVRes(res) : true; } +bool FaxServer::modemSupportsPageWidth(u_int w) const + { return modem ? modem->supportsPageWidth(w) : true; } +bool FaxServer::modemSupportsPageLength(u_int l) const + { return modem ? modem->supportsPageLength(l) : true; } + +bool FaxServer::modemSupportsPolling() const + { return modem ? modem->supportsPolling() : false; } fxStr FaxServer::getModemCapabilities() const diff --git a/faxd/FaxServer.h b/faxd/FaxServer.h index 7a08e598..4030d672 100644 --- a/faxd/FaxServer.h +++ b/faxd/FaxServer.h @@ -62,9 +62,9 @@ private: // FAX transmission protocol support void sendFax(FaxRequest& fax, FaxMachineInfo&, const fxStr& number); - fxBool sendClientCapabilitiesOK(FaxRequest&, FaxMachineInfo&, fxStr&); - fxBool sendFaxPhaseB(FaxRequest&, faxRequest&, FaxMachineInfo&); - void sendPoll(FaxRequest& fax, fxBool remoteHasDoc); + bool sendClientCapabilitiesOK(FaxRequest&, FaxMachineInfo&, fxStr&); + bool sendFaxPhaseB(FaxRequest&, faxRequest&, FaxMachineInfo&); + void sendPoll(FaxRequest& fax, bool remoteHasDoc); FaxSendStatus sendSetupParams(TIFF*, Class2Params&, const FaxMachineInfo&, fxStr&); FaxSendStatus sendSetupParams1(TIFF*, @@ -74,24 +74,24 @@ private: // FAX reception support int getRecvFile(fxStr& qfile, fxStr& emsg); TIFF* setupForRecv(FaxRecvInfo&, FaxRecvInfoArray&, fxStr& emsg); - fxBool recvDocuments(TIFF*, FaxRecvInfo&, FaxRecvInfoArray&, + bool recvDocuments(TIFF*, FaxRecvInfo&, FaxRecvInfoArray&, fxStr& emsg); - fxBool recvFaxPhaseD(TIFF* tif, FaxRecvInfo&, int& ppm, fxStr& emsg); - fxBool pollFaxPhaseB(const fxStr& sep, const fxStr& pwd, + bool recvFaxPhaseD(TIFF* tif, FaxRecvInfo&, int& ppm, fxStr& emsg); + bool pollFaxPhaseB(const fxStr& sep, const fxStr& pwd, FaxRecvInfoArray&, fxStr& emsg); protected: FaxServer(const fxStr& deviceName, const fxStr& devID); - fxBool setupModem(); + bool setupModem(); ClassModem* deduceModem(); - void discardModem(fxBool dropDTR); + void discardModem(bool dropDTR); fxStr getModemCapabilities() const; void readConfig(const fxStr& filename); void setLocalIdentifier(const fxStr& lid); void sendFax(FaxRequest&, FaxMachineInfo&, FaxAcctInfo&); - fxBool recvFax(); + bool recvFax(); time_t getFileTransferTime() const; time_t getPageTransferTime() const; @@ -116,11 +116,11 @@ public: const fxStr& getLocalIdentifier() const; - fxBool modemSupports2D() const; - fxBool modemSupportsEOLPadding() const; - fxBool modemSupportsVRes(float res) const; - fxBool modemSupportsPageWidth(u_int w) const; - fxBool modemSupportsPageLength(u_int l) const; - fxBool modemSupportsPolling() const; + bool modemSupports2D() const; + bool modemSupportsEOLPadding() const; + bool modemSupportsVRes(float res) const; + bool modemSupportsPageWidth(u_int w) const; + bool modemSupportsPageLength(u_int l) const; + bool modemSupportsPolling() const; }; #endif /* _FaxServer_ */ diff --git a/faxd/G3Decoder.c++ b/faxd/G3Decoder.c++ index 6840efd4..6ac30880 100644 --- a/faxd/G3Decoder.c++ +++ b/faxd/G3Decoder.c++ @@ -93,7 +93,7 @@ G3Decoder::G3Decoder() {} G3Decoder::~G3Decoder() {} void -G3Decoder::setupDecoder(u_int recvFillOrder, fxBool is2d) +G3Decoder::setupDecoder(u_int recvFillOrder, bool is2d) { /* * The G3 decoding state tables are constructed for @@ -150,20 +150,20 @@ G3Decoder::decode(void* raster, u_int w, u_int h) } } -fxBool +bool G3Decoder::isNextRow1D() { DECLARE_STATE_EOL(); CACHE_STATE(); SYNC_EOL(Nop); - fxBool is1D; + bool is1D; if (is2D) { NeedBits8(1, Nop); is1D = (GetBits(1) != 0); // 1D/2D-encoding tag bit // NB: we don't clear the tag bit } else { - is1D = TRUE; + is1D = true; } // now reset state for next decoded row BitAcc = (BitAcc<<1)|1; // EOL bit @@ -175,11 +175,11 @@ G3Decoder::isNextRow1D() #define unexpected(table, a0) do { \ invalidCode(table, a0); \ - rowgood = FALSE; \ + rowgood = false; \ } while (0) #define extension(a0) do { \ invalidCode("2D", a0); \ - rowgood = FALSE; \ + rowgood = false; \ } while (0) #define prematureEOF(a0) // never happens 'cuz of longjmp #define SWAP(t,a,b) { t x; x = (a); (a) = (b); (b) = x; } @@ -188,31 +188,31 @@ G3Decoder::isNextRow1D() * Decode a single row of pixels and return * the decoded data in the scanline buffer. */ -fxBool +bool G3Decoder::decodeRow(void* scanline, u_int lastx) { DECLARE_STATE_2D(); - fxBool rowgood = TRUE; - fxBool nullrow = FALSE; + bool rowgood = true; + bool nullrow = false; CACHE_STATE(); a0 = 0; RunLength = 0; pa = thisrun = curruns; SYNC_EOL(Nop); - fxBool is1D; + bool is1D; if (is2D) { NeedBits8(1, Nop); is1D = (GetBits(1) != 0); // 1D/2D-encoding tag bit ClrBits(1); } else - is1D = TRUE; + is1D = true; if (!is1D) { pb = refruns; b1 = *pb++; #define badlength(a0,lastx) do { \ badPixelCount("2D", a0, lastx); \ - rowgood = FALSE; \ + rowgood = false; \ } while (0) EXPAND2D(Nop2d); Nop2d:; @@ -223,7 +223,7 @@ G3Decoder::decodeRow(void* scanline, u_int lastx) if (nullrow && ++RTCrun == 6 && RTCrow == -1) \ RTCrow = rowref-6; \ badPixelCount("1D", a0, lastx); \ - rowgood = FALSE; \ + rowgood = false; \ } while (0) EXPAND1D(Nop1d); Nop1d:; diff --git a/faxd/G3Decoder.h b/faxd/G3Decoder.h index fdff9e51..fcb3d799 100644 --- a/faxd/G3Decoder.h +++ b/faxd/G3Decoder.h @@ -36,7 +36,7 @@ extern "C" { class G3Decoder { private: - fxBool is2D; // whether or not data is 2d-encoded + bool is2D; // whether or not data is 2d-encoded uint32 data; // current input/output byte int bit; // current bit in input/output byte int EOLcnt; // EOL code recognized during decoding (1/0) @@ -67,17 +67,17 @@ public: virtual ~G3Decoder(); - void setupDecoder(u_int fillorder, fxBool is2D); + void setupDecoder(u_int fillorder, bool is2D); void setRuns(uint16*, uint16*, int); uint16* lastRuns(); void decode(void* raster, u_int w, u_int h); - fxBool decodeRow(void* scanline, u_int w); - fxBool isNextRow1D(); + bool decodeRow(void* scanline, u_int w); + bool isNextRow1D(); int getPendingBits() const; - fxBool seenRTC() const; + bool seenRTC() const; int getRTCRow() const; int getReferenceRow() const; }; @@ -95,7 +95,7 @@ public: inline uint16* G3Decoder::lastRuns() { return is2D ? refruns : curruns; } inline const u_char* G3Decoder::getBitmap() { return bitmap; } inline int G3Decoder::getPendingBits() const { return bit; } -inline fxBool G3Decoder::seenRTC() const { return (RTCrow != -1); } +inline bool G3Decoder::seenRTC() const { return (RTCrow != -1); } inline int G3Decoder::getRTCRow() const { return RTCrow; } inline int G3Decoder::getReferenceRow() const { return rowref; } #endif /* _G3Decoder_ */ diff --git a/faxd/G3Encoder.c++ b/faxd/G3Encoder.c++ index ff970f85..41b323b0 100644 --- a/faxd/G3Encoder.c++ +++ b/faxd/G3Encoder.c++ @@ -39,7 +39,7 @@ G3Encoder::~G3Encoder() {} * Reset encoding state. */ void -G3Encoder::setupEncoder(u_int fillOrder, fxBool is2d) +G3Encoder::setupEncoder(u_int fillOrder, bool is2d) { is2D = is2d; /* diff --git a/faxd/G3Encoder.h b/faxd/G3Encoder.h index cd4e6a54..ddb571ec 100644 --- a/faxd/G3Encoder.h +++ b/faxd/G3Encoder.h @@ -35,7 +35,7 @@ struct tableentry; class G3Encoder { private: - fxBool is2D; // data is to be 1d/2d-encoded + bool is2D; // data is to be 1d/2d-encoded const u_char* bitmap; // bit reversal table short data; // current input/output byte short bit; // current bit in input/output byte @@ -55,7 +55,7 @@ public: G3Encoder(fxStackBuffer&); virtual ~G3Encoder(); - void setupEncoder(u_int fillOrder, fxBool); + void setupEncoder(u_int fillOrder, bool); void encode(const void* raster, u_int w, u_int h); }; #endif /* _G3Encoder_ */ diff --git a/faxd/Getty.c++ b/faxd/Getty.c++ index 48dc04f6..5aefc6b1 100644 --- a/faxd/Getty.c++ +++ b/faxd/Getty.c++ @@ -149,7 +149,7 @@ Getty::addEnvVar(int& envc, char* env[], fxStr& var) * the child. */ void -Getty::run(int fd, fxBool parentIsInit) +Getty::run(int fd, bool parentIsInit) { if (Sys::chdir(_PATH_DEV) < 0) fatal("chdir: %m"); @@ -206,8 +206,8 @@ Getty::setupSession(int fd) fatal("Unable to dup stdin to stderr: %m"); } -fxBool -Getty::wait(int& status, fxBool block) +bool +Getty::wait(int& status, bool block) { return (Sys::waitpid(pid, status, block ? 0 : WNOHANG) == pid); } diff --git a/faxd/Getty.h b/faxd/Getty.h index 692e1e39..17bfe275 100644 --- a/faxd/Getty.h +++ b/faxd/Getty.h @@ -55,8 +55,8 @@ public: void setupArgv(const char* args); // setup arguments for getty process // run getty process - virtual void run(int fd, fxBool parentIsInit); - virtual fxBool wait(int& status, fxBool block = FALSE); + virtual void run(int fd, bool parentIsInit); + virtual bool wait(int& status, bool block = false); virtual void hangup(); // cleanup state after hangup pid_t getPID() const; // getty pid diff --git a/faxd/GettySysV.c++ b/faxd/GettySysV.c++ index 981503f9..6b4fad66 100644 --- a/faxd/GettySysV.c++ +++ b/faxd/GettySysV.c++ @@ -221,14 +221,14 @@ SysVGetty::hangup() Getty::hangup(); } -fxBool -SysVGetty::wait(int& status, fxBool block) +bool +SysVGetty::wait(int& status, bool block) { if (Getty::wait(status, block)) { exitStatus = status; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* diff --git a/faxd/GettySysV.h b/faxd/GettySysV.h index 354dbb1e..e1d86527 100644 --- a/faxd/GettySysV.h +++ b/faxd/GettySysV.h @@ -54,6 +54,6 @@ public: ~SysVGetty(); void hangup(); - fxBool wait(int& status, fxBool block = FALSE); + bool wait(int& status, bool block = false); }; #endif /* _SYSVGETTY_ */ diff --git a/faxd/HDLCFrame.c++ b/faxd/HDLCFrame.c++ index 79b56e71..e6c7cf1f 100644 --- a/faxd/HDLCFrame.c++ +++ b/faxd/HDLCFrame.c++ @@ -37,7 +37,7 @@ HDLCFrame::HDLCFrame(u_int fo) base = next = buf; end = &buf[sizeof(buf)]; amountToGrowBy = 1024; - ok = FALSE; + ok = false; } HDLCFrame::~HDLCFrame() diff --git a/faxd/HDLCFrame.h b/faxd/HDLCFrame.h index fbe62057..643e7109 100644 --- a/faxd/HDLCFrame.h +++ b/faxd/HDLCFrame.h @@ -45,9 +45,9 @@ public: u_char& operator[](u_int i) const; // NB: no bounds checking u_char& operator[](int i) const; // NB: no bounds checking - fxBool moreFrames() const; // more frames follow - fxBool isOK() const; // frame has good FCS - void setOK(fxBool b); // set frame FCS indicator + bool moreFrames() const; // more frames follow + bool isOK() const; // frame has good FCS + void setOK(bool b); // set frame FCS indicator u_int getRawFCF() const; // raw FCF in frame u_int getFCF() const; // FCF &~ (FCF_SNDR|FCF_RCVR) const u_char* getFrameData() const; // data following FCF @@ -62,7 +62,7 @@ protected: u_char* base; u_short amountToGrowBy; u_short frameOverhead; // # bytes for leader & FCS - fxBool ok; // FCS correct + bool ok; // FCS correct void addc(u_char c); // make room & add a char to the buffer void grow(u_int amount); // make more room in the buffer @@ -70,17 +70,17 @@ protected: inline void HDLCFrame::put(u_char c) { if (next < end) *next++ = c; else addc(c); } -inline void HDLCFrame::reset() { next = base; ok = FALSE; } +inline void HDLCFrame::reset() { next = base; ok = false; } inline u_int HDLCFrame::getLength() const { return next - base; } inline HDLCFrame::operator u_char*() { return base; } inline u_char& HDLCFrame::operator[](u_int i) const { return base[i]; } inline u_char& HDLCFrame::operator[](int i) const { return base[i]; } -inline fxBool HDLCFrame::moreFrames() const +inline bool HDLCFrame::moreFrames() const { return ((*this)[1]&0x08) == 0; } -inline fxBool HDLCFrame::isOK() const { return ok; } -inline void HDLCFrame::setOK(fxBool b) { ok = b; } +inline bool HDLCFrame::isOK() const { return ok; } +inline void HDLCFrame::setOK(bool b) { ok = b; } inline u_int HDLCFrame::getRawFCF() const { return (*this)[2]; } inline u_int HDLCFrame::getFCF() const { return (*this)[2]&0x7f; } inline const u_char* HDLCFrame::getFrameData() const { return &((*this)[3]); } diff --git a/faxd/HylaClient.c++ b/faxd/HylaClient.c++ index deaf162c..33542f68 100644 --- a/faxd/HylaClient.c++ +++ b/faxd/HylaClient.c++ @@ -44,7 +44,7 @@ HylaClient::HylaClient(const fxStr& fn) : fifoName(fn) refs = 0; seqnum = 0; lrunum = lruseq; - reap = FALSE; + reap = false; clients[fn] = this; } @@ -75,11 +75,11 @@ HylaClient::getClient(const fxStr& name) * client is scheduled to be purged at the next * opportune time. */ -fxBool +bool HylaClient::send(const char* msg, u_int msgLen) { if (reap) // ignore if marked for reaping - return (FALSE); + return (false); seqnum++; // count message again: if (fifo < 0) { @@ -105,7 +105,7 @@ again: logError("HylaClient::send: %s: Cannot open FIFO: %m", (const char*) fifoName); schedReap(); - return (FALSE); + return (false); } /* * NB: We mark the descriptor for non-blocking i/o; this @@ -122,7 +122,7 @@ again: if (n == -1 && (errno == EBADF || errno == EPIPE)) { Sys::close(fifo), fifo = -1; schedReap(); - return (FALSE); + return (false); } if (n != msgLen) logError( @@ -130,7 +130,7 @@ again: (const char*) fifoName, seqnum, n); lrunum = lruseq++; // update last use seqnum } - return (TRUE); + return (true); } /* @@ -139,7 +139,7 @@ again: * the oldest trigger with an open descriptor and * reclaim it. */ -fxBool +bool HylaClient::reapFIFO() { HylaClient* cand = NULL; @@ -162,9 +162,9 @@ HylaClient::reapFIFO() if (cand) { Sys::close(cand->fifo); cand->fifo = -1; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } void @@ -185,7 +185,7 @@ HylaClient::purge() void HylaClient::schedReap() { - reap = TRUE; + reap = true; schedReaper.start(); } @@ -197,13 +197,13 @@ HylaClient::schedReap() * "delete this". */ -HylaClient::SchedReaper::SchedReaper() { started = FALSE; } +HylaClient::SchedReaper::SchedReaper() { started = false; } HylaClient::SchedReaper::~SchedReaper() {} void HylaClient::SchedReaper::timerExpired(long, long) { - started = FALSE; + started = false; /* * Reclaim clients that have gone away. * @@ -230,6 +230,6 @@ HylaClient::SchedReaper::start() { if (!started) { Dispatcher::instance().startTimer(0,1, this); - started = TRUE; + started = true; } } diff --git a/faxd/HylaClient.h b/faxd/HylaClient.h index def4651c..37391cdb 100644 --- a/faxd/HylaClient.h +++ b/faxd/HylaClient.h @@ -41,7 +41,7 @@ class HylaClient { public: class SchedReaper : public IOHandler { private: - fxBool started; + bool started; public: SchedReaper(); ~SchedReaper(); @@ -55,7 +55,7 @@ private: u_short refs; // # of Triggers referencing this client tseq_t seqnum; // per-client message sequence number tseq_t lrunum; // sequence number for LRU reclaim of fd's - fxBool reap; // client should be reaped + bool reap; // client should be reaped static tseq_t lruseq; // master sequence # generator for LRU static HylaClientDict clients; // master table of clients @@ -66,7 +66,7 @@ private: HylaClient(const fxStr& fifoName); - static fxBool reapFIFO(); + static bool reapFIFO(); void schedReap(); public: ~HylaClient(); @@ -78,7 +78,7 @@ public: void dec(); tseq_t getSeqnum() const; - fxBool send(const char* msg, u_int msgLen); + bool send(const char* msg, u_int msgLen); }; inline void HylaClient::inc() { refs++; } inline void HylaClient::dec() { if (--refs == 0) delete this; } diff --git a/faxd/Job.c++ b/faxd/Job.c++ index b3bae759..357189ea 100644 --- a/faxd/Job.c++ +++ b/faxd/Job.c++ @@ -69,7 +69,7 @@ Job::Job(const FaxRequest& req) dnext = NULL; modem = NULL; - suspendPending = FALSE; + suspendPending = false; registry[jobid] = this; } diff --git a/faxd/Job.h b/faxd/Job.h index c62fa1e3..71651320 100644 --- a/faxd/Job.h +++ b/faxd/Job.h @@ -116,8 +116,8 @@ public: u_short pagewidth; // desired output page width (mm) u_short pagelength; // desired output page length (mm) u_short resolution; // desired vertical resolution (lpi) - fxBool willpoll; // job has polling request - fxBool suspendPending; // suspend state change pending for job + bool willpoll; // job has polling request + bool suspendPending; // suspend state change pending for job fxStr file; // queue file name fxStr jobid; // job identifier @@ -165,6 +165,6 @@ public: operator Job&() const { return *(Job*)ql; } operator Job*() const { return (Job*) ql; } Job& job() const { return *(Job*)ql; } - fxBool notDone() { return ql != head; } + bool notDone() { return ql != head; } }; #endif /* _Job_ */ diff --git a/faxd/Modem.c++ b/faxd/Modem.c++ index 94df8212..4f8c9aca 100644 --- a/faxd/Modem.c++ +++ b/faxd/Modem.c++ @@ -72,7 +72,7 @@ Modem::Modem(const fxStr& id) , lockHandler(*this) { state = DOWN; // modem down until notified otherwise - canpoll = TRUE; // be optimistic + canpoll = true; // be optimistic fd = -1; // force open on first use priority = 255; // lowest priority insert(list); // place at end of master list @@ -117,18 +117,18 @@ Modem::getModemByID(const fxStr& id) /* * Is the modem capable of handling the job. */ -fxBool +bool Modem::isCapable(const Job& job) const { if (job.willpoll && !canpoll) - return (FALSE); + return (false); if (job.pagewidth && !supportsPageWidthInMM(job.pagewidth)) - return (FALSE); + return (false); if (job.pagelength && !supportsPageLengthInMM(job.pagelength)) - return (FALSE); + return (false); if (job.resolution && !supportsVRes(job.resolution)) - return (FALSE); - return (TRUE); + return (false); + return (true); } /* @@ -173,13 +173,13 @@ Modem::findModem(const Job& job) /* * Assign a modem for use by a job. */ -fxBool +bool Modem::assign(Job& job) { if (lock->lock()) { // lock modem for use state = BUSY; // mark in use job.modem = this; // assign modem to job - return (TRUE); + return (true); } else { /* * Modem is locked for use by an outbound task. @@ -192,7 +192,7 @@ Modem::assign(Job& job) * to re-assign it in findModem. */ state = BUSY; // mark in use - return (FALSE); + return (false); } } @@ -277,7 +277,7 @@ void Modem::setState(ModemState s) { state = s; } * (but then the caller would need to know in order * to pad the image to the appropriate width). */ -fxBool +bool Modem::supportsPageWidthInMM(u_int w) const { if (w <= 110) // 864 pixels + slop @@ -291,10 +291,10 @@ Modem::supportsPageWidthInMM(u_int w) const else if (w <= 306) // 2432 pixels + slop return caps.wd & BIT(WD_2432); else - return FALSE; + return false; } -fxBool +bool Modem::supportsPageWidthInPixels(u_int w) const { if (w <= 880) // 864 pixels + slop @@ -308,7 +308,7 @@ Modem::supportsPageWidthInPixels(u_int w) const else if (w <= 2448) // 2432 pixels + slop return caps.wd & BIT(WD_2432); else - return FALSE; + return false; } /* @@ -318,7 +318,7 @@ Modem::supportsPageWidthInPixels(u_int w) const * problems and general sloppiness on the part of * applications writing TIFF files. */ -fxBool +bool Modem::supportsVRes(float res) const { if (75 <= res && res < 120) @@ -326,13 +326,13 @@ Modem::supportsVRes(float res) const else if (150 <= res && res < 250) return caps.vr & BIT(VR_FINE); else - return FALSE; + return false; } /* * Return whether or not the modem supports 2DMR. */ -fxBool +bool Modem::supports2D() const { return caps.df & BIT(DF_2DMR); @@ -343,7 +343,7 @@ Modem::supports2D() const * specified page length. As above for vertical * resolution we're lenient in what we accept. */ -fxBool +bool Modem::supportsPageLengthInMM(u_int l) const { // XXX probably need to be more forgiving with values @@ -366,17 +366,17 @@ Modem::broadcast(const fxStr& msg) * NB: We rarely send msgs, so for now close after each use. * +1 here is so the \0 is included in the message. */ - iter.modem().send(msg, msg.length()+1, FALSE); + iter.modem().send(msg, msg.length()+1, false); } } /* * Send a message to the process managing a modem. */ -fxBool -Modem::send(const char* msg, u_int msgLen, fxBool cacheFd) +bool +Modem::send(const char* msg, u_int msgLen, bool cacheFd) { - fxBool retry = TRUE; + bool retry = true; again: if (fd < 0) { fd = Sys::open(fifoName, O_WRONLY|O_NDELAY); @@ -388,13 +388,13 @@ again: */ logError("MODEM " | devID | ": Cannot open FIFO: %m"); #endif - return (FALSE); + return (false); } } int n = Sys::write(fd, msg, msgLen); if (n == -1) { if (errno == EBADF && retry) { // cached descriptor bad, retry - retry = FALSE; + retry = false; Sys::close(fd), fd = -1; goto again; } diff --git a/faxd/Modem.h b/faxd/Modem.h index 47a63e43..73222342 100644 --- a/faxd/Modem.h +++ b/faxd/Modem.h @@ -84,7 +84,7 @@ private: fxStr number; // modem phone number fxStr commid; // communication identifier ModemState state; // modem state - fxBool canpoll; // modem is capable of polling + bool canpoll; // modem is capable of polling u_short priority; // modem priority Class2Params caps; // modem capabilities UUCPLock* lock; // UUCP lockfile support @@ -109,7 +109,7 @@ public: static Modem* modemExists(const fxStr& id); static Modem* findModem(const Job& job); - fxBool assign(Job&); // assign modem + bool assign(Job&); // assign modem void release(); // release modem void startLockPolling(long sec); // initiate polling thread @@ -122,23 +122,23 @@ public: u_int getPriority() const; // return modem scheduling priority const fxStr& getCommID() const; // return communication ID - fxBool isCapable(const Job& job) const; - fxBool supports2D() const; // modem supports 2D-encoded fax - fxBool supportsVRes(float) const; // modem supports vertical resolution + bool isCapable(const Job& job) const; + bool supports2D() const; // modem supports 2D-encoded fax + bool supportsVRes(float) const; // modem supports vertical resolution // modem support fax page width - fxBool supportsPageWidthInMM(u_int) const; - fxBool supportsPageWidthInPixels(u_int) const; + bool supportsPageWidthInMM(u_int) const; + bool supportsPageWidthInPixels(u_int) const; // modem supports fax page length - fxBool supportsPageLengthInMM(u_int) const; - fxBool supportsPolling() const; // modem supports fax polling + bool supportsPageLengthInMM(u_int) const; + bool supportsPolling() const; // modem supports fax polling // send message to modem FIFO - fxBool send(const char* msg, u_int len, fxBool cacheFd = TRUE); + bool send(const char* msg, u_int len, bool cacheFd = true); static void broadcast(const fxStr&); // broadcast msg to all FIFOs void encode(fxStackBuffer&) const; // encode for ModemExt }; -inline fxBool Modem::supportsPolling() const { return canpoll; } +inline bool Modem::supportsPolling() const { return canpoll; } inline const fxStr& Modem::getDeviceID() const { return devID; } inline const fxStr& Modem::getNumber() const { return number; } inline ModemState Modem::getState() const { return state; } @@ -164,6 +164,6 @@ public: operator Modem&() const { return *(Modem*)ql; } operator Modem*() const { return (Modem*) ql; } Modem& modem() const { return *(Modem*)ql; } - fxBool notDone() { return ql != head; } + bool notDone() { return ql != head; } }; #endif /* _Modem_ */ diff --git a/faxd/ModemConfig.c++ b/faxd/ModemConfig.c++ index a5fb3c48..53a4f4b7 100644 --- a/faxd/ModemConfig.c++ +++ b/faxd/ModemConfig.c++ @@ -209,9 +209,9 @@ ModemConfig::setupConfig() flowControl = ClassModem::FLOW_NONE;// no flow control maxRate = ClassModem::BR19200; // reasonable for most modems minSpeed = BR_2400; // minimum transmit speed - waitForConnect = FALSE; // unique modem answer response - class2XmitWaitForXON = TRUE; // default per Class 2 spec - class2SendRTC = FALSE; // default per Class 2 spec + waitForConnect = false; // unique modem answer response + class2XmitWaitForXON = true; // default per Class 2 spec + class2SendRTC = false; // default per Class 2 spec setVolumeCmds("ATM0 ATL0M1 ATL1M1 ATL2M1 ATL3M1"); recvDataFormat = DF_ALL; // default to no transcoding } @@ -225,7 +225,7 @@ ModemConfig::resetConfig() #define valeq(a,b) (strcasecmp(a,b)==0) -fxBool +bool ModemConfig::findRate(const char* cp, BaudRate& br) { static const struct { @@ -246,9 +246,9 @@ ModemConfig::findRate(const char* cp, BaudRate& br) for (int i = N(rates)-1; i >= 0; i--) if (streq(cp, rates[i].name)) { br = rates[i].b; - return (TRUE); + return (true); } - return (FALSE); + return (false); } BaudRate @@ -262,7 +262,7 @@ ModemConfig::getRate(const char* cp) return (br); } -fxBool +bool ModemConfig::findATResponse(const char* cp, ATResponse& resp) { static const struct { @@ -284,9 +284,9 @@ ModemConfig::findATResponse(const char* cp, ATResponse& resp) for (u_int i = 0; i < N(responses); i++) if (valeq(cp, responses[i].name)) { resp = responses[i].r; - return (TRUE); + return (true); } - return (FALSE); + return (false); } u_int @@ -302,7 +302,7 @@ ModemConfig::getFill(const char* cp) } } -fxBool +bool ModemConfig::findFlow(const char* cp, FlowControl& fc) { static const struct { @@ -318,9 +318,9 @@ ModemConfig::findFlow(const char* cp, FlowControl& fc) for (u_int i = 0; i < N(fcnames); i++) if (valeq(cp, fcnames[i].name)) { fc = fcnames[i].f; - return (TRUE); + return (true); } - return (FALSE); + return (false); } FlowControl @@ -421,7 +421,7 @@ ModemConfig::getSpeed(const char* value) return (BR_2400); } -fxBool +bool ModemConfig::findDataFormat(const char* cp, u_int& df) { static const struct { @@ -447,9 +447,9 @@ ModemConfig::findDataFormat(const char* cp, u_int& df) for (i = 0; i < N(dfnames); i++) if (valeq(v, dfnames[i].name)) { df = dfnames[i].d; - return (TRUE); + return (true); } - return (FALSE); + return (false); } u_int @@ -472,7 +472,7 @@ ModemConfig::parseCID(const char* rbuf, CallerID& cid) const cid.number = rbuf+cidNumber.length(); } -fxBool +bool ModemConfig::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -502,7 +502,7 @@ ModemConfig::setConfigItem(const char* tag, const char* value) else if (streq(tag, "recvdataformat")) recvDataFormat = getDataFormat(value); else - return (FALSE); - return (TRUE); + return (false); + return (true); } #undef N diff --git a/faxd/ModemConfig.h b/faxd/ModemConfig.h index 9a9d8ae7..413d1f68 100644 --- a/faxd/ModemConfig.h +++ b/faxd/ModemConfig.h @@ -40,17 +40,17 @@ private: u_int getSpeed(const char* value); u_int getDataFormat(const char* value); - static fxBool findRate(const char*, BaudRate&); - static fxBool findATResponse(const char*, ATResponse&); - static fxBool findFlow(const char*, FlowControl&); - static fxBool findDataFormat(const char*, u_int&); + static bool findRate(const char*, BaudRate&); + static bool findATResponse(const char*, ATResponse&); + static bool findFlow(const char*, FlowControl&); + static bool findDataFormat(const char*, u_int&); protected: ModemConfig(); void setupConfig(); virtual void resetConfig(); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); virtual void configError(const char* fmt, ...) = 0; virtual void configTrace(const char* fmt, ...) = 0; fxStr parseATCmd(const char*); @@ -142,8 +142,8 @@ public: fxStr class2HFLOCmd; // cmd to setup hardware flow control fxStr class2MINSPCmd; // cmd to setup min transmit speed fxStr class2RecvDataTrigger; // send to start recv - fxBool class2XmitWaitForXON; // wait for XON before send - fxBool class2SendRTC; // append RTC to page data on transmit + bool class2XmitWaitForXON; // wait for XON before send + bool class2SendRTC; // append RTC to page data on transmit // for class 2.0: fxStr class2PIECmd; // cmd to set proc interrupt handling fxStr class2NRCmd; // cmd to set status reporting @@ -165,7 +165,7 @@ public: u_int percentGoodLines; // required % of good lines in page u_int maxConsecutiveBadLines; // max consecutive bad lines in page u_int minSpeed; // minimum speed for fax transmits - fxBool waitForConnect; // modem sends multiple answer responses + bool waitForConnect; // modem sends multiple answer responses fxStr tagLineFmt; // format string for tag lines fxStr tagLineFontFile; // font file for imaging tag lines u_int recvDataFormat; // received facsimile data format diff --git a/faxd/ModemServer.c++ b/faxd/ModemServer.c++ index 2bf4d182..bd865e8e 100644 --- a/faxd/ModemServer.c++ +++ b/faxd/ModemServer.c++ @@ -79,10 +79,10 @@ ModemServer::ModemServer(const fxStr& devName, const fxStr& devID) { state = BASE; statusFile = NULL; - abortCall = FALSE; - deduceComplain = TRUE; // first failure causes complaint - changePriority = TRUE; - delayConfig = FALSE; + abortCall = false; + deduceComplain = true; // first failure causes complaint + changePriority = true; + delayConfig = false; modemFd = -1; modem = NULL; @@ -93,7 +93,7 @@ ModemServer::ModemServer(const fxStr& devName, const fxStr& devID) setupAttempts = 0; rcvCC = rcvNext = 0; - timeout = FALSE; + timeout = false; log = NULL; } @@ -115,7 +115,7 @@ ModemServer::initialize(int argc, char** argv) for (GetoptIter iter(argc, argv, faxApp::getOpts()); iter.notDone(); iter++) switch (iter.option()) { case 'p': - changePriority = FALSE; + changePriority = false; break; case 'x': tracingMask &= ~(FAXTRACE_MODEMIO|FAXTRACE_TIMEOUTS); @@ -145,7 +145,7 @@ void ModemServer::open() { if (lockModem()) { - fxBool modemReady = setupModem(); + bool modemReady = setupModem(); unlockModem(); if (!modemReady) changeState(MODEMWAIT, pollModemWait); @@ -166,7 +166,7 @@ ModemServer::close() if (lockModem()) { if (modem) modem->hangup(); - discardModem(TRUE); + discardModem(true); unlockModem(); } } @@ -391,7 +391,7 @@ void ModemServer::resetConfig() { if (modem) - discardModem(TRUE); + discardModem(true); ServerConfig::resetConfig(); } @@ -400,13 +400,13 @@ const fxStr& ModemServer::getConfigFile() const { return configFile; } /* * Setup the modem; if needed. */ -fxBool +bool ModemServer::setupModem() { if (!modem) { const char* dev = modemDevice; if (!openDevice(dev)) - return (FALSE); + return (false); /* * Deduce modem type and setup configuration info. * The deduceComplain cruft is just to reduce the @@ -414,14 +414,14 @@ ModemServer::setupModem() */ modem = deduceModem(); if (!modem) { - discardModem(TRUE); + discardModem(true); if (deduceComplain) { traceServer("%s: Can not initialize modem.", dev); - deduceComplain = FALSE; + deduceComplain = false; } - return (FALSE); + return (false); } else { - deduceComplain = TRUE; + deduceComplain = true; traceServer("MODEM " | modem->getManufacturer() | " " | modem->getModel() | "/" @@ -441,7 +441,7 @@ ModemServer::setupModem() * business in the modem class. */ modem->setSpeakerVolume(speakerVolume); - return (TRUE); + return (true); } /* @@ -472,7 +472,7 @@ ModemServer::getModemCapabilities() const * and change the device file to be owned by us * and with a protected file mode. */ -fxBool +bool ModemServer::openDevice(const char* dev) { /* @@ -483,7 +483,7 @@ ModemServer::openDevice(const char* dev) uid_t euid = geteuid(); if (seteuid(0) < 0) { traceServer("%s: seteuid root failed (%m)", dev); - return (FALSE); + return (false); } #ifdef O_NDELAY /* @@ -494,13 +494,13 @@ ModemServer::openDevice(const char* dev) if (modemFd < 0) { seteuid(euid); traceServer("%s: Can not open modem (%m)", dev); - return (FALSE); + return (false); } int flags = fcntl(modemFd, F_GETFL, 0); if (fcntl(modemFd, F_SETFL, flags &~ O_NDELAY) < 0) { traceServer("%s: fcntl: %m", dev); Sys::close(modemFd), modemFd = -1; - return (FALSE); + return (false); } #else startTimeout(3*1000); @@ -512,7 +512,7 @@ ModemServer::openDevice(const char* dev) "%s: Can not open modem (timed out)." : "%s: Can not open modem (%m)."), dev, errno); - return (FALSE); + return (false); } #endif /* @@ -535,10 +535,10 @@ ModemServer::openDevice(const char* dev) #endif traceServer("%s: chmod: %m", dev); seteuid(euid); - return (TRUE); + return (true); } -fxBool +bool ModemServer::reopenDevice() { if (modemFd >= 0) @@ -550,11 +550,11 @@ ModemServer::reopenDevice() * Discard any handle on the modem. */ void -ModemServer::discardModem(fxBool dropDTR) +ModemServer::discardModem(bool dropDTR) { if (modemFd >= 0) { if (dropDTR) - (void) setDTR(FALSE); // force hangup + (void) setDTR(false); // force hangup Sys::close(modemFd), modemFd = -1; // discard open file } delete modem, modem = NULL; @@ -637,7 +637,7 @@ ModemServer::endSession() * abort request was made or if an external abort * message is dispatched during our processing. */ -fxBool +bool ModemServer::abortRequested() { #ifndef SERVERABORTBUG @@ -658,7 +658,7 @@ ModemServer::abortRequested() void ModemServer::abortSession() { - abortCall = TRUE; + abortCall = true; traceServer("ABORT: job abort requested"); } @@ -682,7 +682,7 @@ ModemServer::timerExpired(long, long) * so cause jobs to be requeued). */ if (lockModem()) { - fxBool modemReady = setupModem(); + bool modemReady = setupModem(); unlockModem(); if (modemReady) changeState(RUNNING, 0); @@ -700,13 +700,13 @@ ModemServer::timerExpired(long, long) * are selected so that any imaged facsimile should * still be sendable. */ -fxBool ModemServer::modemReady() const +bool ModemServer::modemReady() const { return modem != NULL; } -fxBool ModemServer::serverBusy() const +bool ModemServer::serverBusy() const { return state != RUNNING; } -fxBool ModemServer::modemWaitForRings(u_int rings, CallType& type, CallerID& cid) +bool ModemServer::modemWaitForRings(u_int rings, CallType& type, CallerID& cid) { return modem->waitForRings(rings, type, cid); } CallType ModemServer::modemAnswerCall(AnswerType atype, fxStr& emsg) { return modem->answerCall(atype, emsg); } @@ -732,9 +732,9 @@ void ModemServer::readConfig(const fxStr& filename) { dialRulesFile = ""; - delayConfig = TRUE; + delayConfig = true; ServerConfig::readConfig(filename); - delayConfig = FALSE; + delayConfig = false; if (dialRulesFile != "") setDialRules(dialRulesFile); if (localIdentifier == "") @@ -964,10 +964,10 @@ ModemServer::setParity(termios& term, Parity parity) } } -fxBool +bool ModemServer::tcsetattr(int op, struct termios& term) { - fxBool ok; + bool ok; if (clocalAsRoot) { /* * Gag, IRIX 5.2 and beyond permit only the super-user to @@ -988,20 +988,20 @@ ModemServer::tcsetattr(int op, struct termios& term) return ok; } -fxBool +bool ModemServer::tcgetattr(const char* method, struct termios& term) { if (::tcgetattr(modemFd, &term) != 0) { traceModemOp("%s::tcgetattr: %m", method); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* * Set tty port baud rate and flow control. */ -fxBool +bool ModemServer::setBaudRate(BaudRate rate, FlowControl iFlow, FlowControl oFlow) { if (rate >= NBAUDS) @@ -1010,7 +1010,7 @@ ModemServer::setBaudRate(BaudRate rate, FlowControl iFlow, FlowControl oFlow) baudRates[rate], flowNames[iFlow], flowNames[oFlow]); struct termios term; if (!tcgetattr("setBaudRate", term)) - return (FALSE); + return (false); curRate = rate; // NB: for use elsewhere term.c_oflag = 0; term.c_lflag = 0; @@ -1067,7 +1067,7 @@ ModemServer::setBaudRate(BaudRate rate, FlowControl iFlow, FlowControl oFlow) /* * Set tty port baud rate and leave flow control state unchanged. */ -fxBool +bool ModemServer::setBaudRate(BaudRate rate) { if (rate >= NBAUDS) @@ -1076,7 +1076,7 @@ ModemServer::setBaudRate(BaudRate rate) baudRates[rate]); struct termios term; if (!tcgetattr("setBaudRate", term)) - return (FALSE); + return (false); curRate = rate; // NB: for use elsewhere term.c_oflag = 0; term.c_lflag = 0; @@ -1095,13 +1095,13 @@ ModemServer::setBaudRate(BaudRate rate) /* * Set tty port parity and number of data bits */ -fxBool +bool ModemServer::setParity(Parity parity) { traceModemOp("set parity: %s", parityNames[parity]); struct termios term; if (!tcgetattr("setParity", term)) - return (FALSE); + return (false); setParity(term, parity); curParity = parity; // used above flushModemInput(); @@ -1120,8 +1120,8 @@ ModemServer::setParity(Parity parity) * setting the baud rate to zero on some systems can cause * strange side effects. */ -fxBool -ModemServer::setDTR(fxBool onoff) +bool +ModemServer::setDTR(bool onoff) { traceModemOp("set DTR %s", onoff ? "ON" : "OFF"); #if defined(MCGETA) && defined(MCSETAF) && defined(MDTR) @@ -1135,7 +1135,7 @@ ModemServer::setDTR(fxBool onoff) else mstat &= ~MDTR; if (ioctl(modemFd, MCSETAF, &mstat) >= 0) - return (TRUE); + return (true); } #elif defined(TIOCMBIS) int mctl = TIOCM_DTR; @@ -1148,7 +1148,7 @@ ModemServer::setDTR(fxBool onoff) #else if (ioctl(modemFd, onoff ? TIOCMBIS : TIOCMBIC, (char *)mctl) >= 0) #endif - return (TRUE); + return (true); /* * Sigh, Sun seems to support this ioctl only on *some* * devices (e.g. on-board duarts, but not the ALM-2 card); @@ -1156,7 +1156,7 @@ ModemServer::setDTR(fxBool onoff) * on the usual way of doing things... */ #endif /* TIOCMBIS */ - return (onoff ? TRUE : setBaudRate(ClassModem::BR0)); + return (onoff ? true : setBaudRate(ClassModem::BR0)); } static const char* actNames[] = { "NOW", "DRAIN", "FLUSH" }; @@ -1173,7 +1173,7 @@ static u_int actCode[] = { TCSANOW, TCSADRAIN, TCSAFLUSH }; * XON/XOFF handling should be enabled so that any * XON/XOFF from/to the modem will be interpreted. */ -fxBool +bool ModemServer::setXONXOFF(FlowControl iFlow, FlowControl oFlow, SetAction act) { traceModemOp("set XON/XOFF/%s: input %s, output %s", @@ -1183,7 +1183,7 @@ ModemServer::setXONXOFF(FlowControl iFlow, FlowControl oFlow, SetAction act) ); struct termios term; if (!tcgetattr("setXONXOFF", term)) - return (FALSE); + return (false); setFlow(term, iFlow, oFlow); if (act == ClassModem::ACT_FLUSH) flushModemInput(); @@ -1205,8 +1205,8 @@ ModemServer::setXONXOFF(FlowControl iFlow, FlowControl oFlow, SetAction act) * that delays the delivery of input data from the UART module * upstream to the tty module. */ -fxBool -ModemServer::setInputBuffering(fxBool on) +bool +ModemServer::setInputBuffering(bool on) { traceModemOp("input buffering %s", on ? "enabled" : "disabled"); #ifdef SIOC_ITIMER @@ -1245,8 +1245,8 @@ ModemServer::setInputBuffering(fxBool on) * the ALM-2, however, you are just plain out of luck unless * you have source code. */ - static fxBool zsunbuf_push_tried = FALSE; - static fxBool zsunbuf_push_ok = FALSE; + static bool zsunbuf_push_tried = false; + static bool zsunbuf_push_ok = false; if (on) { // pop zsunbuf if present to turn on buffering char topmodule[FMNAMESZ+1]; if (zsunbuf_push_ok && ioctl(modemFd, I_LOOK, topmodule) >= 0 && @@ -1259,7 +1259,7 @@ ModemServer::setInputBuffering(fxBool on) zsunbuf_push_ok = (ioctl(modemFd, I_PUSH, "zsunbuf") >= 0); traceModemOp("initial push zsunbuf %s", zsunbuf_push_ok ? "succeeded" : "failed"); - zsunbuf_push_tried = TRUE; + zsunbuf_push_tried = true; } else if (zsunbuf_push_ok) { if (ioctl(modemFd, I_PUSH, "zsunbuf") < 0) traceModemOp("push zsunbuf failed: %m"); @@ -1280,8 +1280,8 @@ ModemServer::setInputBuffering(fxBool on) return (tcsetattr(TCSANOW, term)); } -fxBool -ModemServer::sendBreak(fxBool pause) +bool +ModemServer::sendBreak(bool pause) { traceModemOp("send break%s", pause ? " (pause)" : ""); flushModemInput(); @@ -1294,16 +1294,16 @@ ModemServer::sendBreak(fxBool pause) } if (tcsendbreak(modemFd, 0) != 0) { traceModemOp("tcsendbreak: %m"); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } void ModemServer::startTimeout(long ms) { timer.startTimeout(ms); - timeout = FALSE; + timeout = false; } void @@ -1365,14 +1365,14 @@ ModemServer::modemFlushInput() traceModemOp("tcflush: %m"); } -fxBool +bool ModemServer::modemStopOutput() { if (tcflow(modemFd, TCOOFF) != 0) { traceModemOp("tcflow: %m"); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } void @@ -1381,20 +1381,20 @@ ModemServer::flushModemInput() rcvCC = rcvNext = 0; } -fxBool +bool ModemServer::putModem(const void* data, int n, long ms) { traceStatus(FAXTRACE_MODEMCOM, "<-- data [%d]", n); return (putModem1(data, n, ms)); } -fxBool +bool ModemServer::putModem1(const void* data, int n, long ms) { if (ms) startTimeout(ms); else - timeout = FALSE; + timeout = false; int cc = Sys::write(modemFd, (const char*) data, n); if (ms) stopTimeout("writing to modem"); diff --git a/faxd/ModemServer.h b/faxd/ModemServer.h index 674bdb34..52f6997e 100644 --- a/faxd/ModemServer.h +++ b/faxd/ModemServer.h @@ -62,9 +62,9 @@ protected: }; private: FILE* statusFile; // server status file - fxBool deduceComplain; // if true, complain when can't deduce - fxBool changePriority; // change process priority by state - fxBool delayConfig; // suppress effects while reading config + bool deduceComplain; // if true, complain when can't deduce + bool changePriority; // change process priority by state + bool delayConfig; // suppress effects while reading config fxStr dialRulesFile; // dial string rules filename fxStr commid; // communication ID // generic modem-related stuff @@ -73,7 +73,7 @@ private: fxStr modemDevID; // device identifier ClassModem* modem; // modem driver Timeout timer; // timeout support class - fxBool timeout; // timeout during i/o operations + bool timeout; // timeout during i/o operations fxStr configFile; // pathname to configuration file BaudRate curRate; // current termio baud rate Parity curParity; // current termio parity setting @@ -94,10 +94,10 @@ private: static const char* stateNames[9]; static const char* stateStatus[9]; - fxBool openDevice(const char* dev); - fxBool reopenDevice(); - fxBool tcsetattr(int op, struct termios& term); - fxBool tcgetattr(const char* method, struct termios& term); + bool openDevice(const char* dev); + bool reopenDevice(); + bool tcsetattr(int op, struct termios& term); + bool tcgetattr(const char* method, struct termios& term); static void setFlow(struct termios&, FlowControl iflow, FlowControl oflow); static void setParity(struct termios&, Parity); @@ -116,15 +116,15 @@ protected: LISTENING = 8 }; ModemServerState state; - fxBool abortCall; // abort current send/receive + bool abortCall; // abort current send/receive // logging and tracing FaxMachineLog* log; // current log device ModemServer(const fxStr& deviceName, const fxStr& devID); // modem driver setup+teardown interfaces - virtual fxBool setupModem(); - virtual void discardModem(fxBool dropDTR); + virtual bool setupModem(); + virtual void discardModem(bool dropDTR); virtual ClassModem* deduceModem(); // low-level modem interfaces int getModemFd(); // XXX @@ -135,21 +135,21 @@ protected: int getModemLine(char buf[], u_int bufSize, long ms = 0); int getModemChar(long ms = 0); void flushModemInput(); - fxBool putModem(const void* data, int n, long ms = 0); - fxBool putModem1(const void* data, int n, long ms = 0); + bool putModem(const void* data, int n, long ms = 0); + bool putModem1(const void* data, int n, long ms = 0); void startTimeout(long ms); void stopTimeout(const char* whichdir); // modem line control - fxBool sendBreak(fxBool pause); - fxBool setBaudRate(BaudRate rate); - fxBool setBaudRate(BaudRate rate, FlowControl i, FlowControl o); - fxBool setParity(Parity parity); - fxBool setXONXOFF(FlowControl i, FlowControl o, SetAction act); - fxBool setDTR(fxBool on); - fxBool setInputBuffering(fxBool on); - fxBool modemStopOutput(); + bool sendBreak(bool pause); + bool setBaudRate(BaudRate rate); + bool setBaudRate(BaudRate rate, FlowControl i, FlowControl o); + bool setParity(Parity parity); + bool setXONXOFF(FlowControl i, FlowControl o, SetAction act); + bool setDTR(bool on); + bool setInputBuffering(bool on); + bool modemStopOutput(); // modem driver interfaces - fxBool modemWaitForRings(u_int rings, CallType&, CallerID&); + bool modemWaitForRings(u_int rings, CallType&, CallerID&); CallType modemAnswerCall(AnswerType, fxStr&); void modemAnswerCallCmd(CallType); void modemFlushInput(); @@ -164,7 +164,7 @@ protected: void traceModemOp(const char* fmt ...); void traceStatus(int kind, const char* fmt ...); // modem locking interfaces implemented in derived class - virtual fxBool lockModem() = 0; + virtual bool lockModem() = 0; virtual void unlockModem() = 0; // notification interfaces implemented in derived class virtual void notifyModemReady() = 0; @@ -181,7 +181,7 @@ protected: void endSession(); // abort send/receive session virtual void abortSession(); - fxBool abortRequested(); + bool abortRequested(); public: virtual ~ModemServer(); @@ -199,8 +199,8 @@ public: int getServerTracing() const; void vtraceStatus(int kind, const char* fmt, va_list ap); - fxBool modemReady() const; - fxBool serverBusy() const; + bool modemReady() const; + bool serverBusy() const; }; inline ClassModem* ModemServer::getModem() { return modem; } inline int ModemServer::getModemFd() { return modemFd; } diff --git a/faxd/PCFFont.c++ b/faxd/PCFFont.c++ index b0824d15..7d922e92 100644 --- a/faxd/PCFFont.c++ +++ b/faxd/PCFFont.c++ @@ -75,7 +75,7 @@ struct charInfo { #define CONFIG_GLYPH 2 // glyphs must be word-aligned #define CONFIG_GLYPH_IX 1 // index for word-aligned glyphs -inline fxBool PCFFont::isFormat(u_long f) const +inline bool PCFFont::isFormat(u_long f) const { return ((format&PCF_FORMAT_MASK) == f); } inline u_int PCFFont::byteOrder() const { return ((format&PCF_BYTE_MASK) ? MSBFirst : LSBFirst); } @@ -110,7 +110,7 @@ PCFFont::cleanup() { if (file != NULL) fclose(file), file = NULL; - ready = FALSE; + ready = false; delete toc, toc = NULL; delete encoding, encoding = NULL; delete bitmaps, bitmaps = NULL; @@ -123,7 +123,7 @@ PCFFont::cleanup() * font metrics, font bitmaps, font encoding, and * some of the accelerator info. */ -fxBool +bool PCFFont::read(const char* name) { cleanup(); @@ -131,10 +131,10 @@ PCFFont::read(const char* name) file = fopen(filename, "r"); if (file == NULL) { error("Can not open file"); - return (FALSE); + return (false); } if (!readTOC()) - return (FALSE); + return (false); if (seekToTable(PCF_METRICS)) { format = getLSB32(); if (isFormat(PCF_DEFAULT_FORMAT)) @@ -143,12 +143,12 @@ PCFFont::read(const char* name) numGlyphs = getINT16(); else { error("Bad font metric format 0x%lx", format); - return (FALSE); + return (false); } metrics = new charInfo[numGlyphs]; if (!metrics) { error("No space for font metric information"); - return (FALSE); + return (false); } for (int i = 0; i < numGlyphs; i++) { if (isFormat(PCF_DEFAULT_FORMAT)) @@ -158,20 +158,20 @@ PCFFont::read(const char* name) } } else { error("Can not seek to font metric information"); - return (FALSE); + return (false); } if (seekToTable(PCF_BITMAPS)) { format = getLSB32(); if (!isFormat(PCF_DEFAULT_FORMAT)) { error("Bad bitmap data format 0x%lx", format); - return (FALSE); + return (false); } u_long nbitmaps = getINT32(); u_long* offsets = new u_long[nbitmaps]; if (!offsets) { error("No space for bitmap offsets array"); - return (FALSE); + return (false); } int i; for (i = 0; i < nbitmaps; i++) @@ -186,12 +186,12 @@ PCFFont::read(const char* name) if (!bitmaps) { error("No space for bitmap data array"); delete offsets; - return (FALSE); + return (false); } if (fread(bitmaps, (u_int) sizebitmaps, 1, file) != 1) { error("Error reading bitmap data"); delete offsets; - return (FALSE); + return (false); } if (bitOrder() != CONFIG_BIT) TIFFReverseBits(bitmaps, sizebitmaps); @@ -216,7 +216,7 @@ PCFFont::read(const char* name) if (!padbitmaps) { error("No space for padded bitmap data array"); delete offsets; - return (FALSE); + return (false); } int newoff = 0; for (i = 0; i < nbitmaps; i++) { @@ -236,20 +236,20 @@ PCFFont::read(const char* name) if ((unsigned) metrics[i].bits & 1) { error("Internal error, bitmap data not word-aligned"); delete offsets; - return (FALSE); + return (false); } } delete offsets; } else { error("Can not seek to bitmap data"); - return (FALSE); + return (false); } if (seekToTable(PCF_BDF_ENCODINGS)) { format = getLSB32(); if (!isFormat(PCF_DEFAULT_FORMAT)) { error("Bad encodings format 0x%lx", format); - return (FALSE); + return (false); } firstCol = getINT16(); lastCol = getINT16(); @@ -261,7 +261,7 @@ PCFFont::read(const char* name) encoding = new charInfo*[nencoding]; if (!encoding) { error("No space for character encoding vector"); - return (FALSE); + return (false); } for (int i = 0; i < nencoding; i++) { int encodingOffset = getINT16(); @@ -280,7 +280,7 @@ PCFFont::read(const char* name) } } else { error("Can not seek to encoding data"); - return (FALSE); + return (false); } if (seekToTable(PCF_BDF_ACCELERATORS)) { @@ -288,7 +288,7 @@ PCFFont::read(const char* name) if (!isFormat(PCF_DEFAULT_FORMAT) && !isFormat(PCF_ACCEL_W_INKBOUNDS)) { error("Bad BDF accelerator format 0x%lx", format); - return (FALSE); + return (false); } fseek(file, 8, SEEK_CUR); // skip a bunch of junk fontAscent = (short) getINT32(); @@ -296,11 +296,11 @@ PCFFont::read(const char* name) // more stuff... } else { error("Can not seek to BDF accelerator information"); - return (FALSE); + return (false); } fclose(file), file = NULL; filename = NULL; - return (ready = TRUE); + return (ready = true); } u_long @@ -377,38 +377,38 @@ PCFFont::getCompressedMetric(charInfo& metric) /* * Position to the begining of the specified table. */ -fxBool +bool PCFFont::seekToTable(u_long type) { for (int i = 0; i < tocSize; i++) if (toc[i].type == type) { if (fseek(file, toc[i].offset, SEEK_SET) == -1) { error("Can not seek; fseek failed"); - return (FALSE); + return (false); } format = toc[i].format; - return (TRUE); + return (true); } error("Can not seek; no such entry in the TOC"); - return (FALSE); + return (false); } /* * Read the table-of-contents for the font file. */ -fxBool +bool PCFFont::readTOC() { u_long version = getLSB32(); if (version != PCF_FILE_VERSION) { error("Cannot read TOC; bad version number %lu", version); - return (FALSE); + return (false); } tocSize = getLSB32(); toc = new PCFTableRec[tocSize]; if (!toc) { error("Cannot read TOC; no space for %lu records", tocSize); - return (FALSE); + return (false); } for (int i = 0; i < tocSize; i++) { toc[i].type = getLSB32(); @@ -416,7 +416,7 @@ PCFFont::readTOC() toc[i].size = getLSB32(); toc[i].offset = getLSB32(); } - return (TRUE); + return (true); } int diff --git a/faxd/PCFFont.h b/faxd/PCFFont.h index 905bcd40..22e4dcfa 100644 --- a/faxd/PCFFont.h +++ b/faxd/PCFFont.h @@ -52,11 +52,11 @@ private: u_long format; // format for current portion being read PCFTableRec* toc; // table of contents u_long tocSize; // number of entries in TOC - fxBool isBigEndian; // host byte order + bool isBigEndian; // host byte order void cleanup(); - fxBool readTOC(); - fxBool seekToTable(u_long type); + bool readTOC(); + bool seekToTable(u_long type); void getMetric(charInfo& metric); void getCompressedMetric(charInfo& metric); int repadBitmap(u_char* src, u_char* dst, @@ -66,7 +66,7 @@ private: int getINT16(); int getINT8(); - fxBool isFormat(u_long f) const; + bool isFormat(u_long f) const; u_int byteOrder() const; u_int bitOrder() const; u_int glyphPadIndex() const; @@ -78,7 +78,7 @@ public: PCFFont(); ~PCFFont(); - fxBool read(const char* filename); + bool read(const char* filename); u_int charWidth(u_int) const; void strWidth(const char* text, u_int& w, u_int& h) const; diff --git a/faxd/QLink.h b/faxd/QLink.h index c1675522..032e7926 100644 --- a/faxd/QLink.h +++ b/faxd/QLink.h @@ -39,8 +39,8 @@ struct QLink { void remove(void); void insert(QLink& after); - int isEmpty(void) const; // TRUE if list is empty (used on head) - int isOnList(void) const; // TRUE if item is on list + int isEmpty(void) const; // true if list is empty (used on head) + int isOnList(void) const; // true if item is on list }; inline int QLink::isEmpty(void) const { return next == this; } inline int QLink::isOnList(void) const { return next != this; } diff --git a/faxd/ServerConfig.c++ b/faxd/ServerConfig.c++ index ddbedb40..f746e38c 100644 --- a/faxd/ServerConfig.c++ +++ b/faxd/ServerConfig.c++ @@ -119,9 +119,9 @@ ServerConfig::setupConfig() speakerVolume = ClassModem::QUIET; // default speaker volume #ifdef sgi - clocalAsRoot = TRUE; // under IRIX must be root to set CLOCAL + clocalAsRoot = true; // under IRIX must be root to set CLOCAL #else - clocalAsRoot = FALSE; // everywhere else anyone can do it + clocalAsRoot = false; // everywhere else anyone can do it #endif requeueTTS[ClassModem::OK] = 0; requeueTTS[ClassModem::BUSY] = FAX_REQBUSY; @@ -276,7 +276,7 @@ ServerConfig::getUUCPLock(const fxStr& deviceName) uucpLockDir, deviceName, uucpLockMode); } -fxBool +bool ServerConfig::checkACL(const fxStr& id, RegExArray* pats, fxBoolArray& accept) { if (pats != NULL) { @@ -284,14 +284,14 @@ ServerConfig::checkACL(const fxStr& id, RegExArray* pats, fxBoolArray& accept) if ((*pats)[i]->Find(id)) return (accept[i]); } - return (FALSE); // NB: reject if no patterns! + return (false); // NB: reject if no patterns! } -fxBool +bool ServerConfig::isTSIOk(const fxStr& tsi) { updatePatterns(qualifyTSI, tsiPats, acceptTSI, lastTSIModTime); - return (qualifyTSI == "" ? TRUE : checkACL(tsi, tsiPats, *acceptTSI)); + return (qualifyTSI == "" ? true : checkACL(tsi, tsiPats, *acceptTSI)); } /* @@ -354,10 +354,10 @@ ServerConfig::readPatterns(FILE* fp, RegExArray*& pats, fxBoolArray*& accept) continue; RegEx* re; if (line[0] == '!') { - accept->append(FALSE); + accept->append(false); pats->append(re = new RegEx(line+1)); } else { - accept->append(TRUE); + accept->append(true); pats->append(re = new RegEx(line)); } if (re->getErrorCode() > REG_NOMATCH) { @@ -390,7 +390,7 @@ tiffWarningHandler(const char* module, const char* fmt0, va_list ap) vlogWarning(fmt, ap); } -fxBool +bool ServerConfig::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -440,6 +440,6 @@ ServerConfig::setConfigItem(const char* tag, const char* value) requeueTTS[ClassModem::DATACONN] = getNumber(value); else return ModemConfig::setConfigItem(tag, value); - return (TRUE); + return (true); } #undef N diff --git a/faxd/ServerConfig.h b/faxd/ServerConfig.h index 544d065c..d96ae7fc 100644 --- a/faxd/ServerConfig.h +++ b/faxd/ServerConfig.h @@ -79,14 +79,14 @@ protected: ServerConfig(); void setupConfig(); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); // pattern access control list support void updatePatterns(const fxStr& file, RegExArray*& pats, fxBoolArray*& accept, time_t& lastModTime); void readPatterns(FILE*, RegExArray*&, fxBoolArray*&); - fxBool checkACL(const fxStr& id, RegExArray*, fxBoolArray&); + bool checkACL(const fxStr& id, RegExArray*, fxBoolArray&); // methods for parameters whose assignment may have side effects virtual void setDialRules(const char* name); virtual void setLocalIdentifier(const fxStr& lid); @@ -101,7 +101,7 @@ public: u_int tracingLevel; // tracing level w/o session u_int logTracingLevel; // tracing level during session u_int tracingMask; // tracing level control mask - fxBool clocalAsRoot; // set CLOCAL as root + bool clocalAsRoot; // set CLOCAL as root u_int requeueTTS[9]; // requeue intervals[CallStatus code] u_int requeueProto; // requeue interval after protocol error u_int requeueOther; // requeue interval after other problem @@ -122,7 +122,7 @@ public: UUCPLock* getUUCPLock(const fxStr& deviceName); - fxBool isTSIOk(const fxStr& tsi); + bool isTSIOk(const fxStr& tsi); virtual void vconfigError(const char* fmt, va_list ap) = 0; virtual void vconfigTrace(const char* fmt, va_list ap) = 0; diff --git a/faxd/TagLine.c++ b/faxd/TagLine.c++ index bb5f2b0c..4ac22a20 100644 --- a/faxd/TagLine.c++ +++ b/faxd/TagLine.c++ @@ -98,16 +98,16 @@ FaxModem::setupTagLine(const FaxRequest& req, const fxStr& tagLineFmt) * being cropped at the bottom; probably together with a decoding * error of one row at the receiver. */ -fxBool +bool FaxModem::setupTagLineSlop(const Class2Params& params) { if (tagLineFont->isReady() && tagLineFields > 0) { tagLineSlop = (tagLineFont->fontHeight()+MARGIN_TOP+MARGIN_BOT+3) * howmany(params.pageWidth(),8); - return (TRUE); + return (true); } else { tagLineSlop = 0; - return (FALSE); + return (false); } } diff --git a/faxd/Trigger.c++ b/faxd/Trigger.c++ index a937e343..eabfe7aa 100644 --- a/faxd/Trigger.c++ +++ b/faxd/Trigger.c++ @@ -219,7 +219,7 @@ Trigger::tidNextFree() * notified when job 1932 is requeued or completes one would * use ``J<1932>4c60''. */ -fxBool +bool Trigger::parse(const char* spec0) { const char* spec = spec0; @@ -239,7 +239,7 @@ Trigger::parse(const char* spec0) for (tp = ++cp; *tp != '>'; tp++) if (*tp == '\0') { // XXX syntax error syntaxError(spec0, "missing '>'"); - return (FALSE); + return (false); } id = fxStr(cp, tp-cp); cp = tp+1; @@ -248,7 +248,7 @@ Trigger::parse(const char* spec0) u_short& m = interests[base>>4]; if (m != 0) { syntaxError(spec0, "interests conflict"); - return (FALSE); + return (false); } if (c == '*') { m = 0xffff; @@ -263,7 +263,7 @@ Trigger::parse(const char* spec0) m = v; } else { syntaxError(spec0, "non-hex event mask"); - return (FALSE); + return (false); } TriggerRef* tr = new TriggerRef(*this); /* @@ -285,13 +285,13 @@ Trigger::parse(const char* spec0) Job* job = Job::getJobByID(id); if (!job) { logError("TRIGGER: job %s does not exist", (const char*) id); - return (FALSE); + return (false); } tr->insert(job->triggers); } spec = cp; } - return (TRUE); + return (true); } void Trigger::syntaxError(const char* spec, const char* msg) @@ -302,7 +302,7 @@ Trigger::syntaxError(const char* spec, const char* msg) /* * Cancel (delete) the trigger with the specified id. */ -fxBool +bool Trigger::cancel(const char* cp) { trid_t tid = (trid_t) strtoul(cp, NULL, 10); @@ -311,10 +311,10 @@ Trigger::cancel(const char* cp) if (t) { if (t->cancel()) delete t; - return (TRUE); + return (true); } } - return (FALSE); + return (false); } /* @@ -326,12 +326,12 @@ Trigger::cancel(const char* cp) * posted to the client) and wait for the object holding * the reference to go away. */ -fxBool +bool Trigger::cancel() { purgeWildRefs(); // wildcard references if (refs == 0) - return (TRUE); + return (true); if (interests[MODEM_BASE>>4] != 0) { /* * Must explicitly search and purge references @@ -341,12 +341,12 @@ Trigger::cancel() for (ModemIter iter(Modem::list); iter.notDone(); iter++) { TriggerRef::purge(iter.modem().triggers, this); if (refs == 0) - return (TRUE); + return (true); } } // clear interests so no more messages are sent memset(interests, 0, sizeof (interests)); - return (FALSE); + return (false); } /* diff --git a/faxd/Trigger.h b/faxd/Trigger.h index b58891aa..3c3132d1 100644 --- a/faxd/Trigger.h +++ b/faxd/Trigger.h @@ -140,11 +140,11 @@ private: Trigger(trid_t, const fxStr& fifoName); - fxBool parse(const char*); // parse trigger spec + bool parse(const char*); // parse trigger spec static void syntaxError(const char* spec, const char* msg); void purgeWildRefs(); // purge all wildcard references - fxBool cancel(); + bool cancel(); static void post(TriggerEvent, const QLink&, const QLink&, fxStackBuffer&); void send(const char* fmt ...); @@ -154,7 +154,7 @@ public: static void purgeClient(HylaClient*);// purge all triggers for client static void create(const fxStr& id, const char* spec); - static fxBool cancel(const char* tid); + static bool cancel(const char* tid); static void post(TriggerEvent, const Job&, const char* = NULL); static void post(TriggerEvent, const Modem&, const char* = NULL); diff --git a/faxd/UUCPLock.c++ b/faxd/UUCPLock.c++ index 2ae5821e..f586a864 100644 --- a/faxd/UUCPLock.c++ +++ b/faxd/UUCPLock.c++ @@ -52,8 +52,8 @@ private: fxStr data; // data to write record in lock file void setPID(pid_t); - fxBool writeData(int fd); - fxBool readData(int fd, pid_t& pid); + bool writeData(int fd); + bool readData(int fd, pid_t& pid); public: AsciiUUCPLock(const fxStr&, mode_t); ~AsciiUUCPLock(); @@ -67,8 +67,8 @@ private: pid_t data; // data to write record in lock file void setPID(pid_t); - fxBool writeData(int fd); - fxBool readData(int fd, pid_t& pid); + bool writeData(int fd); + bool readData(int fd, pid_t& pid); public: BinaryUUCPLock(const fxStr&, mode_t); ~BinaryUUCPLock(); @@ -125,7 +125,7 @@ UUCPLock::newLock(const char* type, UUCPLock::UUCPLock(const fxStr& pathname, mode_t m) : file(pathname) { mode = m; - locked = FALSE; + locked = false; setupIDs(); } @@ -159,7 +159,7 @@ void UUCPLock::setLockTimeout(time_t t) { lockTimeout = t; } /* * Create a lock file. */ -fxBool +bool UUCPLock::create() { /* @@ -192,11 +192,11 @@ UUCPLock::create() * Check if the lock file is * newer than the specified age. */ -fxBool +bool UUCPLock::isNewer(time_t age) { struct stat sb; - return (Sys::stat(file, sb) != 0 ? FALSE : Sys::now() - sb.st_mtime < age); + return (Sys::stat(file, sb) != 0 ? false : Sys::now() - sb.st_mtime < age); } /* @@ -205,14 +205,14 @@ UUCPLock::isNewer(time_t age) * If it is older, an attempt is made to unlink it and * create a new one. */ -fxBool +bool UUCPLock::lock() { if (locked) - return (FALSE); + return (false); uid_t ouid = geteuid(); seteuid(0); // need to be root - fxBool ok = create(); + bool ok = create(); if (!ok) ok = check() && create(); seteuid(ouid); @@ -230,7 +230,7 @@ UUCPLock::unlock() seteuid(0); // need to be root Sys::unlink(file); seteuid(ouid); - locked = FALSE; + locked = false; } } @@ -238,10 +238,10 @@ UUCPLock::unlock() * Set a particular owner process * pid for an already locked device. */ -fxBool +bool UUCPLock::setOwner(pid_t pid) { - fxBool ok = FALSE; + bool ok = false; if (locked) { uid_t ouid = geteuid(); seteuid(0); // need to be root @@ -260,7 +260,7 @@ UUCPLock::setOwner(pid_t pid) /* * Check if the owning process exists. */ -fxBool +bool UUCPLock::ownerExists(int fd) { pid_t pid; @@ -273,7 +273,7 @@ UUCPLock::ownerExists(int fd) * UUCPLock::lockTimeout seconds if the process owner * is no longer around. */ -fxBool +bool UUCPLock::check() { int fd = Sys::open(file, O_RDONLY); @@ -281,17 +281,17 @@ UUCPLock::check() if (lockTimeout > 0) { if (isNewer(lockTimeout) || ownerExists(fd)) { Sys::close(fd); - return (FALSE); + return (false); } Sys::close(fd); logInfo("Purge stale UUCP lock %s", (const char*) file); return (Sys::unlink(file) == 0); } else { Sys::close(fd); - return (FALSE); + return (false); } } - return (TRUE); + return (true); } /* @@ -310,22 +310,22 @@ AsciiUUCPLock::setPID(pid_t pid) sprintf((char*) data, "%*d\n", UUCP_PIDDIGITS, pid); } -fxBool +bool AsciiUUCPLock::writeData(int fd) { return (Sys::write(fd, data, UUCP_PIDDIGITS+1) == (UUCP_PIDDIGITS+1)); } -fxBool +bool AsciiUUCPLock::readData(int fd, pid_t& pid) { char buf[UUCP_PIDDIGITS+1]; if (Sys::read(fd, buf, UUCP_PIDDIGITS) == UUCP_PIDDIGITS) { buf[UUCP_PIDDIGITS] = '\0'; pid = atol(buf); // NB: assumes pid_t is <= 32-bits - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* @@ -342,19 +342,19 @@ BinaryUUCPLock::setPID(pid_t pid) data = pid; // binary pid of lock holder } -fxBool +bool BinaryUUCPLock::writeData(int fd) { return (Sys::write(fd, (char*) &data, sizeof (data)) == sizeof (data)); } -fxBool +bool BinaryUUCPLock::readData(int fd, pid_t& pid) { pid_t data; if (Sys::read(fd, (char*) &data, sizeof (data)) == sizeof (data)) { pid = data; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } diff --git a/faxd/UUCPLock.h b/faxd/UUCPLock.h index 0c552d41..8e233d66 100644 --- a/faxd/UUCPLock.h +++ b/faxd/UUCPLock.h @@ -35,7 +35,7 @@ class UUCPLock { private: fxStr file; // lock file pathname mode_t mode; // lock file mode - fxBool locked; // is lock currently held + bool locked; // is lock currently held static uid_t UUCPuid; static gid_t UUCPgid; @@ -43,15 +43,15 @@ private: static time_t lockTimeout; - fxBool create(); // create lock file - fxBool isNewer(time_t age); // is lock file newer than age - fxBool ownerExists(int fd); // does owning process exist + bool create(); // create lock file + bool isNewer(time_t age); // is lock file newer than age + bool ownerExists(int fd); // does owning process exist protected: UUCPLock(const fxStr& pathname, mode_t mode); virtual void setPID(pid_t) = 0; - virtual fxBool writeData(int fd) = 0; - virtual fxBool readData(int fd, pid_t& pid) = 0; + virtual bool writeData(int fd) = 0; + virtual bool readData(int fd, pid_t& pid) = 0; public: virtual ~UUCPLock(); @@ -65,12 +65,12 @@ public: const fxStr& device, // device pathname mode_t mode); // file creation mode - fxBool isLocked() const; // device is locked - fxBool lock(); // lock device + bool isLocked() const; // device is locked + bool lock(); // lock device void unlock(); // unlock device - fxBool check(); // check if lock exists - fxBool setOwner(pid_t); // force process owner identity + bool check(); // check if lock exists + bool setOwner(pid_t); // force process owner identity }; -inline fxBool UUCPLock::isLocked() const { return locked; } +inline bool UUCPLock::isLocked() const { return locked; } #endif /* _UUCPLOCK_ */ diff --git a/faxd/choptest.c++ b/faxd/choptest.c++ index 097c5fe0..13aabfaa 100644 --- a/faxd/choptest.c++ +++ b/faxd/choptest.c++ @@ -69,7 +69,7 @@ MemoryDecoder::decodeNextByte() return (*bp++); } -static fxBool +static bool isBlank(uint16* runs, u_int rowpixels) { u_int x = 0; @@ -77,11 +77,11 @@ isBlank(uint16* runs, u_int rowpixels) if ((x += *runs++) >= rowpixels) break; if (runs[0] != 0) - return (FALSE); + return (false); if ((x += *runs++) >= rowpixels) break; } - return (TRUE); + return (true); } void @@ -153,14 +153,14 @@ main(int argc, char* argv[]) extern char* optarg; float minChop = 3.0; // chop if >= 3" white space at bottom u_int minRows; - fxBool doAll = FALSE; + bool doAll = false; int c; appName = argv[0]; while ((c = getopt(argc, argv, "t:a")) != -1) switch (c) { case 'a': - doAll = TRUE; + doAll = true; break; case 't': minChop = atof(optarg); diff --git a/faxd/cqtest.c++ b/faxd/cqtest.c++ index d5df16cc..9ae7eb4f 100644 --- a/faxd/cqtest.c++ +++ b/faxd/cqtest.c++ @@ -41,7 +41,7 @@ struct CQDecoder : public G3Decoder { u_int cblc; // current count of consecutive bad lines - fxBool lastRowBad; // last decoded row was bad + bool lastRowBad; // last decoded row was bad u_long recvEOLCount; // EOL count for received page u_long recvBadLineCount; @@ -69,13 +69,13 @@ struct CQDecoder : public G3Decoder { void serverTrace(const char* fmt ...); void copyQualityTrace(const char* fmt, ...); - fxBool recvPageDLEData(TIFF* tif, fxBool checkQuality, + bool recvPageDLEData(TIFF* tif, bool checkQuality, const Class2Params& params, fxStr& emsg); void abortPageRecv(); int nextByte(); - fxBool checkQuality(); - fxBool isQualityOK(const Class2Params&); + bool checkQuality(); + bool isQualityOK(const Class2Params&); CQDecoder(); ~CQDecoder(); @@ -138,8 +138,8 @@ CQDecoder::recvSetupTIFF(TIFF* tif, long, int fillOrder, const Class2Params& par * Receive Phase C data with or without copy * quality checking and erroneous row fixup. */ -fxBool -CQDecoder::recvPageDLEData(TIFF* tif, fxBool checkQuality, +bool +CQDecoder::recvPageDLEData(TIFF* tif, bool checkQuality, const Class2Params& params, fxStr& emsg) { setupDecoder(recvFillOrder, params.is2D()); @@ -167,7 +167,7 @@ CQDecoder::recvPageDLEData(TIFF* tif, fxBool checkQuality, abortPageRecv(); emsg = "Missing EOL after 5 seconds"; recvTrace("%s", (const char*) emsg); - return (FALSE); + return (false); } if (checkQuality) { /* @@ -204,7 +204,7 @@ CQDecoder::recvPageDLEData(TIFF* tif, fxBool checkQuality, memset(curGood, 0, rowSize); // initialize to all white recvBuf = NULL; // don't need raw data - lastRowBad = FALSE; // no previous row + lastRowBad = false; // no previous row cblc = 0; // current bad line run if (!RTCraised()) { for (;;) { @@ -216,13 +216,13 @@ CQDecoder::recvPageDLEData(TIFF* tif, fxBool checkQuality, * later for deciding whether or not the page quality * is acceptable. */ - fxBool decodeOK = decodeRow(recvRow, rowpixels); + bool decodeOK = decodeRow(recvRow, rowpixels); if (seenRTC()) // seen RTC, flush everything continue; if (decodeOK) { curGood = recvRow; // reset last good if (lastRowBad) { // reset run statistics - lastRowBad = FALSE; + lastRowBad = false; if (cblc > recvConsecutiveBadLineCount) recvConsecutiveBadLineCount = cblc; cblc = 0; @@ -231,7 +231,7 @@ CQDecoder::recvPageDLEData(TIFF* tif, fxBool checkQuality, memcpy(recvRow, curGood, rowSize);// replicate last good recvBadLineCount++; cblc++; - lastRowBad = TRUE; + lastRowBad = true; } /* * Advance forward a scanline and if necessary @@ -350,7 +350,7 @@ CQDecoder::recvPageDLEData(TIFF* tif, fxBool checkQuality, recvEOLCount = getRTCRow(); } } - return (TRUE); + return (true); } void @@ -376,7 +376,7 @@ CQDecoder::flushRawData(TIFF* tif, tstrip_t strip, u_char* buf, u_int cc) * Check if the configuration parameters indicate if * copy quality checking should be done on recvd pages. */ -fxBool +bool CQDecoder::checkQuality() { return (percentGoodLines != 0 && maxConsecutiveBadLines != 0); @@ -387,7 +387,7 @@ CQDecoder::checkQuality() * against the configuration parameters and return an * indication of whether or not the page quality is acceptable. */ -fxBool +bool CQDecoder::isQualityOK(const Class2Params& params) { if (percentGoodLines != 0 && recvEOLCount != 0) { @@ -395,7 +395,7 @@ CQDecoder::isQualityOK(const Class2Params& params) if (percent < percentGoodLines) { serverTrace("RECV: REJECT page quality, %u%% good lines (%u%% required)", percent, percentGoodLines); - return (FALSE); + return (false); } } u_int cblc = maxConsecutiveBadLines; @@ -405,10 +405,10 @@ CQDecoder::isQualityOK(const Class2Params& params) if (recvConsecutiveBadLineCount > cblc) { serverTrace("RECV: REJECT page quality, %u-line run (max %u)", recvConsecutiveBadLineCount, cblc); - return (FALSE); + return (false); } } - return (TRUE); + return (true); } int diff --git a/faxd/faxApp.c++ b/faxd/faxApp.c++ index fa851c61..bfc5d921 100644 --- a/faxd/faxApp.c++ +++ b/faxd/faxApp.c++ @@ -63,7 +63,7 @@ const char* GetoptIter::nextArg() faxApp::faxApp() { - running = FALSE; + running = false; faxqfifo = -1; setLogFacility(LOG_FAX); // default #ifdef LC_CTYPE @@ -81,11 +81,11 @@ faxApp::initialize(int, char**) { openFIFOs(); } -void faxApp::open(void) { running = TRUE; } +void faxApp::open(void) { running = true; } void faxApp::close(void) { - running = FALSE; + running = false; if (faxqfifo != -1) Sys::close(faxqfifo); } @@ -126,7 +126,7 @@ faxApp::closeFIFOs(void) * Open the specified FIFO file. */ int -faxApp::openFIFO(const char* fifoName, int mode, fxBool okToExist) +faxApp::openFIFO(const char* fifoName, int mode, bool okToExist) { if (Sys::mkfifo(fifoName, mode & 0777) < 0) { if (errno != EEXIST || !okToExist) @@ -202,7 +202,7 @@ faxApp::FIFOMessage(const char* cp) /* * Send a message to the central queuer process. */ -fxBool +bool faxApp::vsendQueuer(const char* fmt, va_list ap) { if (faxqfifo == -1) { @@ -223,7 +223,7 @@ faxApp::vsendQueuer(const char* fmt, va_list ap) faxqfifo = Sys::open(fifoName, O_WRONLY|O_NDELAY); #endif if (faxqfifo == -1) - return (FALSE); + return (false); /* * Turn off O_NDELAY so that write will block if FIFO is full. */ @@ -238,20 +238,20 @@ faxApp::vsendQueuer(const char* fmt, va_list ap) Sys::close(faxqfifo), faxqfifo = -1; else logError("FIFO write failed: %m"); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* * Send a message to the central queuer process. */ -fxBool +bool faxApp::sendQueuer(const char* fmt ...) { va_list ap; va_start(ap, fmt); - fxBool ok = vsendQueuer(fmt, ap); + bool ok = vsendQueuer(fmt, ap); va_end(ap); return (ok); } @@ -259,14 +259,14 @@ faxApp::sendQueuer(const char* fmt ...) /* * Send a modem status message to the central queuer process. */ -fxBool +bool faxApp::sendModemStatus(const char* devid, const char* fmt0 ...) { char fmt[2*1024]; sprintf(fmt, "+%s:%s", devid, fmt0); va_list ap; va_start(ap, fmt0); - fxBool ok = vsendQueuer(fmt, ap); + bool ok = vsendQueuer(fmt, ap); va_end(ap); return (ok); } @@ -274,14 +274,14 @@ faxApp::sendModemStatus(const char* devid, const char* fmt0 ...) /* * Send a job status message to the central queuer process. */ -fxBool +bool faxApp::sendJobStatus(const char* jobid, const char* fmt0 ...) { char fmt[2*1024]; sprintf(fmt, "*%s:%s", jobid, fmt0); va_list ap; va_start(ap, fmt0); - fxBool ok = vsendQueuer(fmt, ap); + bool ok = vsendQueuer(fmt, ap); va_end(ap); return (ok); } @@ -289,14 +289,14 @@ faxApp::sendJobStatus(const char* jobid, const char* fmt0 ...) /* * Send a receive status message to the central queuer process. */ -fxBool +bool faxApp::sendRecvStatus(const char* devid, const char* fmt0 ...) { char fmt[2*1024]; sprintf(fmt, "@%s:%s", devid, fmt0); va_list ap; va_start(ap, fmt0); - fxBool ok = vsendQueuer(fmt, ap); + bool ok = vsendQueuer(fmt, ap); va_end(ap); return (ok); } @@ -376,8 +376,8 @@ const fxStr faxApp::enquote = "\""; * is so that programs like sendmail show an informative * from address. */ -fxBool -faxApp::runCmd(const char* cmd, fxBool changeIDs) +bool +faxApp::runCmd(const char* cmd, bool changeIDs) { pid_t pid = fork(); switch (pid) { @@ -390,16 +390,16 @@ faxApp::runCmd(const char* cmd, fxBool changeIDs) _exit(127); case -1: logError("Can not fork for \"%s\"", cmd); - return (FALSE); + return (false); default: { int status = 0; Sys::waitpid(pid, status); if (status != 0) { logError("Bad exit status %#o for \"%s\"", status, cmd); - return (FALSE); + return (false); } } - return (TRUE); + return (true); } } diff --git a/faxd/faxApp.h b/faxd/faxApp.h index d952f206..9a83b43d 100644 --- a/faxd/faxApp.h +++ b/faxd/faxApp.h @@ -36,11 +36,11 @@ class faxApp : public Syslog { private: static fxStr getopts; // main arguments - fxBool running; // server running + bool running; // server running int faxqfifo; // cached descriptor to faxq protected: int openFIFO(const char* fifoName, int mode, - fxBool okToExist = FALSE); + bool okToExist = false); public: faxApp(); virtual ~faxApp(); @@ -56,18 +56,18 @@ public: virtual void open(void); virtual void close(void); - fxBool isRunning(void) const; + bool isRunning(void) const; virtual void openFIFOs(void); virtual void closeFIFOs(void); virtual int FIFOInput(int); virtual void FIFOMessage(const char* mesage); - fxBool sendModemStatus(const char* devid, const char* fmt ...); - fxBool sendJobStatus(const char* jobid, const char* fmt ...); - fxBool sendRecvStatus(const char* devid, const char* fmt ...); - fxBool sendQueuer(const char* fmt ...); - fxBool vsendQueuer(const char* fmt, va_list ap); + bool sendModemStatus(const char* devid, const char* fmt ...); + bool sendJobStatus(const char* jobid, const char* fmt ...); + bool sendRecvStatus(const char* devid, const char* fmt ...); + bool sendQueuer(const char* fmt ...); + bool vsendQueuer(const char* fmt, va_list ap); static void setOpts(const char*); static const fxStr& getOpts(void); @@ -78,9 +78,9 @@ public: static const fxStr quote; static const fxStr enquote; - fxBool runCmd(const char* cmd, fxBool changeIDs = FALSE); + bool runCmd(const char* cmd, bool changeIDs = false); }; -inline fxBool faxApp::isRunning(void) const { return running; } +inline bool faxApp::isRunning(void) const { return running; } class GetoptIter { private: @@ -95,13 +95,13 @@ public: void operator++(); void operator++(int); int option() const; - fxBool notDone() const; + bool notDone() const; const char* optArg() const; const char* getArg(); const char* nextArg(); }; inline int GetoptIter::option() const { return c; } -inline fxBool GetoptIter::notDone() const { return c != -1; } +inline bool GetoptIter::notDone() const { return c != -1; } extern const char* fmtTime(time_t); #endif diff --git a/faxd/faxGettyApp.c++ b/faxd/faxGettyApp.c++ index 2dede5ee..8d0622ef 100644 --- a/faxd/faxGettyApp.c++ +++ b/faxd/faxGettyApp.c++ @@ -124,11 +124,11 @@ faxGettyApp::close() } } -fxBool faxGettyApp::lockModem() { return modemLock->lock(); } +bool faxGettyApp::lockModem() { return modemLock->lock(); } void faxGettyApp::unlockModem() { modemLock->unlock(); } -fxBool faxGettyApp::isModemLocked() { return modemLock->isLocked(); } +bool faxGettyApp::isModemLocked() { return modemLock->isLocked(); } -fxBool +bool faxGettyApp::setupModem() { /* @@ -150,16 +150,16 @@ faxGettyApp::setupModem() * If the server is configured, listen for incoming calls. */ setRingsBeforeAnswer(ringsBeforeAnswer); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* * Discard any handle on the modem. */ void -faxGettyApp::discardModem(fxBool dropDTR) +faxGettyApp::discardModem(bool dropDTR) { int fd = getModemFd(); if (fd >= 0) { @@ -193,7 +193,7 @@ faxGettyApp::listenBegin() * state where we wait for the modem to come available again. */ traceServer("ANSWER: Can not lock modem device"); - discardModem(FALSE); + discardModem(false); changeState(LOCKWAIT, pollLockWait); sendModemStatus("U"); } @@ -261,7 +261,7 @@ faxGettyApp::answerPhoneCmd(AnswerType atype) * Discard our handle on the modem and change to LOCKWAIT * state where we wait for the modem to come available again. */ - discardModem(FALSE); + discardModem(false); changeState(LOCKWAIT, pollLockWait); sendModemStatus("U"); } @@ -284,16 +284,16 @@ faxGettyApp::answerPhone(AnswerType atype, CallType ctype, const CallerID& cid) * adaptive-answer is enabled and ``any'' is requested, * then rotate through the set of possibilities. */ - fxBool callResolved; - fxBool advanceRotary = TRUE; + bool callResolved; + bool advanceRotary = true; fxStr emsg; if (!isCIDOk(cid.number)) { // check Caller ID if present /* * Call was rejected based on Caller ID information. */ traceServer("ANSWER: CID REJECTED"); - callResolved = FALSE; - advanceRotary = FALSE; + callResolved = false; + advanceRotary = false; } else if (ctype != ClassModem::CALLTYPE_UNKNOWN) { /* * Distinctive ring or other means has already identified @@ -307,8 +307,8 @@ faxGettyApp::answerPhone(AnswerType atype, CallType ctype, const CallerID& cid) "but told to answer as %s; call ignored", ClassModem::callTypes[ctype], ClassModem::answerTypes[atype]); - callResolved = FALSE; - advanceRotary = FALSE; + callResolved = false; + advanceRotary = false; } else { // NB: answer based on ctype, not atype ctype = modemAnswerCall(ctype, emsg); @@ -373,14 +373,14 @@ faxGettyApp::answerCleanup() { if (modemReady()) { modemHangup(); - discardModem(TRUE); + discardModem(true); } - fxBool isSetup; + bool isSetup; if (isModemLocked() || lockModem()) { isSetup = setupModem(); unlockModem(); } else - isSetup = FALSE; + isSetup = false; if (isSetup) changeState(RUNNING); else @@ -395,10 +395,10 @@ faxGettyApp::answerCleanup() * comes up with. Otherwise we use whatever deduction * the modem layer arrives at as the call type. */ -fxBool +bool faxGettyApp::answerCall(AnswerType atype, CallType& ctype, fxStr& emsg) { - fxBool callResolved; + bool callResolved; if (atype == ClassModem::ANSTYPE_EXTERN) { if (egettyArgs != "") { /* @@ -409,9 +409,9 @@ faxGettyApp::answerCall(AnswerType atype, CallType& ctype, fxStr& emsg) * then we take action based on the returned call type. */ ctype = runGetty("EXTERN GETTY", OSnewEGetty, - egettyArgs, emsg, lockExternCalls, TRUE); + egettyArgs, emsg, lockExternCalls, true); if (ctype == ClassModem::CALLTYPE_DONE) // NB: call completed - return (TRUE); + return (true); if (ctype != ClassModem::CALLTYPE_ERROR) modemAnswerCallCmd(ctype); } else @@ -435,10 +435,10 @@ faxGettyApp::answerCall(AnswerType atype, CallType& ctype, fxStr& emsg) * it removes the modem lock file and reconditions the modem for * incoming calls (if configured). */ -fxBool +bool faxGettyApp::processCall(CallType ctype, fxStr& emsg) { - fxBool callHandled = FALSE; + bool callHandled = false; switch (ctype) { case ClassModem::CALLTYPE_FAX: @@ -456,7 +456,7 @@ faxGettyApp::processCall(CallType ctype, fxStr& emsg) sendModemStatus("e"); } else traceServer("ANSWER: Data connections are not permitted"); - callHandled = TRUE; + callHandled = true; break; case ClassModem::CALLTYPE_VOICE: traceServer("ANSWER: VOICE CONNECTION"); @@ -466,7 +466,7 @@ faxGettyApp::processCall(CallType ctype, fxStr& emsg) sendModemStatus("w"); } else traceServer("ANSWER: Voice connections are not permitted"); - callHandled = TRUE; + callHandled = true; break; case ClassModem::CALLTYPE_ERROR: traceServer("ANSWER: %s", (const char*) emsg); @@ -486,8 +486,8 @@ faxGettyApp::runGetty( Getty* (*newgetty)(const fxStr&, const fxStr&), const char* args, fxStr& emsg, - fxBool keepLock, - fxBool keepModem + bool keepLock, + bool keepModem ) { fxStr prefix(_PATH_DEV); @@ -513,7 +513,7 @@ faxGettyApp::runGetty( */ if (!keepLock) unlockModem(); - fxBool parentIsInit = (getppid() == 1); + bool parentIsInit = (getppid() == 1); pid_t pid = fork(); if (pid == -1) { emsg = fxStr::format("%s: can not fork: %s", what, strerror(errno)); @@ -552,10 +552,10 @@ faxGettyApp::runGetty( * SIGHUP on last close. */ if (!keepModem) - discardModem(FALSE); + discardModem(false); changeState(GETTYWAIT); int status; - getty->wait(status, TRUE); // wait for getty/login work to complete + getty->wait(status, true); // wait for getty/login work to complete /* * Retake ownership of the modem. Note that there's * a race in here (another process could come along @@ -604,11 +604,11 @@ faxGettyApp::setRingsBeforeAnswer(int rings) } } -fxBool +bool faxGettyApp::isCIDOk(const fxStr& cid) { updatePatterns(qualifyCID, cidPats, acceptCID, lastCIDModTime); - return (qualifyCID == "" ? TRUE : checkACL(cid, cidPats, *acceptCID)); + return (qualifyCID == "" ? true : checkACL(cid, cidPats, *acceptCID)); } /* @@ -706,14 +706,14 @@ faxGettyApp::notifyRecvDone(const FaxRecvInfo& ri) ); traceServer("RECV FAX: %s", (const char*) cmd); setProcessPriority(BASE); // lower priority - runCmd(cmd, TRUE); + runCmd(cmd, true); setProcessPriority(state); // restore priority } /* * Send a modem status message to the central queuer process. */ -fxBool +bool faxGettyApp::sendModemStatus(const char* msg) { return faxApp::sendModemStatus(getModemDeviceID(), msg); @@ -729,7 +729,7 @@ faxGettyApp::sendModemStatus(const char* msg) void faxGettyApp::openFIFOs() { - devfifo = openFIFO(fifoName | "." | getModemDeviceID(), 0600, TRUE); + devfifo = openFIFO(fifoName | "." | getModemDeviceID(), 0600, true); Dispatcher::instance().link(devfifo, Dispatcher::ReadMask, this); } @@ -832,10 +832,10 @@ const faxGettyApp::numbertag faxGettyApp::numbers[] = { { "answerbias", &faxGettyApp::answerBias, (u_int) -1 }, }; const faxGettyApp::booltag faxGettyApp::booleans[] = { -{ "adaptiveanswer", &faxGettyApp::adaptiveAnswer, FALSE }, -{ "lockdatacalls", &faxGettyApp::lockDataCalls, TRUE }, -{ "lockvoicecalls", &faxGettyApp::lockVoiceCalls, TRUE }, -{ "lockexterncalls", &faxGettyApp::lockExternCalls, TRUE }, +{ "adaptiveanswer", &faxGettyApp::adaptiveAnswer, false }, +{ "lockdatacalls", &faxGettyApp::lockDataCalls, true }, +{ "lockvoicecalls", &faxGettyApp::lockVoiceCalls, true }, +{ "lockexterncalls", &faxGettyApp::lockExternCalls, true }, }; void @@ -855,7 +855,7 @@ faxGettyApp::setupConfig() setAnswerRotary("any"); // answer calls as ``any'' } -fxBool +bool faxGettyApp::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -887,7 +887,7 @@ faxGettyApp::setConfigItem(const char* tag, const char* value) } } else return (FaxServer::setConfigItem(tag, value)); - return (TRUE); + return (true); } #undef N diff --git a/faxd/faxGettyApp.h b/faxd/faxGettyApp.h index 5855ad67..41fa7ed3 100644 --- a/faxd/faxGettyApp.h +++ b/faxd/faxGettyApp.h @@ -55,7 +55,7 @@ public: }; struct booltag { const char* name; - fxBool faxGettyApp::*p; + bool faxGettyApp::*p; u_int def; }; private: @@ -74,10 +74,10 @@ private: fxStr gettyArgs; // getty arguments fxStr vgettyArgs; // voice getty arguments fxStr egettyArgs; // extern getty arguments - fxBool adaptiveAnswer; // answer as data if fax answer fails - fxBool lockDataCalls; // hold uucp lock for getty - fxBool lockVoiceCalls; // hold uucp lock for vgetty - fxBool lockExternCalls; // hold uucp lock for egetty + bool adaptiveAnswer; // answer as data if fax answer fails + bool lockDataCalls; // hold uucp lock for getty + bool lockVoiceCalls; // hold uucp lock for vgetty + bool lockExternCalls; // hold uucp lock for egetty u_int answerBias; // rotor bias applied after good calls u_short answerRotor; // rotor into possible selections u_short answerRotorSize; // rotor table size @@ -96,32 +96,32 @@ private: // configuration support void setupConfig(); void resetConfig(); - fxBool setConfigItem(const char* tag, const char* value); + bool setConfigItem(const char* tag, const char* value); void setAnswerRotary(const fxStr& value); // modem handling - fxBool isModemLocked(); - fxBool lockModem(); + bool isModemLocked(); + bool lockModem(); void unlockModem(); - fxBool setupModem(); - void discardModem(fxBool dropDTR); + bool setupModem(); + void discardModem(bool dropDTR); // inbound call handling - fxBool isCIDOk(const fxStr& cid); - fxBool processCall(CallType ctype, fxStr& emsg); + bool isCIDOk(const fxStr& cid); + bool processCall(CallType ctype, fxStr& emsg); CallType runGetty(const char* what, Getty* (*newgetty)(const fxStr&, const fxStr&), const char* args, fxStr &emsg, - fxBool keepLock, fxBool keepModem = FALSE); + bool keepLock, bool keepModem = false); void setRingsBeforeAnswer(int rings); void listenBegin(); void listenForRing(); void answerPhoneCmd(AnswerType); void answerPhone(AnswerType, CallType, const CallerID&); void answerCleanup(); - fxBool answerCall(AnswerType atype, CallType& ctype, fxStr& emsg); + bool answerCall(AnswerType atype, CallType& ctype, fxStr& emsg); friend void AnswerTimeoutHandler::timerExpired(long, long); // miscellaneous stuff - fxBool sendModemStatus(const char* msg); + bool sendModemStatus(const char* msg); // FIFO-related stuff void openFIFOs(); void closeFIFOs(); diff --git a/faxd/faxQCleanApp.c++ b/faxd/faxQCleanApp.c++ index 218a4057..63f3f776 100644 --- a/faxd/faxQCleanApp.c++ +++ b/faxd/faxQCleanApp.c++ @@ -43,10 +43,10 @@ fxIMPLEMENT_StrKeyPtrValueDictionary(RefDict, u_int) class faxQCleanApp : public faxApp { private: - fxBool archiving; // enable archival support - fxBool verbose; // trace interesting actions - fxBool trace; // trace all actions - fxBool nowork; // do not carry out actions + bool archiving; // enable archival support + bool verbose; // trace interesting actions + bool trace; // trace all actions + bool nowork; // do not carry out actions time_t minJobAge; // threshold for processing done jobs time_t minDocAge; // threshold for purging unref'd docs @@ -69,10 +69,10 @@ public: void setJobAge(const char*); void setDocAge(const char*); - void setArchiving(fxBool); - void setVerbose(fxBool); - void setTracing(fxBool); - void setNoWork(fxBool); + void setArchiving(bool); + void setVerbose(bool); + void setTracing(bool); + void setNoWork(bool); }; const fxStr faxQCleanApp::archDir = FAX_ARCHDIR; @@ -83,10 +83,10 @@ faxQCleanApp::faxQCleanApp() { minJobAge = 15*60; // jobs kept max 15 minutes in doneq minDocAge = 60*60; // 1 hour threshold on keeping unref'd documents - archiving = FALSE; // default is to disable job archiving - verbose = FALSE; // log actions to stdout - nowork = FALSE; // default is to carry out work - trace = FALSE; // trace work + archiving = false; // default is to disable job archiving + verbose = false; // log actions to stdout + nowork = false; // default is to carry out work + trace = false; // trace work qFilePrefix = FAX_SENDDIR "/q"; } @@ -97,16 +97,16 @@ void faxQCleanApp::setJobAge(const char* s) { minJobAge = (time_t) strtoul(s, NULL, 0); } void faxQCleanApp::setDocAge(const char* s) { minDocAge = (time_t) strtoul(s, NULL, 0); } -void faxQCleanApp::setArchiving(fxBool b) { archiving = b; } -void faxQCleanApp::setVerbose(fxBool b) { verbose = b; } -void faxQCleanApp::setTracing(fxBool b) { trace = b; } -void faxQCleanApp::setNoWork(fxBool b) { nowork = b; } +void faxQCleanApp::setArchiving(bool b) { archiving = b; } +void faxQCleanApp::setVerbose(bool b) { verbose = b; } +void faxQCleanApp::setTracing(bool b) { trace = b; } +void faxQCleanApp::setNoWork(bool b) { nowork = b; } void faxQCleanApp::run(void) { if (trace) - verbose = TRUE; + verbose = true; scanDirectory(); expungeCruft(); } @@ -144,7 +144,7 @@ faxQCleanApp::scanDirectory(void) if (fd >= 0) { if (flock(fd, LOCK_SH|LOCK_NB) >= 0) { FaxRequest* req = new FaxRequest(filename, fd); - fxBool reject; + bool reject; if (req->readQFile(reject) && !reject) { if (now - sb.st_mtime < minJobAge) { /* @@ -392,13 +392,13 @@ main(int argc, char** argv) fxStr queueDir(FAX_SPOOLDIR); for (GetoptIter iter(argc, argv, faxApp::getOpts()); iter.notDone(); iter++) switch (iter.option()) { - case 'a': app.setArchiving(TRUE); break; + case 'a': app.setArchiving(true); break; case 'j': app.setJobAge(optarg); break; case 'd': app.setDocAge(optarg); break; - case 'n': app.setNoWork(TRUE); break; + case 'n': app.setNoWork(true); break; case 'q': queueDir = iter.optArg(); break; - case 't': app.setTracing(TRUE); break; - case 'v': app.setVerbose(TRUE); break; + case 't': app.setTracing(true); break; + case 'v': app.setVerbose(true); break; case '?': usage(appName); } if (Sys::chdir(queueDir) < 0) { diff --git a/faxd/faxQueueApp.c++ b/faxd/faxQueueApp.c++ index 5346ddc6..0167400d 100644 --- a/faxd/faxQueueApp.c++ +++ b/faxd/faxQueueApp.c++ @@ -62,13 +62,13 @@ fxStr strTime(time_t t) { return fxStr(fmtTime(t)); } #define JOBHASH(pri) (((pri) >> 4) & (NQHASH-1)) -faxQueueApp::SchedTimeout::SchedTimeout() { started = FALSE; } +faxQueueApp::SchedTimeout::SchedTimeout() { started = false; } faxQueueApp::SchedTimeout::~SchedTimeout() {} void faxQueueApp::SchedTimeout::timerExpired(long, long) { - started = FALSE; + started = false; faxQueueApp::instance().runScheduler(); } @@ -77,7 +77,7 @@ faxQueueApp::SchedTimeout::start() { if (!started) { Dispatcher::instance().startTimer(0,1, this); - started = TRUE; + started = true; } } @@ -87,7 +87,7 @@ faxQueueApp::faxQueueApp() : configFile(FAX_CONFIG) { fifo = -1; - quit = FALSE; + quit = false; dialRules = NULL; setupConfig(); @@ -176,7 +176,7 @@ faxQueueApp::scanQueueDirectory() } for (dirent* dp = readdir(dir); dp; dp = readdir(dir)) { if (dp->d_name[0] == 'q') - submitJob(&dp->d_name[1], TRUE); + submitJob(&dp->d_name[1], true); } closedir(dir); } @@ -229,7 +229,7 @@ faxQueueApp::processJob(Job& job, FaxRequest* req, if (!prepareJobNeeded(job, *req, status)) { if (status != Job::done) { job.state = FaxRequest::state_done; - deleteRequest(job, req, status, TRUE); + deleteRequest(job, req, status, true); setDead(job); } else sendJobStart(job, req, dci); @@ -244,7 +244,7 @@ faxQueueApp::processJob(Job& job, FaxRequest* req, * cover page must be crafted (i.e. the work may take * a while). */ -fxBool +bool faxQueueApp::prepareJobNeeded(Job& job, FaxRequest& req, JobStatus& status) { for (u_int i = 0, n = req.requests.length(); i < n; i++) @@ -252,13 +252,13 @@ faxQueueApp::prepareJobNeeded(Job& job, FaxRequest& req, JobStatus& status) case FaxRequest::send_postscript: // convert PostScript case FaxRequest::send_pcl: // convert PCL case FaxRequest::send_tiff: // verify&possibly convert TIFF - return (TRUE); + return (true); case FaxRequest::send_poll: // verify modem is capable if (!job.modem->supportsPolling()) { req.notice = "Modem does not support polling"; status = Job::rejected; jobError(job, "SEND REJECT: " | req.notice); - return (FALSE); + return (false); } break; } @@ -277,7 +277,7 @@ faxQueueApp::prepareCleanup(int s) { signal(s, fxSIGHANDLER(faxQueueApp::prepareCleanup)); logError("CAUGHT SIGNAL %d, ABORT JOB PREPARATION", s); - faxQueueApp::instance().abortPrepare = TRUE; + faxQueueApp::instance().abortPrepare = true; } /* @@ -294,7 +294,7 @@ faxQueueApp::prepareJobStart(Job& job, FaxRequest* req, FaxMachineInfo& info, const DestControlInfo& dci) { traceQueue(job, "PREPARE START"); - abortPrepare = FALSE; + abortPrepare = false; pid_t pid = fork(); switch (pid) { case 0: // child, do work @@ -344,7 +344,7 @@ faxQueueApp::prepareJobDone(Job& job, int status) } else status >>= 8; if (job.suspendPending) { // co-thread waiting - job.suspendPending = FALSE; + job.suspendPending = false; releaseModem(job); return; } @@ -365,7 +365,7 @@ faxQueueApp::prepareJobDone(Job& job, int status) sendJobStart(job, req, destCtrls[job.dest]); break; default: // problem preparing job - deleteRequest(job, req, status, TRUE); + deleteRequest(job, req, status, true); setDead(job); break; } @@ -532,7 +532,7 @@ faxQueueApp::prepareJob(Job& job, FaxRequest& req, * using the parameter selected above. */ JobStatus status = Job::done; - fxBool updateQFile = FALSE; + bool updateQFile = false; fxStr tmp; // NB: here to avoid compiler complaint u_int i = 0; while (i < req.requests.length() && status == Job::done && !abortPrepare) { @@ -555,7 +555,7 @@ faxQueueApp::prepareJob(Job& job, FaxRequest& req, req.insertFax(i+1, tmp); } else Sys::unlink(tmp); // bail out - updateQFile = TRUE; + updateQFile = true; break; } i++; @@ -568,7 +568,7 @@ faxQueueApp::prepareJob(Job& job, FaxRequest& req, * fatal; perhaps this should be configurable? */ makeCoverPage(job, req, params, dci); - updateQFile = TRUE; + updateQFile = true; } if (req.pagehandling == "" && !abortPrepare) { /* @@ -579,7 +579,7 @@ faxQueueApp::prepareJob(Job& job, FaxRequest& req, status = Job::rejected; // XXX req.notice.insert("Document preparation failed: "); } - updateQFile = TRUE; + updateQFile = true; } } if (updateQFile) @@ -596,7 +596,7 @@ faxQueueApp::prepareJob(Job& job, FaxRequest& req, * be slow and there can be timing problems if this * is done during transmission. */ -fxBool +bool faxQueueApp::preparePageHandling(FaxRequest& req, const FaxMachineInfo& info, const DestControlInfo& dci, fxStr& emsg) { @@ -705,11 +705,11 @@ faxQueueApp::preparePageHandling(FaxRequest& req, } done: req.pagehandling.append('P'); // EOP - return (TRUE); + return (true); bad: if (tif) TIFFClose(tif); - return (FALSE); + return (false); } /* @@ -806,7 +806,7 @@ MemoryDecoder::decodeNextByte() return (*bp++); } -static fxBool +static bool isBlank(uint16* runs, u_int rowpixels) { u_int x = 0; @@ -814,11 +814,11 @@ isBlank(uint16* runs, u_int rowpixels) if ((x += *runs++) >= rowpixels) break; if (runs[0] != 0) - return (FALSE); + return (false); if ((x += *runs++) >= rowpixels) break; } - return (TRUE); + return (true); } void @@ -1117,7 +1117,7 @@ cleanse(char buf[], int n) * is an error -- this is sent back to the user that * submitted the job. */ -fxBool +bool faxQueueApp::runConverter1(Job& job, int fd, fxStr& output) { int n; @@ -1132,9 +1132,9 @@ faxQueueApp::runConverter1(Job& job, int fd, fxStr& output) if (timer.wasTimeout()) { jobError(job, "CONVERT DOCUMENT: job time limit exceeded"); output.append("\n[Job time limit exceeded]\n"); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* @@ -1159,7 +1159,7 @@ faxQueueApp::makeCoverPage(Job& job, FaxRequest& req, const Class2Params& params | " " | freq.item ); traceQueue(job, "COVER PAGE: " | cmd); - if (runCmd(cmd, TRUE)) { + if (runCmd(cmd, true)) { fxStr emsg; fxStr tmp = freq.item | ";" | params.encodePage(); if (convertDocument(job, freq, tmp, params, dci, emsg)) { @@ -1362,7 +1362,7 @@ faxQueueApp::sendJobDone(Job& job, int status) */ fxAssert(!job.suspendPending, "Interrupted job timed out"); job.state = FaxRequest::state_done; - deleteRequest(job, req, Job::timedout, TRUE); + deleteRequest(job, req, Job::timedout, true); setDead(job); } else if (req->status == send_retry) { /* @@ -1433,7 +1433,7 @@ faxQueueApp::sendJobDone(Job& job, int status) setReadyToRun(job); // NB: job.tts will be <= now } } else // signal waiting co-thread - job.suspendPending = FALSE; + job.suspendPending = false; delete req; // implicit unlock of q file } else { job.state = FaxRequest::state_done; @@ -1441,9 +1441,9 @@ faxQueueApp::sendJobDone(Job& job, int status) Trigger::post(Trigger::SEND_DONE, job); // NB: always notify client if job failed if (req->status == send_failed) - deleteRequest(job, req, Job::failed, TRUE, fmtTime(duration)); + deleteRequest(job, req, Job::failed, true, fmtTime(duration)); else - deleteRequest(job, req, Job::done, FALSE, fmtTime(duration)); + deleteRequest(job, req, Job::done, false, fmtTime(duration)); setDead(job); } } @@ -1496,7 +1496,7 @@ void faxQueueApp::setDead(Job& job) { job.state = FaxRequest::state_done; - job.suspendPending = FALSE; + job.suspendPending = false; traceJob(job, "DEAD"); Trigger::post(Trigger::JOB_DEAD, job); DestInfo& di = destJobs[job.dest]; @@ -1558,8 +1558,8 @@ faxQueueApp::setSuspend(Job& job) * appropriate queue. A kill timer is also setup * for the job. */ -fxBool -faxQueueApp::submitJob(FaxRequest& req, fxBool checkState) +bool +faxQueueApp::submitJob(FaxRequest& req, bool checkState) { Job* job = new Job(req); traceJob(*job, "CREATE"); @@ -1567,8 +1567,8 @@ faxQueueApp::submitJob(FaxRequest& req, fxBool checkState) return (submitJob(*job, req, checkState)); } -fxBool -faxQueueApp::submitJob(Job& job, FaxRequest& req, fxBool checkState) +bool +faxQueueApp::submitJob(Job& job, FaxRequest& req, bool checkState) { /* * Check various submission parameters. We setup the @@ -1583,27 +1583,27 @@ faxQueueApp::submitJob(Job& job, FaxRequest& req, fxBool checkState) req.external = req.number; rejectSubmission(job, req, "REJECT: Unable to convert dial string to canonical format"); - return (FALSE); + return (false); } time_t now = Sys::now(); if (req.killtime <= now) { timeoutJob(job, req); - return (FALSE); + return (false); } if (!Modem::modemExists(req.modem) && !ModemGroup::find(req.modem)) { rejectSubmission(job, req, "REJECT: Requested modem " | req.modem | " is not registered"); - return (FALSE); + return (false); } if (req.requests.length() == 0) { rejectSubmission(job, req, "REJECT: No work found in job file"); - return (FALSE); + return (false); } if (req.pagewidth > 303) { rejectSubmission(job, req, fxStr::format("REJECT: Page width (%u) appears invalid", req.pagewidth)); - return (FALSE); + return (false); } /* * Verify the killtime is ``reasonable''; otherwise @@ -1614,7 +1614,7 @@ faxQueueApp::submitJob(Job& job, FaxRequest& req, fxBool checkState) rejectSubmission(job, req, fxStr::format("REJECT: Job expiration time (%u) appears invalid", req.killtime)); - return (FALSE); + return (false); } if (checkState) { /* @@ -1632,10 +1632,10 @@ faxQueueApp::submitJob(Job& job, FaxRequest& req, fxBool checkState) switch (req.state) { case FaxRequest::state_suspended: setSuspend(job); - return (TRUE); + return (true); case FaxRequest::state_done: setDead(job); - return (TRUE); + return (true); } } /* @@ -1650,7 +1650,7 @@ faxQueueApp::submitJob(Job& job, FaxRequest& req, fxBool checkState) rejectSubmission(job, req, fxStr::format("REJECT: Time-to-send (%u) appears invalid", req.tts)); - return (FALSE); + return (false); } job.startKillTimer(req.killtime); job.state = FaxRequest::state_pending; @@ -1660,7 +1660,7 @@ faxQueueApp::submitJob(Job& job, FaxRequest& req, fxBool checkState) setReadyToRun(job); } updateRequest(req, job); - return (TRUE); + return (true); } /* @@ -1673,7 +1673,7 @@ faxQueueApp::rejectSubmission(Job& job, FaxRequest& req, const fxStr& reason) req.status = send_failed; req.notice = reason; traceServer("JOB " | job.jobid | ": " | reason); - deleteRequest(job, req, Job::rejected, TRUE); + deleteRequest(job, req, Job::rejected, true); setDead(job); // dispose of job } @@ -1685,11 +1685,11 @@ faxQueueApp::rejectSubmission(Job& job, FaxRequest& req, const fxStr& reason) * and we wait for the process to stop before * returning to the caller. */ -fxBool -faxQueueApp::suspendJob(Job& job, fxBool abortActive) +bool +faxQueueApp::suspendJob(Job& job, bool abortActive) { if (job.suspendPending) // already being suspended - return (FALSE); + return (false); switch (job.state) { case FaxRequest::state_active: /* @@ -1700,7 +1700,7 @@ faxQueueApp::suspendJob(Job& job, fxBool abortActive) * to terminate the process completion work will not * mistakenly terminate the job (see sendJobDone). */ - job.suspendPending = TRUE; // mark thread waiting + job.suspendPending = true; // mark thread waiting if (abortActive) (void) kill(job.pid, SIGTERM); // signal subprocess job.stopKillTimer(); @@ -1714,7 +1714,7 @@ faxQueueApp::suspendJob(Job& job, fxBool abortActive) break; /* fall thru... */ case FaxRequest::state_done: - return (FALSE); + return (false); case FaxRequest::state_sleeping: case FaxRequest::state_pending: job.stopTTSTimer(); // cancel timeout @@ -1732,7 +1732,7 @@ faxQueueApp::suspendJob(Job& job, fxBool abortActive) } job.remove(); // remove from old queue job.stopKillTimer(); // clear kill timer - return (TRUE); + return (true); } /* @@ -1742,8 +1742,8 @@ faxQueueApp::suspendJob(Job& job, fxBool abortActive) * This control is used by clients that want to modify * the state of a job (i.e. suspend, modify, submit). */ -fxBool -faxQueueApp::suspendJob(const fxStr& jobid, fxBool abortActive) +bool +faxQueueApp::suspendJob(const fxStr& jobid, bool abortActive) { Job* job = Job::getJobByID(jobid); if (job && suspendJob(*job, abortActive)) { @@ -1753,9 +1753,9 @@ faxQueueApp::suspendJob(const fxStr& jobid, fxBool abortActive) updateRequest(*req, *job); delete req; } - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* @@ -1767,20 +1767,20 @@ faxQueueApp::suspendJob(const fxStr& jobid, fxBool abortActive) * the appropriate queue and any associated resources * are purged. */ -fxBool +bool faxQueueApp::terminateJob(const fxStr& jobid, JobStatus why) { Job* job = Job::getJobByID(jobid); - if (job && suspendJob(*job, TRUE)) { + if (job && suspendJob(*job, true)) { job->state = FaxRequest::state_done; Trigger::post(Trigger::JOB_KILL, *job); FaxRequest* req = readRequest(*job); if (req) deleteRequest(*job, req, why, why != Job::removed); setDead(*job); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* @@ -1853,7 +1853,7 @@ faxQueueApp::timeoutJob(Job& job) job.state = FaxRequest::state_done; FaxRequest* req = readRequest(job); if (req) - deleteRequest(job, req, Job::timedout, TRUE); + deleteRequest(job, req, Job::timedout, true); setDead(job); } else job.killtime = 0; // mark job to be removed @@ -1875,7 +1875,7 @@ faxQueueApp::timeoutJob(Job& job, FaxRequest& req) job.state = FaxRequest::state_done; traceQueue(job, "KILL TIME EXPIRED"); Trigger::post(Trigger::JOB_TIMEDOUT, job); - deleteRequest(job, req, Job::timedout, TRUE); + deleteRequest(job, req, Job::timedout, true); setDead(job); } @@ -1883,12 +1883,12 @@ faxQueueApp::timeoutJob(Job& job, FaxRequest& req) * Resubmit an existing job or create a new job * using the specified job description file. */ -fxBool -faxQueueApp::submitJob(const fxStr& jobid, fxBool checkState) +bool +faxQueueApp::submitJob(const fxStr& jobid, bool checkState) { Job* job = Job::getJobByID(jobid); if (job) { - fxBool ok = FALSE; + bool ok = false; if (job->state == FaxRequest::state_suspended) { job->remove(); // remove from suspend queue FaxRequest* req = readRequest(*job);// XXX need better mechanism @@ -1901,7 +1901,7 @@ faxQueueApp::submitJob(const fxStr& jobid, fxBool checkState) } else if (job->state == FaxRequest::state_done) jobError(*job, "Cannot resubmit a completed job"); else - ok = TRUE; // other, nothing to do + ok = true; // other, nothing to do return (ok); } /* @@ -1912,9 +1912,9 @@ faxQueueApp::submitJob(const fxStr& jobid, fxBool checkState) if (!Sys::isRegularFile(filename)) { logError("JOB %s: qfile %s is not a regular file.", (const char*) jobid, (const char*) filename); - return (FALSE); + return (false); } - fxBool status = FALSE; + bool status = false; int fd = Sys::open(filename, O_RDWR); if (fd >= 0) { if (flock(fd, LOCK_SH) >= 0) { @@ -1932,7 +1932,7 @@ faxQueueApp::submitJob(const fxStr& jobid, fxBool checkState) * 4. Insufficient information was obtained to purge * the job; just skip it. */ - fxBool reject; + bool reject; if (req.readQFile(reject) && !reject && req.state != FaxRequest::state_done) { status = submitJob(req, checkState); @@ -1943,7 +1943,7 @@ faxQueueApp::submitJob(const fxStr& jobid, fxBool checkState) req.notice = "Invalid or corrupted job description file"; traceServer("JOB " | jobid | ": " | req.notice); // NB: this may not work, but we try... - deleteRequest(job, req, Job::rejected, TRUE); + deleteRequest(job, req, Job::rejected, true); } else if (req.state == FaxRequest::state_done) { logError("JOB %s: Cannot resubmit a completed job", (const char*) jobid); @@ -2047,7 +2047,7 @@ faxQueueApp::runScheduler() rejectJob(job, *req, fxStr::format( "REJECT: Too many attempts to dial: %u, max %u", req->totdials, maxdials)); - deleteRequest(job, req, Job::rejected, TRUE); + deleteRequest(job, req, Job::rejected, true); continue; } u_short maxtries = fxmin((u_short) dci.getMaxTries(),req->maxtries); @@ -2055,7 +2055,7 @@ faxQueueApp::runScheduler() rejectJob(job, *req, fxStr::format( "REJECT: Too many attempts to transmit: %u, max %u", req->tottries, maxtries)); - deleteRequest(job, req, Job::rejected, TRUE); + deleteRequest(job, req, Job::rejected, true); continue; } // NB: repeat this check so changes in max pages are applied @@ -2064,7 +2064,7 @@ faxQueueApp::runScheduler() rejectJob(job, *req, fxStr::format( "REJECT: Too many pages in submission: %u, max %u", req->totpages, maxpages)); - deleteRequest(job, req, Job::rejected, TRUE); + deleteRequest(job, req, Job::rejected, true); continue; } if (dci.getRejectNotice() != "") { @@ -2073,7 +2073,7 @@ faxQueueApp::runScheduler() * a specified reason that we return to the sender. */ rejectJob(job, *req, "REJECT: " | dci.getRejectNotice()); - deleteRequest(job, req, Job::rejected, TRUE); + deleteRequest(job, req, Job::rejected, true); continue; } time_t now = Sys::now(); @@ -2141,19 +2141,19 @@ faxQueueApp::runScheduler() * do not get information about when modems are in * use from faxgetty processes. */ -fxBool +bool faxQueueApp::assignModem(Job& job) { fxAssert(job.modem == NULL, "Assigning modem to job that already has one"); - fxBool retryModemLookup; + bool retryModemLookup; do { - retryModemLookup = FALSE; + retryModemLookup = false; Modem* modem = Modem::findModem(job); if (modem) { if (modem->assign(job)) { Trigger::post(Trigger::MODEM_ASSIGN, *modem); - return (TRUE); + return (true); } /* * Modem could not be assigned to job. The @@ -2168,11 +2168,11 @@ faxQueueApp::assignModem(Job& job) (const char*) modem->getDeviceID()); modem->startLockPolling(pollLockWait); traceModem(*modem, "BUSY (begin polling)"); - retryModemLookup = TRUE; + retryModemLookup = true; } else traceJob(job, "No assignable modem located"); } while (retryModemLookup); - return (FALSE); + return (false); } /* @@ -2232,7 +2232,7 @@ faxQueueApp::readRequest(Job& job) if (fd >= 0) { if (flock(fd, LOCK_EX) >= 0) { FaxRequest* req = new FaxRequest(job.file, fd); - fxBool reject; + bool reject; if (req->readQFile(reject) && !reject) { if (req->external == "") req->external = job.dest; @@ -2269,7 +2269,7 @@ faxQueueApp::updateRequest(FaxRequest& req, Job& job) */ void faxQueueApp::deleteRequest(Job& job, FaxRequest* req, JobStatus why, - fxBool force, const char* duration) + bool force, const char* duration) { deleteRequest(job, *req, why, force, duration); delete req; @@ -2277,7 +2277,7 @@ faxQueueApp::deleteRequest(Job& job, FaxRequest* req, JobStatus why, void faxQueueApp::deleteRequest(Job& job, FaxRequest& req, JobStatus why, - fxBool force, const char* duration) + bool force, const char* duration) { fxStr dest = FAX_DONEDIR | req.qfile.tail(req.qfile.length() - (sizeof (FAX_SENDDIR)-1)); @@ -2356,7 +2356,7 @@ faxQueueApp::deleteRequest(Job& job, FaxRequest& req, JobStatus why, void faxQueueApp::openFIFOs() { - fifo = openFIFO(fifoName, 0600, TRUE); + fifo = openFIFO(fifoName, 0600, true); Dispatcher::instance().link(fifo, Dispatcher::ReadMask, this); } @@ -2390,7 +2390,7 @@ faxQueueApp::FIFOMessage(const char* cp) void faxQueueApp::FIFOMessage(char cmd, const fxStr& id, const char* args) { - fxBool status = FALSE; + bool status = false; switch (cmd) { case '+': // modem status msg FIFOModemMessage(id, args); @@ -2403,7 +2403,7 @@ faxQueueApp::FIFOMessage(char cmd, const fxStr& id, const char* args) return; case 'Q': // quit traceServer("QUIT"); - quit = TRUE; + quit = true; pokeScheduler(); return; // NB: no return value expected case 'T': // create new trigger @@ -2439,20 +2439,20 @@ faxQueueApp::FIFOMessage(char cmd, const fxStr& id, const char* args) case 'U': // unreference file traceServer("UNREF DOC %s", args); unrefDoc(args); - status = TRUE; + status = true; break; case 'X': // suspend job traceServer("SUSPEND JOB %s", args); - if (status = suspendJob(args, FALSE)) + if (status = suspendJob(args, false)) pokeScheduler(); break; case 'Y': // interrupt job traceServer("INTERRUPT JOB %s", args); - if (status = suspendJob(args, TRUE)) + if (status = suspendJob(args, true)) pokeScheduler(); break; case 'N': // noop - status = TRUE; + status = true; break; default: logError("Bad FIFO cmd '%c' from client %s", cmd, (const char*) id); @@ -2479,7 +2479,7 @@ faxQueueApp::notifyModemWedged(Modem& modem) | quote | dev | enquote ); traceServer("MODEM WEDGED: %s", (const char*) cmd); - runCmd(cmd, TRUE); + runCmd(cmd, true); } void @@ -2672,7 +2672,7 @@ faxQueueApp::setupConfig() for (i = N(numbers)-1; i >= 0; i--) (*this).*numbers[i].p = numbers[i].def; tod.reset(); // any day, any time - use2D = TRUE; // ok to use 2D data + use2D = true; // ok to use 2D data uucpLockMode = UUCP_LOCKMODE; delete dialRules, dialRules = NULL; ModemGroup::reset(); // clear+add ``any modem'' class @@ -2743,7 +2743,7 @@ tiffWarningHandler(const char* module, const char* fmt0, va_list ap) vlogWarning(fmt, ap); } -fxBool +bool faxQueueApp::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -2812,8 +2812,8 @@ faxQueueApp::setConfigItem(const char* tag, const char* value) } else if (streq(tag, "pagechopthreshold")) pageChopThreshold = atof(value); else - return (FALSE); - return (TRUE); + return (false); + return (true); } /* @@ -2943,7 +2943,7 @@ faxQueueApp::notifySender(Job& job, JobStatus why, const char* duration) cmd.append(buf); } traceServer("NOTIFY: %s", (const char*) cmd); - runCmd(cmd, TRUE); + runCmd(cmd, true); } void @@ -3062,12 +3062,12 @@ main(int argc, char** argv) faxApp::setOpts("q:D"); - fxBool detach = TRUE; + bool detach = true; fxStr queueDir(FAX_SPOOLDIR); for (GetoptIter iter(argc, argv, faxApp::getOpts()); iter.notDone(); iter++) switch (iter.option()) { case 'q': queueDir = iter.optArg(); break; - case 'D': detach = FALSE; break; + case 'D': detach = false; break; case '?': usage(appName); } if (Sys::chdir(queueDir) < 0) diff --git a/faxd/faxQueueApp.h b/faxd/faxQueueApp.h index b69a08fd..01967f47 100644 --- a/faxd/faxQueueApp.h +++ b/faxd/faxQueueApp.h @@ -68,7 +68,7 @@ public: private: class SchedTimeout : public IOHandler { private: - fxBool started; + bool started; public: SchedTimeout(); ~SchedTimeout(); @@ -100,7 +100,7 @@ private: u_int tracingMask; // tracing level control mask fxStr logFacility; // syslog facility to direct trace msgs u_int requeueInterval; // job requeue interval - fxBool use2D; // ok to use 2D-encoded data + bool use2D; // ok to use 2D-encoded data u_int pageChop; // default page chop handling float pageChopThreshold; // minimum space before page chop fxStr notifyCmd; // external command for notification @@ -116,9 +116,9 @@ private: static const stringtag strings[]; static const numbertag numbers[]; // runtime state - fxBool timeout; // timeout occurred - fxBool abortPrepare; // job preparation should be aborted - fxBool quit; // terminate server + bool timeout; // timeout occurred + bool abortPrepare; // job preparation should be aborted + bool quit; // terminate server int fifo; // fifo job queue interface #define NQHASH 16 QLink runqs[NQHASH]; // jobs ready to run @@ -146,14 +146,14 @@ private: // configuration support void setupConfig(); void resetConfig(); - fxBool setConfigItem(const char* tag, const char* value); + bool setConfigItem(const char* tag, const char* value); void configError(const char* fmt, ...); void configTrace(const char* fmt, ...); void setDialRules(const char* name); fxStr canonicalizePhoneNumber(const fxStr& ds); // modem support void scanForModems(); - fxBool assignModem(Job& job); + bool assignModem(Job& job); void releaseModem(Job& job); void notifyModemWedged(Modem&); void pollForModemLock(Modem& modem); @@ -184,9 +184,9 @@ private: FaxRequest* readRequest(Job&); void updateRequest(FaxRequest& req, Job& job); void deleteRequest(Job&, FaxRequest* req, JobStatus why, - fxBool force, const char* duration = ""); + bool force, const char* duration = ""); void deleteRequest(Job&, FaxRequest& req, JobStatus why, - fxBool force, const char* duration = ""); + bool force, const char* duration = ""); void notifySender(Job&, JobStatus, const char* = ""); // job management interfaces void processJob(Job& job); @@ -197,8 +197,8 @@ private: void blockJob(Job&, FaxRequest&, const char*); void delayJob(Job&, FaxRequest&, const char*, time_t); void rejectJob(Job& job, FaxRequest& req, const fxStr& reason); - fxBool submitJob(const fxStr& jobid, fxBool checkState = FALSE); - fxBool suspendJob(const fxStr& jobid, fxBool abortActive); + bool submitJob(const fxStr& jobid, bool checkState = false); + bool suspendJob(const fxStr& jobid, bool abortActive); void rejectSubmission(Job&, FaxRequest&, const fxStr& reason); void setReadyToRun(Job& job); @@ -206,10 +206,10 @@ private: void setDead(Job& job); void setActive(Job& job); void setSuspend(Job& job); - fxBool submitJob(FaxRequest&, fxBool checkState = FALSE); - fxBool submitJob(Job& job, FaxRequest& req, fxBool checkState = FALSE); - fxBool suspendJob(Job& job, fxBool abortActive); - fxBool terminateJob(const fxStr& filename, JobStatus why); + bool submitJob(FaxRequest&, bool checkState = false); + bool submitJob(Job& job, FaxRequest& req, bool checkState = false); + bool suspendJob(Job& job, bool abortActive); + bool terminateJob(const fxStr& filename, JobStatus why); void timeoutJob(Job& job); void timeoutJob(Job& job, FaxRequest&); void runJob(Job& job); @@ -217,7 +217,7 @@ private: void runScheduler(); void pokeScheduler(); // job preparation stuff - fxBool prepareJobNeeded(Job&, FaxRequest&, JobStatus&); + bool prepareJobNeeded(Job&, FaxRequest&, JobStatus&); static void prepareCleanup(int s); void prepareJobStart(Job&, FaxRequest*, FaxMachineInfo&, const DestControlInfo&); @@ -230,10 +230,10 @@ private: const DestControlInfo& dci, fxStr& emsg); JobStatus runConverter(Job& job, const char* app, char* const* argv, fxStr& emsg); - fxBool runConverter1(Job& job, int fd, fxStr& output); + bool runConverter1(Job& job, int fd, fxStr& output); void makeCoverPage(Job&, FaxRequest&, const Class2Params&, const DestControlInfo&); - fxBool preparePageHandling(FaxRequest&, + bool preparePageHandling(FaxRequest&, const FaxMachineInfo&, const DestControlInfo&, fxStr& emsg); void preparePageChop(const FaxRequest&, TIFF*, const Class2Params&, fxStr&); diff --git a/faxd/faxRequest.c++ b/faxd/faxRequest.c++ index a4b047aa..ccf272a5 100644 --- a/faxd/faxRequest.c++ +++ b/faxd/faxRequest.c++ @@ -44,7 +44,7 @@ faxRequest::~faxRequest() {} int faxRequest::compare(faxRequest const*) const { return 0; } -fxBool +bool faxRequest::isSavedOp() const { return (op == FaxRequest::send_tiff_saved || diff --git a/faxd/faxRequest.h b/faxd/faxRequest.h index 06558263..6c5d6e84 100644 --- a/faxd/faxRequest.h +++ b/faxd/faxRequest.h @@ -52,7 +52,7 @@ struct faxRequest { int compare(faxRequest const *a) const; // XXX needed for array - fxBool isSavedOp() const; + bool isSavedOp() const; }; fxDECLARE_ObjArray(faxRequestArray, faxRequest) #endif /* _faxRequest_ */ diff --git a/faxd/faxSendApp.c++ b/faxd/faxSendApp.c++ index e81a0c05..bdbacfe2 100644 --- a/faxd/faxSendApp.c++ +++ b/faxd/faxSendApp.c++ @@ -53,7 +53,7 @@ faxSendApp* faxSendApp::_instance = NULL; faxSendApp::faxSendApp(const fxStr& devName, const fxStr& devID) : FaxServer(devName, devID) { - ready = FALSE; + ready = false; modemLock = NULL; setupConfig(); @@ -131,7 +131,7 @@ faxSendApp::send(const char* filename) req->desiredec = desiredEC; if (desiredST != (u_int) -1) req->desiredst = desiredST; - fxBool reject; + bool reject; if (req->readQFile(reject) && !reject) { FaxMachineInfo info; info.updateConfig(canonicalizePhoneNumber(req->number)); @@ -177,10 +177,10 @@ faxSendApp::send(const char* filename) * Modem locking support. */ -fxBool +bool faxSendApp::lockModem() { - return (modemLock ? modemLock->lock() : TRUE); + return (modemLock ? modemLock->lock() : true); } void @@ -201,7 +201,7 @@ faxSendApp::unlockModem() void faxSendApp::notifyModemReady() { - ready = TRUE; + ready = true; } /* @@ -298,7 +298,7 @@ faxSendApp::notifyPollRecvd(FaxRequest& req, const FaxRecvInfo& ri) ); traceServer("RECV POLL: %s", (const char*) cmd); setProcessPriority(BASE); // lower priority - runCmd(cmd, TRUE); + runCmd(cmd, true); setProcessPriority(state); // restore previous priority } @@ -348,7 +348,7 @@ faxSendApp::setupConfig() (*this).*numbers[i].p = numbers[i].def; } -fxBool +bool faxSendApp::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -358,7 +358,7 @@ faxSendApp::setConfigItem(const char* tag, const char* value) (*this).*numbers[ix].p = getNumber(value); } else return (FaxServer::setConfigItem(tag, value)); - return (TRUE); + return (true); } #undef N diff --git a/faxd/faxSendApp.h b/faxd/faxSendApp.h index d635ed07..846430f9 100644 --- a/faxd/faxSendApp.h +++ b/faxd/faxSendApp.h @@ -47,7 +47,7 @@ public: }; private: // runtime state - fxBool ready; // modem ready for use + bool ready; // modem ready for use UUCPLock* modemLock; // uucp lockfile handle fxStr pollRcvdCmd; // command for docs received by polling u_int desiredBR; // desired signalling rate @@ -62,9 +62,9 @@ private: // configuration support void setupConfig(); void resetConfig(); - fxBool setConfigItem(const char* tag, const char* value); + bool setConfigItem(const char* tag, const char* value); // modem handling - fxBool lockModem(); + bool lockModem(); void unlockModem(); // notification interfaces used by FaxServer void notifyModemReady(); @@ -87,7 +87,7 @@ public: FaxSendStatus send(const char* filename); - fxBool isReady() const; + bool isReady() const; }; -inline fxBool faxSendApp::isReady() const { return ready; } +inline bool faxSendApp::isReady() const { return ready; } #endif diff --git a/faxd/pageSendApp.c++ b/faxd/pageSendApp.c++ index 2b57944a..1c489ff5 100644 --- a/faxd/pageSendApp.c++ +++ b/faxd/pageSendApp.c++ @@ -52,7 +52,7 @@ pageSendApp* pageSendApp::_instance = NULL; pageSendApp::pageSendApp(const fxStr& devName, const fxStr& devID) : ModemServer(devName, devID) { - ready = FALSE; + ready = false; modemLock = NULL; setupConfig(); @@ -118,7 +118,7 @@ pageSendApp::send(const char* filename) if (fd >= 0) { if (flock(fd, LOCK_EX) >= 0) { FaxRequest* req = new FaxRequest(filename, fd); - fxBool reject; + bool reject; if (req->readQFile(reject) && !reject) { if (req->findRequest(FaxRequest::send_page) != fx_invalidArrayIndex) { FaxMachineInfo info; @@ -193,7 +193,7 @@ pageSendApp::sendPage(FaxRequest& req, FaxMachineInfo& info) changeState(MODEMWAIT); // ...sort of... } else sendFailed(req, send_retry, "Can not setup modem", 4*pollModemWait); - discardModem(TRUE); + discardModem(true); endSession(); unlockModem(); } else { @@ -201,17 +201,17 @@ pageSendApp::sendPage(FaxRequest& req, FaxMachineInfo& info) } } -fxBool +bool pageSendApp::prepareMsg(FaxRequest& req, FaxMachineInfo& info, fxStr& msg) { u_int i = req.findRequest(FaxRequest::send_data); if (i == fx_invalidArrayIndex) // page w/o text - return (TRUE); + return (true); int fd = Sys::open(req.requests[i].item, O_RDONLY); if (fd < 0) { sendFailed(req, send_failed, "Internal error: unable to open text message file"); - return (FALSE); + return (false); } struct stat sb; (void) Sys::fstat(fd, sb); @@ -219,7 +219,7 @@ pageSendApp::prepareMsg(FaxRequest& req, FaxMachineInfo& info, fxStr& msg) if (Sys::read(fd, &msg[0], (u_int) sb.st_size) != sb.st_size) { sendFailed(req, send_failed, "Internal error: unable to read text message file"); - return (FALSE); + return (false); } Sys::close(fd); @@ -231,7 +231,7 @@ pageSendApp::prepareMsg(FaxRequest& req, FaxMachineInfo& info, fxStr& msg) msg.length(), maxMsgLen); msg.resize(maxMsgLen); } - return (TRUE); + return (true); } void @@ -273,7 +273,7 @@ pageSendApp::sendPage(FaxRequest& req, FaxMachineInfo& info, const fxStr& number req.ndials = 0; // consec. failed dial attempts req.tottries++; // total answered calls req.totdials++; // total attempted calls - info.setCalledBefore(TRUE); + info.setCalledBefore(true); info.setDialFailures(0); req.status = send_ok; // be optimistic @@ -435,7 +435,7 @@ pageSendApp::getResponse(fxStackBuffer& buf, long secs) * as PageNet intersperse protocol messages and * verbose text messages. */ -static fxBool +static bool scanForCode(const u_char*& cp, u_int& len) { if (len > 0) { @@ -447,7 +447,7 @@ scanForCode(const u_char*& cp, u_int& len) return (len > 0); } -fxBool +bool pageSendApp::pagePrologue(FaxRequest& req, const FaxMachineInfo& info, fxStr& emsg) { fxStackBuffer buf; @@ -461,7 +461,7 @@ pageSendApp::pagePrologue(FaxRequest& req, const FaxMachineInfo& info, fxStr& em */ traceIXO("EXPECT ID (paging central identification)"); start = Sys::now(); - fxBool gotID = FALSE; + bool gotID = false; do { putModem("\r", 1); if (getResponse(buf, ixoIDProbe) >= 3) { @@ -480,7 +480,7 @@ pageSendApp::pagePrologue(FaxRequest& req, const FaxMachineInfo& info, fxStr& em if (!gotID) { emsg = "No initial ID response from paging central"; req.status = send_retry; - return (FALSE); + return (false); } flushModemInput(); // paging central may send multiple ID= /* @@ -526,7 +526,7 @@ pageSendApp::pagePrologue(FaxRequest& req, const FaxMachineInfo& info, fxStr& em if (--ntries == 0) { emsg = "Login failed multiple times"; req.status = send_retry; - return (FALSE); + return (false); } /* * Resend the login request. @@ -550,12 +550,12 @@ pageSendApp::pagePrologue(FaxRequest& req, const FaxMachineInfo& info, fxStr& em emsg = "Paging central responded with forced disconnect"; req.status = send_failed; - return (FALSE); + return (false); } // check for go-ahead message if (len > 2 && cp[1] == '[' && cp[2] == 'p') { traceIXO("RECV ACK (login successful & got go-ahead)"); - return (TRUE); + return (true); } } break; @@ -568,10 +568,10 @@ pageSendApp::pagePrologue(FaxRequest& req, const FaxMachineInfo& info, fxStr& em (unknown ? "timeout waiting for response" : "too many unknown responses")); req.status = send_retry; - return (FALSE); + return (false); } -fxBool +bool pageSendApp::pageGoAhead(FaxRequest& req, const FaxMachineInfo&, fxStr& emsg) { fxStackBuffer buf; @@ -583,7 +583,7 @@ pageSendApp::pageGoAhead(FaxRequest& req, const FaxMachineInfo&, fxStr& emsg) while (len > 0) { if (len > 2 && cp[0] == ESC && cp[1] == '[' && cp[2] == 'p') { traceIXO("RECV go-ahead (prologue done)"); - return (TRUE); + return (true); } (void) scanForCode(cp, len); } @@ -592,7 +592,7 @@ pageSendApp::pageGoAhead(FaxRequest& req, const FaxMachineInfo&, fxStr& emsg) emsg = fxStr::format("Protocol failure: %s waiting for go-ahead message", unknown ? "timeout" : "too many unknown responses"); req.status = send_retry; - return (FALSE); + return (false); } /* @@ -612,7 +612,7 @@ addChecksum(fxStackBuffer& buf) buf.put(check, 3); } -fxBool +bool pageSendApp::sendPagerMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, fxStr& emsg) { /* @@ -656,14 +656,14 @@ pageSendApp::sendPagerMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, f switch (cp[0]) { case ACK: traceIXO("RECV ACK (message block accepted)"); - return (TRUE); + return (true); case NAK: traceIXO("RECV NAK (message block rejected)"); if (--ntries == 0) { req.status = send_retry; emsg = "Message block not acknowledged by paging central " "after multiple tries"; - return (FALSE); + return (false); } /* * Retransmit the packet to paging central. @@ -693,14 +693,14 @@ pageSendApp::sendPagerMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, f req.status = send_failed; emsg = "Message block transmit failed; " "paging central rejected it"; - return (FALSE); + return (false); case ESC: if (len > 1 && cp[1] == EOT) { traceIXO("RECV EOT (forced disconnect)"); req.status = send_failed; emsg = "Protocol failure: paging central responded to " "message block transmit with forced disconnect"; - return (FALSE); + return (false); } /* fall thru... */ default: // unrecognized response @@ -715,10 +715,10 @@ pageSendApp::sendPagerMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, f (unknown ? "timeout waiting for response" : "too many unknown responses")); req.status = send_retry; - return (FALSE); + return (false); } -fxBool +bool pageSendApp::pageEpilogue(FaxRequest& req, const FaxMachineInfo&, fxStr& emsg) { putModem("\4\r", 2); // EOT then @@ -733,14 +733,14 @@ pageSendApp::pageEpilogue(FaxRequest& req, const FaxMachineInfo&, fxStr& emsg) case ESC: if (len > 1 && cp[1] == EOT) { traceIXO("RECV EOT (disconnect)"); - return (TRUE); + return (true); } break; case RS: traceIXO("RECV RS (message content rejected)"); emsg = "Paging central rejected content; check PIN"; req.status = send_failed; - return (FALSE); + return (false); } (void) scanForCode(cp, len); } @@ -750,7 +750,7 @@ pageSendApp::pageEpilogue(FaxRequest& req, const FaxMachineInfo&, fxStr& emsg) req.status = send_retry; emsg = "Protocol failure: timeout waiting for transaction ACK/NAK " "from paging central"; - return (FALSE); + return (false); } void @@ -1022,7 +1022,7 @@ addUcpCodedMsg(fxStackBuffer& buf, const fxStr& msg) } } -fxBool +bool pageSendApp::sendUcpMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, fxStr& emsg, FaxMachineInfo& info) { /* @@ -1112,14 +1112,14 @@ pageSendApp::sendUcpMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, fxS switch( N_ACK[0]) { case 'A': // positive result (ACK) traceIXO("RECV ACK (message block accepted)"); - return(TRUE); + return(true); case 'N': // Negative result (NACK) traceIXO("RECV NACK (message block rejected)"); if(--ntries==0) { req.status = send_retry; emsg="Message block not acknowledged by paging central" "after multiple tries"; - return(FALSE); + return(false); } traceIXO("SEND message block (retransmit)"); putModem((const char*) buf, buf.getLength()); @@ -1130,14 +1130,14 @@ pageSendApp::sendUcpMsg(FaxRequest& req, faxRequest& preq, const fxStr& msg, fxS } } } while (Sys::now()-start < ixoXmitTimeout && unknown < ixoMaxUnknown); - return FALSE; + return false; } /* * END UCP Support */ -fxBool +bool pageSendApp::putModem(const void* data, int n, long ms) { traceIXOCom("<--", (const u_char*) data, n); @@ -1192,7 +1192,7 @@ pageSendApp::setupConfig() (*this).*numbers[i].p = numbers[i].def; } -fxBool +bool pageSendApp::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -1204,7 +1204,7 @@ pageSendApp::setConfigItem(const char* tag, const char* value) (*this).*numbers[ix].p = getNumber(value); } else return (ModemServer::setConfigItem(tag, value)); - return (TRUE); + return (true); } #undef N @@ -1226,7 +1226,7 @@ pageSendApp::getConfigParity(const char* value) const /* * Modem and TTY setup */ -fxBool +bool pageSendApp::setupModem() { return (ModemServer::setupModem() && @@ -1237,10 +1237,10 @@ pageSendApp::setupModem() * Modem locking support. */ -fxBool +bool pageSendApp::lockModem() { - return (modemLock ? modemLock->lock() : TRUE); + return (modemLock ? modemLock->lock() : true); } void @@ -1261,7 +1261,7 @@ pageSendApp::unlockModem() void pageSendApp::notifyModemReady() { - ready = TRUE; + ready = true; } /* diff --git a/faxd/pageSendApp.h b/faxd/pageSendApp.h index ccae712d..2dad8660 100644 --- a/faxd/pageSendApp.h +++ b/faxd/pageSendApp.h @@ -49,7 +49,7 @@ public: }; private: // runtime state - fxBool ready; // modem ready for use + bool ready; // modem ready for use UUCPLock* modemLock; // uucp lockfile handle time_t connTime; // time connected to peer @@ -78,7 +78,7 @@ private: // configuration support void setupConfig(); void resetConfig(); - fxBool setConfigItem(const char* tag, const char* value); + bool setConfigItem(const char* tag, const char* value); u_int getConfigParity(const char* value) const; // page transmission support (independent of paging protocol) void sendPage(FaxRequest&, FaxMachineInfo&); @@ -86,27 +86,27 @@ private: const fxStr&); // IXO transmission support void sendIxoPage(FaxRequest&, FaxMachineInfo&, const fxStr&, fxStr&); - fxBool sendPagerMsg(FaxRequest&, faxRequest&, const fxStr&, fxStr&); + bool sendPagerMsg(FaxRequest&, faxRequest&, const fxStr&, fxStr&); u_int getResponse(fxStackBuffer& buf, long secs); - fxBool prepareMsg(FaxRequest&, FaxMachineInfo&, fxStr&); - fxBool pagePrologue(FaxRequest&, const FaxMachineInfo&, fxStr&); - fxBool pageGoAhead(FaxRequest&, const FaxMachineInfo&, fxStr&); - fxBool pageEpilogue(FaxRequest&, const FaxMachineInfo&, fxStr&); + bool prepareMsg(FaxRequest&, FaxMachineInfo&, fxStr&); + bool pagePrologue(FaxRequest&, const FaxMachineInfo&, fxStr&); + bool pageGoAhead(FaxRequest&, const FaxMachineInfo&, fxStr&); + bool pageEpilogue(FaxRequest&, const FaxMachineInfo&, fxStr&); void sendFailed(FaxRequest&, FaxSendStatus, const char*, u_int = 0); void notifyPageSent(FaxRequest& req, u_int fi); time_t getConnectTime() const; // UCP transmission support - void sendUcpPage(FaxRequest&, FaxMachineInfo&, const fxStr&, fxStr&); fxBool sendUcpMsg(FaxRequest&, faxRequest&, const fxStr&, fxStr&, + void sendUcpPage(FaxRequest&, FaxMachineInfo&, const fxStr&, fxStr&); bool sendUcpMsg(FaxRequest&, faxRequest&, const fxStr&, fxStr&, FaxMachineInfo&); // modem handling - fxBool lockModem(); + bool lockModem(); void unlockModem(); - fxBool setupModem(); + bool setupModem(); // notification interfaces used by ModemServer void notifyModemReady(); void notifyModemWedged(); // miscellaneous - fxBool putModem(const void* data, int n, long ms = 0); + bool putModem(const void* data, int n, long ms = 0); void traceResponse(const fxStackBuffer& buf); void traceIXO(const char* fmt ...); void traceIXOCom(const char* dir, const u_char* data, u_int cc); @@ -122,7 +122,7 @@ public: FaxSendStatus send(const char* filename); - fxBool isReady() const; + bool isReady() const; }; -inline fxBool pageSendApp::isReady() const { return ready; } +inline bool pageSendApp::isReady() const { return ready; } #endif diff --git a/faxd/tagtest.c++ b/faxd/tagtest.c++ index 61a8c7fe..731efd6c 100644 --- a/faxd/tagtest.c++ +++ b/faxd/tagtest.c++ @@ -113,15 +113,15 @@ setupTagLine() #define MARGIN_LEFT 2 #define MARGIN_RIGHT 2 -fxBool +bool setupTagLineSlop(const Class2Params& params) { if (tagLineFont->isReady()) { tagLineSlop = (tagLineFont->fontHeight()+MARGIN_TOP+MARGIN_BOT+3) * howmany(params.pageWidth(),8); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } class MemoryDecoder : public G3Decoder { @@ -464,7 +464,7 @@ main(int argc, char* argv[]) uint32* stripbytecount; (void) TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbytecount); - fxBool firstStrip = setupTagLineSlop(params); + bool firstStrip = setupTagLineSlop(params); u_int ts = tagLineSlop; for (u_int strip = 0; strip < TIFFNumberOfStrips(tif); strip++) { u_int totbytes = (u_int) stripbytecount[strip]; @@ -478,7 +478,7 @@ main(int argc, char* argv[]) */ dp = imageTagLine(data+ts, fillorder, params); totbytes = totbytes+ts - (dp-data); - firstStrip = FALSE; + firstStrip = false; } else dp = data; if (fillorder != FILLORDER_LSB2MSB) diff --git a/faxd/trigtest.c++ b/faxd/trigtest.c++ index 53769046..2cdd34ab 100644 --- a/faxd/trigtest.c++ +++ b/faxd/trigtest.c++ @@ -18,7 +18,7 @@ extern "C" { #include "config.h" -fxBool verbose = FALSE; +bool verbose = false; static int openFIFO(const char* name, int mode) @@ -416,7 +416,7 @@ main(int argc, char* argv[]) exit(-1); } if (argc == 3) { - verbose = TRUE; + verbose = true; argc--, argv++; } if (chdir(FAX_SPOOLDIR) == -1) { diff --git a/faxd/tsitest.c++ b/faxd/tsitest.c++ index c6c62a4e..c3c3e007 100644 --- a/faxd/tsitest.c++ +++ b/faxd/tsitest.c++ @@ -81,10 +81,10 @@ readTSIPatterns(FILE* fd, RegExArray*& pats, fxBoolArray*& accept) continue; RegEx* re; if (line[0] == '!') { - accept->append(FALSE); + accept->append(false); pats->append(re = new RegEx(line+1)); } else { - accept->append(TRUE); + accept->append(true); pats->append(re = new RegEx(line)); } if (re->getErrorCode() > REG_NOMATCH) { @@ -138,7 +138,7 @@ prompt() int main(int argc, char* argv[]) { - fxBool verbose = TRUE; + bool verbose = true; extern int optind, opterr; extern char* optarg; int c; @@ -147,7 +147,7 @@ main(int argc, char* argv[]) while ((c = getopt(argc, argv, ":q")) != -1) switch (c) { case 'q': - verbose = FALSE; + verbose = false; break; case '?': usage(); diff --git a/faxmail/MIMEState.c++ b/faxmail/MIMEState.c++ index e932e0e4..734b9c1c 100644 --- a/faxmail/MIMEState.c++ +++ b/faxmail/MIMEState.c++ @@ -36,7 +36,7 @@ MIMEState::MIMEState(const char* t, const char* st) : type(t), subtype(st) { parent = NULL; - lastPart = FALSE; + lastPart = false; encode = ENC_7BIT; charset = CS_USASCII; blen = (u_int) -1; // NB: should insure no matches @@ -50,7 +50,7 @@ MIMEState::MIMEState(MIMEState& other) type = "message", subtype = "rfc822"; else type = "text", subtype = "plain"; - lastPart = FALSE; + lastPart = false; encode = other.encode; charset = other.charset; blen = other.blen; @@ -62,7 +62,7 @@ MIMEState::MIMEState(MIMEState& other, const char* t, const char* st) , subtype(st) , boundary(other.boundary) { - lastPart = FALSE; + lastPart = false; encode = other.encode; charset = other.charset; blen = other.blen; @@ -108,7 +108,7 @@ MIMEState::trace(FILE* fd) ); } -fxBool +bool MIMEState::parseToken(const char*& cp, const char delimeter, fxStr& result) { while (*cp && isspace(*cp)) @@ -120,16 +120,16 @@ MIMEState::parseToken(const char*& cp, const char delimeter, fxStr& result) result = fxStr(bp, cp-bp); while (isspace(*cp)) // remove trailing ws cp++; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* * Extract MIME-related information from a set of * message headers and fillin the MIME state block. */ -fxBool +bool MIMEState::parse(const MsgFmt& msg, fxStr& emsg) { const fxStr* s = msg.findHeader("Content-Type"); @@ -145,7 +145,7 @@ MIMEState::parse(const MsgFmt& msg, fxStr& emsg) } else { emsg = "Syntax error parsing MIME Content-Type: " | *s; type = "text"; // reset on parsing error - return (FALSE); + return (false); } } s = msg.findHeader("Content-Transfer-Encoding"); @@ -157,7 +157,7 @@ MIMEState::parse(const MsgFmt& msg, fxStr& emsg) s = msg.findHeader("Content-ID"); if (s) cid = *s; - return (TRUE); + return (true); } /* @@ -210,7 +210,7 @@ MIMEState::parseParameters(const char* cp) /* * Set a MIME parameter used by the decoder. */ -fxBool +bool MIMEState::setParameter(const fxStr& p, const fxStr& value) { fxStr param(p); @@ -220,8 +220,8 @@ MIMEState::setParameter(const fxStr& p, const fxStr& value) } else if (param.length() == 8 && param == "boundary") { setBoundary(value); // part boundary marker } else - return (FALSE); - return (TRUE); + return (false); + return (true); } /* @@ -290,15 +290,15 @@ extern void fxFatal(const char* fmt ...); * Return a line of data according to the current * setting of the content-transfer-encoding and * the body part boundary. If the boundary marker - * or EOF is reached FALSE is returned, otherwise - * this method returns TRUE and the decoded line. + * or EOF is reached false is returned, otherwise + * this method returns true and the decoded line. * If the data is encoded with a text-oriented * scheme (7bit, 8bit, binary, or quoted-printable) * then the trailing newline character is returned * in the buffer. Otherwise any trailing newline * is discarded and only the decoded data is returned. */ -fxBool +bool MIMEState::getLine(FILE* fd, fxStackBuffer& buf) { buf.reset(); @@ -314,14 +314,14 @@ MIMEState::getLine(FILE* fd, fxStackBuffer& buf) u_int cc = buf.getLength(); if (cc >= blen && buf[0] == '-') { if (cc == blen && strneq(buf, boundary, blen)) - return (FALSE); + return (false); if (cc == blen+2 && strneq(buf, boundary, blen+2)) { - lastPart = TRUE; - return (FALSE); + lastPart = true; + return (false); } } buf.put('\n'); - return (TRUE); + return (true); } buf.put(c); } @@ -338,14 +338,14 @@ MIMEState::getLine(FILE* fd, fxStackBuffer& buf) u_int cc = buf.getLength(); if (cc >= blen && buf[0] == '-') { if (cc == blen && strneq(buf, boundary, blen)) - return (FALSE); + return (false); if (cc == blen+2 && strneq(buf, boundary, blen+2)) { - lastPart = TRUE; - return (FALSE); + lastPart = true; + return (false); } } buf.put('\n'); - return (TRUE); + return (true); } buf.put(c); } @@ -356,7 +356,7 @@ MIMEState::getLine(FILE* fd, fxStackBuffer& buf) } fxFatal("Internal error, unsupported Content-Transfer-Encoding %u", encode); /*NOTREACHED*/ - return (FALSE); + return (false); } static int @@ -383,7 +383,7 @@ copyQP(fxStackBuffer& buf, const char line[], u_int cc) /* * Return a decoded line of quoted-printable text. */ -fxBool +bool MIMEState::getQuotedPrintableLine(FILE* fd, fxStackBuffer& buf) { char line[80]; // spec says never more than 76 @@ -404,15 +404,15 @@ MIMEState::getQuotedPrintableLine(FILE* fd, fxStackBuffer& buf) } if (cc >= blen && line[0] == '-') { if (cc == blen && strneq(line, boundary, blen)) - return (FALSE); + return (false); if (cc == blen+2 && strneq(line, boundary, blen+2)) { - lastPart = TRUE; - return (FALSE); + lastPart = true; + return (false); } } copyQP(buf, line, cc); buf.put('\n'); - return (TRUE); + return (true); } if (cc < sizeof (line)-1) line[cc++] = c; @@ -467,7 +467,7 @@ copyBase64(fxStackBuffer& buf, const char line[], u_int cc) /* * Return a decoded line of base64 data. */ -fxBool +bool MIMEState::getBase64Line(FILE* fd, fxStackBuffer& buf) { char line[80]; // spec says never more than 76 @@ -483,14 +483,14 @@ MIMEState::getBase64Line(FILE* fd, fxStackBuffer& buf) lineno++; if (cc >= blen && line[0] == '-') { if (cc == blen && strneq(line, boundary, blen)) - return (FALSE); + return (false); if (cc == blen+2 && strneq(line, boundary, blen+2)) { - lastPart = TRUE; - return (FALSE); + lastPart = true; + return (false); } } copyBase64(buf, line, cc); - return (TRUE); + return (true); } if (cc < sizeof (line)-1) line[cc++] = c; @@ -525,7 +525,7 @@ copyUUDecode(fxStackBuffer& buf, const char line[], u_int) /* * Return a decoded line of uuencode'd data. */ -fxBool +bool MIMEState::getUUDecodeLine(FILE* fd, fxStackBuffer& buf) { char line[80]; // spec says never more than 62 @@ -541,10 +541,10 @@ MIMEState::getUUDecodeLine(FILE* fd, fxStackBuffer& buf) lineno++; if (cc >= blen && line[0] == '-') { // check for boundary marker if (cc == blen && strneq(line, boundary, blen)) - return (FALSE); + return (false); if (cc == blen+2 && strneq(line, boundary, blen+2)) { - lastPart = TRUE; - return (FALSE); + lastPart = true; + return (false); } } else if (cc >= 6 && strneq(line, "begin ", 6)) { return (getUUDecodeLine(fd, buf)); @@ -552,10 +552,10 @@ MIMEState::getUUDecodeLine(FILE* fd, fxStackBuffer& buf) // consume to boundary marker while (getUUDecodeLine(fd, buf)) ; - return (FALSE); + return (false); } copyUUDecode(buf, line, cc); - return (TRUE); + return (true); } if (cc < sizeof (line)-1) line[cc++] = c; diff --git a/faxmail/MIMEState.h b/faxmail/MIMEState.h index 6e896f7b..d7f52050 100644 --- a/faxmail/MIMEState.h +++ b/faxmail/MIMEState.h @@ -64,19 +64,19 @@ private: fxStr cid; // content ID fxStr boundary; // multipart boundary marker u_int blen; // adjusted boundary length - fxBool lastPart; // TRUE if last multipart boundary seen + bool lastPart; // true if last multipart boundary seen Encoding encode; // content transfer encoding Charset charset; // text character set - static fxBool parseToken(const char*&, const char delimeter, fxStr& result); + static bool parseToken(const char*&, const char delimeter, fxStr& result); void parseParameters(const char*); protected: - virtual fxBool setParameter(const fxStr& param, const fxStr& value); + virtual bool setParameter(const fxStr& param, const fxStr& value); - fxBool getQuotedPrintableLine(FILE* fd, fxStackBuffer& buf); - fxBool getBase64Line(FILE* fd, fxStackBuffer& buf); - fxBool getUUDecodeLine(FILE* fd, fxStackBuffer& buf); + bool getQuotedPrintableLine(FILE* fd, fxStackBuffer& buf); + bool getBase64Line(FILE* fd, fxStackBuffer& buf); + bool getUUDecodeLine(FILE* fd, fxStackBuffer& buf); public: MIMEState(const char* type, const char* subtype); MIMEState(MIMEState& parent); @@ -84,12 +84,12 @@ public: ~MIMEState(); u_int lineno; // input line number - fxBool parse(const MsgFmt&, fxStr& emsg); + bool parse(const MsgFmt&, fxStr& emsg); const fxStr& getType(void) const; const fxStr& getSubType(void) const; - fxBool isParent(const char* type) const; - fxBool isParent(const char* type, const char* subtype) const; + bool isParent(const char* type) const; + bool isParent(const char* type, const char* subtype) const; const fxStr& getDescription(void) const; const fxStr& getContentID(void) const; @@ -100,18 +100,18 @@ public: void setBoundary(const char*); const fxStr& getBoundary(void) const; - virtual fxBool getLine(FILE*, fxStackBuffer&); - fxBool isLastPart(void) const; + virtual bool getLine(FILE*, fxStackBuffer&); + bool isLastPart(void) const; virtual void trace(FILE*); }; inline Charset MIMEState::getCharset(void) const { return charset; } inline Encoding MIMEState::getEncoding(void) const { return encode; } inline const fxStr& MIMEState::getBoundary(void) const { return boundary; } -inline fxBool MIMEState::isLastPart(void) const { return lastPart; } -inline fxBool MIMEState::isParent(const char* t) const +inline bool MIMEState::isLastPart(void) const { return lastPart; } +inline bool MIMEState::isParent(const char* t) const { return (parent && parent->type == t); } -inline fxBool MIMEState::isParent(const char* t, const char* st) const +inline bool MIMEState::isParent(const char* t, const char* st) const { return (parent && parent->type == t && parent->subtype == st); } inline const fxStr& MIMEState::getType(void) const { return type; } inline const fxStr& MIMEState::getSubType(void) const { return subtype; } diff --git a/faxmail/MsgFmt.c++ b/faxmail/MsgFmt.c++ index a2d2ab88..26a6996e 100644 --- a/faxmail/MsgFmt.c++ +++ b/faxmail/MsgFmt.c++ @@ -67,7 +67,7 @@ MsgFmt::mapHeader(const fxStr& name) return (name); } -fxBool +bool MsgFmt::getLine(FILE* fd, fxStackBuffer& buf) { buf.reset(); @@ -80,7 +80,7 @@ MsgFmt::getLine(FILE* fd, fxStackBuffer& buf) break; buf.put(c); } - return (TRUE); + return (true); } void @@ -139,7 +139,7 @@ MsgFmt::parseHeaders(FILE* fd, u_int& lineno) void MsgFmt::setupConfig() { - verbose = FALSE; + verbose = false; boldFont = "Helvetica-Bold"; italicFont = "Helvetica-Oblique"; @@ -157,7 +157,7 @@ MsgFmt::setupConfig() #undef streq #define streq(a,b) (strcasecmp(a,b)==0) -fxBool +bool MsgFmt::setConfigItem(const char* tag, const char* value) { if (streq(tag, "headers")) { @@ -187,8 +187,8 @@ MsgFmt::setConfigItem(const char* tag, const char* value) } else if (streq(tag, "verbose")) { verbose = FaxConfig::getBoolean(tag); } else - return (FALSE); - return (TRUE); + return (false); + return (true); } #undef streq diff --git a/faxmail/MsgFmt.h b/faxmail/MsgFmt.h index d94991e5..f4b7e872 100644 --- a/faxmail/MsgFmt.h +++ b/faxmail/MsgFmt.h @@ -36,7 +36,7 @@ struct MsgFmt { TextCoord headerStop; // tab stop for headers fxStr boldFont; // bold font family name fxStr italicFont; // italic font family name - fxBool verbose; // trace header handling + bool verbose; // trace header handling fxStrArray fields; // header tags fxStrArray headers; // header values @@ -48,9 +48,9 @@ struct MsgFmt { virtual ~MsgFmt(); void setupConfig(); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); - static fxBool getLine(FILE* fd, fxStackBuffer& buf); + static bool getLine(FILE* fd, fxStackBuffer& buf); const fxStr* findHeader(const fxStr& name) const; u_int headerCount(void); diff --git a/faxmail/faxmail.c++ b/faxmail/faxmail.c++ index d2542ad7..bf2310e4 100644 --- a/faxmail/faxmail.c++ +++ b/faxmail/faxmail.c++ @@ -44,14 +44,14 @@ public: MySendFaxClient(); ~MySendFaxClient(); - void setup(fxBool); - fxBool setConfigItem(const char* tag, const char* value); + void setup(bool); + bool setConfigItem(const char* tag, const char* value); void fatal(const char* fmt ...); }; MySendFaxClient::MySendFaxClient() {} MySendFaxClient::~MySendFaxClient() {} void -MySendFaxClient::setup(fxBool b) +MySendFaxClient::setup(bool b) { resetConfig(); readConfig(FAX_SYSCONF); @@ -61,13 +61,13 @@ MySendFaxClient::setup(fxBool b) setVerbose(b); FaxClient::setVerbose(b); } -fxBool MySendFaxClient::setConfigItem(const char* tag, const char* value) +bool MySendFaxClient::setConfigItem(const char* tag, const char* value) { return SendFaxClient::setConfigItem(tag, value); } class faxMailApp : public TextFmt, public MsgFmt { private: - fxBool markDiscarded; // mark MIME parts not handled - fxBool withinFile; // between beginFile() & endFile() + bool markDiscarded; // mark MIME parts not handled + bool withinFile; // between beginFile() & endFile() fxStr mimeConverters; // pathname to MIME converter scripts fxStr mailProlog; // site-specific prologue definitions fxStr clientProlog; // client-specific prologue info @@ -77,7 +77,7 @@ private: MySendFaxClient* client; // for direct delivery SendFaxJob* job; // reference to outbound job fxStr mailUser; // user ID for contacting server - fxBool autoCoverPage; // make cover page for direct delivery + bool autoCoverPage; // make cover page for direct delivery void formatMIME(FILE* fd, MIMEState& mime, MsgFmt& msg); void formatText(FILE* fd, MIMEState& mime); @@ -85,18 +85,18 @@ private: void formatMessage(FILE* fd, MIMEState& mime, MsgFmt& msg); void formatApplication(FILE* fd, MIMEState& mime); void formatDiscarded(MIMEState& mime); - fxBool formatWithExternal(FILE* fd, const fxStr& app, MIMEState& mime); + bool formatWithExternal(FILE* fd, const fxStr& app, MIMEState& mime); void emitClientPrologue(FILE*); void discardPart(FILE* fd, MIMEState& mime); - fxBool copyPart(FILE* fd, MIMEState& mime, fxStr& tmpFile); - fxBool runConverter(const fxStr& app, const fxStr& tmp, MIMEState& mime); + bool copyPart(FILE* fd, MIMEState& mime, fxStr& tmpFile); + bool runConverter(const fxStr& app, const fxStr& tmp, MIMEState& mime); void copyFile(FILE* fd, const char* filename); void resetConfig(); void setupConfig(); - fxBool setConfigItem(const char* tag, const char* value); + bool setConfigItem(const char* tag, const char* value); void usage(void); public: @@ -105,7 +105,7 @@ public: void run(int argc, char** argv); - void setVerbose(fxBool b) { verbose = b; } + void setVerbose(bool b) { verbose = b; } void setBoldFont(const char* cp) { boldFont = cp; } void setItalicFont(const char* cp) { italicFont = cp; } }; @@ -136,7 +136,7 @@ faxMailApp::run(int argc, char** argv) readConfig(FAX_LIBDATA "/faxmail.conf"); readConfig(FAX_USERCONF); - fxBool deliver = FALSE; + bool deliver = false; while ((c = Sys::getopt(argc, argv, "12b:cdf:H:i:M:np:rRs:u:vW:")) != -1) switch (c) { case '1': case '2': // format in 1 or 2 columns @@ -146,10 +146,10 @@ faxMailApp::run(int argc, char** argv) setBoldFont(optarg); break; case 'c': // truncate lines - setLineWrapping(FALSE); + setLineWrapping(false); break; case 'd': // enable direct delivery - deliver = TRUE; + deliver = true; break; case 'f': // default font for text body setTextFont(optarg); @@ -164,7 +164,7 @@ faxMailApp::run(int argc, char** argv) setPageMargins(optarg); break; case 'n': // suppress cover page - autoCoverPage = FALSE; + autoCoverPage = false; break; case 'p': // point size setTextPointSize(TextFmt::inch(optarg)); @@ -185,7 +185,7 @@ faxMailApp::run(int argc, char** argv) setPageWidth(atof(optarg)); break; case 'v': // trace work - setVerbose(TRUE); + setVerbose(true); break; case '?': usage(); @@ -322,24 +322,24 @@ faxMailApp::run(int argc, char** argv) const fxStr* version = findHeader("MIME-Version"); if (version && *version == "1.0") { beginFile(); - withinFile = TRUE; + withinFile = true; formatHeaders(*this); // format top-level headers formatMIME(stdin, mime, *this); // parse MIME format if (withinFile) endFile(); - withinFile = FALSE; + withinFile = false; } else { beginFile(); - withinFile = TRUE; + withinFile = true; formatHeaders(*this); // format top-level headers formatText(stdin, mime); // treat body as text/plain if (withinFile) endFile(); - withinFile = FALSE; + withinFile = false; } endFormatting(); if (client) { // complete direct delivery - fxBool status = FALSE; + bool status = false; fxStr emsg; const char* user = mailUser; if (user[0] == '\0') // null user =>'s use real uid @@ -504,13 +504,13 @@ faxMailApp::formatApplication(FILE* fd, MIMEState& mime) { if (mime.getSubType() == "postscript") { // copy PS straight thru if (withinFile) endFile(); - withinFile = FALSE; + withinFile = false; FILE* fout = getOutputFile(); fxStackBuffer buf; while (mime.getLine(fd, buf)) fwrite((const char*) buf, buf.getLength(), 1, fout); if (!withinFile) beginFile(); - withinFile = TRUE; + withinFile = true; } else if (mime.getSubType() == "x-faxmail-prolog") { copyPart(fd, mime, clientProlog); // save client PS prologue } else { @@ -523,10 +523,10 @@ faxMailApp::formatApplication(FILE* fd, MIMEState& mime) * Format a MIME part using an external conversion * script to convert the decoded body to PostScript. */ -fxBool +bool faxMailApp::formatWithExternal(FILE* fd, const fxStr& app, MIMEState& mime) { - fxBool ok = FALSE; + bool ok = false; if (verbose) fprintf(stderr, "CONVERT: run %s\n", (const char*) app); fxStr tmp; @@ -580,7 +580,7 @@ faxMailApp::discardPart(FILE* fd, MIMEState& mime) * The latter is used, for example, to accumulate * client-specified prologue data. */ -fxBool +bool faxMailApp::copyPart(FILE* fd, MIMEState& mime, fxStr& tmpFile) { int ftmp; @@ -592,25 +592,25 @@ faxMailApp::copyPart(FILE* fd, MIMEState& mime, fxStr& tmpFile) ftmp = Sys::open(tmpFile, O_WRONLY|O_APPEND); if (ftmp >= 0) { fxStackBuffer buf; - fxBool ok = TRUE; + bool ok = true; while (mime.getLine(fd, buf) && ok) ok = (Sys::write(ftmp, buf, buf.getLength()) == buf.getLength()); if (ok) { Sys::close(ftmp); - return (TRUE); + return (true); } error("%s: write error: %s", (const char*) tmpFile, strerror(errno)); Sys::close(ftmp); } else error("%s: Can not create temporary file", (const char*) tmpFile); discardPart(fd, mime); - return (FALSE); + return (false); } /* * Run an external converter program. */ -fxBool +bool faxMailApp::runConverter(const fxStr& app, const fxStr& tmp, MIMEState& mime) { const char* av[3]; @@ -637,7 +637,7 @@ faxMailApp::runConverter(const fxStr& app, const fxStr& tmp, MIMEState& mime) default: int status; if (Sys::waitpid(pid, status) == pid && status == 0) - return (TRUE); + return (true); error("Error converting %s/%s; command was \"%s %s\"; exit status %x" , (const char*) mime.getType() , (const char*) mime.getSubType() @@ -647,7 +647,7 @@ faxMailApp::runConverter(const fxStr& app, const fxStr& tmp, MIMEState& mime) ); break; } - return (FALSE); + return (false); } /* @@ -674,18 +674,18 @@ faxMailApp::copyFile(FILE* fd, const char* filename) void faxMailApp::setupConfig() { - markDiscarded = TRUE; + markDiscarded = true; mimeConverters = FAX_LIBEXEC "/faxmail"; mailProlog = FAX_LIBDATA "/faxmail.ps"; msgDivider = ""; mailUser = ""; // default to real uid - autoCoverPage = TRUE; // a la sendfax + autoCoverPage = true; // a la sendfax - setPageHeaders(FALSE); // disable normal page headers + setPageHeaders(false); // disable normal page headers setNumberOfColumns(1); // 1 input page per output page - setLineWrapping(TRUE); - setISO8859(TRUE); + setLineWrapping(true); + setISO8859(true); MsgFmt::setupConfig(); } @@ -700,7 +700,7 @@ faxMailApp::resetConfig() #undef streq #define streq(a,b) (strcasecmp(a,b)==0) -fxBool +bool faxMailApp::setConfigItem(const char* tag, const char* value) { if (streq(tag, "markdiscarded")) @@ -720,8 +720,8 @@ faxMailApp::setConfigItem(const char* tag, const char* value) else if (TextFmt::setConfigItem(tag, value)) ; else - return (FALSE); - return (TRUE); + return (false); + return (true); } #undef streq diff --git a/faxrm/faxrm.c++ b/faxrm/faxrm.c++ index 962ad59a..47c79770 100644 --- a/faxrm/faxrm.c++ +++ b/faxrm/faxrm.c++ @@ -31,8 +31,8 @@ class faxRmApp : public FaxClient { private: void usage(); - fxBool removeJob(const char* id, fxStr& emsg); - fxBool deleteDoc(const char* id); + bool removeJob(const char* id, fxStr& emsg); + bool deleteDoc(const char* id); public: faxRmApp(); ~faxRmApp(); @@ -54,24 +54,24 @@ faxRmApp::run(int argc, char** argv) readConfig(FAX_SYSCONF); readConfig(FAX_USERCONF); - fxBool jobs = TRUE; - fxBool docs = FALSE; - fxBool useadmin = FALSE; + bool jobs = true; + bool docs = false; + bool useadmin = false; while ((c = getopt(argc, argv, "ah:dv")) != -1) switch (c) { case 'a': - useadmin = TRUE; + useadmin = true; break; case 'd': // treat args as document names - jobs = FALSE; - docs = TRUE; + jobs = false; + docs = true; break; case 'h': // server's host setHost(optarg); break; case 'v': - setVerbose(TRUE); + setVerbose(true); break; case '?': usage(); @@ -103,23 +103,23 @@ faxRmApp::run(int argc, char** argv) printError(emsg); } -fxBool +bool faxRmApp::removeJob(const char* id, fxStr& emsg) { if (jobKill(id)) { printf("Job %s removed.\n", id); - return (TRUE); + return (true); } emsg = getLastResponse(); if (getLastCode() == 504 && jobDelete(id)) { printf("Job %s removed (from doneq).\n", id); emsg = ""; - return (TRUE); + return (true); } - return (FALSE); + return (false); } -fxBool +bool faxRmApp::deleteDoc(const char* id) { return (command("DELE %s%s" diff --git a/faxstat/faxstat.c++ b/faxstat/faxstat.c++ index 8e89179b..b8563526 100644 --- a/faxstat/faxstat.c++ +++ b/faxstat/faxstat.c++ @@ -34,7 +34,7 @@ class faxStatApp : public FaxClient { private: fxStr header; - fxBool listWithHeader(const fxStr& dir, fxStr& emsg); + bool listWithHeader(const fxStr& dir, fxStr& emsg); public: faxStatApp(); ~faxStatApp(); @@ -44,11 +44,11 @@ public: faxStatApp::faxStatApp() {} faxStatApp::~faxStatApp() {} -static fxBool +static bool writeStdout(void*, const char* buf, int cc, fxStr&) { (void) Sys::write(STDOUT_FILENO, buf, cc); - return (TRUE); + return (true); } void @@ -60,7 +60,7 @@ faxStatApp::run(int argc, char** argv) fxStrArray dirs; dirs.append(FAX_STATUSDIR); // server status - fxBool checkInfo = FALSE; + bool checkInfo = false; int c; while ((c = getopt(argc, argv, "h:adgfilrsv")) != -1) switch (c) { @@ -80,7 +80,7 @@ faxStatApp::run(int argc, char** argv) setHost(optarg); break; case 'i': // display any.info file - checkInfo = TRUE; + checkInfo = true; break; case 'l': // use local timezone for dates & times setTimeZone(TZ_LOCAL); @@ -92,7 +92,7 @@ faxStatApp::run(int argc, char** argv) dirs.append(FAX_SENDDIR); break; case 'v': // enable protocol tracing - setVerbose(TRUE); + setVerbose(true); break; case '?': fxFatal("usage: faxstat [-h server-host] [-adfglrsv]"); @@ -122,7 +122,7 @@ faxStatApp::run(int argc, char** argv) printError(emsg); } -fxBool +bool faxStatApp::listWithHeader(const fxStr& dir, fxStr& emsg) { if (!setMode(MODE_S)) @@ -139,11 +139,11 @@ faxStatApp::listWithHeader(const fxStr& dir, fxStr& emsg) int cc = read(getDataFd(), buf, sizeof (buf)); if (cc == 0) { closeDataConn(); - return (getReply(FALSE) == COMPLETE); + return (getReply(false) == COMPLETE); } if (cc < 0) { emsg = fxStr::format("Data Connection: %s", strerror(errno)); - (void) getReply(FALSE); + (void) getReply(false); break; } if (byte_count == 0 && header.length() > 0) @@ -153,7 +153,7 @@ faxStatApp::listWithHeader(const fxStr& dir, fxStr& emsg) } bad: closeDataConn(); - return (FALSE); + return (false); } int diff --git a/hfaxd/FIFO.c++ b/hfaxd/FIFO.c++ index 7e844712..4e9090b7 100644 --- a/hfaxd/FIFO.c++ +++ b/hfaxd/FIFO.c++ @@ -37,30 +37,30 @@ /* * Create the client FIFO and open it for use. */ -fxBool +bool HylaFAXServer::initClientFIFO(fxStr& emsg) { clientFIFOName = fxStr::format(FAX_CLIENTDIR "/%u", getpid()); if (Sys::mkfifo(clientFIFOName, 0622) < 0 && errno != EEXIST) { emsg = fxStr::format("Could not create %s: %s", (const char*) clientFIFOName, strerror(errno)); - return (FALSE); + return (false); } clientFd = Sys::open(clientFIFOName, CONFIG_OPENFIFO|O_NDELAY); if (clientFd == -1) { emsg = fxStr::format("Could not open FIFO file %s: %s", (const char*) clientFIFOName, strerror(errno)); - return (FALSE); + return (false); } if (!Sys::isFIFOFile(clientFd)) { emsg = clientFIFOName | " is not a FIFO special file"; - return (FALSE); + return (false); } // open should set O_NDELAY, but just to be sure... if (fcntl(clientFd, F_SETFL, fcntl(clientFd, F_GETFL, 0) | O_NDELAY) < 0) logError("initClientFIFO %s: fcntl: %m", (const char*) clientFIFOName); Dispatcher::instance().link(clientFd, Dispatcher::ReadMask, this); - return (TRUE); + return (true); } /* @@ -139,10 +139,10 @@ HylaFAXServer::FIFOMessage(const char* cp, u_int) /* * Send a message to the central queuer process. */ -fxBool +bool HylaFAXServer::sendQueuerMsg(fxStr& emsg, const fxStr& msg) { - fxBool retry = FALSE; + bool retry = false; again: if (faxqFd == -1) { #ifdef FIFOSELECTBUG @@ -164,7 +164,7 @@ again: if (faxqFd == -1) { emsg = fxStr::format("Unable to open scheduler FIFO: %s", strerror(errno)); - return (FALSE); + return (false); } /* * Turn off O_NDELAY so that write will block if FIFO is full. @@ -181,26 +181,26 @@ again: */ Sys::close(faxqFd), faxqFd = -1; if (!retry) { - retry = TRUE; + retry = true; goto again; } } emsg = fxStr::format("FIFO write failed: %s", strerror(errno)); logError(emsg); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* * Send a message to the central queuer process. */ -fxBool +bool HylaFAXServer::sendQueuer(fxStr& emsg, const char* fmt ...) { va_list ap; va_start(ap, fmt); - fxBool ok = sendQueuerMsg(emsg, fxStr::vformat(fmt, ap)); + bool ok = sendQueuerMsg(emsg, fxStr::vformat(fmt, ap)); va_end(ap); return (ok); } @@ -209,43 +209,43 @@ HylaFAXServer::sendQueuer(fxStr& emsg, const char* fmt ...) * Send a message to the central queuer process * and wait for a response on our client FIFO. */ -fxBool +bool HylaFAXServer::sendQueuerACK(fxStr& emsg, const char* fmt, ...) { va_list ap; va_start(ap, fmt); - fxBool b = vsendQueuerACK(emsg, fmt, ap); + bool b = vsendQueuerACK(emsg, fmt, ap); va_end(ap); return (b); } -fxBool +bool HylaFAXServer::vsendQueuerACK(fxStr& emsg, const char* fmt, va_list ap) { if (clientFd == -1) { emsg = "Bad server state, client FIFO is not open"; - return (FALSE); + return (false); } fxStr msg = fxStr::vformat(fmt, ap); if (msg.length() < 2) { // sanity check emsg = "Bad FIFO message, too short to be valid"; - return (FALSE); + return (false); } msg.insert(clientFIFOName | ":", 1); // insert FIFO name for reply - fxBool ok = sendQueuerMsg(emsg, msg); + bool ok = sendQueuerMsg(emsg, msg); if (ok) { Dispatcher& disp = Dispatcher::instance(); for (state |= S_WAITFIFO; IS(WAITFIFO); disp.dispatch()) ; if (fifoResponse.length() < 2) { // too short to be valid emsg = "Unexpected response from scheduler: \"" |fifoResponse| "\""; - ok = FALSE; + ok = false; } else if (fifoResponse[0] == msg[0]) { // response to our request ok = (fifoResponse[1] == '*'); if (!ok) emsg = "Unspecified reason (scheduler NAK'd request)"; } else // user abort - ok = FALSE; + ok = false; } return (ok); } @@ -253,7 +253,7 @@ HylaFAXServer::vsendQueuerACK(fxStr& emsg, const char* fmt, va_list ap) /* * Send a message to a modem process via the per-modem FIFO. */ -fxBool +bool HylaFAXServer::sendModem(const char* modem, fxStr& emsg, const char* fmt ...) { fxStr fifoName(modem); @@ -279,7 +279,7 @@ HylaFAXServer::sendModem(const char* modem, fxStr& emsg, const char* fmt ...) if (fd == -1) { emsg = fxStr::format("Unable to open %s: %s", (const char*) fifoName, strerror(errno)); - return (FALSE); + return (false); } va_list ap; va_start(ap, fmt); @@ -290,7 +290,7 @@ HylaFAXServer::sendModem(const char* modem, fxStr& emsg, const char* fmt ...) emsg = fxStr::format("write to %s failed: %s", (const char*) fifoName, strerror(errno)); logError(emsg); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } diff --git a/hfaxd/FileCache.c++ b/hfaxd/FileCache.c++ index a8c91e1d..c1510786 100644 --- a/hfaxd/FileCache.c++ +++ b/hfaxd/FileCache.c++ @@ -85,8 +85,8 @@ FileCache::hash(const char* pathname) return (h % CACHESIZE); } -fxBool -FileCache::lookup(const char* pathname, struct stat& sb, fxBool addToCache) +bool +FileCache::lookup(const char* pathname, struct stat& sb, bool addToCache) { lookups++; u_int h = hash(pathname); @@ -99,7 +99,7 @@ FileCache::lookup(const char* pathname, struct stat& sb, fxBool addToCache) fi->serial = master++; sb = fi->sb; hits++; - return (TRUE); + return (true); } if (fi->serial < oldest->serial) oldest = fi; @@ -110,7 +110,7 @@ FileCache::lookup(const char* pathname, struct stat& sb, fxBool addToCache) * Pathname not found in the cache. */ if (Sys::stat(pathname, sb) < 0) - return (FALSE); + return (false); if (addToCache && pathname[0] != '.') { if (fi) { fi = oldest; @@ -121,17 +121,17 @@ FileCache::lookup(const char* pathname, struct stat& sb, fxBool addToCache) fi->serial = master++; fi->sb = sb; } - return (TRUE); + return (true); } /* * Update the file mode for any in-cache entry. */ -fxBool +bool FileCache::chmod(const char* pathname, mode_t mode) { if (Sys::chmod(pathname, mode) < 0) - return (FALSE); + return (false); lookups++; u_int h = hash(pathname); u_int maxprobes = 5; @@ -146,13 +146,13 @@ FileCache::chmod(const char* pathname, mode_t mode) h = (u_int)(h*h) % CACHESIZE; fi = cache[h]; } - return (TRUE); + return (true); } /* * Update the file ownership for any in-cache entry. */ -fxBool +bool FileCache::chown(const char* pathname, uid_t uid, gid_t gid) { /* @@ -167,7 +167,7 @@ FileCache::chown(const char* pathname, uid_t uid, gid_t gid) */ uid_t ouid = geteuid(); (void) seteuid(0); - fxBool ok = (Sys::chown(pathname, uid, gid) >= 0); + bool ok = (Sys::chown(pathname, uid, gid) >= 0); (void) seteuid(ouid); if (ok) { lookups++; @@ -192,8 +192,8 @@ FileCache::chown(const char* pathname, uid_t uid, gid_t gid) /* * Like lookup, but if found in the cache, re-do the stat. */ -fxBool -FileCache::update(const char* pathname, struct stat& sb, fxBool addToCache) +bool +FileCache::update(const char* pathname, struct stat& sb, bool addToCache) { lookups++; u_int h = hash(pathname); @@ -207,12 +207,12 @@ FileCache::update(const char* pathname, struct stat& sb, fxBool addToCache) hits++; fi->serial = master++; fi->sb = sb; - return (TRUE); + return (true); } else { flushed++; cache[h] = NULL; delete fi; - return (FALSE); + return (false); } } if (fi->serial < oldest->serial) @@ -224,7 +224,7 @@ FileCache::update(const char* pathname, struct stat& sb, fxBool addToCache) * Pathname not found in the cache. */ if (Sys::stat(pathname, sb) < 0) - return (FALSE); + return (false); if (addToCache && pathname[0] != '.') { if (fi) { fi = oldest; @@ -235,7 +235,7 @@ FileCache::update(const char* pathname, struct stat& sb, fxBool addToCache) fi->serial = master++; fi->sb = sb; } - return (TRUE); + return (true); } void diff --git a/hfaxd/FileCache.h b/hfaxd/FileCache.h index a5a1c6d0..326997ec 100644 --- a/hfaxd/FileCache.h +++ b/hfaxd/FileCache.h @@ -52,13 +52,13 @@ struct FileCache { static u_int hash(const char* pathname); - static fxBool lookup(const char* pathname, struct stat& sb, - fxBool addToCache = TRUE); - static fxBool update(const char* pathname, struct stat& sb, - fxBool addToCache = TRUE); + static bool lookup(const char* pathname, struct stat& sb, + bool addToCache = true); + static bool update(const char* pathname, struct stat& sb, + bool addToCache = true); static void flush(const char* pathname); - static fxBool chmod(const char* pathname, mode_t mode); - static fxBool chown(const char* pathname, uid_t uid, gid_t gid); + static bool chmod(const char* pathname, mode_t mode); + static bool chown(const char* pathname, uid_t uid, gid_t gid); static void reset(void); }; #endif /* _FileCache_ */ diff --git a/hfaxd/FileSystem.c++ b/hfaxd/FileSystem.c++ index d1e2e39c..823caccb 100644 --- a/hfaxd/FileSystem.c++ +++ b/hfaxd/FileSystem.c++ @@ -137,64 +137,64 @@ HylaFAXServer::mdtmCmd(const char* pathname) * NB: this array is ordered by expected frequency of access. */ SpoolDir HylaFAXServer::dirs[] = { -{ "/status/", FALSE, FALSE, FALSE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/status/", false, false, false, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listStatus, &HylaFAXServer::listStatusFile, &HylaFAXServer::nlstStatus, &HylaFAXServer::nlstUnixFile, }, -{ "/sendq/", FALSE, FALSE, FALSE, 0, +{ "/sendq/", false, false, false, 0, HylaFAXServer::isVisibleSendQFile, &HylaFAXServer::listSendQ, &HylaFAXServer::listSendQFile, &HylaFAXServer::nlstSendQ, &HylaFAXServer::nlstSendQFile, }, -{ "/doneq/", FALSE, FALSE, FALSE, 0, +{ "/doneq/", false, false, false, 0, HylaFAXServer::isVisibleSendQFile, &HylaFAXServer::listSendQ, &HylaFAXServer::listSendQFile, &HylaFAXServer::nlstSendQ, &HylaFAXServer::nlstSendQFile, }, -{ "/docq/", FALSE, TRUE, TRUE, 0, +{ "/docq/", false, true, true, 0, HylaFAXServer::isVisibleDocQFile, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/tmp/", FALSE, TRUE, TRUE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/tmp/", false, true, true, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/log/", FALSE, FALSE, FALSE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/log/", false, false, false, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/recvq/", FALSE, FALSE, TRUE, 0, +{ "/recvq/", false, false, true, 0, HylaFAXServer::isVisibleRecvQFile, &HylaFAXServer::listRecvQ, &HylaFAXServer::listRecvQFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/archive/", FALSE, FALSE, FALSE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/archive/", false, false, false, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/pollq/", FALSE, TRUE, TRUE, 0, +{ "/pollq/", false, true, true, 0, HylaFAXServer::isVisibleRecvQFile, &HylaFAXServer::listRecvQ, &HylaFAXServer::listRecvQFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/", FALSE, FALSE, FALSE, 0, +{ "/", false, false, false, 0, HylaFAXServer::isVisibleRootFile, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/etc/", TRUE, FALSE, FALSE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/etc/", true, false, false, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/info/", FALSE, FALSE, FALSE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/info/", false, false, false, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/bin/", TRUE, FALSE, FALSE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/bin/", true, false, false, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/config/", FALSE, FALSE, FALSE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/config/", false, false, false, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, -{ "/client/", TRUE, FALSE, FALSE, 0, - HylaFAXServer::isVisibleTRUE, +{ "/client/", true, false, false, 0, + HylaFAXServer::isVisibletrue, &HylaFAXServer::listDirectory, &HylaFAXServer::listUnixFile, &HylaFAXServer::nlstDirectory, &HylaFAXServer::nlstUnixFile, }, }; @@ -400,18 +400,18 @@ HylaFAXServer::setFileOwner(const char* file) /* * Is the specified file visible to the client. */ -fxBool +bool HylaFAXServer::fileVisible(const SpoolDir& dir, const char* filename, const struct stat& sb) { return (IS(PRIVILEGED) || (*dir.isVisibleFile)(filename, sb)); } -fxBool -HylaFAXServer::isVisibleTRUE(const char*, const struct stat&) - { return (TRUE); } -fxBool +bool +HylaFAXServer::isVisibletrue(const char*, const struct stat&) + { return (true); } +bool HylaFAXServer::isVisibleDocQFile(const char* filename, const struct stat&) { return (strncmp(filename, "doc", 3) == 0); } -fxBool +bool HylaFAXServer::isVisibleRootFile(const char*, const struct stat& sb) { return (S_ISREG(sb.st_mode) || S_ISDIR(sb.st_mode)); } @@ -621,7 +621,7 @@ HylaFAXServer::Fprintf(FILE* fd, const char* fmt, } void -HylaFAXServer::makeProt(const struct stat& sb, fxBool withGrp, char prot[10]) +HylaFAXServer::makeProt(const struct stat& sb, bool withGrp, char prot[10]) { char* pp = prot; *pp++ = S_ISREG(sb.st_mode) ? '-' : @@ -721,11 +721,11 @@ HylaFAXServer::nlstUnixFile(FILE* fd, const SpoolDir&, fprintf(fd, "%s", filename); } -static fxBool +static bool isTIFF(const TIFFHeader& h) { if (h.tiff_magic != TIFF_BIGENDIAN && h.tiff_magic != TIFF_LITTLEENDIAN) - return (FALSE); + return (false); union { int32 i; char c[4]; @@ -738,7 +738,7 @@ isTIFF(const TIFFHeader& h) return (version == TIFF_VERSION); } -fxBool +bool HylaFAXServer::docType(const char* docname, FaxSendOp& op) { op = FaxRequest::send_unknown; diff --git a/hfaxd/FileTransfer.c++ b/hfaxd/FileTransfer.c++ index 8eb2807c..94818248 100644 --- a/hfaxd/FileTransfer.c++ +++ b/hfaxd/FileTransfer.c++ @@ -44,17 +44,17 @@ #endif #endif /* CHAR_BIT */ -#define HAVE_PSLEVEL2 FALSE -#define HAVE_PCL5 FALSE +#define HAVE_PSLEVEL2 false +#define HAVE_PCL5 false static struct { const char* name; // protocol token name - fxBool supported; // TRUE if format is supported + bool supported; // true if format is supported const char* suffix; // file suffix const char* help; // help string for HELP FORM command } formats[] = { -{ "TIFF", TRUE, "tif", "Tagged Image File Format, Class F only" }, -{ "PS", TRUE, "ps", "Adobe PostScript Level I" }, +{ "TIFF", true, "tif", "Tagged Image File Format, Class F only" }, +{ "PS", true, "ps", "Adobe PostScript Level I" }, { "PS2", HAVE_PSLEVEL2, "ps", "Adobe PostScript Level II" }, { "PCL", HAVE_PCL5, "pcl", "HP Printer Control Language (PCL), Version 5"}, }; @@ -88,15 +88,15 @@ HylaFAXServer::logTransfer(const char* direction, (void) Sys::write(xferfaxlog, msg, msg.length()); } -fxBool +bool HylaFAXServer::restartSend(FILE* fd, off_t marker) { if (type == TYPE_A) { // restart based on line count int c; while ((c = getc(fd)) != EOF) if (c == '\n' && --marker == 0) - return (TRUE); - return (FALSE); + return (true); + return (false); } else // restart based on file offset return (lseek(fileno(fd), marker, SEEK_SET) == marker); } @@ -265,13 +265,13 @@ HylaFAXServer::openTIFF(const char* name) /* * Tranfer the current directory's contents of "tif" to "fdout". */ -fxBool +bool HylaFAXServer::sendTIFFData(TIFF* tif, FILE* fdout) { state |= S_TRANSFER; if (setjmp(urgcatch) != 0) { state &= ~S_TRANSFER; - return (FALSE); + return (false); } #define PACK(a,b) (((a)<<8)|(b)) switch (PACK(type,mode)) { @@ -280,7 +280,7 @@ HylaFAXServer::sendTIFFData(TIFF* tif, FILE* fdout) if (sendTIFFHeader(tif, fileno(fdout)) && sendITIFFData(tif, fileno(fdout))) { state &= ~S_TRANSFER; - return (TRUE); + return (true); } break; default: @@ -292,7 +292,7 @@ HylaFAXServer::sendTIFFData(TIFF* tif, FILE* fdout) } #undef PACK state &= ~S_TRANSFER; - return (FALSE); + return (false); } static void @@ -316,7 +316,7 @@ getShort(TIFF* tif, TIFFDirEntry& de) * immediately after this data) and it is assumed that * all image data is concatenated into a single strip. */ -fxBool +bool HylaFAXServer::sendTIFFHeader(TIFF* tif, int fdout) { static DirTemplate templ = { @@ -398,10 +398,10 @@ HylaFAXServer::sendTIFFHeader(TIFF* tif, int fdout) memcpy(buf.dirstuff, &templ, sizeof (templ)); if (write(fdout, (const char*) &buf, sizeof (buf)) != sizeof (buf)) { perror_reply(426, "Data connection", errno); - return (FALSE); + return (false); } else { byte_count += sizeof (buf); - return (TRUE); + return (true); } #undef NTAGS #undef offsetof @@ -414,7 +414,7 @@ HylaFAXServer::sendTIFFHeader(TIFF* tif, int fdout) * consideration for any padding that might be present * or might be needed. */ -fxBool +bool HylaFAXServer::sendITIFFData(TIFF* tif, int fdout) { uint32* sb; @@ -429,7 +429,7 @@ HylaFAXServer::sendITIFFData(TIFF* tif, int fdout) } if (buf == NULL) { reply(551, "Error allocating intermediate buffer"); - return (FALSE); + return (false); } if (TIFFReadRawStrip(tif, s, buf, cc) != cc) { reply(551, "Error reading input file at strip %u", s); @@ -442,10 +442,10 @@ HylaFAXServer::sendITIFFData(TIFF* tif, int fdout) byte_count += cc; } _TIFFfree(buf); - return (TRUE); + return (true); bad: _TIFFfree(buf); - return (FALSE); + return (false); } const char* @@ -518,7 +518,7 @@ HylaFAXServer::storeCmd(const char* name, const char* mode) * be shared across multiple sessions. */ void -HylaFAXServer::storeUniqueCmd(fxBool isTemp) +HylaFAXServer::storeUniqueCmd(bool isTemp) { fxStr emsg; u_int seqnum = getDocumentNumbers(1, emsg); @@ -562,13 +562,13 @@ HylaFAXServer::storeUniqueCmd(fxBool isTemp) /* * Tranfer the contents of "fdin" to "fdout". */ -fxBool +bool HylaFAXServer::sendData(FILE* fdin, FILE* fdout) { state |= S_TRANSFER; if (setjmp(urgcatch) != 0) { state &= ~S_TRANSFER; - return (FALSE); + return (false); } #define PACK(a,b) (((a)<<8)|(b)) switch (PACK(type,mode)) { @@ -576,14 +576,14 @@ HylaFAXServer::sendData(FILE* fdin, FILE* fdout) case PACK(TYPE_L,MODE_S): if (sendIData(fileno(fdin), fileno(fdout))) { state &= ~S_TRANSFER; - return (TRUE); + return (true); } break; case PACK(TYPE_I,MODE_Z): case PACK(TYPE_L,MODE_Z): if (sendZData(fileno(fdin), fileno(fdout))) { state &= ~S_TRANSFER; - return (TRUE); + return (true); } break; case PACK(TYPE_A,MODE_S): @@ -600,7 +600,7 @@ HylaFAXServer::sendData(FILE* fdin, FILE* fdout) break; } state &= ~S_TRANSFER; - return (TRUE); + return (true); } byte_count++; if (c == '\n') { // \n -> \r\n @@ -622,17 +622,17 @@ HylaFAXServer::sendData(FILE* fdin, FILE* fdout) } #undef PACK state &= ~S_TRANSFER; - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::sendIData(int fdin, int fdout) { char buf[16*1024]; for (;;) { int cc = read(fdin, buf, sizeof (buf)); if (cc == 0) - return (TRUE); + return (true); if (cc < 0) { perror_reply(551, "Error reading input file", errno); break; @@ -643,10 +643,10 @@ HylaFAXServer::sendIData(int fdin, int fdout) } byte_count += cc; } - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::sendZData(int fdin, int fdout) { z_stream zstream; @@ -709,24 +709,24 @@ HylaFAXServer::sendZData(int fdin, int fdout) } } while (state != Z_STREAM_END); deflateEnd(&zstream); - return (TRUE); + return (true); bad: deflateEnd(&zstream); } else reply(452, "Can not initialize compression library: %s", zstream.msg); - return (FALSE); + return (false); } /* * Transfer data from peer to file. */ -fxBool +bool HylaFAXServer::recvData(FILE* fdin, FILE* fdout) { state |= S_TRANSFER; if (setjmp(urgcatch) != 0) { state &= ~S_TRANSFER; - return (FALSE); + return (false); } #define PACK(a,b) (((a)<<8)|(b)) switch (PACK(type,mode)) { @@ -734,14 +734,14 @@ HylaFAXServer::recvData(FILE* fdin, FILE* fdout) case PACK(TYPE_L,MODE_S): if (recvIData(fileno(fdin), fileno(fdout))) { state &= ~S_TRANSFER; - return (TRUE); + return (true); } break; case PACK(TYPE_I,MODE_Z): case PACK(TYPE_L,MODE_Z): if (recvZData(fileno(fdin), fileno(fdout))) { state &= ~S_TRANSFER; - return (TRUE); + return (true); } break; case PACK(TYPE_A,MODE_S): @@ -758,7 +758,7 @@ HylaFAXServer::recvData(FILE* fdin, FILE* fdout) break; } state &= ~S_TRANSFER; - return (TRUE); + return (true); } byte_count++; if (c == '\r') { // \r\n -> \n @@ -786,17 +786,17 @@ HylaFAXServer::recvData(FILE* fdin, FILE* fdout) } #undef PACK state &= ~S_TRANSFER; - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::recvIData(int fdin, int fdout) { char buf[16*1024]; // XXX better if page-aligned for (;;) { int cc = read(fdin, buf, sizeof (buf)); if (cc == 0) - return (TRUE); + return (true); if (cc < 0) { perror_reply(426, "Data Connection", errno); break; @@ -807,10 +807,10 @@ HylaFAXServer::recvIData(int fdin, int fdout) } byte_count += cc; } - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::recvZData(int fdin, int fdout) { z_stream zstream; @@ -832,7 +832,7 @@ HylaFAXServer::recvZData(int fdin, int fdout) break; } (void) inflateEnd(&zstream); - return (TRUE); + return (true); } if (cc < 0) { perror_reply(426, "Data Connection", errno); @@ -862,7 +862,7 @@ bad: (void) inflateEnd(&zstream); } else reply(452, "Can not initialize decoder: %s", zstream.msg); - return (FALSE); + return (false); } void diff --git a/hfaxd/HylaFAXServer.c++ b/hfaxd/HylaFAXServer.c++ index da493d61..66502db5 100644 --- a/hfaxd/HylaFAXServer.c++ +++ b/hfaxd/HylaFAXServer.c++ @@ -193,7 +193,7 @@ HylaFAXServer::open(void) dologout(-1); } ctrlFlags = fcntl(STDIN_FILENO, F_GETFL); // for parser - if (isShutdown(TRUE)) + if (isShutdown(true)) reply(220, "%s HylaFAX server shut down; available only for admin use.", (const char*) hostname); else @@ -273,10 +273,10 @@ HylaFAXServer::fixPathname(const char* file) return (!IS(LOGGEDIN) && file[0] == '/' ? file+1 : file); } -fxBool +bool HylaFAXServer::readShutdownFile(void) { - fxBool ok = FALSE; + bool ok = false; FILE* fd = fopen(fixPathname(shutdownFile), "r"); if (fd != NULL) { struct tm tm; @@ -297,7 +297,7 @@ HylaFAXServer::readShutdownFile(void) char buf[1024]; while (fgets(buf, sizeof (buf), fd)) shutdownMsg.append(buf); - ok = TRUE; + ok = true; } else logError("%s: Invalid shutdown time, mktime conversion failed;" "Year=%d Mon=%d Day=%d Hour=%d Min=%d" @@ -318,22 +318,22 @@ HylaFAXServer::readShutdownFile(void) return (ok); } -fxBool -HylaFAXServer::isShutdown(fxBool quiet) +bool +HylaFAXServer::isShutdown(bool quiet) { struct stat sb; if (shutdownFile == "" || Sys::stat(fixPathname(shutdownFile), sb) < 0) - return (FALSE); + return (false); if (sb.st_mtime != lastModTime) { if (!readShutdownFile()) - return (FALSE); + return (false); lastModTime = sb.st_mtime; } time_t now = Sys::now(); if (!quiet) { // possibly send client shutdown msg time_t timeToDisconnect = discTime - now; time_t lastMsg = now-lastTime; - fxBool sendShutDownMsg = + bool sendShutDownMsg = (lastTime == 0) // first time || (timeToDisconnect < 60) // <60 seconds, warn continuously // <15 minutes, warn ever 5 minutes @@ -650,7 +650,7 @@ HylaFAXServer::configTrace(const char* fmt, ...) } } -fxBool +bool HylaFAXServer::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -662,7 +662,7 @@ HylaFAXServer::setConfigItem(const char* tag, const char* value) } else if (findTag(tag, (const tags*) numbers, N(numbers), ix)) { (*this).*numbers[ix].p = getNumber(value); } else - return (FALSE); - return (TRUE); + return (false); + return (true); } #undef N diff --git a/hfaxd/HylaFAXServer.h b/hfaxd/HylaFAXServer.h index f5dfe92e..f76b435c 100644 --- a/hfaxd/HylaFAXServer.h +++ b/hfaxd/HylaFAXServer.h @@ -50,12 +50,12 @@ */ struct Job : public FaxRequest { time_t lastmod; // last file modify time, for updates - fxBool queued; // for SNPP + bool queued; // for SNPP Job(const fxStr& qf, int fd = -1); ~Job(); - fxBool checkDocument(const char* pathname); + bool checkDocument(const char* pathname); }; fxDECLARE_StrKeyDictionary(JobDict, Job*) @@ -63,7 +63,7 @@ fxDECLARE_StrKeyDictionary(JobDict, Job*) * Received facsimile information. */ struct RecvInfo : public FaxRecvInfo { - fxBool beingReceived; // currently being received + bool beingReceived; // currently being received time_t recvTime; // time receive operation started RecvInfo(); @@ -131,8 +131,8 @@ enum Token { struct tab { // protocol command table entry const char* name; Token token; - fxBool checklogin; // if TRUE, must be logged in first - fxBool implemented; // FALSE if command is not implemented + bool checklogin; // if true, must be logged in first + bool implemented; // false if command is not implemented const char* help; }; @@ -148,11 +148,11 @@ class HylaFAXServer; */ struct SpoolDir { const char* pathname; - fxBool adminOnly; // accessible by unprivileged clients - fxBool storAble; // unprivileged clients may STOR files - fxBool deleAble; // unprivileged clients may DELE files + bool adminOnly; // accessible by unprivileged clients + bool storAble; // unprivileged clients may STOR files + bool deleAble; // unprivileged clients may DELE files ino_t ino; // directory inode number - fxBool (*isVisibleFile)(const char*, const struct stat&); + bool (*isVisibleFile)(const char*, const struct stat&); void (HylaFAXServer::*listDirectory)(FILE*, const SpoolDir&, DIR*); void (HylaFAXServer::*listFile)(FILE*, const SpoolDir&, const char*, const struct stat&); @@ -316,7 +316,7 @@ protected: void listCmd(const char* name); // LIST void nlstCmd(const char* name); // NLST void storeCmd(const char*, const char*);// STOR+APPE - void storeUniqueCmd(fxBool isTemp); // STOU+STOT + void storeUniqueCmd(bool isTemp); // STOU+STOT void statFileCmd(const char* name); // STAT void chownCmd(const char*, const char*);// CHOWN void chmodCmd(const char*, u_int); // CHMOD @@ -342,8 +342,8 @@ protected: void configCmd(const char* where, const char* info); virtual void initServer(void); - fxBool readShutdownFile(void); - fxBool isShutdown(fxBool quiet); + bool readShutdownFile(void); + bool isShutdown(bool quiet); void fatal(const char *fmt, ...); void reply(int code, const char* fmt, ...); void vreply(int code, const char* fmt, va_list ap); @@ -356,21 +356,21 @@ protected: void setFileOwner(const char* filename); void loginRefused(const char* why); - fxBool checkUser(const char*); - fxBool checkuser(FILE*, const char *name); + bool checkUser(const char*); + bool checkuser(FILE*, const char *name); void login(void); void end_login(void); virtual void dologout(int status); const char* fixPathname(const char* file); const char* userName(u_int uid); - fxBool userID(const char*, u_int& id); + bool userID(const char*, u_int& id); void fillIDCache(void); - fxBool cvtPasswd(const char* type, const char* pass, fxStr& result); - fxBool findUser(FILE* db, const char* user, u_int& newuid); - fxBool addUser(FILE* db, const char* user, u_int uid, + bool cvtPasswd(const char* type, const char* pass, fxStr& result); + bool findUser(FILE* db, const char* user, u_int& newuid); + bool addUser(FILE* db, const char* user, u_int uid, const char* upass, const char* apass); - fxBool deleteUser(FILE* db, const char* user); + bool deleteUser(FILE* db, const char* user); /* * Configuration file support. @@ -382,9 +382,9 @@ protected: void setupConfig(); void configError(const char* fmt, ...); void configTrace(const char* fmt, ...); - fxBool setConfigItem(const char* tag, const char* value); + bool setConfigItem(const char* tag, const char* value); - fxBool restartSend(FILE* fd, off_t marker); + bool restartSend(FILE* fd, off_t marker); static SpoolDir dirs[]; @@ -393,13 +393,13 @@ protected: static SpoolDir* dirLookup(ino_t ino); SpoolDir* dirAccess(const char* path); SpoolDir* fileAccess(const char* path, int op, struct stat&); - fxBool fileVisible(const SpoolDir&, const char*, const struct stat&); + bool fileVisible(const SpoolDir&, const char*, const struct stat&); - static fxBool isVisibleRecvQFile(const char*, const struct stat&); + static bool isVisibleRecvQFile(const char*, const struct stat&); void listRecvQ(FILE* fd, const SpoolDir& sd, DIR* dir); void listRecvQFile(FILE*, const SpoolDir&, const char*, const struct stat&); - static fxBool isVisibleSendQFile(const char*, const struct stat&); + static bool isVisibleSendQFile(const char*, const struct stat&); void listSendQ(FILE* fd, const SpoolDir& sd, DIR* dir); void listSendQFile(FILE*, const SpoolDir&, const char*, const struct stat&); void nlstSendQ(FILE* fd, const SpoolDir& sd, DIR* dir); @@ -409,13 +409,13 @@ protected: void listStatusFile(FILE*, const SpoolDir&, const char*, const struct stat&); void nlstStatus(FILE* fd, const SpoolDir& sd, DIR* dir); - static fxBool isVisibleTRUE(const char*, const struct stat&); - static fxBool isVisibleDocQFile(const char*, const struct stat&); - static fxBool isVisibleRootFile(const char*, const struct stat&); + static bool isVisibletrue(const char*, const struct stat&); + static bool isVisibleDocQFile(const char*, const struct stat&); + static bool isVisibleRootFile(const char*, const struct stat&); void listDirectory(FILE* fd, const SpoolDir& sd, DIR* dir); void listUnixFile(FILE*, const SpoolDir&, const char*, const struct stat&); - void makeProt(const struct stat& sb, fxBool withGrp, char prot[10]); + void makeProt(const struct stat& sb, bool withGrp, char prot[10]); void Fprintf(FILE*, const char* fmt, const char*, const struct stat&); void nlstDirectory(FILE* fd, const SpoolDir& sd, DIR* dir); @@ -425,64 +425,64 @@ protected: static const char* dataConnMsg(int code); virtual void closeDataConn(FILE*); - fxBool sendData(FILE* fdin, FILE* fdout); - fxBool sendIData(int fdin, int fdout); - fxBool sendZData(int fdin, int fdout); - fxBool recvData(FILE* instr, FILE* outstr); - fxBool recvIData(int fdin, int fdout); - fxBool recvZData(int fdin, int fdout); + bool sendData(FILE* fdin, FILE* fdout); + bool sendIData(int fdin, int fdout); + bool sendZData(int fdin, int fdout); + bool recvData(FILE* instr, FILE* outstr); + bool recvIData(int fdin, int fdout); + bool recvZData(int fdin, int fdout); TIFF* openTIFF(const char* name); - fxBool sendTIFFData(TIFF* tif, FILE* fdout); - fxBool sendTIFFHeader(TIFF* tif, int fdout); - fxBool sendITIFFData(TIFF* tif, int fdout); + bool sendTIFFData(TIFF* tif, FILE* fdout); + bool sendTIFFHeader(TIFF* tif, int fdout); + bool sendITIFFData(TIFF* tif, int fdout); void logTransfer(const char*, const SpoolDir&, const char*, time_t); virtual int parse(void); - fxBool cmd(Token t); - fxBool site_cmd(Token t); - fxBool param_cmd(Token t); - fxBool string_param(fxStr&, const char* what = NULL); - fxBool number_param(long&); - fxBool boolean_param(fxBool&); - fxBool file_param(fxStr& pathname); - fxBool pwd_param(fxStr& s); - fxBool timespec_param(int ndigits, time_t& t); - fxBool pathname_param(fxStr& pathname); - fxBool job_param(fxStr& jid); - fxBool jgrp_param(fxStr& jgid); - fxBool pathname(fxStr& s); - fxBool CRLF(); - fxBool SP(); - fxBool COMMA(); - fxBool TIMESPEC(u_int len, time_t& result); - fxBool BOOLEAN(fxBool& b); - fxBool STRING(fxStr& s, const char* what = NULL); - fxBool NUMBER(long& n); - fxBool checkNUMBER(const char* s); - fxBool opt_CRLF(); - fxBool opt_STRING(fxStr& s); - fxBool multi_STRING(fxStr& s); + bool cmd(Token t); + bool site_cmd(Token t); + bool param_cmd(Token t); + bool string_param(fxStr&, const char* what = NULL); + bool number_param(long&); + bool boolean_param(bool&); + bool file_param(fxStr& pathname); + bool pwd_param(fxStr& s); + bool timespec_param(int ndigits, time_t& t); + bool pathname_param(fxStr& pathname); + bool job_param(fxStr& jid); + bool jgrp_param(fxStr& jgid); + bool pathname(fxStr& s); + bool CRLF(); + bool SP(); + bool COMMA(); + bool TIMESPEC(u_int len, time_t& result); + bool BOOLEAN(bool& b); + bool STRING(fxStr& s, const char* what = NULL); + bool NUMBER(long& n); + bool checkNUMBER(const char* s); + bool opt_CRLF(); + bool opt_STRING(fxStr& s); + bool multi_STRING(fxStr& s); static u_int twodigits(const char* cp, u_int range); static u_int fourdigits(const char* cp); virtual void syntaxError(const char* msg); virtual void netStatus(FILE*) = 0; // depends on transport - virtual fxBool hostPort() = 0; // depends on transport + virtual bool hostPort() = 0; // depends on transport - int getChar(fxBool waitForInput); + int getChar(bool waitForInput); void pushCmdData(const char* data, int n); - fxBool getCmdLine(char* s, int n, fxBool waitForInput = FALSE); + bool getCmdLine(char* s, int n, bool waitForInput = false); void pushToken(Token t); Token nextToken(void); - fxBool checkToken(Token); - fxBool getToken(Token, const char*); + bool checkToken(Token); + bool getToken(Token, const char*); void helpCmd(const tab* ctab, const char* s); void logcmd(Token t, const char* fmt = NULL, ...); void cmdFailure(Token t, const char* why); - fxBool checklogin(Token); - fxBool checkadmin(Token); + bool checklogin(Token); + bool checkadmin(Token); static const char* version; @@ -490,19 +490,19 @@ protected: virtual const char* siteToken(Token t); static const char* parmToken(Token t); - fxBool initClientFIFO(fxStr& emsg); + bool initClientFIFO(fxStr& emsg); int FIFOInput(int fd); void FIFOMessage(const char* cp, u_int len); - fxBool sendModem(const char* modem, fxStr& emsg, const char* fmt ...); - fxBool sendQueuerMsg(fxStr& emsg, const fxStr& msg); - fxBool sendQueuer(fxStr& emsg, const char* fmt ...); - fxBool sendQueuerACK(fxStr& emsg, const char* fmt, ...); - fxBool vsendQueuerACK(fxStr& emsg, const char* fmt, va_list ap); - - fxBool newTrigger(fxStr& emsg, const char* fmt, ...); - fxBool vnewTrigger(fxStr& emsg, const char* fmt, va_list ap); - fxBool loadTrigger(fxStr& emsg); - fxBool cancelTrigger(fxStr& emsg); + bool sendModem(const char* modem, fxStr& emsg, const char* fmt ...); + bool sendQueuerMsg(fxStr& emsg, const fxStr& msg); + bool sendQueuer(fxStr& emsg, const char* fmt ...); + bool sendQueuerACK(fxStr& emsg, const char* fmt, ...); + bool vsendQueuerACK(fxStr& emsg, const char* fmt, va_list ap); + + bool newTrigger(fxStr& emsg, const char* fmt, ...); + bool vnewTrigger(fxStr& emsg, const char* fmt, va_list ap); + bool loadTrigger(fxStr& emsg); + bool cancelTrigger(fxStr& emsg); void triggerEvent(const TriggerMsgHeader& h, const char* data); void logEventMsg(const TriggerMsgHeader&h, fxStr& msg); void logJobEventMsg(const TriggerMsgHeader&, const JobExt&); @@ -514,30 +514,30 @@ protected: virtual void initDefaultJob(void); void parmBotch(Token t); - fxBool checkAccess(const Job& job, Token t, u_int op); - fxBool checkParm(Job&, Token t, u_int op); - fxBool checkJobState(Job*); + bool checkAccess(const Job& job, Token t, u_int op); + bool checkParm(Job&, Token t, u_int op); + bool checkJobState(Job*); void replyJobParamValue(Job&, int code, Token t); - void replyBoolean(int code, fxBool b); - fxBool setValue(u_short& v, const char* value, const char* what, + void replyBoolean(int code, bool b); + bool setValue(u_short& v, const char* value, const char* what, const char* valNames[], u_int nValNames); void flushPreparedDocuments(Job& job); - fxBool setJobParameter(Job&, Token t, const fxStr& value); - fxBool setJobParameter(Job&, Token t, u_short value); - fxBool setJobParameter(Job&, Token t, time_t value); - fxBool setJobParameter(Job&, Token t, fxBool b); - fxBool setJobParameter(Job&, Token t, float value); - fxBool docType(const char* docname, FaxSendOp& op); - fxBool checkAddDocument(Job&, Token type, const char* docname, FaxSendOp&); + bool setJobParameter(Job&, Token t, const fxStr& value); + bool setJobParameter(Job&, Token t, u_short value); + bool setJobParameter(Job&, Token t, time_t value); + bool setJobParameter(Job&, Token t, bool b); + bool setJobParameter(Job&, Token t, float value); + bool docType(const char* docname, FaxSendOp& op); + bool checkAddDocument(Job&, Token type, const char* docname, FaxSendOp&); void addCoverDocument(Job&, const char* docname); void addDocument(Job&, const char* docname); void addPollOp(Job&, const char* sep, const char* pwd); void newJobCmd(void); - fxBool newJob(fxStr& emsg); + bool newJob(fxStr& emsg); Job* findJob(const char* jobid, fxStr& emsg); Job* findJobInMemmory(const char* jobid); Job* findJobOnDisk(const char* jobid, fxStr& emsg); - fxBool updateJobFromDisk(Job& job); + bool updateJobFromDisk(Job& job); void replyCurrentJob(const char* leader); void setCurrentJob(const char* jobid); Job* preJobCmd(const char* op, const char* jobid, fxStr& emsg); @@ -550,9 +550,9 @@ protected: void suspendJob(const char* jobid); void submitJob(const char* jobid); void waitForJob(const char* jobid); - fxBool updateJobOnDisk(Job& req, fxStr& emsg); - fxBool lockJob(Job& job, int how, fxStr& emsg); - fxBool lockJob(Job& job, int how); + bool updateJobOnDisk(Job& req, fxStr& emsg); + bool lockJob(Job& job, int how, fxStr& emsg); + bool lockJob(Job& job, int how); void unlockJob(Job& job); #ifdef OLDPROTO_SUPPORT void readJobs(void); @@ -568,7 +568,7 @@ protected: u_int getJobNumber(fxStr&); u_int getDocumentNumbers(u_int count, fxStr&); - fxBool getRecvDocStatus(RecvInfo& ri); + bool getRecvDocStatus(RecvInfo& ri); RecvInfo* getRecvInfo(const fxStr& qfile, const struct stat& sb); const char* compactRecvTime(time_t t); void Rprintf(FILE*, const char*, const RecvInfo&, const struct stat&); diff --git a/hfaxd/InetFaxServer.c++ b/hfaxd/InetFaxServer.c++ index 4fa9d326..b90cdf4d 100644 --- a/hfaxd/InetFaxServer.c++ +++ b/hfaxd/InetFaxServer.c++ @@ -46,7 +46,7 @@ InetSuperServer::InetSuperServer(const char* p, int bl) {} InetSuperServer::~InetSuperServer() {} -fxBool +bool InetSuperServer::startServer(void) { int s = socket(AF_INET, SOCK_STREAM, 0); @@ -66,14 +66,14 @@ InetSuperServer::startServer(void) if (Socket::bind(s, &sin, sizeof (sin)) >= 0) { (void) listen(s, getBacklog()); Dispatcher::instance().link(s, Dispatcher::ReadMask, this); - return (TRUE); // success + return (true); // success } Sys::close(s); logError("HylaFAX %s: bind (port %u): %m", getKind(), ntohs(sin.sin_port)); } else logError("HylaFAX %s: socket: %m", getKind()); - return (FALSE); + return (false); } HylaFAXServer* InetSuperServer::newChild(void) { return new InetFaxServer; } @@ -81,7 +81,7 @@ InetFaxServer* InetFaxServer::_instance = NULL; InetFaxServer::InetFaxServer() { - usedefault = TRUE; + usedefault = true; swaitmax = 90; // wait at most 90 seconds swaitint = 5; // interval between retries @@ -110,7 +110,7 @@ void InetFaxServer::initServer(void) { HylaFAXServer::initServer(); - usedefault = TRUE; + usedefault = true; } void @@ -148,7 +148,7 @@ topDomain(const fxStr& h) * assume that the host is local, as it will be * interpreted as such. */ -fxBool +bool InetFaxServer::isLocalDomain(const fxStr& h) { const char* p1 = topDomain(hostname); @@ -164,23 +164,23 @@ InetFaxServer::isLocalDomain(const fxStr& h) * look up the name and check that the peer's address * corresponds to the host name. */ -fxBool +bool InetFaxServer::checkHostIdentity(hostent*& hp) { if (!isLocalDomain(hp->h_name)) // not local, don't check - return (TRUE); + return (true); fxStr name(hp->h_name); // must copy static value hp = Socket::gethostbyname(name); if (hp) { for (const char** cpp = (const char**) hp->h_addr_list; *cpp; cpp++) if (memcmp(*cpp, &peer_addr.sin_addr, hp->h_length) == 0) - return (TRUE); + return (true); reply(130, "Warning, client address \"%s\" is not listed for host name \"%s\".", (const char*) remoteaddr, hp->h_name); } else reply(130, "Warning, no inverse address mapping for client host name \"%s\".", (const char*) name); - return (FALSE); + return (false); } void @@ -302,7 +302,7 @@ InetFaxServer::lostConnection(void) } void InetFaxServer::sigPIPE(int) { InetFaxServer::instance().lostConnection(); } -static fxBool +static bool setupPassiveDataSocket(int pdata, struct sockaddr_in& pasv_addr) { socklen_t len = sizeof (pasv_addr); @@ -400,7 +400,7 @@ bad: return (NULL); } -fxBool +bool InetFaxServer::dataConnect(void) { return Socket::connect(data, &data_dest,sizeof (data_dest)) >= 0; @@ -464,12 +464,12 @@ InetFaxServer::openDataConn(const char* mode, int& code) return (file); } -fxBool +bool InetFaxServer::hostPort() { long a0, a1, a2, a3; long p0, p1; - fxBool syntaxOK = + bool syntaxOK = NUMBER(a0) && COMMA() && NUMBER(a1) && COMMA() && NUMBER(a2) @@ -482,16 +482,16 @@ InetFaxServer::hostPort() u_char* p = (u_char*) &data_dest.sin_port; a[0] = UC(a0); a[1] = UC(a1); a[2] = UC(a2); a[3] = UC(a3); p[0] = UC(p0); p[1] = UC(p1); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } void InetFaxServer::portCmd(void) { logcmd(T_PORT, "%s;%u", inet_ntoa(data_dest.sin_addr), data_dest.sin_port); - usedefault = FALSE; + usedefault = false; if (pdata >= 0) (void) Sys::close(pdata), pdata = -1; ack(200, cmdToken(T_PORT)); diff --git a/hfaxd/InetFaxServer.h b/hfaxd/InetFaxServer.h index 8d5659d5..d70b876d 100644 --- a/hfaxd/InetFaxServer.h +++ b/hfaxd/InetFaxServer.h @@ -40,7 +40,7 @@ protected: sockaddr_in data_source; // source of data connection sockaddr_in data_dest; // destination of data connection sockaddr_in pasv_addr; // local end of passive connections - fxBool usedefault; // for data transfers + bool usedefault; // for data transfers /* * Timeout intervals for retrying connections * to hosts that don't accept PORT cmds. @@ -48,8 +48,8 @@ protected: int swaitmax; // wait at most 90 seconds int swaitint; // interval between retries - fxBool isLocalDomain(const fxStr& h); - fxBool checkHostIdentity(hostent*& hp); + bool isLocalDomain(const fxStr& h); + bool checkHostIdentity(hostent*& hp); void setupNetwork(int fd); void handleUrgentData(void); void passiveCmd(void); @@ -61,10 +61,10 @@ protected: void netStatus(FILE*); void printaddr(FILE*, const char* leader, const struct sockaddr_in& sin); - fxBool hostPort(); + bool hostPort(); void portCmd(void); - fxBool dataConnect(void); + bool dataConnect(void); FILE* getDataSocket(const char* mode); FILE* openDataConn(const char* mode, int& code); @@ -86,7 +86,7 @@ class InetSuperServer : public SuperServer { private: fxStr port; protected: - fxBool startServer(void); + bool startServer(void); HylaFAXServer* newChild(void); public: InetSuperServer(const char* port, int backlog = 5); diff --git a/hfaxd/Jobs.c++ b/hfaxd/Jobs.c++ index 4ab81732..4a97d679 100644 --- a/hfaxd/Jobs.c++ +++ b/hfaxd/Jobs.c++ @@ -40,7 +40,7 @@ Job::Job(const fxStr& qf, int f) : FaxRequest(qf,f) { lastmod = 0; - queued = FALSE; + queued = false; } Job::~Job() {} @@ -53,7 +53,7 @@ Job::~Job() {} * check for ``..'' and ``/'' being used to reference * files outside the spooling area. */ -fxBool +bool Job::checkDocument(const char* pathname) { struct stat sb; @@ -154,7 +154,7 @@ static const struct { * ownership is based on login account and not fax uid; * this may need to be rethought. */ -fxBool +bool HylaFAXServer::checkAccess(const Job& job, Token t, u_int op) { u_int n = N(params)-1; @@ -163,12 +163,12 @@ HylaFAXServer::checkAccess(const Job& job, Token t, u_int op) i++; u_int m = params[i].protect; if (m&op) // other/public access - return (TRUE); + return (true); if (IS(PRIVILEGED) && ((m>>3)&op)) // administrative access - return (TRUE); + return (true); if (job.owner == the_user && ((m>>6)&op)) // owner access - return (TRUE); - return (FALSE); + return (true); + return (false); } static const struct { @@ -263,12 +263,12 @@ static const char* docTypeNames[] = { }; static const char* -boolString(fxBool b) +boolString(bool b) { return (b ? "YES" : "NO"); } void -HylaFAXServer::replyBoolean(int code, fxBool b) +HylaFAXServer::replyBoolean(int code, bool b) { reply(code, "%s", boolString(b)); } @@ -281,7 +281,7 @@ HylaFAXServer::replyBoolean(int code, fxBool b) * and send the client an error reply. This method is used * before each place a job's state is access. */ -fxBool +bool HylaFAXServer::checkJobState(Job* job) { /* @@ -295,13 +295,13 @@ HylaFAXServer::checkJobState(Job* job) if (job == curJob) // make default job current curJob = &defJob; delete job, job = NULL; - return (FALSE); + return (false); } if (job->lastmod < sb.st_mtime) { (void) updateJobFromDisk(*job); job->lastmod = sb.st_mtime; } - return (TRUE); + return (true); } /* @@ -312,25 +312,25 @@ HylaFAXServer::checkJobState(Job* job) * could be lost (in our case they will be lost due to the * way that things work). */ -fxBool +bool HylaFAXServer::checkParm(Job& job, Token t, u_int op) { if (!checkJobState(&job)) { // insure consistent state reply(500, "Cannot access job %s state; job deleted by another party.", (const char*) job.jobid); - return (FALSE); + return (false); } else if (!checkAccess(job, t, op)) { reply(503, "Permission denied: no %s access to job parameter %s." , (op == A_READ ? "read" : "write") , parmToken(t) ); - return (FALSE); + return (false); } else if ((op & (A_WRITE|A_MODIFY)) && job.state != FaxRequest::state_suspended && job.jobid != "default") { reply(503, "Suspend the job with JSUSP first."); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* @@ -572,17 +572,17 @@ HylaFAXServer::jstatCmd(const Job& job) * array. Parameter names are case-insensitive. * Unknown values cause an error reply. */ -fxBool +bool HylaFAXServer::setValue(u_short& v, const char* value, const char* what, const char* valNames[], u_int nValNames) { for (u_int i = 0; i < nValNames; i++) if (strcasecmp(value, valNames[i]) == 0) { v = i; - return (TRUE); + return (true); } reply(503, "Unknown %s value %s.", what, value); - return (FALSE); + return (false); } void @@ -619,7 +619,7 @@ HylaFAXServer::flushPreparedDocuments(Job& job) /* * Set a job state parameter that has a string value. */ -fxBool +bool HylaFAXServer::setJobParameter(Job& job, Token t, const fxStr& value) { if (checkParm(job, t, A_WRITE|A_MODIFY)) { @@ -631,31 +631,31 @@ HylaFAXServer::setJobParameter(Job& job, Token t, const fxStr& value) if (setValue(job.pagechop, value, parmToken(t), chopVals, N(chopVals))) { job.pagehandling = ""; // force recalculation - return (TRUE); + return (true); } else - return (FALSE); + return (false); case T_DATAFORMAT: if (setValue(job.desireddf, value, parmToken(t), dataVals, N(dataVals))) { flushPreparedDocuments(job); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } for (u_int i = 0, n = N(strvals); i < n; i++) if (strvals[i].t == t) { job.*strvals[i].p = value; - return (TRUE); + return (true); } parmBotch(t); } - return (FALSE); + return (false); } /* * Set a job state parameter that has a integer value. */ -fxBool +bool HylaFAXServer::setJobParameter(Job& job, Token t, u_short value) { if (checkParm(job, t, A_WRITE|A_MODIFY)) { @@ -679,17 +679,17 @@ HylaFAXServer::setJobParameter(Job& job, Token t, u_short value) break; } } - return (TRUE); + return (true); } parmBotch(t); } - return (FALSE); + return (false); } /* * Set a job state parameter that has a time value. */ -fxBool +bool HylaFAXServer::setJobParameter(Job& job, Token t, time_t value) { if (checkParm(job, t, A_WRITE|A_MODIFY)) { @@ -699,12 +699,12 @@ HylaFAXServer::setJobParameter(Job& job, Token t, time_t value) if (value != 0) { // explicit time if (value < now) { reply(503, "Bad time to send; time in the past."); // XXX - return (FALSE); + return (false); } job.tts = value; } else // ``NOW'' job.tts = now; - return (TRUE); + return (true); case T_LASTTIME: /* * Convert client-specified kill time (as a relative number) @@ -716,43 +716,43 @@ HylaFAXServer::setJobParameter(Job& job, Token t, time_t value) * value may be installed for LASTTIME. */ job.killtime = value + (job.tts == 0 ? now : job.tts); - return (TRUE); + return (true); case T_RETRYTIME: job.retrytime = value; - return (TRUE); + return (true); } parmBotch(t); } - return (FALSE); + return (false); } /* * Set a job state parameter that has a boolean value. */ -fxBool -HylaFAXServer::setJobParameter(Job& job, Token t, fxBool b) +bool +HylaFAXServer::setJobParameter(Job& job, Token t, bool b) { if (checkParm(job, t, A_WRITE|A_MODIFY)) { switch (t) { case T_USE_ECM: job.desiredec = b; - return (TRUE); + return (true); case T_USE_TAGLINE: job.desiredtl = b; - return (TRUE); + return (true); case T_USE_CONTCOVER: job.useccover = b; - return (TRUE); + return (true); } parmBotch(t); } - return (TRUE); + return (true); } /* * Set a job state parameter that has a float value. */ -fxBool +bool HylaFAXServer::setJobParameter(Job& job, Token t, float value) { if (checkParm(job, t, A_WRITE|A_MODIFY)) { @@ -762,11 +762,11 @@ HylaFAXServer::setJobParameter(Job& job, Token t, float value) job.chopthreshold = value; job.pagehandling = ""; // force recalculation } - return (TRUE); + return (true); } parmBotch(t); } - return (FALSE); + return (false); } /* @@ -792,8 +792,8 @@ HylaFAXServer::initDefaultJob(void) defJob.desiredst = ST_0MS; defJob.desiredec = EC_ENABLE; defJob.desireddf = DF_2DMMR; - defJob.desiredtl = FALSE; - defJob.useccover = TRUE; + defJob.desiredtl = false; + defJob.useccover = true; defJob.pagechop = FaxRequest::chop_default; defJob.notify = FaxRequest::no_notice;// FAX_DEFNOTIFY defJob.chopthreshold= 3.0; @@ -845,16 +845,16 @@ HylaFAXServer::newJobCmd(void) * information in dial strings and passwords to be * transmitted with polling requests. */ -fxBool +bool HylaFAXServer::newJob(fxStr& emsg) { if (!IS(PRIVILEGED) && the_user != curJob->owner) { emsg = "Permission denied; cannot inherit from job " | curJob->jobid; - return (FALSE); + return (false); } u_int id = getJobNumber(emsg); // allocate unique job ID if (id == (u_int) -1) - return (FALSE); + return (false); fxStr jobid = fxStr::format("%u", id); Job* job = new Job(FAX_SENDDIR "/" FAX_QFILEPREF | jobid); job->jobid = jobid; @@ -898,22 +898,22 @@ HylaFAXServer::newJob(fxStr& emsg) job->queued = curJob->queued; jobs[jobid] = job; curJob = job; - return (TRUE); + return (true); } /* * Update the job's state on disk. */ -fxBool +bool HylaFAXServer::updateJobOnDisk(Job& job, fxStr& emsg) { if (lockJob(job, LOCK_EX|LOCK_NB, emsg)) { // XXX don't update in place, use temp file and rename job.writeQFile(); unlockJob(job); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* @@ -957,7 +957,7 @@ HylaFAXServer::findJobOnDisk(const char* jid, fxStr& emsg) if (fd >= 0) { // XXX should we lock here??? Job* req = new Job(&filename[1], fd); - fxBool reject; + bool reject; if (req->readQFile(reject) && !reject) { Sys::close(req->fd), req->fd = -1; return (req); @@ -973,12 +973,12 @@ HylaFAXServer::findJobOnDisk(const char* jid, fxStr& emsg) /* * Update a job's state from the on-disk copy. */ -fxBool +bool HylaFAXServer::updateJobFromDisk(Job& job) { - fxBool status = FALSE; + bool status = false; if (lockJob(job, LOCK_SH|LOCK_NB)) { - fxBool reject; + bool reject; status = (job.reReadQFile(reject) && !reject); unlockJob(job); } @@ -991,28 +991,28 @@ HylaFAXServer::updateJobFromDisk(Job& job) * occurs a descriptive message is returned for * transmission to the client. */ -fxBool +bool HylaFAXServer::lockJob(Job& job, int how, fxStr& emsg) { if (job.fd < 0) { job.fd = Sys::open("/" | job.qfile, O_RDWR|O_CREAT, 0600); if (job.fd < 0) { emsg = "Cannot open/create job description file /" | job.qfile; - return (FALSE); + return (false); } } if (flock(job.fd, how) < 0) { emsg = fxStr::format("Job file lock failed: %s", strerror(errno)); Sys::close(job.fd), job.fd = -1; - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* * Like above, but no error message is returned. */ -fxBool +bool HylaFAXServer::lockJob(Job& job, int how) { if (job.fd < 0) @@ -1407,7 +1407,7 @@ HylaFAXServer::waitForJob(const char* jobid) * Do common work used in adding a document to a * job's set of documents that are to be sent. */ -fxBool +bool HylaFAXServer::checkAddDocument(Job& job, Token type, const char* docname, FaxSendOp& op) { @@ -1418,9 +1418,9 @@ HylaFAXServer::checkAddDocument(Job& job, Token type, else if (!docType(docname, op)) reply(550, "%s: Document type not recognized.", docname); else - return (TRUE); + return (true); } - return (FALSE); + return (false); } /* @@ -1484,7 +1484,7 @@ HylaFAXServer::addPollOp(Job& job, const char* sep, const char* pwd) * Directory interface support for querying job status. */ -fxBool +bool HylaFAXServer::isVisibleSendQFile(const char* filename, const struct stat&) { return (filename[0] == 'q'); @@ -1605,7 +1605,7 @@ HylaFAXServer::Jprintf(FILE* fd, const char* fmt, const Job& job) * implies read access to anything else in the * job state that is protected. */ - fxBool haveAccess = checkAccess(job, T_DIALSTRING, A_READ); + bool haveAccess = checkAccess(job, T_DIALSTRING, A_READ); for (const char* cp = fmt; *cp; cp++) { if (*cp == '%') { #define MAXSPEC 20 diff --git a/hfaxd/Login.c++ b/hfaxd/Login.c++ index 94bb0c91..015ff1c7 100644 --- a/hfaxd/Login.c++ +++ b/hfaxd/Login.c++ @@ -147,7 +147,7 @@ HylaFAXServer::login(void) uid_t ouid = geteuid(); (void) seteuid(0); - fxBool isSetup = (chroot(".") >= 0 && chdir("/") >= 0); + bool isSetup = (chroot(".") >= 0 && chdir("/") >= 0); /* * Install the client's fax-uid as the effective gid * so that created files automatically are given the @@ -162,7 +162,7 @@ HylaFAXServer::login(void) end_login(); return; } - (void) isShutdown(FALSE); // display any shutdown messages + (void) isShutdown(false); // display any shutdown messages reply(230, "User %s logged in.", (const char*) the_user); if (TRACE(LOGIN)) logInfo("FAX LOGIN FROM %s [%s], %s" diff --git a/hfaxd/OldProtocol.c++ b/hfaxd/OldProtocol.c++ index 540ed6c4..b9251ac3 100644 --- a/hfaxd/OldProtocol.c++ +++ b/hfaxd/OldProtocol.c++ @@ -62,7 +62,7 @@ OldProtocolSuperServer::OldProtocolSuperServer(const char* p, int bl) {} OldProtocolSuperServer::~OldProtocolSuperServer() {} -fxBool +bool OldProtocolSuperServer::startServer(void) { int s = socket(AF_INET, SOCK_STREAM, 0); @@ -82,14 +82,14 @@ OldProtocolSuperServer::startServer(void) if (Socket::bind(s, &sin, sizeof (sin)) >= 0) { (void) listen(s, getBacklog()); Dispatcher::instance().link(s, Dispatcher::ReadMask, this); - return (TRUE); // success + return (true); // success } Sys::close(s); logError("HylaFAX %s: bind (port %u): %m", getKind(), ntohs(sin.sin_port)); } else logError("HylaFAX %s: socket: %m", getKind()); - return (FALSE); + return (false); } HylaFAXServer* OldProtocolSuperServer::newChild(void) { return new OldProtocolServer; } @@ -97,7 +97,7 @@ HylaFAXServer* OldProtocolSuperServer::newChild(void) OldProtocolServer::OldProtocolServer() { version = 0; - alreadyChecked = FALSE; + alreadyChecked = false; codetab = NULL; } OldProtocolServer::~OldProtocolServer() {} @@ -114,7 +114,7 @@ OldProtocolServer::open(void) (const char*) remotehost, (const char*) remoteaddr); fxStr emsg; - if (isShutdown(TRUE)) { + if (isShutdown(true)) { logInfo("HylaFAX Old connection refused (server shut down) from %s [%s]", (const char*) remotehost, (const char*) remoteaddr); dologout(-1); @@ -149,23 +149,23 @@ OldProtocolServer::open(void) * look up the name and check that the peer's address * corresponds to the host name. */ -fxBool +bool OldProtocolServer::checkHostIdentity(hostent*& hp) { if (!isLocalDomain(hp->h_name)) // not local, don't check - return (TRUE); + return (true); fxStr name(hp->h_name); // must copy static value hp = Socket::gethostbyname(name); if (hp) { for (const char** cpp = (const char**) hp->h_addr_list; *cpp; cpp++) if (memcmp(*cpp, &peer_addr.sin_addr, hp->h_length) == 0) - return (TRUE); + return (true); sendError("Client address %s is not listed for host name %s.", (const char*) remoteaddr, hp->h_name); } else sendError("No inverse address mapping for client host name %s.", (const char*) name); - return (FALSE); + return (false); } void @@ -220,38 +220,38 @@ OldProtocolServer::setupNetwork(int fd) // NB: there is no support for the old style data transfer const OldProtocolServer::protoCmd OldProtocolServer::cmds[] = { -{ "begin", TRUE, &OldProtocolServer::submitJob }, -{ "checkPerm", TRUE, &OldProtocolServer::ackPermission }, -{ "tiff", TRUE, &OldProtocolServer::getTIFFData }, -{ "postscript", TRUE, &OldProtocolServer::getPostScriptData }, -{ "zpostscript", TRUE, &OldProtocolServer::getZPostScriptData }, -{ "opaque", TRUE, &OldProtocolServer::getOpaqueData }, -{ "zopaque", TRUE, &OldProtocolServer::getZOpaqueData }, -{ "poll", TRUE, &OldProtocolServer::newPollID }, -{ "userID", FALSE, &OldProtocolServer::setUserID }, -{ "version", FALSE, &OldProtocolServer::setProtoVersion }, -{ "serverStatus", FALSE, &OldProtocolServer::sendServerStatus }, -{ "serverInfo", FALSE, &OldProtocolServer::sendServerInfo }, -{ "allStatus", FALSE, &OldProtocolServer::sendAllStatus }, -{ "userStatus", FALSE, &OldProtocolServer::sendUserStatus }, -{ "jobStatus", FALSE, &OldProtocolServer::sendJobStatus }, -{ "recvStatus", FALSE, &OldProtocolServer::sendRecvStatus }, -{ "remove", TRUE, &OldProtocolServer::removeJob }, -{ "removeGroup", TRUE, &OldProtocolServer::removeJobGroup }, -{ "kill", TRUE, &OldProtocolServer::killJob }, -{ "killGroup", TRUE, &OldProtocolServer::killJobGroup }, -{ "alterTTS", TRUE, &OldProtocolServer::alterJobTTS }, -{ "alterGroupTTS", TRUE, &OldProtocolServer::alterJobGroupTTS }, -{ "alterKillTime", TRUE, &OldProtocolServer::alterJobKillTime }, -{ "alterGroupKillTime", TRUE, &OldProtocolServer::alterJobGroupKillTime }, -{ "alterMaxDials", TRUE, &OldProtocolServer::alterJobMaxDials }, -{ "alterGroupMaxDials", TRUE, &OldProtocolServer::alterJobGroupMaxDials }, -{ "alterNotify", TRUE, &OldProtocolServer::alterJobNotification }, -{ "alterGroupNotify", TRUE, &OldProtocolServer::alterJobGroupNotification }, -{ "alterModem", TRUE, &OldProtocolServer::alterJobModem }, -{ "alterGroupModem", TRUE, &OldProtocolServer::alterJobGroupModem }, -{ "alterPriority", TRUE, &OldProtocolServer::alterJobPriority }, -{ "alterGroupPriority", TRUE, &OldProtocolServer::alterJobGroupPriority }, +{ "begin", true, &OldProtocolServer::submitJob }, +{ "checkPerm", true, &OldProtocolServer::ackPermission }, +{ "tiff", true, &OldProtocolServer::getTIFFData }, +{ "postscript", true, &OldProtocolServer::getPostScriptData }, +{ "zpostscript", true, &OldProtocolServer::getZPostScriptData }, +{ "opaque", true, &OldProtocolServer::getOpaqueData }, +{ "zopaque", true, &OldProtocolServer::getZOpaqueData }, +{ "poll", true, &OldProtocolServer::newPollID }, +{ "userID", false, &OldProtocolServer::setUserID }, +{ "version", false, &OldProtocolServer::setProtoVersion }, +{ "serverStatus", false, &OldProtocolServer::sendServerStatus }, +{ "serverInfo", false, &OldProtocolServer::sendServerInfo }, +{ "allStatus", false, &OldProtocolServer::sendAllStatus }, +{ "userStatus", false, &OldProtocolServer::sendUserStatus }, +{ "jobStatus", false, &OldProtocolServer::sendJobStatus }, +{ "recvStatus", false, &OldProtocolServer::sendRecvStatus }, +{ "remove", true, &OldProtocolServer::removeJob }, +{ "removeGroup", true, &OldProtocolServer::removeJobGroup }, +{ "kill", true, &OldProtocolServer::killJob }, +{ "killGroup", true, &OldProtocolServer::killJobGroup }, +{ "alterTTS", true, &OldProtocolServer::alterJobTTS }, +{ "alterGroupTTS", true, &OldProtocolServer::alterJobGroupTTS }, +{ "alterKillTime", true, &OldProtocolServer::alterJobKillTime }, +{ "alterGroupKillTime", true, &OldProtocolServer::alterJobGroupKillTime }, +{ "alterMaxDials", true, &OldProtocolServer::alterJobMaxDials }, +{ "alterGroupMaxDials", true, &OldProtocolServer::alterJobGroupMaxDials }, +{ "alterNotify", true, &OldProtocolServer::alterJobNotification }, +{ "alterGroupNotify", true, &OldProtocolServer::alterJobGroupNotification }, +{ "alterModem", true, &OldProtocolServer::alterJobModem }, +{ "alterGroupModem", true, &OldProtocolServer::alterJobGroupModem }, +{ "alterPriority", true, &OldProtocolServer::alterJobPriority }, +{ "alterGroupPriority", true, &OldProtocolServer::alterJobGroupPriority }, }; #define NCMDS (sizeof (cmds) / sizeof (cmds[0])) @@ -302,7 +302,7 @@ OldProtocolServer::doProtocol(void) ); dologout(-1); } - alreadyChecked = TRUE; + alreadyChecked = true; } } (this->*cmds[i].cmdFunc)(tag); @@ -463,7 +463,7 @@ OldProtocolServer::ackPermission(const char*) */ #include -fxBool +bool OldProtocolServer::_checkUser(const char* requestor, struct passwd* pwd) { char buf[1024]; @@ -494,11 +494,11 @@ OldProtocolServer::_checkUser(const char* requestor, struct passwd* pwd) return (strcmp(requestor, buf) == 0); } -fxBool +bool OldProtocolServer::isAdmin(const char* requestor) { - static fxBool checked = FALSE; - static fxBool isadmin = FALSE; + static bool checked = false; + static bool isadmin = false; if (!checked) { struct passwd* pwd = getpwuid(getuid()); @@ -509,18 +509,18 @@ OldProtocolServer::isAdmin(const char* requestor) } if (!pwd) { logError("getpwuid failed for effective uid %d: %m", geteuid()); - isadmin = FALSE; + isadmin = false; } isadmin = _checkUser(requestor, pwd); if (!isadmin) { /* not fax user */ pwd = getpwnam("root"); if (!pwd) { logError("getpwnam failed for \"root\": %m"); - isadmin = FALSE; + isadmin = false; } else isadmin = _checkUser(requestor, pwd); /* root user */ } - checked = TRUE; + checked = true; } return (isadmin); } @@ -608,19 +608,19 @@ void OldProtocolServer::alterJob##param(const char* tag) \ void OldProtocolServer::alterJobGroup##param(const char* tag) \ { applyToJobGroup(tag, "alter", &OldProtocolServer::reallyAlterJob##param); } -fxBool +bool OldProtocolServer::alterSuspend(Job& job) { if (job.state == FaxRequest::state_active) { sendClient("jobLocked", job.jobid); // NB: maintain old semantics - return (FALSE); + return (false); } fxStr emsg; if (!sendQueuerACK(emsg, "X%s", (const char*) job.jobid)) { sendError("Unable to suspend job: %s", (const char*) emsg); - return (FALSE); + return (false); } - return (TRUE); + return (true); } void @@ -1302,7 +1302,7 @@ OldProtocolServer::sendJobStatus(Job& job) sendClientJobLocked(job); } -fxBool +bool OldProtocolServer::modemMatch(const fxStr& a, const fxStr& b) { return (a == MODEM_ANY || b == MODEM_ANY || a == b); diff --git a/hfaxd/OldProtocol.h b/hfaxd/OldProtocol.h index f1a0e570..e8db0ca0 100644 --- a/hfaxd/OldProtocol.h +++ b/hfaxd/OldProtocol.h @@ -36,20 +36,20 @@ class OldProtocolServer : public InetFaxServer { public: struct protoCmd { const char* cmd; // command to match - fxBool check; // if true, checkPermission first + bool check; // if true, checkPermission first void (OldProtocolServer::*cmdFunc)(const char*); }; private: faxRequestArray reqs; char line[1024]; // current input line int version; - fxBool alreadyChecked; + bool alreadyChecked; code_ent* codetab; fxStr modem; // selected modem static const protoCmd cmds[]; - fxBool checkHostIdentity(hostent*& hp); + bool checkHostIdentity(hostent*& hp); void setupNetwork(int fd); void doProtocol(void); void getCommandLine(char line[1024], char*& tag); @@ -63,13 +63,13 @@ private: void newPollID(const char* tag); void setProtoVersion(const char* tag); void ackPermission(const char*); - fxBool _checkUser(const char* requestor, struct passwd* pwd); - fxBool isAdmin(const char* requestor); + bool _checkUser(const char* requestor, struct passwd* pwd); + bool isAdmin(const char* requestor); void applyToJob(const char* tag, const char* op, void (OldProtocolServer::*f)(Job&, const char*)); void applyToJobGroup(const char* tag, const char* op, void (OldProtocolServer::*f)(Job&, const char*)); - fxBool alterSuspend(Job&); + bool alterSuspend(Job&); void alterResubmit(Job&); void alterJobTTS(const char*); void alterJobGroupTTS(const char*); @@ -111,7 +111,7 @@ private: void getZPostScriptData(const char* tag); void getZOpaqueData(const char* tag); void dologout(int status); - fxBool modemMatch(const fxStr& a, const fxStr& b); + bool modemMatch(const fxStr& a, const fxStr& b); void sendServerStatus(const char*); void sendServerInfo1(const char* name); void sendServerInfo(const char*); @@ -138,7 +138,7 @@ class OldProtocolSuperServer : public SuperServer { private: fxStr port; protected: - fxBool startServer(void); + bool startServer(void); HylaFAXServer* newChild(void); public: OldProtocolSuperServer(const char* port, int backlog = 5); diff --git a/hfaxd/Parser.c++ b/hfaxd/Parser.c++ index ace009df..4f822f49 100644 --- a/hfaxd/Parser.c++ +++ b/hfaxd/Parser.c++ @@ -42,155 +42,155 @@ * Standard protocol commands. */ static const tab cmdtab[] = { -{ "ABOR", T_ABOR, FALSE, TRUE, "[modem] (abort operation)" }, -{ "ACCT", T_ACCT, FALSE,FALSE, "(specify account)" }, -{ "ADMIN", T_ADMIN, TRUE, TRUE, "password" }, -{ "ALLO", T_ALLO, FALSE,FALSE, "(allocate disk space)" }, -{ "ANSWER", T_ANSWER, TRUE, TRUE, "modem [DATA|VOICE|FAX]" }, -{ "APPE", T_APPE, TRUE, TRUE, "file-name" }, -{ "CWD", T_CWD, TRUE, TRUE, "[directory-name]" }, -{ "CDUP", T_CDUP, TRUE, TRUE, "(change directory up one level)"}, -{ "CHMOD", T_CHMOD, TRUE, TRUE, "file-name mode" }, -{ "CHOWN", T_CHOWN, TRUE, TRUE, "file-name user" }, -{ "DELE", T_DELE, TRUE, TRUE, "file-name" }, -{ "DISABLE", T_DISABLE, TRUE, TRUE, "modem [reason]" }, -{ "ENABLE", T_ENABLE, TRUE, TRUE, "modem" }, -{ "HELP", T_HELP, FALSE, TRUE, "[]" }, -{ "FILEFMT", T_FILEFMT, TRUE, TRUE, "[format-string]" }, -{ "FORM", T_FORM, TRUE, TRUE, "format-type" }, -{ "IDLE", T_IDLE, TRUE, TRUE, "[max-idle-timeout]" }, -{ "JDELE", T_JDELE, TRUE, TRUE, "[job-id]" }, -{ "JINTR", T_JINTR, TRUE, TRUE, "[job-id]" }, -{ "JKILL", T_JKILL, TRUE, TRUE, "[job-id]" }, -{ "JNEW", T_JNEW, TRUE, TRUE, "" }, -{ "JOB", T_JOB, TRUE, TRUE, "[job-id]" }, -{ "JOBFMT", T_JOBFMT, TRUE, TRUE, "[format-string]" }, -{ "JPARM", T_JPARM, TRUE, TRUE, "[parm-name [parm-value]]" }, -{ "JREST", T_JREST, TRUE, TRUE, "(reset current job state)" }, -{ "JSUBM", T_JSUB, TRUE, TRUE, "[job-id]" }, -{ "JSUSP", T_JSUSP, TRUE, TRUE, "[job-id]" }, -{ "JWAIT", T_JWAIT, TRUE, TRUE, "[job-id]" }, -{ "JGDELE", T_JGDELE, TRUE,FALSE, "[jobgroup-id]" }, -{ "JGINTR", T_JGINTR, TRUE,FALSE, "[jobgroup-id]" }, -{ "JGKILL", T_JGKILL, TRUE,FALSE, "[jobgroup-id]" }, -{ "JGNEW", T_JGNEW, TRUE, TRUE, "" }, -{ "JGPARM", T_JGPARM, TRUE,FALSE, "parm-name [parm-value]" }, -{ "JGREST", T_JGREST, TRUE,FALSE, "(reset current job group state)"}, -{ "JGRP", T_JGRP, TRUE,FALSE, "[jobgroup-id]" }, -{ "JGSUBM", T_JGSUB, TRUE,FALSE, "[jobgroup-id]" }, -{ "JGSUSP", T_JGSUSP, TRUE,FALSE, "[jobgroup-id]" }, -{ "JGWAIT", T_JGWAIT, TRUE,FALSE, "[jobgroup-id]" }, -{ "LIST", T_LIST, TRUE, TRUE, "[path-name]" }, -{ "MDTM", T_MDTM, TRUE, TRUE, "path-name" }, -{ "MODE", T_MODE, FALSE, TRUE, "(specify transfer mode)" }, -{ "MDMFMT", T_MODEMFMT, TRUE, TRUE, "[format-string]" }, -{ "NLST", T_NLST, TRUE, TRUE, "[path-name]" }, -{ "NOOP", T_NOOP, FALSE, TRUE, "" }, -{ "PASS", T_PASS, FALSE, TRUE, "password" }, -{ "PASV", T_PASV, TRUE, TRUE, "(set server in passive mode)" }, -{ "PORT", T_PORT, TRUE, TRUE, "a0,a1,a2,a3,p0,p1" }, -{ "PWD", T_PWD, TRUE, TRUE, "(print working directory)" }, -{ "QUIT", T_QUIT, FALSE, TRUE, "(terminate service)", }, -{ "RCVFMT", T_RCVFMT, TRUE, TRUE, "[format-string]" }, -{ "REIN", T_REIN, FALSE, TRUE, "(reinitialize server state)" }, -{ "REST", T_REST, TRUE, TRUE, "restart-marker" }, -{ "RETP", T_RETP, TRUE, TRUE, "file-name" }, -{ "RETR", T_RETR, TRUE, TRUE, "file-name" }, -{ "RNFR", T_RNFR, TRUE,FALSE, "file-name" }, -{ "RNTO", T_RNTO, TRUE,FALSE, "file-name" }, -{ "SHUT", T_SHUT, TRUE, TRUE, "NOW|HHSS|YYYYMMDDHHSS [reason]" }, -{ "SITE", T_SITE, TRUE, TRUE, "site-cmd [arguments]" }, -{ "SIZE", T_SIZE, TRUE, TRUE, "path-name" }, -{ "STAT", T_STAT, FALSE, TRUE, "[path-name]" }, -{ "STOR", T_STOR, TRUE, TRUE, "file-name" }, -{ "STOT", T_STOT, TRUE, TRUE, "(store unique temporary)" }, -{ "STOU", T_STOU, TRUE, TRUE, "(store unique)" }, -{ "STRU", T_STRU, FALSE, TRUE, "file-structure" }, -{ "SYST", T_SYST, TRUE, TRUE, "(return system type)" }, -{ "TZONE", T_TZONE, TRUE, TRUE, "[GMT|LOCAL]" }, -{ "TYPE", T_TYPE, FALSE, TRUE, "transfer-type" }, -{ "USER", T_USER, FALSE, TRUE, "username" }, -{ "VRFY", T_VRFY, FALSE, TRUE, "dialstring" }, +{ "ABOR", T_ABOR, false, true, "[modem] (abort operation)" }, +{ "ACCT", T_ACCT, false,false, "(specify account)" }, +{ "ADMIN", T_ADMIN, true, true, "password" }, +{ "ALLO", T_ALLO, false,false, "(allocate disk space)" }, +{ "ANSWER", T_ANSWER, true, true, "modem [DATA|VOICE|FAX]" }, +{ "APPE", T_APPE, true, true, "file-name" }, +{ "CWD", T_CWD, true, true, "[directory-name]" }, +{ "CDUP", T_CDUP, true, true, "(change directory up one level)"}, +{ "CHMOD", T_CHMOD, true, true, "file-name mode" }, +{ "CHOWN", T_CHOWN, true, true, "file-name user" }, +{ "DELE", T_DELE, true, true, "file-name" }, +{ "DISABLE", T_DISABLE, true, true, "modem [reason]" }, +{ "ENABLE", T_ENABLE, true, true, "modem" }, +{ "HELP", T_HELP, false, true, "[]" }, +{ "FILEFMT", T_FILEFMT, true, true, "[format-string]" }, +{ "FORM", T_FORM, true, true, "format-type" }, +{ "IDLE", T_IDLE, true, true, "[max-idle-timeout]" }, +{ "JDELE", T_JDELE, true, true, "[job-id]" }, +{ "JINTR", T_JINTR, true, true, "[job-id]" }, +{ "JKILL", T_JKILL, true, true, "[job-id]" }, +{ "JNEW", T_JNEW, true, true, "" }, +{ "JOB", T_JOB, true, true, "[job-id]" }, +{ "JOBFMT", T_JOBFMT, true, true, "[format-string]" }, +{ "JPARM", T_JPARM, true, true, "[parm-name [parm-value]]" }, +{ "JREST", T_JREST, true, true, "(reset current job state)" }, +{ "JSUBM", T_JSUB, true, true, "[job-id]" }, +{ "JSUSP", T_JSUSP, true, true, "[job-id]" }, +{ "JWAIT", T_JWAIT, true, true, "[job-id]" }, +{ "JGDELE", T_JGDELE, true,false, "[jobgroup-id]" }, +{ "JGINTR", T_JGINTR, true,false, "[jobgroup-id]" }, +{ "JGKILL", T_JGKILL, true,false, "[jobgroup-id]" }, +{ "JGNEW", T_JGNEW, true, true, "" }, +{ "JGPARM", T_JGPARM, true,false, "parm-name [parm-value]" }, +{ "JGREST", T_JGREST, true,false, "(reset current job group state)"}, +{ "JGRP", T_JGRP, true,false, "[jobgroup-id]" }, +{ "JGSUBM", T_JGSUB, true,false, "[jobgroup-id]" }, +{ "JGSUSP", T_JGSUSP, true,false, "[jobgroup-id]" }, +{ "JGWAIT", T_JGWAIT, true,false, "[jobgroup-id]" }, +{ "LIST", T_LIST, true, true, "[path-name]" }, +{ "MDTM", T_MDTM, true, true, "path-name" }, +{ "MODE", T_MODE, false, true, "(specify transfer mode)" }, +{ "MDMFMT", T_MODEMFMT, true, true, "[format-string]" }, +{ "NLST", T_NLST, true, true, "[path-name]" }, +{ "NOOP", T_NOOP, false, true, "" }, +{ "PASS", T_PASS, false, true, "password" }, +{ "PASV", T_PASV, true, true, "(set server in passive mode)" }, +{ "PORT", T_PORT, true, true, "a0,a1,a2,a3,p0,p1" }, +{ "PWD", T_PWD, true, true, "(print working directory)" }, +{ "QUIT", T_QUIT, false, true, "(terminate service)", }, +{ "RCVFMT", T_RCVFMT, true, true, "[format-string]" }, +{ "REIN", T_REIN, false, true, "(reinitialize server state)" }, +{ "REST", T_REST, true, true, "restart-marker" }, +{ "RETP", T_RETP, true, true, "file-name" }, +{ "RETR", T_RETR, true, true, "file-name" }, +{ "RNFR", T_RNFR, true,false, "file-name" }, +{ "RNTO", T_RNTO, true,false, "file-name" }, +{ "SHUT", T_SHUT, true, true, "NOW|HHSS|YYYYMMDDHHSS [reason]" }, +{ "SITE", T_SITE, true, true, "site-cmd [arguments]" }, +{ "SIZE", T_SIZE, true, true, "path-name" }, +{ "STAT", T_STAT, false, true, "[path-name]" }, +{ "STOR", T_STOR, true, true, "file-name" }, +{ "STOT", T_STOT, true, true, "(store unique temporary)" }, +{ "STOU", T_STOU, true, true, "(store unique)" }, +{ "STRU", T_STRU, false, true, "file-structure" }, +{ "SYST", T_SYST, true, true, "(return system type)" }, +{ "TZONE", T_TZONE, true, true, "[GMT|LOCAL]" }, +{ "TYPE", T_TYPE, false, true, "transfer-type" }, +{ "USER", T_USER, false, true, "username" }, +{ "VRFY", T_VRFY, false, true, "dialstring" }, }; /* * Job parameter commands/keys. */ static const tab parmtab[] = { -{ "ACCTINFO", T_ACCTINFO, FALSE,FALSE, "[]" }, -{ "BEGBR", T_BEGBR, FALSE, TRUE, "[ANY|bit-rate]" }, -{ "BEGST", T_BEGST, FALSE, TRUE, "[ANY|scanline-time]" }, -{ "CHOPTHRESHOLD",T_CHOPTHRESH, FALSE, TRUE, "[inches]" }, -{ "CLIENT", T_CLIENT, FALSE, TRUE, "[]" }, -{ "COMMENTS", T_COMMENTS, FALSE,FALSE, "[]" }, -{ "COMMID", T_COMMID, FALSE, TRUE, "(communication identifier)" }, -{ "COVER", T_COVER, FALSE, TRUE, "path-name" }, -{ "DATAFORMAT", T_DATAFORMAT, FALSE, TRUE, "[ANY|G31D|G32D|G4]" }, -{ "DIALSTRING", T_DIALSTRING, FALSE, TRUE, "[]" }, -{ "DOCUMENT", T_DOCUMENT, FALSE, TRUE, "path-name" }, -{ "DONEOP", T_DONEOP, FALSE, TRUE, "[]" }, -{ "EXTERNAL", T_EXTERNAL, FALSE, TRUE, "[]" }, -{ "FROMCOMPANY", T_FROM_COMPANY, FALSE,FALSE, "[]" }, -{ "FROMLOCATION", T_FROM_LOCATION,FALSE,FALSE, "[]" }, -{ "FROMUSER", T_FROM_USER, FALSE, TRUE, "[]" }, -{ "FROMVOICE", T_FROM_VOICE, FALSE,FALSE, "[]" }, -{ "GROUPID", T_GROUPID, FALSE, TRUE, "(job group identifier)" }, -{ "HRES", T_HRES, FALSE,FALSE, "[dots-per-inch]" }, -{ "JOBID", T_JOBID, FALSE, TRUE, "(job identifier)" }, -{ "JOBINFO", T_JOBINFO, FALSE, TRUE, "[]" }, -{ "JOBTYPE", T_JOBTYPE, FALSE, TRUE, "(job type)" }, -{ "LASTTIME", T_LASTTIME, FALSE, TRUE, "[DDHHSS]" }, -{ "MAXDIALS", T_MAXDIALS, FALSE, TRUE, "[]" }, -{ "MAXPAGES", T_MAXPAGES, FALSE, TRUE, "[]" }, -{ "MAXTRIES", T_MAXTRIES, FALSE, TRUE, "[]" }, -{ "MINBR", T_MINBR, FALSE, TRUE, "[ANY|bit-rate]" }, -{ "MODEM", T_MODEM, FALSE, TRUE, "[device|class]" }, -{ "NDIALS", T_NDIALS, FALSE, TRUE, "[]" }, -{ "NOTIFY", T_NOTIFY, FALSE, TRUE, "[NONE|DONE|REQUEUE|DONE+REQUEUE]" }, -{ "NOTIFYADDR", T_NOTIFYADDR, FALSE, TRUE, "[email-address]" }, -{ "NPAGES", T_NPAGES, FALSE, TRUE, "[]" }, -{ "NTRIES", T_NTRIES, FALSE, TRUE, "[]" }, -{ "OWNER", T_OWNER, FALSE, TRUE, "[|]" }, -{ "PAGECHOP", T_PAGECHOP, FALSE, TRUE, "[DEFAULT|NONE|ALL|LAST]" }, -{ "PAGELENGTH", T_PAGELENGTH, FALSE, TRUE, "[millimeters]" }, -{ "PAGEWIDTH", T_PAGEWIDTH, FALSE, TRUE, "[millimeters]" }, -{ "PASSWD", T_PASSWD, FALSE, TRUE, "[]" }, -{ "POLL", T_POLL, FALSE, TRUE, "selector [passwd]" }, -{ "REGARDING", T_REGARDING, FALSE,FALSE, "[]" }, -{ "RETRYTIME", T_RETRYTIME, FALSE, TRUE, "[HHSS]" }, -{ "SCHEDPRI", T_SCHEDPRI, FALSE, TRUE, "[]" }, -{ "SENDTIME", T_SENDTIME, FALSE, TRUE, "[NOW|YYYYMMDDHHSS]" }, -{ "STATE", T_STATE, FALSE, TRUE, "(job state)" }, -{ "STATUS", T_STATUS, FALSE, TRUE, "[" }, -{ "SUBADDR", T_SUBADDR, FALSE, TRUE, "[]" }, -{ "TAGLINE", T_TAGLINE, FALSE, TRUE, "[]" }, -{ "TOCOMPANY", T_TO_COMPANY, FALSE, TRUE, "[]" }, -{ "TOLOCATION", T_TO_LOCATION, FALSE, TRUE, "[]" }, -{ "TOTDIALS", T_TOTDIALS, FALSE, TRUE, "[]" }, -{ "TOTPAGES", T_TOTPAGES, FALSE, TRUE, "[]" }, -{ "TOTTRIES", T_TOTTRIES, FALSE, TRUE, "[]" }, -{ "TOUSER", T_TO_USER, FALSE, TRUE, "[]" }, -{ "TOVOICE", T_TO_VOICE, FALSE,FALSE, "[]" }, -{ "USECONTCOVER", T_USE_CONTCOVER,FALSE, TRUE, "[YES|NO]" }, -{ "USEECM", T_USE_ECM, FALSE, TRUE, "[YES|NO]" }, -{ "USETAGLINE", T_USE_TAGLINE, FALSE, TRUE, "[YES|NO]" }, -{ "USRKEY", T_USRKEY, FALSE, TRUE, "[]" }, -{ "VRES", T_VRES, FALSE, TRUE, "[lines-per-inch]" }, +{ "ACCTINFO", T_ACCTINFO, false,false, "[]" }, +{ "BEGBR", T_BEGBR, false, true, "[ANY|bit-rate]" }, +{ "BEGST", T_BEGST, false, true, "[ANY|scanline-time]" }, +{ "CHOPTHRESHOLD",T_CHOPTHRESH, false, true, "[inches]" }, +{ "CLIENT", T_CLIENT, false, true, "[]" }, +{ "COMMENTS", T_COMMENTS, false,false, "[]" }, +{ "COMMID", T_COMMID, false, true, "(communication identifier)" }, +{ "COVER", T_COVER, false, true, "path-name" }, +{ "DATAFORMAT", T_DATAFORMAT, false, true, "[ANY|G31D|G32D|G4]" }, +{ "DIALSTRING", T_DIALSTRING, false, true, "[]" }, +{ "DOCUMENT", T_DOCUMENT, false, true, "path-name" }, +{ "DONEOP", T_DONEOP, false, true, "[]" }, +{ "EXTERNAL", T_EXTERNAL, false, true, "[]" }, +{ "FROMCOMPANY", T_FROM_COMPANY, false,false, "[]" }, +{ "FROMLOCATION", T_FROM_LOCATION,false,false, "[]" }, +{ "FROMUSER", T_FROM_USER, false, true, "[]" }, +{ "FROMVOICE", T_FROM_VOICE, false,false, "[]" }, +{ "GROUPID", T_GROUPID, false, true, "(job group identifier)" }, +{ "HRES", T_HRES, false,false, "[dots-per-inch]" }, +{ "JOBID", T_JOBID, false, true, "(job identifier)" }, +{ "JOBINFO", T_JOBINFO, false, true, "[]" }, +{ "JOBTYPE", T_JOBTYPE, false, true, "(job type)" }, +{ "LASTTIME", T_LASTTIME, false, true, "[DDHHSS]" }, +{ "MAXDIALS", T_MAXDIALS, false, true, "[]" }, +{ "MAXPAGES", T_MAXPAGES, false, true, "[]" }, +{ "MAXTRIES", T_MAXTRIES, false, true, "[]" }, +{ "MINBR", T_MINBR, false, true, "[ANY|bit-rate]" }, +{ "MODEM", T_MODEM, false, true, "[device|class]" }, +{ "NDIALS", T_NDIALS, false, true, "[]" }, +{ "NOTIFY", T_NOTIFY, false, true, "[NONE|DONE|REQUEUE|DONE+REQUEUE]" }, +{ "NOTIFYADDR", T_NOTIFYADDR, false, true, "[email-address]" }, +{ "NPAGES", T_NPAGES, false, true, "[]" }, +{ "NTRIES", T_NTRIES, false, true, "[]" }, +{ "OWNER", T_OWNER, false, true, "[|]" }, +{ "PAGECHOP", T_PAGECHOP, false, true, "[DEFAULT|NONE|ALL|LAST]" }, +{ "PAGELENGTH", T_PAGELENGTH, false, true, "[millimeters]" }, +{ "PAGEWIDTH", T_PAGEWIDTH, false, true, "[millimeters]" }, +{ "PASSWD", T_PASSWD, false, true, "[]" }, +{ "POLL", T_POLL, false, true, "selector [passwd]" }, +{ "REGARDING", T_REGARDING, false,false, "[]" }, +{ "RETRYTIME", T_RETRYTIME, false, true, "[HHSS]" }, +{ "SCHEDPRI", T_SCHEDPRI, false, true, "[]" }, +{ "SENDTIME", T_SENDTIME, false, true, "[NOW|YYYYMMDDHHSS]" }, +{ "STATE", T_STATE, false, true, "(job state)" }, +{ "STATUS", T_STATUS, false, true, "[" }, +{ "SUBADDR", T_SUBADDR, false, true, "[]" }, +{ "TAGLINE", T_TAGLINE, false, true, "[]" }, +{ "TOCOMPANY", T_TO_COMPANY, false, true, "[]" }, +{ "TOLOCATION", T_TO_LOCATION, false, true, "[]" }, +{ "TOTDIALS", T_TOTDIALS, false, true, "[]" }, +{ "TOTPAGES", T_TOTPAGES, false, true, "[]" }, +{ "TOTTRIES", T_TOTTRIES, false, true, "[]" }, +{ "TOUSER", T_TO_USER, false, true, "[]" }, +{ "TOVOICE", T_TO_VOICE, false,false, "[]" }, +{ "USECONTCOVER", T_USE_CONTCOVER,false, true, "[YES|NO]" }, +{ "USEECM", T_USE_ECM, false, true, "[YES|NO]" }, +{ "USETAGLINE", T_USE_TAGLINE, false, true, "[YES|NO]" }, +{ "USRKEY", T_USRKEY, false, true, "[]" }, +{ "VRES", T_VRES, false, true, "[lines-per-inch]" }, -{ "HELP", T_HELP, FALSE, TRUE, "[]" }, +{ "HELP", T_HELP, false, true, "[]" }, }; /* * Site-specific commands. */ static const tab sitetab[] = { -{ "ADDMODEM", T_ADDMODEM, FALSE,FALSE, "modem [speed]"}, -{ "ADDUSER", T_ADDUSER, FALSE, TRUE, "user-spec [passwd [adminwd]]"}, -{ "CONFIG", T_CONFIG, FALSE, TRUE, "[parm-name [parm-value]]" }, -{ "DELMODEM", T_DELMODEM, FALSE,FALSE, "modem" }, -{ "DELUSER", T_DELUSER, FALSE, TRUE, "user-spec" }, -{ "TRIGGER", T_TRIGGER, FALSE, TRUE, "spec" }, -{ "HELP", T_HELP, FALSE, TRUE, "[]" }, +{ "ADDMODEM", T_ADDMODEM, false,false, "modem [speed]"}, +{ "ADDUSER", T_ADDUSER, false, true, "user-spec [passwd [adminwd]]"}, +{ "CONFIG", T_CONFIG, false, true, "[parm-name [parm-value]]" }, +{ "DELMODEM", T_DELMODEM, false,false, "modem" }, +{ "DELUSER", T_DELUSER, false, true, "user-spec" }, +{ "TRIGGER", T_TRIGGER, false, true, "spec" }, +{ "HELP", T_HELP, false, true, "[]" }, }; static const tab* @@ -242,7 +242,7 @@ HylaFAXServer::fourdigits(const char* cp) (cp[2]-'0')*10 + (cp[3]-'0'); } -inline fxBool +inline bool isLoginToken(Token t) { return (t == T_USER || t == T_PASS || t == T_ADMIN); @@ -350,7 +350,7 @@ HylaFAXServer::parse() /* * Protocol command (one line). */ -fxBool +bool HylaFAXServer::cmd(Token t) { fxStr s; @@ -361,14 +361,14 @@ HylaFAXServer::cmd(Token t) if (string_param(s, "user name")) { logcmd(t, "%s", (const char*) s); userCmd(s); - return (TRUE); + return (true); } break; case T_PASS: // user password if (string_param(s, "password")) { logcmd(t, ""); passCmd(s); - return (TRUE); + return (true); } break; case T_ADMIN: // administrator password @@ -378,7 +378,7 @@ HylaFAXServer::cmd(Token t) break; logcmd(t, ""); adminCmd(s); - return (TRUE); + return (true); case T_REIN: // reinitialize server logcmd(t); if (IS(LOGGEDIN)) @@ -392,7 +392,7 @@ HylaFAXServer::cmd(Token t) restart_point = n; reply(350, "Data transfer will restart at %lu, " "send transfer command", n); - return (TRUE); + return (true); } break; case T_SYST: // system identification @@ -400,62 +400,62 @@ HylaFAXServer::cmd(Token t) logcmd(t); // this is what we *emulate* reply(215, "%s", (const char*) systemType); - return (TRUE); + return (true); } break; case T_PORT: // port for data transfer if (SP() && hostPort() && CRLF()) { portCmd(); - return (TRUE); + return (true); } break; case T_PASV: // enable passive mode if (CRLF()) { logcmd(t); passiveCmd(); - return (TRUE); + return (true); } break; case T_FORM: // document format if (string_param(s, "document format")) { logcmd(t, "%s", (const char*) s); formCmd(s); - return (TRUE); + return (true); } break; case T_MODE: // data transfer mode if (string_param(s, "transfer mode")) { logcmd(t, "%s", (const char*) s); modeCmd(s); - return (TRUE); + return (true); } break; case T_STRU: // data transfer file structure if (string_param(s, "file structure")) { logcmd(t, "%s", (const char*) s); struCmd(s); - return (TRUE); + return (true); } break; case T_TYPE: // data transfer type if (string_param(s, "transfer type")) { logcmd(t, "%s", (const char*) s); typeCmd(s); - return (TRUE); + return (true); } break; case T_RETP: // retrieve next page of document/file if (pathname_param(s)) { logcmd(t, "%s", (const char*) s); retrievePageCmd(s); - return (TRUE); + return (true); } break; case T_RETR: // retrieve document/file if (pathname_param(s)) { logcmd(t, "%s", (const char*) s); retrieveCmd(s); - return (TRUE); + return (true); } break; case T_STOR: // store document/file @@ -463,28 +463,28 @@ HylaFAXServer::cmd(Token t) logcmd(t, "%s", (const char*) s); // XXX file must exist if not admin, check for bad chars in pathname storeCmd(s, "w"); - return (TRUE); + return (true); } break; case T_APPE: // append to document/file if (pathname_param(s)) { logcmd(t, "%s", (const char*) s); storeCmd(s, "a"); - return (TRUE); + return (true); } break; case T_STOT: // store uniquely named document/file if (CRLF()) { logcmd(t); - storeUniqueCmd(TRUE); - return (TRUE); + storeUniqueCmd(true); + return (true); } break; case T_STOU: // store uniquely named document/file if (CRLF()) { logcmd(t); - storeUniqueCmd(FALSE); - return (TRUE); + storeUniqueCmd(false); + return (true); } break; case T_LIST: // list directory/file @@ -495,47 +495,47 @@ HylaFAXServer::cmd(Token t) listCmd("."); else nlstCmd("."); - return (TRUE); + return (true); } else if (pathname_param(s)) { logcmd(t, "%s", (const char*) s); if (t == T_LIST) listCmd(s); else nlstCmd(s); - return (TRUE); + return (true); } break; case T_CWD: // change working directory if (opt_CRLF()) { logcmd(t); cwdCmd("/"); - return (TRUE); + return (true); } else if (pathname_param(s)) { logcmd(t, "%s", (const char*) s); cwdCmd(s); - return (TRUE); + return (true); } break; case T_CDUP: // CWD .. logcmd(t); cwdCmd(".."); - return (TRUE); + return (true); case T_PWD: // print working directory if (CRLF()) { logcmd(t); pwdCmd(); - return (TRUE); + return (true); } break; case T_STAT: // stat file/server status if (opt_CRLF()) { logcmd(t); statusCmd(); - return (TRUE); + return (true); } else if (checklogin(T_STAT) && pathname_param(s)) { logcmd(t, "%s", (const char*) s); statFileCmd(s); - return (TRUE); + return (true); } break; case T_SIZE: // return file size @@ -546,44 +546,44 @@ HylaFAXServer::cmd(Token t) reply(550, "%s: not a plain file.", (const char*) s); else reply(213, "%lu", (u_long) sb.st_size); - return (TRUE); + return (true); } break; case T_CHMOD: // set file protection if (SP() && STRING(s, "filename") && SP() && NUMBER(n)) { chmodCmd(s, (u_int) n); - return (TRUE); + return (true); } break; case T_MDTM: // return file last modification time if (pathname_param(s)) { logcmd(t, "%s", (const char*) s); mdtmCmd(s); - return (TRUE); + return (true); } break; case T_DELE: // delete file/document if (pathname_param(s)) { logcmd(t, "%s", (const char*) s); deleCmd(s); - return (TRUE); + return (true); } break; case T_ABOR: // abort active command/incoming call if (opt_CRLF()) { logcmd(t); ack(225, cmdToken(t)); - return (TRUE); + return (true); } else if (checkadmin(T_ABOR) && string_param(s, "modem")) { abortCallCmd(s); - return (TRUE); + return (true); } break; case T_HELP: // return help if (opt_CRLF()) { logcmd(t); helpCmd(cmdtab, (char*) NULL); - return (TRUE); + return (true); } else if (string_param(s, "command name")) { logcmd(t, "%s", (const char*) s); s.raisecase(); @@ -593,122 +593,122 @@ HylaFAXServer::cmd(Token t) helpCmd(parmtab, NULL); else helpCmd(cmdtab, s); - return (TRUE); + return (true); } break; case T_JNEW: // create new job if (CRLF()) { newJobCmd(); - return (TRUE); + return (true); } break; case T_JOB: // select current job if (job_param(s)) { setCurrentJob(s); - return (TRUE); + return (true); } break; case T_JREST: // reset job state if (job_param(s)) { resetJob(s); - return (TRUE); + return (true); } break; case T_JDELE: // delete job if (job_param(s)) { deleteJob(s); - return (TRUE); + return (true); } break; case T_JINTR: // interrupt job if (job_param(s)) { interruptJob(s); - return (TRUE); + return (true); } break; case T_JKILL: // kill job if (job_param(s)) { killJob(s); - return (TRUE); + return (true); } break; case T_JSUSP: // suspend job if (job_param(s)) { suspendJob(s); - return (TRUE); + return (true); } break; case T_JSUB: // submit job if (job_param(s)) { submitJob(s); - return (TRUE); + return (true); } break; case T_JWAIT: // wait for job if (job_param(s)) { waitForJob(s); - return (TRUE); + return (true); } break; case T_JGNEW: // create job group if (CRLF()) { curJob->groupid = curJob->jobid; ack(200, cmdToken(t)); - return (TRUE); + return (true); } break; case T_JGREST: // reset current job group state if (CRLF()) { - return (TRUE); + return (true); } break; case T_JGRP: // select current job group if (jgrp_param(s)) { - return (TRUE); + return (true); } break; case T_JGDELE: // delete job group if (jgrp_param(s)) { - return (TRUE); + return (true); } break; case T_JGINTR: // interrupt job group if (jgrp_param(s)) { - return (TRUE); + return (true); } break; case T_JGKILL: // kill job group if (jgrp_param(s)) { - return (TRUE); + return (true); } break; case T_JGSUSP: // suspend job group if (jgrp_param(s)) { - return (TRUE); + return (true); } break; case T_JGSUB: // submit job group if (jgrp_param(s)) { - return (TRUE); + return (true); } break; case T_JGWAIT: // wait for job group if (jgrp_param(s)) { - return (TRUE); + return (true); } break; case T_NOOP: // no-op if (CRLF()) { logcmd(t); ack(200, cmdToken(t)); - return (TRUE); + return (true); } break; case T_IDLE: // set/query idle timeout if (opt_CRLF()) { logcmd(t); reply(213, "%u seconds.", idleTimeout); - return (TRUE); + return (true); } else if (number_param(n)) { logcmd(t, "%lu", n); if (n > maxIdleTimeout && !IS(PRIVILEGED)) { @@ -719,7 +719,7 @@ HylaFAXServer::cmd(Token t) idleTimeout = (int) n; reply(213, "Idle timeout set to %u.", idleTimeout); } - return (TRUE); + return (true); } break; case T_QUIT: // terminate session @@ -727,14 +727,14 @@ HylaFAXServer::cmd(Token t) logcmd(t); reply(221, "Goodbye."); dologout(0); - return (TRUE); + return (true); } break; case T_TZONE: // set/query timezone usage if (opt_CRLF()) { reply(200, "Time values are handled in %s.", IS(USEGMT) ? "GMT" : tzname[0]); - return (TRUE); + return (true); } else if (string_param(s, "timezone specification")) { logcmd(t, "%s", (const char*) s); s.raisecase(); @@ -748,7 +748,7 @@ HylaFAXServer::cmd(Token t) reply(503, "Unknown timezone specification %s.", (const char*) s); } - return (TRUE); + return (true); } break; case T_JOBFMT: // query/specify job format string @@ -762,7 +762,7 @@ HylaFAXServer::cmd(Token t) t == T_MODEMFMT ? (const char*) modemFormat : (const char*) fileFormat ); - return (TRUE); + return (true); } else if (string_param(s, "format-string")) { if (t == T_JOBFMT) jobFormat = s; @@ -773,7 +773,7 @@ HylaFAXServer::cmd(Token t) else if (t == T_FILEFMT) fileFormat = s; ack(200, cmdToken(t)); - return (TRUE); + return (true); } break; case T_JPARM: // set/query job parameter @@ -781,7 +781,7 @@ HylaFAXServer::cmd(Token t) logcmd(T_JPARM); if (checkJobState(curJob)) jstatCmd(*curJob); - return (TRUE); + return (true); } else if (SP() && getToken(T_STRING, "parameter name")) { tokenBody.raisecase(); const tab* p = lookup(parmtab, N(parmtab), tokenBody); @@ -828,7 +828,7 @@ HylaFAXServer::cmd(Token t) else if (!string_param(how, "answer-how")) break; answerCallCmd(s, how); - return (TRUE); + return (true); } break; case T_CHOWN: // assign file ownership @@ -836,7 +836,7 @@ HylaFAXServer::cmd(Token t) fxStr who; if (string_param(who, "user")) { chownCmd(s, who); - return (TRUE); + return (true); } } break; @@ -848,13 +848,13 @@ HylaFAXServer::cmd(Token t) else if (!SP() || !multi_STRING(reason)) break; disableModemCmd(s, reason); - return (TRUE); + return (true); } break; case T_ENABLE: // enable outbound-usage of modem if (checkadmin(T_ENABLE) && string_param(s, "modem")) { enableModemCmd(s); - return (TRUE); + return (true); } break; case T_SHUT: // shutdown server @@ -868,14 +868,14 @@ HylaFAXServer::cmd(Token t) if (s.length() == 3 && strcasecmp(cp, "NOW") == 0) { time_t t = Sys::now(); shutCmd(*localtime(&t), reason); - return (TRUE); + return (true); } else if (s.length() == 4 && checkNUMBER(cp)) { time_t t = Sys::now(); struct tm tm = *localtime(&t); tm.tm_hour = 60*60*twodigits(cp, 60); tm.tm_min = 60*twodigits(cp+2, 60); shutCmd(tm, reason); - return (TRUE); + return (true); } else if (s.length() == 12 && checkNUMBER(cp)) { struct tm tm; tm.tm_sec = 0; @@ -885,7 +885,7 @@ HylaFAXServer::cmd(Token t) tm.tm_mon = twodigits(cp+4, 12) -1; tm.tm_year = fourdigits(cp+0) - 1900; shutCmd(tm, reason); - return (TRUE); + return (true); } else syntaxError("bad time specification"); } @@ -897,17 +897,17 @@ HylaFAXServer::cmd(Token t) , (const char*) hostname , (const char*) hostaddr ); - return (TRUE); + return (true); } break; } - return (FALSE); + return (false); } /* * Site-specific protocol commands (one line). */ -fxBool +bool HylaFAXServer::site_cmd(Token t) { fxStr s; @@ -918,15 +918,15 @@ HylaFAXServer::site_cmd(Token t) fxStr pass; if (opt_CRLF()) { addUserCmd(s, "", ""); - return (TRUE); + return (true); } else if (SP() && STRING(pass, "password")) { fxStr apass; if (opt_CRLF()) { addUserCmd(s, pass, ""); - return (TRUE); + return (true); } else if (string_param(apass, "admin-password")) { addUserCmd(s, pass, apass); - return (TRUE); + return (true); } } } @@ -934,19 +934,19 @@ HylaFAXServer::site_cmd(Token t) case T_DELUSER: if (checkadmin(T_DELUSER) && string_param(s, "user-spec")) { delUserCmd(s); - return (TRUE); + return (true); } break; case T_DELMODEM: if (checkadmin(T_DELMODEM) && string_param(s, "modem")) { delModemCmd(s); - return (TRUE); + return (true); } break; case T_ADDMODEM: if (checkadmin(T_ADDMODEM) && string_param(s, "modem")) { addModemCmd(s); - return (TRUE); + return (true); } break; case T_CONFIG: @@ -954,10 +954,10 @@ HylaFAXServer::site_cmd(Token t) fxStr config; if (opt_CRLF()) { configQueryCmd(s); - return (TRUE); + return (true); } else if (SP() && multi_STRING(config)) { configCmd(s, config); - return (TRUE); + return (true); } } break; @@ -965,43 +965,43 @@ HylaFAXServer::site_cmd(Token t) if (string_param(s, "trigger-spec")) { logcmd(t, s); triggerCmd("%s", (const char*) s); - return (TRUE); + return (true); } break; case T_HELP: // return help if (opt_CRLF()) { helpCmd(sitetab, (char*) NULL); - return (TRUE); + return (true); } else if (string_param(s, "command name")) { logcmd(T_SITE, "HELP %s", (const char*) s); s.raisecase(); helpCmd(sitetab, s); - return (TRUE); + return (true); } break; } - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::param_cmd(Token t) { fxStr s; long n; time_t ticks; - fxBool b; + bool b; switch (t) { case T_SENDTIME: // time to send job if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (SP() && getToken(T_STRING, "time specification")) { tokenBody.raisecase(); if (tokenBody == "NOW") { if (CRLF() && setJobParameter(*curJob, t, (time_t) 0)) { reply(213, "%s set to NOW.", parmToken(t)); - return (TRUE); + return (true); } } else { pushToken(T_STRING); // XXX @@ -1021,7 +1021,7 @@ HylaFAXServer::param_cmd(Token t) ); } else reply(213, "%s set to NOW.", parmToken(t)); - return (TRUE); + return (true); } } } @@ -1029,7 +1029,7 @@ HylaFAXServer::param_cmd(Token t) case T_LASTTIME: // time to kill job if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (timespec_param(6, ticks) && setJobParameter(*curJob, t, ticks)) { reply(213, "%s set to %02d%02d%02d." @@ -1038,13 +1038,13 @@ HylaFAXServer::param_cmd(Token t) , (ticks/(60*60))%24 , (ticks/60)%60 ); - return (TRUE); + return (true); } break; case T_RETRYTIME: // retry interval for job if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (timespec_param(4, ticks) && setJobParameter(*curJob, t, ticks)) { reply(213, "%s set to %02d%02d." @@ -1052,7 +1052,7 @@ HylaFAXServer::param_cmd(Token t) , ticks/60 , ticks%60 ); - return (TRUE); + return (true); } break; case T_MAXDIALS: @@ -1073,11 +1073,11 @@ HylaFAXServer::param_cmd(Token t) case T_TOTDIALS: if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (number_param(n) && setJobParameter(*curJob, t, (u_short) n)) { reply(213, "%s set to %u.", parmToken(t), n); - return (TRUE); + return (true); } break; case T_NOTIFYADDR: @@ -1106,11 +1106,11 @@ HylaFAXServer::param_cmd(Token t) case T_COMMID: if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (SP() && multi_STRING(s) && CRLF() && setJobParameter(*curJob, t, s)) { reply(213, "%s set to \"%s\".", parmToken(t), (const char*) s); - return (TRUE); + return (true); } break; case T_USE_ECM: @@ -1118,75 +1118,75 @@ HylaFAXServer::param_cmd(Token t) case T_USE_CONTCOVER: if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (boolean_param(b) && setJobParameter(*curJob, t, b)) { reply(213, "%s set to %s.", parmToken(t), b ? "YES" : "NO"); - return (TRUE); + return (true); } break; case T_CHOPTHRESH: if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (string_param(s, "floating point number") && setJobParameter(*curJob, t, (float) atof(s))) { reply(213, "%s set to %g.", parmToken(t), (float) atof(s)); - return (TRUE); + return (true); } break; case T_COVER: // specify/query cover page document if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (pathname_param(s)) { addCoverDocument(*curJob, s); - return (TRUE); + return (true); } break; case T_DOCUMENT: // specify/query normal document if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (pathname_param(s)) { addDocument(*curJob, s); - return (TRUE); + return (true); } break; case T_POLL: // specify/query poll operation if (opt_CRLF()) { replyJobParamValue(*curJob, 213, t); - return (TRUE); + return (true); } else if (SP() && STRING(s, "polling selector")) { fxStr pwd; if (opt_CRLF()) { addPollOp(*curJob, s, ""); // sep but no pwd - return (TRUE); + return (true); } else if (SP() && pwd_param(pwd) && CRLF()) { addPollOp(*curJob, s, pwd); // sep & pwd - return (TRUE); + return (true); } } break; case T_HELP: // return help if (opt_CRLF()) { helpCmd(parmtab, (char*) NULL); - return (TRUE); + return (true); } else if (string_param(s, "parameter name")) { s.raisecase(); logcmd(T_JPARM, "HELP %s", (const char*) s); helpCmd(parmtab, s); - return (TRUE); + return (true); } break; } - return (FALSE); + return (false); } /* * Collect a single string parameter. */ -fxBool +bool HylaFAXServer::string_param(fxStr& s, const char* what) { return SP() && STRING(s, what) && CRLF(); @@ -1195,7 +1195,7 @@ HylaFAXServer::string_param(fxStr& s, const char* what) /* * Collect a single number parameter. */ -fxBool +bool HylaFAXServer::number_param(long& n) { return SP() && NUMBER(n) && CRLF(); @@ -1204,8 +1204,8 @@ HylaFAXServer::number_param(long& n) /* * Collect a single boolean parameter. */ -fxBool -HylaFAXServer::boolean_param(fxBool& b) +bool +HylaFAXServer::boolean_param(bool& b) { return SP() && BOOLEAN(b) && CRLF(); } @@ -1213,7 +1213,7 @@ HylaFAXServer::boolean_param(fxBool& b) /* * Collect a single time parameter. */ -fxBool +bool HylaFAXServer::timespec_param(int ndigits, time_t& t) { return SP() && TIMESPEC(ndigits, t) && CRLF(); @@ -1222,7 +1222,7 @@ HylaFAXServer::timespec_param(int ndigits, time_t& t) /* * File manipulation command. */ -fxBool +bool HylaFAXServer::pathname_param(fxStr& s) { return SP() && pathname(s) && CRLF(); @@ -1231,48 +1231,48 @@ HylaFAXServer::pathname_param(fxStr& s) /* * Job control commands. */ -fxBool +bool HylaFAXServer::job_param(fxStr& jid) { if (opt_CRLF()) { jid = curJob->jobid; - return (TRUE); + return (true); } else if (SP() && STRING(jid, "job identifer") && CRLF()) { jid.lowercase(); - return (TRUE); + return (true); } - return (FALSE); + return (false); } /* * Job group control commands. */ -fxBool +bool HylaFAXServer::jgrp_param(fxStr& jgid) { if (opt_CRLF()) { jgid = curJob->groupid; - return (TRUE); + return (true); } else if (SP() && STRING(jgid, "job group identifier") && CRLF()) { jgid.lowercase(); - return (TRUE); + return (true); } - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::pwd_param(fxStr& s) { return STRING(s, "polling password"); } -fxBool +bool HylaFAXServer::pathname(fxStr& s) { return STRING(s, "pathname"); } -fxBool +bool HylaFAXServer::TIMESPEC(u_int len, time_t& result) { if (getToken(T_STRING, "time specification")) { @@ -1303,44 +1303,44 @@ HylaFAXServer::TIMESPEC(u_int len, time_t& result) result = 60*twodigits(cp, 60) + twodigits(cp+2, 60); } - return (TRUE); + return (true); } } else syntaxError(fxStr::format( "bad time specification (expecting %d digits)", len)); } - return (FALSE); + return (false); } -fxBool -HylaFAXServer::BOOLEAN(fxBool& b) +bool +HylaFAXServer::BOOLEAN(bool& b) { if (getToken(T_STRING, "boolean")) { tokenBody.raisecase(); if (tokenBody == "YES") { - b = TRUE; - return (TRUE); + b = true; + return (true); } else if (tokenBody == "NO") { - b = FALSE; - return (TRUE); + b = false; + return (true); } else syntaxError("invalid boolean value, use YES or NO"); } - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::checkToken(Token wanted) { Token t = nextToken(); if (t != wanted) { pushToken(t); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } -fxBool +bool HylaFAXServer::getToken(Token wanted, const char* expected) { Token t = nextToken(); @@ -1349,44 +1349,44 @@ HylaFAXServer::getToken(Token wanted, const char* expected) syntaxError("unmatched quote mark"); else syntaxError(fxStr::format("expecting %s", expected)); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } -fxBool HylaFAXServer::SP() { return getToken(T_SP, ""); } -fxBool HylaFAXServer::COMMA() { return getToken(T_COMMA, "\",\""); } -fxBool HylaFAXServer::CRLF() { return getToken(T_CRLF, ""); } -fxBool HylaFAXServer::opt_CRLF() { return checkToken(T_CRLF); } +bool HylaFAXServer::SP() { return getToken(T_SP, ""); } +bool HylaFAXServer::COMMA() { return getToken(T_COMMA, "\",\""); } +bool HylaFAXServer::CRLF() { return getToken(T_CRLF, ""); } +bool HylaFAXServer::opt_CRLF() { return checkToken(T_CRLF); } -fxBool +bool HylaFAXServer::opt_STRING(fxStr& s) { if (checkToken(T_STRING)) { s = tokenBody; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::STRING(fxStr& s, const char* what) { if (getToken(T_STRING, what != NULL ? what : "")) { s = tokenBody; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::multi_STRING(fxStr& s) { if (!STRING(s)) - return (FALSE); + return (false); for (;;) { switch (nextToken()) { case T_CRLF: pushToken(T_CRLF); - return (TRUE); + return (true); case T_COMMA: s.append(','); break; @@ -1398,12 +1398,12 @@ HylaFAXServer::multi_STRING(fxStr& s) break; case T_LEXERR: syntaxError("unmatched quote mark"); - return (FALSE); + return (false); } } } -fxBool +bool HylaFAXServer::checkNUMBER(const char* cp) { if (cp[0] == '-' || cp[0] == '+') @@ -1411,21 +1411,21 @@ HylaFAXServer::checkNUMBER(const char* cp) for (; *cp; cp++) if (!isdigit(*cp)) { syntaxError("invalid number"); - return (FALSE); + return (false); } - return (TRUE); + return (true); } -fxBool +bool HylaFAXServer::NUMBER(long& n) { if (!getToken(T_STRING, "decimal number")) { - return (FALSE); + return (false); } else if (!checkNUMBER(tokenBody)) { - return (FALSE); + return (false); } else { n = strtol(tokenBody, NULL, 0); - return (TRUE); + return (true); } } @@ -1448,7 +1448,7 @@ HylaFAXServer::syntaxError(const char* msg) * be received or return EOF. */ int -HylaFAXServer::getChar(fxBool waitForInput) +HylaFAXServer::getChar(bool waitForInput) { if (recvCC <= 0) { // enable non-blocking i/o on control channel @@ -1502,33 +1502,33 @@ HylaFAXServer::pushCmdData(const char* data, int n) * Return the next line of data received on the control * channel, ignoring any Telnet protocol command sequences. */ -fxBool -HylaFAXServer::getCmdLine(char* s, int n, fxBool waitForInput) +bool +HylaFAXServer::getCmdLine(char* s, int n, bool waitForInput) { char* cp = s; cpos = 0; while (n > 1) { int c = getChar(cp != s || waitForInput); if (c == EOF) - return (FALSE); + return (false); if (c == IAC) { // telnet protocol command - c = getChar(TRUE); + c = getChar(true); if (c == EOF) - return (FALSE); + return (false); switch (c&0377) { case WILL: case WONT: - c = getChar(TRUE); // telnet option + c = getChar(true); // telnet option if (c == EOF) - return (FALSE); + return (false); printf("%c%c%c", IAC, DONT, c&0377); (void) fflush(stdout); continue; case DO: case DONT: - c = getChar(TRUE); // telnet option + c = getChar(true); // telnet option if (c == EOF) - return (FALSE); + return (false); printf("%c%c%c", IAC, WONT, c&0377); (void) fflush(stdout); continue; @@ -1551,7 +1551,7 @@ HylaFAXServer::getCmdLine(char* s, int n, fxBool waitForInput) *cp = '\0'; if (TRACE(PROTOCOL)) logDebug("command: %s", s); - return (TRUE); + return (true); } void @@ -1719,25 +1719,25 @@ HylaFAXServer::cmdFailure(Token t, const char* why) } } -fxBool +bool HylaFAXServer::checklogin(Token t) { if (!IS(LOGGEDIN)) { cmdFailure(t, "not logged in"); reply(530, "Please login with USER and PASS."); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } -fxBool +bool HylaFAXServer::checkadmin(Token t) { if (checklogin(t)) { if (IS(PRIVILEGED)) - return (TRUE); + return (true); cmdFailure(t, "user is not privileged"); reply(530, "Please use ADMIN to establish administrative privileges."); } - return (FALSE); + return (false); } diff --git a/hfaxd/RecvQueue.c++ b/hfaxd/RecvQueue.c++ index cedb745d..d355711b 100644 --- a/hfaxd/RecvQueue.c++ +++ b/hfaxd/RecvQueue.c++ @@ -37,45 +37,45 @@ RecvInfo::RecvInfo() { - beingReceived = FALSE; + beingReceived = false; recvTime = 0; } RecvInfo::RecvInfo(const char* qf) { qfile = qf; - beingReceived = FALSE; + beingReceived = false; recvTime = 0; } RecvInfo::~RecvInfo() {} fxIMPLEMENT_StrKeyPtrValueDictionary(RecvInfoDict, RecvInfo*) -static fxBool +static bool isFAXImage(TIFF* tif) { uint16 w; if (TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &w) && w != 1) - return (FALSE); + return (false); if (TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &w) && w != 1) - return (FALSE); + return (false); if (!TIFFGetField(tif, TIFFTAG_COMPRESSION, &w) || (w != COMPRESSION_CCITTFAX3 && w != COMPRESSION_CCITTFAX4)) - return (FALSE); + return (false); if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &w) || (w != PHOTOMETRIC_MINISWHITE && w != PHOTOMETRIC_MINISBLACK)) - return (FALSE); - return (TRUE); + return (false); + return (true); } /* * Construct receive information from a file's contents. */ -fxBool +bool HylaFAXServer::getRecvDocStatus(RecvInfo& ri) { int fd = Sys::open(ri.qfile, O_RDWR); // RDWR for flock emulation if (fd < 0) - return (FALSE); + return (false); /* * Files that are being received are locked * for exclusive use by faxgetty. @@ -96,7 +96,7 @@ HylaFAXServer::getRecvDocStatus(RecvInfo& ri) */ if (!isFAXImage(tif)) { TIFFClose(tif); - return (FALSE); + return (false); } /* * Should be a received facsimile, build up status. @@ -153,10 +153,10 @@ HylaFAXServer::getRecvDocStatus(RecvInfo& ri) #endif } while (TIFFReadDirectory(tif)); TIFFClose(tif); - return (TRUE); + return (true); } -fxBool +bool HylaFAXServer::isVisibleRecvQFile(const char* filename, const struct stat&) { return (strncmp(filename, "fax", 3) == 0); diff --git a/hfaxd/SNPPServer.c++ b/hfaxd/SNPPServer.c++ index a956790c..bcc0a669 100644 --- a/hfaxd/SNPPServer.c++ +++ b/hfaxd/SNPPServer.c++ @@ -54,7 +54,7 @@ SNPPSuperServer::SNPPSuperServer(const char* p, int bl) {} SNPPSuperServer::~SNPPSuperServer() {} -fxBool +bool SNPPSuperServer::startServer(void) { /* @@ -86,7 +86,7 @@ SNPPSuperServer::startServer(void) (void) listen(s, getBacklog()); (void) seteuid(ouid); Dispatcher::instance().link(s, Dispatcher::ReadMask, this); - return (TRUE); // success + return (true); // success } Sys::close(s); logError("HylaFAX %s: bind (port %u): %m", @@ -94,7 +94,7 @@ SNPPSuperServer::startServer(void) } else logError("HylaFAX %s: socket: %m", getKind()); (void) seteuid(ouid); - return (FALSE); + return (false); } HylaFAXServer* SNPPSuperServer::newChild(void) { return new SNPPServer; } @@ -116,7 +116,7 @@ SNPPServer::open(void) dologout(-1); } ctrlFlags = fcntl(STDIN_FILENO, F_GETFL); // for parser - if (isShutdown(TRUE)) { + if (isShutdown(true)) { reply(421, "%s SNPP server unavailable; try again later.", (const char*) hostname); dologout(-1); @@ -147,7 +147,7 @@ SNPPServer::initDefaultJob(void) void SNPPServer::initSNPPJob(void) { - defJob.queued = FALSE; // jobs not queued--per protocol + defJob.queued = false; // jobs not queued--per protocol defJob.maxdials = SNPP_DEFREDIALS; // configuration defaults... defJob.maxtries = SNPP_DEFRETRIES; defJob.killtime = 60*killMap[SNPP_DEFLEVEL]; @@ -161,7 +161,7 @@ SNPPServer::resetState(void) { initDefaultJob(); // default job state msgFile = ""; - haveText = FALSE; // no message text yet + haveText = false; // no message text yet msgs.resize(0); // purge any message refs } @@ -192,7 +192,7 @@ SNPPServer::dologout(int status) InetFaxServer::dologout(status); } -static inline fxBool +static inline bool isMagic(char c) { return (c == '[' || c == ']' || c == '*' || c == '.' || c == '^' || @@ -237,7 +237,7 @@ subRHS(fxStr& result, const RegEx& re, const fxStr& match) * to dial of the service provider and the PIN to supply * to the provider when talking IXO/TAP (for aliases). */ -fxBool +bool SNPPServer::mapPagerID(const char* pagerID, fxStr& number, fxStr& pin, fxStr& emsg) { if (pagerIDMapFile != "") { @@ -269,13 +269,13 @@ SNPPServer::mapPagerID(const char* pagerID, fxStr& number, fxStr& pin, fxStr& em * that begin with '#' are ignored (i.e. comments). */ const char* pattern = cp; - fxBool isRE = FALSE; + bool isRE = false; for (; *cp != '\0' && !isspace(*cp); cp++) if (isMagic(*cp)) - isRE = TRUE; + isRE = true; if (*cp != '\0') // \0-term. *cp++ = '\0'; - fxBool match; + bool match; RegEx* re; if (isRE) { re = new RegEx(pattern); @@ -312,9 +312,9 @@ SNPPServer::mapPagerID(const char* pagerID, fxStr& number, fxStr& pin, fxStr& em s.raisecase(); if (s == "REJECT") { emsg = fxStr::format("Invalid pager ID %s",pagerID); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } } delete re; @@ -330,7 +330,7 @@ SNPPServer::mapPagerID(const char* pagerID, fxStr& number, fxStr& pin, fxStr& em emsg = "No pager ID mapping file found"; logError("%s", (const char*) emsg); } - return (FALSE); + return (false); } /* @@ -343,51 +343,51 @@ SNPPServer::mapPagerID(const char* pagerID, fxStr& number, fxStr& pin, fxStr& em * Standard protocol commands. */ static const tab cmdtab[] = { -{ "2WAY", T_2WAY, TRUE,FALSE, "(preface 2-way transaction)" }, -{ "ABOR", T_ABOR, FALSE, TRUE, "(abort operation)" }, -{ "ACKR", T_ACKREAD, TRUE,FALSE, "0|1" }, -{ "ALER", T_ALERT, TRUE,FALSE, "alert-level" }, -{ "CALL", T_CALLERID, TRUE,FALSE, "caller-ID" }, -{ "COVE", T_COVERAGE, TRUE,FALSE, "alternate-area" }, -{ "DATA", T_DATA, TRUE, TRUE, "(specify multi-line message)" }, -{ "EXPT", T_EXPTAG, TRUE,FALSE, "hours" }, -{ "HELP", T_HELP, FALSE, TRUE, "[]" }, -{ "HOLD", T_HOLDUNTIL, TRUE, TRUE, "YYYYMMDDHHMMSS [+/-GMT-diff]" }, -{ "KTAG", T_KTAG, TRUE,FALSE, "message-tag pass-code" }, -{ "LEVE", T_LEVEL, TRUE, TRUE, "service-level" }, -{ "LOGI", T_LOGIN, FALSE, TRUE, "username [password]" }, -{ "MCRE", T_MCRESPONSE, TRUE,FALSE, "2-byte-code response-text" }, -{ "MESS", T_MESSAGE, TRUE, TRUE, "message" }, -{ "MSTA", T_MSTATUS, TRUE,FALSE, "message-tag pass-code" }, -{ "NOQU", T_NOQUEUEING, TRUE,FALSE, "(disable message queueing)" }, -{ "PAGE", T_PAGER, TRUE, TRUE, "pager-ID|alias [PIN]" }, -{ "PING", T_PING, TRUE, TRUE, "pager-ID|alias" }, -{ "QUIT", T_QUIT, FALSE, TRUE, "(terminate service)" }, -{ "RESE", T_REST, TRUE, TRUE, "(reset state)" }, -{ "RTYP", T_RTYPE, TRUE,FALSE, "reply-type-code" }, -{ "SEND", T_SEND, TRUE, TRUE, "(send message)" }, -{ "SITE", T_SITE, TRUE, TRUE, "site-cmd [arguments]" }, -{ "STAT", T_STAT, FALSE, TRUE, "(return server status)" }, -{ "SUBJ", T_SUBJECT, TRUE, TRUE, "message-subject" }, +{ "2WAY", T_2WAY, true,false, "(preface 2-way transaction)" }, +{ "ABOR", T_ABOR, false, true, "(abort operation)" }, +{ "ACKR", T_ACKREAD, true,false, "0|1" }, +{ "ALER", T_ALERT, true,false, "alert-level" }, +{ "CALL", T_CALLERID, true,false, "caller-ID" }, +{ "COVE", T_COVERAGE, true,false, "alternate-area" }, +{ "DATA", T_DATA, true, true, "(specify multi-line message)" }, +{ "EXPT", T_EXPTAG, true,false, "hours" }, +{ "HELP", T_HELP, false, true, "[]" }, +{ "HOLD", T_HOLDUNTIL, true, true, "YYYYMMDDHHMMSS [+/-GMT-diff]" }, +{ "KTAG", T_KTAG, true,false, "message-tag pass-code" }, +{ "LEVE", T_LEVEL, true, true, "service-level" }, +{ "LOGI", T_LOGIN, false, true, "username [password]" }, +{ "MCRE", T_MCRESPONSE, true,false, "2-byte-code response-text" }, +{ "MESS", T_MESSAGE, true, true, "message" }, +{ "MSTA", T_MSTATUS, true,false, "message-tag pass-code" }, +{ "NOQU", T_NOQUEUEING, true,false, "(disable message queueing)" }, +{ "PAGE", T_PAGER, true, true, "pager-ID|alias [PIN]" }, +{ "PING", T_PING, true, true, "pager-ID|alias" }, +{ "QUIT", T_QUIT, false, true, "(terminate service)" }, +{ "RESE", T_REST, true, true, "(reset state)" }, +{ "RTYP", T_RTYPE, true,false, "reply-type-code" }, +{ "SEND", T_SEND, true, true, "(send message)" }, +{ "SITE", T_SITE, true, true, "site-cmd [arguments]" }, +{ "STAT", T_STAT, false, true, "(return server status)" }, +{ "SUBJ", T_SUBJECT, true, true, "message-subject" }, }; /* * Site-specific commands. */ static const tab sitetab[] = { -{ "FROMUSER", T_FROM_USER, TRUE, TRUE, "[]" }, -{ "HELP", T_HELP, FALSE, TRUE, "[]" }, -{ "IDLE", T_IDLE, TRUE, TRUE, "[max-idle-timeout]" }, -{ "JPARM", T_JPARM, TRUE, TRUE, "(print job parameter status)" }, -{ "JQUEUE", T_JQUEUE, TRUE, TRUE, "[on|off]" }, -{ "LASTTIME", T_LASTTIME, FALSE, TRUE, "[DDHHSS]" }, -{ "MAXDIALS", T_MAXDIALS, TRUE, TRUE, "[]" }, -{ "MAXTRIES", T_MAXTRIES, TRUE, TRUE, "[]" }, -{ "MODEM", T_MODEM, TRUE, TRUE, "[device|class]" }, -{ "NOTIFY", T_NOTIFY, TRUE, TRUE, "[NONE|DONE|REQUEUE|DONE+REQUEUE]"}, -{ "MAILADDR", T_NOTIFYADDR, TRUE, TRUE, "[email-address]" }, -{ "RETRYTIME", T_RETRYTIME, TRUE, TRUE, "[HHSS]" }, -{ "SCHEDPRI", T_SCHEDPRI, TRUE, TRUE, "[]" }, +{ "FROMUSER", T_FROM_USER, true, true, "[]" }, +{ "HELP", T_HELP, false, true, "[]" }, +{ "IDLE", T_IDLE, true, true, "[max-idle-timeout]" }, +{ "JPARM", T_JPARM, true, true, "(print job parameter status)" }, +{ "JQUEUE", T_JQUEUE, true, true, "[on|off]" }, +{ "LASTTIME", T_LASTTIME, false, true, "[DDHHSS]" }, +{ "MAXDIALS", T_MAXDIALS, true, true, "[]" }, +{ "MAXTRIES", T_MAXTRIES, true, true, "[]" }, +{ "MODEM", T_MODEM, true, true, "[device|class]" }, +{ "NOTIFY", T_NOTIFY, true, true, "[NONE|DONE|REQUEUE|DONE+REQUEUE]"}, +{ "MAILADDR", T_NOTIFYADDR, true, true, "[email-address]" }, +{ "RETRYTIME", T_RETRYTIME, true, true, "[HHSS]" }, +{ "SCHEDPRI", T_SCHEDPRI, true, true, "[]" }, }; static const tab* @@ -421,15 +421,15 @@ SNPPServer::siteToken(Token t) return tokenName(sitetab, N(sitetab), t); } -fxBool +bool SNPPServer::checklogin(Token t) { if (!IS(LOGGEDIN)) { cmdFailure(t, "not logged in"); reply(530, "Please login with LOGIN."); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* @@ -528,7 +528,7 @@ SNPPServer::parse() /* * Protocol command (one line). */ -fxBool +bool SNPPServer::cmd(Token t) { fxStr s; @@ -540,21 +540,21 @@ SNPPServer::cmd(Token t) if (CRLF()) { logcmd(t); ack(250, cmdToken(t)); - return (TRUE); + return (true); } break; case T_DATA: // submit multi-line message data if (CRLF()) { logcmd(t); dataCmd(); - return (TRUE); + return (true); } break; case T_HELP: // return help if (opt_CRLF()) { logcmd(t); helpCmd(cmdtab, (char*) NULL); - return (TRUE); + return (true); } else if (string_param(s, "command name")) { logcmd(t, "%s", (const char*) s); s.raisecase(); @@ -562,14 +562,14 @@ SNPPServer::cmd(Token t) helpCmd(sitetab, NULL); else helpCmd(cmdtab, s); - return (TRUE); + return (true); } break; case T_HOLDUNTIL: // set time to send if (SP() && SNPPTime(tv)) { if (opt_CRLF()) { holdCmd(tv); - return (TRUE); + return (true); } else if (string_param(s, "GMT-difference")) { // conver GMT offset to numeric value int sign = 1; @@ -580,7 +580,7 @@ SNPPServer::cmd(Token t) cp++; time_t off = (time_t) (strtoul(cp, 0, 10)*60 / 100); holdCmd(tv + sign*off); - return (TRUE); + return (true); } } break; @@ -588,7 +588,7 @@ SNPPServer::cmd(Token t) if (number_param(n)) { logcmd(t, "%lu", n); serviceLevel((u_int) n); - return (TRUE); + return (true); } break; case T_LOGIN: // login as user @@ -597,11 +597,11 @@ SNPPServer::cmd(Token t) if (opt_CRLF()) { logcmd(t, (const char*) s); loginCmd(s); - return (TRUE); + return (true); } else if (string_param(pwd, "password")) { logcmd(t, "%s ", (const char*) s); loginCmd(s, pwd); - return (TRUE); + return (true); } } break; @@ -609,7 +609,7 @@ SNPPServer::cmd(Token t) if (SP() && multi_STRING(s) && CRLF()) { logcmd(t, "%s", (const char*) s); messageCmd(s); - return (TRUE); + return (true); } break; case T_PAGER: // specify destination pager ID @@ -618,11 +618,11 @@ SNPPServer::cmd(Token t) if (opt_CRLF()) { logcmd(t, "%s", (const char*) s); pagerCmd(s); - return (TRUE); + return (true); } else if (string_param(pwd, "password/PIN")) { logcmd(t, "%s ", (const char*) s); pagerCmd(s, pwd); - return (TRUE); + return (true); } } break; @@ -630,7 +630,7 @@ SNPPServer::cmd(Token t) if (string_param(s, "pager-ID")) { logcmd(t, "%s", (const char*) s); pingCmd(s); - return (TRUE); + return (true); } break; case T_QUIT: // terminate session @@ -638,7 +638,7 @@ SNPPServer::cmd(Token t) logcmd(t); reply(221, "Goodbye."); dologout(0); - return (TRUE); + return (true); } break; case T_REST: // reset server state @@ -650,7 +650,7 @@ SNPPServer::cmd(Token t) if (CRLF()) { logcmd(t); sendCmd(); - return (TRUE); + return (true); } break; case T_SITE: // site-specific command @@ -670,37 +670,37 @@ SNPPServer::cmd(Token t) if (CRLF()) { logcmd(t); statusCmd(); - return (TRUE); + return (true); } break; case T_SUBJECT: // message subject if (SP() && multi_STRING(s) && CRLF()) { logcmd(t, "%s", (const char*) s); subjectCmd(s); - return (TRUE); + return (true); } break; } - return (FALSE); + return (false); } /* * Site-specific protocol commands (one line). */ -fxBool +bool SNPPServer::site_cmd(Token t) { fxStr s; long n; time_t tv; - fxBool b; + bool b; switch (t) { case T_IDLE: // set/query idle timeout if (opt_CRLF()) { logcmd(t); reply(250, "%u seconds.", idleTimeout); - return (TRUE); + return (true); } else if (number_param(n)) { logcmd(t, "%lu", n); if (n > maxIdleTimeout && !IS(PRIVILEGED)) { @@ -711,18 +711,18 @@ SNPPServer::site_cmd(Token t) idleTimeout = (int) n; reply(250, "Idle timeout set to %u.", idleTimeout); } - return (TRUE); + return (true); } break; case T_HELP: // return help if (opt_CRLF()) { helpCmd(sitetab, (char*) NULL); - return (TRUE); + return (true); } else if (string_param(s, "command name")) { logcmd(T_SITE, "HELP %s", (const char*) s); s.raisecase(); helpCmd(sitetab, s); - return (TRUE); + return (true); } break; case T_JQUEUE: @@ -730,7 +730,7 @@ SNPPServer::site_cmd(Token t) logcmd(t, "%s", b ? "YES" : "NO"); defJob.queued = b; reply(250, "Job will%s be queued.", b ? "" : " not"); - return (TRUE); + return (true); } break; case T_FROM_USER: @@ -740,7 +740,7 @@ SNPPServer::site_cmd(Token t) if (SP() && multi_STRING(s) && CRLF() && setJobParameter(defJob, t, s)) { logcmd(t, "%s", (const char*) s); reply(250, "%s set to \"%s\".", parmToken(t), (const char*) s); - return (TRUE); + return (true); } break; case T_MAXDIALS: @@ -749,7 +749,7 @@ SNPPServer::site_cmd(Token t) if (number_param(n) && setJobParameter(defJob, t, (u_short) n)) { logcmd(t, "%lu", n); reply(250, "%s set to %u.", parmToken(t), n); - return (TRUE); + return (true); } break; case T_LASTTIME: // time to kill job @@ -759,31 +759,31 @@ SNPPServer::site_cmd(Token t) reply(250, "%s set to %02d%02d%02d." , parmToken(t) , tv/(24*60*60) , (tv/(60*60))%24 , (tv/60)%60); - return (TRUE); + return (true); } break; case T_RETRYTIME: // retry interval for job if (timespec_param(4, tv) && setJobParameter(defJob, t, tv)) { logcmd(t, "%02d%02d" , tv/60, tv%60); reply(250, "%s set to %02d%02d.", parmToken(t), tv/60, tv%60); - return (TRUE); + return (true); } break; case T_JPARM: // query job parameters if (CRLF()) { logcmd(t); jstatCmd(defJob); - return (TRUE); + return (true); } break; } - return (FALSE); + return (false); } /* * Parse an SNPP time specification. */ -fxBool +bool SNPPServer::SNPPTime(time_t& result) { if (getToken(T_STRING, "time specification") && checkNUMBER(tokenBody)) { @@ -818,12 +818,12 @@ SNPPServer::SNPPTime(time_t& result) * client will then be applied to this result. */ result = mktime(&tm) - gmtoff; - return (TRUE); + return (true); } syntaxError(fxStr::format( "bad time specification (expecting 10/12 digits, got %u)", tlen)); } - return (FALSE); + return (false); } void @@ -862,7 +862,7 @@ SNPPServer::dataCmd(void) char buf[1024]; u_int len = 0; for (;;) { - if (getCmdLine(buf, sizeof (buf), TRUE)) { + if (getCmdLine(buf, sizeof (buf), true)) { const char* bp = buf; if (bp[0] == '.') { if ((bp[1] == '\n' && bp[2] == '\0') || bp[1] == '\0') @@ -889,7 +889,7 @@ SNPPServer::dataCmd(void) perror_reply(554, msgFile, errno); Sys::unlink(msgFile); } else { - haveText = TRUE; + haveText = true; reply(250, "Message text OK."); } } else @@ -1067,7 +1067,7 @@ SNPPServer::messageCmd(const char* msg) perror_reply(554, msgFile, errno); Sys::unlink(msgFile); } else { - haveText = TRUE; + haveText = true; reply(250, "Message text OK."); } } else @@ -1151,13 +1151,13 @@ SNPPServer::pingCmd(const char* pagerID) reply(550, "%s.", (const char*) emsg); } -static fxBool +static bool notPresent(faxRequestArray& a, const char* name) { for (u_int i = 0, n = a.length(); i < n; i++) if (a[i].op == FaxRequest::send_data && a[i].item == name) - return (FALSE); - return (TRUE); + return (false); + return (true); } /* @@ -1179,13 +1179,13 @@ SNPPServer::sendCmd(void) */ fxStr emsg; u_int i, n = msgs.length(); - fxBool waitForJobs = FALSE; + bool waitForJobs = false; for (i = 0; i < n; i++) { Job* job = findJob(msgs[i], emsg); if (!job) msgs.remove(i), n--; else if (!job->queued) - waitForJobs = TRUE; + waitForJobs = true; } if (waitForJobs) { state &= ~S_LOGTRIG; // just process events @@ -1275,7 +1275,7 @@ SNPPServer::sendCmd(void) if (setjmp(urgcatch) == 0) { Dispatcher& disp = Dispatcher::instance(); state |= S_WAITTRIG|S_SENDWAIT; - fxBool jobsPending; + bool jobsPending; do { disp.dispatch(); /* @@ -1284,13 +1284,13 @@ SNPPServer::sendCmd(void) * monitor the job state(s) after each event we * receive. */ - jobsPending = FALSE; + jobsPending = false; for (i = 0; i < n; i++) { Job* job = findJob(msgs[i], emsg); if (!job) msgs.remove(i), n--; else if (!job->queued && job->state != FaxRequest::state_done) - jobsPending = TRUE; + jobsPending = true; } } while (IS(WAITTRIG) && jobsPending); reply(250, "Message processing completed."); @@ -1427,7 +1427,7 @@ setTimeMap(time_t map[12], const char* value) } } -fxBool +bool SNPPServer::setConfigItem(const char* tag, const char* value) { if (streq(tag, "maxmsglength")) { @@ -1441,7 +1441,7 @@ SNPPServer::setConfigItem(const char* tag, const char* value) } else if (streq(tag, "retrytimemap")) { setTimeMap(retryMap, value); } else if (!InetFaxServer::setConfigItem(tag, value)) - return (FALSE); - return (TRUE); + return (false); + return (true); } #endif /* SNPP_SUPPORT */ diff --git a/hfaxd/SNPPServer.h b/hfaxd/SNPPServer.h index 957efc88..e19bb2bf 100644 --- a/hfaxd/SNPPServer.h +++ b/hfaxd/SNPPServer.h @@ -34,7 +34,7 @@ class SNPPServer : public InetFaxServer { private: fxStr msgFile; // file with message text - fxBool haveText; // client specified message text + bool haveText; // client specified message text fxStrArray msgs; // jobs pending SEND (jobids) #define S_SENDWAIT 0x10000 // in SEND waiting for jobs @@ -53,13 +53,13 @@ protected: virtual void resetConfig(); void setupConfig(); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); int parse(void); - fxBool cmd(Token t); - fxBool site_cmd(Token t); - fxBool checklogin(Token); - fxBool SNPPTime(time_t& result); + bool cmd(Token t); + bool site_cmd(Token t); + bool checklogin(Token); + bool SNPPTime(time_t& result); virtual void syntaxError(const char* msg); virtual const char* cmdToken(Token t); @@ -77,7 +77,7 @@ protected: void statusCmd(void); void subjectCmd(const char*); - fxBool mapPagerID(const char* pagerID, + bool mapPagerID(const char* pagerID, fxStr& number, fxStr& pid, fxStr& emsg); public: SNPPServer(); @@ -91,7 +91,7 @@ class SNPPSuperServer : public SuperServer { private: fxStr port; protected: - fxBool startServer(void); + bool startServer(void); HylaFAXServer* newChild(void); public: SNPPSuperServer(const char* port, int backlog = 5); diff --git a/hfaxd/Status.c++ b/hfaxd/Status.c++ index b87d0df2..98422286 100644 --- a/hfaxd/Status.c++ +++ b/hfaxd/Status.c++ @@ -50,13 +50,13 @@ public: fxStr localIdentifier; // to use in place of FAXNumber fxStr FAXNumber; // phone number fxStr modemName; // canonical modem name - fxBool isGettyRunning; // TRUE if faxgetty responds via FIFO + bool isGettyRunning; // true if faxgetty responds via FIFO fxStr status; // from status file ModemConfig(const char* name); ~ModemConfig() {}; - fxBool setConfigItem(const char* tag, const char* value); + bool setConfigItem(const char* tag, const char* value); void configError(const char* fmt, ...); void configTrace(const char* fmt, ...); @@ -81,7 +81,7 @@ ModemConfig::checkGetty(const char* fifoFile) isGettyRunning = (fifo != -1); } -fxBool +bool ModemConfig::setConfigItem(const char* tag, const char* value) { if (streq(tag, "faxnumber")) @@ -105,7 +105,7 @@ ModemConfig::setConfigItem(const char* tag, const char* value) logTracingLevel = getNumber(value); else if (streq(tag, "maxrecvpages")) maxRecvPages = getNumber(value); - return (TRUE); // avoid complaints + return (true); // avoid complaints } void diff --git a/hfaxd/SuperServer.h b/hfaxd/SuperServer.h index 5cb63220..9b4bad66 100644 --- a/hfaxd/SuperServer.h +++ b/hfaxd/SuperServer.h @@ -35,7 +35,7 @@ protected: SuperServer(const char* kind, int backlog); virtual HylaFAXServer* newChild(void) = 0; - virtual fxBool startServer(void) = 0; + virtual bool startServer(void) = 0; int inputReady(int fd); void timerExpired(long, long); diff --git a/hfaxd/Trigger.c++ b/hfaxd/Trigger.c++ index d79a38f7..a40ecdaa 100644 --- a/hfaxd/Trigger.c++ +++ b/hfaxd/Trigger.c++ @@ -90,16 +90,16 @@ HylaFAXServer::triggerCmd(const char* fmt ...) * and return the identifier sent back by the * scheduler. */ -fxBool +bool HylaFAXServer::newTrigger(fxStr& emsg, const char* fmt, ...) { va_list ap; va_start(ap, fmt); - fxBool b = vnewTrigger(emsg, fmt, ap); + bool b = vnewTrigger(emsg, fmt, ap); va_end(ap); return (b); } -fxBool +bool HylaFAXServer::vnewTrigger(fxStr& emsg, const char* fmt, va_list ap) { trigSpec = fxStr::vformat(fmt, ap); @@ -112,22 +112,22 @@ HylaFAXServer::vnewTrigger(fxStr& emsg, const char* fmt, va_list ap) * create triggers the first time as well as to re-load an * active trigger if the scheduler is restarted. */ -fxBool +bool HylaFAXServer::loadTrigger(fxStr& emsg) { if (sendQueuerACK(emsg, "T%s", (const char*) trigSpec) && fifoResponse.length() > 2) { tid = atoi(&fifoResponse[2]); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* * Inform the spooler that it should cancel * a previously created trigger. */ -fxBool +bool HylaFAXServer::cancelTrigger(fxStr& emsg) { trigSpec = ""; // avoid spontaneous reloads @@ -181,10 +181,10 @@ HylaFAXServer::triggerEvent(const TriggerMsgHeader& h, const char* cp) if (rip->recvTime == 0) rip->recvTime = h.tstamp; if (h.event == Trigger::RECV_END) { - rip->beingReceived = FALSE; + rip->beingReceived = false; rip->reason = ri.reason; } else - rip->beingReceived = TRUE; + rip->beingReceived = true; rip->sender = ri.sender; rip->subaddr = ri.subaddr; rip->npages = ri.npages; diff --git a/hfaxd/UnixFaxServer.c++ b/hfaxd/UnixFaxServer.c++ index 692a8a7d..ad06da17 100644 --- a/hfaxd/UnixFaxServer.c++ +++ b/hfaxd/UnixFaxServer.c++ @@ -48,7 +48,7 @@ UnixSuperServer::~UnixSuperServer() Sys::unlink(fileName); } -fxBool +bool UnixSuperServer::startServer(void) { int s = socket(AF_UNIX, SOCK_STREAM, 0); @@ -64,7 +64,7 @@ UnixSuperServer::startServer(void) #endif (void) listen(s, getBacklog()); Dispatcher::instance().link(s, Dispatcher::ReadMask, this); - return (TRUE); + return (true); } Sys::close(s); logError("%s HylaFAX: bind (port %s): %m", @@ -72,13 +72,13 @@ UnixSuperServer::startServer(void) fileName = ""; // don't try to unlink file } else logError("%s HylaFAX: socket: %m", getKind()); - return (FALSE); + return (false); } HylaFAXServer* UnixSuperServer::newChild(void) { return new UnixFaxServer; } UnixFaxServer::UnixFaxServer() { - usedefault = TRUE; + usedefault = true; } UnixFaxServer::~UnixFaxServer() {} @@ -86,7 +86,7 @@ void UnixFaxServer::initServer(void) { HylaFAXServer::initServer(); - usedefault = TRUE; + usedefault = true; } void @@ -135,7 +135,7 @@ UnixFaxServer::getDataSocket(const char* mode) return (NULL); } -fxBool +bool UnixFaxServer::dataConnect(void) { return Socket::connect(data, &data_dest,sizeof (data_dest)) >= 0; @@ -188,23 +188,23 @@ UnixFaxServer::openDataConn(const char* mode, int& code) return (file); } -fxBool +bool UnixFaxServer::hostPort() { fxStr s; if (pathname(s)) { data_dest.sun_family = AF_UNIX; strncpy(data_dest.sun_path, s, sizeof (data_dest.sun_path)); - return (TRUE); + return (true); } else - return (FALSE); + return (false); } void UnixFaxServer::portCmd(void) { logcmd(T_PORT, "%s", data_dest.sun_path); - usedefault = FALSE; + usedefault = false; if (pdata >= 0) (void) Sys::close(pdata), pdata = -1; reply(200, "PORT command successful."); diff --git a/hfaxd/UnixFaxServer.h b/hfaxd/UnixFaxServer.h index 25c8444c..c505c9ee 100644 --- a/hfaxd/UnixFaxServer.h +++ b/hfaxd/UnixFaxServer.h @@ -36,20 +36,20 @@ private: sockaddr_un data_source; // source of data connection sockaddr_un data_dest; // destination of data connection sockaddr_un peer_addr; // destination of control connection - fxBool usedefault; // for data transfers + bool usedefault; // for data transfers void passiveCmd(void); void netStatus(FILE*); - fxBool hostPort(); + bool hostPort(); void portCmd(void); virtual void initServer(void); FILE* getDataSocket(const char* mode); - fxBool dataConnect(void); + bool dataConnect(void); FILE* openDataConn(const char* mode, int& code); void send_data(FILE* instr, FILE* outstr, off_t blksize); - fxBool receive_data(FILE* instr, FILE* outstr); + bool receive_data(FILE* instr, FILE* outstr); public: UnixFaxServer(); virtual ~UnixFaxServer(); @@ -63,7 +63,7 @@ class UnixSuperServer : public SuperServer { private: fxStr fileName; // UNIX domain socket filename protected: - fxBool startServer(void); + bool startServer(void); HylaFAXServer* newChild(void); public: UnixSuperServer(const char* filename, int backlog = 5); diff --git a/hfaxd/User.c++ b/hfaxd/User.c++ index 13a6682d..5e55efff 100644 --- a/hfaxd/User.c++ +++ b/hfaxd/User.c++ @@ -49,10 +49,10 @@ gid_t HylaFAXServer::faxuid = 0; // reserved fax uid #define FAXUID_RESV HylaFAXServer::faxuid // reserved fax uid -fxBool +bool HylaFAXServer::checkUser(const char* name) { - fxBool check = FALSE; + bool check = false; FILE* db = fopen(fixPathname(userAccessFile), "r"); if (db != NULL) { check = checkuser(db, name); @@ -63,7 +63,7 @@ HylaFAXServer::checkUser(const char* name) return (check); } -static fxBool +static bool nextRecord(FILE* db, char line[], u_int size) { while (fgets(line, size-1, db)) { @@ -77,9 +77,9 @@ nextRecord(FILE* db, char line[], u_int size) if (cp = strchr(line, '\n')) *cp = '\0'; if (line[0] != '\0') - return (TRUE); + return (true); } - return (FALSE); + return (false); } /* @@ -87,15 +87,15 @@ nextRecord(FILE* db, char line[], u_int size) * the list of users and hosts that are permitted to * user the server and setup password handling. */ -fxBool +bool HylaFAXServer::checkuser(FILE* db, const char* name) { struct stat sb; if (Sys::fstat(fileno(db), sb) < 0) - return (FALSE); + return (false); if (sb.st_mode&077) { // file must not be publicly readable logError("Access control file not mode 600; access denied."); - return (FALSE); + return (false); } uid = FAXUID_ANON; // anonymous user adminwd = "*"; // disallow privileged access @@ -132,7 +132,7 @@ HylaFAXServer::checkuser(FILE* db, const char* name) RegEx pat(base, cp-base); if (line[0] == '!') { // disallow access on match if (pat.Find(dotform) || pat.Find(hostform)) - return (FALSE); + return (false); } else { // allow access on match if (pat.Find(dotform) || pat.Find(hostform)) { passwd = ""; // no password required @@ -153,7 +153,7 @@ HylaFAXServer::checkuser(FILE* db, const char* name) } else passwd = ""; // no password required } - return (TRUE); + return (true); } } } @@ -163,7 +163,7 @@ HylaFAXServer::checkuser(FILE* db, const char* name) * folks that probe the server looking for valid accounts. */ passwd = "*"; - return (TRUE); + return (true); } fxDECLARE_PtrKeyDictionary(IDCache, u_int, fxStr) @@ -232,7 +232,7 @@ HylaFAXServer::userName(u_int id) /* * Map user name to fax UID. */ -fxBool +bool HylaFAXServer::userID(const char* name, u_int& id) { if (name == the_user) @@ -245,22 +245,22 @@ HylaFAXServer::userID(const char* name, u_int& id) for (IDCacheIter iter(*idcache); iter.notDone(); iter++) if (iter.value() == name) { id = iter.key(); - return (TRUE); + return (true); } - return (FALSE); + return (false); } - return (TRUE); + return (true); } -static fxBool +static bool isAllLower(const char* cp) { while (*cp) { if (!islower(*cp)) - return (FALSE); + return (false); cp++; } - return (TRUE); + return (true); } static void @@ -272,20 +272,20 @@ to64(char* cp, long v, int len) } } -fxBool +bool HylaFAXServer::cvtPasswd(const char* type, const char* pass, fxStr& result) { if (*pass == '\0') { // null password *IS* permitted result = ""; - return (TRUE); + return (true); } if (strlen(pass) <= 5) { reply(500, "%s password is too short; use 5-8 characters.", type); - return (FALSE); + return (false); } if (isAllLower(pass)) { reply(500, "%s password is all lower-case; use something more.", type); - return (FALSE); + return (false); } srandom((int) Sys::now()); char salt[9]; @@ -303,7 +303,7 @@ HylaFAXServer::cvtPasswd(const char* type, const char* pass, fxStr& result) to64(&salt[0], random(), 2); #endif result = crypt(pass, salt); - return (TRUE); + return (true); } #define NBPL (sizeof (u_long) * CHAR_BIT) // bits/u_long @@ -314,7 +314,7 @@ HylaFAXServer::cvtPasswd(const char* type, const char* pass, fxStr& result) #endif #define N(a) (sizeof (a) / sizeof (a[0])) -fxBool +bool HylaFAXServer::findUser(FILE* db, const char* user, u_int& newuid) { rewind(db); @@ -333,7 +333,7 @@ HylaFAXServer::findUser(FILE* db, const char* user, u_int& newuid) for (cp = line; *cp && *cp != ':'; cp++) ; if (strncmp(user, line, cp-line) == 0) - return (TRUE); + return (true); if (*cp == ':' && isdigit(cp[1])) { // mark uid as in-use u_int uid = (u_int) atoi(cp+1); SetBit(uid); @@ -346,13 +346,13 @@ HylaFAXServer::findUser(FILE* db, const char* user, u_int& newuid) for (u_long mask = 1; allocated[l] & mask; mask <<= 1) b++; newuid = (u_int) (l*NBPL + b); - return (FALSE); + return (false); } newuid = (u_int) -1; // no more space - return (FALSE); + return (false); } -fxBool +bool HylaFAXServer::addUser(FILE* db, const char* user, u_int uid, const char* upass, const char* apass) { fxStr templ("/" FAX_TMPDIR "/uaddXXXXXX"); @@ -360,7 +360,7 @@ HylaFAXServer::addUser(FILE* db, const char* user, u_int uid, const char* upass, if (fd < 0) { reply(550, "Error creating temp file %s: %s.", (const char*) templ, strerror(errno)); - return (FALSE); + return (false); } rewind(db); char buf[8*1024]; @@ -370,7 +370,7 @@ HylaFAXServer::addUser(FILE* db, const char* user, u_int uid, const char* upass, perror_reply(550, "Write error", errno); Sys::close(fd); (void) Sys::unlink(templ); - return (FALSE); + return (false); } fxStr line; if (*apass != '\0') @@ -383,15 +383,15 @@ HylaFAXServer::addUser(FILE* db, const char* user, u_int uid, const char* upass, perror_reply(550, "Write error", errno); Sys::close(fd); (void) Sys::unlink(templ); - return (FALSE); + return (false); } Sys::close(fd); if (Sys::rename(templ, fixPathname(userAccessFile)) < 0) { perror_reply(550, "Rename of temp file failed", errno); (void) Sys::unlink(templ); - return (FALSE); + return (false); } - return (TRUE); + return (true); } /* @@ -419,7 +419,7 @@ HylaFAXServer::addUserCmd(const char* user, const char* up, const char* ap) (const char*) userAccessFile, strerror(errno)); } -fxBool +bool HylaFAXServer::deleteUser(FILE* db, const char* user) { fxStr templ("/" FAX_TMPDIR "/udelXXXXXX"); @@ -428,7 +428,7 @@ HylaFAXServer::deleteUser(FILE* db, const char* user) if (fd < 0 || (ftmp = fdopen(fd, "w")) == NULL) { reply(550, "Error creating temp file %s: %s.", (const char*) templ, strerror(errno)); - return (FALSE); + return (false); } /* * Scan the existing file for the specified user @@ -437,7 +437,7 @@ HylaFAXServer::deleteUser(FILE* db, const char* user) * scanning line-by-line and just block-copy the * remaining part of the file. */ - fxBool found = FALSE; + bool found = false; rewind(db); char line[8*1024]; while (fgets(line, sizeof (line)-1, db)) { @@ -446,7 +446,7 @@ HylaFAXServer::deleteUser(FILE* db, const char* user) for (cp = line; *cp && *cp != '\n' && *cp != ':'; cp++) ; if (strncmp(user, line, cp-line) == 0) { - found = TRUE; + found = true; break; } } @@ -455,18 +455,18 @@ HylaFAXServer::deleteUser(FILE* db, const char* user) int cc; while ((cc = fread(line, 1, sizeof (line), db)) > 0) fwrite(line, cc, 1, ftmp); - fxBool ioError = (fclose(ftmp) != 0); + bool ioError = (fclose(ftmp) != 0); if (found) { if (ioError) perror_reply(550, "I/O error", errno); else if (Sys::rename(templ, fixPathname(userAccessFile)) < 0) perror_reply(550, "Rename of temp file failed", errno); else - return (TRUE); + return (true); } else reply(500, "User %s not found in access file.", user); (void) Sys::unlink(templ); - return (FALSE); + return (false); } /* diff --git a/hfaxd/main.c++ b/hfaxd/main.c++ index 275fd0cf..3a074576 100644 --- a/hfaxd/main.c++ +++ b/hfaxd/main.c++ @@ -224,18 +224,18 @@ main(int argc, char** argv, char** envp) switch (c) { case 'h': case 'i': case 'o': case 's': case 'u': if (detach == -1) // detach unless explicitly specified - detach = TRUE; + detach = true; break; case 'H': case 'I': case 'O': case 'S': if (detach == -1) // don't detach when invoked by inetd - detach = FALSE; + detach = false; break; - case 'd': detach = FALSE; break; + case 'd': detach = false; break; case 'q': queueDir = optarg; break; case '?': usage(appName); } if (detach == -1) // no protocol options means -I - detach = FALSE; + detach = false; if (Sys::chdir(queueDir) < 0) fatal(queueDir | ": Can not change directory"); CheckSpoolingSetup(); diff --git a/sendfax/sendfax.c++ b/sendfax/sendfax.c++ index 7dceb3ea..df2c3fae 100644 --- a/sendfax/sendfax.c++ +++ b/sendfax/sendfax.c++ @@ -50,7 +50,7 @@ public: sendFaxApp(); ~sendFaxApp(); - fxBool run(int argc, char** argv); + bool run(int argc, char** argv); }; fxStr sendFaxApp::dbName("~/.faxdb"); @@ -66,7 +66,7 @@ sendFaxApp::~sendFaxApp() delete db; } -fxBool +bool sendFaxApp::run(int argc, char** argv) { extern int optind; @@ -82,7 +82,7 @@ sendFaxApp::run(int argc, char** argv) readConfig(FAX_LIBDATA "/sendfax.conf"); readConfig(FAX_USERCONF); - fxBool waitForJob = FALSE; + bool waitForJob = false; int verbose = 0; SendFaxJob& proto = getProtoJob(); db = new FaxDB(tildeExpand(dbName)); @@ -116,7 +116,7 @@ sendFaxApp::run(int argc, char** argv) addDestination(optarg); break; case 'E': // disable use of ECM - proto.setDesiredEC(FALSE); + proto.setDesiredEC(false); break; case 'F': // override tag line format string proto.setTagLineFormat(optarg); @@ -146,7 +146,7 @@ sendFaxApp::run(int argc, char** argv) proto.setVResolution(196.); break; case 'n': // no cover sheet - proto.setAutoCoverPage(FALSE); + proto.setAutoCoverPage(false); break; case 'N': // no notification proto.setNotification("none"); @@ -175,14 +175,14 @@ sendFaxApp::run(int argc, char** argv) case 'v': // verbose mode verbose++; setvbuf(stdout, NULL, _IOLBF, BUFSIZ); - SendFaxClient::setVerbose(TRUE); // type rules & basic operation + SendFaxClient::setVerbose(true); // type rules & basic operation FaxClient::setVerbose(verbose > 1); // protocol tracing break; case 'V': // cover sheet: voice number field proto.setCoverVoiceNumber(optarg); break; case 'w': // wait for job to complete - waitForJob = TRUE; + waitForJob = true; break; case 'x': // cover page: to's company proto.setCoverCompany(optarg); @@ -207,7 +207,7 @@ sendFaxApp::run(int argc, char** argv) copyToTemporary(fileno(stdin), stdinTemp); addFile(stdinTemp); } - fxBool status = FALSE; + bool status = false; fxStr emsg; if (callServer(emsg)) { status = login(NULL, emsg) diff --git a/sendpage/sendpage.c++ b/sendpage/sendpage.c++ index c3a8a001..7d14ef50 100644 --- a/sendpage/sendpage.c++ +++ b/sendpage/sendpage.c++ @@ -49,7 +49,7 @@ public: sendPageApp(); ~sendPageApp(); - fxBool run(int argc, char** argv); + bool run(int argc, char** argv); }; sendPageApp::sendPageApp() @@ -63,7 +63,7 @@ sendPageApp::~sendPageApp() Sys::unlink(msgFile); } -fxBool +bool sendPageApp::run(int argc, char** argv) { extern int optind; @@ -80,7 +80,7 @@ sendPageApp::run(int argc, char** argv) readConfig(FAX_USERCONF); fxStr emsg; - fxBool noText = FALSE; // default is to assume message text + bool noText = false; // default is to assume message text SNPPJob& proto = getProtoJob(); while ((c = Sys::getopt(argc, argv, "a:De:f:h:i:I:l:nNp:qRs:t:T:v")) != -1) switch (c) { @@ -110,7 +110,7 @@ sendPageApp::run(int argc, char** argv) proto.setServiceLevel(atoi(optarg)); break; case 'n': // numeric-only page, no message text - noText = TRUE; + noText = true; break; case 'N': // no notification proto.setNotification("none"); @@ -119,7 +119,7 @@ sendPageApp::run(int argc, char** argv) addJob().setPIN(optarg); break; case 'q': // queue job and don't wait - proto.setQueued(TRUE); + proto.setQueued(true); break; case 'R': // notify when requeued or done proto.setNotification("when requeued"); @@ -132,7 +132,7 @@ sendPageApp::run(int argc, char** argv) break; case 'v': // client-server protocol tracing setvbuf(stdout, NULL, _IOLBF, BUFSIZ); - setVerbose(TRUE); + setVerbose(true); break; case '?': usage(); @@ -158,7 +158,7 @@ sendPageApp::run(int argc, char** argv) setPagerMsgFile(msgFile); } } - fxBool status = FALSE; + bool status = false; if (callServer(emsg)) { status = login(NULL, emsg) && prepareForJobSubmissions(emsg) diff --git a/util/Array.h b/util/Array.h index 33183fa5..c23aaffe 100644 --- a/util/Array.h +++ b/util/Array.h @@ -98,8 +98,8 @@ protected: fxAddress() { ptr = 0; } fxAddress(void* p) { ptr = (char*) p; } fxAddress operator+(u_long offset) const { return ptr + offset; } - fxBool operator==(const fxAddress& r) const { return ptr == r.ptr; } - fxBool operator!=(const fxAddress& r) const { return ptr != r.ptr; } + bool operator==(const fxAddress& r) const { return ptr == r.ptr; } + bool operator!=(const fxAddress& r) const { return ptr != r.ptr; } // NB: operator const void*() const does not work operator void*() const { return ptr; } protected: diff --git a/util/AtSyntax.c++ b/util/AtSyntax.c++ index 6b447af9..38236a33 100644 --- a/util/AtSyntax.c++ +++ b/util/AtSyntax.c++ @@ -49,12 +49,12 @@ isLeapYear(const tm& at) { #endif #define streq(a,b,n) (strncasecmp(a,b,n) == 0) -static fxBool checkDay(const char*& cp, int& day); +static bool checkDay(const char*& cp, int& day); static void adjustDay(struct tm& at, int day, const struct tm&); -static fxBool checkMonth(const char*& cp, int& month); -static fxBool parseMonthAndYear(const char*&, const struct tm& ref, +static bool checkMonth(const char*& cp, int& month); +static bool parseMonthAndYear(const char*&, const struct tm& ref, struct tm& at, fxStr& emsg); -static fxBool parseMultiplier(const char* cp, struct tm& at, fxStr& emsg); +static bool parseMultiplier(const char* cp, struct tm& at, fxStr& emsg); static const char* whitespace(const char* cp); static void fixup(struct tm& at); @@ -102,20 +102,20 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg) int min = 10*(cp[1]-'0') + (cp[2]-'0'); if (min >= 60) { _atError(emsg, "Illegal minutes value %u", min); - return (FALSE); + return (false); } v += min; cp += 3; } else { _atSyntax(emsg, "expecting HH:MM"); - return (FALSE); + return (false); } } cp = whitespace(cp); if (streq(cp, "am", 2)) { if (v >= HALFDAY+HOUR) { _atError(emsg, "%u:%02u is not an AM value", v/HOUR, v%HOUR); - return (FALSE); + return (false); } if (HALFDAY <= v && v < HALFDAY+HOUR) v -= HALFDAY; @@ -123,7 +123,7 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg) } else if (streq(cp, "pm", 2)) { if (v >= HALFDAY+HOUR) { _atError(emsg, "%u:%02u is not a PM value", v/HOUR, v%HOUR); - return (FALSE); + return (false); } if (v < HALFDAY) v += HALFDAY; @@ -144,12 +144,12 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg) cp += 4; } else { _atSyntax(emsg, "unrecognized symbolic time \"%s\"", cp); - return (FALSE); + return (false); } } if ((unsigned) v >= FULLDAY) { _atError(emsg, "Illegal time value; out of range"); - return (FALSE); + return (false); } at.tm_hour = v/HOUR; at.tm_min = v%HOUR; @@ -162,7 +162,7 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg) if (checkMonth(cp, v)) { at.tm_mon = v; if (!parseMonthAndYear(cp, ref, at, emsg)) - return (FALSE); + return (false); } else if (checkDay(cp, v)) { adjustDay(at, v, ref); } else { @@ -173,7 +173,7 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg) cp += 8; } else if (cp[0] != '\0' && cp[0] != '+') { _atSyntax(emsg, "expecting \"+\" after time"); - return (FALSE); + return (false); } /* * Adjust the date according to whether it is before ``now''. @@ -185,14 +185,14 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg) * Process any increment expression. */ if (cp[0] == '+' && !parseMultiplier(++cp, at, emsg)) - return (FALSE); + return (false); fixup(at); if (at < ref) { _atError(emsg, "Invalid date/time; time must be in the future"); - return (FALSE); + return (false); } at0 = at; - return (TRUE); + return (true); } /* @@ -214,7 +214,7 @@ whitespace(const char* cp) * return the day number [0..6] and update * the character pointer. */ -static fxBool +static bool checkDay(const char*& cp, int& day) { static const char* days[] = { @@ -227,14 +227,14 @@ again: if (streq(cp, days[i], len)) { cp += len; day = i; - return (TRUE); + return (true); } if (len != 3) { // an Algol-style for loop... len = 3; goto again; } } - return (FALSE); + return (false); } /* @@ -267,7 +267,7 @@ static const char* months[] = { * return the month index [0..11] and update * the character pointer. */ -static fxBool +static bool checkMonth(const char*& cp, int& month) { for (u_int i = 0; i < N(months); i++) { @@ -276,14 +276,14 @@ again: if (streq(cp, months[i], len)) { cp += len; month = i; - return (TRUE); + return (true); } if (len != 3) { // an Algol-style for loop... len = 3; goto again; } } - return (FALSE); + return (false); } /* @@ -308,14 +308,14 @@ adjustYDay(struct tm& t) /* * Parse an expected day [, year] expression. */ -static fxBool +static bool parseMonthAndYear(const char*& cp, const struct tm& ref, struct tm& at, fxStr& emsg) { char* tp; at.tm_mday = (u_int) strtoul(cp, &tp, 10); if (tp == cp) { _atSyntax(emsg, "missing or invalid day of month"); - return (FALSE); + return (false); } at.tm_mday--; // tm_mday is [0..31] tp = (char*) whitespace(tp); @@ -324,12 +324,12 @@ parseMonthAndYear(const char*& cp, const struct tm& ref, struct tm& at, fxStr& e u_int year = (u_int) strtoul(++tp, &xp, 10); if (tp == xp) { _atSyntax(emsg, "missing year"); - return (FALSE); + return (false); } if (year < TM_YEAR_BASE) { _atError(emsg, "Sorry, cannot handle dates before %u", TM_YEAR_BASE); - return (FALSE); + return (false); } at.tm_year = year - TM_YEAR_BASE; adjustYDay(at); @@ -352,22 +352,22 @@ parseMonthAndYear(const char*& cp, const struct tm& ref, struct tm& at, fxStr& e if (at.tm_mday > days[at.tm_mon]) { _atError(emsg, "Invalid day of month, %s has only %u days", months[at.tm_mon], days[at.tm_mon]); - return (FALSE); + return (false); } cp = tp; - return (TRUE); + return (true); } /* * Parse an expected multiplier expression. */ -static fxBool +static bool parseMultiplier(const char* cp, struct tm& at, fxStr& emsg) { cp = whitespace(cp); if (!isdigit(cp[0])) { _atSyntax(emsg, "expecting number after \"+\""); - return (FALSE); + return (false); } int v = 0; for (; isdigit(*cp); cp++) @@ -375,7 +375,7 @@ parseMultiplier(const char* cp, struct tm& at, fxStr& emsg) cp = whitespace(cp); if (*cp == '\0') { _atSyntax(emsg, "\"+%u\" without unit", v); - return (FALSE); + return (false); } if (streq(cp, "minute", 6)) at.tm_min += v; @@ -394,9 +394,9 @@ parseMultiplier(const char* cp, struct tm& at, fxStr& emsg) at.tm_year += v; else { _atError(emsg, "Unknown increment unit \"%s\"", cp); - return (FALSE); + return (false); } - return (TRUE); + return (true); } /* @@ -413,7 +413,7 @@ fixup(struct tm& at) at.tm_hour++, at.tm_min -= HOUR; while (at.tm_hour >= FULLDAY) at.tm_yday++, at.tm_hour -= FULLDAY; - fxBool leap; + bool leap; int daysinyear; for (;;) { leap = isLeapYear(at); diff --git a/util/BoolArray.c++ b/util/BoolArray.c++ index 40a0e699..6772f427 100644 --- a/util/BoolArray.c++ +++ b/util/BoolArray.c++ @@ -25,4 +25,4 @@ */ #include "BoolArray.h" -fxIMPLEMENT_PrimArray(fxBoolArray, fxBool) +fxIMPLEMENT_PrimArray(fxBoolArray, bool) diff --git a/util/BoolArray.h b/util/BoolArray.h index 1f14d3e0..e4441fc1 100644 --- a/util/BoolArray.h +++ b/util/BoolArray.h @@ -28,5 +28,5 @@ #include "Array.h" -fxDECLARE_PrimArray(fxBoolArray, fxBool) +fxDECLARE_PrimArray(fxBoolArray, bool) #endif /* _BoolArray_ */ diff --git a/util/Class2Params.c++ b/util/Class2Params.c++ index 4ba48fdb..68bd0d7d 100644 --- a/util/Class2Params.c++ +++ b/util/Class2Params.c++ @@ -91,7 +91,7 @@ Class2Params::cmd() const return fxStr(buf); } -fxBool +bool Class2Params::is2D() const { return (DF_2DMR <= df && df <= DF_2DMRUNCOMP); diff --git a/util/Class2Params.h b/util/Class2Params.h index 03c68452..c33d0604 100644 --- a/util/Class2Params.h +++ b/util/Class2Params.h @@ -80,7 +80,7 @@ public: void setFromDCS(u_int dcs, u_int xinfo = 0); u_int getDCS() const; u_int getXINFO() const; - fxBool is2D() const; + bool is2D() const; u_int transferSize(u_int ms) const; u_int minScanlineSize() const; diff --git a/util/DialRules.c++ b/util/DialRules.c++ index f19eb6a0..1438399c 100644 --- a/util/DialRules.c++ +++ b/util/DialRules.c++ @@ -63,7 +63,7 @@ fxIMPLEMENT_StrKeyObjValueDictionary(RulesDict, RuleArrayPtr) DialStringRules::DialStringRules(const char* file) : filename(file) { - verbose = FALSE; + verbose = false; fp = NULL; vars = new VarDict; regex = new RegExArray; @@ -77,16 +77,16 @@ DialStringRules::~DialStringRules() delete vars; } -void DialStringRules::setVerbose(fxBool b) { verbose = b; } +void DialStringRules::setVerbose(bool b) { verbose = b; } /* * Parse the dialing string rules file * to create the in-memory rules. */ -fxBool -DialStringRules::parse(fxBool shouldExist) +bool +DialStringRules::parse(bool shouldExist) { - fxBool ok = FALSE; + bool ok = false; lineno = 0; fp = fopen(filename, "r"); if (fp) { @@ -115,7 +115,7 @@ DialStringRules::undef(const fxStr& var) vars->remove(var); } -fxBool +bool DialStringRules::parseRules() { char line[1024]; @@ -124,7 +124,7 @@ DialStringRules::parseRules() // collect token if (!isalpha(*cp)) { parseError("Syntax error, expecting identifier"); - return (FALSE); + return (false); } const char* tp = cp; for (cp++; isalnum(*cp); cp++) @@ -136,14 +136,14 @@ DialStringRules::parseRules() for (cp += 2; *cp != '['; cp++) if (*cp == '\0') { parseError("Missing '[' while parsing rule set"); - return (FALSE); + return (false); } if (verbose) traceParse("%s := [", (const char*) var); RuleArray* ra = new RuleArray; if (!parseRuleSet(*ra)) { delete ra; - return (FALSE); + return (false); } (*rules)[var] = ra; if (verbose) @@ -151,11 +151,11 @@ DialStringRules::parseRules() } else if (*cp == '=') { // variable definition fxStr value; if (parseToken(cp+1, value) == NULL) - return (FALSE); + return (false); def(var, value); } else { // an error parseError("Missing '=' or ':=' after \"%s\"", (const char*) var); - return (FALSE); + return (false); } } if (verbose) { @@ -166,7 +166,7 @@ DialStringRules::parseRules() if (ra == 0) traceParse("Warning, no \"DialString\" rules."); } - return (TRUE); + return (true); } /* @@ -244,7 +244,7 @@ DialStringRules::parseToken(const char* cp, fxStr& v) u_int l = v.next(i, '}'); if (l >= v.length()) { parseError("Missing '}' for variable reference"); - return (FALSE); + return (NULL); } fxStr var = v.cut(i+2,l-(i+2));// variable name v.remove(i, 3); // remove ${} @@ -283,7 +283,7 @@ DialStringRules::subRHS(fxStr& v) * Parse a set of rules and construct the array of * rules (regular expressions + replacement strings). */ -fxBool +bool DialStringRules::parseRuleSet(RuleArray& rules) { for (;;) { @@ -291,23 +291,23 @@ DialStringRules::parseRuleSet(RuleArray& rules) const char* cp = nextLine(line, sizeof (line)); if (!cp) { parseError("Missing ']' while parsing rule set"); - return (FALSE); + return (false); } if (*cp == ']') - return (TRUE); + return (true); // new rule fxStr pat; if ((cp = parseToken(cp, pat)) == NULL) - return (FALSE); + return (false); while (isspace(*cp)) cp++; if (*cp != '=') { parseError("Rule pattern without '='"); - return (FALSE); + return (false); } DialRule r; if (parseToken(cp+1, r.replace) == NULL) - return (FALSE); + return (false); if (verbose) traceParse(" \"%s\" = \"%s\"", (const char*) pat, (const char*) r.replace); diff --git a/util/DialRules.h b/util/DialRules.h index 9685f23f..78c767b1 100644 --- a/util/DialRules.h +++ b/util/DialRules.h @@ -51,12 +51,12 @@ private: u_int lineno; // current line number during parsing FILE* fp; // open file during parsing VarDict* vars; // defined variables during parsing - fxBool verbose; // trace parsing of rules file + bool verbose; // trace parsing of rules file RegExArray* regex; // regular expressions RulesDict* rules; // rules defined in the file - fxBool parseRules(); - fxBool parseRuleSet(RuleArray& rules); + bool parseRules(); + bool parseRuleSet(RuleArray& rules); const char* parseToken(const char* cp, fxStr& v); char* nextLine(char* line, int lineSize); void subRHS(fxStr& v); @@ -68,14 +68,14 @@ public: DialStringRules(const char* filename); virtual ~DialStringRules(); - void setVerbose(fxBool b); + void setVerbose(bool b); u_int getLineno() const; const fxStr& getFilename() const; void def(const fxStr& var, const fxStr& value); void undef(const fxStr& var); - fxBool parse(fxBool shouldExist = TRUE); + bool parse(bool shouldExist = true); fxStr applyRules(const fxStr& name, const fxStr& s); fxStr canonicalNumber(const fxStr&); diff --git a/util/Dictionary.c++ b/util/Dictionary.c++ index 005068c6..73664c51 100644 --- a/util/Dictionary.c++ +++ b/util/Dictionary.c++ @@ -79,7 +79,7 @@ void fxDictionary::cleanup() for (i=0; i < l; i++) { iters[i]->dict = 0; iters[i]->node = 0; - iters[i]->invalid = TRUE; + iters[i]->invalid = true; } } @@ -241,7 +241,7 @@ fxDictionary::invalidateIters(const fxDictBucket *db) fxDictIter* di = iters[i]; if (di->node == db) { (*di)++; - if (di->dict) di->invalid = TRUE; + if (di->dict) di->invalid = true; } } } @@ -250,7 +250,7 @@ fxDictionary::invalidateIters(const fxDictBucket *db) fxDictIter::fxDictIter() { - invalid = FALSE; + invalid = false; dict = 0; bucket = 0; node = 0; @@ -258,7 +258,7 @@ fxDictIter::fxDictIter() fxDictIter::fxDictIter(fxDictionary& d) { - invalid = FALSE; + invalid = false; dict = &d; bucket = 0; node = d.buckets[bucket]; @@ -278,7 +278,7 @@ fxDictIter::operator=(fxDictionary& d) dict = &d; bucket = 0; node = d.buckets[bucket]; - invalid = FALSE; + invalid = false; d.addIter(this); if (!node) advanceToValid(); } @@ -302,7 +302,7 @@ fxDictIter::increment() { if (!dict) return; if (invalid) { - invalid = FALSE; + invalid = false; return; } node = node->next; @@ -323,12 +323,12 @@ fxDictIter::advanceToValid() if (bucket == len) { dict->removeIter(this); // it's done with us dict = 0; - invalid = TRUE; + invalid = true; break; } if (n = dict->buckets[bucket]) { // NB: intentional = node = n; - invalid = FALSE; + invalid = false; break; } } diff --git a/util/Dictionary.h b/util/Dictionary.h index d784d8f4..448c7f36 100644 --- a/util/Dictionary.h +++ b/util/Dictionary.h @@ -74,8 +74,8 @@ public: operator KEY const &() const KEY const& key() const; VALUE& value() const; - fxBool removed(); - fxBool notDone(); + bool removed(); + bool notDone(); } *******************************************/ @@ -155,8 +155,8 @@ public: void operator=(fxDictionary&); // not a const argument! void operator++() { increment(); } void operator++(int) { increment(); } - fxBool removed() const { return invalid; } - fxBool notDone() const { return node != 0; } + bool removed() const { return invalid; } + bool notDone() const { return node != 0; } protected: void* getKey() const; void* getValue() const; diff --git a/util/Dispatcher.c++ b/util/Dispatcher.c++ index 47e543ab..1c174b29 100644 --- a/util/Dispatcher.c++ +++ b/util/Dispatcher.c++ @@ -76,23 +76,23 @@ timeval operator-(timeval src1, timeval src2) { return delta; } -fxBool operator>(timeval src1, timeval src2) { +bool operator>(timeval src1, timeval src2) { if (src1.tv_sec > src2.tv_sec) { - return TRUE; + return true; } else if (src1.tv_sec == src2.tv_sec && src1.tv_usec > src2.tv_usec) { - return TRUE; + return true; } else { - return FALSE; + return false; } } -fxBool operator<(timeval src1, timeval src2) { +bool operator<(timeval src1, timeval src2) { if (src1.tv_sec < src2.tv_sec) { - return TRUE; + return true; } else if (src1.tv_sec == src2.tv_sec && src1.tv_usec < src2.tv_usec) { - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -113,7 +113,7 @@ public: TimerQueue(); virtual ~TimerQueue(); - fxBool isEmpty() const; + bool isEmpty() const; static timeval zeroTime(); timeval earliestTime() const; static timeval currentTime(); @@ -145,7 +145,7 @@ TimerQueue::~TimerQueue() { } } -inline fxBool TimerQueue::isEmpty() const { +inline bool TimerQueue::isEmpty() const { return _first == NULL; } @@ -221,8 +221,8 @@ public: ChildQueue(); virtual ~ChildQueue(); - fxBool isEmpty() const; - fxBool isReady() const; + bool isEmpty() const; + bool isReady() const; void insert(pid_t, IOHandler*); void remove(IOHandler*); @@ -230,7 +230,7 @@ public: void setStatus(pid_t, int status); private: Child* _first; // queue head - fxBool _ready; // something is ready + bool _ready; // something is ready }; Child::Child(pid_t p, IOHandler* h, Child* n) @@ -244,7 +244,7 @@ Child::Child(pid_t p, IOHandler* h, Child* n) ChildQueue::ChildQueue() { _first = NULL; - _ready = FALSE; + _ready = false; } ChildQueue::~ChildQueue() { @@ -256,8 +256,8 @@ ChildQueue::~ChildQueue() { } } -inline fxBool ChildQueue::isEmpty() const { return _first == NULL; } -inline fxBool ChildQueue::isReady() const { return _ready; } +inline bool ChildQueue::isEmpty() const { return _first == NULL; } +inline bool ChildQueue::isReady() const { return _ready; } void ChildQueue::insert(pid_t p, IOHandler* handler) { /* @@ -298,7 +298,7 @@ void ChildQueue::setStatus(pid_t p, int status) { for (Child* c = _first; c != NULL; c = c->next) if (c->pid == p) { c->status = status; - _ready = TRUE; + _ready = true; break; } } @@ -315,7 +315,7 @@ void ChildQueue::notify() { } else prev = &c->next; } - _ready = FALSE; + _ready = false; } Dispatcher::Dispatcher() { @@ -440,9 +440,9 @@ void Dispatcher::stopChild(IOHandler* handler) { _cqueue->remove(handler); } -fxBool Dispatcher::setReady(int fd, DispatcherMask mask) { +bool Dispatcher::setReady(int fd, DispatcherMask mask) { if (handler(fd, mask) == NULL) { - return FALSE; + return false; } if (mask == ReadMask) { FD_SET(fd, &_rmaskready); @@ -451,16 +451,16 @@ fxBool Dispatcher::setReady(int fd, DispatcherMask mask) { } else if (mask == ExceptMask) { FD_SET(fd, &_emaskready); } else { - return FALSE; + return false; } - return TRUE; + return true; } void Dispatcher::dispatch() { dispatch(NULL); } -fxBool Dispatcher::dispatch(long& sec, long& usec) { +bool Dispatcher::dispatch(long& sec, long& usec) { timeval howlong; timeval prevTime; timeval elapsedTime; @@ -469,7 +469,7 @@ fxBool Dispatcher::dispatch(long& sec, long& usec) { howlong.tv_usec = usec; prevTime = TimerQueue::currentTime(); - fxBool success = dispatch(&howlong); + bool success = dispatch(&howlong); elapsedTime = TimerQueue::currentTime() - prevTime; if (howlong > elapsedTime) { @@ -483,7 +483,7 @@ fxBool Dispatcher::dispatch(long& sec, long& usec) { return success; } -fxBool Dispatcher::dispatch(timeval* howlong) { +bool Dispatcher::dispatch(timeval* howlong) { fd_set rmask; fd_set wmask; fd_set emask; @@ -501,7 +501,7 @@ fxBool Dispatcher::dispatch(timeval* howlong) { return (nfound != 0); } -fxBool Dispatcher::anyReady() const { +bool Dispatcher::anyReady() const { if (!_cqueue->isEmpty()) { Dispatcher::sigCLD(0); // poll for pending children return _cqueue->isReady(); @@ -509,10 +509,10 @@ fxBool Dispatcher::anyReady() const { for (int i = 0; i < _nfds; i++) { if (FD_ISSET(i, &_rmaskready) || FD_ISSET(i, &_wmaskready) || FD_ISSET(i, &_emaskready)) { - return TRUE; + return true; } } - return FALSE; + return false; } int Dispatcher::fillInReady( @@ -682,20 +682,20 @@ timeval* Dispatcher::calculateTimeout(timeval* howlong) const { extern void fxFatal(const char* fmt, ...); -fxBool Dispatcher::handleError() { +bool Dispatcher::handleError() { switch (errno) { case EBADF: checkConnections(); break; case EINTR: if (_cqueue->isReady()) - return TRUE; + return true; break; default: fxFatal("Dispatcher: select: %s", strerror(errno)); /*NOTREACHED*/ } - return FALSE; // retry select + return false; // retry select } void Dispatcher::checkConnections() { diff --git a/util/Dispatcher.h b/util/Dispatcher.h index bc174c1d..225fa26e 100644 --- a/util/Dispatcher.h +++ b/util/Dispatcher.h @@ -58,22 +58,22 @@ public: virtual void startChild(pid_t pid, IOHandler*); virtual void stopChild(IOHandler*); - virtual fxBool setReady(int fd, DispatcherMask); + virtual bool setReady(int fd, DispatcherMask); virtual void dispatch(); - virtual fxBool dispatch(long& sec, long& usec); + virtual bool dispatch(long& sec, long& usec); static Dispatcher& instance(); static void instance(Dispatcher*); protected: virtual void attach(int fd, DispatcherMask, IOHandler*); virtual void detach(int fd); - virtual fxBool dispatch(timeval*); - virtual fxBool anyReady() const; + virtual bool dispatch(timeval*); + virtual bool anyReady() const; virtual int fillInReady(fd_set&, fd_set&, fd_set&); virtual int waitFor(fd_set&, fd_set&, fd_set&, timeval*); virtual void notify(int, fd_set&, fd_set&, fd_set&); virtual timeval* calculateTimeout(timeval*) const; - virtual fxBool handleError(); + virtual bool handleError(); virtual void checkConnections(); protected: int _nfds; diff --git a/util/FaxClient.c++ b/util/FaxClient.c++ index 00ef0602..4f5d8bfc 100644 --- a/util/FaxClient.c++ +++ b/util/FaxClient.c++ @@ -167,7 +167,7 @@ void FaxClient::setModem(const fxStr& modemarg) { modem = modemarg; } void FaxClient::setModem(const char* modemarg) { modem = modemarg; } void -FaxClient::setVerbose(fxBool v) +FaxClient::setVerbose(bool v) { if (v) state |= FS_VERBOSE; @@ -175,7 +175,7 @@ FaxClient::setVerbose(fxBool v) state &= ~FS_VERBOSE; } -fxBool +bool FaxClient::setupUserIdentity(fxStr& emsg) { struct passwd* pwd = NULL; @@ -191,7 +191,7 @@ FaxClient::setupUserIdentity(fxStr& emsg) emsg = fxStr::format( "Can not locate your password entry (account name %s, uid %lu).", (name ? name : ""), (u_long) getuid()); - return (FALSE); + return (false); } userName = pwd->pw_name; if (pwd->pw_gecos && pwd->pw_gecos[0] != '\0') { @@ -215,9 +215,9 @@ FaxClient::setupUserIdentity(fxStr& emsg) if (senderName.length() == 0) { emsg = "Bad (null) user name; your password file entry" " probably has bogus GECOS field information."; - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* @@ -271,7 +271,7 @@ FaxClient::configTrace(const char* fmt ...) } } -fxBool +bool FaxClient::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -295,11 +295,11 @@ FaxClient::setConfigItem(const char* tag, const char* value) } else if (streq(tag, "filefmt")) { setFileStatusFormat(value); } else - return (FALSE); - return (TRUE); + return (false); + return (true); } -fxBool +bool FaxClient::callServer(fxStr& emsg) { if (host.length() == 0) { // if host not specified by -h @@ -320,12 +320,12 @@ FaxClient::callServer(fxStr& emsg) * Transport code is expected to call back through * setCtrlFds so fdIn should be properly setup... */ - return (fdIn != NULL && getReply(FALSE) == COMPLETE); + return (fdIn != NULL && getReply(false) == COMPLETE); } else - return (FALSE); + return (false); } -fxBool +bool FaxClient::hangupServer(void) { if (fdIn != NULL) { @@ -342,7 +342,7 @@ FaxClient::hangupServer(void) */ delete transport, transport = NULL; initServerState(); - return (TRUE); + return (true); } void @@ -367,7 +367,7 @@ FaxClient::setDataFd(int fd) /* * Do login procedure. */ -fxBool +bool FaxClient::login(const char* user, fxStr& emsg) { if (user == NULL) { @@ -390,10 +390,10 @@ FaxClient::login(const char* user, fxStr& emsg) (void) setTimeZone(tz); state &= ~FS_TZPEND; } - return (TRUE); + return (true); } else { emsg = "Login failed: " | lastResponse; - return (FALSE); + return (false); } } @@ -409,58 +409,58 @@ FaxClient::getPasswd(const char* prompt) /* * Do admin login procedure. */ -fxBool +bool FaxClient::admin(const char* pass, fxStr& emsg) { if (command("ADMIN %s", pass ? pass : getpass("Password:")) != COMPLETE) { emsg = "Admin failed: " | lastResponse; - return (FALSE); + return (false); } else - return (TRUE); + return (true); } -fxBool +bool FaxClient::setCommon(const FaxParam& parm, u_int v) { if (v != this->*parm.pv) { if (0 < v && v < parm.NparmNames) { if (command("%s %s", parm.cmd, parm.parmNames[v]) != COMPLETE) { printError("%s", (const char*) lastResponse); - return (FALSE); + return (false); } } else { printError("Bad %s parameter value %u.", parm.cmd, v); - return (FALSE); + return (false); } this->*parm.pv = v; } - return (TRUE); + return (true); } static const char* typeNames[] = { "", "A", "E", "I", "L" }; const FaxClient::FaxParam FaxClient::typeParam = { "TYPE", typeNames, N(typeNames), &FaxClient::type }; -fxBool FaxClient::setType(u_int v) { return setCommon(typeParam, v); } +bool FaxClient::setType(u_int v) { return setCommon(typeParam, v); } static const char* modeNames[] = { "", "S", "B", "C", "Z" }; const FaxClient::FaxParam FaxClient::modeParam = { "MODE", modeNames, N(modeNames), &FaxClient::mode }; -fxBool FaxClient::setMode(u_int v) { return setCommon(modeParam, v); } +bool FaxClient::setMode(u_int v) { return setCommon(modeParam, v); } static const char* struNames[] = { "", "F", "R", "P", "T" }; const FaxClient::FaxParam FaxClient::struParam = { "STRU", struNames, N(struNames), &FaxClient::stru }; -fxBool FaxClient::setStruct(u_int v) { return setCommon(struParam, v); } +bool FaxClient::setStruct(u_int v) { return setCommon(struParam, v); } static const char* formNames[] = { "", "PS", "PS2", "TIFF", "PCL" }; const FaxClient::FaxParam FaxClient::formParam = { "FORM", formNames, N(formNames), &FaxClient::format }; -fxBool FaxClient::setFormat(u_int v) { return setCommon(formParam, v); } +bool FaxClient::setFormat(u_int v) { return setCommon(formParam, v); } static const char* tzoneNames[] = { "", "GMT", "LOCAL" }; const FaxClient::FaxParam FaxClient::tzoneParam = { "TZONE", tzoneNames, N(tzoneNames), &FaxClient::tzone }; -fxBool +bool FaxClient::setTimeZone(u_int v) { if (!isLoggedIn()) { // set and mark pending accordingly @@ -472,9 +472,9 @@ FaxClient::setTimeZone(u_int v) state |= FS_TZPEND; } else { printError("Bad time zone parameter value %u.", v); - return (FALSE); + return (false); } - return (TRUE); + return (true); } else // pass directly to server return setCommon(tzoneParam, v); } @@ -502,7 +502,7 @@ FaxClient::setTimeZone(u_int v) * is provided for this use. */ -fxBool +bool FaxClient::initDataConn(fxStr& emsg) { closeDataConn(); @@ -510,23 +510,23 @@ FaxClient::initDataConn(fxStr& emsg) if (!transport->initDataConn(emsg)) { if (emsg == "") emsg = "Unable to initialize data connection to server"; - return (FALSE); + return (false); } } - return (TRUE); + return (true); } -fxBool +bool FaxClient::openDataConn(fxStr& emsg) { if (transport) { if (!transport->openDataConn(emsg)) { if (emsg == "") emsg = "Unable to open data connection to server"; - return (FALSE); + return (false); } } - return (TRUE); + return (true); } void @@ -538,7 +538,7 @@ FaxClient::closeDataConn(void) } } -fxBool +bool FaxClient::abortDataConn(fxStr& emsg) { if (fdData >= 0 && transport) { @@ -546,7 +546,7 @@ FaxClient::abortDataConn(fxStr& emsg) if (!transport->abortCmd(emsg)) { if (emsg == "") emsg = "Unable to abort data connection to server"; - return (FALSE); + return (false); } #ifdef notdef /* @@ -563,13 +563,13 @@ FaxClient::abortDataConn(fxStr& emsg) * existing operation is aborted followed by an ack * of the ABOR command itself. */ - if (getReply(FALSE) != TRANSIENT || // 4xx operation aborted - getReply(FALSE) != COMPLETE) { // 2xx abort successful + if (getReply(false) != TRANSIENT || // 4xx operation aborted + getReply(false) != COMPLETE) { // 2xx abort successful unexpectedResponse(emsg); - return (FALSE); + return (false); } } - return (TRUE); + return (true); } void @@ -672,10 +672,10 @@ getReplyCode(const char* cp) * handled but not collected. */ int -FaxClient::getReply(fxBool expecteof) +FaxClient::getReply(bool expecteof) { int firstCode = 0; - fxBool continuation = FALSE; + bool continuation = false; do { lastResponse.resize(0); int c; @@ -719,9 +719,9 @@ FaxClient::getReply(fxBool expecteof) if (lastResponse[3] == '-') { // continuation line if (firstCode == 0) // first line of reponse firstCode = code; - continuation = TRUE; + continuation = true; } else if (code == firstCode) // end of continued reply - continuation = FALSE; + continuation = false; } } while (continuation || code == 0); @@ -739,7 +739,7 @@ FaxClient::getReply(fxBool expecteof) * case was). The resulting string is checked to * make sure that it is not null. */ -fxBool +bool FaxClient::extract(u_int& pos, const char* pattern, fxStr& result, const char* cmd, fxStr& emsg) { @@ -755,24 +755,24 @@ FaxClient::extract(u_int& pos, const char* pattern, fxStr& result, if (l == lastResponse.length()) { protocolBotch(emsg, ": No \"%s\" in %s response: %s", pattern, cmd, (const char*) lastResponse); - return (FALSE); + return (false); } l = lastResponse.skip(l+pat.length(), ' ');// skip white space result = lastResponse.extract(l, lastResponse.next(l, ' ')-l); if (result == "") { protocolBotch(emsg, ": Null %s in %s response: %s", pattern, cmd, (const char*) lastResponse); - return (FALSE); + return (false); } pos = l; // update position - return (TRUE); + return (true); } /* * Create a new job and return its job-id * and group-id, parsed from the reply. */ -fxBool +bool FaxClient::newJob(fxStr& jobid, fxStr& groupid, fxStr& emsg) { if (command("JNEW") == COMPLETE) { @@ -796,55 +796,55 @@ FaxClient::newJob(fxStr& jobid, fxStr& groupid, fxStr& emsg) jobid.resize(jobid.skip(0, "0123456789")); groupid.resize(groupid.skip(0, "0123456789")); curjob = jobid; - return (TRUE); + return (true); } } else unexpectedResponse(emsg); } else emsg = lastResponse; - return (FALSE); + return (false); } /* * Set the current job on the server. */ -fxBool +bool FaxClient::setCurrentJob(const char* jobid) { if (strcasecmp(jobid, curjob) != 0) { if (command("JOB %s", jobid) != COMPLETE) - return (FALSE); + return (false); curjob = jobid; } - return (TRUE); + return (true); } -fxBool +bool FaxClient::jobParm(const char* name, const fxStr& value) { return jobParm(name, (const char*) value); } -fxBool +bool FaxClient::jobParm(const char* name, const char* value) { return (command("JPARM %s \"%s\"", name, value) == COMPLETE); } -fxBool -FaxClient::jobParm(const char* name, fxBool b) +bool +FaxClient::jobParm(const char* name, bool b) { return (command("JPARM %s %s", name, b ? "YES" : "NO") == COMPLETE); } -fxBool +bool FaxClient::jobParm(const char* name, u_int v) { return (command("JPARM %s %u", name, v) == COMPLETE); } -fxBool +bool FaxClient::jobParm(const char* name, float v) { return (command("JPARM %s %g", name, v) == COMPLETE); } -fxBool +bool FaxClient::jobSendTime(const struct tm tm) { return (command("JPARM SENDTIME %d%02d%02d%02d%02d" @@ -855,57 +855,57 @@ FaxClient::jobSendTime(const struct tm tm) , tm.tm_min ) == COMPLETE); } -fxBool +bool FaxClient::jobLastTime(u_long tv) { return (command("JPARM LASTTIME %02d%02d%02d", tv/(24*60*60), (tv/(60*60))%24, (tv/60)%60) == COMPLETE); } -fxBool +bool FaxClient::jobRetryTime(u_long tv) { return (command("JPARM RETRYTIME %02d%02d", tv/60, tv%60) == COMPLETE); } -fxBool +bool FaxClient::jobCover(const char* docname) { return (command("JPARM COVER %s", docname) == COMPLETE); } -fxBool +bool FaxClient::jobDocument(const char* docname) { return (command("JPARM DOCUMENT %s", docname) == COMPLETE); } -fxBool +bool FaxClient::jobPollRequest(const char* sep, const char* pwd) { return (command("JPARM POLL \"%s\" \"%s\"", sep, pwd) == COMPLETE); } -fxBool +bool FaxClient::jobOp(const char* op, const char* jobid) { return (command(jobid == curjob ? "%s" : "%s %s", op, jobid) == COMPLETE); } -fxBool FaxClient::jobSubmit(const char* jobid) { return jobOp("JSUBM",jobid); } -fxBool FaxClient::jobSuspend(const char* jobid) { return jobOp("JSUSP",jobid); } -fxBool FaxClient::jobKill(const char* jobid) { return jobOp("JKILL",jobid); } -fxBool FaxClient::jobDelete(const char* jobid) { return jobOp("JDELE",jobid); } -fxBool FaxClient::jobWait(const char* jobid) { return jobOp("JWAIT",jobid); } +bool FaxClient::jobSubmit(const char* jobid) { return jobOp("JSUBM",jobid); } +bool FaxClient::jobSuspend(const char* jobid) { return jobOp("JSUSP",jobid); } +bool FaxClient::jobKill(const char* jobid) { return jobOp("JKILL",jobid); } +bool FaxClient::jobDelete(const char* jobid) { return jobOp("JDELE",jobid); } +bool FaxClient::jobWait(const char* jobid) { return jobOp("JWAIT",jobid); } -fxBool FaxClient::jgrpSubmit(const char* jgrpid) +bool FaxClient::jgrpSubmit(const char* jgrpid) { return (command("JGSUBM %s", jgrpid) == COMPLETE); } -fxBool FaxClient::jgrpSuspend(const char* jgrpid) +bool FaxClient::jgrpSuspend(const char* jgrpid) { return (command("JGSUSP %s", jgrpid) == COMPLETE); } -fxBool FaxClient::jgrpKill(const char* jgrpid) +bool FaxClient::jgrpKill(const char* jgrpid) { return (command("JGKILL %s", jgrpid) == COMPLETE); } -fxBool FaxClient::jgrpWait(const char* jgrpid) +bool FaxClient::jgrpWait(const char* jgrpid) { return (command("JGWAIT %s", jgrpid) == COMPLETE); } -fxBool +bool FaxClient::runScript(const char* filename, fxStr& emsg) { - fxBool ok = FALSE; + bool ok = false; FILE* fd = fopen(filename, "r"); if (fd != NULL) { ok = runScript(fd, filename, emsg); @@ -915,10 +915,10 @@ FaxClient::runScript(const char* filename, fxStr& emsg) return (ok); } -fxBool +bool FaxClient::runScript(FILE* fp, const char* filename, fxStr& emsg) { - fxBool ok = FALSE; + bool ok = false; struct stat sb; (void) Sys::fstat(fileno(fp), sb); char* addr; @@ -942,7 +942,7 @@ FaxClient::runScript(FILE* fp, const char* filename, fxStr& emsg) return (ok); } -fxBool +bool FaxClient::runScript(const char* script, u_long scriptLen, const char* filename, fxStr& emsg) { @@ -957,7 +957,7 @@ FaxClient::runScript(const char* script, u_long scriptLen, if (command("%.*s", cmdLen, script) != COMPLETE) { emsg = fxStr::format("%s: line %u: %s", filename, lineno, (const char*) lastResponse); - return (FALSE); + return (false); } } if (*ep == '\n') @@ -965,14 +965,14 @@ FaxClient::runScript(const char* script, u_long scriptLen, scriptLen -= ep - script; script = ep; } - return (TRUE); + return (true); } /* * Create a uniquely named document on the server * that is not removed when the server exits. */ -fxBool +bool FaxClient::storeUnique(fxStr& docname, fxStr& emsg) { return storeUnique("STOU", docname, emsg); @@ -981,7 +981,7 @@ FaxClient::storeUnique(fxStr& docname, fxStr& emsg) * Create a uniquely named document on the server * that is automatically removed when the server exits. */ -fxBool +bool FaxClient::storeTemp(fxStr& docname, fxStr& emsg) { return storeUnique("STOT", docname, emsg); @@ -991,7 +991,7 @@ FaxClient::storeTemp(fxStr& docname, fxStr& emsg) * Send a STOU/STOT command and parse the * response to get the resulting filename. */ -fxBool +bool FaxClient::storeUnique(const char* cmd, fxStr& docname, fxStr& emsg) { if (command(cmd) == PRELIM) { @@ -1009,31 +1009,31 @@ FaxClient::storeUnique(const char* cmd, fxStr& docname, fxStr& emsg) unexpectedResponse(emsg); } else emsg = lastResponse; - return (FALSE); + return (false); } /* * Create/overwrite a file on the server. */ -fxBool +bool FaxClient::storeFile(fxStr& docname, fxStr& emsg) { if (command("STOR " | docname) != PRELIM) { emsg = lastResponse; - return (FALSE); + return (false); } if (code != 150) { unexpectedResponse(emsg); - return (FALSE); + return (false); } - return (TRUE); + return (true); } /* * Send a block of raw data on the data * conenction, interpreting write errors. */ -fxBool +bool FaxClient::sendRawData(void* buf, int cc, fxStr& emsg) { #ifdef __linux__ @@ -1047,17 +1047,17 @@ FaxClient::sendRawData(void* buf, int cc, fxStr& emsg) protocolBotch(emsg, errno == EPIPE ? " (server closed connection)" : " (server write error: %s).", strerror(errno)); - return (FALSE); + return (false); } #else if (write(fdData, buf, cc) != cc) { protocolBotch(emsg, errno == EPIPE ? " (server closed connection)" : " (server write error: %s).", strerror(errno)); - return (FALSE); + return (false); } #endif - return (TRUE); + return (true); } /* @@ -1065,9 +1065,9 @@ FaxClient::sendRawData(void* buf, int cc, fxStr& emsg) * and the current transfer parameters. The server-side * document name where data gets placed is returned. */ -fxBool +bool FaxClient::sendData(int fd, - fxBool (FaxClient::*store)(fxStr&, fxStr&), fxStr& docname, fxStr& emsg) + bool (FaxClient::*store)(fxStr&, fxStr&), fxStr& docname, fxStr& emsg) { char* addr = (char*) -1; struct stat sb; @@ -1108,14 +1108,14 @@ FaxClient::sendData(int fd, if (addr != (char*) -1) munmap(addr, sb.st_size); #endif - return (getReply(FALSE) == 2); + return (getReply(false) == 2); bad: closeDataConn(); #if HAS_MMAP if (addr != (char*) -1) munmap(addr, sb.st_size); #endif - return (FALSE); + return (false); } /* @@ -1123,9 +1123,9 @@ bad: * and the current transfer parameters. The server-side * document name where data gets placed is returned. */ -fxBool +bool FaxClient::sendZData(int fd, - fxBool (FaxClient::*store)(fxStr&, fxStr&), fxStr& docname, fxStr& emsg) + bool (FaxClient::*store)(fxStr&, fxStr&), fxStr& docname, fxStr& emsg) { z_stream zstream; zstream.zalloc = NULL; @@ -1229,9 +1229,9 @@ FaxClient::sendZData(int fd, munmap(addr, sb.st_size); #endif deflateEnd(&zstream); - return (getReply(FALSE) == COMPLETE); + return (getReply(false) == COMPLETE); bad2: - (void) getReply(FALSE); + (void) getReply(false); /* fall thru... */ bad: closeDataConn(); @@ -1243,7 +1243,7 @@ bad: } else emsg = fxStr::format("Can not initialize compression library: %s", zstream.msg); - return (FALSE); + return (false); } /* @@ -1255,8 +1255,8 @@ bad: * listing (LIST), trigger event trace log (SITE TRIGGER) * or other data connection-based transfer. */ -fxBool -FaxClient::recvData(fxBool (*f)(void*, const char*, int, fxStr&), +bool +FaxClient::recvData(bool (*f)(void*, const char*, int, fxStr&), void* arg, fxStr& emsg, u_long restart, const char* fmt, ...) { if (!setMode(MODE_S)) @@ -1279,11 +1279,11 @@ FaxClient::recvData(fxBool (*f)(void*, const char*, int, fxStr&), int cc = read(fdData, buf, sizeof (buf)); if (cc == 0) { closeDataConn(); - return (getReply(FALSE) == COMPLETE); + return (getReply(false) == COMPLETE); } if (cc < 0) { emsg = fxStr::format("Data Connection: %s", strerror(errno)); - (void) getReply(FALSE); + (void) getReply(false); break; } byte_count += cc; @@ -1292,7 +1292,7 @@ FaxClient::recvData(fxBool (*f)(void*, const char*, int, fxStr&), } bad: closeDataConn(); - return (FALSE); + return (false); } /* @@ -1304,8 +1304,8 @@ bad: * listing (LIST), trigger event trace log (SITE TRIGGER) * or other data connection-based transfer. */ -fxBool -FaxClient::recvZData(fxBool (*f)(void*, const char*, int, fxStr&), +bool +FaxClient::recvZData(bool (*f)(void*, const char*, int, fxStr&), void* arg, fxStr& emsg, u_long restart, const char* fmt, ...) { z_stream zstream; @@ -1340,11 +1340,11 @@ FaxClient::recvZData(fxBool (*f)(void*, const char*, int, fxStr&), goto bad; closeDataConn(); (void) inflateEnd(&zstream); - return (getReply(FALSE) == COMPLETE); + return (getReply(false) == COMPLETE); } if (cc < 0) { emsg = fxStr::format("Data Connection: %s", strerror(errno)); - (void) getReply(FALSE); + (void) getReply(false); goto bad; } zstream.next_in = (Bytef*) buf; @@ -1369,7 +1369,7 @@ bad: inflateEnd(&zstream); } else emsg = fxStr::format("Can not initialize decoder: %s", zstream.msg); - return (FALSE); + return (false); } /* @@ -1401,27 +1401,27 @@ FaxClient::getStatusFormat(u_int flag, const char* cmd, fxStr& fmt) * Set the specified status format string * in the client and the server. */ -fxBool +bool FaxClient::setStatusFormat(const char* cmd, u_int flag, fxStr& fmt, const char* value) { if (isLoggedIn()) { if (command("%s \"%s\"", cmd, value) != COMPLETE) { printError("%s", (const char*) lastResponse); - return (FALSE); + return (false); } state &= ~flag; } else state |= flag; fmt = value; - return (TRUE); + return (true); } /* * Set the job status format string in the * client and the server. */ -fxBool +bool FaxClient::setJobStatusFormat(const char* cp) { return setStatusFormat("JOBFMT", FS_JFMTPEND, jobFmt, cp); @@ -1442,7 +1442,7 @@ FaxClient::getJobStatusFormat(void) * Set the receive queue status format * string in the client and the server. */ -fxBool +bool FaxClient::setRecvStatusFormat(const char* cp) { return setStatusFormat("RCVFMT", FS_RFMTPEND, recvFmt, cp); @@ -1464,7 +1464,7 @@ FaxClient::getRecvStatusFormat(void) * Set the modem status format * string in the client and the server. */ -fxBool +bool FaxClient::setModemStatusFormat(const char* cp) { return setStatusFormat("MDMFMT", FS_MFMTPEND, modemFmt, cp); @@ -1485,7 +1485,7 @@ FaxClient::getModemStatusFormat(void) * Set the file status format * string in the client and the server. */ -fxBool +bool FaxClient::setFileStatusFormat(const char* cp) { return setStatusFormat("FILEFMT", FS_FFMTPEND, fileFmt, cp); diff --git a/util/FaxClient.h b/util/FaxClient.h index 1199f934..1541030a 100644 --- a/util/FaxClient.h +++ b/util/FaxClient.h @@ -134,8 +134,8 @@ private: void init(void); - fxBool sendRawData(void* buf, int cc, fxStr& emsg); - fxBool setCommon(const FaxParam&, u_int); + bool sendRawData(void* buf, int cc, fxStr& emsg); + bool setCommon(const FaxParam&, u_int); protected: FaxClient(); FaxClient(const fxStr& hostarg); @@ -147,22 +147,22 @@ protected: virtual void vtraceServer(const char* fmt, va_list ap); void initServerState(void); - fxBool jobOp(const char* op, const char* jobid); - fxBool extract(u_int& pos, const char* pattern, fxStr& result, + bool jobOp(const char* op, const char* jobid); + bool extract(u_int& pos, const char* pattern, fxStr& result, const char* cmd, fxStr& emsg); - fxBool storeUnique(const char* cmd, fxStr& docname, fxStr& emsg); + bool storeUnique(const char* cmd, fxStr& docname, fxStr& emsg); const fxStr& getStatusFormat(u_int flag, const char* cmd, fxStr& fmt); - fxBool setStatusFormat(const char* cmd, u_int flag, fxStr&, const char*); + bool setStatusFormat(const char* cmd, u_int flag, fxStr&, const char*); void makeHeader(const char* fmt, const FaxFmtHeader fmts[], fxStr& header); - virtual fxBool setupUserIdentity(fxStr& emsg); + virtual bool setupUserIdentity(fxStr& emsg); void setupHostModem(const char*); void setupHostModem(const fxStr&); virtual void resetConfig(void); virtual void setupConfig(void); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); virtual void configError(const char* fmt ...); virtual void configTrace(const char* fmt ...); @@ -184,25 +184,25 @@ public: void setModem(const char*); const fxStr& getModem(void) const; - virtual fxBool callServer(fxStr& emsg); - virtual fxBool hangupServer(void); - fxBool isConnected(void) const; - fxBool login(const char* user, fxStr& emsg); - fxBool admin(const char* pass, fxStr& emsg); + virtual bool callServer(fxStr& emsg); + virtual bool hangupServer(void); + bool isConnected(void) const; + bool login(const char* user, fxStr& emsg); + bool admin(const char* pass, fxStr& emsg); virtual const char* getPasswd(const char* prompt); - fxBool isLoggedIn(void) const; + bool isLoggedIn(void) const; void setCtrlFds(int in, int out); FILE* getCtrlFd(void) const; - virtual fxBool initDataConn(fxStr& emsg); - virtual fxBool openDataConn(fxStr& emsg); + virtual bool initDataConn(fxStr& emsg); + virtual bool openDataConn(fxStr& emsg); virtual void closeDataConn(void); - virtual fxBool abortDataConn(fxStr& emsg); + virtual bool abortDataConn(fxStr& emsg); void setDataFd(int fd); int getDataFd(void) const; - void setVerbose(fxBool); - fxBool getVerbose(void) const; + void setVerbose(bool); + bool getVerbose(void) const; int getPort(void) const; const fxStr& getProtoName(void) const; @@ -213,77 +213,77 @@ public: // output int command(const char* fmt ...); int vcommand(const char* fmt, va_list ap); - int getReply(fxBool expectEOF); + int getReply(bool expectEOF); const fxStr& getLastResponse(void) const; int getLastCode(void) const; /* * Job control support. */ const fxStr& getCurrentJob(void) const; - fxBool setCurrentJob(const char* jobid); - fxBool newJob(fxStr& jobid, fxStr& groupid, fxStr& emsg); - fxBool jobSubmit(const char* jobid); - fxBool jobSuspend(const char* jobid); - fxBool jobKill(const char* jobid); - fxBool jobDelete(const char* jobid); - fxBool jobWait(const char* jobid); + bool setCurrentJob(const char* jobid); + bool newJob(fxStr& jobid, fxStr& groupid, fxStr& emsg); + bool jobSubmit(const char* jobid); + bool jobSuspend(const char* jobid); + bool jobKill(const char* jobid); + bool jobDelete(const char* jobid); + bool jobWait(const char* jobid); /* * Set various job parameters. */ - fxBool jobParm(const char* name, const fxStr& value); - fxBool jobParm(const char* name, const char* value); - fxBool jobParm(const char* name, fxBool b); - fxBool jobParm(const char* name, u_int v); - fxBool jobParm(const char* name, float v); - fxBool jobSendTime(const struct tm tm); - fxBool jobLastTime(u_long); - fxBool jobRetryTime(u_long); - fxBool jobCover(const char* docname); - fxBool jobDocument(const char* docname); - fxBool jobPollRequest(const char* sep, const char* pwd); + bool jobParm(const char* name, const fxStr& value); + bool jobParm(const char* name, const char* value); + bool jobParm(const char* name, bool b); + bool jobParm(const char* name, u_int v); + bool jobParm(const char* name, float v); + bool jobSendTime(const struct tm tm); + bool jobLastTime(u_long); + bool jobRetryTime(u_long); + bool jobCover(const char* docname); + bool jobDocument(const char* docname); + bool jobPollRequest(const char* sep, const char* pwd); /* * Job group control support. */ - fxBool jgrpSubmit(const char* jgrpid); - fxBool jgrpSuspend(const char* jgrpid); - fxBool jgrpKill(const char* jgrpid); - fxBool jgrpWait(const char* jgrpid); + bool jgrpSubmit(const char* jgrpid); + bool jgrpSuspend(const char* jgrpid); + bool jgrpKill(const char* jgrpid); + bool jgrpWait(const char* jgrpid); /* * Query/set transfer state parameters. */ u_int getType(void) const; - fxBool setType(u_int); + bool setType(u_int); u_int getMode(void) const; - fxBool setMode(u_int); + bool setMode(u_int); u_int getStruct(void) const; - fxBool setStruct(u_int); + bool setStruct(u_int); u_int getFormat(void) const; - fxBool setFormat(u_int); + bool setFormat(u_int); u_int getTimeZone(void) const; - fxBool setTimeZone(u_int); + bool setTimeZone(u_int); /* * Send documents to the server. */ - fxBool storeUnique(fxStr& docname, fxStr& emsg); // STOU - fxBool storeTemp(fxStr& docname, fxStr& emsg); // STOT - fxBool storeFile(fxStr&, fxStr& emsg); // STOR - fxBool sendData(int fd, fxBool (FaxClient::*store)(fxStr&, fxStr&), + bool storeUnique(fxStr& docname, fxStr& emsg); // STOU + bool storeTemp(fxStr& docname, fxStr& emsg); // STOT + bool storeFile(fxStr&, fxStr& emsg); // STOR + bool sendData(int fd, bool (FaxClient::*store)(fxStr&, fxStr&), fxStr& docname, fxStr& emsg); - fxBool sendZData(int fd, fxBool (FaxClient::*store)(fxStr&, fxStr&), + bool sendZData(int fd, bool (FaxClient::*store)(fxStr&, fxStr&), fxStr& docname, fxStr& emsg); /* * Retrieve information from the server. */ - fxBool recvData(fxBool (*f)(void*, const char*, int, fxStr&), + bool recvData(bool (*f)(void*, const char*, int, fxStr&), void* arg, fxStr& emsg, u_long restart, const char* fmt, ...); - fxBool recvZData(fxBool (*f)(void*, const char*, int, fxStr&), + bool recvZData(bool (*f)(void*, const char*, int, fxStr&), void* arg, fxStr& emsg, u_long restart, const char* fmt, ...); /* * Job scripting support. */ - fxBool runScript(const char* filename, fxStr& emsg); - fxBool runScript(FILE*, const char* filename, fxStr& emsg); - fxBool runScript(const char* script, u_long scriptLen, + bool runScript(const char* filename, fxStr& emsg); + bool runScript(FILE*, const char* filename, fxStr& emsg); + bool runScript(const char* script, u_long scriptLen, const char* filename, fxStr& emsg); /* * Status query support. @@ -293,13 +293,13 @@ public: static const FaxFmtHeader modemFormats[]; static const FaxFmtHeader fileFormats[]; - fxBool setJobStatusFormat(const char*); + bool setJobStatusFormat(const char*); const fxStr& getJobStatusFormat(void); - fxBool setRecvStatusFormat(const char*); + bool setRecvStatusFormat(const char*); const fxStr& getRecvStatusFormat(void); - fxBool setModemStatusFormat(const char*); + bool setModemStatusFormat(const char*); const fxStr& getModemStatusFormat(void); - fxBool setFileStatusFormat(const char*); + bool setFileStatusFormat(const char*); const fxStr& getFileStatusFormat(void); void getJobStatusHeader(fxStr& header); void getRecvStatusHeader(fxStr& header); @@ -311,7 +311,7 @@ inline const fxStr& FaxClient::getUserName(void) const { return userName; } inline const fxStr& FaxClient::getHost(void) const { return host; } inline const fxStr& FaxClient::getModem(void) const { return modem; } inline const fxStr& FaxClient::getProtoName() const { return proto; } -inline fxBool FaxClient::getVerbose(void) const +inline bool FaxClient::getVerbose(void) const { return (state&FS_VERBOSE) != 0; } inline int FaxClient::getPort(void) const { return port; } inline FILE* FaxClient::getCtrlFd(void) const { return fdOut; } @@ -319,9 +319,9 @@ inline int FaxClient::getDataFd(void) const { return fdData; } inline const fxStr& FaxClient::getLastResponse(void) const { return lastResponse; } inline int FaxClient::getLastCode(void) const { return code; } -inline fxBool FaxClient::isLoggedIn(void) const +inline bool FaxClient::isLoggedIn(void) const { return (state&FS_LOGGEDIN) != 0; } -inline fxBool FaxClient::isConnected(void) const { return fdIn != NULL; } +inline bool FaxClient::isConnected(void) const { return fdIn != NULL; } inline u_int FaxClient::getType(void) const { return type; } inline u_int FaxClient::getStruct(void) const { return stru; } inline u_int FaxClient::getMode(void) const { return mode; } diff --git a/util/FaxConfig.c++ b/util/FaxConfig.c++ index 8e9e8bd5..9f8d6062 100644 --- a/util/FaxConfig.c++ +++ b/util/FaxConfig.c++ @@ -63,7 +63,7 @@ FaxConfig::readConfig(const fxStr& filename) } void FaxConfig::resetConfig() { lineno = 0; } -fxBool +bool FaxConfig::updateConfig(const fxStr& filename) { struct stat sb; @@ -72,9 +72,9 @@ FaxConfig::updateConfig(const fxStr& filename) resetConfig(); readConfig(path); lastModTime = sb.st_mtime; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* @@ -102,7 +102,7 @@ FaxConfig::tildeExpand(const fxStr& filename) return (path); } -fxBool +bool FaxConfig::findTag(const char* tag, const void* names0, u_int n, u_int& ix) { const tags* names = (const tags*) names0; @@ -111,23 +111,23 @@ FaxConfig::findTag(const char* tag, const void* names0, u_int n, u_int& ix) const char* cp = names[i].name; if (cp[0] == tag[0] && streq(cp, tag)) { ix = i; - return (TRUE); + return (true); } } - return (FALSE); + return (false); } -fxBool +bool FaxConfig::findValue(const char* value, const char* values[], u_int n, u_int& ix) { for (u_int i = 0; i < n; i++) { const char* cp = values[i]; if (cp[0] == value[0] && streq(cp, value)) { ix = i; - return (TRUE); + return (true); } } - return (FALSE); + return (false); } int @@ -138,13 +138,13 @@ FaxConfig::getNumber(const char* s) #define valeq(a,b) (strcasecmp(a,b)==0) -fxBool +bool FaxConfig::getBoolean(const char* cp) { return (valeq(cp, "on") || valeq(cp, "yes") || valeq(cp, "true")); } -fxBool +bool FaxConfig::readConfigItem(const char* b) { char buf[2048]; @@ -155,7 +155,7 @@ FaxConfig::readConfigItem(const char* b) for (cp = buf; isspace(*cp); cp++) // skip leading white space ; if (*cp == '#' || *cp == '\0') - return (TRUE); + return (true); const char* tag = cp; // start of tag while (*cp && *cp != ':') { // skip to demarcating ':' if (isupper(*cp)) @@ -165,7 +165,7 @@ FaxConfig::readConfigItem(const char* b) if (*cp != ':') { configError("Syntax error at line %u, missing ':' in \"%s\"", lineno, b); - return (FALSE); + return (false); } for (*cp++ = '\0'; isspace(*cp); cp++) // skip white space again ; @@ -180,7 +180,7 @@ FaxConfig::readConfigItem(const char* b) if (c == '\0') { // unmatched quote mark configError("Syntax error at line %u, missing quote mark in \"%s\"", lineno, b); - return (FALSE); + return (false); } if (c == '\\') { c = *++cp; @@ -211,9 +211,9 @@ FaxConfig::readConfigItem(const char* b) if (!setConfigItem(tag, value)) { configTrace("Unknown configuration parameter \"%s\" ignored at line %u", tag, lineno); - return (FALSE); + return (false); } else { configTrace("%s = %s (line %u)", tag, value, lineno); - return (TRUE); + return (true); } } diff --git a/util/FaxConfig.h b/util/FaxConfig.h index 5685fd7f..4f110aef 100644 --- a/util/FaxConfig.h +++ b/util/FaxConfig.h @@ -40,7 +40,7 @@ protected: FaxConfig(); FaxConfig(const FaxConfig& other); - virtual fxBool setConfigItem(const char* tag, const char* value) = 0; + virtual bool setConfigItem(const char* tag, const char* value) = 0; virtual void configError(const char* fmt, ...) = 0; virtual void configTrace(const char* fmt, ...) = 0; u_int getConfigLineNumber() const; @@ -55,18 +55,18 @@ public: } tags; // NB: const void* should be const tags* but gcc can't hack it - static fxBool findTag(const char*, const void*, u_int, u_int&); - static fxBool findValue(const char*, const char*[], u_int, u_int&); + static bool findTag(const char*, const void*, u_int, u_int&); + static bool findValue(const char*, const char*[], u_int, u_int&); static int getNumber(const char*); - static fxBool getBoolean(const char*); + static bool getBoolean(const char*); fxStr tildeExpand(const fxStr& filename); virtual void readConfig(const fxStr& filename); - virtual fxBool readConfigItem(const char*); + virtual bool readConfigItem(const char*); virtual void resetConfig(); - virtual fxBool updateConfig(const fxStr& filename); + virtual bool updateConfig(const fxStr& filename); }; inline u_int FaxConfig::getConfigLineNumber() const { return lineno; } #endif /* _FaxConfig_ */ diff --git a/util/FaxDB.c++ b/util/FaxDB.c++ index abb81a64..9eff88ba 100644 --- a/util/FaxDB.c++ +++ b/util/FaxDB.c++ @@ -146,13 +146,13 @@ FaxDB::parseDatabase(FILE* fd, FaxDBRecord* parent) #include "StackBuffer.h" #include -fxBool +bool FaxDB::getToken(FILE* fd, fxStr& token) { int c; top: if ((c = getc(fd)) == EOF) - return (FALSE); + return (false); while (isspace(c)) { if (c == '\n') lineno++; @@ -162,7 +162,7 @@ top: while ((c = getc(fd)) != EOF && c != '\n') ; if (c == EOF) - return (FALSE); + return (false); lineno++; goto top; } @@ -171,7 +171,7 @@ top: buf[0] = c; buf[1] = '\0'; token = buf; - return (TRUE); + return (true); } fxStackBuffer buf; if (c == '"') { @@ -180,7 +180,7 @@ top: c = getc(fd); if (c == EOF) { fprintf(stderr, "%s: Premature EOF.\n", (char*) filename); - return (FALSE); + return (false); } // XXX handle standard escapes if (c == '\n') @@ -203,7 +203,7 @@ top: } buf.set('\0'); token = (char*) buf; - return (TRUE); + return (true); } #ifdef notdef diff --git a/util/FaxDB.h b/util/FaxDB.h index bbf20db2..026ba56b 100644 --- a/util/FaxDB.h +++ b/util/FaxDB.h @@ -60,7 +60,7 @@ protected: FaxInfoDict dict; // name->record map void parseDatabase(FILE*, FaxDBRecord* parent); - fxBool getToken(FILE*, fxStr& token); + bool getToken(FILE*, fxStr& token); public: FaxDB(const fxStr& filename); ~FaxDB(); diff --git a/util/FaxRecvInfo.c++ b/util/FaxRecvInfo.c++ index 9ef64c05..17f6c909 100644 --- a/util/FaxRecvInfo.c++ +++ b/util/FaxRecvInfo.c++ @@ -59,40 +59,40 @@ FaxRecvInfo::encode() const ); } -fxBool +bool FaxRecvInfo::decode(const char* cp) { char* np; time = (u_int) strtoul(cp, &np, 16); if (np == cp) - return (FALSE); + return (false); npages = (u_short) strtoul(cp = np+1, &np, 16); if (np == cp) - return (FALSE); + return (false); params.decode((u_int) strtoul(cp = np+1, &np, 16)); if (np == cp) - return (FALSE); + return (false); qfile = np+1; qfile.resize(qfile.next(0,',')); cp = strchr(np+1, ','); if (cp == NULL) - return (FALSE); + return (false); commid = cp+1; commid.resize(commid.next(0,',')); cp = strchr(cp+1, '"'); if (cp == NULL) - return (FALSE); + return (false); sender = cp+1; sender.resize(sender.next(0,'"')); cp = strchr(cp+1, '"'); if (cp == NULL || cp[1] != ',' || cp[2] != '"') - return (FALSE); + return (false); subaddr = cp+1; subaddr.resize(subaddr.next(0,'"')); cp = strchr(cp+1, '"'); if (cp == NULL || cp[1] != ',' || cp[2] != '"') - return (FALSE); + return (false); reason = cp+3; // +1 for "/+1 for ,/+1 for " reason.resize(reason.next(0,'"')); - return (TRUE); + return (true); } diff --git a/util/FaxRecvInfo.h b/util/FaxRecvInfo.h index 6efade48..e721fd81 100644 --- a/util/FaxRecvInfo.h +++ b/util/FaxRecvInfo.h @@ -48,6 +48,6 @@ public: ~FaxRecvInfo(); fxStr encode() const; - fxBool decode(const char*); + bool decode(const char*); }; #endif /* _FaxRecvInfo_ */ diff --git a/util/FaxSendInfo.c++ b/util/FaxSendInfo.c++ index 5d6bf5de..b583a5ad 100644 --- a/util/FaxSendInfo.c++ +++ b/util/FaxSendInfo.c++ @@ -52,25 +52,25 @@ FaxSendInfo::encode() const ); } -fxBool +bool FaxSendInfo::decode(const char* cp) { char* np; time = (u_int) strtoul(cp, &np, 16); if (np == cp) - return (FALSE); + return (false); npages = (u_short) strtoul(cp = np+1, &np, 16); if (np == cp) - return (FALSE); + return (false); params.decode((u_int) strtoul(cp = np+1, &np, 16)); if (np == cp) - return (FALSE); + return (false); commid = np+1; commid.resize(commid.next(0,',')); np = strchr(np+1, '"'); if (np == NULL) - return (FALSE); + return (false); qfile = np+1; // +1 for " qfile.resize(qfile.next(0,'"')); - return (TRUE); + return (true); } diff --git a/util/FaxSendInfo.h b/util/FaxSendInfo.h index 05f00ded..f75184a6 100644 --- a/util/FaxSendInfo.h +++ b/util/FaxSendInfo.h @@ -46,6 +46,6 @@ struct FaxSendInfo { ~FaxSendInfo(); fxStr encode() const; - fxBool decode(const char*); + bool decode(const char*); }; #endif /* _FaxSendInfo_ */ diff --git a/util/InetTransport.c++ b/util/InetTransport.c++ index 29544ac6..50c73f0c 100644 --- a/util/InetTransport.c++ +++ b/util/InetTransport.c++ @@ -31,10 +31,10 @@ InetTransport::InetTransport(FaxClient& c) : Transport(c) {} InetTransport::~InetTransport(){} -fxBool +bool InetTransport::isA(const char*) { - return (TRUE); // XXX are there checks we can make? + return (true); // XXX are there checks we can make? } #if CONFIG_INETTRANSPORT @@ -52,7 +52,7 @@ extern "C" { #include #include -fxBool +bool InetTransport::callServer(fxStr& emsg) { int port = client.getPort(); @@ -79,13 +79,13 @@ InetTransport::callServer(fxStr& emsg) struct hostent* hp = Socket::gethostbyname(client.getHost()); if (!hp) { emsg = client.getHost() | ": Unknown host"; - return (FALSE); + return (false); } int fd = socket(hp->h_addrtype, SOCK_STREAM, protocol); if (fd < 0) { emsg = "Can not create socket to connect to server."; - return (FALSE); + return (false); } struct sockaddr_in sin; memset(&sin, 0, sizeof (sin)); @@ -133,29 +133,29 @@ InetTransport::callServer(fxStr& emsg) * input and output (sigh). */ client.setCtrlFds(fd, dup(fd)); - return (TRUE); + return (true); } } emsg = fxStr::format("Can not reach server at host \"%s\", port %u.", (const char*) client.getHost(), ntohs(sin.sin_port)); Sys::close(fd), fd = -1; - return (FALSE); + return (false); } -fxBool +bool InetTransport::initDataConn(fxStr& emsg) { struct sockaddr_in data_addr; socklen_t dlen = sizeof (data_addr); if (Socket::getsockname(fileno(client.getCtrlFd()), &data_addr, &dlen) < 0) { emsg = fxStr::format("getsockname(ctrl): %s", strerror(errno)); - return (FALSE); + return (false); } data_addr.sin_port = 0; // let system allocate port int fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) { emsg = fxStr::format("socket: %s", strerror(errno)); - return (FALSE); + return (false); } if (Socket::bind(fd, &data_addr, sizeof (data_addr)) < 0) { emsg = fxStr::format("bind: %s", strerror(errno)); @@ -176,16 +176,16 @@ InetTransport::initDataConn(fxStr& emsg) if (client.command("PORT %u,%u,%u,%u,%u,%u", UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]), UC(p[0]), UC(p[1])) != FaxClient::COMPLETE) - return (FALSE); + return (false); #undef UC client.setDataFd(fd); - return (TRUE); + return (true); bad: Sys::close(fd), fd = -1; - return (FALSE); + return (false); } -fxBool +bool InetTransport::openDataConn(fxStr& emsg) { int s = Socket::accept(client.getDataFd(), NULL, NULL); @@ -196,10 +196,10 @@ InetTransport::openDataConn(fxStr& emsg) if (Socket::setsockopt(s, IPPROTO_IP, IP_TOS, &tos, sizeof (tos)) < 0) client.printWarning("setsockopt(IP_TOS): %s", strerror(errno)); #endif - return (TRUE); + return (true); } else { emsg = fxStr::format("accept: %s", strerror(errno)); - return (FALSE); + return (false); } } @@ -213,7 +213,7 @@ InetTransport::openDataConn(fxStr& emsg) * rather than before as done by most contemporary * TCP implementations. */ -fxBool +bool InetTransport::abortCmd(fxStr& emsg) { static const char msg[] = @@ -221,21 +221,21 @@ InetTransport::abortCmd(fxStr& emsg) int s = fileno(client.getCtrlFd()); if (send(s, msg, 3, MSG_OOB) != 3) { emsg = fxStr::format("send(MSG_OOB): %s", strerror(errno)); - return (FALSE); + return (false); } if (send(s, msg+3, sizeof (msg)-3, 0) != sizeof (msg)-3) { emsg = fxStr::format("send(ABOR\\r\\n): %s", strerror(errno)); - return (FALSE); + return (false); } - return (TRUE); + return (true); } #else -fxBool InetTransport::callServer(fxStr& emsg) - { notConfigured("TCP/IP", emsg); return (FALSE); } -fxBool InetTransport::initDataConn(fxStr& emsg) - { notConfigured("TCP/IP", emsg); return (FALSE); } -fxBool InetTransport::openDataConn(fxStr& emsg) - { notConfigured("TCP/IP", emsg); return (FALSE); } -fxBool InetTransport::abortDataConn(fxStr& emsg) - { notConfigured("TCP/IP", emsg); return (FALSE); } +bool InetTransport::callServer(fxStr& emsg) + { notConfigured("TCP/IP", emsg); return (false); } +bool InetTransport::initDataConn(fxStr& emsg) + { notConfigured("TCP/IP", emsg); return (false); } +bool InetTransport::openDataConn(fxStr& emsg) + { notConfigured("TCP/IP", emsg); return (false); } +bool InetTransport::abortDataConn(fxStr& emsg) + { notConfigured("TCP/IP", emsg); return (false); } #endif diff --git a/util/InetTransport.h b/util/InetTransport.h index 245e0245..45329155 100644 --- a/util/InetTransport.h +++ b/util/InetTransport.h @@ -35,12 +35,12 @@ public: InetTransport(FaxClient&); ~InetTransport(); - static fxBool isA(const char*); + static bool isA(const char*); - fxBool callServer(fxStr& emsg); - fxBool abortCmd(fxStr& emsg); + bool callServer(fxStr& emsg); + bool abortCmd(fxStr& emsg); - fxBool initDataConn(fxStr& emsg); - fxBool openDataConn(fxStr& emsg); + bool initDataConn(fxStr& emsg); + bool openDataConn(fxStr& emsg); }; #endif /* _InetTransport_ */ diff --git a/util/ModemExt.h b/util/ModemExt.h index d17cd5d8..b025ed5b 100644 --- a/util/ModemExt.h +++ b/util/ModemExt.h @@ -36,7 +36,7 @@ struct ModemExt { fxStr number; // modem phone number fxStr commid; // communication identifier char state; // modem state - fxBool canpoll; // modem is capable of polling + bool canpoll; // modem is capable of polling u_short priority; // scheduling priority Class2Params caps; // modem capabilities diff --git a/util/PageSize.c++ b/util/PageSize.c++ index 52949965..976f57af 100644 --- a/util/PageSize.c++ +++ b/util/PageSize.c++ @@ -52,7 +52,7 @@ parseError(const char* file, u_int lineno, const char* fmt ...) va_end(ap); } -fxBool +bool PageSizeInfo::skipws(char*& cp, const char* file, const char* item, u_int lineno) { @@ -63,9 +63,9 @@ PageSizeInfo::skipws(char*& cp, if (*cp == '\0') { parseError(file, lineno, "Unexpected end of line after \"%s\".\n", item); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } PageInfoArray* @@ -285,5 +285,5 @@ PageSizeInfoIter::operator const PageSizeInfo&() pi.info = &(*PageSizeInfo::pageInfo)[i]; return (pi); } -fxBool PageSizeInfoIter::notDone() +bool PageSizeInfoIter::notDone() { return i < PageSizeInfo::pageInfo->length(); } diff --git a/util/PageSize.h b/util/PageSize.h index 692cb6bf..05c9ea6d 100644 --- a/util/PageSize.h +++ b/util/PageSize.h @@ -55,7 +55,7 @@ private: static const PageInfo* getPageInfoByName(const char* name); static PageInfoArray* readPageInfoFile(); - static fxBool skipws(char*& cp, + static bool skipws(char*& cp, const char* file, const char* item, u_int lineno); static float toMM(BMU v) { return (v/1200.)*25.4; } @@ -98,7 +98,7 @@ public: void operator++(); void operator++(int); operator const PageSizeInfo&(); - fxBool notDone(); + bool notDone(); }; #else /* diff --git a/util/RegEx.c++ b/util/RegEx.c++ index da28cd75..477945f6 100644 --- a/util/RegEx.c++ +++ b/util/RegEx.c++ @@ -63,7 +63,7 @@ RegEx::init(int flags) } } -fxBool +bool RegEx::Find(const char* text, u_int length, u_int off) { if (compResult == 0) { diff --git a/util/RegEx.h b/util/RegEx.h index a0da9a8a..c76208e4 100644 --- a/util/RegEx.h +++ b/util/RegEx.h @@ -44,8 +44,8 @@ public: const char* pattern() const; - fxBool Find(const char* text, u_int length, u_int off = 0); - fxBool Find(const fxStr& s, u_int off = 0); + bool Find(const char* text, u_int length, u_int off = 0); + bool Find(const fxStr& s, u_int off = 0); int StartOfMatch(u_int subexp = 0) const; int EndOfMatch(u_int subexp = 0) const; @@ -61,7 +61,7 @@ private: void init(int flags); }; -inline fxBool RegEx::Find(const fxStr& s, u_int off) +inline bool RegEx::Find(const fxStr& s, u_int off) { return Find(s, s.length(), off); } inline const char* RegEx::pattern() const { return _pattern; } inline int RegEx::getErrorCode() const { return execResult; } diff --git a/util/SNPPClient.c++ b/util/SNPPClient.c++ index 15336a34..509bb2fe 100644 --- a/util/SNPPClient.c++ +++ b/util/SNPPClient.c++ @@ -154,7 +154,7 @@ void SNPPClient::setModem(const fxStr& modemarg){ modem = modemarg; } void SNPPClient::setModem(const char* modemarg) { modem = modemarg; } void -SNPPClient::setVerbose(fxBool v) +SNPPClient::setVerbose(bool v) { if (v) state |= SS_VERBOSE; @@ -165,7 +165,7 @@ SNPPClient::setVerbose(fxBool v) /* * Setup the sender's identity. */ -fxBool +bool SNPPClient::setupSenderIdentity(fxStr& emsg) { setupUserIdentity(emsg); // client identity @@ -206,9 +206,9 @@ SNPPClient::setupSenderIdentity(fxStr& emsg) fxStr mbox; if (senderName == "" || !getNonBlankMailbox(mbox)) { emsg = "Malformed (null) sender name or mail address"; - return (FALSE); + return (false); } else - return (TRUE); + return (true); } void SNPPClient::setFromIdentity(const char* s) { from = s; } @@ -230,20 +230,20 @@ SNPPClient::setBlankMailboxes(const fxStr& s) * Return the first non-null mailbox string * in the set of jobs. */ -fxBool +bool SNPPClient::getNonBlankMailbox(fxStr& s) { for (u_int i = 0, n = jobs->length(); i < n; i++) { SNPPJob& job = (*jobs)[i]; if (job.getMailbox() != "") { s = job.getMailbox(); - return (TRUE); + return (true); } } - return (FALSE); + return (false); } -fxBool +bool SNPPClient::setupUserIdentity(fxStr& emsg) { struct passwd* pwd = NULL; @@ -259,7 +259,7 @@ SNPPClient::setupUserIdentity(fxStr& emsg) emsg = fxStr::format( "Can not locate your password entry (account name %s, uid %lu).", (name ? name : ""), (u_long) getuid()); - return (FALSE); + return (false); } userName = pwd->pw_name; if (pwd->pw_gecos && pwd->pw_gecos[0] != '\0') { @@ -283,9 +283,9 @@ SNPPClient::setupUserIdentity(fxStr& emsg) if (senderName.length() == 0) { emsg = "Bad (null) user name; your password file entry" " probably has bogus GECOS field information."; - return (FALSE); + return (false); } else - return (TRUE); + return (true); } void @@ -368,7 +368,7 @@ SNPPClient::configTrace(const char* fmt ...) } } -fxBool +bool SNPPClient::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -401,11 +401,11 @@ SNPPClient::setConfigItem(const char* tag, const char* value) } else if (streq(tag, "mailaddr")) { jproto.setMailbox(value); } else - return (FALSE); - return (TRUE); + return (false); + return (true); } -fxBool +bool SNPPClient::callServer(fxStr& emsg) { if (host.length() == 0) { // if host not specified by -h @@ -426,9 +426,9 @@ SNPPClient::callServer(fxStr& emsg) * Transport code is expected to call back through * setCtrlFds so fdIn should be properly setup... */ - return (fdIn != NULL && getReply(FALSE) == COMPLETE); + return (fdIn != NULL && getReply(false) == COMPLETE); } else - return (FALSE); + return (false); } #if CONFIG_INETTRANSPORT @@ -443,7 +443,7 @@ extern "C" { #include } -fxBool +bool SNPPClient::callInetServer(fxStr& emsg) { fxStr proto(getProtoName()); @@ -458,7 +458,7 @@ SNPPClient::callInetServer(fxStr& emsg) struct hostent* hp = Socket::gethostbyname(getHost()); if (!hp) { emsg = getHost() | ": Unknown host"; - return (FALSE); + return (false); } int protocol; const char* cproto = proto; // XXX for busted include files @@ -471,7 +471,7 @@ SNPPClient::callInetServer(fxStr& emsg) int fd = socket(hp->h_addrtype, SOCK_STREAM, protocol); if (fd < 0) { emsg = "Can not create socket to connect to server."; - return (FALSE); + return (false); } struct sockaddr_in sin; memset(&sin, 0, sizeof (sin)); @@ -513,24 +513,24 @@ SNPPClient::callInetServer(fxStr& emsg) strerror(errno)); #endif setCtrlFds(fd, fd); - return (TRUE); + return (true); } } emsg = fxStr::format("Can not reach server at host \"%s\", port %u.", (const char*) getHost(), ntohs(sin.sin_port)); close(fd), fd = -1; - return (FALSE); + return (false); } #else -fxBool +bool SNPPServer::callInetServer(fxStr& emsg) { emsg = "Sorry, no TCP/IP communication support was configured."; - return (FALSE); + return (false); } #endif -fxBool +bool SNPPClient::hangupServer(void) { if (fdIn != NULL) @@ -538,7 +538,7 @@ SNPPClient::hangupServer(void) if (fdOut != NULL) fclose(fdOut), fdOut = NULL; initServerState(); - return (TRUE); + return (true); } void @@ -555,7 +555,7 @@ SNPPClient::setCtrlFds(int in, int out) /* * Do login procedure. */ -fxBool +bool SNPPClient::login(const char* user, fxStr& emsg) { if (user == NULL) { @@ -574,10 +574,10 @@ SNPPClient::login(const char* user, fxStr& emsg) state |= SS_HASSITE; else state &= ~SS_HASSITE; - return (TRUE); + return (true); } else { emsg = "Login failed: " | lastResponse; - return (FALSE); + return (false); } } @@ -688,10 +688,10 @@ getReplyCode(const char* cp) * handled but not collected. */ int -SNPPClient::getReply(fxBool expecteof) +SNPPClient::getReply(bool expecteof) { int firstCode = 0; - fxBool continuation = FALSE; + bool continuation = false; do { lastResponse.resize(0); int c; @@ -735,9 +735,9 @@ SNPPClient::getReply(fxBool expecteof) if (lastResponse[3] == '-') { // continuation line if (firstCode == 0) // first line of reponse firstCode = code; - continuation = TRUE; + continuation = true; } else if (code == firstCode) // end of continued reply - continuation = FALSE; + continuation = false; } } while (continuation || code == 0); @@ -755,7 +755,7 @@ SNPPClient::getReply(fxBool expecteof) * case was). The resulting string is checked to * make sure that it is not null. */ -fxBool +bool SNPPClient::extract(u_int& pos, const char* pattern, fxStr& result) { fxStr pat(pattern); @@ -768,13 +768,13 @@ SNPPClient::extract(u_int& pos, const char* pattern, fxStr& result) l = lastResponse.find(pos, pat); } if (l == lastResponse.length()) - return (FALSE); + return (false); l = lastResponse.skip(l+pat.length(), ' ');// skip white space result = lastResponse.extract(l, lastResponse.next(l, ' ')-l); if (result == "") - return (FALSE); + return (false); pos = l; // update position - return (TRUE); + return (true); } /* @@ -782,7 +782,7 @@ SNPPClient::extract(u_int& pos, const char* pattern, fxStr& result) * parsed from the reply (this is for HylaFAX, * RFC 1861 says nothing about this). */ -fxBool +bool SNPPClient::newPage(const fxStr& pin, const fxStr& passwd, fxStr& jobid, fxStr& emsg) { int result; @@ -810,12 +810,12 @@ SNPPClient::newPage(const fxStr& pin, const fxStr& passwd, fxStr& jobid, fxStr& jobid.resize(jobid.skip(0, "0123456789")); } else jobid = "unknown"; - return (TRUE); + return (true); } else unexpectedResponse(emsg); } else emsg = lastResponse; - return (FALSE); + return (false); } SNPPJob& @@ -847,19 +847,19 @@ SNPPClient::removeJob(const SNPPJob& job) jobs->remove(ix); } -fxBool +bool SNPPClient::prepareForJobSubmissions(fxStr&) { // XXX nothing to do right now - return (TRUE); + return (true); } -fxBool +bool SNPPClient::submitJobs(fxStr& emsg) { if (!isLoggedIn()) { emsg = "Not logged in to server"; - return (FALSE); + return (false); } /* * Construct jobs and submit them. @@ -867,21 +867,21 @@ SNPPClient::submitJobs(fxStr& emsg) for (u_int i = 0, n = jobs->length(); i < n; i++) { SNPPJob& job = (*jobs)[i]; if (!job.createJob(*this, emsg)) - return (FALSE); + return (false); notifyNewJob(job); // notify client } if (msgFile != "") { if (!sendData(msgFile, emsg)) - return (FALSE); + return (false); } else if (msg) { if (!sendMsg(*msg, emsg)) - return (FALSE); + return (false); } if (command("SEND") != COMPLETE) { emsg = lastResponse; - return (FALSE); + return (false); } else - return (TRUE); + return (true); } /* @@ -901,7 +901,7 @@ SNPPClient::notifyNewJob(const SNPPJob& job) * Send a block of raw data on the data * conenction, interpreting write errors. */ -fxBool +bool SNPPClient::sendRawData(void* buf, int cc, fxStr& emsg) { #ifdef __linux__ @@ -915,20 +915,20 @@ SNPPClient::sendRawData(void* buf, int cc, fxStr& emsg) protocolBotch(emsg, errno == EPIPE ? " (server closed connection)" : " (server write error: %s).", strerror(errno)); - return (FALSE); + return (false); } #else if (write(fileno(fdOut), buf, cc) != cc) { protocolBotch(emsg, errno == EPIPE ? " (server closed connection)" : " (server write error: %s).", strerror(errno)); - return (FALSE); + return (false); } #endif - return (TRUE); + return (true); } -fxBool +bool SNPPClient::sendData(int fd, fxStr& emsg) { struct stat sb; @@ -942,23 +942,23 @@ SNPPClient::sendData(int fd, fxStr& emsg) size_t n = fxmin(cc, sizeof (buf)); if (read(fd, buf, n) != n) { protocolBotch(emsg, " (data read: %s).", strerror(errno)); - return (FALSE); + return (false); } if (!sendRawData(buf, n, emsg)) - return (FALSE); + return (false); cc -= n; } if (command(".") == COMPLETE) - return (TRUE); + return (true); } emsg = getLastResponse(); - return (FALSE); + return (false); } -fxBool +bool SNPPClient::sendData(const fxStr& filename, fxStr& emsg) { - fxBool ok = FALSE; + bool ok = false; int fd = Sys::open(filename, O_RDONLY); if (fd >= 0) { ok = sendData(fd, emsg); @@ -969,37 +969,37 @@ SNPPClient::sendData(const fxStr& filename, fxStr& emsg) return (ok); } -fxBool +bool SNPPClient::sendMsg(const char* msg, fxStr& emsg) { if (command("MESS %s", msg) != COMPLETE) { emsg = getLastResponse(); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } -fxBool +bool SNPPClient::siteParm(const char* name, const fxStr& value) { if (!hasSiteCmd()) { printWarning("no SITE %s support; ignoring set request.", name); - return (TRUE); + return (true); } else return (command("SITE %s %s", name, (const char*) value) == COMPLETE); } -fxBool +bool SNPPClient::siteParm(const char* name, u_int value) { if (!hasSiteCmd()) { printWarning("no SITE %s support; ignoring set request.", name); - return (TRUE); + return (true); } else return (command("SITE %s %u", name, value) == COMPLETE); } -fxBool +bool SNPPClient::setHoldTime(u_int t) { time_t tv = t; @@ -1012,7 +1012,7 @@ SNPPClient::setHoldTime(u_int t) , tm->tm_min) == COMPLETE); } -fxBool +bool SNPPClient::setRetryTime(u_int t) { return siteParm("RETRYTIME", fxStr::format("%02d%02d", t/60, t%60)); diff --git a/util/SNPPClient.h b/util/SNPPClient.h index 3c70dec0..7941f852 100644 --- a/util/SNPPClient.h +++ b/util/SNPPClient.h @@ -80,7 +80,7 @@ private: static const S_numbertag numbers[]; void init(void); - fxBool callInetServer(fxStr& emsg); + bool callInetServer(fxStr& emsg); protected: SNPPClient(); SNPPClient(const fxStr& hostarg); @@ -104,9 +104,9 @@ protected: virtual void notifyNewJob(const SNPPJob& job); void initServerState(void); - fxBool extract(u_int& pos, const char* pattern, fxStr& result); + bool extract(u_int& pos, const char* pattern, fxStr& result); - virtual fxBool setupUserIdentity(fxStr& emsg); + virtual bool setupUserIdentity(fxStr& emsg); void setupHostModem(const char*); void setupHostModem(const fxStr&); @@ -114,7 +114,7 @@ protected: * Miscellaneous stuff used by setupSenderIdentity. */ void setBlankMailboxes(const fxStr&); - fxBool getNonBlankMailbox(fxStr&); + bool getNonBlankMailbox(fxStr&); /* * Configuration file support; derived classes may override @@ -122,19 +122,19 @@ protected: */ virtual void resetConfig(void); virtual void setupConfig(void); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); virtual void configError(const char* fmt ...); virtual void configTrace(const char* fmt ...); - fxBool sendRawData(void* buf, int cc, fxStr& emsg); + bool sendRawData(void* buf, int cc, fxStr& emsg); void unexpectedResponse(fxStr& emsg); void protocolBotch(fxStr& emsg, const char* fmt ...); virtual void lostServer(void); public: virtual ~SNPPClient(); // prepare jobs for submission - virtual fxBool prepareForJobSubmissions(fxStr& emsg); - virtual fxBool submitJobs(fxStr& emsg); // submit documents & jobs + virtual bool prepareForJobSubmissions(fxStr& emsg); + virtual bool submitJobs(fxStr& emsg); // submit documents & jobs /* * Sender identity controls. There are two separate @@ -144,7 +144,7 @@ public: * is used by proxy services such as email to pager gateways * and for folks that submit jobs for other people. */ - fxBool setupSenderIdentity(fxStr& emsg); // identity associated with job + bool setupSenderIdentity(fxStr& emsg); // identity associated with job const fxStr& getSenderName() const; void setFromIdentity(const char*); // identity associated with page const fxStr& getFromIdentity() const; @@ -159,19 +159,19 @@ public: void setModem(const char*); const fxStr& getModem(void) const; - virtual fxBool callServer(fxStr& emsg); - virtual fxBool hangupServer(void); - fxBool isConnected(void) const; - fxBool login(const char* user, fxStr& emsg); + virtual bool callServer(fxStr& emsg); + virtual bool hangupServer(void); + bool isConnected(void) const; + bool login(const char* user, fxStr& emsg); virtual const char* getPasswd(const char* prompt); - fxBool isLoggedIn(void) const; + bool isLoggedIn(void) const; void setCtrlFds(int in, int out); FILE* getCtrlFd(void) const; - void setVerbose(fxBool); - fxBool getVerbose(void) const; + void setVerbose(bool); + bool getVerbose(void) const; - fxBool hasSiteCmd(void) const; // server has SITE cmd support + bool hasSiteCmd(void) const; // server has SITE cmd support int getPort(void) const; const fxStr& getProtoName(void) const; @@ -181,7 +181,7 @@ public: // output int command(const char* fmt ...); int vcommand(const char* fmt, va_list ap); - int getReply(fxBool expectEOF); + int getReply(bool expectEOF); const fxStr& getLastResponse(void) const; int getLastCode(void) const; @@ -200,15 +200,15 @@ public: SNPPJob& getProtoJob(); - fxBool setHoldTime(u_int t); - fxBool setRetryTime(u_int t); - fxBool siteParm(const char* name, const fxStr& v); - fxBool siteParm(const char* name, u_int v); - fxBool newPage(const fxStr& pin, const fxStr& passwd, + bool setHoldTime(u_int t); + bool setRetryTime(u_int t); + bool siteParm(const char* name, const fxStr& v); + bool siteParm(const char* name, u_int v); + bool newPage(const fxStr& pin, const fxStr& passwd, fxStr& jobid, fxStr& emsg); - fxBool sendData(int fd, fxStr& emsg); - fxBool sendData(const fxStr& filename, fxStr& emsg); - fxBool sendMsg(const char* msg, fxStr& emsg); + bool sendData(int fd, fxStr& emsg); + bool sendData(const fxStr& filename, fxStr& emsg); + bool sendMsg(const char* msg, fxStr& emsg); void printError(const char* fmt ...); void printWarning(const char* fmt ...); @@ -220,17 +220,17 @@ inline const fxStr& SNPPClient::getUserName(void) const { return userName; } inline const fxStr& SNPPClient::getHost(void) const { return host; } inline const fxStr& SNPPClient::getModem(void) const { return modem; } inline const fxStr& SNPPClient::getProtoName() const { return proto; } -inline fxBool SNPPClient::getVerbose(void) const +inline bool SNPPClient::getVerbose(void) const { return (state&SS_VERBOSE) != 0; } inline int SNPPClient::getPort(void) const { return port; } inline FILE* SNPPClient::getCtrlFd(void) const { return fdOut; } inline const fxStr& SNPPClient::getLastResponse(void) const { return lastResponse; } inline int SNPPClient::getLastCode(void) const { return code; } -inline fxBool SNPPClient::isLoggedIn(void) const +inline bool SNPPClient::isLoggedIn(void) const { return (state&SS_LOGGEDIN) != 0; } -inline fxBool SNPPClient::isConnected(void) const { return fdIn != NULL; } -inline fxBool SNPPClient::hasSiteCmd(void) const +inline bool SNPPClient::isConnected(void) const { return fdIn != NULL; } +inline bool SNPPClient::hasSiteCmd(void) const { return (state&SS_HASSITE) != 0 ; } inline SNPPJob& SNPPClient::getProtoJob() { return jproto; } inline const fxStr* SNPPClient::getPagerMsg() const { return msg; } diff --git a/util/SNPPJob.c++ b/util/SNPPJob.c++ index 834a08eb..357fe3cb 100644 --- a/util/SNPPJob.c++ +++ b/util/SNPPJob.c++ @@ -61,7 +61,7 @@ SNPPJob::~SNPPJob() {} #define valeq(a,b) (strcasecmp(a,b)==0) #define valneq(a,b,n) (strncasecmp(a,b,n)==0) -fxBool +bool SNPPJob::setNotification(const char* v0) { const char* v = v0; @@ -78,8 +78,8 @@ SNPPJob::setNotification(const char* v0) else if (valeq(v, "default")) setNotification(SNPP_DEFNOTIFY); else - return (FALSE); - return (TRUE); + return (false); + return (true); } void SNPPJob::setNotification(PageNotify n) { notify = n; } /* @@ -132,17 +132,17 @@ void SNPPJob::setRetryTime(u_int v) { retryTime = v; } extern int parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg); -fxBool +bool SNPPJob::setHoldTime(const char* s, fxStr& emsg) { struct tm tts; time_t now = Sys::now(); if (!parseAtSyntax(s, *localtime(&now), tts, emsg)) { emsg.insert(fxStr::format("%s: ", s)); - return (FALSE); + return (false); } else { setHoldTime((u_int) mktime(&tts)); - return (TRUE); + return (true); } } void SNPPJob::setHoldTime(u_int v) { holdTime = v; } @@ -150,7 +150,7 @@ void SNPPJob::setMaxTries(u_int n) { maxRetries = n; } void SNPPJob::setMaxDials(u_int n) { maxDials = n; } void SNPPJob::setPIN(const char* s) { pin = s; } void SNPPJob::setPassword(const char* s) { passwd = s; } -void SNPPJob::setQueued(fxBool v) { queued = v; } +void SNPPJob::setQueued(bool v) { queued = v; } void SNPPJob::setSubject(const char* s) { subject = s; } void SNPPJob::setServiceLevel(u_int n) { serviceLevel = n; } @@ -160,7 +160,7 @@ void SNPPJob::setServiceLevel(u_int n) { serviceLevel = n; } #define CHECKPARM(a,b) CHECK(client.siteParm(a,b)) #define IFPARM(a,b,v) { if ((b) != (v)) CHECKPARM(a,b) } -fxBool +bool SNPPJob::createJob(SNPPClient& client, fxStr& emsg) { if (holdTime != 0 && !client.setHoldTime((u_int) holdTime)) @@ -185,7 +185,7 @@ SNPPJob::createJob(SNPPClient& client, fxStr& emsg) return (client.newPage(pin, passwd, jobid, emsg)); failure: emsg = client.getLastResponse(); - return (FALSE); + return (false); } #undef IFPARM #undef CHECKPARM diff --git a/util/SNPPJob.h b/util/SNPPJob.h index aabf7258..7a9a30db 100644 --- a/util/SNPPJob.h +++ b/util/SNPPJob.h @@ -54,7 +54,7 @@ private: u_int maxRetries; // max number times to try send u_int maxDials; // max number times to dial telephone u_int serviceLevel; // delivery service type - fxBool queued; // queued delivery + bool queued; // queued delivery u_int parseTime(const char* v); public: @@ -62,14 +62,14 @@ public: SNPPJob(const SNPPJob& other); virtual ~SNPPJob(); - virtual fxBool createJob(SNPPClient& client, fxStr& emsg); + virtual bool createJob(SNPPClient& client, fxStr& emsg); const fxStr& getJobID(void) const; /* * Job notification. */ - fxBool setNotification(const char*);// email notification + bool setNotification(const char*);// email notification void setNotification(PageNotify); PageNotify getNotification() const; void setMailbox(const char*); // email notification address @@ -78,13 +78,13 @@ public: /* * Job scheduling controls. */ - void setQueued(fxBool); // queued or synchronous wait - fxBool getQueued() const; + void setQueued(bool); // queued or synchronous wait + bool getQueued() const; void setRetryTime(u_int); // job retry time (seconds) void setRetryTime(const char* v); u_int getRetryTime() const; // time to initiate tranmission - fxBool setHoldTime(const char*, fxStr& emsg); + bool setHoldTime(const char*, fxStr& emsg); void setHoldTime(u_int); u_int getHoldTime() const; void setMaxTries(u_int); // maximum attempts to send @@ -116,7 +116,7 @@ inline u_int SNPPJob::getMaxTries() const { return maxRetries; } inline u_int SNPPJob::getMaxDials() const { return maxDials; } inline const fxStr& SNPPJob::getPIN() const { return pin; } inline const fxStr& SNPPJob::getPasswd() const { return passwd; } -inline fxBool SNPPJob::getQueued() const { return queued; } +inline bool SNPPJob::getQueued() const { return queued; } inline const fxStr& SNPPJob::getSubject(void) const { return subject; } inline u_int SNPPJob::getServiceLevel() const { return serviceLevel; } #endif /* _SNPPJob_ */ diff --git a/util/SendFaxClient.c++ b/util/SendFaxClient.c++ index 97c46600..d16ffdc1 100644 --- a/util/SendFaxClient.c++ +++ b/util/SendFaxClient.c++ @@ -64,7 +64,7 @@ SendFaxClient::SendFaxClient() dialRules = NULL; files = new FileInfoArray; polls = new PollRequestArray; - setup = FALSE; + setup = false; setupConfig(); } @@ -87,11 +87,11 @@ void SendFaxClient::vprintWarning(const char* fmt, va_list ap) void SendFaxClient::vtraceServer(const char* fmt, va_list ap) { FaxClient::vtraceServer(fmt, ap); } -fxBool +bool SendFaxClient::prepareForJobSubmissions(fxStr& emsg) { if (senderName == "" && !setupSenderIdentity(from, emsg)) - return (FALSE); + return (false); /* * Prepare documents for transmission. */ @@ -99,7 +99,7 @@ SendFaxClient::prepareForJobSubmissions(fxStr& emsg) typeRules = TypeRules::read(typeRulesFile); if (!typeRules) { emsg = "Unable to setup file typing and conversion rules"; - return (FALSE); + return (false); } } typeRules->setVerbose(verbose); @@ -112,7 +112,7 @@ SendFaxClient::prepareForJobSubmissions(fxStr& emsg) * confused by this that the message has been removed so I no * longer have to explain why it's not a problem. */ - (void) dialRules->parse(FALSE); + (void) dialRules->parse(false); } else dialRules->setVerbose(verbose); /* @@ -125,7 +125,7 @@ SendFaxClient::prepareForJobSubmissions(fxStr& emsg) continue; if (!job.setPageSize(job.getPageSize())) { emsg = "Unknown page size " | job.getPageSize(); - return (FALSE); + return (false); } } /* @@ -137,7 +137,7 @@ SendFaxClient::prepareForJobSubmissions(fxStr& emsg) totalPages = 0; for (i = 0, n = files->length(); i < n; i++) if (!prepareFile((*files)[i], emsg)) - return (FALSE); + return (false); /* * Prepare cover pages. */ @@ -159,11 +159,11 @@ SendFaxClient::prepareForJobSubmissions(fxStr& emsg) if (job.getAutoCoverPage() && getNumberOfFiles() > 0) { fxStr file; if (!makeCoverPage(job, file, emsg)) - return (FALSE); - job.setCoverPageFile(file, TRUE); + return (false); + job.setCoverPageFile(file, true); } } - return (setup = TRUE); + return (setup = true); } static fxStr @@ -187,7 +187,7 @@ addarg(const char* av[], int& ac, const char* flag, const fxStr& opt) /* * Invoke the cover page generation program. */ -fxBool +bool SendFaxClient::makeCoverPage(const SendFaxJob& job, fxStr& file, fxStr& emsg) { tmpFile = _PATH_TMP "/sndfaxXXXXXX"; @@ -250,7 +250,7 @@ SendFaxClient::makeCoverPage(const SendFaxJob& job, fxStr& file, fxStr& emsg) int status; if (Sys::waitpid(pid, status) == pid && status == 0) { file = tmpFile; - return (TRUE); + return (true); } emsg = fxStr::format("Error creating cover sheet; " "command was \"%s\"; exit status %x" @@ -269,7 +269,7 @@ SendFaxClient::makeCoverPage(const SendFaxJob& job, fxStr& file, fxStr& emsg) emsg = fxStr::format("%s: Can not create temporary file for cover page", (const char*) tmpFile); Sys::unlink(tmpFile); - return (FALSE); + return (false); } SendFaxJob& @@ -278,7 +278,7 @@ SendFaxClient::addJob(void) u_int ix = jobs->length(); jobs->resize(ix+1); (*jobs)[ix] = proto; - setup = FALSE; + setup = false; return ((*jobs)[ix]); } u_int SendFaxClient::getNumberOfJobs() const { return jobs->length(); } @@ -324,7 +324,7 @@ SendFaxClient::addFile(const fxStr& filename) u_int ix = files->length(); files->resize(ix+1); (*files)[ix].name = filename; - setup = FALSE; + setup = false; return (ix); } @@ -381,7 +381,7 @@ SendFaxClient::addPollRequest(const fxStr& sep, const fxStr& pwd) polls->resize(ix+1); (*polls)[ix].sep = sep; (*polls)[ix].pwd = pwd; - setup = FALSE; + setup = false; return (ix); } u_int SendFaxClient::getNumberOfPollRequests() const { return polls->length(); } @@ -405,43 +405,43 @@ SendFaxClient::removePollRequest(u_int ix) /* * Submit documents and jobs to the server. */ -fxBool +bool SendFaxClient::submitJobs(fxStr& emsg) { if (!setup) { emsg = "Documents not prepared"; - return (FALSE); + return (false); } if (!isLoggedIn()) { emsg = "Not logged in to server"; - return (FALSE); + return (false); } /* * Transfer documents to the server. */ if (!sendDocuments(emsg)) - return (FALSE); + return (false); /* * Construct jobs and submit them. */ for (u_int i = 0, n = jobs->length(); i < n; i++) { SendFaxJob& job = (*jobs)[i]; if (!job.createJob(*this, emsg)) - return (FALSE); + return (false); if (!jobSubmit(job.getJobID())) { emsg = getLastResponse(); - return (FALSE); + return (false); } notifyNewJob(job); // notify client } - return (TRUE); + return (true); } /* * Transfer the document files to the server and * record the serve-side documents for job submission. */ -fxBool +bool SendFaxClient::sendDocuments(fxStr& emsg) { emsg = ""; @@ -451,9 +451,9 @@ SendFaxClient::sendDocuments(fxStr& emsg) if (fd < 0) { emsg = fxStr::format(info.temp | ": Can not open: %s", strerror(errno)); - return (FALSE); // XXX + return (false); // XXX } - fxBool fileSent; + bool fileSent; if (info.rule->getResult() == TypeRule::TIFF) { fileSent = setFormat(FORM_TIFF) && setType(TYPE_I) @@ -467,10 +467,10 @@ SendFaxClient::sendDocuments(fxStr& emsg) if (!fileSent) { if (emsg == "") emsg = "Document transfer failed: " | getLastResponse(); - return (FALSE); + return (false); } } - return (TRUE); + return (true); } /* @@ -510,7 +510,7 @@ SendFaxClient::setupConfig() { for (int i = N(strings)-1; i >= 0; i--) (*this).*strings[i].p = (strings[i].def ? strings[i].def : ""); - verbose = FALSE; + verbose = false; delete typeRules, typeRules = NULL; delete dialRules, dialRules = NULL; @@ -524,7 +524,7 @@ SendFaxClient::resetConfig() setupConfig(); } -fxBool +bool SendFaxClient::setConfigItem(const char* tag, const char* value) { u_int ix; @@ -536,15 +536,15 @@ SendFaxClient::setConfigItem(const char* tag, const char* value) } else if (proto.setConfigItem(tag, value)) { ; } else if (!FaxClient::setConfigItem(tag, value)) - return (FALSE); - return (TRUE); + return (false); + return (true); } #undef N /* * Setup the sender's identity. */ -fxBool +bool SendFaxClient::setupSenderIdentity(const fxStr& from, fxStr& emsg) { FaxClient::setupUserIdentity(emsg); // client identity @@ -588,9 +588,9 @@ SendFaxClient::setupSenderIdentity(const fxStr& from, fxStr& emsg) fxStr mbox; if (senderName == "" || !getNonBlankMailbox(mbox)) { emsg = "Malformed (null) sender name or mail address"; - return (FALSE); + return (false); } else - return (TRUE); + return (true); } void SendFaxClient::setFromIdentity(const char* s) { from = s; } @@ -613,28 +613,28 @@ SendFaxClient::setBlankMailboxes(const fxStr& s) * Return the first non-null mailbox string * in the set of jobs. */ -fxBool +bool SendFaxClient::getNonBlankMailbox(fxStr& s) { for (u_int i = 0, n = jobs->length(); i < n; i++) { SendFaxJob& job = (*jobs)[i]; if (job.getMailbox() != "") { s = job.getMailbox(); - return (TRUE); + return (true); } } - return (FALSE); + return (false); } /* * Process a file submitted for transmission. */ -fxBool +bool SendFaxClient::prepareFile(FileInfo& info, fxStr& emsg) { info.rule = fileType(info.name, emsg); if (!info.rule) - return (FALSE); + return (false); if (info.temp != "" && info.temp != info.name) Sys::unlink(info.temp); if (info.rule->getCmd() != "") { // conversion required @@ -659,7 +659,7 @@ SendFaxClient::prepareFile(FileInfo& info, fxStr& emsg) Sys::unlink(tmpFile); emsg = fxStr::format("Error converting data; command was \"%s\"", (const char*) sysCmd); - return (FALSE); + return (false); } info.temp = tmpFile; } else // already postscript or tiff @@ -672,7 +672,7 @@ SendFaxClient::prepareFile(FileInfo& info, fxStr& emsg) estimatePostScriptPages(info.temp); break; } - return (TRUE); + return (true); } /* diff --git a/util/SendFaxClient.h b/util/SendFaxClient.h index 3788f0e1..5b47f6c3 100644 --- a/util/SendFaxClient.h +++ b/util/SendFaxClient.h @@ -54,8 +54,8 @@ private: DialStringRules* dialRules; // dial string conversion database FileInfoArray* files; // files to send (possibly converted) PollRequestArray* polls; // polling requests - fxBool verbose; // enable debugging information - fxBool setup; // if true, then ready to send + bool verbose; // enable debugging information + bool setup; // if true, then ready to send fxStr tmpFile; // stuff to cleanup on abort fxStr from; // command line from information fxStr senderName; // sender's full name @@ -87,7 +87,7 @@ protected: * Derived classes can override makeCoverPage to supply an * application-specific cover page generation scheme. */ - virtual fxBool makeCoverPage(const SendFaxJob&, fxStr& file, fxStr& emsg); + virtual bool makeCoverPage(const SendFaxJob&, fxStr& file, fxStr& emsg); /* * These methods are used to count/estimate the number * of pages in a document that is to be transmitted. @@ -105,27 +105,27 @@ protected: */ virtual void setupConfig(); virtual void resetConfig(); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); /* * File typerule support. */ const TypeRule* fileType(const char* filename, fxStr& emsg); - fxBool prepareFile(FileInfo& info, fxStr& emsg); + bool prepareFile(FileInfo& info, fxStr& emsg); /* * Miscellaneous stuff used by setupSenderIdentity. */ void setBlankMailboxes(const fxStr&); - fxBool getNonBlankMailbox(fxStr&); + bool getNonBlankMailbox(fxStr&); public: virtual ~SendFaxClient(); // prepare jobs for submission - virtual fxBool prepareForJobSubmissions(fxStr& emsg); + virtual bool prepareForJobSubmissions(fxStr& emsg); void purgeFileConversions(void); // purge any converted docs - virtual fxBool submitJobs(fxStr& emsg); // submit documents & jobs - virtual fxBool sendDocuments(fxStr& emsg); // send prepared documents + virtual bool submitJobs(fxStr& emsg); // submit documents & jobs + virtual bool sendDocuments(fxStr& emsg); // send prepared documents /* * Job manipulation interfaces. @@ -164,18 +164,18 @@ public: * and for folks people that submit jobs for other people. */ // identity associated with job - fxBool setupSenderIdentity(const fxStr&, fxStr& emsg); + bool setupSenderIdentity(const fxStr&, fxStr& emsg); const fxStr& getSenderName() const; void setFromIdentity(const char*); // identity associated with fax const fxStr& getFromIdentity() const; - fxBool getVerbose() const; // trace operation - void setVerbose(fxBool); + bool getVerbose() const; // trace operation + void setVerbose(bool); }; inline SendFaxJob& SendFaxClient::getProtoJob() { return proto; } inline const fxStr& SendFaxClient::getFromIdentity() const { return from; } inline const fxStr& SendFaxClient::getSenderName() const { return senderName;} -inline void SendFaxClient::setVerbose(fxBool b) { verbose = b; } -inline fxBool SendFaxClient::getVerbose() const { return verbose; } +inline void SendFaxClient::setVerbose(bool b) { verbose = b; } +inline bool SendFaxClient::getVerbose() const { return verbose; } #endif /* _SendFaxClient_ */ diff --git a/util/SendFaxJob.c++ b/util/SendFaxJob.c++ index 271c37e7..b07eb36f 100644 --- a/util/SendFaxJob.c++ +++ b/util/SendFaxJob.c++ @@ -135,8 +135,8 @@ SendFaxJob::setupConfig() for (i = N(floats)-1; i >= 0; i--) (*this).*floats[i].p = floats[i].def; - autoCover = TRUE; - sendTagLine = FALSE; // default is to use server config + autoCover = true; + sendTagLine = false; // default is to use server config notify = FAX_DEFNOTIFY; // default notification mailbox = ""; priority = FAX_DEFPRIORITY; // default transmit priority @@ -149,14 +149,14 @@ SendFaxJob::setupConfig() pagechop = chop_default; } -fxBool +bool SendFaxJob::setConfigItem(const char* tag, const char* value) { u_int ix; if (FaxConfig::findTag(tag, (const FaxConfig::tags*) strings, N(strings), ix)) { (*this).*strings[ix].p = value; switch (ix) { - case 0: sendTagLine = TRUE; break; + case 0: sendTagLine = true; break; } } else if (FaxConfig::findTag(tag, (const FaxConfig::tags*) numbers, N(numbers), ix)) { (*this).*numbers[ix].p = atoi(value); @@ -185,15 +185,15 @@ SendFaxJob::setConfigItem(const char* tag, const char* value) else if (streq(tag, "pagechop")) setChopHandling(value); else - return (FALSE); - return (TRUE); + return (false); + return (true); } #undef N #define valeq(a,b) (strcasecmp(a,b)==0) #define valneq(a,b,n) (strncasecmp(a,b,n)==0) -fxBool +bool SendFaxJob::setNotification(const char* v0) { const char* v = v0; @@ -210,8 +210,8 @@ SendFaxJob::setNotification(const char* v0) else if (valeq(v, "default")) notify = FAX_DEFNOTIFY; else - return (FALSE); - return (TRUE); + return (false); + return (true); } void SendFaxJob::setNotification(FaxNotify n) { notify = n; } /* @@ -283,9 +283,9 @@ void SendFaxJob::setSubAddress(const char* s) { subaddr = s; } void SendFaxJob::setPassword(const char* s) { passwd = s; } void SendFaxJob::setExternalNumber(const char* s) { external = s; } -void SendFaxJob::setAutoCoverPage(fxBool b) { autoCover = b; } +void SendFaxJob::setAutoCoverPage(bool b) { autoCover = b; } void -SendFaxJob::setCoverPageFile(const char* s, fxBool removeOnExit) +SendFaxJob::setCoverPageFile(const char* s, bool removeOnExit) { if (coverFile != "" && removeOnExit) Sys::unlink(coverFile); @@ -300,7 +300,7 @@ void SendFaxJob::setCoverComments(const char* s) { comments = s; } void SendFaxJob::setCoverRegarding(const char* s) { regarding = s; } void SendFaxJob::setCoverVoiceNumber(const char* s) { voicenumber = s; } -fxBool +bool SendFaxJob::setPageSize(const char* name) { PageSizeInfo* info = PageSizeInfo::getPageSizeByName(name); @@ -309,9 +309,9 @@ SendFaxJob::setPageSize(const char* name) pageLength = info->height(); pageSize = name; delete info; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } void SendFaxJob::setVResolution(float r) { vres = r; } void SendFaxJob::setHResolution(float r) { hres = r; } @@ -356,7 +356,7 @@ SendFaxJob::setDesiredMST(const char* v) desiredst = atoi(v); } void SendFaxJob::setDesiredMST(int v) { desiredst = v; } -void SendFaxJob::setDesiredEC(fxBool b) { desiredec = b; } +void SendFaxJob::setDesiredEC(bool b) { desiredec = b; } void SendFaxJob::setDesiredDF(const char* v) { @@ -377,7 +377,7 @@ void SendFaxJob::setTagLineFormat(const char* v) { tagline = v; - sendTagLine = TRUE; + sendTagLine = true; } void @@ -403,15 +403,15 @@ parseAtSyntax(const char* s, const struct tm& ref, struct tm& at0, fxStr& emsg); #define CHECKPARM(a,b) CHECK(client.jobParm(a,b)) #define IFPARM(a,b,v) { if ((b) != (v)) CHECKPARM(a,b) } -fxBool +bool SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg) { if (!client.setCurrentJob("DEFAULT")) { // inherit from default emsg = client.getLastResponse(); - return (FALSE); + return (false); } if (!client.newJob(jobid, groupid, emsg)) // create new job on server - return (FALSE); + return (false); time_t now = Sys::now(); @@ -421,7 +421,7 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg) if (sendTime != "") { if (!parseAtSyntax(sendTime, *localtime(&now), tts, emsg)) { emsg.insert(sendTime | ": "); - return (FALSE); + return (false); } now = mktime(&tts); // NB: must send time relative to GMT @@ -432,7 +432,7 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg) struct tm when; if (!parseAtSyntax(killTime, tts, when, emsg)) { emsg.insert(killTime | ": "); - return (FALSE); + return (false); } CHECK(client.jobLastTime(mktime(&when) - now)) } @@ -462,7 +462,7 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg) IFPARM("BEGBR", desiredbr, (u_int) -1) IFPARM("BEGST", desiredst, (u_int) -1) if (desiredec != (u_int) -1) - CHECKPARM("USEECM", (fxBool) desiredec) + CHECKPARM("USEECM", (bool) desiredec) if (desireddf != (u_int) -1) { CHECKPARM("DATAFORMAT", desireddf == 0 ? "g31d" : @@ -472,7 +472,7 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg) "g31d") } if (sendTagLine) { - CHECKPARM("USETAGLINE", TRUE) + CHECKPARM("USETAGLINE", true) CHECKPARM("TAGLINE", tagline) } CHECKPARM("NOTIFY", @@ -490,10 +490,10 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg) if (fd < 0) { emsg = fxStr::format("%s: Can not open: %s", (const char*) coverFile, strerror(errno)); - return (FALSE); // XXX + return (false); // XXX } fxStr coverDoc; - fxBool fileSent = + bool fileSent = client.setFormat(FaxClient::FORM_PS) && client.setType(FaxClient::TYPE_I) // XXX??? TYPE_A && client.sendZData(fd, &FaxClient::storeTemp, coverDoc, emsg); @@ -501,7 +501,7 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg) if (!fileSent) { if (emsg == "") emsg = "Document transfer failed: " | client.getLastResponse(); - return (FALSE); + return (false); } CHECK(client.jobCover(coverDoc)) } @@ -516,10 +516,10 @@ SendFaxJob::createJob(SendFaxClient& client, fxStr& emsg) client.getPollRequest(i, sep, pwd); CHECK(client.jobPollRequest(sep, pwd)) } - return (TRUE); + return (true); failure: emsg = client.getLastResponse(); - return (FALSE); + return (false); } #undef CHECKPARM #undef IFPARM diff --git a/util/SendFaxJob.h b/util/SendFaxJob.h index ccd2bcaa..ef222bfc 100644 --- a/util/SendFaxJob.h +++ b/util/SendFaxJob.h @@ -76,8 +76,8 @@ private: fxStr passwd; // password (opt) fxStr external; // displayable version of number (opt) - fxBool autoCover; // if TRUE, auto-generate cover sheet - fxBool coverIsTemp; // if TRUE, remove coverFile on exit + bool autoCover; // if true, auto-generate cover sheet + bool coverIsTemp; // if true, remove coverFile on exit fxStr coverFile; // cover page file fxStr coverTemplate; // cover page template file fxStr name; // receipient for cover page @@ -87,7 +87,7 @@ private: fxStr comments; // comments for cover page fxStr regarding; // regarding info for cover page - fxBool sendTagLine; // if TRUE, use custom tagline format + bool sendTagLine; // if true, use custom tagline format fxStr killTime; // job's time to be killed fxStr sendTime; // job's time to be sent u_int retryTime; // retry time for failures (secs) @@ -118,10 +118,10 @@ public: SendFaxJob(const SendFaxJob& other); virtual ~SendFaxJob(); - virtual fxBool createJob(SendFaxClient& client, fxStr& emsg); + virtual bool createJob(SendFaxClient& client, fxStr& emsg); virtual void setupConfig(); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); const fxStr& getJobID(void) const; const fxStr& getGroupID(void) const; @@ -129,7 +129,7 @@ public: /* * Job notification. */ - fxBool setNotification(const char*);// email notification + bool setNotification(const char*);// email notification void setNotification(FaxNotify); FaxNotify getNotification() const; void setMailbox(const char*); // email notification address @@ -183,10 +183,10 @@ public: * suppressed or an application-specified file can be * specified instead. */ - void setAutoCoverPage(fxBool); // auto-generate cover page - fxBool getAutoCoverPage() const; + void setAutoCoverPage(bool); // auto-generate cover page + bool getAutoCoverPage() const; // cover page file - void setCoverPageFile(const char*, fxBool removeOnExit); + void setCoverPageFile(const char*, bool removeOnExit); const fxStr& getCoverPageFile() const; void setCoverTemplate(const char*); // cover page template file const fxStr& getCoverTemplate() const; @@ -215,7 +215,7 @@ public: float getPageWidth() const; // sending page width (mm) float getPageLength() const; // sending page length (mm) const fxStr& getPageSize() const; // page size by name - fxBool setPageSize(const char* name); + bool setPageSize(const char* name); void setVResolution(float); // vertical resolution (lines/inch) float getVResolution() const; void setHResolution(float); // horizontal resolution (lines/inch) @@ -233,8 +233,8 @@ public: void setDesiredMST(int); // desired/initial min-scanline time void setDesiredMST(const char* v); int getDesiredMST() const; - void setDesiredEC(fxBool b); // desired use of Error Correction mode - fxBool getDesiredEC() const; + void setDesiredEC(bool b); // desired use of Error Correction mode + bool getDesiredEC() const; void setDesiredDF(int); // desired data format void setDesiredDF(const char*); int getDesiredDF() const; @@ -266,7 +266,7 @@ inline const fxStr& SendFaxJob::getDialString() const { return number; } inline const fxStr& SendFaxJob::getSubAddress() const { return subaddr; } inline const fxStr& SendFaxJob::getPasswd() const { return passwd; } inline const fxStr& SendFaxJob::getExternalNumber() const{ return external; } -inline fxBool SendFaxJob::getAutoCoverPage() const { return autoCover; } +inline bool SendFaxJob::getAutoCoverPage() const { return autoCover; } inline const fxStr& SendFaxJob::getCoverPageFile() const{ return coverFile; } inline const fxStr& SendFaxJob::getCoverTemplate() const{ return coverTemplate;} inline const fxStr& SendFaxJob::getCoverName() const { return name; } @@ -283,7 +283,7 @@ inline float SendFaxJob::getHResolution() const { return hres; } inline int SendFaxJob::getMinSpeed() const { return minsp; } inline int SendFaxJob::getDesiredSpeed() const { return desiredbr; } inline int SendFaxJob::getDesiredMST() const { return desiredst; } -inline fxBool SendFaxJob::getDesiredEC() const { return desiredec; } +inline bool SendFaxJob::getDesiredEC() const { return desiredec; } inline int SendFaxJob::getDesiredDF() const { return desireddf; } inline const fxStr& SendFaxJob::getTagLineFormat() const{ return tagline; } inline u_int SendFaxJob::getChopHandling() const { return pagechop; } diff --git a/util/Str.c++ b/util/Str.c++ index 5f52cf0d..8b9fcb17 100644 --- a/util/Str.c++ +++ b/util/Str.c++ @@ -307,7 +307,7 @@ void fxStr::resizeInternal(u_int chars) } -void fxStr::resize(u_int chars, fxBool) +void fxStr::resize(u_int chars, bool) { resizeInternal(chars); if (chars != 0) { @@ -370,92 +370,92 @@ void fxStr::append(char a) data[slength-1] = 0; } -fxBool operator==(const fxStr& a,const fxStr& b) +bool operator==(const fxStr& a,const fxStr& b) { return (a.slength == b.slength) && (memcmp(a.data,b.data,a.slength) == 0); } -fxBool operator==(const fxStr& a,const char* b) +bool operator==(const fxStr& a,const char* b) { return (a.slength == strlen(b)+1) && (memcmp(a.data,b,a.slength) == 0); } -fxBool operator==(const char* b, const fxStr& a) +bool operator==(const char* b, const fxStr& a) { return (a.slength == strlen(b)+1) && (memcmp(a.data,b,a.slength) == 0); } -fxBool operator!=(const fxStr& a,const fxStr& b) +bool operator!=(const fxStr& a,const fxStr& b) { return (a.slength != b.slength) || (memcmp(a.data,b.data,a.slength) != 0); } -fxBool operator!=(const fxStr& a,const char* b) +bool operator!=(const fxStr& a,const char* b) { return (a.slength != strlen(b)+1) || (memcmp(a.data,b,a.slength) != 0); } -fxBool operator!=(const char* b, const fxStr& a) +bool operator!=(const char* b, const fxStr& a) { return (a.slength != strlen(b)+1) || (memcmp(a.data,b,a.slength) != 0); } -fxBool operator>=(const fxStr& a,const fxStr& b) +bool operator>=(const fxStr& a,const fxStr& b) { return strcmp(a,b) >= 0; } -fxBool operator>=(const fxStr& a,const char* b) +bool operator>=(const fxStr& a,const char* b) { return strcmp(a,b) >= 0; } -fxBool operator>=(const char* a, const fxStr& b) +bool operator>=(const char* a, const fxStr& b) { return strcmp(a,b) >= 0; } -fxBool operator>(const fxStr& a,const fxStr& b) +bool operator>(const fxStr& a,const fxStr& b) { return strcmp(a,b) > 0; } -fxBool operator>(const fxStr& a,const char* b) +bool operator>(const fxStr& a,const char* b) { return strcmp(a,b) > 0; } -fxBool operator>(const char* a, const fxStr& b) +bool operator>(const char* a, const fxStr& b) { return strcmp(a,b) > 0; } -fxBool operator<=(const fxStr& a,const fxStr& b) +bool operator<=(const fxStr& a,const fxStr& b) { return strcmp(a,b) <= 0; } -fxBool operator<=(const fxStr& a,const char* b) +bool operator<=(const fxStr& a,const char* b) { return strcmp(a,b) <= 0; } -fxBool operator<=(const char* a, const fxStr& b) +bool operator<=(const char* a, const fxStr& b) { return strcmp(a,b) <= 0; } -fxBool operator<(const fxStr& a,const fxStr& b) +bool operator<(const fxStr& a,const fxStr& b) { return strcmp(a,b) < 0; } -fxBool operator<(const fxStr& a,const char* b) +bool operator<(const fxStr& a,const char* b) { return strcmp(a,b) < 0; } -fxBool operator<(const char* a, const fxStr& b) +bool operator<(const char* a, const fxStr& b) { return strcmp(a,b) < 0; } diff --git a/util/Str.h b/util/Str.h index 6585a7d3..bd86888b 100644 --- a/util/Str.h +++ b/util/Str.h @@ -125,29 +125,29 @@ public: ///////////////////////////////////////////////////// // Comparison - friend fxBool operator==(fxStr const&, fxStr const&); - friend fxBool operator==(fxStr const&, char const*); - friend fxBool operator==(char const*, fxStr const&); + friend bool operator==(fxStr const&, fxStr const&); + friend bool operator==(fxStr const&, char const*); + friend bool operator==(char const*, fxStr const&); - friend fxBool operator!=(fxStr const&, fxStr const&); - friend fxBool operator!=(fxStr const&, char const*); - friend fxBool operator!=(char const*, fxStr const&); + friend bool operator!=(fxStr const&, fxStr const&); + friend bool operator!=(fxStr const&, char const*); + friend bool operator!=(char const*, fxStr const&); - friend fxBool operator>=(fxStr const&, fxStr const&); - friend fxBool operator>=(fxStr const&, char const*); - friend fxBool operator>=(char const*, fxStr const&); + friend bool operator>=(fxStr const&, fxStr const&); + friend bool operator>=(fxStr const&, char const*); + friend bool operator>=(char const*, fxStr const&); - friend fxBool operator<=(fxStr const&, fxStr const&); - friend fxBool operator<=(fxStr const&, char const*); - friend fxBool operator<=(char const*, fxStr const&); + friend bool operator<=(fxStr const&, fxStr const&); + friend bool operator<=(fxStr const&, char const*); + friend bool operator<=(char const*, fxStr const&); - friend fxBool operator>(fxStr const&, fxStr const&); - friend fxBool operator>(fxStr const&, char const*); - friend fxBool operator>(char const*, fxStr const&); + friend bool operator>(fxStr const&, fxStr const&); + friend bool operator>(fxStr const&, char const*); + friend bool operator>(char const*, fxStr const&); - friend fxBool operator<(fxStr const&, fxStr const&); - friend fxBool operator<(fxStr const&, char const*); - friend fxBool operator<(char const*, fxStr const&); + friend bool operator<(fxStr const&, fxStr const&); + friend bool operator<(fxStr const&, char const*); + friend bool operator<(char const*, fxStr const&); int compare(fxStr const *a) const { return ::compare(*this, *a); } friend int compare(fxStr const&, fxStr const&); @@ -175,7 +175,7 @@ public: void remove(u_int posn,u_int len=1); - void resize(u_int len, fxBool reallocate = FALSE); + void resize(u_int len, bool reallocate = false); void setMaxLength(u_int maxlen); void append(char a); diff --git a/util/Sys.c++ b/util/Sys.c++ index cf426c7d..0ee673b9 100644 --- a/util/Sys.c++ +++ b/util/Sys.c++ @@ -29,49 +29,49 @@ * Wrapper functions for C library calls. */ -fxBool +bool Sys::isRegularFile(const char* filename) { struct stat sb; return (Sys::stat(filename, sb) >= 0 && (sb.st_mode&S_IFMT) == S_IFREG); } -fxBool +bool Sys::isSocketFile(const char* filename) { #ifdef S_IFSOCK struct stat sb; return (Sys::stat(filename, sb) >= 0 && (sb.st_mode&S_IFMT) == S_IFSOCK); #else - return (FALSE); + return (false); #endif } -fxBool +bool Sys::isFIFOFile(const char* filename) { struct stat sb; return (Sys::stat(filename, sb) >= 0 && (sb.st_mode&S_IFMT) == S_IFIFO); } -fxBool +bool Sys::isFIFOFile(int fd) { struct stat sb; return (Sys::fstat(fd, sb) >= 0 && (sb.st_mode&S_IFMT) == S_IFIFO); } -fxBool +bool Sys::isCharSpecialFile(const char* filename, struct stat& sb) { #ifdef S_IFCHR return (Sys::stat(filename, sb) >= 0 && (sb.st_mode&S_IFMT) == S_IFCHR); #else - return (FALSE); + return (false); #endif } -fxBool +bool Sys::isCharSpecialFile(const char* filename) { struct stat sb; diff --git a/util/Sys.h b/util/Sys.h index 98787874..0591710d 100644 --- a/util/Sys.h +++ b/util/Sys.h @@ -64,12 +64,12 @@ public: { return ::stat(file, &sb); } static int fstat(int fd, struct stat& sb) { return ::fstat(fd, &sb); } - static fxBool isRegularFile(const char* filename); - static fxBool isFIFOFile(const char* filename); - static fxBool isSocketFile(const char* filename); - static fxBool isFIFOFile(int fd); - static fxBool isCharSpecialFile(const char* filename); - static fxBool isCharSpecialFile(const char* filename, struct stat&); + static bool isRegularFile(const char* filename); + static bool isFIFOFile(const char* filename); + static bool isSocketFile(const char* filename); + static bool isFIFOFile(int fd); + static bool isCharSpecialFile(const char* filename); + static bool isCharSpecialFile(const char* filename, struct stat&); static int link(const char* file1, const char* file2) { return ::link(file1, file2); } static int rename(const char* file1, const char* file2) diff --git a/util/TextFmt.c++ b/util/TextFmt.c++ index b36f9d28..bb891ba4 100644 --- a/util/TextFmt.c++ +++ b/util/TextFmt.c++ @@ -71,7 +71,7 @@ TextFmt::TextFmt() firstPageNum = 1; // starting page number column = 1; // current text column # (1..numcol) pageNum = 1; // current page number - workStarted = FALSE; + workStarted = false; fonts = new FontDict; curFont = addFont("Roman", "Courier"); @@ -146,9 +146,9 @@ void TextFmt::setFontPath(const char* path) { TextFont::fontPath = path; } void TextFmt::setOutputFile(FILE* f) { output = f; } void TextFmt::setNumberOfColumns(u_int n) { numcol = n; } -void TextFmt::setPageHeaders(fxBool b) { headers = b; } -void TextFmt::setISO8859(fxBool b) { useISO8859 = b; } -void TextFmt::setLineWrapping(fxBool b) { wrapLines = b; } +void TextFmt::setPageHeaders(bool b) { headers = b; } +void TextFmt::setISO8859(bool b) { useISO8859 = b; } +void TextFmt::setLineWrapping(bool b) { wrapLines = b; } void TextFmt::setOutlineMargin(TextCoord o) { outline = o; } void TextFmt::setTextPointSize(TextCoord p) { pointSize = p; } void TextFmt::setPageOrientation(u_int o) { landscape = (o == LANDSCAPE); } @@ -158,32 +158,32 @@ void TextFmt::setTitle(const char* cp) { title = cp; } void TextFmt::setFilename(const char* cp) { curFile = cp; } void -TextFmt::setGaudyHeaders(fxBool b) +TextFmt::setGaudyHeaders(bool b) { if (gaudy = b) - headers = TRUE; + headers = true; } -fxBool +bool TextFmt::setTextFont(const char* name) { if (TextFont::findFont(name)) { (*fonts)["Roman"]->family = name; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } /* * Parse margin syntax: l=#,r=#,t=#,b=# */ -fxBool +bool TextFmt::setPageMargins(const char* s) { for (const char* cp = s; cp && cp[0];) { if (cp[1] != '=') - return (FALSE); + return (false); TextCoord v = inch(&cp[2]); switch (tolower(cp[0])) { case 'b': bm = v; break; @@ -191,13 +191,13 @@ TextFmt::setPageMargins(const char* s) case 'r': rm = v; break; case 't': tm = v; break; default: - return (FALSE); + return (false); } cp = strchr(cp, ','); if (cp) cp++; } - return (TRUE); + return (true); } void @@ -209,7 +209,7 @@ TextFmt::setPageMargins(TextCoord l, TextCoord r, TextCoord b, TextCoord t) tm = t; } -fxBool +bool TextFmt::setPageSize(const char* name) { PageSizeInfo* info = PageSizeInfo::getPageSizeByName(name); @@ -217,9 +217,9 @@ TextFmt::setPageSize(const char* name) setPageWidth(info->width() / 25.4); setPageHeight(info->height() / 25.4); delete info; - return (TRUE); + return (true); } else - return (FALSE); + return (false); } void TextFmt::setPageWidth(float pw) { physPageWidth = pw; } @@ -291,7 +291,7 @@ TextFmt::beginFormatting(FILE* o) */ if (lineHeight <= 0) lineHeight = (pointSize * 12L) / 10L; - workStarted = TRUE; + workStarted = true; } void @@ -322,7 +322,7 @@ TextFmt::endFormatting(void) tf = NULL; emitTrailer(); fflush(output); - workStarted = FALSE; + workStarted = false; } /* copy bytes b1..b2 to stdout */ @@ -584,8 +584,8 @@ TextFmt::newPage(void) y = pageHeight - tm - lineHeight; // y at page top level = 0; // string paren level reset column = 1; - boc = TRUE; - bop = TRUE; + boc = true; + bop = true; } void @@ -596,7 +596,7 @@ TextFmt::newCol(void) y = pageHeight - tm - lineHeight; // y at page top level = 0; column++; - boc = TRUE; + boc = true; } static void @@ -647,7 +647,7 @@ void TextFmt::beginLine(void) { if (boc) - beginCol(), boc = FALSE, bop = FALSE; + beginCol(), boc = false, bop = false; fputc('B', tf); } @@ -680,8 +680,8 @@ TextFmt::beginFile(void) { newPage(); // each file starts on a new page - bol = TRUE; // force line start - bot = TRUE; // force text start + bol = true; // force line start + bot = true; // force text start xoff = col_width * (column-1); } @@ -759,7 +759,7 @@ TextFmt::format(FILE* fp) break; case '\f': // form feed endTextCol(); - bol = bot = TRUE; + bol = bot = true; break; case '\n': // line break if (bol) @@ -774,7 +774,7 @@ TextFmt::format(FILE* fp) break; } closeStrings("O\n"); // do overstriking - bot = TRUE; // start new string + bot = true; // start new string break; default: TextCoord hm; @@ -816,16 +816,16 @@ TextFmt::format(FILE* fp) endTextLine(); } if (bol) - beginLine(), bol = FALSE; + beginLine(), bol = false; if (c == '\t') { // close open PS string and do motion if (hm > 0) { closeStrings("LN"); - bot = TRUE; // force new string + bot = true; // force new string hrMove(hm); } } else { // append to open PS string if (bot) - beginText(), bot = FALSE; + beginText(), bot = false; if (040 <= c && c <= 0176) { if (c == '(' || c == ')' || c == '\\') fputc('\\',tf); @@ -850,7 +850,7 @@ TextFmt::format(const char* cp, u_int cc) break; case '\f': // form feed endTextCol(); - bol = bot = TRUE; + bol = bot = true; break; case '\n': // line break if (bol) @@ -864,7 +864,7 @@ TextFmt::format(const char* cp, u_int cc) break; // collapse \r\n => \n cp++; // count character closeStrings("O\n"); // do overstriking - bot = TRUE; // start new string + bot = true; // start new string break; default: TextCoord hm; @@ -906,16 +906,16 @@ TextFmt::format(const char* cp, u_int cc) endTextLine(); } if (bol) - beginLine(), bol = FALSE; + beginLine(), bol = false; if (c == '\t') { // close open PS string and do motion if (hm > 0) { closeStrings("LN"); fprintf(tf, " %ld M ", hm); - bot = TRUE; // force new string + bot = true; // force new string } } else { // append to open PS string if (bot) - beginText(), bot = FALSE; + beginText(), bot = false; if (040 <= c && c <= 0176) { if (c == '(' || c == ')' || c == '\\') fputc('\\',tf); @@ -981,7 +981,7 @@ TextFmt::endTextLine(void) if ((y -= lineHeight) < bm) endCol(); xoff = col_width * (column-1); - bol = bot = TRUE; + bol = bot = true; } void @@ -1048,12 +1048,12 @@ TextFmt::inch(const char* s) void TextFmt::setupConfig() { - gaudy = FALSE; // emit gaudy headers - landscape = FALSE; // horizontal landscape mode output - useISO8859 = TRUE; // use the ISO 8859-1 character encoding - reverse = FALSE; // page reversal flag - wrapLines = TRUE; // wrap/truncate lines - headers = TRUE; // emit page headers + gaudy = false; // emit gaudy headers + landscape = false; // horizontal landscape mode output + useISO8859 = true; // use the ISO 8859-1 character encoding + reverse = false; // page reversal flag + wrapLines = true; // wrap/truncate lines + headers = true; // emit page headers pointSize = -1; // font point size in big points lm = inch("0.25in"); // left margin @@ -1080,7 +1080,7 @@ void TextFmt::configTrace(const char* ...) {} #undef streq #define streq(a,b) (strcasecmp(a,b)==0) -fxBool +bool TextFmt::setConfigItem(const char* tag, const char* value) { if (streq(tag, "columns")) @@ -1120,8 +1120,8 @@ TextFmt::setConfigItem(const char* tag, const char* value) else if (streq(tag, "fontpath")) setFontPath(value); else - return (FALSE); - return (TRUE); + return (false); + return (true); } #define NCHARS (sizeof (widths) / sizeof (widths[0])) @@ -1138,7 +1138,7 @@ TextFont::TextFont(const char* cp) : family(cp) } TextFont::~TextFont() {} -fxBool +bool TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg) { struct stat junk; @@ -1213,7 +1213,7 @@ TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg) fpath.remove(0, index2); if (fpath.length() > 0) fpath.remove(0, 1); } - fxBool result = stat(filename, &junk) ? FALSE : TRUE; + bool result = stat(filename, &junk) ? false : true; if (!result) emsg = fxStr::format( "Warning: %s invalid Fontmap entry - no filename present", (const char*)val); @@ -1233,15 +1233,15 @@ TextFont::decodeFontName(const char* name, fxStr& filename, fxStr& emsg) filename = path.head(index) | "/" | name | ".afm"; path.remove(0, index); if (path.length() > 0) path.remove(0, 1); - if (stat(filename, &junk) == 0) return TRUE; + if (stat(filename, &junk) == 0) return true; filename.resize(filename.length()-4); // strip ``.afm'' - if (stat(filename, &junk) == 0) return TRUE; + if (stat(filename, &junk) == 0) return true; index = path.next(0, ':'); } - return FALSE; + return false; } -fxBool +bool TextFont::findFont(const char* name) { fxStr myname, emsg; @@ -1259,7 +1259,7 @@ static const char* defRegularFont = "\ "; void -TextFont::defFont(FILE* fd, TextCoord ps, fxBool useISO8859) const +TextFont::defFont(FILE* fd, TextCoord ps, bool useISO8859) const { if (useISO8859) { fprintf(fd, defISOFont, (const char*) setproc, @@ -1321,21 +1321,21 @@ TextFont::loadFixedMetrics(TextCoord w) widths[i] = w; } -fxBool +bool TextFont::getAFMLine(FILE* fp, char* buf, int bsize) { if (fgets(buf, bsize, fp) == NULL) - return (FALSE); + return (false); char* cp = strchr(buf, '\n'); if (cp == NULL) { // line too long, skip it int c; while ((c = getc(fp)) != '\n') // skip to end of line if (c == EOF) - return (FALSE); + return (false); cp = buf; // force line to be skipped } *cp = '\0'; - return (TRUE); + return (true); } FILE* @@ -1349,8 +1349,8 @@ TextFont::openAFMFile(fxStr& fontpath) return Sys::fopen(fontpath, "r"); } -fxBool -TextFont::readMetrics(TextCoord ps, fxBool useISO8859, fxStr& emsg) +bool +TextFont::readMetrics(TextCoord ps, bool useISO8859, fxStr& emsg) { fxStr file; FILE *fp = openAFMFile(file); @@ -1359,7 +1359,7 @@ TextFont::readMetrics(TextCoord ps, fxBool useISO8859, fxStr& emsg) "%s: Can not open font metrics file; using fixed widths", (const char*) file); loadFixedMetrics(625*ps/1000L); // NB: use fixed width metrics - return (FALSE); + return (false); } /* * Since many ISO-encoded fonts don't include metrics for @@ -1383,7 +1383,7 @@ TextFont::readMetrics(TextCoord ps, fxBool useISO8859, fxStr& emsg) * (I don't know if this does or does not cause any problem.) */ loadFixedMetrics(625*ps/1000L); // NB: use fixed width metrics - return (FALSE); + return (false); } lineno++; } while (strncmp(buf, "StartCharMetrics", 16)); @@ -1395,7 +1395,7 @@ TextFont::readMetrics(TextCoord ps, fxBool useISO8859, fxStr& emsg) emsg = fxStr::format("%s, line %u: format error", (const char*) file, lineno); fclose(fp); - return (FALSE); + return (false); } if (ix == -1) // end of unencoded glyphs break; @@ -1413,5 +1413,5 @@ TextFont::readMetrics(TextCoord ps, fxBool useISO8859, fxStr& emsg) widths[ix] = w*ps/1000L; } fclose(fp); - return (TRUE); + return (true); } diff --git a/util/TextFmt.h b/util/TextFmt.h index 191afed9..3e58548e 100644 --- a/util/TextFmt.h +++ b/util/TextFmt.h @@ -49,15 +49,15 @@ private: void loadFixedMetrics(TextCoord w); FILE* openAFMFile(fxStr& pathname); - fxBool getAFMLine(FILE* fp, char* buf, int bsize); - static fxBool decodeFontName(const char*, fxStr&, fxStr&); + bool getAFMLine(FILE* fp, char* buf, int bsize); + static bool decodeFontName(const char*, fxStr&, fxStr&); public: TextFont(const char*); ~TextFont(); - static fxBool findFont(const char* name); + static bool findFont(const char* name); - void defFont(FILE*, TextCoord pointSize, fxBool useISO8859) const; + void defFont(FILE*, TextCoord pointSize, bool useISO8859) const; void setfont(FILE*) const; TextCoord show(FILE*, const char*, int len) const; TextCoord show(FILE*, const fxStr&) const; @@ -66,7 +66,7 @@ public: const char* getFamily(void) const; - fxBool readMetrics(TextCoord pointsize, fxBool useISO8859, fxStr& emsg); + bool readMetrics(TextCoord pointsize, bool useISO8859, fxStr& emsg); }; /* * we have to use unsigned const char @@ -88,13 +88,13 @@ public: REVERSE }; private: - fxBool gaudy; // emit gaudy headers - fxBool landscape; // horizontal landscape mode output - fxBool useISO8859; // use the ISO 8859-1 character encoding - fxBool reverse; // page reversal flag - fxBool wrapLines; // wrap/truncate lines - fxBool headers; // emit page headers - fxBool workStarted; // formatting work begun + bool gaudy; // emit gaudy headers + bool landscape; // horizontal landscape mode output + bool useISO8859; // use the ISO 8859-1 character encoding + bool reverse; // page reversal flag + bool wrapLines; // wrap/truncate lines + bool headers; // emit page headers + bool workStarted; // formatting work begun FILE* output; // output file stream FILE* tf; // temporary output file OfftArray* pageOff; // page offset table @@ -112,10 +112,10 @@ private: TextCoord lm, rm; // left, right margins in local coordinates TextCoord tm, bm; // top, bottom margin in local coordinates TextCoord lineHeight; // inter-line spacing - fxBool boc; // at beginning of a column - fxBool bop; // at beginning of a page - fxBool bol; // at beginning of a line - fxBool bot; // at beginning of a text string + bool boc; // at beginning of a column + bool bop; // at beginning of a page + bool bol; // at beginning of a line + bool bot; // at beginning of a text string int numcol; // number of text columns int column; // current text column # (1..numcol) TextCoord col_margin; // inter-column margin @@ -145,7 +145,7 @@ protected: virtual void fatal(const char* fmt ...) const; virtual void setupConfig(void); - virtual fxBool setConfigItem(const char* tag, const char* value); + virtual bool setConfigItem(const char* tag, const char* value); virtual void configError(const char* fmt ...); virtual void configTrace(const char* fmt ...); public: @@ -157,21 +157,21 @@ public: static TextCoord inch(const char*); void setNumberOfColumns(u_int n); - void setPageHeaders(fxBool); - fxBool getPageHeaders(void) const; - void setLineWrapping(fxBool); - fxBool getLineWrapping(void) const; - void setISO8859(fxBool); - fxBool getISO8859(void) const; - fxBool setTextFont(const char* fontName); - void setGaudyHeaders(fxBool); - fxBool setPageMargins(const char*); + void setPageHeaders(bool); + bool getPageHeaders(void) const; + void setLineWrapping(bool); + bool getLineWrapping(void) const; + void setISO8859(bool); + bool getISO8859(void) const; + bool setTextFont(const char* fontName); + void setGaudyHeaders(bool); + bool setPageMargins(const char*); void setPageMargins(TextCoord l, TextCoord r, TextCoord b, TextCoord t); void setOutlineMargin(TextCoord); void setTextPointSize(TextCoord); TextCoord getTextPointSize(void) const; void setPageOrientation(u_int); - fxBool setPageSize(const char*); + bool setPageSize(const char*); void setPageWidth(float); void setPageHeight(float); void setPageCollation(u_int); @@ -221,13 +221,13 @@ public: void reserveVSpace(TextCoord); }; -inline fxBool TextFmt::getLineWrapping(void) const { return wrapLines; } -inline fxBool TextFmt::getPageHeaders(void) const { return headers; } +inline bool TextFmt::getLineWrapping(void) const { return wrapLines; } +inline bool TextFmt::getPageHeaders(void) const { return headers; } inline TextCoord TextFmt::getTextPointSize(void) const { return pointSize; } inline TextCoord TextFmt::getXOff(void) const { return xoff; } inline TextCoord TextFmt::getRHS(void) const { return right_x; } inline TextCoord TextFmt::getTextLineHeight(void) const { return lineHeight; } -inline fxBool TextFmt::getISO8859(void) const { return useISO8859; } +inline bool TextFmt::getISO8859(void) const { return useISO8859; } inline const TextFont* TextFmt::getFont(void) const { return curFont; } inline FILE* TextFmt::getOutputFile(void) { return tf; } #endif /* _TextFmt_ */ diff --git a/util/Timeout.c++ b/util/Timeout.c++ index fdcde092..44f6084e 100644 --- a/util/Timeout.c++ +++ b/util/Timeout.c++ @@ -28,7 +28,7 @@ #include #include "Timeout.h" -fxBool Timeout::timerExpired = FALSE; +bool Timeout::timerExpired = false; Timeout::Timeout() {} Timeout::~Timeout() {} @@ -37,7 +37,7 @@ void Timeout::traceTimer(const char* ...) {} void Timeout::sigAlarm(int) { - Timeout::timerExpired = TRUE; + Timeout::timerExpired = true; } #ifndef SA_INTERRUPT @@ -47,7 +47,7 @@ Timeout::sigAlarm(int) void Timeout::startTimeout(long ms) { - timerExpired = FALSE; + timerExpired = false; #ifdef SV_INTERRUPT /* BSD-style */ static struct sigvec sv; sv.sv_handler = fxSIGVECHANDLER(Timeout::sigAlarm); diff --git a/util/Timeout.h b/util/Timeout.h index 5a4bb737..ba237d35 100644 --- a/util/Timeout.h +++ b/util/Timeout.h @@ -32,7 +32,7 @@ */ class Timeout { private: - static fxBool timerExpired; + static bool timerExpired; static void sigAlarm(int); protected: virtual void traceTimer(const char* fmt ...); @@ -43,6 +43,6 @@ public: void startTimeout(long ms); void stopTimeout(); - fxBool wasTimeout() const { return Timeout::timerExpired; } + bool wasTimeout() const { return Timeout::timerExpired; } }; #endif /* _Timeout_ */ diff --git a/util/Transport.c++ b/util/Transport.c++ index 0a600618..5c6f7edb 100644 --- a/util/Transport.c++ +++ b/util/Transport.c++ @@ -34,7 +34,7 @@ Transport::Transport(FaxClient& c) : client(c) {} Transport::~Transport() {} -fxBool Transport::hangupServer() { return (TRUE); } +bool Transport::hangupServer() { return (true); } void Transport::closeDataConn(int fd) @@ -65,16 +65,16 @@ Transport::getTransport(FaxClient& client, const char* address) } } -fxBool +bool Transport::abortCmd(fxStr& emsg) { static const char msg[] = { 'A', 'B', 'O', 'R', '\r', '\n' }; int s = fileno(client.getCtrlFd()); if (Sys::write(s, msg, sizeof (msg)) != sizeof (msg)) { emsg = fxStr::format("send(ABOR\\r\\n): %s", strerror(errno)); - return (FALSE); + return (false); } - return (TRUE); + return (true); } void diff --git a/util/Transport.h b/util/Transport.h index de7dc2fe..56d535cb 100644 --- a/util/Transport.h +++ b/util/Transport.h @@ -43,12 +43,12 @@ public: static Transport& getTransport(FaxClient&, const char* address); - virtual fxBool callServer(fxStr& emsg) = 0; - virtual fxBool hangupServer(void); - virtual fxBool abortCmd(fxStr& emsg); + virtual bool callServer(fxStr& emsg) = 0; + virtual bool hangupServer(void); + virtual bool abortCmd(fxStr& emsg); - virtual fxBool initDataConn(fxStr& emsg) = 0; - virtual fxBool openDataConn(fxStr& emsg) = 0; + virtual bool initDataConn(fxStr& emsg) = 0; + virtual bool openDataConn(fxStr& emsg) = 0; virtual void closeDataConn(int); }; #endif /* _Transport_ */ diff --git a/util/TypeRules.c++ b/util/TypeRules.c++ index 8f1c5bdc..8d47c68e 100644 --- a/util/TypeRules.c++ +++ b/util/TypeRules.c++ @@ -56,8 +56,8 @@ static const char* opNames[] = { "", "=", "!=", "<", "<=", ">", ">=", "&", "^", "!" }; static const char* resultNames[] = { "tiff", "postscript", "error" }; -fxBool -TypeRule::match(const void* data, u_int size, fxBool verbose) const +bool +TypeRule::match(const void* data, u_int size, bool verbose) const { if (verbose) { printf("rule: %soffset %#lx %s %s", @@ -79,9 +79,9 @@ TypeRule::match(const void* data, u_int size, fxBool verbose) const if (off > size) { if (verbose) printf("failed (offset past data)\n"); - return (FALSE); + return (false); } - fxBool ok = FALSE; + bool ok = false; u_long v = 0; const u_char* cp = (const u_char*) data; switch (type) { @@ -91,9 +91,9 @@ TypeRule::match(const void* data, u_int size, fxBool verbose) const if (!isprint(cp[i]) && !isspace(cp[i])) { if (verbose) printf("failed (unprintable char %#x)\n", cp[i]); - return (FALSE); + return (false); } - ok = TRUE; + ok = true; goto done; case STRING: ok = (strncmp((const char*)(cp+off), value.s, @@ -114,7 +114,7 @@ TypeRule::match(const void* data, u_int size, fxBool verbose) const } if (verbose) printf("failed (insufficient data)\n"); - return (FALSE); + return (false); case LONG: if (off + 4 < size) { memcpy(&v, cp+off, 4); @@ -123,13 +123,13 @@ TypeRule::match(const void* data, u_int size, fxBool verbose) const } if (verbose) printf("failed (insufficient data)\n"); - return (FALSE); + return (false); } /* * Numeric value, use operation. */ switch (op) { - case ANY: ok = TRUE; break; + case ANY: ok = true; break; case EQ: ok = (v == value.v); break; case NE: ok = (v != value.v); break; case LT: ok = (v < value.v); break; @@ -211,7 +211,7 @@ fxIMPLEMENT_ObjArray(TypeRuleArray, TypeRule) TypeRules::TypeRules() { - verbose = FALSE; + verbose = false; rules = new TypeRuleArray; } @@ -221,14 +221,14 @@ TypeRules::~TypeRules() } void -TypeRules::setVerbose(fxBool b) +TypeRules::setVerbose(bool b) { verbose = b; } #include -static fxBool +static bool appendLine(fxStr& s, const char* line) { const char* cp = line; @@ -243,14 +243,14 @@ appendLine(fxStr& s, const char* line) if (cp[-1] == '\\') { if (*cp == '\n') { // continue cmd string on next line s.append(cmd, cp-1 - cmd); - return (TRUE); + return (true); } else if (*cp) // accept anything but \\0 cp++; } } while (*cp != '\0' && *cp != '\n' && *cp != '#'); s.append(fxStr(cmd, cp-cmd)); } - return (FALSE); + return (false); } #include @@ -286,10 +286,10 @@ TypeRules::read(const fxStr& file) continue; TypeRule rule; if (*cp == '>') { // continuation - rule.cont = TRUE; + rule.cont = true; cp++; } else - rule.cont = FALSE; + rule.cont = false; const char *op = cp; rule.off = strtoul(op, &cp, 0); // file offset if (cp == op) { @@ -387,7 +387,7 @@ TypeRules::read(const fxStr& file) cp++; const char* cmd = cp; // collect cmd string if (*cp != '\0' && *cp != '\n' && *cp != '#') { - fxBool done = FALSE; // XXX workaround compiler limitation + bool done = false; // XXX workaround compiler limitation do { cp++; if (cp[-1] == '\\') { @@ -396,7 +396,7 @@ TypeRules::read(const fxStr& file) while (fgets(line, sizeof (line), fp) != NULL && appendLine(rule.cmd, line)) ; - done = TRUE; + done = true; } else if (*cp) // accept anything but \\0 cp++; } @@ -414,7 +414,7 @@ TypeRules::read(const fxStr& file) * Check secondary matching rules after a primary match. */ u_int -TypeRules::match2(u_int base, const void* data, u_int size, fxBool verb) const +TypeRules::match2(u_int base, const void* data, u_int size, bool verb) const { for (u_int i = 1, n = (*rules).length() - base; i < n; i++) { TypeRule& rule = (*rules)[base+i]; diff --git a/util/TypeRules.h b/util/TypeRules.h index 64aeaf04..1983b88f 100644 --- a/util/TypeRules.h +++ b/util/TypeRules.h @@ -98,14 +98,14 @@ public: static TypeRules* read(const fxStr& file); // read rule database - void setVerbose(fxBool); + void setVerbose(bool); const TypeRule* match(const void* data, u_int size) const; private: TypeRuleArray* rules; - fxBool verbose; // while matching + bool verbose; // while matching - u_int match2(u_int base, const void* data, u_int size, fxBool verb) const; + u_int match2(u_int base, const void* data, u_int size, bool verb) const; }; typedef unsigned int TypeResult; // conversion result @@ -127,7 +127,7 @@ public: }; private: off_t off; // byte offset in file - fxBool cont; // continuation + bool cont; // continuation enum { ASCII, // ascii-only string STRING, // byte string @@ -161,8 +161,8 @@ public: TypeRule(const TypeRule& other); virtual ~TypeRule(); - fxBool match(const void*, u_int size, fxBool verbose = FALSE) const; - fxBool isContinuation() const; + bool match(const void*, u_int size, bool verbose = false) const; + bool isContinuation() const; TypeResult getResult() const; const fxStr& getCmd() const; @@ -172,7 +172,7 @@ public: const fxStr& df, const fxStr& pname) const; }; -inline fxBool TypeRule::isContinuation() const { return cont; } +inline bool TypeRule::isContinuation() const { return cont; } inline TypeResult TypeRule::getResult() const { return result; } inline const fxStr& TypeRule::getCmd() const { return cmd; } inline fxStr TypeRule::getErrMsg() const { return cmd; } diff --git a/util/Types.h b/util/Types.h index c76b025a..5bc94ec8 100644 --- a/util/Types.h +++ b/util/Types.h @@ -33,13 +33,6 @@ #include "sys/types.h" #include "port.h" -// Boolean type -typedef unsigned char fxBool; -#undef TRUE -#define TRUE ((fxBool)1) -#undef FALSE -#define FALSE ((fxBool)0) - // minimum of two numbers inline int fxmin(int a, int b) { return (a < b) ? a : b; } inline u_long fxmin(u_long a, u_long b) { return (a < b) ? a : b; } diff --git a/util/UnixTransport.c++ b/util/UnixTransport.c++ index 9198ccb0..26ae4d14 100644 --- a/util/UnixTransport.c++ +++ b/util/UnixTransport.c++ @@ -31,7 +31,7 @@ UnixTransport::UnixTransport(FaxClient& c) : Transport(c) {} UnixTransport::~UnixTransport() {} -fxBool +bool UnixTransport::isA(const char* address) { return Sys::isSocketFile(address); @@ -44,13 +44,13 @@ extern "C" { #include } -fxBool +bool UnixTransport::callServer(fxStr& emsg) { int fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { emsg = "Can not create socket to connect to server."; - return (FALSE); + return (false); } struct sockaddr_un Sun; memset(&Sun, 0, sizeof (Sun)); @@ -61,16 +61,16 @@ UnixTransport::callServer(fxStr& emsg) (const char*) client.getHost()); if (Socket::connect(fd, &Sun, sizeof (Sun)) >= 0) { client.setCtrlFds(fd, dup(fd)); - return (TRUE); + return (true); } else { emsg = fxStr::format("Can not reach server at Unix domain socket \"%s\".", (const char*) client.getHost()); Sys::close(fd), fd = -1; - return (FALSE); + return (false); } } -fxBool +bool UnixTransport::initDataConn(fxStr&) { #ifdef notdef @@ -78,13 +78,13 @@ UnixTransport::initDataConn(fxStr&) Socket::socklen_t dlen = sizeof (data_addr); if (Socket::getsockname(fileno(client.getCtrlFd()), &data_addr, &dlen) < 0) { emsg = fxStr::format("getsockname(ctrl): %s", strerror(errno)); - return (FALSE); + return (false); } data_addr.sin_port = 0; // let system allocate port fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) { emsg = fxStr::format("socket: %s", strerror(errno)); - return (FALSE); + return (false); } if (Socket::bind(fd, &data_addr, sizeof (data_addr)) < 0) { emsg = fxStr::format("bind: %s", strerror(errno)); @@ -105,37 +105,37 @@ UnixTransport::initDataConn(fxStr&) if (client.command("PORT %u,%u,%u,%u,%u,%u", UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]), UC(p[0]), UC(p[1])) != COMPLETE) - return (FALSE); + return (false); #undef UC client.setDataFd(fd); - return (TRUE); + return (true); bad: Sys::close(fd), fd = -1; #endif - return (FALSE); + return (false); } -fxBool +bool UnixTransport::openDataConn(fxStr&) { #ifdef notdef int s = Socket::accept(fileno(client.getDataFd()), NULL, NULL); if (s >= 0) { client.setDataFd(s); - return (TRUE); + return (true); } else { emsg = fxStr::format("accept: %s", strerror(errno)); - return (FALSE); + return (false); } #else - return (FALSE); + return (false); #endif } #else -fxBool UnixTransport::callServer(fxStr& emsg) - { notConfigured("Unix domain", emsg); return (FALSE); } -fxBool UnixTransport::initDataConn(fxStr& emsg) - { notConfigured("Unix domain", emsg); return (FALSE); } -fxBool UnixTransport::openDataConn(fxStr& emsg) - { notConfigured("Unix domain", emsg); return (FALSE); } +bool UnixTransport::callServer(fxStr& emsg) + { notConfigured("Unix domain", emsg); return (false); } +bool UnixTransport::initDataConn(fxStr& emsg) + { notConfigured("Unix domain", emsg); return (false); } +bool UnixTransport::openDataConn(fxStr& emsg) + { notConfigured("Unix domain", emsg); return (false); } #endif diff --git a/util/UnixTransport.h b/util/UnixTransport.h index 9a48a5c7..1994e0de 100644 --- a/util/UnixTransport.h +++ b/util/UnixTransport.h @@ -35,11 +35,11 @@ public: UnixTransport(FaxClient&); ~UnixTransport(); - static fxBool isA(const char*); + static bool isA(const char*); - fxBool callServer(fxStr& emsg); + bool callServer(fxStr& emsg); - fxBool initDataConn(fxStr& emsg); - fxBool openDataConn(fxStr& emsg); + bool initDataConn(fxStr& emsg); + bool openDataConn(fxStr& emsg); }; #endif /* _UnixTransport_ */ diff --git a/util/dialtest.c++ b/util/dialtest.c++ index c20a6dbb..f3fbb8ef 100644 --- a/util/dialtest.c++ +++ b/util/dialtest.c++ @@ -65,7 +65,7 @@ main(int argc, char* argv[]) char* countryCode = "1"; char* internationalPrefix = "011"; char* longDistancePrefix = "1"; - fxBool verbose = FALSE; + bool verbose = false; extern int optind, opterr; extern char* optarg; int c; @@ -86,7 +86,7 @@ main(int argc, char* argv[]) longDistancePrefix = optarg; break; case 'v': - verbose = TRUE; + verbose = true; break; case '?': usage(); @@ -95,7 +95,7 @@ main(int argc, char* argv[]) if (argc - optind != 1) usage(); DialStringRules rules(argv[optind]); - rules.setVerbose(TRUE); + rules.setVerbose(true); rules.def("AreaCode", areaCode); rules.def("CountryCode", countryCode); rules.def("InternationalPrefix", internationalPrefix); diff --git a/util/faxfetch.c++ b/util/faxfetch.c++ index 7a977563..4e9934b9 100644 --- a/util/faxfetch.c++ +++ b/util/faxfetch.c++ @@ -39,11 +39,11 @@ public: faxFetchApp::faxFetchApp() {} faxFetchApp::~faxFetchApp() {} -static fxBool +static bool writeStdout(void*, const char* buf, int cc, fxStr&) { (void) Sys::write(STDOUT_FILENO, buf, cc); - return (TRUE); + return (true); } void @@ -77,7 +77,7 @@ faxFetchApp::run(int argc, char** argv) mode = MODE_S; break; case 'v': // enable protocol tracing - setVerbose(TRUE); + setVerbose(true); break; case 'z': mode = MODE_Z; diff --git a/util/faxinfo.c++ b/util/faxinfo.c++ index 4c1455de..25f555d3 100644 --- a/util/faxinfo.c++ +++ b/util/faxinfo.c++ @@ -39,21 +39,21 @@ extern const char* fmtTime(time_t t); -static fxBool +static bool isFAXImage(TIFF* tif) { uint16 w; if (TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &w) && w != 1) - return (FALSE); + return (false); if (TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &w) && w != 1) - return (FALSE); + return (false); if (!TIFFGetField(tif, TIFFTAG_COMPRESSION, &w) || (w != COMPRESSION_CCITTFAX3 && w != COMPRESSION_CCITTFAX4)) - return (FALSE); + return (false); if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &w) || (w != PHOTOMETRIC_MINISWHITE && w != PHOTOMETRIC_MINISBLACK)) - return (FALSE); - return (TRUE); + return (false); + return (true); } static void @@ -67,11 +67,11 @@ sanitize(fxStr& s) int main(int argc, char** argv) { - fxBool showFilename = TRUE; + bool showFilename = true; const char* appName = argv[0]; if (argc > 2 && streq(argv[1], "-n")) { - showFilename = FALSE; + showFilename = false; argc--, argv++; } if (argc != 2) { @@ -87,7 +87,7 @@ main(int argc, char** argv) printf("Could not open %s; either not TIFF or corrupted.\n", argv[1]); return (0); } - fxBool ok = isFAXImage(tif); + bool ok = isFAXImage(tif); if (!ok) { printf("Does not look like a facsimile?\n"); return (0); diff --git a/util/faxwatch.c++ b/util/faxwatch.c++ index 4d7ada48..ca789edf 100644 --- a/util/faxwatch.c++ +++ b/util/faxwatch.c++ @@ -45,14 +45,14 @@ public: watchApp::watchApp() {} watchApp::~watchApp() {} -static fxBool +static bool writeData(void* arg, const char* buf, int cc, fxStr& emsg) { if (Sys::write((int) arg, buf, cc) != cc) { emsg = fxStr::format("write error: %s", strerror(errno)); - return (FALSE); + return (false); } else - return (TRUE); + return (true); } void @@ -83,7 +83,7 @@ watchApp::run(int argc, char** argv) break; case 'v': // verbose mode setvbuf(stdout, NULL, _IOLBF, BUFSIZ); - FaxClient::setVerbose(TRUE);// protocol tracing + FaxClient::setVerbose(true);// protocol tracing break; case '?': usage(); diff --git a/util/textfmt.c++ b/util/textfmt.c++ index 99214d9a..add3cb9f 100644 --- a/util/textfmt.c++ +++ b/util/textfmt.c++ @@ -95,13 +95,13 @@ main(int argc, char* argv[]) fmt.setNumberOfColumns(c - '0'); break; case 'B': - fmt.setPageHeaders(FALSE); + fmt.setPageHeaders(false); break; case 'c': // clip/cut instead of wrapping lines - fmt.setLineWrapping(FALSE); + fmt.setLineWrapping(false); break; case 'D': // don't use ISO 8859-1 encoding - fmt.setISO8859(FALSE); + fmt.setISO8859(false); break; case 'f': // body font if (!fmt.setTextFont(optarg)) { @@ -115,7 +115,7 @@ main(int argc, char* argv[]) fmt.setFontPath(optarg); break; case 'G': // gaudy mode - fmt.setGaudyHeaders(TRUE); + fmt.setGaudyHeaders(true); break; case 'm': // multi-column output fmt.setNumberOfColumns(atoi(optarg)); diff --git a/util/typetest.c++ b/util/typetest.c++ index c8f82d3e..f832bc44 100644 --- a/util/typetest.c++ +++ b/util/typetest.c++ @@ -117,7 +117,7 @@ main(int argc, char* argv[]) fprintf(stderr, "Unable to setup file typing and conversion rules\n"); return (-1); } - typeRules->setVerbose(TRUE); + typeRules->setVerbose(true); for (; optind < argc; optind++) (void) fileType(argv[optind]); return (0);