1 | /********************************************************************** |
---|
2 | * File Exchange fxping client |
---|
3 | * |
---|
4 | * $Id: fxping.c,v 1.2 2002-03-13 17:06:41 zacheiss Exp $ |
---|
5 | * |
---|
6 | * Copyright 1990 by the Massachusetts Institute of Technology. |
---|
7 | * |
---|
8 | * For copying and distribution information, please see the file |
---|
9 | * <mit-copyright.h>. |
---|
10 | **********************************************************************/ |
---|
11 | |
---|
12 | #include <mit-copyright.h> |
---|
13 | |
---|
14 | #ifndef lint |
---|
15 | static char rcsid_fxping_c[] = "$Id: fxping.c,v 1.2 2002-03-13 17:06:41 zacheiss Exp $"; |
---|
16 | #endif /* lint */ |
---|
17 | |
---|
18 | #include <stdio.h> |
---|
19 | #include <string.h> |
---|
20 | #include <fx/fxcl.h> /* overrides #include <time.h> */ |
---|
21 | |
---|
22 | main(argc, argv) |
---|
23 | int argc; |
---|
24 | char *argv[]; |
---|
25 | { |
---|
26 | FX *fxp; |
---|
27 | long code; |
---|
28 | stringlist node; |
---|
29 | server_stats *stats; |
---|
30 | struct tm *tim; |
---|
31 | |
---|
32 | /* Initialization needed for com_err routines */ |
---|
33 | initialize_fxcl_error_table(); |
---|
34 | initialize_rpc_error_table(); |
---|
35 | initialize_fxsv_error_table(); |
---|
36 | initialize_krb_error_table(); |
---|
37 | fxp = fx_open("", &code); |
---|
38 | if (code) |
---|
39 | com_err(argv[0], code, "while connecting."); |
---|
40 | if (!fxp) |
---|
41 | exit(1); |
---|
42 | for (node = fx_host_list(); node != NULL; node = node->next) { |
---|
43 | strcpy(fxp->host, node->s); |
---|
44 | code = fx_connect(fxp); |
---|
45 | if (!code) |
---|
46 | fx_stat(fxp, &stats); |
---|
47 | else |
---|
48 | { |
---|
49 | printf("%16s down: %s\n", fxp->host, error_message(code)); |
---|
50 | continue; |
---|
51 | } |
---|
52 | |
---|
53 | tim = (struct tm *)gmtime(&stats->uptime); |
---|
54 | printf("%16s up %d days, %02d:%02d:%02d, DB %ld/%ld\n", fxp->host, |
---|
55 | tim->tm_yday, tim->tm_hour, tim->tm_min, tim->tm_sec, |
---|
56 | stats->vers.synctime, stats->vers.commit); |
---|
57 | } |
---|
58 | fx_close(fxp); |
---|
59 | exit(0); |
---|
60 | } |
---|