2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
9 * Portions Copyright (c) 2003 Apple Computer, Inc.
13 * This file contains sample code for the client admin interface
16 #include <afsconfig.h>
17 #include <afs/param.h>
26 #include <rx/rxstat.h>
28 #include <afs/afs_Admin.h>
29 #include <afs/afs_clientAdmin.h>
30 #include <afs/afs_utilAdmin.h>
35 fprintf(stderr
, "Usage: cm_local_cell <host> <port>\n");
40 ParseArgs(int argc
, char *argv
[], char **srvrName
, long *srvrPort
)
46 *srvrName
= *(argp
++);
49 *srvrPort
= strtol(*(argp
++), NULL
, 0);
50 if (*srvrPort
<= 0 || *srvrPort
>= 65536)
57 main(int argc
, char *argv
[])
61 struct rx_connection
*conn
;
65 afs_CMCellName_t cellName
;
67 ParseArgs(argc
, argv
, &srvrName
, &srvrPort
);
69 rc
= afsclient_Init(&st
);
71 fprintf(stderr
, "afsclient_Init, status %d\n", st
);
75 rc
= afsclient_NullCellOpen(&cellHandle
, &st
);
77 fprintf(stderr
, "afsclient_NullCellsOpen, status %d\n", st
);
81 rc
= afsclient_CMStatOpenPort(cellHandle
, srvrName
, srvrPort
, &conn
, &st
);
83 fprintf(stderr
, "afsclient_CMStatOpenPort, status %d\n", st
);
87 rc
= util_CMLocalCell(conn
, cellName
, &st
);
89 fprintf(stderr
, "util_CMLocalCell, status %d\n", st
);
93 rc
= afsclient_CMStatClose(conn
, &st
);
95 fprintf(stderr
, "afsclient_CMStatClose, status %d\n", st
);
99 rc
= afsclient_CellClose(cellHandle
, &st
);
101 fprintf(stderr
, "afsclient_CellClose, status %d\n", st
);
106 printf("Client %s (port %ld) is in cell %s\n", srvrName
, srvrPort
,