about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--event.c2
-rw-r--r--main.c40
2 files changed, 14 insertions, 28 deletions
diff --git a/event.c b/event.c
index aa07427..ab57024 100644
--- a/event.c
+++ b/event.c
@@ -23,7 +23,7 @@ typedef struct {
 const char *browse[] = { "firefox", NULL };
 const char *gimp[] = { "gimp", NULL };
 const char *term[] = { 
-	"urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
+	"urxvt", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
 	"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
 };
 const char *xlock[] = { "xlock", NULL };
diff --git a/main.c b/main.c
index dc8a6e7..db36536 100644
--- a/main.c
+++ b/main.c
@@ -166,22 +166,17 @@ main(int argc, char *argv[])
 	int i, n;
 	unsigned int mask;
 	fd_set rd;
-	Bool readstdin = True;
+	Bool readin = True;
 	Window w;
 	XEvent ev;
 	XSetWindowAttributes wa;
 
-	for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) {
-		switch (argv[i][1]) {
-		default:
-			eprint("usage: dwm [-v]\n");
-			break;
-		case 'v':
-			fputs("dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
-			exit(EXIT_SUCCESS);
-			break;
-		}
+	if(argc == 2 && !strncmp("-v", argv[1], 3)) {
+		fputs("dwm-"VERSION", (C)opyright MMVI Anselm R. Garbe\n", stdout);
+		exit(EXIT_SUCCESS);
 	}
+	else if(argc != 1)
+		eprint("usage: dwm [-v]\n");
 
 	dpy = XOpenDisplay(0);
 	if(!dpy)
@@ -256,10 +251,9 @@ main(int argc, char *argv[])
 	scan();
 
 	/* main event loop, reads status text from stdin as well */
-Mainloop:
 	while(running) {
 		FD_ZERO(&rd);
-		if(readstdin)
+		if(readin)
 			FD_SET(STDIN_FILENO, &rd);
 		FD_SET(ConnectionNumber(dpy), &rd);
 
@@ -276,20 +270,12 @@ Mainloop:
 						(handler[ev.type])(&ev); /* call handler */
 				}
 			}
-			if(readstdin && FD_ISSET(STDIN_FILENO, &rd)) {
-				i = n = 0;
-				for(;;) {
-					if((i = getchar()) == EOF) {
-						/* broken pipe/end of producer */
-						readstdin = False;
-						strcpy(stext, "broken pipe");
-						goto Mainloop;
-					}
-					if(i == '\n' || n >= sizeof(stext) - 1)
-						break;
-					stext[n++] = i;
-				}
-				stext[n] = 0;
+			if(readin && FD_ISSET(STDIN_FILENO, &rd)) {
+				readin = NULL != fgets(stext, sizeof(stext), stdin);
+				if(readin)
+					stext[strlen(stext) - 1] = 0;
+				else 
+					strcpy(stext, "broken pipe");
 				drawstatus();
 			}
 		}
0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Mu - 083scenario_screen_test.mu</title>
<meta name="Generator" content="Vim/7.4">
<meta name="plugin-version" content="vim7.4_v2">
<meta name="syntax" content="none">
<meta name="settings" content="use_css,pre_wrap,no_foldcolumn,expand_tabs,prevent_copy=">
<meta name="colorscheme" content="minimal">
<style type="text/css">
<!--
pre { white-space: pre-wrap; font-family: monospace; color: #eeeeee; background-color: #080808; }
body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color: #080808; }
* { font-size: 12pt; font-size: 1em; }
.Comment { color: #9090ff; }
.Constant { color: #00a0a0; }
.Special { color: #c00000; }
.muScenario { color: #00af00; }
-->
</style>

<script type='text/javascript'>
<!--

-->
</script>
</head>
<body>
<pre id='vimCodeElement'>
<span class="Comment"># To check our support for screens in scenarios, rewrite tests from print.mu</span>

<span class="muScenario">scenario</span> print-character-at-top-left-2 [
  <span class="Constant">local-scope</span>
  assume-screen <span class="Constant">3/width</span>, <span class="Constant">2/height</span>
  run [
    a:char<span class="Special"> &lt;- </span>copy <span class="Constant">97/a</span>
    screen:&amp;:screen<span class="Special"> &lt;- </span>print screen:&amp;:screen, a
  ]
  screen-should-contain [
   <span class="Constant"> .a  .</span>
   <span class="Constant"> .   .</span>
  ]
]

<span class="muScenario">scenario</span> clear-line-erases-printed-characters-2 [
  <span class="Constant">local-scope</span>
  assume-screen <span class="Constant">5/width</span>, <span class="Constant">3/height</span>
  <span class="Comment"># print a character</span>
  a:char<span class="Special"> &lt;- </span>copy <span class="Constant">97/a</span>
  screen:&amp;:screen<span class="Special"> &lt;- </span>print screen:&amp;:screen, a
  <span class="Comment"># move cursor to start of line</span>
  screen:&amp;:screen<span class="Special"> &lt;- </span>move-cursor screen:&amp;:screen, <span class="Constant">0/row</span>, <span class="Constant">0/column</span>
  run [
    screen:&amp;:screen<span class="Special"> &lt;- </span>clear-line screen:&amp;:screen
  ]
  screen-should-contain [
   <span class="Constant"> .     .</span>
   <span class="Constant"> .     .</span>
   <span class="Constant"> .     .</span>
  ]
]
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->