Commit c8800168aa381c51828a55f3405ea13af8cd4a96

Authored by perry.werneck@gmail.com
1 parent 0e87618b

Ajustando tradução na tela de help, incluindo lista de argumentos aceitos no pop…

…up de argumento inválido para facilitar o uso em windows, removendo macros para chamadas de log
configure.ac
... ... @@ -243,6 +243,18 @@ AC_SEARCH_LIBS( [sin], [m], AC_DEFINE(HAVE_LIBM), AC_MSG_NOTICE([libm not presen
243 243  
244 244 AC_SUBST(SOCKET_LIBS)
245 245  
  246 +#--[ Optional ]---------------------------------------------------------------------------------------------------------------------------------------------
  247 +
  248 +AC_ARG_WITH([php-config], [AS_HELP_STRING([--with-php-config], [Path to php-config tool])], [ PHPCONFIG="$withval" ],[ AC_PATH_TOOL(PHPCONFIG, php-configX, , $PATH) ])
  249 +
  250 +if test -z "${PHPCONFIG}"; then
  251 + AC_MSG_NOTICE([Program php-config not found. Use --with-php-config=path to specify absolute path to the php-config tool.])
  252 +else
  253 + AC_DEFINE(HAVE_PHP)
  254 +fi
  255 +
  256 +AC_SUBST(PHPCONFIG)
  257 +
246 258 #--[ Pre-reqs ]-----------------------------------------------------------------------------------------------------------------------------------------------
247 259 AC_SUBST(LIB3270_REQUIRES)
248 260  
... ...
src/gtk/main.c
... ... @@ -103,42 +103,7 @@ int main(int argc, char *argv[])
103 103 static const gchar * host = NULL;
104 104 int rc = 0;
105 105  
106   - // Process command-line options
107   - {
108   - static const GOptionEntry app_options[] =
109   - {
110   - { "appname", 'a', 0, G_OPTION_ARG_STRING, &appname, N_( "Application name" ), PACKAGE_NAME },
111   - { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), NULL },
112   - { NULL }
113   - };
114   -
115   - GOptionContext * options = g_option_context_new (_("- 3270 Emulator for Gtk"));
116   - GError * error = NULL;
117   -
118   - g_option_context_add_main_entries(options, app_options, NULL);
119   -
120   - gtk_init(&argc, &argv);
121   -
122   - if(!g_option_context_parse( options, &argc, &argv, &error ))
123   - {
124   - GtkWidget *dialog = gtk_message_dialog_new( NULL,
125   - GTK_DIALOG_DESTROY_WITH_PARENT,
126   - GTK_MESSAGE_ERROR,
127   - GTK_BUTTONS_CANCEL,
128   - "%s", _( "Option parsing failed." ));
129   -
130   - gtk_window_set_title(GTK_WINDOW(dialog),_( "Parse error" ));
131   - gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(dialog), "%s", error->message);
132   -
133   - gtk_dialog_run(GTK_DIALOG (dialog));
134   - gtk_widget_destroy(dialog);
135   -
136   - g_error_free(error);
137   -
138   - return -1;
139   - }
140   - }
141   -
  106 + // Setup locale
142 107 #ifdef LC_ALL
143 108 setlocale( LC_ALL, "" );
144 109 #endif
... ... @@ -172,6 +137,52 @@ int main(int argc, char *argv[])
172 137 bind_textdomain_codeset(PACKAGE_NAME, "UTF-8");
173 138 textdomain(PACKAGE_NAME);
174 139  
  140 +
  141 + // Process command-line options
  142 + {
  143 + static const GOptionEntry app_options[] =
  144 + {
  145 + { "appname", 'a', 0, G_OPTION_ARG_STRING, &appname, N_( "Application name" ), PACKAGE_NAME },
  146 + { "host", 'h', 0, G_OPTION_ARG_STRING, &host, N_( "Host to connect"), NULL },
  147 + { NULL }
  148 + };
  149 +
  150 + GOptionContext * options = g_option_context_new (_("- 3270 Emulator for Gtk"));
  151 + GError * error = NULL;
  152 +
  153 + g_option_context_add_main_entries(options, app_options, NULL);
  154 +
  155 + gtk_init(&argc, &argv);
  156 +
  157 + if(!g_option_context_parse( options, &argc, &argv, &error ))
  158 + {
  159 + int f;
  160 + GString * str;
  161 + GtkWidget * dialog = gtk_message_dialog_new( NULL,
  162 + GTK_DIALOG_DESTROY_WITH_PARENT,
  163 + GTK_MESSAGE_ERROR,
  164 + GTK_BUTTONS_CANCEL,
  165 + "%s", error->message);
  166 +
  167 + gtk_window_set_title(GTK_WINDOW(dialog),_( "Parse error" ));
  168 +
  169 + str = g_string_new( _( "<b>Valid options:</b>\n\n" ) );
  170 +
  171 + for(f=0;app_options[f].description;f++)
  172 + g_string_append_printf(str,"--%-20s\t%s\n",app_options[f].long_name,gettext(app_options[f].description));
  173 +
  174 + gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog), "%s", str->str);
  175 +
  176 + gtk_dialog_run(GTK_DIALOG (dialog));
  177 + gtk_widget_destroy(dialog);
  178 +
  179 + g_error_free(error);
  180 + g_string_free(str,TRUE);
  181 +
  182 + return -1;
  183 + }
  184 + }
  185 +
175 186 g_set_application_name(appname);
176 187  
177 188 rc = initialize();
... ...
src/lib3270/api.h
... ... @@ -99,8 +99,8 @@
99 99  
100 100  
101 101 #include <lib3270/log.h>
102   - #define WriteLog(module,fmt, ...) lib3270_write_log(NULL,module,fmt,__VA_ARGS__)
103   - #define WriteRCLog(module,rc,fmt, ...) lib3270_write_rc(NULL,module,fmt,__VA_ARGS__)
  102 +// #define WriteLog(module,fmt, ...) lib3270_write_log(NULL,module,fmt,__VA_ARGS__)
  103 +// #define WriteRCLog(module,rc,fmt, ...) lib3270_write_rc(NULL,module,fmt,__VA_ARGS__)
104 104  
105 105 #ifdef LIB3270_MODULE_NAME
106 106 #define Log(fmt, ...) lib3270_write_log(NULL,LIB3270_MODULE_NAME,fmt,__VA_ARGS__)
... ... @@ -367,7 +367,7 @@
367 367 LOCAL_EXTERN int emulate_input(char *s, int len, int pasting);
368 368  
369 369 /* Network related calls */
370   - LOCAL_EXTERN int Get3270Socket(void);
  370 +// LOCAL_EXTERN int Get3270Socket(void);
371 371  
372 372 /* Misc calls */
373 373 LOCAL_EXTERN void popup_an_error(H3270 *session, const char *fmt, ...);
... ...
src/lib3270/glue.c
... ... @@ -819,7 +819,7 @@ void popup_an_errno(int errn, const char *fmt, ...)
819 819 (void) vsprintf(vmsgbuf, fmt, args);
820 820 va_end(args);
821 821  
822   - WriteLog("3270", "Error Popup:\n%s\nrc=%d (%s)",vmsgbuf,errn,strerror(errn));
  822 + lib3270_write_log("3270", "Error Popup:\n%s\nrc=%d (%s)",vmsgbuf,errn,strerror(errn));
823 823  
824 824 Error(NULL,vmsgbuf);
825 825 }
... ...
src/lib3270/host.c
... ... @@ -645,7 +645,7 @@ int lib3270_connect(H3270 *h, const char *n, int wait)
645 645 */
646 646 static void try_reconnect(H3270 *session)
647 647 {
648   - WriteLog("3270","Starting auto-reconnect (Host: %s)",session->full_current_host ? session->full_current_host : "-");
  648 + lib3270_write_log("3270","Starting auto-reconnect (Host: %s)",session->full_current_host ? session->full_current_host : "-");
649 649 session->auto_reconnect_inprogress = False;
650 650 lib3270_reconnect(session,0);
651 651 }
... ...
src/lib3270/selection.c
... ... @@ -448,9 +448,6 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u
448 448 return realloc(text,sz);
449 449 }
450 450  
451   -
452   -
453   -
454 451 LIB3270_EXPORT char * lib3270_get_text(H3270 *h, int offset, int len)
455 452 {
456 453 char * buffer;
... ...
src/lib3270/telnet.c
... ... @@ -3277,7 +3277,7 @@ static void client_info_callback(INFO_CONST SSL *s, int where, int ret)
3277 3277 if (ret == 0)
3278 3278 {
3279 3279 trace_dsn("SSL_connect: failed in %s\n",SSL_state_string_long(s));
3280   - WriteLog("SSL","connect failed in %s (Alert: %s)",SSL_state_string_long(s),SSL_alert_type_string_long(ret));
  3280 + lib3270_write_log("SSL","connect failed in %s (Alert: %s)",SSL_state_string_long(s),SSL_alert_type_string_long(ret));
3281 3281 }
3282 3282 else if (ret < 0)
3283 3283 {
... ... @@ -3452,7 +3452,9 @@ LIB3270_EXPORT int lib3270_get_ssl_state(H3270 *h)
3452 3452 #endif
3453 3453 }
3454 3454  
  3455 +/*
3455 3456 int Get3270Socket(void)
3456 3457 {
3457 3458 return h3270.sock;
3458 3459 }
  3460 +*/
... ...
src/lib3270/util.c
... ... @@ -76,7 +76,7 @@ int get_version_info(void)
76 76 info.dwOSVersionInfoSize = sizeof(info);
77 77 if(GetVersionEx(&info) == 0)
78 78 {
79   - WriteLog("lib3270","%s","Can't get Windows version");
  79 + lib3270_write_log("lib3270","%s","Can't get Windows version");
80 80 return -1;
81 81 }
82 82  
... ...
src/lib3270/w3miscc.h
... ... @@ -19,8 +19,7 @@
19 19 #if defined(_WIN32) /*[*/
20 20  
21 21 #if defined(_WS2TCPIP_H) /*[*/
22   -LIB3270_INTERNAL const char *inet_ntop(int af, const void *src, char *dst,
23   - socklen_t cnt);
  22 +LIB3270_INTERNAL const char *inet_ntop(int af, const void *src, char *dst,socklen_t cnt);
24 23 #endif /*]*/
25 24  
26 25 LIB3270_INTERNAL const char *win32_strerror(int e);
... ...