summaryrefslogtreecommitdiff
path: root/source3/utils/net_time.c
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2008-05-09 23:22:12 +0200
committerKai Blin <kai@samba.org>2008-05-10 09:22:27 +0200
commitf5769109447d8da0f09b102d444a816ad97a00dc (patch)
treefe7b470486ace083b3f48a54334a3db0bb9633d2 /source3/utils/net_time.c
parent378527215e663c0c9d36c565a16723e0a1979ea0 (diff)
downloadsamba-f5769109447d8da0f09b102d444a816ad97a00dc.tar.gz
samba-f5769109447d8da0f09b102d444a816ad97a00dc.tar.bz2
samba-f5769109447d8da0f09b102d444a816ad97a00dc.zip
net: Remove globals
(This used to be commit 1e9319cf88b65a2a8d4f5099a1fe5297e405ed2e)
Diffstat (limited to 'source3/utils/net_time.c')
-rw-r--r--source3/utils/net_time.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/source3/utils/net_time.c b/source3/utils/net_time.c
index 7375206af6..48417fbc0f 100644
--- a/source3/utils/net_time.c
+++ b/source3/utils/net_time.c
@@ -14,8 +14,8 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
#include "includes.h"
#include "utils/net.h"
@@ -68,9 +68,10 @@ done:
}
/* find the servers time on the opt_host host */
-static time_t nettime(int *zone)
+static time_t nettime(struct net_context *c, int *zone)
{
- return cli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, zone);
+ return cli_servertime(c->opt_host,
+ c->opt_have_ip? &c->opt_dest_ip : NULL, zone);
}
/* return a time as a string ready to be passed to /bin/date */
@@ -90,7 +91,7 @@ static const char *systime(time_t t)
return s;
}
-int net_time_usage(int argc, const char **argv)
+int net_time_usage(struct net_context *c, int argc, const char **argv)
{
d_printf(
"net time\n\tdisplays time on a server\n\n"\
@@ -98,14 +99,14 @@ int net_time_usage(int argc, const char **argv)
"net time set\n\truns /bin/date with the time from the server\n\n"\
"net time zone\n\tdisplays the timezone in hours from GMT on the remote computer\n\n"\
"\n");
- net_common_flags_usage(argc, argv);
+ net_common_flags_usage(c, argc, argv);
return -1;
}
/* try to set the system clock using /bin/date */
-static int net_time_set(int argc, const char **argv)
+static int net_time_set(struct net_context *c, int argc, const char **argv)
{
- time_t t = nettime(NULL);
+ time_t t = nettime(c, NULL);
char *cmd;
int result;
@@ -125,9 +126,9 @@ static int net_time_set(int argc, const char **argv)
}
/* display the time on a remote box in a format ready for /bin/date */
-static int net_time_system(int argc, const char **argv)
+static int net_time_system(struct net_context *c, int argc, const char **argv)
{
- time_t t = nettime(NULL);
+ time_t t = nettime(c, NULL);
if (t == 0) return -1;
@@ -137,14 +138,14 @@ static int net_time_system(int argc, const char **argv)
}
/* display the time on a remote box in a format ready for /bin/date */
-static int net_time_zone(int argc, const char **argv)
+static int net_time_zone(struct net_context *c, int argc, const char **argv)
{
int zone = 0;
int hours, mins;
char zsign;
time_t t;
- t = nettime(&zone);
+ t = nettime(c, &zone);
if (t == 0) return -1;
@@ -161,7 +162,7 @@ static int net_time_zone(int argc, const char **argv)
}
/* display or set the time on a host */
-int net_time(int argc, const char **argv)
+int net_time(struct net_context *c, int argc, const char **argv)
{
time_t t;
struct functable func[] = {
@@ -171,20 +172,21 @@ int net_time(int argc, const char **argv)
{NULL, NULL}
};
- if (!opt_host && !opt_have_ip &&
- !find_master_ip(opt_target_workgroup, &opt_dest_ip)) {
+ if (!c->opt_host && !c->opt_have_ip &&
+ !find_master_ip(c->opt_target_workgroup, &c->opt_dest_ip)) {
d_fprintf(stderr, "Could not locate a time server. Try "\
"specifying a target host.\n");
- net_time_usage(argc,argv);
+ net_time_usage(c, argc,argv);
return -1;
}
if (argc != 0) {
- return net_run_function(argc, argv, func, net_time_usage);
+ return net_run_function(c, argc, argv, func, net_time_usage);
}
/* default - print the time */
- t = cli_servertime(opt_host, opt_have_ip? &opt_dest_ip : NULL, NULL);
+ t = cli_servertime(c->opt_host, c->opt_have_ip? &c->opt_dest_ip : NULL,
+ NULL);
if (t == 0) return -1;
d_printf("%s", ctime(&t));