Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!akgua!sdcsvax!sdcrdcf!hplabs!sri-unix!mogul@su-coyote.ARPA From: mogul@su-coyote.ARPA Newsgroups: net.unix-wizards Subject: arguments to adb :r command are damaged (4.[12]BSD) Message-ID: <12536@sri-arpa.UUCP> Date: Wed, 25-Apr-84 22:03:06 EDT Article-I.D.: sri-arpa.12536 Posted: Wed Apr 25 22:03:06 1984 Date-Received: Fri, 11-May-84 08:19:14 EDT Lines: 42 From: Jeff Mogul Description: Arguments after the first supplied to the :r command of ADB have their first character dropped. (Original bug report by cmcl2!rna!dan, 30 Jan 84.) Repeat-By: % adb /bin/echo :r abc def ghi should print: abc def ghi actually prints: abc ef hi Fix: The bug is in doexec() in runpcs.c. The body of the major loop is: throws away spaces copy an argument throws away spaces the problem being that the two different sets of code for throwing away spaces are incompatible in such a way as to discard one extra character each time. My fix is to move some code out of the loop; by turning the do loop into a while loop one could get rid of a redundant test but I didn't bother. The same bug seems to lurk in the 4.1BSD version of adb; probably the same fix would work. *** runpcs.c.old Thu Aug 11 20:06:55 1983 --- runpcs.c Thu Apr 19 01:55:10 1984 *************** *** 171,173 *ap++=symfil; ! REP IF rdc()==EOR THEN break; FI *ap = p; --- 171,174 ----- *ap++=symfil; ! rdc(); ! REP IF lastc==EOR THEN break; FI *ap = p;