Annotation of 43BSD/ingres/source/iutil/setkey.c, revision 1.1.1.1

1.1       root        1: # include      <ingres.h>
                      2: # include      <symbol.h>
                      3: # include      <sccs.h>
                      4: 
                      5: SCCSID(@(#)setkey.c    8.1     12/31/84)
                      6: 
                      7: /*
                      8: **     Clearkeys - reset all key indicators in descriptor
                      9: **
                     10: **     Clearkeys is used to clear the key supplied
                     11: **     flags before calls to setkey
                     12: */
                     13: 
                     14: 
                     15: clearkeys(d)
                     16: register DESC  *d;
                     17: {
                     18:        register int    i;
                     19: 
                     20:        for (i = 0; i <= d->reldum.relatts; i++)
                     21:                d->relgiven[i] = 0;
                     22:        return (0);
                     23: }
                     24: /*
                     25: **  SETKEY - indicate a partial key for find
                     26: **
                     27: **     Setkey is used to set a key value into place
                     28: **     in a key. The key can be as large as the entire
                     29: **     tuple. Setkey moves the key value into the
                     30: **     proper place in the key and marks the value as
                     31: **     supplied
                     32: **
                     33: **     If the value is a null pointer, then the key is
                     34: **     cleared.
                     35: **
                     36: **     Clearkeys should be called once before the
                     37: **     first call to setkey.
                     38: */
                     39: 
                     40: setkey(d, key, value, dom)
                     41: register DESC  *d;
                     42: char           *key;
                     43: char           *value;
                     44: register int   dom;
                     45: {
                     46:        register int    len;
                     47:        char            *cp;
                     48: 
                     49: #      ifdef xATR1
                     50:        if (tTf(22, 8))
                     51:                printf("setkey: %.14s, %d\n", d->reldum.relid, dom);
                     52: #      endif
                     53: 
                     54:        /* check validity of domain number */
                     55:        if (dom < 1 || dom > d->reldum.relatts)
                     56:                syserr("setkey:rel=%12s,dom=%d", d->reldum.relid, dom);
                     57: 
                     58:        /* if value is null, clear key */
                     59:        if (value == 0)
                     60:        {
                     61:                d->relgiven[dom] = 0;
                     62:                return;
                     63:        }
                     64: 
                     65:        /* mark as given */
                     66:        d->relgiven[dom] = 1;
                     67: 
                     68:        len = d->relfrml[dom] & I1MASK;
                     69:        cp = &key[d->reloff[dom]];
                     70: 
                     71:        if (d->relfrmt[dom] == CHAR)
                     72:        {
                     73:                pmove(value, cp, len, ' ');
                     74:        }
                     75:        else
                     76:        {
                     77:                bmove(value, cp, len);
                     78:        }
                     79: }

unix.superglobalmegacorp.com

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