Advertisement
Guest User

gmu9-ncurses.patch

a guest
Feb 19th, 2013
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.49 KB | None | 0 0
  1. diff -rupN gmu-0.9.0/src/tools.orig/charset.h gmu-0.9.0/src/tools/charset.h
  2. --- gmu-0.9.0/src/tools.orig/charset.h  1969-12-31 19:00:00.000000000 -0500
  3. +++ gmu-0.9.0/src/tools/charset.h   2013-02-19 20:48:30.000000000 -0500
  4. @@ -0,0 +1,40 @@
  5. +#ifndef WEJ_CHARSET_H
  6. +#define WEJ_CHARSET_H
  7. +
  8. +#ifdef USE_WIDE_CHAR
  9. +#include <wctype.h>
  10. +
  11. +static char *wchars_to_utf8_str_realloc(char *input, wchar_t *wchars)
  12. +{
  13. +   int len = wcstombs(NULL, wchars, 0);
  14. +   if (len >= 0) {
  15. +       input = realloc(input, len + 1);
  16. +       if (input) {
  17. +           if (wcstombs(input, wchars, len) != len) {
  18. +               free(input);
  19. +               input = NULL;
  20. +           } else {
  21. +               input[len] = '\0';
  22. +           }
  23. +       }
  24. +   }
  25. +   return input;
  26. +}
  27. +
  28. +#else /* USE_WIDE_CHAR */
  29. +
  30. +#define wchar_t char
  31. +#define wcstombs(d, s, l) strlen(l)
  32. +#define wchars_to_utf8_str_realloc(i, wc) wc
  33. +#define wget_wch(w, c) ((*(c) = wgetch(w)) ? OK : OK)
  34. +
  35. +#define WACS_VLINE   ACS_VLINE
  36. +#define WACS_DIAMOND ACS_DIAMOND
  37. +#define WACS_UARROW  ACS_UARROW
  38. +#define WACS_DARROW  ACS_DARROW
  39. +#define mvwadd_wchnstr(w, y, x, c, n) mvwaddch(w, y, x, c)
  40. +#define mvwvline_set(w, y, x, c, n) mvwvline(w, y, x, c, n)
  41. +
  42. +#endif /* USE_WIDE_CHAR */
  43. +
  44. +#endif
  45. diff -rupN gmu-0.9.0/src/tools.orig/gmuc.c gmu-0.9.0/src/tools/gmuc.c
  46. --- gmu-0.9.0/src/tools.orig/gmuc.c 2013-02-19 20:56:36.000000000 -0500
  47. +++ gmu-0.9.0/src/tools/gmuc.c  2013-02-19 19:40:26.000000000 -0500
  48. @@ -32,7 +32,7 @@
  49.  #endif
  50.  #include <curses.h>
  51.  #include <signal.h>
  52. -#include <wctype.h>
  53. +#include "charset.h"
  54.  #include "../wejpconfig.h"
  55.  #include "../ringbuffer.h"
  56.  #include "../debug.h"
  57. @@ -131,23 +131,6 @@ static int parse_input_alloc(char *input
  58.     return res;
  59.  }
  60.  
  61. -static char *wchars_to_utf8_str_realloc(char *input, wchar_t *wchars)
  62. -{
  63. -   int len = wcstombs(NULL, wchars, 0);
  64. -   if (len >= 0) {
  65. -       input = realloc(input, len + 1);
  66. -       if (input) {
  67. -           if (wcstombs(input, wchars, len) != len) {
  68. -               free(input);
  69. -               input = NULL;
  70. -           } else {
  71. -               input[len] = '\0';
  72. -           }
  73. -       }
  74. -   }
  75. -   return input;
  76. -}
  77. -
  78.  static State do_websocket_handshake(RingBuffer *rb, State state)
  79.  {
  80.     int  i, data_available = 1;
  81. diff -rupN gmu-0.9.0/src/tools.orig/listwidget.c gmu-0.9.0/src/tools/listwidget.c
  82. --- gmu-0.9.0/src/tools.orig/listwidget.c   2013-02-19 20:56:36.000000000 -0500
  83. +++ gmu-0.9.0/src/tools/listwidget.c    2013-02-19 20:48:52.000000000 -0500
  84. @@ -19,6 +19,7 @@
  85.  #define _XOPEN_SOURCE_EXTENDED
  86.  #endif
  87.  #include <curses.h>
  88. +#include "charset.h"
  89.  #include "window.h"
  90.  #include "listwidget.h"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement