Commit 669d8ad65db298dcd87207b1c6cf9e58018855ed

Authored by Perry Werneck
1 parent 47b964ab
Exists in master and in 2 other branches develop, macos

Updating 'popup-an-errno' dialog.

Showing 2 changed files with 8 additions and 30 deletions   Show diff stats
src/core/util.c
... ... @@ -279,25 +279,19 @@ LIB3270_EXPORT char * lib3270_get_version_info(void)
279 279 void lib3270_popup_an_errno(H3270 *hSession, int errn, const char *fmt, ...)
280 280 {
281 281 va_list args;
282   - char * text;
283 282  
284 283 va_start(args, fmt);
285   - text = lib3270_vsprintf(fmt, args);
  284 + lib3270_autoptr(char) summary = lib3270_vsprintf(fmt, args);
  285 + lib3270_autoptr(char) body = lib3270_strdup_printf( _( "The system error was '%s' (rc=%d)" ),strerror(errn),errn);
286 286 va_end(args);
287 287  
288   - lib3270_write_log(hSession, "3270", "Error Popup:\n%s\nrc=%d (%s)",text,errn,strerror(errn));
289   -
290   - lib3270_popup_dialog(
291   - hSession,
292   - LIB3270_NOTIFY_ERROR,
293   - _( "Error" ),
294   - text,
295   - "%s (rc=%d)",
296   - strerror(errn),
297   - errn
298   - );
  288 + LIB3270_POPUP popup = {
  289 + .type = LIB3270_NOTIFY_ERROR,
  290 + .summary = summary,
  291 + .body = body
  292 + };
299 293  
300   - lib3270_free(text);
  294 + lib3270_popup(hSession,&popup,0);
301 295  
302 296 }
303 297  
... ...
src/core/windows/util.c
... ... @@ -238,22 +238,6 @@ LIB3270_EXPORT const char * lib3270_win32_local_charset(void)
238 238 #define SECS_BETWEEN_EPOCHS 11644473600ULL
239 239 #define SECS_TO_100NS 10000000ULL /* 10^7 */
240 240  
241   -/*
242   -int gettimeofday(struct timeval *tv, struct timezone GNUC_UNUSED(*ignored))
243   -{
244   - FILETIME t;
245   - ULARGE_INTEGER u;
246   -
247   - GetSystemTimeAsFileTime(&t);
248   - memcpy(&u, &t, sizeof(ULARGE_INTEGER));
249   -
250   - // Isolate seconds and move epochs.
251   - tv->tv_sec = (DWORD)((u.QuadPart / SECS_TO_100NS) - SECS_BETWEEN_EPOCHS);
252   - tv->tv_usec = (u.QuadPart % SECS_TO_100NS) / 10ULL;
253   - return 0;
254   -}
255   -*/
256   -
257 241 LIB3270_EXPORT char * lib3270_get_installation_path()
258 242 {
259 243 char lpFilename[4096];
... ...