00001
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #include <SUM.h>
00054 #include <soi_key.h>
00055 #include <rpc/rpc.h>
00056 #include <sum_rpc.h>
00057
00058 void usage()
00059 {
00060 printf("Queries the sum_svc.\n");
00061 printf("Prints out 0 if a user is still opened in SUMS and you\n");
00062 printf("should wait for it to close before you shut down SUMS.\n");
00063 printf("Else prints 1.\n");
00064 printf("Normal call will turn off new SUM_open() calls in sum_svc.\n");
00065 printf("Call with -q to not turn off new SUM_open() or to reenable if\n");
00066 printf("already turned off.\n");
00067 exit(0);
00068 }
00069
00070 int main(int argc, char *argv[])
00071 {
00072 int shutmode, c;
00073 int queryonly = 0;
00074
00075 while((--argc > 0) && ((*++argv)[0] == '-')) {
00076 while((c = *++argv[0])) {
00077 switch(c) {
00078 case 'q':
00079 queryonly=1;
00080 break;
00081 case 'h':
00082 usage();
00083 break;
00084 default:
00085 usage();
00086 break;
00087 }
00088 }
00089 }
00090 if((shutmode = SUM_shutdown(queryonly, printf)) == 0) {
00091 printf("0\n");
00092 if(queryonly)
00093 printf("Don't shutdown. A SUM_open() is still active. New opens still allowed\n");
00094 else
00095 printf("Don't shutdown. A SUM_open() is still active. New opens not allowed\n");
00096 }
00097 else {
00098 printf("1\n");
00099 if(queryonly)
00100 printf("No active opens in SUMS, New opens still allowed\n");
00101 else
00102 printf("Ok to shutdown SUMS, New opens in sum_svc not allowed\n");
00103 }
00104 }