FAQ Database Discussion Community

c - unsetenv() implementation, is it necessary to free memory?

As TLPI exercise 6-3 required, I made an implementation of setenv() and unsetenv() using putenv(), getenv() and via modifing environ variable directly. Code: // setenv() / unsetenv() impl // TLPI exercise 6-3 #include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include <errno.h> #define ENV_SEP '=' extern char **environ; // setenv()...

How to make setenv to an output of a perl script

I wrote a perl script that prints a path to a very specific file. I want to define a personal environment variables (by using setenv in .aliases file) that gives the output of this script. For example, let's say that the file "myscript.pl" prints the path "/home/files/reports/file". Let's call the...