Update main.c

add two loops to store env data depending on entry method