~ubuntu-branches/ubuntu/gutsy/postnews/gutsy

« back to all changes in this revision

Viewing changes to postnews

  • Committer: Bazaar Package Importer
  • Author(s): Peter Karlsson
  • Date: 2003-07-13 14:00:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20030713140000-06feauebvsx7elph
Tags: 0.5.3-2
Removed mention of non-existant info files from manual page.
(Closes: Bug#187066)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
 
# postnews 0.5.1 - post a usenet article
 
3
# postnews 0.5.3 - post a usenet article
4
4
#
5
5
# (C) 2001 by Michael Waschbuesch <waschbuesch@users.sourceforge.net>
6
6
# http://sourceforge.net/projects/postnews/
19
19
def main():
20
20
        #get arguments and options
21
21
        try:
22
 
                opts, args = getopt.getopt(sys.argv[1:], "hf:p:v", ["help", "file=", "port=", "user=", "pass=", "verbose"])
 
22
                opts, args = getopt.getopt(sys.argv[1:], "hf:p:vr", ["help", "file=", "port=", "user=", "pass=", "verbose", "readermode"])
23
23
        except:
24
24
                usage()
25
25
                sys.exit(2)
37
37
        user = ""
38
38
        password = ""
39
39
        verbose = 0
 
40
        readermode = None
40
41
        
41
42
        for o, a in opts:
42
43
                if o in ("-h", "--help"):
62
63
                        password = a
63
64
                if o in ("-v", "--verbose"):
64
65
                        verbose = 1
 
66
                if o in ("-r", "--readermode"):
 
67
                        readermode = 1
65
68
                        
66
69
        #post message
67
70
        if verbose:
68
71
                print "Connecting to Server..."
69
72
        try:
70
 
                s = nntplib.NNTP(server, port, user, password)
 
73
                s = nntplib.NNTP(server, port, user, password, readermode)
71
74
        except Exception, e:    # it can throw a class exception...
72
75
                sys.stderr.write("Can't connect to server: "+server+"\n")
73
76
                sys.stderr.write(str(e)+"\n")
94
97
 
95
98
 
96
99
def usage():
97
 
        print "postnews 0.5.1 - (C) 2001 by Michael Waschbuesch <MichaelWaschbuesch@web.de>"
 
100
        print "postnews 0.5.3 - (C) 2001 by Michael Waschbuesch <MichaelWaschbuesch@web.de>"
98
101
        print ""
99
 
        print "Usage: postnews [OPTIONS] [SERVER]"
 
102
        print "Usage: postnews [OPTIONS] SERVER"
100
103
        print "Post a usenet article (including headers) from stdin onto SERVER."
101
104
        print "Article must at least contain the headers 'From:', 'Newsgroups:' and 'Subject:',"
102
105
        print "a newline and a body."
103
106
        print ""
104
 
        print "Options: -h, --help      display this text"
105
 
        print "         -v, --verbose   be verbose"
106
 
        print "         -f, --file=FILE read file instead of stdin"
107
 
        print "         -p, --port      port number"
108
 
        print "             --user      user name"
109
 
        print "             --pass      password"
 
107
        print "Options: -h, --help          display this text"
 
108
        print "         -v, --verbose       be verbose"
 
109
        print "         -f, --file=FILE     read file instead of stdin"
 
110
        print "         -p, --port=PORT     port number"
 
111
        print "             --user=NAME     user name"
 
112
        print "             --pass=PASSWD   password"
 
113
        print "         -r, --readermode    send MODE READER before authentication"
110
114
 
111
115
 
112
116