Created
December 10, 2008 16:49
-
-
Save aristidb/34375 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boost::any environment::enumerate_start(int &n) { | |
n = 0; // We dont know how many | |
return boost::any(environ); | |
} | |
value environment::enumerate_next(boost::any &iter) { | |
char **env = boost::any_cast<char**>(iter); | |
if (*env == 0) | |
return value(); | |
char *eq_c = strchr(*env, '='); | |
string result = string(*env, eq_c - *env); | |
iter = ++env; | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment