Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Possible bug in cut(1)

14 views
Skip to first unread message

Daniel R. Levy

unread,
Nov 16, 1985, 1:24:39 AM11/16/85
to
Situation: bug in cut(1)

Description:

When an attempt was made to port cut(1) onto a non-usg system,
(in this case, Eunice under VMS 4.1) a problem showed up. Some-
times an error message

"bad list for c/f option"

would appear for no good reason, when the options were all valid.
The problem is mentioned here because the cause could theoretically
bite on any system, though it seems to work OK on the usg systems
tried.

Cause and Fix:

The (automatic) variable "num" should have been initialized to
zero before first use. It was not. Therefore, it was possible
for it to begin with a nonzero value. In fact it did in the
porting attempt; it began with a value so large that cut detected
an error in the result. There is potentially a similar problem
with the variable "r" also. Lint caught both of these, as well
as pointing out that *d is declared and never used, and that
the function diagl() appears and is not used (it is functionless,
pardon the pun).

On (approx.) line 29 of cut.c,

endflag = supflag = cflag = fflag = 0;

should be changed to

r = num = endflag = supflag = cflag = fflag = 0;
--
------------------------------- Disclaimer: The views contained herein are
| dan levy | yvel nad | my own and are not at all those of my em-
| an engihacker @ | ployer or the administrator of any computer
| at&t computer systems division | upon which I may hack.
| skokie, illinois |
-------------------------------- Path: ..!ihnp4!ttrdc!levy

0 new messages