comparison src/SDL_compat.c @ 3581:15eea7a1fa97

Implemented SDL_setenv(), moved SDL_putenv() to compat. Fixes Bugzilla #779.
author Ryan C. Gordon <icculus@icculus.org>
date Wed, 16 Dec 2009 10:59:51 +0000
parents abefdc334970
children f8816ffa210b
comparison
equal deleted inserted replaced
3580:951dd6a5d1a2 3581:15eea7a1fa97
1752 break; 1752 break;
1753 } 1753 }
1754 return previous; 1754 return previous;
1755 } 1755 }
1756 1756
1757
1758 int
1759 SDL_putenv(const char *_var)
1760 {
1761 char *ptr = NULL;
1762 char *var = SDL_strdup(_var);
1763 if (var == NULL) {
1764 return -1; /* we don't set errno. */
1765 }
1766
1767 ptr = strchr(var, '=');
1768 if (ptr == NULL) {
1769 SDL_free(var);
1770 return -1;
1771 }
1772
1773 *ptr = '\0'; /* split the string into name and value. */
1774 SDL_setenv(var, ptr + 1, 1);
1775 SDL_free(var);
1776 return 0;
1777 }
1778
1757 /* vi: set ts=4 sw=4 expandtab: */ 1779 /* vi: set ts=4 sw=4 expandtab: */