X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fcardfile.c;h=04816949d3552d64c5986d75697f675757c255cf;hp=14b50de0d4aa0749dae779a771f3211a8a53f6e6;hb=3853a8e97d7efa8cb6a3c93c696d2c52895d6a70;hpb=027ae42953e3186daed8f3882da73de48291b606 diff --git a/test/cardfile.c b/test/cardfile.c index 14b50de0..04816949 100644 --- a/test/cardfile.c +++ b/test/cardfile.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999-2004,2006 Free Software Foundation, Inc. * + * Copyright (c) 1999-2006,2007 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,7 +29,7 @@ /* * Author: Thomas E. Dickey * - * $Id: cardfile.c,v 1.28 2006/12/10 00:30:09 tom Exp $ + * $Id: cardfile.c,v 1.30 2007/04/07 17:07:34 tom Exp $ * * File format: text beginning in column 1 is a title; other text is content. */ @@ -136,13 +136,15 @@ add_content(CARD * card, const char *content) if ((offset = strlen(card->content)) != 0) { total += 1 + offset; card->content = (char *) realloc(card->content, total + 1); - strcpy(card->content + offset++, " "); + if (card->content) + strcpy(card->content + offset++, " "); } else { if (card->content != 0) free(card->content); card->content = (char *) malloc(total + 1); } - strcpy(card->content + offset, content); + if (card->content) + strcpy(card->content + offset, content); } } @@ -306,8 +308,8 @@ form_virtualize(WINDOW *w) return (MY_CTRL_N); case CTRL('P'): return (MY_CTRL_P); - case CTRL('Q'): - case 033: + case QUIT: + case ESCAPE: return (MY_CTRL_Q); case KEY_BACKSPACE: