[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

`var' buglets



Quoting the manual:

	var var ...

	Prints definitions of the named variables, suitable for being
	used as input to the shell.

But that is not very reliable:

	; x=\201
	; var x
	x = \-177

Apparently, some code in there assumes that the `char' type is
unsigned?

On the other hand,

	; x=\201^4
	; var x
	x = '#4'

where I have taken the liberty of replacing the single \201 character
with `#', since 8-bit characters may not survive the mail.  This is
perhaps correct, but not consistent with the previous result.
Ideally, the output should perhaps be

	x = \201^4

(since \2014 would be parsed as a single character)?  Admittedly, this
will somewhat increase the complexity of the formatting routines.

I also find the behaviour of `var' with respect to control characters
lacking.  I think they should all be represented by escape sequences
\a \b \f etc., and numerical escapes when a single letter escape is
insufficient.  (The way I understand 8-bit character sets the
characters \200 .. \237 are classified as control sequences, and ought
to be escaped as well(?))

- Harald