DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T m

⟦1346c7779⟧ TextFile

    Length: 1597 (0x63d)
    Types: TextFile
    Names: »modifyrdn.c«

Derivation

└─⟦3d0c2be1b⟧ Bits:30001254 ISODE-5.0 Tape
    └─⟦eba4602b1⟧ »./isode-5.0.tar.Z« 
        └─⟦d3ac74d73⟧ 
            └─⟦this⟧ »isode-5.0/quipu/dish/modifyrdn.c« 

TextFile

#include "quipu/util.h"
#include "quipu/modifyrdn.h"

extern DN       dn;
extern PS       opt,
                rps;
extern LLog    *log_dua;

call_modifyrdn (argc, argv)
int             argc;
char          **argv;
{
	struct ds_modifyrdn_arg modrdn_arg;
	struct DSError  error;
	RDN             newname = NULLRDN;
	DN              dnptr;
	DN              trail;
	int             x;
	char 		deleterdn = TRUE;


	if ((argc = service_control (opt,argc, argv, &modrdn_arg.mra_common)) == -1)
		return;

	for (x = 1; x < argc; x++) {
		if (test_arg (argv[x], "-name",2)) {
			if ((newname = str2rdn (argv[++x])) == NULLRDN) {
				ps_printf (opt,"invalid rdn %s\n",argv[x]);
				return;
			}
		} else if (test_arg (argv[x],"-delete",2))
			deleterdn = TRUE;
		else if (test_arg (argv[x],"-nodelete",3))
			deleterdn = FALSE;
		else if (move (argv[x]) == OK)
			continue;
		else {
			ps_printf (opt,"Unknown option %s\n",argv[x]);
			Usage (argv[0]);
			return;
		}
	}

	modrdn_arg.deleterdn = deleterdn;
	modrdn_arg.mra_object = dn;
	if (newname == NULLRDN) {
		ps_print (opt, "Invalid RDN\n");
		Usage (argv[0]);
		return;
	}
	modrdn_arg.mra_newrdn = newname;

	if (rebind () != OK)
		return;

	if (ds_modifyrdn (&modrdn_arg, &error) != DS_OK) {
		/* deal with error */
		rdn_free(modrdn_arg.mra_newrdn);
		ds_error (opt, &error);
	} else {
		/* use data */
		ps_print (rps, "Modify done\n");
		for (dnptr = dn; dnptr->dn_parent != NULLDN; dnptr = dnptr->dn_parent)
			trail = dnptr;

		dn_comp_free (dnptr);
		trail->dn_parent = dn_comp_new (rdn_cpy (newname));
		rdn_free(modrdn_arg.mra_newrdn);
	}
}