ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/init.C
(Generate patch)

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.215 by root, Mon Oct 8 15:36:13 2007 UTC vs.
Revision 1.220 by ayin, Sun Oct 28 11:25:04 2007 UTC

40#include "init.h" 40#include "init.h"
41 41
42#include <limits> 42#include <limits>
43 43
44#include <csignal> 44#include <csignal>
45
46#ifdef HAVE_XSETLOCALE
47# define X_LOCALE
48# include <X11/Xlocale.h>
49#else
50# ifdef HAVE_SETLOCALE
51# include <clocale>
52# endif
53#endif
54
55#ifdef HAVE_NL_LANGINFO
56# include <langinfo.h>
57#endif
45 58
46#ifdef DISPLAY_IS_IP 59#ifdef DISPLAY_IS_IP
47/* On Solaris link with -lsocket and -lnsl */ 60/* On Solaris link with -lsocket and -lnsl */
48#include <sys/types.h> 61#include <sys/types.h>
49#include <sys/socket.h> 62#include <sys/socket.h>
353 */ 366 */
354 for (r_argc = 0; r_argc < argc; r_argc++) 367 for (r_argc = 0; r_argc < argc; r_argc++)
355 if (!strcmp (argv[r_argc], "-e")) 368 if (!strcmp (argv[r_argc], "-e"))
356 break; 369 break;
357 370
371 if (r_argc == argc)
372 cmd_argv = NULL;
373 else if (!argv[r_argc + 1])
374 rxvt_fatal ("option '-e' requires an argument, aborting.\n");
375 else
376 {
377 cmd_argv = (const char **)rxvt_malloc (sizeof (char *) * (argc - r_argc));
378
379 for (i = 0; i < argc - r_argc - 1; i++)
380 cmd_argv[i] = (const char *)argv[i + r_argc + 1];
381
382 cmd_argv[i] = NULL;
383 }
384
358 r_argv = (const char **)rxvt_malloc (sizeof (char *) * (r_argc + 1)); 385 r_argv = (const char **)rxvt_malloc (sizeof (char *) * (r_argc + 1));
359 386
360 for (i = 0; i < r_argc; i++) 387 for (i = 0; i < r_argc; i++)
361 r_argv[i] = (const char *)argv[i]; 388 r_argv[i] = (const char *)argv[i];
362 389
363 r_argv[i] = NULL; 390 r_argv[i] = NULL;
364
365 if (r_argc == argc)
366 cmd_argv = NULL;
367 else
368 {
369 cmd_argv = (const char **)rxvt_malloc (sizeof (char *) * (argc - r_argc));
370
371 for (i = 0; i < argc - r_argc - 1; i++)
372 cmd_argv[i] = (const char *)argv[i + r_argc + 1];
373
374 cmd_argv[i] = NULL;
375 }
376 391
377 rs[Rs_name] = rxvt_basename (argv[0]); 392 rs[Rs_name] = rxvt_basename (argv[0]);
378 393
379 /* 394 /*
380 * Open display, get options/resources and create the window 395 * Open display, get options/resources and create the window
384 rs[Rs_display_name] = ":0"; 399 rs[Rs_display_name] = ":0";
385 400
386 get_options (r_argc, r_argv); 401 get_options (r_argc, r_argv);
387 402
388 if (!(display = displays.get (rs[Rs_display_name]))) 403 if (!(display = displays.get (rs[Rs_display_name])))
404 {
405 free (r_argv);
389 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); 406 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
407 }
390 408
391 // using a local pointer decreases code size a lot 409 // using a local pointer decreases code size a lot
392 xa = display->xa; 410 xa = display->xa;
393 411
394 set (display); 412 set (display);
639 657
640 this->locale = "C"; 658 this->locale = "C";
641 } 659 }
642 660
643 661
644 this->locale = rxvt_strdup (this->locale); 662 this->locale = strdup (this->locale);
645 SET_LOCALE (this->locale); 663 SET_LOCALE (this->locale);
646 mbstate.reset (); 664 mbstate.reset ();
647#endif 665#endif
648 666
649#if HAVE_NL_LANGINFO 667#if HAVE_NL_LANGINFO

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines