I'm making a minishell in C. I don't know what is the best way to order the strings. The idea is that by running the C program and typing "export" with no arguments, it simulates the output that bash does (declare -x "text").
How can i order it? Since export in bash orders the output of the env
Thanks
Edit:
I have this for the moment so that I can display it (without ordering), where g_shell->env is a global environment variable
int i = 0;
while (g_shell->env[i])
{
printf("%s\n", g_shell->env[i]);
i++;
}
qsort()inbuilt function to sort an array of strings (char **). See this link: stackoverflow.com/a/23189704