1159097Smaxim/* $NetBSD: doexec.c,v 1.8 2003/07/26 19:38:48 salo Exp $ */ 2159097Smaxim 3159097Smaxim/* 4159097Smaxim * Copyright (c) 1993 Christopher G. Demetriou 5159097Smaxim * All rights reserved. 6159097Smaxim * 7159097Smaxim * Redistribution and use in source and binary forms, with or without 8159097Smaxim * modification, are permitted provided that the following conditions 9159097Smaxim * are met: 10159097Smaxim * 1. Redistributions of source code must retain the above copyright 11159097Smaxim * notice, this list of conditions and the following disclaimer. 12159097Smaxim * 2. Redistributions in binary form must reproduce the above copyright 13159097Smaxim * notice, this list of conditions and the following disclaimer in the 14159097Smaxim * documentation and/or other materials provided with the distribution. 15159097Smaxim * 3. All advertising materials mentioning features or use of this software 16159097Smaxim * must display the following acknowledgement: 17159097Smaxim * This product includes software developed for the 18159097Smaxim * NetBSD Project. See http://www.NetBSD.org/ for 19159097Smaxim * information about NetBSD. 20159097Smaxim * 4. The name of the author may not be used to endorse or promote products 21159097Smaxim * derived from this software without specific prior written permission. 22159097Smaxim * 23159097Smaxim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 24159097Smaxim * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 25159097Smaxim * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 26159097Smaxim * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 27159097Smaxim * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 28159097Smaxim * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 29159097Smaxim * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 30159097Smaxim * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31159097Smaxim * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32159097Smaxim * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33159097Smaxim * 34159097Smaxim * $FreeBSD: stable/10/tests/sys/kern/execve/execve_helper.c 312320 2017-01-17 01:55:05Z ngie $ 35159097Smaxim */ 36159097Smaxim 37281464Sngie#include <err.h> 38159097Smaxim#include <errno.h> 39159097Smaxim#include <stdio.h> 40159097Smaxim#include <stdlib.h> 41159097Smaxim#include <unistd.h> 42159097Smaxim 43159097Smaximint 44281464Sngiemain(int argc, char **argv) 45159097Smaxim{ 46281464Sngie 47159097Smaxim if (argc != 2) { 48159097Smaxim fprintf(stderr, "usage: %s <progname>\n", argv[0]); 49159097Smaxim exit(2); 50159097Smaxim } 51159097Smaxim 52281464Sngie execve(argv[1], &argv[1], NULL); 53312320Sngie err(1, "execve failed"); 54159097Smaxim} 55