I'm a little confused as to the compiler warnings that I am getting and how to resolve them. Here are the errors and the relevant code slices:
declaration of cmds (relevant to most of them):
23: static char **cmds[] = { cmd0, cmd1, cmd2, cmd3, cmd4 }; 24: static int ncmds = sizeof(cmds) / sizeof(cmds[0]); pipeline.c: In function âexec_nth_commandâ: pipeline.c:41: warning: declaration of âncmdsâ shadows a global declaration pipeline.c:24: warning: shadowed declaration is here pipeline.c:41: warning: declaration of âcmdsâ shadows a global declaration pipeline.c:23: warning: shadowed declaration is here 41: static void exec_nth_command(int ncmds, char ***cmds) pipeline.c: In function âexec_pipe_commandâ: pipeline.c:68: warning: declaration of âncmdsâ shadows a global declaration pipeline.c:24: warning: shadowed declaration is here pipeline.c:68: warning: declaration of âcmdsâ shadows a global declaration pipeline.c:23: warning: shadowed declaration is here 68: static void exec_pipe_command(int ncmds, char ***cmds, Pipe output) pipeline.c: In function âexec_pipelineâ: pipeline.c:79: warning: declaration of âncmdsâ shadows a global declaration pipeline.c:24: warning: shadowed declaration is here pipeline.c:79: warning: declaration of âcmdsâ shadows a global declaration pipeline.c:23: warning: shadowed declaration is here 79: static void exec_pipeline(int ncmds, char ***cmds) pipeline.c:82: warning: ISO C90 forbids mixed declarations and code 82: pid_t pid; pipeline.c: In function âerr_usageâ: pipeline.c:141: warning: declaration of âusestrâ shadows a global declaration pipeline.c:26: warning: shadowed declaration is here 26: static char const usestr[] = "[-f filename]"; 141: static void err_usage(char const *usestr)