Changeset 6210


Ignore:
Timestamp:
2007-01-26T20:57:51+01:00 (9 years ago)
Author:
nbd
Message:

another fix for the awk command line parsing - should finally work properly now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/busybox/patches/400-revert_awk_getopt.patch

    r6204 r6210  
    11diff -ur busybox.old/editors/awk.c busybox.dev/editors/awk.c 
    22--- busybox.old/editors/awk.c   2007-01-19 22:23:12.000000000 +0100 
    3 +++ busybox.dev/editors/awk.c   2007-01-25 20:01:26.000000000 +0100 
     3+++ busybox.dev/editors/awk.c   2007-01-26 20:09:45.000000000 +0100 
    44@@ -2639,14 +2639,13 @@ 
    55  
     
    1818        /* Undo busybox.c, or else strtod may eat ','! This breaks parsing: 
    1919         * $1,$2 == '$1,' '$2', NOT '$1' ',' '$2' */ 
    20 @@ -2694,39 +2693,46 @@ 
     20@@ -2694,40 +2693,54 @@ 
    2121                free(s); 
    2222        } 
     
    4040-                               s = xrealloc(s, i + 4096); 
    4141-                               j = fread(s + i, 1, 4094, from_file); 
     42+       programname = NULL; 
    4243+       while((c = getopt(argc, argv, "F:v:f:W:")) != EOF) { 
    4344+               switch (c) { 
     
    8485-               if (!argc) 
    8586-                       bb_show_usage(); 
    86 -               programname = "cmd. line"; 
    87 -               parse_program(*argv++); 
    88 -               argc--; 
     87+       } 
     88+       argc -= optind; 
     89+       argv += optind; 
     90+ 
     91+       if (!programname) { 
     92                programname = "cmd. line"; 
     93                parse_program(*argv++); 
     94                argc--; 
    8995        } 
    9096-       if (opt & 0x8) // -W 
    9197-               bb_error_msg("warning: unrecognized option '-W %s' ignored", opt_W); 
    92 +       argc -= optind; 
    93 +       argv += optind; 
    94   
     98- 
     99+        
    95100        /* fill in ARGV array */ 
    96101        setvar_i(V[ARGC], argc + 1); 
     102        setari_u(V[ARGV], 0, "awk"); 
Note: See TracChangeset for help on using the changeset viewer.