Date: 1 Apr 1997 23:36:18 +0200 From: sec@42.org (Stefan `Sec` Zehl) To: freebsd-questions@freebsd.org Subject: Re: 'GET A LIFE' doesn't work Message-ID: <slrn5k2vuh.583.sec@matrix.42.org> References: <199704010048.QAA29694@gabber.c2.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <199704010048.QAA29694@gabber.c2.net>, sameer wrote: > Why doesn't: > > echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq'|dc > > work as expected on freebsd? I traced it down a little (heavily relying on the Manpage :) it does nothing more that continually dividing the number (3135071790101768542287578439) by 256 and printing the reminders... # store letter 'q' in register a [q]sa # store command "ln0=aln256%Pln256/snlbx" in register b [ln0=aln256%Pln256/snlbx]sb # store number "3135071790101768542287578439" in register n 3135071790101768542287578439sn # load register b on stack and execute as command lbx # quit q While the command in "b" does: # load reg. a on stack, compare it with 0, if true execute reg. a (= quit) ln 0 =a # load reg. a on stack, do modulo 256 and Print this value ln 256 % P # load reg. a on stack, divide (integer) by 256 an store it in reg. n again ln 256 / sn # load reg. b on stack and execute as command (recursion) lbx So, so far for the difficult part, now why doesn't this work on FreeBSD ? it's the 'P' command of FreeBSD's dc on FreeBSD: echo '71Pq'|dc yields "71" on SunOS: echo '71Pq'|dc yields "G" from the SunOS manpage: P Interpret the top of the stack as an ASCII string, remove and print it. from the FreeBSD manpage: P Prints the value on the top of the stack, popping it off, and does not print a newline after. so they don't even claim to do the same.... The magic question is now, should this behavior be changed ? CU, Sec -- Fuer die Raupe ist es das Ende der Welt, Fuer den Rest der Welt ist es ein Schmetterling Error 0: No error
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?slrn5k2vuh.583.sec>