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

    if ((objc < 4) || (objc > 5)) {
        Tcl_WrongNumArgs(interp, 1, objv, USAGE_INSERT);
        return TCL_ERROR;
    }

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

    base = Tcl_GetString(objv[2]);
    label = Tcl_GetString(objv[3]);

    if (objc == 4) {
        before = 0;
    } else {
        conv_result = Tcl_GetIntFromObj(interp, objv[4], &before);
        if (conv_result != TCL_OK) {
            Tcl_SetObjResult(interp, Tcl_NewStringObj(ERROR_TOKEN, -1));
            return TCL_ERROR;
        }
    }

    aug_result = aug_insert(aug, base, label, before);

    if (aug_result == 0) {
        return TCL_OK;
    } else {
        Tcl_SetObjResult(interp, Tcl_NewStringObj("can't insert node", -1));

        return TCL_ERROR;
    }
}
/*
 * Insert a sibling node of path with label label before or after path.
 * Usage: insert token path label ?before?
 * Return value: nothing.
 * Side effects: changes an Augeas object.
 */
Insert a sibling node of path with label label before or after path.
Usage: insert token path label ?before.
Return value: nothing.
Side effects: changes an Augeas object.
Insert a sibling node of path with label label before or after path . Usage : insert token path label ?before . Return value : nothing . Side effects : changes an Augeas object .
static int
Insert_Cmd(ClientData cdata, Tcl_Interp *interp,
        int objc, Tcl_Obj *const objv[])
{
    augeas* aug;
    const char* base;
    const char* label;
    int conv_result;
    int before;
    int aug_result;
    if ((objc < 4) || (objc > 5)) {
        Tcl_WrongNumArgs(interp, 1, objv, USAGE_INSERT);
        return TCL_ERROR;
    }
    aug = parse_id(cdata, interp, objv[1], 0);
    if (aug == NULL) {
        return TCL_ERROR;
    }
    base = Tcl_GetString(objv[2]);
    label = Tcl_GetString(objv[3]);
    if (objc == 4) {
        before = 0;
    } else {
        conv_result = Tcl_GetIntFromObj(interp, objv[4], &before);
        if (conv_result != TCL_OK) {
            Tcl_SetObjResult(interp, Tcl_NewStringObj(ERROR_TOKEN, -1));
            return TCL_ERROR;
        }
    }
    aug_result = aug_insert(aug, base, label, before);
    if (aug_result == 0) {
        return TCL_OK;
    } else {
        Tcl_SetObjResult(interp, Tcl_NewStringObj("can't insert node", -1));
        return TCL_ERROR;
    }
}
static int Insert_Cmd ( ClientData cdata , Tcl_Interp * interp , int objc , Tcl_Obj * const objv [ ] ) { augeas * aug ; const char * base ; const char * label ; int conv_result ; int before ; int aug_result ; if ( ( objc < 4 ) || ( objc > 5 ) ) { Tcl_WrongNumArgs ( interp , 1 , objv , USAGE_INSERT ) ; return TCL_ERROR ; } aug = parse_id ( cdata , interp , objv [ 1 ] , 0 ) ; if ( aug == NULL ) { return TCL_ERROR ; } base = Tcl_GetString ( objv [ 2 ] ) ; label = Tcl_GetString ( objv [ 3 ] ) ; if ( objc == 4 ) { before = 0 ; } else { conv_result = Tcl_GetIntFromObj ( interp , objv [ 4 ] , & before ) ; if ( conv_result != TCL_OK ) { Tcl_SetObjResult ( interp , Tcl_NewStringObj ( ERROR_TOKEN , -1 ) ) ; return TCL_ERROR ; } } aug_result = aug_insert ( aug , base , label , before ) ; if ( aug_result == 0 ) { return TCL_OK ; } else { Tcl_SetObjResult ( interp , Tcl_NewStringObj ( " " , -1 ) ) ; return TCL_ERROR ; } }
Insert a sibling node of path with label label before or after path.
Insert a sibling node of path with label label before or after path .