1  extern struct win *windows, *wtab[];
       2  struct win
       3  {
       4    struct win *w_next;
       5  };
       6  
       7  struct auser;
       8  
       9  struct comm
      10  {
      11    char *name;
      12    int flags;
      13  };
      14  
      15  extern struct comm comms[];
      16  
      17  extern int WindowByNoN (char *);
      18  extern int FindCommnr (char *);
      19  extern int AclSetPermCmd (struct auser *, char *, struct comm *);
      20  extern int AclSetPermWin (struct auser *, struct auser *, char *, struct win *);
      21  
      22  
      23  int
      24    AclSetPerm(uu, u, mode, s)
      25      struct auser *uu, *u;
      26  char *mode, *s;
      27  {
      28    struct win *w;
      29    int i;
      30    char *p, ch;
      31  
      32    do 
      33      {
      34      }
      35    while (0);
      36  
      37    while (*s)
      38      {
      39        switch (*s)
      40  	{  
      41  	case '*':
      42  	  return AclSetPerm(uu, u, mode, "#?");
      43  	case '#':
      44  	  if (uu)
      45  	    AclSetPermWin(uu, u, mode, (struct win *)1);
      46  	  else
      47  	    for (w = windows; w; w = w->w_next)
      48  	      AclSetPermWin((struct auser *)0, u, mode, w);
      49  	  s++;
      50  	  break;
      51  	case '?':
      52  	  if (uu)
      53  	    AclSetPermWin(uu, u, mode, (struct win *)0);
      54  	  else
      55  	    for (i = 0; i <= 174; i++)
      56  	      AclSetPermCmd(u, mode, &comms[i]);
      57  	  s++;
      58  	  break;
      59  	default:
      60  	  for (p = s; *p && *p != ' ' && *p != '\t' && *p != ','; p++)
      61  	    ;
      62  	  if ((ch = *p))
      63  	    *p++ = '\0';
      64  	  if ((i = FindCommnr(s)) != -1)
      65  	    AclSetPermCmd(u, mode, &comms[i]);
      66  	  else if (((i = WindowByNoN(s)) >= 0) && wtab[i])
      67  	    AclSetPermWin((struct auser *)0, u, mode, wtab[i]);
      68  	  else
      69  	    return -1;
      70  	  if (ch)
      71  	    p[-1] = ch;
      72  	  s = p;
      73  	}
      74      }
      75  
      76    return 0;
      77  }