/* Copyright (C) 1991, 93, 1995-1998, 2000 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sysdep.h>		/* In case it wants to define anything.  */

/* The first piece of initialized data.  */
int __data_start = 0;
#ifdef HAVE_WEAK_SYMBOLS
/* ETI weak_alias (__data_start, data_start) */
#endif

#ifndef errno
/* __errno must be initialized since otherwise one cannot create an
   alias (at least on some platforms).  */
volatile int __errno = 0;
strong_alias (__errno, errno)
#endif

extern void __libc_init (int argc, char **argv, char **envp);
extern int main (int argc, char **argv, char **envp);


void _start(int argc, char** argv, char** env)
{
  /* The environment starts just after ARGV.  */
  __environ = env;

  /* Do C library initializations.  */
  __libc_init (argc, argv, __environ);

  /* Call the user program.  */
  exit( main(argc, argv, __environ) );
}
