faxd/Class2.c++
/*
 * Given a hangup code from a modem return a
 * descriptive string.  We use strings here to
 * avoid having to know what type of modem we're
 * talking to (Rev A or Rev B or SP-2388).  This
 * works right now becase the codes don't overlap
 * (as strings).  Hopefully this'll continue to
 * be true.
 */
Given a hangup code from a modem return a
descriptive string.  We use strings here to
avoid having to know what type of modem we're
talking to (Rev A or Rev B or SP-2388).  This
works right now becase the codes don't overlap
(as strings).  Hopefully this'll continue to
be true.
Given a hangup code from a modem return a descriptive string . We use strings here to avoid having to know what type of modem we ' re talking to ( Rev A or Rev B or SP - 2388 ) . This works right now becase the codes don ' t overlap ( as strings ) . Hopefully this ' ll continue to be true .
const char*
Class2Modem::hangupCause(const char* code, bool codetocode)
{
    for (u_int i = 0; i < NCODES; i++) {
	const HangupCode& c = hangupCodes[i];
	if ((c.code[1] != NULL && strcasecmp(code, c.code[1]) == 0) ||
	    (c.code[2] != NULL && strcasecmp(code, c.code[2]) == 0)) {
	    if (codetocode) {
		return (c.code[3]);
	    } else {
		return (c.message);
	    }
	}
    }
    if (codetocode) return ("E210");
    return ("Unknown hangup code");
}
const char * Class2Modem :: hangupCause ( const char * code , bool codetocode ) { for ( u_int i = 0 ; i < NCODES ; i ++ ) { const HangupCode & c = hangupCodes [ i ] ; if ( ( c . code [ 1 ] != NULL && strcasecmp ( code , c . code [ 1 ] ) == 0 ) || ( c . code [ 2 ] != NULL && strcasecmp ( code , c . code [ 2 ] ) == 0 ) ) { if ( codetocode ) { return ( c . code [ 3 ] ) ; } else { return ( c . message ) ; } } } if ( codetocode ) return ( " " ) ; return ( " " ) ; }
Given a hangup code from a modem return a
 descriptive string.
Given a hangup code from a modem return a descriptive string .