tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: sh(1) read: add LINE_MAX safeguard and "-n" option
    Date:        Tue, 24 Sep 2024 17:30:42 +0200
    From:        tlaronde%kergis.com@localhost
    Message-ID:  <ZvLbItYTlanIgVgV%kergis.com@localhost>
  | In the present code, a delimiter can not be "any character": because
  | if the delimiter is the backslash, what shall be the behavior?
That isn't even a half an issue ... the read reads characters until
the delimiter is encountered, then discards that, and processes the
line/record/whatever you want to call it, as directed - which includes
(assuming -r wasn't given) looking for (and eventually removing) escape
chars ... in this case it is unlikely to find any!   (But that's OK).
  | Since backslash is defined to be the escape character, it can not be
  | used as a delimiter, unless specifying that all backslashes have to
  | be escaped to be accepted as end delimiter... But how to specify a
  | continuation line then?
It isn't possible.   Actually using \ as the delimiter (without
-r anyway) makes little sense at all, but that doesn't mean it
needs to be prohibited.
  | Furthermore the continuation test on:
	[...]
  | seems wrong. Shouldn't it be?:
	[...]
Yes, probably - use of -d without -r is kind of rare I suspect (in
fact actually using read at all without -r is not all that common, or
not in correct code).
I will fix it along with other things - thanks.
kre
Home |
Main Index |
Thread Index |
Old Index