A shell that runs x86_64 assembly
c
x86-64
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

history.h 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* Copyright Yann Weber <asmsh@yannweb.net>
  2. This file is part of asmsh.
  3. asmsh is free software: you can redistribute it and/or modify it under the
  4. terms of the GNU General Public License as published by the Free Software
  5. Foundation, either version 3 of the License, or any later version.
  6. asmsh is distributed in the hope that it will be useful, but WITHOUT ANY
  7. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  9. details.
  10. You should have received a copy of the GNU General Public License along
  11. with asmsh. If not, see <https://www.gnu.org/licenses/>.
  12. */
  13. #ifndef ASMSH_HISTORY_H
  14. #define ASMSH_HISTORY_H
  15. #include "config.h"
  16. #include <fcntl.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <unistd.h>
  21. #include <sys/types.h>
  22. #include <sys/stat.h>
  23. #define ASMSH_HISTORY_PATH_FMT "%s/.local/share/asmsh"
  24. static const char ASMSH_HISTORY_FILE[] = "asmsh.history";
  25. typedef void(add_history_f)(const char*);
  26. /** Return the history filename and create the directory if needed
  27. * @note the returned string should be freed after use
  28. * @param const char * if NULL use $HOME
  29. */
  30. char * history_filename_init(const char *homedir);
  31. int save_history(const char *history_path, const char* const* hists);
  32. int load_history(const char *history_path, add_history_f *add_h);
  33. #endif