X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Fhome_terminfo.c;fp=ncurses%2Ftinfo%2Fhome_terminfo.c;h=69b8a96ffcff745a0ce855cf1a54b7869b63312d;hp=7aa4ca112e5ad51a56ace2c7caed0f740edd5f1d;hb=c633e5103a29a38532cf1925257b91cea33fd090;hpb=b1f61d9f3aa244512045a6b02e759825d7049d34 diff --git a/ncurses/tinfo/home_terminfo.c b/ncurses/tinfo/home_terminfo.c index 7aa4ca11..69b8a96f 100644 --- a/ncurses/tinfo/home_terminfo.c +++ b/ncurses/tinfo/home_terminfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2000 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,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1998 * + * Author: Thomas E. Dickey 1998,2000 * ****************************************************************************/ /* @@ -37,7 +37,7 @@ #include #include -MODULE_ID("$Id: home_terminfo.c,v 1.2 1999/02/27 19:58:46 tom Exp $") +MODULE_ID("$Id: home_terminfo.c,v 1.3 2000/10/04 02:31:53 tom Exp $"); #define my_length (strlen(home) + sizeof(PRIVATE_INFO)) @@ -46,17 +46,20 @@ MODULE_ID("$Id: home_terminfo.c,v 1.2 1999/02/27 19:58:46 tom Exp $") char * _nc_home_terminfo(void) { - char *home; - static char *temp = 0; + char *home; + static char *temp = 0; + if (use_terminfo_vars()) { if (temp == 0) { - if ((home = getenv("HOME")) != 0 - && my_length <= PATH_MAX) { - temp = typeMalloc(char, my_length); - if (temp == 0) - _nc_err_abort("Out of memory"); - (void) sprintf(temp, PRIVATE_INFO, home); - } + if ((home = getenv("HOME")) != 0 + && my_length <= PATH_MAX) { + temp = typeMalloc(char, my_length); + if (temp == 0) + _nc_err_abort("Out of memory"); + (void) sprintf(temp, PRIVATE_INFO, home); + } } return temp; + } + return 0; }