Sun Jul 18 11:45:31 2021 UTC ()
aiomixer: Honor terminal colors. Looks better in cool-retro-term.


(nia)
diff -r1.3 -r1.4 src/usr.bin/aiomixer/main.c

cvs diff -r1.3 -r1.4 src/usr.bin/aiomixer/main.c (expand / switch to unified diff)

--- src/usr.bin/aiomixer/main.c 2021/07/15 06:57:10 1.3
+++ src/usr.bin/aiomixer/main.c 2021/07/18 11:45:31 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: main.c,v 1.3 2021/07/15 06:57:10 nia Exp $ */ 1/* $NetBSD: main.c,v 1.4 2021/07/18 11:45:31 nia Exp $ */
2/*- 2/*-
3 * Copyright (c) 2021 The NetBSD Foundation, Inc. 3 * Copyright (c) 2021 The NetBSD Foundation, Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This code is derived from software contributed to The NetBSD Foundation 6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Nia Alarie. 7 * by Nia Alarie.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
@@ -527,26 +527,27 @@ main(int argc, char **argv) @@ -527,26 +527,27 @@ main(int argc, char **argv)
527 err(EXIT_FAILURE, "can't initialize curses"); 527 err(EXIT_FAILURE, "can't initialize curses");
528 528
529 (void)signal(SIGHUP, on_signal); 529 (void)signal(SIGHUP, on_signal);
530 (void)signal(SIGINT, on_signal); 530 (void)signal(SIGINT, on_signal);
531 (void)signal(SIGTERM, on_signal); 531 (void)signal(SIGTERM, on_signal);
532 532
533 curs_set(0); 533 curs_set(0);
534 keypad(stdscr, TRUE); 534 keypad(stdscr, TRUE);
535 cbreak(); 535 cbreak();
536 noecho(); 536 noecho();
537 537
538 if (has_colors()) { 538 if (has_colors()) {
539 start_color(); 539 start_color();
 540 use_default_colors();
540 init_pair(COLOR_CONTROL_SELECTED, COLOR_BLUE, COLOR_BLACK); 541 init_pair(COLOR_CONTROL_SELECTED, COLOR_BLUE, COLOR_BLACK);
541 init_pair(COLOR_LEVELS, COLOR_GREEN, COLOR_BLACK); 542 init_pair(COLOR_LEVELS, COLOR_GREEN, COLOR_BLACK);
542 init_pair(COLOR_SET_SELECTED, COLOR_BLACK, COLOR_GREEN); 543 init_pair(COLOR_SET_SELECTED, COLOR_BLACK, COLOR_GREEN);
543 init_pair(COLOR_ENUM_ON, COLOR_WHITE, COLOR_RED); 544 init_pair(COLOR_ENUM_ON, COLOR_WHITE, COLOR_RED);
544 init_pair(COLOR_ENUM_OFF, COLOR_WHITE, COLOR_BLUE); 545 init_pair(COLOR_ENUM_OFF, COLOR_WHITE, COLOR_BLUE);
545 init_pair(COLOR_ENUM_MISC, COLOR_BLACK, COLOR_YELLOW); 546 init_pair(COLOR_ENUM_MISC, COLOR_BLACK, COLOR_YELLOW);
546 } 547 }
547 548
548 if (mixer_device != NULL) { 549 if (mixer_device != NULL) {
549 open_device(aio, mixer_device); 550 open_device(aio, mixer_device);
550 } else { 551 } else {
551 for (i = 0; i < 16; ++i) { 552 for (i = 0; i < 16; ++i) {
552 (void)snprintf(mixer_path, sizeof(mixer_path), 553 (void)snprintf(mixer_path, sizeof(mixer_path),