A handy calculator for IP addresses, subnet masks, et cetera. Some examples: dq 3com.com ## good for numericizing hostnames 192.136.32.249 dq 3com.com - 13 ## arithmetic works; note spacing 192.136.32.236 dq www.m-w.com ## '-' is part of this name 63.240.197.83 dq 0-256 ## error; looks like hostname; try '0 - 256' dq www.xerox.com Hi 13 ## high-order bits 204.64.0.0 dq www.xerox.com Lo 13 ## operators must be capitalized 0.0.30.98 dq 'Hi 24 Xor Lo 15; Swap Last, Last+1' ## Last == result of previous step 255.255.128.255 ## ';' separates results by newline 255.128.255.255 255.129.0.0 ## ',' separates results by space dq -32 / 8, -32 Rsh 3 ## Div and Mul are signed; shifts are unsigned 255.255.255.252 31.255.255.252 echo Card 1.1.1.1 | dq ## read from stdin; Card counts bits 4 dq Scalar 255.255.255.0 ## Scalar and Card print integers, -256 ## not dotted quads dq 'Scalar 0 -256, Card 0 -256, Card(0 -256)' ## Scalar binds loosely; -256 255.255.255.0 24 ## other unary operators bind tightly dq Not 7, 1.1.1.1 Not 7 ## unary Not, binary Not 255.255.255.248 1.1.1.0 Symbol: ; , () + - * / % & | ^ ~ << >> Word: Mul Div Mod And Or Xor Not Lsh Rsh Note: ! !! B UB B! B B B! B! B UB! B! B! Word: Last Hi Lo Swap Card Scalar Note: UB UB U U U where U ==> unary operator, B ==> binary infix operator. ! ==> symbol means something to the shell, so you have to quote it. All Boolean operators are bitwise. Written using bison/flex (yacc/lex) on Linux; should run on any Unix machine Download from http://www.av8n.com/computer/dq/dq.tgz