aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-08-30 16:41:17 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2022-08-30 16:41:17 +0200
commitfe73c8d55795a8fe7e95fc2c00af6899817b96b8 (patch)
tree1b772243f00c63d16ee4cf8bf6f80a6c7a53ee91 /editors
parent58598eb7093561d914a6254697e137b815f1fdfc (diff)
downloadbusybox-w32-fe73c8d55795a8fe7e95fc2c00af6899817b96b8.tar.gz
busybox-w32-fe73c8d55795a8fe7e95fc2c00af6899817b96b8.tar.bz2
busybox-w32-fe73c8d55795a8fe7e95fc2c00af6899817b96b8.zip
*: style fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors')
-rw-r--r--editors/patch.c16
-rw-r--r--editors/patch_toybox.c36
-rw-r--r--editors/vi.c2
3 files changed, 27 insertions, 27 deletions
diff --git a/editors/patch.c b/editors/patch.c
index aebb5073e..f90d6854d 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -138,9 +138,9 @@ static void do_line(void *data)
138{ 138{
139 struct double_list *dlist = data; 139 struct double_list *dlist = data;
140 140
141 if (TT.state>1 && *dlist->data != TT.state) 141 if (TT.state > 1 && *dlist->data != TT.state)
142 fdprintf(TT.state == 2 ? 2 : TT.fileout, 142 fdprintf(TT.state == 2 ? 2 : TT.fileout,
143 "%s\n", dlist->data+(TT.state>3 ? 1 : 0)); 143 "%s\n", dlist->data + (TT.state > 3 ? 1 : 0));
144 144
145 if (PATCH_DEBUG) fdprintf(2, "DO %d: %s\n", TT.state, dlist->data); 145 if (PATCH_DEBUG) fdprintf(2, "DO %d: %s\n", TT.state, dlist->data);
146 146
@@ -221,7 +221,7 @@ static int apply_one_hunk(void)
221 221
222 // Match EOF if there aren't as many ending context lines as beginning 222 // Match EOF if there aren't as many ending context lines as beginning
223 for (plist = TT.current_hunk; plist; plist = plist->next) { 223 for (plist = TT.current_hunk; plist; plist = plist->next) {
224 if (plist->data[0]==' ') matcheof++; 224 if (plist->data[0] == ' ') matcheof++;
225 else matcheof = 0; 225 else matcheof = 0;
226 if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data); 226 if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data);
227 } 227 }
@@ -433,15 +433,15 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
433 433
434 // Are we assembling a hunk? 434 // Are we assembling a hunk?
435 if (state >= 2) { 435 if (state >= 2) {
436 if (*patchline==' ' || *patchline=='+' || *patchline=='-') { 436 if (*patchline == ' ' || *patchline == '+' || *patchline == '-') {
437 dlist_add(&TT.current_hunk, patchline); 437 dlist_add(&TT.current_hunk, patchline);
438 438
439 if (*patchline != '+') oldlen--; 439 if (*patchline != '+') oldlen--;
440 if (*patchline != '-') newlen--; 440 if (*patchline != '-') newlen--;
441 441
442 // Context line? 442 // Context line?
443 if (*patchline==' ' && state==2) TT.context++; 443 if (*patchline == ' ' && state == 2) TT.context++;
444 else state=3; 444 else state = 3;
445 445
446 // If we've consumed all expected hunk lines, apply the hunk. 446 // If we've consumed all expected hunk lines, apply the hunk.
447 447
@@ -469,9 +469,9 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
469 free(*name); 469 free(*name);
470 // Trim date from end of filename (if any). We don't care. 470 // Trim date from end of filename (if any). We don't care.
471 for (s = patchline+4; *s && *s!='\t'; s++) 471 for (s = patchline+4; *s && *s!='\t'; s++)
472 if (*s=='\\' && s[1]) s++; 472 if (*s == '\\' && s[1]) s++;
473 i = atoi(s); 473 i = atoi(s);
474 if (i>1900 && i<=1970) 474 if (i > 1900 && i <= 1970)
475 *name = xstrdup("/dev/null"); 475 *name = xstrdup("/dev/null");
476 else { 476 else {
477 *s = 0; 477 *s = 0;
diff --git a/editors/patch_toybox.c b/editors/patch_toybox.c
index 69a508b2e..5478ece7d 100644
--- a/editors/patch_toybox.c
+++ b/editors/patch_toybox.c
@@ -79,7 +79,7 @@ void TOY_llist_free(void *list, void (*freeit)(void *data))
79 else free(pop); 79 else free(pop);
80 80
81 // End doubly linked list too. 81 // End doubly linked list too.
82 if (list==pop) break; 82 if (list == pop) break;
83 } 83 }
84} 84}
85 85
@@ -137,11 +137,11 @@ char *get_rawline(int fd, long *plen, char end)
137 long len = 0; 137 long len = 0;
138 138
139 for (;;) { 139 for (;;) {
140 if (1>read(fd, &c, 1)) break; 140 if (1 > read(fd, &c, 1)) break;
141 if (!(len & 63)) buf=xrealloc(buf, len+65); 141 if (!(len & 63)) buf=xrealloc(buf, len+65);
142 if ((buf[len++]=c) == end) break; 142 if ((buf[len++] = c) == end) break;
143 } 143 }
144 if (buf) buf[len]=0; 144 if (buf) buf[len] = 0;
145 if (plen) *plen = len; 145 if (plen) *plen = len;
146 146
147 return buf; 147 return buf;
@@ -153,7 +153,7 @@ char *get_line(int fd)
153 long len; 153 long len;
154 char *buf = get_rawline(fd, &len, '\n'); 154 char *buf = get_rawline(fd, &len, '\n');
155 155
156 if (buf && buf[--len]=='\n') buf[len]=0; 156 if (buf && buf[--len] == '\n') buf[len] = 0;
157 157
158 return buf; 158 return buf;
159} 159}
@@ -165,10 +165,10 @@ void xsendfile(int in, int out)
165 long len; 165 long len;
166 char buf[4096]; 166 char buf[4096];
167 167
168 if (in<0) return; 168 if (in < 0) return;
169 for (;;) { 169 for (;;) {
170 len = safe_read(in, buf, 4096); 170 len = safe_read(in, buf, 4096);
171 if (len<1) break; 171 if (len < 1) break;
172 xwrite(out, buf, len); 172 xwrite(out, buf, len);
173 } 173 }
174} 174}
@@ -179,7 +179,7 @@ void replace_tempfile(int fdin, int fdout, char **tempname)
179{ 179{
180 char *temp = xstrdup(*tempname); 180 char *temp = xstrdup(*tempname);
181 181
182 temp[strlen(temp)-6]=0; 182 temp[strlen(temp)-6] = 0;
183 if (fdin != -1) { 183 if (fdin != -1) {
184 xsendfile(fdin, fdout); 184 xsendfile(fdin, fdout);
185 xclose(fdin); 185 xclose(fdin);
@@ -263,9 +263,9 @@ static void do_line(void *data)
263{ 263{
264 struct double_list *dlist = (struct double_list *)data; 264 struct double_list *dlist = (struct double_list *)data;
265 265
266 if (TT.state>1 && *dlist->data != TT.state) 266 if (TT.state > 1 && *dlist->data != TT.state)
267 fdprintf(TT.state == 2 ? 2 : TT.fileout, 267 fdprintf(TT.state == 2 ? 2 : TT.fileout,
268 "%s\n", dlist->data+(TT.state>3 ? 1 : 0)); 268 "%s\n", dlist->data + (TT.state > 3 ? 1 : 0));
269 269
270 if (PATCH_DEBUG) fdprintf(2, "DO %d: %s\n", TT.state, dlist->data); 270 if (PATCH_DEBUG) fdprintf(2, "DO %d: %s\n", TT.state, dlist->data);
271 271
@@ -314,7 +314,7 @@ static int apply_one_hunk(void)
314 314
315 // Match EOF if there aren't as many ending context lines as beginning 315 // Match EOF if there aren't as many ending context lines as beginning
316 for (plist = TT.current_hunk; plist; plist = plist->next) { 316 for (plist = TT.current_hunk; plist; plist = plist->next) {
317 if (plist->data[0]==' ') matcheof++; 317 if (plist->data[0] == ' ') matcheof++;
318 else matcheof = 0; 318 else matcheof = 0;
319 if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data); 319 if (PATCH_DEBUG) fdprintf(2, "HUNK:%s\n", plist->data);
320 } 320 }
@@ -385,7 +385,7 @@ static int apply_one_hunk(void)
385 385
386 // If we've reached the end of the buffer without confirming a 386 // If we've reached the end of the buffer without confirming a
387 // match, read more lines. 387 // match, read more lines.
388 if (check==buf) { 388 if (check == buf) {
389 buf = 0; 389 buf = 0;
390 break; 390 break;
391 } 391 }
@@ -456,15 +456,15 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
456 456
457 // Are we assembling a hunk? 457 // Are we assembling a hunk?
458 if (state >= 2) { 458 if (state >= 2) {
459 if (*patchline==' ' || *patchline=='+' || *patchline=='-') { 459 if (*patchline == ' ' || *patchline == '+' || *patchline == '-') {
460 dlist_add(&TT.current_hunk, patchline); 460 dlist_add(&TT.current_hunk, patchline);
461 461
462 if (*patchline != '+') TT.oldlen--; 462 if (*patchline != '+') TT.oldlen--;
463 if (*patchline != '-') TT.newlen--; 463 if (*patchline != '-') TT.newlen--;
464 464
465 // Context line? 465 // Context line?
466 if (*patchline==' ' && state==2) TT.context++; 466 if (*patchline == ' ' && state == 2) TT.context++;
467 else state=3; 467 else state = 3;
468 468
469 // If we've consumed all expected hunk lines, apply the hunk. 469 // If we've consumed all expected hunk lines, apply the hunk.
470 470
@@ -491,9 +491,9 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
491 491
492 // Trim date from end of filename (if any). We don't care. 492 // Trim date from end of filename (if any). We don't care.
493 for (s = patchline+4; *s && *s!='\t'; s++) 493 for (s = patchline+4; *s && *s!='\t'; s++)
494 if (*s=='\\' && s[1]) s++; 494 if (*s == '\\' && s[1]) s++;
495 i = atoi(s); 495 i = atoi(s);
496 if (i>1900 && i<=1970) 496 if (i > 1900 && i <= 1970)
497 *name = xstrdup("/dev/null"); 497 *name = xstrdup("/dev/null");
498 else { 498 else {
499 *s = 0; 499 *s = 0;
@@ -537,7 +537,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
537 // handle -p path truncation. 537 // handle -p path truncation.
538 for (i=0, s = name; *s;) { 538 for (i=0, s = name; *s;) {
539 if ((option_mask32 & FLAG_PATHLEN) && TT.prefix == i) break; 539 if ((option_mask32 & FLAG_PATHLEN) && TT.prefix == i) break;
540 if (*(s++)=='/') { 540 if (*(s++) == '/') {
541 name = s; 541 name = s;
542 i++; 542 i++;
543 } 543 }
diff --git a/editors/vi.c b/editors/vi.c
index 1f997e8e5..2645afe87 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -4327,7 +4327,7 @@ static void do_cmd(int c)
4327 c1 = get_one_char(); 4327 c1 = get_one_char();
4328 // ZQ means to exit without saving 4328 // ZQ means to exit without saving
4329 if (c1 == 'Q') { 4329 if (c1 == 'Q') {
4330 editing=0; 4330 editing = 0;
4331 optind = cmdline_filecnt; 4331 optind = cmdline_filecnt;
4332 break; 4332 break;
4333 } 4333 }