Skip to content

Commit b0f3b89

Browse files
committed
Migrate putenv to setenv
putenv was the old standard. Now setenv has also made it's way to the set of UNIX standards. Considering the current buggy nature of putenv doing a migration to setenv. Fixes abishekvashok#38 Signed-off-by: Abishek V Ashok <[email protected]>
1 parent b5759ff commit b0f3b89

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

cmatrix.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -293,12 +293,8 @@ int main(int argc, char *argv[]) {
293293
int randmin = 0;
294294
int pause = 0;
295295

296-
char *oldtermname;
297-
char *oldterm = NULL;
298-
299296
srand((unsigned) time(NULL));
300297

301-
302298
/* Many thanks to morph- ([email protected]) for this getopt patch */
303299
opterr = 0;
304300
while ((optchr = getopt(argc, argv, "abBfhlnrosxVu:C:")) != EOF) {
@@ -379,11 +375,9 @@ int main(int argc, char *argv[]) {
379375
bold = 0;
380376
}
381377

382-
oldtermname = getenv("TERM");
383378
if (force && strcmp("linux", getenv("TERM"))) {
384-
/* Portability wins out here, apparently putenv is much more
385-
common on non-Linux than setenv */
386-
putenv("TERM=linux");
379+
/* setenv is much more safe to use than putenv */
380+
setenv("TERM", "linux", 1);
387381
}
388382
initscr();
389383
savetty();

0 commit comments

Comments
 (0)