apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: apr libapr.dsp configure.in apr.dsp CHANGES
Date Mon, 17 Feb 2003 03:47:11 GMT
brane       2003/02/16 19:47:11

  Modified:    test     testall.c test_apr.h Makefile.win Makefile.in
               misc/unix Makefile.in
               .        libapr.dsp configure.in apr.dsp CHANGES
  Added:       test     testenv.c
               misc/win32 env.c
               misc/unix env.c
               include  apr_env.h
  Log:
  Added a new module, apr_env, for manipulating the environment. The new
  functions are apr_env_get, apr_env_set and apr_env_delete. Also added a set
  of tests for the new functions.
  
  Revision  Changes    Path
  1.41      +1 -0      apr/test/testall.c
  
  Index: testall.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testall.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- testall.c	12 Feb 2003 20:20:55 -0000	1.40
  +++ testall.c	17 Feb 2003 03:47:09 -0000	1.41
  @@ -107,6 +107,7 @@
       {"testnames", testnames},
       {"testuser", testuser},
       {"testpath", testpath},
  +    {"testenv", testenv},
       {"LastTest", NULL}
   };
   
  
  
  
  1.41      +1 -0      apr/test/test_apr.h
  
  Index: test_apr.h
  ===================================================================
  RCS file: /home/cvs/apr/test/test_apr.h,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- test_apr.h	12 Feb 2003 20:20:55 -0000	1.40
  +++ test_apr.h	17 Feb 2003 03:47:09 -0000	1.41
  @@ -95,6 +95,7 @@
   CuSuite *testnames(void);
   CuSuite *testuser(void);
   CuSuite *testpath(void);
  +CuSuite *testenv(void);
   
   /* Assert that RV is an APR_SUCCESS value; else fail giving strerror
    * for RV and CONTEXT message. */
  
  
  
  1.8       +2 -1      apr/test/Makefile.win
  
  Index: Makefile.win
  ===================================================================
  RCS file: /home/cvs/apr/test/Makefile.win,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Makefile.win	12 Feb 2003 20:20:55 -0000	1.7
  +++ Makefile.win	17 Feb 2003 03:47:09 -0000	1.8
  @@ -99,7 +99,8 @@
   	testfmt.obj testfile.obj testdir.obj testfileinfo.obj testrand.obj \
   	testdso.obj testoc.obj testdup.obj testsockets.obj testproc.obj \
   	testpoll.obj testlock.obj testsockopt.obj testpipe.obj testthread.obj \
  -	testhash.obj testargs.obj testnames.obj testuser.obj testpath.obj
  +	testhash.obj testargs.obj testnames.obj testuser.obj testpath.obj \
  +	testenv.obj
   
   testall.exe: $(TESTS) CuTest.obj $(LOCAL_LIBS)
   	$(LINK) /debug /subsystem:console /machine:I386 $(TESTS) CuTest.obj \
  
  
  
  1.134     +2 -1      apr/test/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/test/Makefile.in,v
  retrieving revision 1.133
  retrieving revision 1.134
  diff -u -r1.133 -r1.134
  --- Makefile.in	12 Feb 2003 20:20:55 -0000	1.133
  +++ Makefile.in	17 Feb 2003 03:47:09 -0000	1.134
  @@ -102,7 +102,8 @@
   	testfmt.lo testfile.lo testdir.lo testfileinfo.lo testrand.lo \
   	testdso.lo testoc.lo testdup.lo testsockets.lo testproc.lo \
   	testpoll.lo testlock.lo testsockopt.lo testpipe.lo testthread.lo \
  -	testhash.lo testargs.lo testnames.lo testuser.lo testpath.lo
  +	testhash.lo testargs.lo testnames.lo testuser.lo testpath.lo \
  +	testenv.lo
   
   testall: $(TESTS) mod_test.la libmod_test.la occhild@EXEEXT@ \
   	 CuTest.lo proc_child@EXEEXT@ $(LOCAL_LIBS)
  
  
  
  1.1                  apr/test/testenv.c
  
  Index: testenv.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #include "apr_env.h"
  #include "apr_errno.h"
  #include "test_apr.h"
  
  #define TEST_ENVVAR_NAME "apr_test_envvar"
  #define TEST_ENVVAR_VALUE "Just a value that we'll check"
  
  static int have_env_set;
  static int have_env_get;
  
  static void test_setenv(CuTest *tc)
  {
      apr_status_t rv;
  
      rv = apr_env_set(TEST_ENVVAR_NAME, TEST_ENVVAR_VALUE, p);
      have_env_set = (rv != APR_ENOTIMPL);
      if (!have_env_set) {
          CuNotImpl(tc, "apr_env_set");
      }
      apr_assert_success(tc, "set environment variable", rv);
  }
  
  static void test_getenv(CuTest *tc)
  {
      char *value;
      apr_status_t rv;
  
      if (!have_env_set) {
          CuNotImpl(tc, "apr_env_set (skip test for apr_env_get)");
      }
  
      rv = apr_env_get(&value, TEST_ENVVAR_NAME, p);
      have_env_get = (rv != APR_ENOTIMPL);
      if (!have_env_get) {
          CuNotImpl(tc, "apr_env_get");
      }
      apr_assert_success(tc, "get environment variable", rv);
      CuAssertStrEquals(tc, TEST_ENVVAR_VALUE, value);
  }
  
  static void test_delenv(CuTest *tc)
  {
      char *value;
      apr_status_t rv;
  
      if (!have_env_set) {
          CuNotImpl(tc, "apr_env_set (skip test for apr_env_delete)");
      }
  
      rv = apr_env_delete(TEST_ENVVAR_NAME, p);
      if (rv == APR_ENOTIMPL) {
          CuNotImpl(tc, "apr_env_delete");
      }
      apr_assert_success(tc, "delete environment variable", rv);
  
      if (!have_env_get) {
          CuNotImpl(tc, "apr_env_get (skip sanity check for apr_env_delete)");
      }
      rv = apr_env_get(&value, TEST_ENVVAR_NAME, p);
      CuAssertIntEquals(tc, APR_ENOENT, rv);
  }
  
  CuSuite *testenv(void)
  {
      CuSuite *suite = CuSuiteNew("Environment");
  
      SUITE_ADD_TEST(suite, test_setenv);
      SUITE_ADD_TEST(suite, test_getenv);
      SUITE_ADD_TEST(suite, test_delenv);
  
      return suite;
  }
  
  
  
  
  1.1                  apr/misc/win32/env.c
  
  Index: env.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #define APR_WANT_STRFUNC
  #include "apr_want.h"
  #include "apr.h"
  #include "apr_arch_misc.h"
  #include "apr_arch_utf8.h"
  #include "apr_env.h"
  #include "apr_errno.h"
  #include "apr_pools.h"
  
  
  #if APR_HAS_UNICODE_FS
  static apr_status_t widen_envvar_name (apr_wchar_t *buffer,
                                         apr_size_t bufflen,
                                         const char *envvar)
  {
      apr_size_t inchars;
      apr_status_t status;
  
      inchars = strlen(envvar) + 1;
      status = apr_conv_utf8_to_ucs2(envvar, &inchars, buffer, &bufflen);
      if (status == APR_INCOMPLETE)
          status = APR_ENAMETOOLONG;
  
      return status;
  }
  #endif
  
  
  APR_DECLARE(apr_status_t) apr_env_get(char **value,
                                        const char *envvar,
                                        apr_pool_t *pool)
  {
      char *val = NULL;
      DWORD size;
  
  #if APR_HAS_UNICODE_FS
      IF_WIN_OS_IS_UNICODE
      {
          apr_wchar_t wenvvar[APR_PATH_MAX];
          apr_size_t inchars, outchars;
          apr_wchar_t *wvalue, dummy;
          apr_status_t status;
  
          status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar);
          if (status)
              return status;
  
          size = GetEnvironmentVariableW(wenvvar, &dummy, 0);
          if (size == 0)
              /* The environment variable doesn't exist. */
              return APR_ENOENT;
  
          wvalue = apr_palloc(pool, size * sizeof(*wvalue));
          size = GetEnvironmentVariableW(wenvvar, wvalue, size);
          if (size == 0)
              /* Mid-air collision?. Somebody must've changed the env. var. */
              return APR_INCOMPLETE;
  
          inchars = wcslen(wvalue) + 1;
          outchars = 3 * inchars; /* Enougn for any UTF-8 representation */
          val = apr_palloc(pool, outchars);
          status = apr_conv_ucs2_to_utf8(wvalue, &inchars, val, &outchars);
          if (status)
              return status;
      }
  #endif
  #if APR_HAS_ANSI_FS
      ELSE_WIN_OS_IS_ANSI
      {
          char dummy;
  
          size = GetEnvironmentVariableA(envvar, &dummy, 0);
          if (size == 0)
              /* The environment variable doesn't exist. */
              return APR_ENOENT;
  
          val = apr_palloc(pool, size);
          size = GetEnvironmentVariableA(envvar, val, size);
          if (size == 0)
              /* Mid-air collision?. Somebody must've changed the env. var. */
              return APR_INCOMPLETE;
      }
  #endif
  
      *value = val;
      return APR_SUCCESS;
  }
  
  
  APR_DECLARE(apr_status_t) apr_env_set(const char *envvar,
                                        const char *value,
                                        apr_pool_t *pool)
  {
  #if APR_HAS_UNICODE_FS
      IF_WIN_OS_IS_UNICODE
      {
          apr_wchar_t wenvvar[APR_PATH_MAX];
          apr_wchar_t *wvalue;
          apr_size_t inchars, outchars;
          apr_status_t status;
  
          status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar);
          if (status)
              return status;
  
          outchars = inchars = strlen(value) + 1;
          wvalue = apr_palloc(pool, outchars * sizeof(*wvalue));
          status = apr_conv_utf8_to_ucs2(value, &inchars, wvalue, &outchars);
          if (status)
              return status;
  
          if (!SetEnvironmentVariableW(wenvvar, wvalue))
              return apr_get_os_error();
      }
  #endif
  #if APR_HAS_ANSI_FS
      ELSE_WIN_OS_IS_ANSI
      {
          if (!SetEnvironmentVariableA(envvar, value))
              return apr_get_os_error();
      }
  #endif
  
      return APR_SUCCESS;
  }
  
  
  APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool)
  {
  #if APR_HAS_UNICODE_FS
      IF_WIN_OS_IS_UNICODE
      {
          apr_wchar_t wenvvar[APR_PATH_MAX];
          apr_status_t status;
  
          status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar);
          if (status)
              return status;
  
          if (!SetEnvironmentVariableW(wenvvar, NULL))
              return apr_get_os_error();
      }
  #endif
  #if APR_HAS_ANSI_FS
      ELSE_WIN_OS_IS_ANSI
      {
          if (!SetEnvironmentVariableA(envvar, NULL))
              return apr_get_os_error();
      }
  #endif
  
      return APR_SUCCESS;
  }
  
  
  
  1.33      +1 -1      apr/misc/unix/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/apr/misc/unix/Makefile.in,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- Makefile.in	12 Nov 2002 02:55:45 -0000	1.32
  +++ Makefile.in	17 Feb 2003 03:47:10 -0000	1.33
  @@ -3,7 +3,7 @@
   
   TARGETS = \
   	start.lo getopt.lo otherchild.lo errorcodes.lo rand.lo version.lo \
  -	charset.lo
  +	charset.lo env.lo
   
   # bring in rules.mk for standard functionality
   @INCLUDE_RULES@
  
  
  
  1.1                  apr/misc/unix/env.c
  
  Index: env.c
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #define APR_WANT_STRFUNC
  #include "apr_want.h"
  #include "apr.h"
  #include "apr_private.h"
  #include "apr_env.h"
  
  #if APR_HAVE_UNISTD_H
  #include <unistd.h>
  #endif
  #if APR_HAVE_STDLIB_H
  #include <stdlib.h>
  #endif
  
  APR_DECLARE(apr_status_t) apr_env_get(char **value,
                                        const char *envvar,
                                        apr_pool_t *pool)
  {
  #ifdef HAVE_GETENV
  
      char *val = getenv(envvar);
      if (!val)
          return APR_ENOENT;
      *value = val;
      return APR_SUCCESS;
  
  #else
      return APR_ENOTIMPL;
  #endif
  }
  
  
  APR_DECLARE(apr_status_t) apr_env_set(const char *envvar,
                                        const char *value,
                                        apr_pool_t *pool)
  {
  #if defined(HAVE_SETENV)
  
      if (0 > setenv(envvar, value, 1))
          return APR_ENOMEM;
      return APR_SUCCESS;
  
  #elif defined(HAVE_PUTENV)
  
      apr_size_t elen = strlen(envvar);
      apr_size_t vlen = strlen(value);
      char *env = apr_palloc(pool, elen + vlen + 2);
      char *p = env + elen;
  
      memcpy(env, envvar, elen);
      *p++ = '=';
      memcpy(p, value, vlen);
      p[vlen] = '\0';
  
      if (0 > putenv(env))
          return APR_ENOMEM;
      return APR_SUCCESS;
  
  #else
      return APR_ENOTIMPL;
  #endif
  }
  
  
  APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool)
  {
  #ifdef HAVE_UNSETENV
  
      unsetenv(envvar);
      return APR_SUCCESS;
  
  #else
      return APR_ENOTIMPL;
  #endif
  }
  
  
  
  1.1                  apr/include/apr_env.h
  
  Index: apr_env.h
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  #ifndef APR_ENV_H
  #define APR_ENV_H
  /**
   * @file apr_env.h
   * @brief APR Environment functions
   */
  /**
   * @defgroup APR_ENV Functions for manupulating the environment
   * @ingroup APR_ENV
   * @{
   */
  
  #include "apr_errno.h"
  #include "apr_pools.h"
  
  #ifdef __cplusplus
  extern "C" {
  #endif /* __cplusplus */
  
  /**
   * Get the value of an environment variable
   * @param value the returned value, allocated from @a pool
   * @param envvar the name of the environment variable
   * @param pool where to allocate @a value and any temporary storage from
   * @deffunc apr_status_t apr_env_get(char **value, const char *envvar, apr_pool_t *pool)
   */
  APR_DECLARE(apr_status_t) apr_env_get(char **value, const char *envvar,
                                        apr_pool_t *pool);
  
  /**
   * Set the value of an environment variable
   * @param envvar the name of the environment variable
   * @param value the value to set
   * @param pool where to allocate temporary storage from
   * @deffunc apr_status_t apr_env_get(const char *envvar, const char *value, apr_pool_t *pool)
   */
  APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, const char *value,
                                        apr_pool_t *pool);
  
  /**
   * Delete a variable from the environment
   * @param envvar the name of the environment variable
   * @param pool where to allocate temporary storage from
   * @deffunc apr_status_t apr_env_delete(const char *envvar, apr_pool_t *pool)
   */
  APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool);
  
  
  #ifdef __cplusplus
  }
  #endif
  /** @} */
  #endif  /* ! APR_ENV_H */
  
  
  
  1.87      +12 -0     apr/libapr.dsp
  
  Index: libapr.dsp
  ===================================================================
  RCS file: /home/cvs/apr/libapr.dsp,v
  retrieving revision 1.86
  retrieving revision 1.87
  diff -u -r1.86 -r1.87
  --- libapr.dsp	16 Feb 2003 09:56:30 -0000	1.86
  +++ libapr.dsp	17 Feb 2003 03:47:10 -0000	1.87
  @@ -213,6 +213,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=.\misc\win32\env.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\misc\unix\errorcodes.c
   # End Source File
   # Begin Source File
  @@ -448,6 +452,10 @@
   
   SOURCE=.\include\arch\win32\apr_private.h
   # End Source File
  +# Begin Source File
  +
  +SOURCE=.\include\arch\apr_private_common.h
  +# End Source File
   # End Group
   # Begin Group "Public Header Files"
   
  @@ -500,6 +508,10 @@
   # Begin Source File
   
   SOURCE=.\include\apr_errno.h
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=.\include\apr_env.h
   # End Source File
   # Begin Source File
   
  
  
  
  1.515     +1 -0      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.514
  retrieving revision 1.515
  diff -u -r1.514 -r1.515
  --- configure.in	11 Feb 2003 15:36:56 -0000	1.514
  +++ configure.in	17 Feb 2003 03:47:10 -0000	1.515
  @@ -817,6 +817,7 @@
   dnl ----------------------------- Checks for Any required Functions
   dnl Checks for library functions. (N.B. poll is further down)
   AC_CHECK_FUNCS(alloca calloc strcasecmp stricmp setsid isinf isnan)
  +AC_CHECK_FUNCS(getenv putenv setenv unsetenv)
   AC_CHECK_FUNCS(setrlimit, [ have_setrlimit="1" ], [ have_setrlimit="0" ]) 
   AC_CHECK_FUNCS(getrlimit, [ have_getrlimit="1" ], [ have_getrlimit="0" ]) 
   AC_CHECK_FUNCS(writev)
  
  
  
  1.122     +12 -0     apr/apr.dsp
  
  Index: apr.dsp
  ===================================================================
  RCS file: /home/cvs/apr/apr.dsp,v
  retrieving revision 1.121
  retrieving revision 1.122
  diff -u -r1.121 -r1.122
  --- apr.dsp	12 Feb 2003 20:20:56 -0000	1.121
  +++ apr.dsp	17 Feb 2003 03:47:10 -0000	1.122
  @@ -198,6 +198,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=.\misc\win32\env.c
  +# End Source File
  +# Begin Source File
  +
   SOURCE=.\misc\unix\errorcodes.c
   # End Source File
   # Begin Source File
  @@ -433,6 +437,10 @@
   
   SOURCE=.\include\arch\win32\apr_private.h
   # End Source File
  +# Begin Source File
  +
  +SOURCE=.\include\arch\apr_private_common.h
  +# End Source File
   # End Group
   # Begin Group "Public Header Files"
   
  @@ -481,6 +489,10 @@
   # Begin Source File
   
   SOURCE=.\include\apr_dso.h
  +# End Source File
  +# Begin Source File
  +
  +SOURCE=.\include\apr_env.h
   # End Source File
   # Begin Source File
   
  
  
  
  1.379     +3 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.378
  retrieving revision 1.379
  diff -u -r1.378 -r1.379
  --- CHANGES	17 Feb 2003 02:36:21 -0000	1.378
  +++ CHANGES	17 Feb 2003 03:47:10 -0000	1.379
  @@ -1,5 +1,8 @@
   Changes with APR 0.9.2
   
  +  *) Add functions apr_env_get, apr_env_set and apr_env_delete for
  +     manipulating the environment.  [Branko Cibej]
  +
     *) Fix APR_LAYOUT to work with layout files with no preceding blank lines
        and emit errors when layout is not found.  PR 15679.
        [Justin Erenkrantz]
  
  
  

Mime
View raw message