From owner-freebsd-bugs Sat May 12 5:30:16 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 70F1E37B424 for ; Sat, 12 May 2001 05:30:02 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4CCU2T96999; Sat, 12 May 2001 05:30:02 -0700 (PDT) (envelope-from gnats) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 4949037B423 for ; Sat, 12 May 2001 05:24:58 -0700 (PDT) (envelope-from nobody@FreeBSD.org) Received: (from nobody@localhost) by freefall.freebsd.org (8.11.1/8.11.1) id f4CCOwQ96797; Sat, 12 May 2001 05:24:58 -0700 (PDT) (envelope-from nobody) Message-Id: <200105121224.f4CCOwQ96797@freefall.freebsd.org> Date: Sat, 12 May 2001 05:24:58 -0700 (PDT) From: opentrax@email.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/27281: vidcontrol(1) does not have error codes Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 27281 >Category: bin >Synopsis: vidcontrol(1) does not have error codes >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat May 12 05:30:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: Jesse Monroy, Jr. >Release: 3.5.1 >Organization: Digital Marshalls >Environment: FreeBSD spammie.svbug.com 3.5.1-RELEASE FreeBSD 3.5.1-RELEASE #0: Wed Sep 13 20:07:41 PDT 2000 jessem@spammie.svbug.com:/usr/src/sys/compile/GATEWAY i386 >Description: vidcontrol has no error code other than when it prints a usage message. This makes it difficult to test via scripts. The attached code adds error codes. Caution is advised as the changes have not fully been tested. >How-To-Repeat: >Fix: 55a56,64 > enum error_code { OKAY = 0, > BADMODECODE = 1, SCRNMAPNOT = 2, > SCRNMAPBAD = 3, FONTFILENOT = 4, > FONTSIZEBAD = 5, FONTFILEBAD = 6, > SCRNSVR_POS = 7, CURSORBADARG = 8, > CONS_BADNUM = 9, CONS_OUTRANGE = 10, > CONS_ACTIVATE = 11, MOUSEBADARG = 12, > MOUSEBADARG2 = 13, SHOW_ADP_FAIL = 14, > SHOWBADARG = 15 }; 103c112 < void --- > int 111a121 > int return_code = 0; 116c126 < if (fd) --- > if (fd) { 117a128 > } 121c132 < return; --- > return SCRNMAPNOT; 129c140 < return; --- > return SCRNMAPBAD; 132c143 < if (ioctl(0, PIO_SCRNMAP, &scrnmap) < 0) --- > if ((return_code = ioctl(0, PIO_SCRNMAP, &scrnmap)) < 0) { 133a145 > } 134a147,148 > > return return_code; 137c151 < void --- > int 141a156 > int return_code = 0; 145c160 < if (ioctl(0, PIO_SCRNMAP, &scrnmap) < 0) --- > if ((return_code = ioctl(0, PIO_SCRNMAP, &scrnmap)) < 0) { 146a162,164 > } > > return return_code; 149c167 < void --- > int 153a172 > int return_code = 0; 155c174 < if (ioctl(0, GIO_SCRNMAP, &map) < 0) { --- > if ((return_code = ioctl(0, GIO_SCRNMAP, &map)) < 0) { 157c176 < return; --- > return return_code; 168a188 > return return_code; 171c191 < void --- > int 179a200 > int return_code = 0; 184c205 < if (fd) --- > if (fd) { 185a207 > } 189c211 < return; --- > return FONTFILENOT; 206c228 < return; --- > return FONTSIZEBAD; 215c237 < return; --- > return FONTFILEBAD; 218c240 < if (ioctl(0, io, fontmap) < 0) --- > if ((return_code = ioctl(0, io, fontmap)) < 0) { 219a242 > } 221a245,246 > > return return_code; 224c249 < void --- > int 227a253 > int return_code = 0; 229c255 < if (!strcmp(arg, "off")) --- > if (!strcmp(arg, "off")) { 231c257 < else { --- > } else { 235c261 < return; --- > return SCRNSVR_POS; 238c264 < if (ioctl(0, CONS_BLANKTIME, &nsec) == -1) --- > if ((return_code = ioctl(0, CONS_BLANKTIME, &nsec)) == -1) { 239a266,268 > } > > return return_code; 242c271 < void --- > int 247c276 < if (!strcmp(appearence, "normal")) --- > if (!strcmp(appearence, "normal")) { 249c278 < else if (!strcmp(appearence, "blink")) --- > } else if (!strcmp(appearence, "blink")) { 251c280 < else if (!strcmp(appearence, "destructive")) --- > } else if (!strcmp(appearence, "destructive")) { 253c282 < else { --- > } else { 255c284 < return; --- > return CURSORBADARG; 257a287,288 > > return 0; 260c291 < void --- > int 296a328 > int return_code = 0; 305,307c337,340 < if (modes[i].name == NULL) < return; < if (ioctl(0, mode, NULL) < 0) --- > if (modes[i].name == NULL) { > return (int) BADMODECODE; > } > if ((return_code = ioctl(0, mode, NULL)) < 0) { 308a342 > } 313c347 < if (ioctl(0, KDRASTER, size)) --- > if ((return_code = ioctl(0, KDRASTER, size)) != 0) { 314a349 > } 318c353 < return; --- > return return_code; 326,327c361,362 < for (i=0; i<16; i++) < if (!strcmp(color, legal_colors[i])) --- > for (i=0; i<16; i++) { > if (!strcmp(color, legal_colors[i])) { 328a364,366 > } > } > 365c403 < void --- > int 368a407 > int return_code = 0; 372c411 < return; --- > return CONS_BADNUM; 378c417,418 < } else if (ioctl(0, VT_ACTIVATE, (caddr_t) (long) n) == -1) --- > return_code = CONS_OUTRANGE; > } else if (ioctl(0, VT_ACTIVATE, (caddr_t) (long) n) == -1) { 379a420,423 > return_code = CONS_ACTIVATE; > } > > return return_code; 389,390c433 < } < else --- > } else { 391a435 > } 394c438 < void --- > int 398c442,443 < long l; --- > long l; > int return_value = 0; 403c448 < return; --- > return MOUSEBADARG; 407a453,454 > > return return_value; 410c457 < void --- > int 413a461 > int return_value = 0; 415c463 < if (!strcmp(arg, "on")) --- > if (!strcmp(arg, "on")) { 417c465 < else if (!strcmp(arg, "off")) --- > } else if (!strcmp(arg, "off")) { 419c467 < else { --- > } else { 421c469 < return; --- > return MOUSEBADARG2; 423a472,473 > > return return_value; 449c499 < void --- > int 452a503 > int return_value = 0; 457c508 < return; --- > return SHOW_ADP_FAIL; 466a518,519 > > return return_value; 510c563 < void --- > int 513c566,568 < if (!strcmp(arg, "adapter")) --- > int return_value = 0; > > if (!strcmp(arg, "adapter")) { 515c570 < else if (!strcmp(arg, "mode")) --- > } else if (!strcmp(arg, "mode")) { 517c572 < else { --- > } else { 519c574 < return; --- > return SHOWBADARG; 520a576,577 > > return return_value; 544a602 > int return_value = 0; 556c614 < set_cursor_type(optarg); --- > return_value = set_cursor_type(optarg); 562c620 < load_font(optarg, --- > return_value = load_font(optarg, 566c624 < show_info(optarg); --- > return_value = show_info(optarg); 569c627 < load_scrnmap(optarg); --- > return_value = load_scrnmap(optarg); 572c630 < load_default_scrnmap(); --- > return_value = load_default_scrnmap(); 575c633 < set_mouse_char(optarg); --- > return_value = set_mouse_char(optarg); 578c636 < set_mouse(optarg); --- > return_value = set_mouse(optarg); 584c642 < set_console(optarg); --- > return_value = set_console(optarg); 587c645 < set_screensaver_timeout(optarg); --- > return_value = set_screensaver_timeout(optarg); 595c653 < video_mode(argc, argv, &optind); --- > return_value = video_mode(argc, argv, &optind); 603c661,663 < return 0; --- > > /* Return an error code */ > return (return_value) ? return_value : 0; >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message