Annotation of xinu/sys/ckmode.c, revision 1.1.1.1

1.1       root        1: /* ckmode.c - ckmode */
                      2: 
                      3: #include <conf.h>
                      4: #include <kernel.h>
                      5: #include <file.h>
                      6: 
                      7: /*------------------------------------------------------------------------
                      8:  *  ckmode  --  parse open's mode argument and generate actual mode bits
                      9:  *------------------------------------------------------------------------
                     10:  */
                     11: ckmode(mode)
                     12: char   *mode;
                     13: {
                     14:        int     mbits;
                     15:        char    ch;
                     16: 
                     17:        mbits = 0;
                     18:        while (ch = *mode++)
                     19:                switch (ch) {
                     20: 
                     21:                    case FLRMODE:
                     22:                                if (mbits&FLREAD) return(SYSERR);
                     23:                                mbits |= FLREAD;
                     24:                                break;
                     25: 
                     26:                    case FLWMODE:
                     27:                                if (mbits&FLWRITE) return(SYSERR);
                     28:                                mbits |= FLWRITE;
                     29:                                break;
                     30: 
                     31:                    case FLOMODE:
                     32:                                if (mbits&FLOLD || mbits&FLNEW)
                     33:                                        return(SYSERR);
                     34:                                mbits |= FLOLD;
                     35:                                break;
                     36: 
                     37:                    case FLNMODE:
                     38:                                if (mbits&FLOLD || mbits&FLNEW)
                     39:                                        return(SYSERR);
                     40:                                mbits |= FLNEW;
                     41:                                break;
                     42: 
                     43:                    default:    return(SYSERR);
                     44:                }
                     45:        if ((mbits&FLREAD) == (mbits&FLWRITE))  /* default: allow R + W */
                     46:                mbits |= FLRW;
                     47:        return(mbits);
                     48: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.