Пример #1
0
static int Paug_mv(lua_State *L)
{
    augeas *a = Paug_checkarg(L, 1);
    const char *src = luaL_checkstring(L, 2);
    const char *dst = luaL_checkstring(L, 3);
    return pushresult(L, aug_mv(a, src, dst), a, NULL);
}
Пример #2
0
/*
 * call-seq:
 *   mv(SRC, DST) -> int
 *
 * Move the node SRC to DST. SRC must match exactly one node in the
 * tree. DST must either match exactly one node in the tree, or may not
 * exist yet. If DST exists already, it and all its descendants are
 * deleted. If DST does not exist yet, it and all its missing ancestors are
 * created.
 */
VALUE augeas_mv(VALUE s, VALUE src, VALUE dst) {
    augeas *aug = aug_handle(s);
    const char *csrc = StringValueCStr(src);
    const char *cdst = StringValueCStr(dst);
    int r = aug_mv(aug, csrc, cdst);

    return INT2FIX(r);
}
Пример #3
0
int
do_aug_mv (const char *src, const char *dest)
{
#ifdef HAVE_AUGEAS
  int r;

  NEED_AUG (-1);

  r = aug_mv (aug, src, dest);
  if (r == -1) {
    reply_with_error ("Augeas mv failed");
    return -1;
  }

  return 0;
#else
  NOT_AVAILABLE (-1);
#endif
}