void afs_setacl(char *path, char *user, char *rights)
afs_setacl(char *path, char *user, char *rights)
void afs_setacl(char *path, char *user, char *rights){    struct Acl *acl;    struct AclEntry *position;    struct ViceIoctl a_params;    int i;    int newrights=0;    int foundit=0;    char *ptr;    char acltext[MAXSIZE];    char tmpstr[MAXSIZE];    if((acl=afs_getacl(path))==NULL)	exit(1);    if(!strcmp(rights,"read"))	newrights=PRSFS_READ | PRSFS_LOOKUP;    else if(!strcmp(rights,"write"))	newrights=PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE |	    PRSFS_DELETE | PRSFS_WRITE | PRSFS_LOCK;    else if(!strcmp(rights,"mail"))	newrights=PRSFS_INSERT | PRSFS_LOCK | PRSFS_LOOKUP;    else if(!strcmp(rights,"all"))	newrights=PRSFS_READ | PRSFS_LOOKUP | PRSFS_INSERT | PRSFS_DELETE |	    PRSFS_WRITE | PRSFS_LOCK | PRSFS_ADMINISTER;    else {	ptr=rights;	while(*ptr!=0) {	    if(*ptr=='r')		newrights|=PRSFS_READ;	    if(*ptr=='l')		newrights|=PRSFS_LOOKUP;	    if(*ptr=='i')		newrights|=PRSFS_INSERT;	    if(*ptr=='d')		newrights|=PRSFS_DELETE;	    if(*ptr=='w')		newrights|=PRSFS_WRITE;	    if(*ptr=='k')		newrights|=PRSFS_LOCK;	    if(*ptr=='a')		newrights|=PRSFS_ADMINISTER;	    ptr++;	}    }    position=acl->pos;    for(i=0; i<acl->NumPositiveEntries; i++) {	if(!strncmp(user, position->name, 100)) {	    position->RightsMask=newrights;	    foundit=1;	}	if(position->next)	    position=position->next;    }    if(!foundit) {	acl->NumPositiveEntries++;	/* We should already be at the last entry */	position->next=malloc(sizeof(struct AclEntry));	if(position->next==NULL) {	    printf("fs: Out of memory\n");	    exit(1);	}	position=position->next;	position->next=NULL;	strncpy(position->name, user, MAXNAME);	position->RightsMask=newrights;    }    sprintf(acltext,"%d\n%d\n", acl->NumPositiveEntries,	    acl->NumNegativeEntries);    position=acl->pos;    for(i=0; i<acl->NumPositiveEntries; i++) {	sprintf(tmpstr, "%s %d\n", position->name, position->RightsMask);	strcat(acltext,tmpstr);	position=position->next;    }    position=acl->neg;    for(i=0; i<acl->NumNegativeEntries; i++) {	sprintf(tmpstr, "%s %d\n", position->name, position->RightsMask);	strcat(acltext,tmpstr);	position=position->next;    }    a_params.in_size=strlen(acltext);    a_params.out_size=0;    a_params.in=acltext;    a_params.out=0;    if(k_pioctl(path,VIOCSETAL,&a_params,1)==-1) {	fserr(PROGNAME, errno, path);	return;    }    /*    free(oldacl);   and its contents */}