v1.60.0-a7d60e8b.diff 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. diff --git a/README.md b/README.md
  2. index 3ead7a7..bba4f89 100644
  3. --- a/README.md
  4. +++ b/README.md
  5. @@ -9,7 +9,7 @@ Bug reports: https://github.com/LonnyGomes/hexcurse/issues
  6. Description
  7. -----------
  8. -Hexcurse is a curses-base hex editing utility that can open, edit, and save files, editing both the hexadecimal and decimal values.
  9. +Hexcurse is a curses-based hex editing utility that can open, edit, and save files, editing both the hexadecimal and decimal values.
  10. It was written by [Lonny Gomes](https://twitter.com/lonnygomes) and [James Stephenson](https://plus.google.com/u/0/103174459258175070784/about) but we haven't maintained it for some time. We recently saw an old tarball of the code floating around the net and thought it would be good to start maintaining the codebase again.
  11. @@ -33,9 +33,9 @@ Usage
  12. usage: hexcurse [-?|help] [-a] [-r rnum] [-o outputfile] [[-i] infile]
  13. - -a Output addresses in decimal format initially
  14. - -e Output characters in EBCDIC format rather than ASCII
  15. - -r rnum Resize the display to "rnum" bytes wide
  16. + -a Output addresses in decimal format initially
  17. + -e Output characters in EBCDIC format rather than ASCII
  18. + -r rnum Resize the display to "rnum" bytes wide
  19. -o outfile Write output to outfile by default
  20. -? | -help Display usage and version of hexcurse program
  21. [-i] infile Read from data from infile (-i required if not last argument)
  22. diff --git a/src/acceptch.c b/src/acceptch.c
  23. index 1580645..d57207b 100644
  24. --- a/src/acceptch.c
  25. +++ b/src/acceptch.c
  26. @@ -297,6 +297,7 @@ int wacceptch(WINS *win, off_t len)
  27. }
  28. else
  29. currentLine -= (2*MAXY);
  30. + /* fall through */
  31. case CTRL_AND('d'):
  32. case KEY_PGDN: /* if KEY_PGDN... */
  33. diff --git a/src/hexcurse.c b/src/hexcurse.c
  34. index 9a275ee..e723ddc 100644
  35. --- a/src/hexcurse.c
  36. +++ b/src/hexcurse.c
  37. @@ -217,9 +217,13 @@ off_t parseArgs(int argc, char *argv[])
  38. fpINfilename = strdup(argv[0]);
  39. }
  40. - if (fpINfilename && strcmp(fpINfilename, ""))
  41. + if (fpINfilename == NULL) {
  42. + print_usage();
  43. + exit(-1);
  44. + } else if (fpINfilename && strcmp(fpINfilename, "")) {
  45. if ((fpIN = fopen(fpINfilename, "r")) == NULL)
  46. exit_err("Could not open file");
  47. + }
  48. return ((fpIN != NULL) ? maxLoc(fpIN):0); /* return file length */
  49. }
  50. @@ -231,10 +235,9 @@ off_t parseArgs(int argc, char *argv[])
  51. \********************************************************/
  52. int getMinimumAddressLength(off_t len)
  53. {
  54. - char buffer[1];
  55. int min_address_length;
  56. - min_address_length = snprintf(buffer, 1, "%jd", (intmax_t)len);
  57. + min_address_length = snprintf(NULL, 0, "%jd", (intmax_t)len);
  58. /* At least 8 characters wide */
  59. return min_address_length > 8 ? min_address_length : 8;