ytree.c 814 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. err = sr_connect(SR_CONN_DEFAULT, &conn);
  17. if (err) {
  18. printf("Error\n");
  19. goto out;
  20. }
  21. err = sr_session_start(conn, SR_DS_RUNNING, &sess);
  22. if (err) {
  23. printf("Error2\n");
  24. goto out;
  25. }
  26. faux_argv_parse(args, argv[1]);
  27. faux_argv_del_continuable(args);
  28. pline = pline_parse(sess, args, 0);
  29. faux_argv_free(args);
  30. // pline_debug(pline);
  31. pline_print_completions(pline, BOOL_TRUE);
  32. pline_free(pline);
  33. ret = 0;
  34. out:
  35. sr_disconnect(conn);
  36. return ret;
  37. }