From fca7f4728adba1bc3ad2f944f332c976836066b8 Mon Sep 17 00:00:00 2001 From: rupa Date: Sun, 30 Dec 2007 04:41:50 +0000 Subject: [PATCH] tweaks to man --- man | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/man b/man index 69f0653..d813428 100755 --- a/man +++ b/man @@ -7,10 +7,12 @@ from urllib import urlopen url = 'http://man.linuxquestions.org/?query=%s§ion=0&type=0' -if len(sys.argv) == 2: - text = urlopen(url % (sys.argv[1])).read() - p1 = Popen(["echo", text], stdout=PIPE) - p2 = Popen(["less"], stdin=p1.stdout) - p2.wait() +if len(sys.argv) != 2: + print "What manual page do you want?" else: - print "what man page do you want?" + text = urlopen(url % (sys.argv[1])).read() + if text.count("\n"): + text = Popen(["echo", text], stdout=PIPE) + Popen(["less"], stdin=text.stdout).wait() + else: + print text -- 2.11.4.GIT