Patch from Mike Castle to cleanup some modutils issues, in
[oweals/busybox.git] / editors / vi.c
index 28eca754a2d1b156d95dd09c8c5825a90943f0c6..b1d7034d4aead72328adc2bd07ddf5e6eb8bee41 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 static const char vi_Version[] =
-       "$Id: vi.c,v 1.34 2004/03/15 08:28:32 andersen Exp $";
+       "$Id: vi.c,v 1.37 2004/07/20 06:44:46 andersen Exp $";
 
 /*
  * To compile for standalone use:
@@ -45,7 +45,7 @@ static const char vi_Version[] =
  *     An "ex" line oriented mode- maybe using "cmdedit"
  */
 
-//----  Feature --------------  Bytes to immplement
+//----  Feature --------------  Bytes to implement
 #ifdef STANDALONE
 #define vi_main                        main
 #define CONFIG_FEATURE_VI_COLON        // 4288
@@ -375,6 +375,7 @@ extern int vi_main(int argc, char **argv)
 #ifdef CONFIG_FEATURE_VI_READONLY
                case 'R':               // Read-only flag
                        readonly = TRUE;
+                       vi_readonly = TRUE;
                        break;
 #endif                                                 /* CONFIG_FEATURE_VI_READONLY */
                        //case 'r':     // recover flag-  ignore- we don't use tmp file
@@ -640,7 +641,7 @@ static Byte *get_address(Byte *p, int *b, int *e)   // get two colon addrs, if pre
        p = get_one_address(p, b);
        while (isblnk(*p))
                p++;
-       if (*p == ',') {                        // is there a address seperator
+       if (*p == ',') {                        // is there a address separator
                p++;
                while (isblnk(*p))
                        p++;
@@ -692,12 +693,13 @@ static void colon(Byte * buf)
        // :s/find/replace/ // substitute pattern "find" with "replace"
        // :!<cmd>      // run <cmd> then return
        //
+       forced = useforce = FALSE;
+
        if (strlen((char *) buf) <= 0)
                goto vc1;
        if (*buf == ':')
                buf++;                  // move past the ':'
 
-       forced = useforce = FALSE;
        li = st = ch = i = 0;
        b = e = -1;
        q = text;                       // assume 1,$ for the range
@@ -1451,7 +1453,7 @@ static Byte *new_screen(int ro, int co)
        screen = (Byte *) xmalloc(screensize);
        // initialize the new screen. assume this will be a empty file.
        screen_erase();
-       //   non-existant text[] lines start with a tilde (~).
+       //   non-existent text[] lines start with a tilde (~).
        for (li = 1; li < ro - 1; li++) {
                screen[(li * co) + 0] = '~';
        }
@@ -2527,7 +2529,7 @@ static int file_write(Byte * fn, Byte * first, Byte * last)
 
 //----- Terminal Drawing ---------------------------------------
 // The terminal is made up of 'rows' line of 'columns' columns.
-// classicly this would be 24 x 80.
+// classically this would be 24 x 80.
 //  screen coordinates
 //  0,0     ...     0,79
 //  1,0     ...     1,79
@@ -3221,7 +3223,7 @@ key_cmd_mode:
        case 'f':                       // f- forward to a user specified char
                last_forward_char = get_one_char();     // get the search char
                //
-               // dont seperate these two commands. 'f' depends on ';'
+               // dont separate these two commands. 'f' depends on ';'
                //
                //**** fall thru to ... 'i'
        case ';':                       // ;- look at rest of line for last forward char