Unified · Split
| @@ -12,8 +12,6 @@ · 11 unmodified lines | ||
| 12 | 12 | |
| 13 | 13 | #include <termios.h> |
| 14 | 14 | |
| 15 | −#define argv0 "drawterm" | |
| 16 | − | |
| 17 | 15 | typedef struct Cursor Cursor; |
| 18 | 16 | |
| 19 | 17 | #undef long |
| @@ -327,7 +325,6 @@ xinitscreen(void) · 307 unmodified lines | ||
| 327 | 325 | Memimage *gscreen; |
| 328 | 326 | int i, xsize, ysize; |
| 329 | 327 | char *argv[2]; |
| 330 | − char *disp_val; | |
| 331 | 328 | Window rootwin; |
| 332 | 329 | Rectangle r; |
| 333 | 330 | XWMHints hints; |
| @@ -346,11 +343,8 @@ xinitscreen(void) · 12 unmodified lines | ||
| 346 | 343 | xdrawable = 0; |
| 347 | 344 | |
| 348 | 345 | xdisplay = XOpenDisplay(NULL); |
| 349 | − if(xdisplay == 0){ | |
| 350 | − iprint("xinitscreen: XOpenDisplay: %r [DISPLAY=%s]\n", | |
| 351 | − getenv("DISPLAY")); | |
| 352 | − exit(0); | |
| 353 | − } | |
| 346 | + if(xdisplay == 0) | |
| 347 | + panic("XOpenDisplay: %r [DISPLAY=%s]", getenv("DISPLAY")); | |
| 354 | 348 | |
| 355 | 349 | XSetErrorHandler(shutup); |
| 356 | 350 | XSetIOErrorHandler(panicshutup); |
| @@ -373,13 +367,13 @@ xinitscreen(void) · 16 unmodified lines | ||
| 373 | 367 | else if(XMatchVisualInfo(xdisplay, rootscreennum, 8, PseudoColor, &xvi) |
| 374 | 368 | || XMatchVisualInfo(xdisplay, rootscreennum, 8, StaticColor, &xvi)){ |
| 375 | 369 | if(xscreendepth > 8) |
| 376 | − panic("drawterm: can't deal with colormapped depth %d screens\n", xscreendepth); | |
| 370 | + panic("can't deal with colormapped depth %d screens", xscreendepth); | |
| 377 | 371 | xvis = xvi.visual; |
| 378 | 372 | xscreendepth = 8; |
| 379 | 373 | } |
| 380 | 374 | else{ |
| 381 | 375 | if(xscreendepth != 8) |
| 382 | − panic("drawterm: can't deal with depth %d screens\n", xscreendepth); | |
| 376 | + panic("can't deal with depth %d screens", xscreendepth); | |
| 383 | 377 | xvis = DefaultVisual(xdisplay, rootscreennum); |
| 384 | 378 | } |
| 385 | 379 | |
| @@ -418,7 +412,7 @@ xinitscreen(void) · 32 unmodified lines | ||
| 418 | 412 | } |
| 419 | 413 | } |
| 420 | 414 | if(xscreenchan == 0) |
| 421 | − panic("drawterm: unknown screen pixel format\n"); | |
| 415 | + panic("unknown screen pixel format"); | |
| 422 | 416 | |
| 423 | 417 | screen = DefaultScreenOfDisplay(xdisplay); |
| 424 | 418 | xcmap = DefaultColormapOfScreen(screen); |
| @@ -489,23 +483,13 @@ xinitscreen(void) · 64 unmodified lines | ||
| 489 | 483 | xgccopy = creategc(xscreenid); |
| 490 | 484 | |
| 491 | 485 | xkmcon = XOpenDisplay(NULL); |
| 492 | − if(xkmcon == 0){ | |
| 493 | − disp_val = getenv("DISPLAY"); | |
| 494 | − if(disp_val == 0) | |
| 495 | − disp_val = "not set"; | |
| 496 | − iprint("drawterm: open %r, DISPLAY is %s\n", disp_val); | |
| 497 | − exit(0); | |
| 498 | − } | |
| 486 | + if(xkmcon == 0) | |
| 487 | + panic("XOpenDisplay: %r [DISPLAY=%s]", getenv("DISPLAY")); | |
| 499 | 488 | XkbSetDetectableAutoRepeat(xkmcon, True, NULL); |
| 500 | 489 | |
| 501 | 490 | xsnarfcon = XOpenDisplay(NULL); |
| 502 | − if(xsnarfcon == 0){ | |
| 503 | − disp_val = getenv("DISPLAY"); | |
| 504 | − if(disp_val == 0) | |
| 505 | − disp_val = "not set"; | |
| 506 | − iprint("drawterm: open %r, DISPLAY is %s\n", disp_val); | |
| 507 | − exit(0); | |
| 508 | − } | |
| 491 | + if(xsnarfcon == 0) | |
| 492 | + panic("XOpenDisplay: %r [DISPLAY=%s]", getenv("DISPLAY")); | |
| 509 | 493 | |
| 510 | 494 | clipboard = XInternAtom(xkmcon, "CLIPBOARD", False); |
| 511 | 495 | utf8string = XInternAtom(xkmcon, "UTF8_STRING", False); |
| @@ -607,7 +591,7 @@ initmap(Window w) · 95 unmodified lines | ||
| 607 | 591 | c = map[19]; |
| 608 | 592 | /* find out index into colormap for our RGB */ |
| 609 | 593 | if(!XAllocColor(xdisplay, xcmap, &c)) |
| 610 | − panic("drawterm: screen-x11 can't alloc color"); | |
| 594 | + panic("screen-x11 can't alloc color"); | |
| 611 | 595 | |
| 612 | 596 | p = c.pixel; |
| 613 | 597 | pp = rgb2cmap((p>>16)&0xff,(p>>8)&0xff,p&0xff); |
| @@ -642,10 +626,8 @@ initmap(Window w) · 28 unmodified lines | ||
| 642 | 626 | else { |
| 643 | 627 | for(i = 0; i < 128; i++) { |
| 644 | 628 | c = map7[i]; |
| 645 | − if(!XAllocColor(xdisplay, xcmap, &c)) { | |
| 646 | − iprint("drawterm: can't alloc colors in default map, don't use -7\n"); | |
| 647 | − exit(0); | |
| 648 | − } | |
| 629 | + if(!XAllocColor(xdisplay, xcmap, &c)) | |
| 630 | + panic("can't alloc colors in default map, don't use -7"); | |
| 649 | 631 | plan9tox11[map7to8[i][0]] = c.pixel; |
| 650 | 632 | plan9tox11[map7to8[i][1]] = c.pixel; |
| 651 | 633 | x11toplan9[c.pixel] = map7to8[i][0]; |
| @@ -653,7 +635,7 @@ initmap(Window w) · 1 unmodified line | ||
| 653 | 635 | } |
| 654 | 636 | } |
| 655 | 637 | else |
| 656 | − panic("drawterm: unsupported visual class %d\n", xvis->class); | |
| 638 | + panic("unsupported visual class %d", xvis->class); | |
| 657 | 639 | } |
| 658 | 640 | |
| 659 | 641 | static void |
| @@ -1163,7 +1145,7 @@ if(0) iprint("xselect target=%d requestor=%d property=%d selection=%d\n", · 503 unmodified lines | ||
| 1163 | 1145 | }else if(strcmp(name, "text/plain") == 0 || strcmp(name, "text/plain;charset=UTF-8") == 0){ |
| 1164 | 1146 | goto text; |
| 1165 | 1147 | }else |
| 1166 | − iprint("%s: cannot handle selection request for '%s' (%d)\n", argv0, name, (int)xe->target); | |
| 1148 | + iprint("cannot handle selection request for '%s' (%d)\n", name, (int)xe->target); | |
| 1167 | 1149 | } |
| 1168 | 1150 | r.xselection.property = None; |
| 1169 | 1151 | } |