[Patch] Add command ":wn" to vi-applet

Alexander Griesser alexander.griesser at lkh-vil.or.at
Thu Mar 23 17:42:09 UTC 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't know if you want this feature in the current vi release, I think
the difference in sizes with this patch applied isn't that dramatically
and I really like :wn ;)

OLD:
   text    data     bss     dec     hex filename
  20429       4     924   21357    536d vi.o

NEW:
   text    data     bss     dec     hex filename
  20456       4     924   21384    5388 vi.o

- --- vi.c.orig   2006-03-23 18:14:49.325996107 +0100
+++ vi.c        2006-03-23 18:34:24.254374673 +0100
@@ -1086,6 +1086,7 @@
                psb("%s", vi_Version);
        } else if ((strncasecmp((char *) cmd, "write", i) == 0) ||
// write text to file
                           (strncasecmp((char *) cmd, "wq", i) == 0) ||
+                          (strncasecmp((char *) cmd, "wn", i) == 0) ||
                           (strncasecmp((char *) cmd, "x", i) == 0)) {
                // is there a file name to write to?
                if (strlen((char *) args) > 0) {
@@ -1123,7 +1124,7 @@
                                file_modified = 0;
                                last_file_modified = -1;
                        }
- -                       if ((cmd[0] == 'x' || cmd[1] == 'q') && l == ch) {
+                       if ((cmd[0] == 'x' || cmd[1] == 'q' || cmd[1] ==
'n') && l == ch) {
                                editing = 0;
                        }
                }
@@ -3434,6 +3435,7 @@
                        }
                } else if (strncasecmp((char *) p, "write", cnt) == 0 ||
                                   strncasecmp((char *) p, "wq", cnt) ==
0 ||
+                                  strncasecmp((char *) p, "wn", cnt) ==
0 ||
                                   strncasecmp((char *) p, "x", cnt) == 0) {
                        cnt = file_write(cfn, text, end - 1);
                        if (cnt < 0) {
@@ -3443,7 +3445,7 @@
                                file_modified = 0;
                                last_file_modified = -1;
                                psb("\"%s\" %dL, %dC", cfn,
count_lines(text, end - 1), cnt);
- -                               if (p[0] == 'x' || p[1] == 'q') {
+                               if (p[0] == 'x' || p[1] == 'q' || p[1]
== 'n') {
                                        editing = 0;
                                }
                        }

ciao,
- --
Alexander Griesser (Netzwerkadministration)
E-Mail: alexander.griesser at lkh-vil.or.at | Web: http://www.lkh-vil.or.at
KABEG LKH Villach | Nikolaigasse 43 | 9500 Villach
Tel.:   +43 4242 208 3061 | Fax.:   +43 4242 971 3061
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEIt3x66HVD6KUm1oRAj/BAKCX9V2vqSOYGkv/Nqv4TvtLIGBsMgCfYY+j
NMDq2kBg/lLtOLiCduVoLcI=
=KeHq
-----END PGP SIGNATURE-----



More information about the busybox mailing list