comparison console/libgnt/gntmain.c @ 14881:5228f8cf2a6a

[gaim-migrate @ 17650] Print a debug message if someone tries to specify a binding for some non-existent action. Make sure the conversation windows aren't too large to cause a crash. raise(SIGABRT) instead of exit() to force a coredump if something goes wrong with stdin. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 01 Nov 2006 20:59:23 +0000
parents 70623f0d5cdc
children 065e7ac30338
comparison
equal deleted inserted replaced
14880:0e4833acd31c 14881:5228f8cf2a6a
772 const char *buffer; 772 const char *buffer;
773 773
774 int rd = read(STDIN_FILENO, keys, sizeof(keys) - 1); 774 int rd = read(STDIN_FILENO, keys, sizeof(keys) - 1);
775 if (rd < 0) 775 if (rd < 0)
776 { 776 {
777 int ch = getch(); /* This should return ERR, but let's see what it really returns */
777 endwin(); 778 endwin();
778 printf("ERROR: %s\n", strerror(errno)); 779 printf("ERROR: %s\n", strerror(errno));
779 printf("File descriptor is: %d\n\nGIOChannel is: %p", STDIN_FILENO, source); 780 printf("File descriptor is: %d\n\nGIOChannel is: %p\ngetch() = %d\n", STDIN_FILENO, source, ch);
780 exit(1); 781 raise(SIGABRT);
781 } 782 }
782 else if (rd == 0) 783 else if (rd == 0)
783 { 784 {
784 endwin(); 785 endwin();
785 printf("EOF\n"); 786 printf("EOF\n");
786 exit(1); 787 raise(SIGABRT);
787 } 788 }
788 789
789 event_stack = TRUE; 790 event_stack = TRUE;
790 keys[rd] = 0; 791 keys[rd] = 0;
791 792
1113 1114
1114 result = g_io_add_watch_full(channel, G_PRIORITY_HIGH, 1115 result = g_io_add_watch_full(channel, G_PRIORITY_HIGH,
1115 (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI | G_IO_NVAL), 1116 (G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI | G_IO_NVAL),
1116 io_invoke, NULL, NULL); 1117 io_invoke, NULL, NULL);
1117 1118
1119 g_io_channel_unref(channel); /* Apparently this caused crashes for some people.
1120 But irssi does this, so I am going to assume the
1121 crashes were caused by some other stuff. */
1122
1118 locale = setlocale(LC_ALL, ""); 1123 locale = setlocale(LC_ALL, "");
1119
1120 #if 0
1121 g_io_channel_unref(channel); /* Apparently this causes crash for some people */
1122 #endif
1123 1124
1124 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf"))) 1125 if (locale && (strstr(locale, "UTF") || strstr(locale, "utf")))
1125 ascii_only = FALSE; 1126 ascii_only = FALSE;
1126 else 1127 else
1127 ascii_only = TRUE; 1128 ascii_only = TRUE;