Check the value returned by fopen() during display initialization
[tig] / tig.c
diff --git a/tig.c b/tig.c
index a3b92c8..6a1f3d1 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -12,7 +12,7 @@
  */
 
 #ifndef        VERSION
-#define VERSION        "tig-0.3"
+#define VERSION        "tig-0.4.git"
 #endif
 
 #ifndef DEBUG
@@ -80,7 +80,7 @@ static size_t utf8_length(const char *string, size_t max_width, int *coloffset,
        "git log --cc --stat -n100 %s"
 
 #define TIG_MAIN_CMD \
-       "git log --topo-order --stat --pretty=raw %s"
+       "git log --topo-order --pretty=raw %s"
 
 /* XXX: Needs to be defined to the empty string. */
 #define TIG_HELP_CMD   ""
@@ -770,6 +770,7 @@ static struct key key_table[] = {
        { "Down",       KEY_DOWN },
        { "Insert",     KEY_IC },
        { "Delete",     KEY_DC },
+       { "Hash",       '#' },
        { "Home",       KEY_HOME },
        { "End",        KEY_END },
        { "PageUp",     KEY_PPAGE },
@@ -1046,7 +1047,7 @@ read_option(char *opt, int optlen, char *value, int valuelen)
 
        /* Check for comment markers, since read_properties() will
         * only ensure opt and value are split at first " \t". */
-       optlen = strcspn(opt, "#;");
+       optlen = strcspn(opt, "#");
        if (optlen == 0)
                return OK;
 
@@ -1056,7 +1057,7 @@ read_option(char *opt, int optlen, char *value, int valuelen)
 
        }  else {
                /* Look for comment endings in the value. */
-               int len = strcspn(value, "#;");
+               int len = strcspn(value, "#");
 
                if (len < valuelen) {
                        valuelen = len;
@@ -2582,6 +2583,8 @@ init_display(void)
                /* Leave stdin and stdout alone when acting as a pager. */
                FILE *io = fopen("/dev/tty", "r+");
 
+               if (!io)
+                       die("Failed to open /dev/tty");
                cursed = !!newterm(NULL, io, io);
        }