changeset 114:af7bea7515b2 noffle

[svn] --post simplification.
author bears
date Sat, 24 Jun 2000 21:36:38 +0100
parents 70bd4379b233
children 3b4db42990e0
files src/noffle.c
diffstat 1 files changed, 9 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/src/noffle.c	Sat Jun 24 21:30:45 2000 +0100
+++ b/src/noffle.c	Sat Jun 24 21:36:38 2000 +0100
@@ -10,7 +10,7 @@
   received for some seconds (to allow multiple clients connect at the same
   time).
 
-  $Id: noffle.c 135 2000-06-05 08:57:05Z bears $
+  $Id: noffle.c 158 2000-06-24 20:36:38Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <getopt.h>
 #include <signal.h>
+#include <sys/time.h>
 #include <sys/resource.h>
 #include <syslog.h>
 #include <unistd.h>
@@ -176,7 +177,7 @@
 }
 
 static Bool
-doPost( Bool localOnly )
+doPost()
 {
     Str line;
     DynStr *s;
@@ -193,7 +194,7 @@
 	fprintf( stderr, "Post failed: Malformed article.\n" );
 	res = FALSE;
     }
-    else if ( ! Post_post( localOnly ) )
+    else if ( ! Post_post() )
     {
 	fprintf( stderr, "Post failed: Can't post to group.\n" );
 	res = FALSE;
@@ -528,8 +529,7 @@
       " -m | --modify post <grp> (y|n)   Modify posting status of a local group\n"
       " -n | --online                    Switch to online mode\n"
       " -o | --offline                   Switch to offline mode\n"
-      " -p | --post all                  Post article on stdin to all groups\n"
-      " -p | --post local                Post article on stdin to local groups\n"
+      " -p | --post                      Post article on stdin\n"
       " -q | --query groups              Get group list from server\n"
       " -q | --query desc                Get group descriptions from server\n"
       " -q | --query times               Get group creation times from server\n"
@@ -650,7 +650,7 @@
         { "modify",           required_argument, NULL, 'm' },
         { "offline",          no_argument,       NULL, 'o' },
         { "online",           no_argument,       NULL, 'n' },
-        { "post",             required_argument, NULL, 'p' },
+        { "post",             no_argument, 	 NULL, 'p' },
         { "query",            required_argument, NULL, 'q' },
         { "server",           no_argument,       NULL, 'r' },
         { "requested",        no_argument,       NULL, 'R' },
@@ -669,7 +669,7 @@
     signal( SIGINT, logSignal );
     signal( SIGTERM, logSignal );
     signal( SIGPIPE, logSignal );
-    c = getopt_long( argc, argv, "a:c:C:dD:efghlm:onp:q:rRs:S:t:u:v",
+    c = getopt_long( argc, argv, "a:c:C:dD:efghlm:onpq:rRs:S:t:u:v",
                      longOptions, NULL );
     if ( ! initNoffle( c != 'r' ) )
         return EXIT_FAILURE;
@@ -757,26 +757,8 @@
             Online_set( FALSE );
         break;
     case 'p':
-        if ( ! optarg )
-        {
-            fprintf( stderr, "Option -p needs argument.\n" );
-            result = EXIT_FAILURE;
-        }
-        else
-        {
-	    Bool local;
-	    
-	    local = FALSE;
-            if ( strcmp( optarg, "local" ) == 0 )
-                local = TRUE;
-            else if ( strcmp( optarg, "all" ) != 0 )
-            {
-                fprintf( stderr, "Unknown argument -p %s\n", optarg );
-                result = EXIT_FAILURE;
-            }
-            if ( ! doPost( local ) )
-		result = EXIT_FAILURE;
-        }
+	if ( ! doPost() )
+	    result = EXIT_FAILURE;
         break;
     case 'q':
         if ( ! optarg )