util.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef UTIL__H
  2. #define UTIL__H
  3. /**
  4. * Copyright (C) 2011 Anders Sundman <anders@4zm.org>
  5. *
  6. * This file is part of mfterm.
  7. *
  8. * mfterm is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * mfterm is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with mfterm. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. * Parts of code used in this file are from the GNU readline library file
  22. * fileman.c (GPLv3). Copyright (C) 1987-2009 Free Software Foundation, Inc
  23. */
  24. /* Strip whitespace from the start and end of STRING. Return a pointer
  25. into STRING. */
  26. char* trim(char* string);
  27. // Allocate a new string and duplicate the argument string.
  28. char* strdup(const char* string);
  29. // Print a byte array in hex without byte separation
  30. void print_hex_array(const unsigned char* data, size_t nbytes);
  31. // Print a byte array in hex with the specified byte separation.
  32. void print_hex_array_sep(const unsigned char* data, size_t nbytes, char* sep);
  33. #endif