home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / bugs / 4bsd / 244 next >
Encoding:
Internet Message Format  |  1993-01-21  |  3.2 KB

  1. Xref: sparky comp.bugs.4bsd:244 comp.unix.bsd:11662
  2. Newsgroups: comp.bugs.4bsd,comp.unix.bsd
  3. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!smurf.sub.org!flatlin!bad
  4. From: bad@flatlin.ka.sub.org (Christoph Badura)
  5. Subject: fix for ash's (/bin/sh) for loop parsing (NET2/386BSD)
  6. Organization: Guru Systems/Funware Department
  7. Date: Thu, 21 Jan 1993 16:55:14 GMT
  8. Message-ID: <C17r03.8up@flatlin.ka.sub.org>
  9. Summary: "for variable do" was rejected by parser
  10. Lines: 125
  11.  
  12. Subject: sh(1) bombs on "for var do ..."
  13. Index:    bin/sh/parser.c, bin/sh/sh.1
  14.  
  15. Description:
  16.     When using the
  17.          for var do
  18.          ...
  19.          done
  20.     variant of the for statement the shell complains about a
  21.     syntax error.
  22. Repeat-By:
  23.     /bin/sh
  24.     $ for foo do
  25.     Syntax error: word unexpected
  26.     $ ^D
  27. Fix:
  28.  
  29. *** parser.c,1    Tue Apr 16 02:23:22 1991
  30. --- parser.c    Thu Jan 21 00:47:55 1993
  31. ***************
  32. *** 326,331 ****
  33. --- 326,333 ----
  34.               }
  35.               *app = NULL;
  36.               n1->nfor.args = ap;
  37. +             if (lasttoken != TNL && lasttoken != TSEMI)
  38. +                 synexpect(-1);
  39.           } else {
  40.   #ifndef GDB_HACK
  41.               static const char argvars[5] = {CTLVAR, VSNORMAL|VSQUOTE,
  42. ***************
  43. *** 337,345 ****
  44.               n2->narg.backquote = NULL;
  45.               n2->narg.next = NULL;
  46.               n1->nfor.args = n2;
  47.           }
  48. -         if (lasttoken != TNL && lasttoken != TSEMI)
  49. -             synexpect(-1);
  50.           checkkwd = 2;
  51.           if ((t = readtoken()) == TDO)
  52.               t = TDONE;
  53. --- 339,346 ----
  54.               n2->narg.backquote = NULL;
  55.               n2->narg.next = NULL;
  56.               n1->nfor.args = n2;
  57. +             tokpushback++;
  58.           }
  59.           checkkwd = 2;
  60.           if ((t = readtoken()) == TDO)
  61.               t = TDONE;
  62.  
  63. And this is for the man page.
  64.  
  65. *** sh.1,1    Tue Apr 16 02:23:25 1991
  66. --- sh.1    Thu Jan 21 00:51:54 1993
  67. ***************
  68. *** 223,234 ****
  69.   .I for
  70.   command looks like
  71.   .d
  72. ! \fBfor\fR variable \fBin\fR word...
  73.   \fBdo\fR    list
  74.   \fBdone\fR
  75.   .e
  76.   The words are expanded, and then the list is executed repeatedly with
  77. ! the variable set to each word in turn.
  78.   .B do
  79.   and
  80.   .B done
  81. --- 223,236 ----
  82.   .I for
  83.   command looks like
  84.   .d
  85. ! \fBfor\fR variable [\fBin\fR word... ]
  86.   \fBdo\fR    list
  87.   \fBdone\fR
  88.   .e
  89.   The words are expanded, and then the list is executed repeatedly with
  90. ! the variable set to each word in turn. If \fBin\fR word ... is omitted
  91. ! .B in
  92. ! \&"$@" is assumed.
  93.   .B do
  94.   and
  95.   .B done
  96. ***************
  97. *** 254,260 ****
  98.   loops.
  99.   .I Continue
  100.   continues with the next iteration of the
  101. ! .IRnum'th
  102.   innermost loop.
  103.   These are implemented as builtin commands.
  104.   .PP
  105. --- 256,262 ----
  106.   loops.
  107.   .I Continue
  108.   continues with the next iteration of the
  109. ! .IR num'th
  110.   innermost loop.
  111.   These are implemented as builtin commands.
  112.   .PP
  113. ***************
  114. *** 625,631 ****
  115.   none of them has met with universal approval.  The convention used by
  116.   \fIash\fR and all the programs included in the \fIash\fR distribution is
  117.   as follows:
  118. ! .ta 1i,2i
  119.   .nf
  120.       0    Success.
  121.       1    Alternate success.
  122. --- 627,633 ----
  123.   none of them has met with universal approval.  The convention used by
  124.   \fIash\fR and all the programs included in the \fIash\fR distribution is
  125.   as follows:
  126. ! .ta 1i 2i
  127.   .nf
  128.       0    Success.
  129.       1    Alternate success.
  130.  
  131.  
  132. -- 
  133.                 Christoph Badura  ---  bad@flatlin.ka.sub.org
  134.  
  135. Personally, I don't care whether someone is cool enough to quote Doug
  136. Gwyn--I only care whether Doug Gwyn is cool enough to quote. -- Larry Wall
  137.