I prefer it to work like this: set S0,"" set IO,42 pack S0, 4, I0 ,0 length I1, S0 # is 4 pack S0, 4, I0 length I1, S0 # is 8 pack S0, 4, I0, 10000 # no segv :) length I1, S0 # is 10004
Patch is already applied. Daniel Grunblatt. On Thu, 23 May 2002, Sean O'Rourke wrote: > On Thu, 23 May 2002, Daniel Grunblatt wrote: > > > > On Wed, 22 May 2002, Sean O'Rourke wrote: > > > > > that pack() can't handle null bytes makes it a bit more complicated (and > > Exactly how do you want it to handle null bytes? > > Nevermind -- sorry 'bout that. There's a little wierdness in there, but > it isn't because of nulls -- I just spaced out reading the pack docs. > The strangeness is with the 4-argument version of pack(), which doesn't > extend its first argument if the pack destination goes past the end of the > string. So you get this: > > set S0, "" > set I0, 42 > pack S0, 4, I0, 0 > length I1, S0 # is 0 > pack S0, 4, I0 > length I1, S0 # is 4 > pack S0, 4, I0, 10000 # is segv > > which is completely unrelated to nulls, but still strange. I was thrown > off by this result when trying to use the offset version of pack. I > attached a patch that (I think) does something with less startle value. > > /s >