Annotation of 43BSDReno/contrib/isode-beta/quipu/dish/compare.c, revision 1.1

1.1     ! root        1: /* compare.c - */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/compare.c,v 7.0 89/11/23 22:19:58 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/quipu/dish/RCS/compare.c,v 7.0 89/11/23 22:19:58 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       compare.c,v $
        !            12:  * Revision 7.0  89/11/23  22:19:58  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: #include "quipu/util.h"
        !            29: #include "quipu/compare.h"
        !            30: 
        !            31: extern DN       dn;
        !            32: 
        !            33: #define        OPT     (!frompipe || rps -> ps_byteno == 0 ? opt : rps)
        !            34: #define        RPS     (!frompipe || opt -> ps_byteno == 0 ? rps : opt)
        !            35: extern char    frompipe;
        !            36: extern PS      opt, rps;
        !            37: 
        !            38: call_compare (argc, argv)
        !            39: int             argc;
        !            40: char          **argv;
        !            41: {
        !            42:        struct DSError  error;
        !            43:        struct ds_compare_result result;
        !            44:        struct ds_compare_arg compare_arg;
        !            45:        
        !            46:        int             x;
        !            47:        int             att_present = 0;
        !            48:        int             print = FALSE;
        !            49:        char           *str1_type;
        !            50:        char           *str1_value;
        !            51:        char           *ptr;
        !            52: 
        !            53:        if ((argc = service_control (OPT, argc, argv, &compare_arg.cma_common)) == -1)
        !            54:                return;
        !            55: 
        !            56:        if (argc == 1) {
        !            57:                ps_print (OPT,"What do you want to compare ?\n");
        !            58:                Usage (argv[0]);
        !            59:                return;
        !            60:        }
        !            61:        
        !            62:        for (x = 1; x < argc; x++) {
        !            63:                if (test_arg (argv[x],"-attribute",1)) {
        !            64:                        str1_type = argv[++x];
        !            65:                        att_present = 1;
        !            66:                } else if (test_arg (argv[x], "-print",3)) {
        !            67:                        print = TRUE;
        !            68:                } else if (test_arg (argv[x], "-noprint",3)) {
        !            69:                        print = FALSE;
        !            70:                } else if (move (argv[x]) == OK)
        !            71:                        continue;
        !            72:                else {
        !            73:                        if (*argv[x] == '-')
        !            74:                                ps_printf (OPT,"Unknown option %s\n",argv[x]);
        !            75:                        else
        !            76:                                ps_printf (OPT,"Invalid attribute assertion syntax %s\n",argv[x]);
        !            77:                        Usage (argv[0]);
        !            78:                        return;
        !            79:                }
        !            80:        }
        !            81: 
        !            82:        if (att_present == 0) {
        !            83:                ps_printf (OPT, "We are missing <attribute_type>=<attribute_value>.\n");
        !            84:                Usage (argv[0]);
        !            85:                return;
        !            86:        }
        !            87:        ptr = str1_type;
        !            88:        while (*ptr != '=') {
        !            89:                ptr++;
        !            90:        }
        !            91:        *ptr++ = '\0';
        !            92:        str1_value = ptr;
        !            93:        if (get_ava (&compare_arg.cma_purported, str1_type, str1_value) != OK) {
        !            94:                Usage (argv[0]);
        !            95:                return;
        !            96:        }
        !            97:        compare_arg.cma_object = dn;
        !            98: 
        !            99:        if (rebind () != OK)
        !           100:                return;
        !           101: 
        !           102:        /* Strong authentication */
        !           103:        if (compare_arg.cma_common.ca_security != (struct security_parms *) 0)
        !           104:        {
        !           105:        struct signature *sign_operation();
        !           106:        int encode_DAS_CompareArgumentData();
        !           107: 
        !           108:        compare_arg.cma_common.ca_sig = 
        !           109:                sign_operation((caddr_t)&compare_arg, encode_DAS_CompareArgumentData);
        !           110:        }
        !           111: 
        !           112:        while (ds_compare (&compare_arg, &error, &result) != DS_OK) {
        !           113:                if (dish_error (OPT, &error) == 0)
        !           114:                        return;
        !           115:                compare_arg.cma_object = error.ERR_REFERRAL.DSE_ref_candidates->cr_name;
        !           116:        } 
        !           117: 
        !           118:        if (result.cmr_common.cr_aliasdereferenced & print) {
        !           119:                ps_print (RPS, "(Alias dereferenced - ");
        !           120:                dn_print (RPS, result.cmr_object, EDBOUT);
        !           121:                dn_free (result.cmr_object);
        !           122:                ps_print (RPS, ")\n");
        !           123:        }
        !           124:        if (print) {
        !           125:                if (result.cmr_matched == TRUE)
        !           126:                        ps_print (RPS, "TRUE\n");
        !           127:                else
        !           128:                        ps_print (OPT, "FALSE\n");
        !           129:        } else {
        !           130:                if (result.cmr_matched == TRUE)
        !           131:                        ps_print (RPS, "\1");
        !           132:                else
        !           133:                        ps_print (OPT, "\0");
        !           134:        }
        !           135: }

unix.superglobalmegacorp.com

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