Add install(1) stub.

This commit is contained in:
Jonas 'Sortie' Termansen 2013-02-19 21:41:53 +01:00
parent e4bd7cad82
commit e97990e144
4 changed files with 60 additions and 21 deletions

43
utils/.gitignore vendored
View File

@ -1,31 +1,32 @@
*.o
init
calc
cat
chvideomode
clear
column
cp
echo
rm
sh
mxsh
clear
ls
pwd
help
uptime
memstat
chvideomode
uname
kernelinfo
editor
kill
column
pager
find
head
help
init
install-file
kernelinfo
kill
ln
ls
memstat
mkdir
mv
mxsh
pager
pwd
rm
rmdir
sh
tail
type
mkdir
rmdir
uname
uptime
which
ln
mv
find

View File

@ -27,6 +27,7 @@ find \
head \
help \
init \
install-file \
kernelinfo \
kill \
ln \
@ -55,6 +56,7 @@ all: $(BINARIES)
install: all
mkdir -p $(DESTDIR)$(BINDIR)
install $(BINARIES) $(DESTDIR)$(BINDIR)
install install-file $(DESTDIR)$(BINDIR)/install
uninstall:
rm -f $(INSTALLBINARIES) $(DESTDIR)$(BINDIR)/install

View File

@ -338,7 +338,11 @@ void Usage(FILE* fp, const char* argv0)
fprintf(fp, "Usage: %s [OPTION]... [-T] SOURCE DEST\n", argv0);
fprintf(fp, " or: %s [OPTION]... SOURCE... DIRECTORY\n", argv0);
fprintf(fp, " or: %s [OPTION]... -t DIRECTORY SOURCE...\n", argv0);
#ifdef CP_PRETEND_TO_BE_INSTALL
fprintf(fp, "Copy files and set attributes.\n");
#else
fprintf(fp, "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n");
#endif
}
void Help(FILE* fp, const char* argv0)
@ -378,6 +382,10 @@ int main(int argc, char* argv[])
case 'u': flags |= FLAG_UPDATE; break;
case 'P': flags |= FLAG_NO_DEREFERENCE; break;
default:
#ifdef CP_PRETEND_TO_BE_INSTALL
fprintf(stderr, "%s (fake): unknown option, ignoring -- '%c'\n", argv0, c);
continue;
#endif
fprintf(stderr, "%s: unknown option -- '%c'\n", argv0, c);
Usage(stderr, argv0);
exit(1);
@ -400,6 +408,10 @@ int main(int argc, char* argv[])
flags |= FLAG_NO_DEREFERENCE;
else
{
#ifdef CP_PRETEND_TO_BE_INSTALL
fprintf(stderr, "%s (fake): unknown option, ignoring: %s\n", argv0, arg);
continue;
#endif
fprintf(stderr, "%s: unknown option: %s\n", argv0, arg);
Usage(stderr, argv0);
exit(1);

24
utils/install-file.cpp Normal file
View File

@ -0,0 +1,24 @@
/*******************************************************************************
Copyright(C) Jonas 'Sortie' Termansen 2013.
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/>.
install-file.cpp
Installs files into system directories.
*******************************************************************************/
#define CP_PRETEND_TO_BE_INSTALL
#include "cp.cpp"