OSSP CVS Repository

ossp - Check-in [1105]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 1105
Date: 2001-Oct-08 16:30:11 (local)
2001-Oct-08 14:30:11 (UTC)
User:thl
Branch:
Comment: -a option now supports both unix:/ and inet:// URLs. It tries to guess missing prefixes.
Tickets:
Inspections:
Files:
ossp-pkg/lmtp2nntp/lmtp2nntp.c      1.67 -> 1.68     23 inserted, 5 deleted
ossp-pkg/lmtp2nntp/lmtp2nntp.pod      1.23 -> 1.24     3 inserted, 1 deleted

ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.67 -> 1.68

--- lmtp2nntp.c  2001/10/08 13:40:22     1.67
+++ lmtp2nntp.c  2001/10/08 14:30:11     1.68
@@ -401,13 +401,31 @@
         switch (i) {
             case 'a': /*POD [B<-a> I<altio>] */
                 if ((rc = sa_addr_create(&ctx->saaAltio)) != SA_OK) {
-                    fprintf(stderr, "%s:Error: Creating address failed for -i option (%d)\n", 
+                    fprintf(stderr, "%s:Error: Creating address failed for -a option (%d)\n", 
                             ctx->progname, rc);
                 }
-                if ((rc = sa_addr_u2a(ctx->saaAltio, "inet://%s", optarg)) != SA_OK) {
-                    fprintf(stderr, "%s:Error: Parsing inputbind address failed for \"%s\" (%d)\n", 
-                            ctx->progname, optarg, rc);
-                    CU(ERR_EXECUTION);
+                if ((strncasecmp(optarg, "inet://", 7) == 0) ||
+                    (strncasecmp(optarg, "unix:/" , 6) == 0)   ) {
+                    if ((rc = sa_addr_u2a(ctx->saaAltio, "%s", optarg)) != SA_OK) {
+                        fprintf(stderr, "%s:Error: Parsing alternate IO URL failed for \"%s\" (%d)\n", 
+                                ctx->progname, optarg, rc);
+                        CU(ERR_EXECUTION);
+                    }
+                } else {
+                    if (optarg[0] == '/') {
+                        if ((rc = sa_addr_u2a(ctx->saaAltio, "unix:%s", optarg)) != SA_OK) {
+                            fprintf(stderr, "%s:Error: Parsing alternate IO guessing UNIX domain socket failed for \"%s\" (%d)\n", 
+                                    ctx->progname, optarg, rc);
+                            CU(ERR_EXECUTION);
+                        }
+                    }
+                    else {
+                        if ((rc = sa_addr_u2a(ctx->saaAltio, "inet://%s", optarg)) != SA_OK) {
+                            fprintf(stderr, "%s:Error: Parsing alternate IO guessing INET socket failed for \"%s\" (%d)\n", 
+                                    ctx->progname, optarg, rc);
+                            CU(ERR_EXECUTION);
+                        }
+                    }
                 }
                 if ((rc = sa_create(&ctx->saAltio)) != SA_OK) {
                     fprintf(stderr, "%s:Error: Creating TCP socket failed for \"%s\": %s\n", 


ossp-pkg/lmtp2nntp/lmtp2nntp.pod 1.23 -> 1.24

--- lmtp2nntp.pod        2001/10/08 13:50:01     1.23
+++ lmtp2nntp.pod        2001/10/08 14:30:11     1.24
@@ -117,7 +117,9 @@
 
 Alternate IO allows reading and writing from/to a UNIX domain or TCP sockets
 instead stdin/stdout. This places the program in daemon mode. The syntax for
-altio is either "unix:/path/to/socket" or "inet://address:port".
+altio is either "unix:/path/to/socket" or "inet://address:port". If "unix:/"
+and "inet://" prefixes are ommited the program tries to guess the desired mode
+based on the existing of a leading slash.
 
 =item B<-m> I<mailfrom>
 

CVSTrac 2.0.1