r5400: Slightly better handling of help messages in net tool.
[bbaumbach/samba-autobuild/.git] / source4 / utils / net / net_time.c
index e32ec76293a64ce64c44767662e5995e577fe631..ce7db4ab5c08462e6f36ddb79fb2de119e06d72a 100644 (file)
 */
 
 #include "includes.h"
+#include "libnet/libnet.h"
+#include "utils/net/net.h"
 #include "system/time.h"
 
 /*
  * Code for getting the remote time
  */
 
-
 int net_time(struct net_context *ctx, int argc, const char **argv)
 {
        NTSTATUS status;
@@ -39,8 +40,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
        if (argc > 0 && argv[0]) {
                server_name = argv[0];
        } else {
-               DEBUG(0,("net_time: server name needed!\n"));
-               return -1;
+               return net_time_usage(ctx, argc, argv);
        }
 
        libnetctx = libnet_context_init();
@@ -62,9 +62,9 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
                return -1;
        }
 
-       ZERO_ARRAY(timestr);
+       ZERO_STRUCT(timestr);
        tm = localtime(&r.generic.out.time);
-       sys_strftime(timestr, sizeof(timestr)-1, "%c %Z",tm);
+       strftime(timestr, sizeof(timestr)-1, "%c %Z",tm);
 
        printf("%s\n",timestr);
 
@@ -75,12 +75,12 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
 
 int net_time_usage(struct net_context *ctx, int argc, const char **argv)
 {
-       d_printf("net_time_usage: TODO\n");
+       d_printf("net time <server> [options]\n");
        return 0;       
 }
 
 int net_time_help(struct net_context *ctx, int argc, const char **argv)
 {
-       d_printf("net_time_help: TODO\n");
+       d_printf("Displays remote server's time.\n");
        return 0;       
 }