diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-16 13:18:17 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-16 13:18:17 +0000 |
commit | 284d0faed6a1ec2adcc4b7aea31ae3d05b3b70d9 (patch) | |
tree | 3cfcea06c5a5c9e454edd39b58111ef38810882c /editors/sed.c | |
parent | 069e347863fa46f684ab6bd7e48cefd8fa74b629 (diff) | |
download | busybox-w32-284d0faed6a1ec2adcc4b7aea31ae3d05b3b70d9.tar.gz busybox-w32-284d0faed6a1ec2adcc4b7aea31ae3d05b3b70d9.tar.bz2 busybox-w32-284d0faed6a1ec2adcc4b7aea31ae3d05b3b70d9.zip |
random s/short/int/
add_cmd 1189 1190 +1
xconnect_ftpdata 118 117 -1
data_align 86 84 -2
process_files 2101 2096 -5
forkexec 1345 1334 -11
Diffstat (limited to 'editors/sed.c')
-rw-r--r-- | editors/sed.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/editors/sed.c b/editors/sed.c index 0f5cab2b7..433418253 100644 --- a/editors/sed.c +++ b/editors/sed.c | |||
@@ -76,7 +76,7 @@ typedef struct sed_cmd_s { | |||
76 | FILE *sw_file; /* File (sw) command writes to, -1 for none. */ | 76 | FILE *sw_file; /* File (sw) command writes to, -1 for none. */ |
77 | char *string; /* Data string for (saicytb) commands. */ | 77 | char *string; /* Data string for (saicytb) commands. */ |
78 | 78 | ||
79 | unsigned short which_match; /* (s) Which match to replace (0 for all) */ | 79 | unsigned which_match; /* (s) Which match to replace (0 for all) */ |
80 | 80 | ||
81 | /* Bitfields (gcc won't group them if we don't) */ | 81 | /* Bitfields (gcc won't group them if we don't) */ |
82 | unsigned invert:1; /* the '!' after the address */ | 82 | unsigned invert:1; /* the '!' after the address */ |
@@ -353,7 +353,7 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char *substr) | |||
353 | /* Match 0 treated as all, multiple matches we take the last one. */ | 353 | /* Match 0 treated as all, multiple matches we take the last one. */ |
354 | const char *pos = substr + idx; | 354 | const char *pos = substr + idx; |
355 | /* FIXME: error check? */ | 355 | /* FIXME: error check? */ |
356 | sed_cmd->which_match = (unsigned short)strtol(substr+idx, (char**) &pos, 10); | 356 | sed_cmd->which_match = (unsigned)strtol(substr+idx, (char**) &pos, 10); |
357 | idx = pos - substr; | 357 | idx = pos - substr; |
358 | } | 358 | } |
359 | continue; | 359 | continue; |
@@ -364,7 +364,8 @@ static int parse_subst_cmd(sed_cmd_t *sed_cmd, const char *substr) | |||
364 | switch (substr[idx]) { | 364 | switch (substr[idx]) { |
365 | /* Replace all occurrences */ | 365 | /* Replace all occurrences */ |
366 | case 'g': | 366 | case 'g': |
367 | if (match[0] != '^') sed_cmd->which_match = 0; | 367 | if (match[0] != '^') |
368 | sed_cmd->which_match = 0; | ||
368 | break; | 369 | break; |
369 | /* Print pattern space */ | 370 | /* Print pattern space */ |
370 | case 'p': | 371 | case 'p': |
@@ -683,7 +684,8 @@ static int do_subst_command(sed_cmd_t *sed_cmd, char **line) | |||
683 | altered++; | 684 | altered++; |
684 | 685 | ||
685 | /* if we're not doing this globally, get out now */ | 686 | /* if we're not doing this globally, get out now */ |
686 | if (sed_cmd->which_match) break; | 687 | if (sed_cmd->which_match) |
688 | break; | ||
687 | } while (*oldline && (regexec(current_regex, oldline, 10, G.regmatch, 0) != REG_NOMATCH)); | 689 | } while (*oldline && (regexec(current_regex, oldline, 10, G.regmatch, 0) != REG_NOMATCH)); |
688 | 690 | ||
689 | /* Copy rest of string into output pipeline */ | 691 | /* Copy rest of string into output pipeline */ |