Back to index

glibc  2.9
Functions | Variables
dl-environ.c File Reference
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <ldsodefs.h>

Go to the source code of this file.

Functions

char *internal_function _dl_next_ld_env_entry (char ***position)
int unsetenv (const char *name)

Variables

char **__environ attribute_hidden

Function Documentation

char* internal_function _dl_next_ld_env_entry ( char ***  position)

Definition at line 29 of file dl-environ.c.

{
  char **current = *position;
  char *result = NULL;

  while (*current != NULL)
    {
      if (__builtin_expect ((*current)[0] == 'L', 0)
         && (*current)[1] == 'D' && (*current)[2] == '_')
       {
         result = &(*current)[3];

         /* Save current position for next visit.  */
         *position = ++current;

         break;
       }

      ++current;
    }

  return result;
}

Here is the caller graph for this function:

int unsetenv ( const char *  name)

Definition at line 58 of file dl-environ.c.

{
  char **ep;

  ep = __environ;
  while (*ep != NULL)
    {
      size_t cnt = 0;

      while ((*ep)[cnt] == name[cnt] && name[cnt] != '\0')
       ++cnt;

      if (name[cnt] == '\0' && (*ep)[cnt] == '=')
       {
         /* Found it.  Remove this pointer by moving later ones to
            the front.  */
         char **dp = ep;

         do
           dp[0] = dp[1];
         while (*dp++);
         /* Continue the loop in case NAME appears again.  */
       }
      else
       ++ep;
    }

  return 0;
}

Here is the caller graph for this function:


Variable Documentation

Definition at line 25 of file init-first.c.