corrections for echoing the last command when "!!" is given,
[unix-history] / usr / src / contrib / ed / bang.c
index 48cbb91..d87f797 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)bang.c     5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)bang.c     5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -59,8 +59,10 @@ bang(inputt, errnum)
                        l_shellcmd[l_cnt] = '\0';
                        break;
                } else
                        l_shellcmd[l_cnt] = '\0';
                        break;
                } else
-                       if ((ss == '!') && (l_esc == 0))
+                       if ((ss == '!') && (l_esc == 0)) {
                                l_cnt = l_cnt_last_pos;
                                l_cnt = l_cnt_last_pos;
+                               printf("%s\n", l_shellcmd);
+                       }
                        else
                                if ((ss == '%') && (l_esc == 0)) {
                                        l_shellcmd[l_cnt] = '\0';
                        else
                                if ((ss == '%') && (l_esc == 0)) {
                                        l_shellcmd[l_cnt] = '\0';