source: trunk/athena/etc/listsuidcells/listsuidcells.c @ 12350

Revision 12350, 1.1 KB checked in by ghudson, 26 years ago (diff)
Some RCS ID cleanup: delete $Log$ and replace other RCS keywords with $Id$.
Line 
1/* $Id: listsuidcells.c,v 1.5 1999-01-22 23:15:48 ghudson Exp $
2 * Created by Greg Hudson.
3 * Copyright (c) 1996 by the Massachusetts Institute of Technology.
4 */
5
6#include <stdio.h>
7#include <errno.h>
8#include <sys/types.h>
9#include <sys/ioctl.h>
10#ifdef HAVE_SYS_FILIO_H
11#include <sys/filio.h>
12#endif
13#include <netinet/in.h>
14#include <afs/param.h>
15#include <afs/stds.h>
16#include <afs/afs.h>
17#include <afs/venus.h>
18
19static void try_cell(char *name);
20
21int main(int argc, char **argv)
22{
23    int32 i;
24    char out[2048];
25    struct ViceIoctl ioc;
26   
27    for (i = 0; i < 1000; i++) {
28        ioc.in = (caddr_t) &i;
29        ioc.in_size = sizeof(i);
30        ioc.out = (caddr_t) out;
31        ioc.out_size = sizeof(out);
32        if (pioctl(0, VIOCGETCELL, &ioc, 1) < 0)
33            exit((errno == EDOM) ? 0 : 1);
34        try_cell(out + OMAXHOSTS * sizeof(int32));
35    }
36    return 0;
37}
38
39static void try_cell(char *name)
40{
41    int32 out[2];
42    struct ViceIoctl ioc;
43   
44    ioc.in = (caddr_t) name;
45    ioc.in_size = strlen(name) + 1;
46    ioc.out = (caddr_t) out;
47    ioc.out_size = sizeof(out);
48    pioctl(0, VIOC_GETCELLSTATUS, &ioc, 1);
49    if (!(out[0] & 2))
50        printf("%s\n", name);
51}
52
Note: See TracBrowser for help on using the repository browser.