aboutsummaryrefslogtreecommitdiff
path: root/ncurses/tinfo/name_match.c
diff options
context:
space:
mode:
authorRong-En Fan <rafan@FreeBSD.org>2008-11-09 14:08:54 +0000
committerRong-En Fan <rafan@FreeBSD.org>2008-11-09 14:08:54 +0000
commit6181f4622a00a9de81df01cecb5fa73ffdb697bc (patch)
treec963ba08ac935d7f048b78517309fe6fc2f496e6 /ncurses/tinfo/name_match.c
parentc0e48ca1322e978a8f9795a5ddb251df2479f930 (diff)
downloadsrc-6181f4622a00a9de81df01cecb5fa73ffdb697bc.tar.gz
src-6181f4622a00a9de81df01cecb5fa73ffdb697bc.zip
- Import ncurses 5.7-20081102 (5.7 release) onto vendor branchvendor/ncurses/5.7-20081102
Notes
Notes: svn path=/vendor/ncurses/dist/; revision=184798 svn path=/vendor/ncurses/5.7-20081102/; revision=184799; tag=vendor/ncurses/5.7-20081102
Diffstat (limited to 'ncurses/tinfo/name_match.c')
-rw-r--r--ncurses/tinfo/name_match.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/ncurses/tinfo/name_match.c b/ncurses/tinfo/name_match.c
index c8d728faa7c4..d576901fa2e9 100644
--- a/ncurses/tinfo/name_match.c
+++ b/ncurses/tinfo/name_match.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * Copyright (c) 1999-2005,2007 Free Software Foundation, Inc. *
+ * Copyright (c) 1999-2007,2008 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 *
@@ -27,14 +27,14 @@
****************************************************************************/
/****************************************************************************
- * Author: Thomas E. Dickey <dickey@clark.net> 1999 *
+ * Author: Thomas E. Dickey 1999-on *
****************************************************************************/
#include <curses.priv.h>
#include <term.h>
#include <tic.h>
-MODULE_ID("$Id: name_match.c,v 1.16 2007/04/21 21:28:13 tom Exp $")
+MODULE_ID("$Id: name_match.c,v 1.17 2008/08/03 19:49:33 tom Exp $")
/*
* _nc_first_name(char *names)
@@ -53,18 +53,21 @@ _nc_first_name(const char *const sp)
if (sp == 0) {
if (FirstName != 0)
FreeAndNull(FirstName);
- return 0;
- }
+ } else
#endif
+ {
+ if (FirstName == 0)
+ FirstName = typeMalloc(char, MAX_NAME_SIZE + 1);
- if (FirstName == 0)
- FirstName = typeMalloc(char, MAX_NAME_SIZE + 1);
- for (n = 0; n < MAX_NAME_SIZE; n++) {
- if ((FirstName[n] = sp[n]) == '\0'
- || (FirstName[n] == '|'))
- break;
+ if (FirstName != 0) {
+ for (n = 0; n < MAX_NAME_SIZE; n++) {
+ if ((FirstName[n] = sp[n]) == '\0'
+ || (FirstName[n] == '|'))
+ break;
+ }
+ FirstName[n] = '\0';
+ }
}
- FirstName[n] = '\0';
return (FirstName);
}