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

1.1     ! root        1: /* showname.c - */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/quipu/dish/RCS/showname.c,v 7.0 89/11/23 22:20:24 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/quipu/dish/RCS/showname.c,v 7.0 89/11/23 22:20:24 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       showname.c,v $
        !            12:  * Revision 7.0  89/11/23  22:20:24  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/name.h"
        !            30: 
        !            31: extern DN       current_dn;
        !            32: extern DN       dn;
        !            33: 
        !            34: #define        OPT     (!frompipe || rps -> ps_byteno == 0 ? opt : rps)
        !            35: #define        RPS     (!frompipe || opt -> ps_byteno == 0 ? rps : opt)
        !            36: extern char    frompipe;
        !            37: extern PS      opt, rps;
        !            38: 
        !            39: extern char    print_format;
        !            40: 
        !            41: 
        !            42: call_showname (argc, argv)
        !            43: int             argc;
        !            44: char          **argv;
        !            45: {
        !            46:        DN              dnptr;
        !            47:        int             compact = FALSE;
        !            48:        int             x;
        !            49:        extern DN       rel_dn;
        !            50: 
        !            51:        if ((argc = read_cache (argc, argv)) < 0)
        !            52:                return;
        !            53: 
        !            54:        for (x = 1; x < argc; x++) {
        !            55:                if (test_arg (argv[x], "-compact",2))  {        /* compact */
        !            56:                        compact = TRUE;
        !            57:                        argc--;
        !            58:                } else if (test_arg (argv[x], "-nocompact",3))  {
        !            59:                        compact = FALSE;
        !            60:                        argc--;
        !            61:                } else {
        !            62:                        ps_printf (OPT,"Unknown option %s\n",argv[x]);
        !            63:                        Usage (argv[0]);
        !            64:                        return;
        !            65:                }
        !            66:        }
        !            67: 
        !            68:        if (compact) {
        !            69:                if (rel_dn != NULLDN) {
        !            70:                        DN a,b;
        !            71: 
        !            72:                        a = rel_dn;
        !            73:                        b = current_dn;
        !            74:                        for (; a != NULLDN && b != NULLDN ; a = a->dn_parent, b = b->dn_parent)
        !            75:                                if ( dn_comp_cmp (a,b) == NOTOK) 
        !            76:                                        break;
        !            77:                        if (a == NULLDN)
        !            78:                                dn_print (RPS,b,RDNOUT);
        !            79:                        else {
        !            80:                                ps_print (RPS, "@");
        !            81:                                dn_print (RPS,current_dn,RDNOUT);
        !            82:                        }
        !            83:                        ps_print (RPS, "\n");
        !            84:                } else {
        !            85:                        dn_print (RPS, current_dn, RDNOUT);
        !            86:                        ps_print (RPS, "\n");
        !            87:                }
        !            88:        } else {
        !            89:                if (current_dn == NULLDN) {
        !            90:                        ps_print (RPS, "NULL Name\n");
        !            91:                        return;
        !            92:                }
        !            93:                for (dnptr = current_dn; dnptr != NULLDN; dnptr = dnptr->dn_parent) {
        !            94:                        rdn_print (RPS,dnptr->dn_rdn,print_format);
        !            95:                        ps_print (RPS, "\n");
        !            96:                }
        !            97:        }
        !            98: }

unix.superglobalmegacorp.com

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