On Wed, 21 Aug 96 00:20:05 -0400 Marcus Watts wrote:
> I believe you are supplying the wrong parameters.
>
> It seems the output structure consists of an integer followed
> by the sysname; you probably ran it on a big-endian
> machine, so the first (high) byte of the output integer
> was 0 - a null string.
Thanks! You are absolutely correct, this fixes the problem. I don't
have the AFS docs right in front of me (they're at work), but I don't
recall any language in them that indicated this was necessary. This
sort of inconsistency (e.g. compared to the AFS_WS_GETCELL call) seems
common in the AFS libraries. Sometimes I'm amazed that they got it
all to work...; :^)
-- Garrett
>
> I found a test program that happens to use just this: (the
> use of lpioctl is because I didn't care if it couldn't run on an
> NFS client...)
>
> =============== sy.c
> #include <afs/param.h>
> #include <sys/types.h>
> #include <netinet/in.h>
> #include <afs/venus.h>
> main()
> {
> struct ViceIoctl blob;
> struct {
> int32 setp;
> char data[512];
> } space;
> long code;
>
> space.setp = 0;
> blob.in = (char*)&space;
> blob.out = (char*)&space;
> blob.out_size = sizeof space;
> blob.in_size = sizeof space.setp;
> code = lpioctl(0, VIOC_AFS_SYSNAME, &blob, 1);
> if (code)
> printf ("sysname failed: %s\n", error_message(code));
> else if (!space.setp)
> printf ("no sysname value was found\n");
> else printf ("Current sysname is <%s>\n", space.data);
> exit(0);
> }
> =============== Makefile
> AFS=your AFS client library & include area/
> sy: sy.o
> cc -o sy sy.o ${AFS}lib/afs/libsys.a ${AFS}lib/afs/libcom_err.a
> sy.o: sy.c
> cc -I${AFS}include -c afs sy.c
> ===============
>
> -Marcus
>