ytree.c 841 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <faux/faux.h>
  4. #include <faux/argv.h>
  5. #include <sysrepo.h>
  6. #include <sysrepo/xpath.h>
  7. #include "pline.h"
  8. int main(int argc, char **argv)
  9. {
  10. int ret = -1;
  11. int err = SR_ERR_OK;
  12. sr_conn_ctx_t *conn = NULL;
  13. sr_session_ctx_t *sess = NULL;
  14. faux_argv_t *args = faux_argv_new();
  15. pline_t *pline = NULL;
  16. if (argc < 2)
  17. return -1;
  18. err = sr_connect(SR_CONN_DEFAULT, &conn);
  19. if (err) {
  20. printf("Error\n");
  21. goto out;
  22. }
  23. err = sr_session_start(conn, SR_DS_RUNNING, &sess);
  24. if (err) {
  25. printf("Error2\n");
  26. goto out;
  27. }
  28. faux_argv_parse(args, argv[1]);
  29. faux_argv_del_continuable(args);
  30. pline = pline_parse(sess, args, 0);
  31. faux_argv_free(args);
  32. pline_debug(pline);
  33. pline_print_completions(pline, BOOL_TRUE);
  34. pline_free(pline);
  35. ret = 0;
  36. out:
  37. sr_disconnect(conn);
  38. return ret;
  39. }