Unified · Split
| @@ -313,14 +313,14 @@ loadbg(void) · 312 unmodified lines | |||
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | static int | 315 | static int |
| 316 | printcolor(Color *c) | 316 | printcolor(int f, Color *c) |
| 317 | { | 317 | { |
| 318 | char s[64]; | 318 | char s[64]; |
| 319 | int n; | 319 | int n; |
| 320 | 320 | ||
| 321 | n = snprint(s, sizeof(s), "%s\t%©\n", c->id, c); | 321 | n = snprint(s, sizeof(s), "%s\t%©\n", c->id, c); |
| 322 | 322 | ||
| 323 | return write(1, s, n) == n ? 0 : -1; | 323 | return write(f, s, n) == n ? 0 : -1; |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | static int | 326 | static int |
| @@ -405,6 +405,15 @@ readcolors(Biobuf *b) · 78 unmodified lines | |||
| 405 | } | 405 | } |
| 406 | } | 406 | } |
| 407 | 407 | ||
| 408 | static void | ||
| 409 | dump(int f) | ||
| 410 | { | ||
| 411 | Color *c; | ||
| 412 | |||
| 413 | for (c = colors; c != nil; c = c->next) | ||
| 414 | printcolor(f, c); | ||
| 415 | } | ||
| 416 | |||
| 408 | static void | 417 | static void |
| 409 | loadtheme(char *filename) | 418 | loadtheme(char *filename) |
| 410 | { | 419 | { |
| @@ -429,6 +438,7 @@ plumbproc(void *) · 18 unmodified lines | |||
| 429 | while ((m = plumbrecv(f)) != nil) { | 438 | while ((m = plumbrecv(f)) != nil) { |
| 430 | loadtheme(m->data); | 439 | loadtheme(m->data); |
| 431 | redraw(); | 440 | redraw(); |
| 441 | dump(1); | ||
| 432 | plumbfree(m); | 442 | plumbfree(m); |
| 433 | } | 443 | } |
| 434 | } | 444 | } |
| @@ -554,7 +564,7 @@ changed: · 119 unmodified lines | |||
| 554 | if (c->u != u) { | 564 | if (c->u != u) { |
| 555 | c->u = u; | 565 | c->u = u; |
| 556 | if (!once) | 566 | if (!once) |
| 557 | printcolor(c); | 567 | printcolor(1, c); |
| 558 | } | 568 | } |
| 559 | redraw(); | 569 | redraw(); |
| 560 | goto next; | 570 | goto next; |
| @@ -580,12 +590,10 @@ changed: · 19 unmodified lines | |||
| 580 | 590 | ||
| 581 | int f; | 591 | int f; |
| 582 | if ((f = open("/dev/snarf", OWRITE)) >= 0) { | 592 | if ((f = open("/dev/snarf", OWRITE)) >= 0) { |
| 583 | if (i == nelem(spaces)) { | 593 | if (i == nelem(spaces)) |
| 584 | write(f, hex, strlen(hex)); | 594 | write(f, hex, strlen(hex)); |
| 585 | } else { | 595 | else |
| 586 | for (c = colors; c != nil; c = c->next) | 596 | dump(f); |
| 587 | fprint(f, "%s\t%©\n", c->id, c); | ||
| 588 | } | ||
| 589 | close(f); | 597 | close(f); |
| 590 | } | 598 | } |
| 591 | } else if (m.buttons == 2) { | 599 | } else if (m.buttons == 2) { |
| @@ -608,10 +616,8 @@ changed: · 16 unmodified lines | |||
| 608 | } | 616 | } |
| 609 | 617 | ||
| 610 | end: | 618 | end: |
| 611 | if (once) { | 619 | if (once) |
| 612 | for (c = colors; c != nil; c = c->next) | 620 | dump(1); |
| 613 | print("%s\t%©\n", c->id, c); | ||
| 614 | } | ||
| 615 | 621 | ||
| 616 | threadexitsall(nil); | 622 | threadexitsall(nil); |
| 617 | } | 623 | } |