#include <afsconfig.h>
#include <afs/param.h>
-RCSID("$Header$");
+RCSID
+ ("$Header$");
#include <sys/types.h>
#include <stddef.h>
#endif
#include <afs/cellconfig.h>
-PrintOneCell(ainfo, arock, adir)
-struct afsconf_cell *ainfo;
-char *arock;
-struct afsconf_dir *adir; {
+int
+PrintOneCell(struct afsconf_cell *ainfo, void *arock, struct afsconf_dir *adir)
+{
register int i;
long temp;
printf("Cell %s:\n", ainfo->name);
- for(i=0;i<ainfo->numServers;i++) {
- bcopy(&ainfo->hostAddr[i].sin_addr, &temp, sizeof(long));
- printf(" host %s at %x.%x\n", ainfo->hostName[i], temp, ainfo->hostAddr[i].sin_port);
+ for (i = 0; i < ainfo->numServers; i++) {
+ memcpy(&temp, &ainfo->hostAddr[i].sin_addr, sizeof(long));
+ printf(" host %s at %x.%x\n", ainfo->hostName[i], temp,
+ ainfo->hostAddr[i].sin_port);
}
return 0;
}
/*Main for testcellconfig*/
main(argc, argv)
-int argc;
-char *argv[];
+ int argc;
+ char *argv[];
{
struct afsconf_dir *theDir;
char tbuffer[1024];
char *dirName;
if (argc < 2) {
- printf("usage: testcellconfig <conf-dir-name> [<cell-to-display>]*\n");
+ printf
+ ("usage: testcellconfig <conf-dir-name> [<cell-to-display>]*\n");
exit(1);
}
printf("could not open configuration files in '%s'\n", dirName);
exit(1);
}
-
+
/* get the cell */
code = afsconf_GetLocalCell(theDir, tbuffer, sizeof(tbuffer));
if (code != 0) {
exit(1);
}
printf("Local cell is '%s'\n\n", tbuffer);
-
+
if (argc == 2) {
printf("About to print cell database contents:\n");
afsconf_CellApply(theDir, PrintOneCell, 0);
printf("Done.\n\n");
/* do this junk once */
printf("start of special test\n");
- code = afsconf_GetCellInfo(theDir, (char *) 0, "afsprot", &theCell);
- if (code) printf("failed to find afsprot service (%d)\n", code);
+ code = afsconf_GetCellInfo(theDir, NULL, "afsprot", &theCell);
+ if (code)
+ printf("failed to find afsprot service (%d)\n", code);
else {
printf("AFSPROT service:\n");
- PrintOneCell(&theCell, (char *) (char *) 0, theDir);
+ PrintOneCell(&theCell, NULL, theDir);
}
code = afsconf_GetCellInfo(theDir, 0, "bozotheclown", &theCell);
- if (code == 0) printf("unexpectedly found service 'bozotheclown'\n");
- code = afsconf_GetCellInfo(theDir, (char *) 0, "telnet", &theCell);
+ if (code == 0)
+ printf("unexpectedly found service 'bozotheclown'\n");
+ code = afsconf_GetCellInfo(theDir, NULL, "telnet", &theCell);
printf("Here's the telnet service:\n");
- PrintOneCell(&theCell, (char *) 0, theDir);
+ PrintOneCell(&theCell, NULL, theDir);
printf("done with special test\n");
- }
- else {
+ } else {
/* now print out specified cell info */
- for(i = 2; i<argc; i++) {
+ for (i = 2; i < argc; i++) {
code = afsconf_GetCellInfo(theDir, argv[i], 0, &theCell);
if (code) {
- printf("Could not find info for cell '%s', code %d\n", argv[i], code);
- }
- else PrintOneCell(&theCell, (char *) 0, theDir);
+ printf("Could not find info for cell '%s', code %d\n",
+ argv[i], code);
+ } else
+ PrintOneCell(&theCell, NULL, theDir);
}
}