deal with stderr in man
[xo.git] / man
blob0957e0824fce19ae9be06dbc2f64a9b452cd1a53
1 #!/usr/bin/python
2 # little man page getter for olpc (which doesn't have man installed)
4 import sys
5 from subprocess import *
6 from urllib import urlopen
8 url = 'http://man.linuxquestions.org/?query=%s&section=0&type=0'
10 if len(sys.argv) != 2:
11 print "What manual page do you want?"
12 else:
13 text = urlopen(url % (sys.argv[1])).read()
14 if text.count("\n"):
15 text = Popen(["echo", text], stdout=PIPE,stderr=PIPE)
16 Popen(["less"], stdin=text.stdout).wait()
17 else:
18 print text