aboutsummaryrefslogtreecommitdiff
path: root/contrib/ncurses/test/cardfile.c
diff options
context:
space:
mode:
authorPeter Wemm <peter@FreeBSD.org>2002-05-21 05:30:25 +0000
committerPeter Wemm <peter@FreeBSD.org>2002-05-21 05:30:25 +0000
commit39f2269fcb4873fd97d70af944ec49f4230fadea (patch)
treebd986d58f5a6e348466b5362637ba93e6cd5bf8c /contrib/ncurses/test/cardfile.c
parent7e6a63408cfb0b48f0e41f77ed82f5d0ca60bda5 (diff)
downloadsrc-39f2269fcb4873fd97d70af944ec49f4230fadea.tar.gz
src-39f2269fcb4873fd97d70af944ec49f4230fadea.zip
Import ncurses-5.2-20020518 onto the vendor branch.
Obtained from: ftp://dickey.his.com/ncurses/
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=97049
Diffstat (limited to 'contrib/ncurses/test/cardfile.c')
-rw-r--r--contrib/ncurses/test/cardfile.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/contrib/ncurses/test/cardfile.c b/contrib/ncurses/test/cardfile.c
index a705d9d9eb62..8edbd1e4fa0f 100644
--- a/contrib/ncurses/test/cardfile.c
+++ b/contrib/ncurses/test/cardfile.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999,2000 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2001,2002 Free Software Foundation, Inc. *
* *
* Permission is hereby granted, free of charge, to any person obtaining a *
* copy of this software and associated documentation files (the *
@@ -29,17 +29,18 @@
/*
* Author: Thomas E. Dickey <dickey@clark.net> 1999
*
- * $Id: cardfile.c,v 1.6 2000/11/04 23:14:28 tom Exp $
+ * $Id: cardfile.c,v 1.11 2002/04/06 23:12:50 tom Exp $
*
* File format: text beginning in column 1 is a title; other text forms the content.
*/
#include <test.priv.h>
+#if HAVE_FORM_H && HAVE_PANEL_H && HAVE_LIBFORM && HAVE_LIBPANEL
+
#include <form.h>
#include <panel.h>
-#include <string.h>
#include <ctype.h>
#define VISIBLE_CARDS 10
@@ -75,7 +76,7 @@ strdup(char *s)
static const char *
skip(const char *buffer)
{
- while (isspace(CharOf(*buffer)))
+ while (isspace(UChar(*buffer)))
buffer++;
return buffer;
}
@@ -84,7 +85,7 @@ static void
trim(char *buffer)
{
unsigned n = strlen(buffer);
- while (n-- && isspace(CharOf(buffer[n])))
+ while (n-- && isspace(UChar(buffer[n])))
buffer[n] = 0;
}
@@ -166,7 +167,7 @@ read_data(char *fname)
if ((fp = fopen(fname, "r")) != 0) {
while (fgets(buffer, sizeof(buffer), fp)) {
trim(buffer);
- if (isspace(CharOf(*buffer))) {
+ if (isspace(UChar(*buffer))) {
if (card == 0)
card = add_title("");
add_content(card, buffer);
@@ -378,6 +379,11 @@ cardfile(char *fname)
case MAX_FORM_COMMAND + 4:
write_data(fname);
break;
+#ifdef KEY_RESIZE
+ case KEY_RESIZE:
+ flash();
+ break;
+#endif
default:
beep();
break;
@@ -416,5 +422,13 @@ main(int argc, char *argv[])
endwin();
- return EXIT_SUCCESS;
+ ExitProgram(EXIT_SUCCESS);
}
+#else
+int
+main(void)
+{
+ printf("This program requires the curses form and panel libraries\n");
+ ExitProgram(EXIT_FAILURE);
+}
+#endif