]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - test/cardfile.c
ncurses 5.9 - patch 20130112
[ncurses.git] / test / cardfile.c
index c549659b493ad569fb7795ea2e8defb4add3e9a2..ef224c9b9006e82418ac53a92cee0ea759d968be 100644 (file)
@@ -29,7 +29,7 @@
 /*
  * Author: Thomas E. Dickey
  *
 /*
  * Author: Thomas E. Dickey
  *
- * $Id: cardfile.c,v 1.39 2012/06/09 20:30:32 tom Exp $
+ * $Id: cardfile.c,v 1.41 2012/11/03 19:26:50 tom Exp $
  *
  * File format: text beginning in column 1 is a title; other text is content.
  */
  *
  * File format: text beginning in column 1 is a title; other text is content.
  */
@@ -68,17 +68,13 @@ static CARD *all_cards;
 static bool try_color = FALSE;
 static char default_name[] = "cardfile.dat";
 
 static bool try_color = FALSE;
 static char default_name[] = "cardfile.dat";
 
-#if !HAVE_STRDUP
-#define strdup my_strdup
-static char *
-strdup(const char *s)
+static void
+failed(const char *s)
 {
 {
-    char *p = typeMalloc(char, strlen(s) + 1);
-    if (p)
-       strcpy(p, s);
-    return (p);
+    perror(s);
+    endwin();
+    ExitProgram(EXIT_FAILURE);
 }
 }
-#endif /* not HAVE_STRDUP */
 
 static const char *
 skip(const char *buffer)
 
 static const char *
 skip(const char *buffer)
@@ -146,6 +142,8 @@ add_content(CARD * card, const char *content)
        }
        if (card->content)
            strcpy(card->content + offset, content);
        }
        if (card->content)
            strcpy(card->content + offset, content);
+       else
+           failed("add_content");
     }
 }
 
     }
 }