2012-03-11 15:57:13 +01:00
|
|
|
/*******************************************************************************
|
|
|
|
|
|
|
|
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011, 2012.
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU General Public License as published by the Free
|
|
|
|
Software Foundation, either version 3 of the License, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program 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 General Public License for
|
|
|
|
more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along with
|
|
|
|
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
help.cpp
|
|
|
|
Prints a friendly message and ls /bin.
|
|
|
|
|
|
|
|
*******************************************************************************/
|
|
|
|
|
2011-08-27 23:26:11 +02:00
|
|
|
#include <stdio.h>
|
2011-11-26 11:00:45 +01:00
|
|
|
#include <errno.h>
|
|
|
|
#include <error.h>
|
2012-03-02 15:00:11 +01:00
|
|
|
#include <unistd.h>
|
2011-08-27 23:26:11 +02:00
|
|
|
|
|
|
|
int main(int argc, char* argv[])
|
|
|
|
{
|
|
|
|
printf("Please enter the name of one of the following programs:\n");
|
|
|
|
|
|
|
|
const char* programname = "ls";
|
2012-03-02 15:00:11 +01:00
|
|
|
const char* newargv[] = { programname, "/bin", NULL };
|
|
|
|
execv(programname, (char* const*) newargv);
|
2011-11-26 11:00:45 +01:00
|
|
|
error(1, errno, "%s", programname);
|
|
|
|
|
2011-08-27 23:26:11 +02:00
|
|
|
return 1;
|
|
|
|
}
|