vidcontrol.c (76897) | vidcontrol.c (77329) |
---|---|
1/*- 2 * Copyright (c) 1994-1996 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#ifndef lint 30static const char rcsid[] = | 1/*- 2 * Copyright (c) 1994-1996 S�ren Schmidt 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29#ifndef lint 30static const char rcsid[] = |
31 "$FreeBSD: head/usr.sbin/vidcontrol/vidcontrol.c 76897 2001-05-20 12:17:31Z sobomax $"; | 31 "$FreeBSD: head/usr.sbin/vidcontrol/vidcontrol.c 77329 2001-05-28 11:05:28Z des $"; |
32#endif /* not lint */ 33 34#include <ctype.h> 35#include <err.h> 36#include <limits.h> 37#include <stdio.h> 38#include <stdlib.h> 39#include <string.h> --- 28 unchanged lines hidden (view full) --- 68char letter; 69struct vid_info info; 70 71 72static void 73usage() 74{ 75 fprintf(stderr, "%s\n%s\n%s\n%s\n", | 32#endif /* not lint */ 33 34#include <ctype.h> 35#include <err.h> 36#include <limits.h> 37#include <stdio.h> 38#include <stdlib.h> 39#include <string.h> --- 28 unchanged lines hidden (view full) --- 68char letter; 69struct vid_info info; 70 71 72static void 73usage() 74{ 75 fprintf(stderr, "%s\n%s\n%s\n%s\n", |
76"usage: vidcontrol [-b color] [-c appearance] [-d] [-f [size] file] [-g geometry]", 77" [-i adapter | mode] [-l screen_map] [-L] [-m on | off]", 78" [-M char] [-p] [-P] [-r foreground background] [-s number]", 79" [-t N | off] [-x] [mode] [foreground [background]] [show]"); | 76"usage: vidcontrol [-CdLPpx] [-b color] [-c appearance] [-f [size] file]", 77" [-g geometry] [-h size] [-i adapter | mode] [-l screen_map]", 78" [-m on | off] [-M char] [-r foreground background] [-s num]", 79" [-t N | off] [mode] [foreground [background]] [show]"); |
80 exit(1); 81} 82 83char * 84nextarg(int ac, char **av, int *indp, int oc, int strict) 85{ 86 if (*indp < ac) 87 return(av[(*indp)++]); --- 621 unchanged lines hidden (view full) --- 709 puts(line); 710 } 711 fflush(stdout); 712 } 713 714 return; 715} 716 | 80 exit(1); 81} 82 83char * 84nextarg(int ac, char **av, int *indp, int oc, int strict) 85{ 86 if (*indp < ac) 87 return(av[(*indp)++]); --- 621 unchanged lines hidden (view full) --- 709 puts(line); 710 } 711 fflush(stdout); 712 } 713 714 return; 715} 716 |
717void 718set_history(char *opt) 719{ 720 int size; 721 722 size = atoi(opt); 723 if ((*opt == '\0') || size < 0) { 724 warnx("argument must be a positive number"); 725 return; 726 } 727 if (ioctl(0, CONS_HISTORY, &size) == -1) 728 warn("setting history buffer size"); 729} 730 731void 732clear_history() 733{ 734 735 if (ioctl(0, CONS_CLRHIST) == -1) 736 warn("clear history buffer"); 737} 738 |
|
717int 718main(int argc, char **argv) 719{ 720 char *font, *type; 721 int opt; 722 723 724 info.size = sizeof(info); 725 if (argc == 1) 726 usage(); 727 /* Not reached */ 728 if (ioctl(0, CONS_GETINFO, &info) < 0) 729 err(1, "must be on a virtual console"); | 739int 740main(int argc, char **argv) 741{ 742 char *font, *type; 743 int opt; 744 745 746 info.size = sizeof(info); 747 if (argc == 1) 748 usage(); 749 /* Not reached */ 750 if (ioctl(0, CONS_GETINFO, &info) < 0) 751 err(1, "must be on a virtual console"); |
730 while((opt = getopt(argc, argv, "b:c:df:g:i:l:LM:m:pPr:s:t:x")) != -1) | 752 while((opt = getopt(argc, argv, "b:Cc:df:g:h:i:l:LM:m:pPr:s:t:x")) != -1) |
731 switch(opt) { | 753 switch(opt) { |
732 case 'b': 733 set_border_color(optarg); 734 break; 735 case 'c': 736 set_cursor_type(optarg); 737 break; 738 case 'd': 739 print_scrnmap(); 740 break; 741 case 'f': 742 type = optarg; 743 font = nextarg(argc, argv, &optind, 'f', 0); 744 if (font == NULL) { 745 type = NULL; 746 font = optarg; 747 } 748 load_font(type, font); 749 break; 750 case 'g': 751 if (sscanf(optarg, "%dx%d", &vesa_cols, 752 &vesa_rows) != 2) { 753 warnx("incorrect geometry: %s", optarg); 754 usage(); 755 } 756 break; 757 case 'i': 758 show_info(optarg); 759 break; 760 case 'l': 761 load_scrnmap(optarg); 762 break; 763 case 'L': 764 load_default_scrnmap(); 765 break; 766 case 'M': 767 set_mouse_char(optarg); 768 break; 769 case 'm': 770 set_mouse(optarg); 771 break; 772 case 'p': 773 dump_screen(DUMP_RAW); 774 break; 775 case 'P': 776 dump_screen(DUMP_TXT); 777 break; 778 case 'r': 779 set_reverse_colors(argc, argv, &optind); 780 break; 781 case 's': 782 set_console(optarg); 783 break; 784 case 't': 785 set_screensaver_timeout(optarg); 786 break; 787 case 'x': 788 hex = 1; 789 break; 790 default: | 754 case 'b': 755 set_border_color(optarg); 756 break; 757 case 'C': 758 clear_history(); 759 break; 760 case 'c': 761 set_cursor_type(optarg); 762 break; 763 case 'd': 764 print_scrnmap(); 765 break; 766 case 'f': 767 type = optarg; 768 font = nextarg(argc, argv, &optind, 'f', 0); 769 if (font == NULL) { 770 type = NULL; 771 font = optarg; 772 } 773 load_font(type, font); 774 break; 775 case 'g': 776 if (sscanf(optarg, "%dx%d", &vesa_cols, 777 &vesa_rows) != 2) { 778 warnx("incorrect geometry: %s", optarg); |
791 usage(); | 779 usage(); |
780 } 781 break; 782 case 'h': 783 set_history(optarg); 784 break; 785 case 'i': 786 show_info(optarg); 787 break; 788 case 'l': 789 load_scrnmap(optarg); 790 break; 791 case 'L': 792 load_default_scrnmap(); 793 break; 794 case 'M': 795 set_mouse_char(optarg); 796 break; 797 case 'm': 798 set_mouse(optarg); 799 break; 800 case 'p': 801 dump_screen(DUMP_RAW); 802 break; 803 case 'P': 804 dump_screen(DUMP_TXT); 805 break; 806 case 'r': 807 set_reverse_colors(argc, argv, &optind); 808 break; 809 case 's': 810 set_console(optarg); 811 break; 812 case 't': 813 set_screensaver_timeout(optarg); 814 break; 815 case 'x': 816 hex = 1; 817 break; 818 default: 819 usage(); |
|
792 } 793 video_mode(argc, argv, &optind); 794 set_normal_colors(argc, argv, &optind); 795 if (optind < argc && !strcmp(argv[optind], "show")) { 796 test_frame(); 797 optind++; 798 } 799 if ((optind != argc) || (argc == 1)) 800 usage(); 801 return 0; 802} 803 | 820 } 821 video_mode(argc, argv, &optind); 822 set_normal_colors(argc, argv, &optind); 823 if (optind < argc && !strcmp(argv[optind], "show")) { 824 test_frame(); 825 optind++; 826 } 827 if ((optind != argc) || (argc == 1)) 828 usage(); 829 return 0; 830} 831 |