/****************************************************************** * * Description: Demonstrate the C bitwise operators. * * Author: M.J. Leslie * Date: 18-Feb-96 * * Syntax: * * Bugs: * * Notes: Compile and place in cgi-bin * * History: * Ver Date Comments * --- ---- -------- * 1.0 18-Feb-96 Initial release. * ******************************************************************/ #include #include /******************************************************************/ void ReadParms(char **Operator, char **LeftOpHex, char **RightOpHex); void DecimalToBinary(int Decimal, char **Binary); void HexToDecimal(char *Hex, long int *Decimal); void CreateForm(int LeftOpDec, char *Operator, int RightOpDec, int AnswerDec); void FormIP(int, char *, int); void FormTable (int LeftOpDec, char *Operator, int RightOpDec, int AnswerDec); void FormHeader(void); void FormFooter(void); void PerformCalc (long int Left, char *Operator, long int Right, long unsigned int *Answer); /******************************************************************/ main(int argc, char **argv) { char *Operator; char *LeftOpHex; char *RightOpHex; long int LeftOpDec = 0; long int RightOpDec = 0; long int AnswerDec; ReadParms(&Operator, &LeftOpHex, &RightOpHex); /* ... If we have parms, convert the values to decimal. */ HexToDecimal(LeftOpHex, &LeftOpDec); HexToDecimal(RightOpHex, &RightOpDec); PerformCalc (LeftOpDec, Operator, RightOpDec, &AnswerDec); CreateForm (LeftOpDec, Operator, RightOpDec, AnswerDec); } /******************************************************************/ void CreateForm(int LeftOpDec, char *Operator, int RightOpDec, int AnswerDec) { FormHeader(); FormIP(LeftOpDec, Operator, RightOpDec); FormTable( LeftOpDec, Operator, RightOpDec, AnswerDec); FormFooter(); } /******************************************************************/ void FormIP(int LeftOpDec, char *Operator, int RightOpDec) { char Options[]="