generic/tcl-augeas.c
static int
Rm_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    augeas* aug;
    const char* path;
    int aug_result;

    if (objc != 3) {
        Tcl_WrongNumArgs(interp, 1, objv, USAGE_RM);
        return TCL_ERROR;
    }

    aug = parse_id(cdata, interp, objv[1], 0);
    if (aug == NULL) {
        return TCL_ERROR;
    }

    path = Tcl_GetString(objv[2]);

    aug_result = aug_rm(aug, path);

    if (aug_result > 0) {
        /* Return the number of nodes removed. */
        Tcl_SetObjResult(interp, Tcl_NewIntObj(aug_result));

        return TCL_OK;
    } else if (aug_result == 0) {
        Tcl_SetObjResult(interp, Tcl_NewStringObj(ERROR_NO_NODES, -1));

        return TCL_ERROR;
    } else { /* aug_result < 0 */
        Tcl_SetObjResult(interp, Tcl_NewStringObj(ERROR_PATH, -1));

        return TCL_ERROR;
    }
}
/*
 * Remove all nodes that match path.
 * Usage: rm token path
 * Return value: the number of nodes removed.
 * Side effects: changes an Augeas object.
 */
Remove all nodes that match path.
Usage: rm token path
Return value: the number of nodes removed.
Side effects: changes an Augeas object.
Remove all nodes that match path . Usage : rm token path Return value : the number of nodes removed . Side effects : changes an Augeas object .
static int
Rm_Cmd(ClientData cdata, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
{
    augeas* aug;
    const char* path;
    int aug_result;
    if (objc != 3) {
        Tcl_WrongNumArgs(interp, 1, objv, USAGE_RM);
        return TCL_ERROR;
    }
    aug = parse_id(cdata, interp, objv[1], 0);
    if (aug == NULL) {
        return TCL_ERROR;
    }
    path = Tcl_GetString(objv[2]);
    aug_result = aug_rm(aug, path);
    if (aug_result > 0) {
        Tcl_SetObjResult(interp, Tcl_NewIntObj(aug_result));
        return TCL_OK;
    } else if (aug_result == 0) {
        Tcl_SetObjResult(interp, Tcl_NewStringObj(ERROR_NO_NODES, -1));
        return TCL_ERROR;
    } else { 
        Tcl_SetObjResult(interp, Tcl_NewStringObj(ERROR_PATH, -1));
        return TCL_ERROR;
    }
}
static int Rm_Cmd ( ClientData cdata , Tcl_Interp * interp , int objc , Tcl_Obj * const objv [ ] ) { augeas * aug ; const char * path ; int aug_result ; if ( objc != 3 ) { Tcl_WrongNumArgs ( interp , 1 , objv , USAGE_RM ) ; return TCL_ERROR ; } aug = parse_id ( cdata , interp , objv [ 1 ] , 0 ) ; if ( aug == NULL ) { return TCL_ERROR ; } path = Tcl_GetString ( objv [ 2 ] ) ; aug_result = aug_rm ( aug , path ) ; if ( aug_result > 0 ) { Tcl_SetObjResult ( interp , Tcl_NewIntObj ( aug_result ) ) ; return TCL_OK ; } else if ( aug_result == 0 ) { Tcl_SetObjResult ( interp , Tcl_NewStringObj ( ERROR_NO_NODES , -1 ) ) ; return TCL_ERROR ; } else { Tcl_SetObjResult ( interp , Tcl_NewStringObj ( ERROR_PATH , -1 ) ) ; return TCL_ERROR ; } }
Remove all nodes that match path.
Remove all nodes that match path .
/* Return the number of nodes removed. */ /* aug_result < 0 */