From e97990e14412193bc2d89a532ada86d12c4e66de Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Tue, 19 Feb 2013 21:41:53 +0100 Subject: [PATCH] Add install(1) stub. --- utils/.gitignore | 43 +++++++++++++++++++++--------------------- utils/Makefile | 2 ++ utils/cp.cpp | 12 ++++++++++++ utils/install-file.cpp | 24 +++++++++++++++++++++++ 4 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 utils/install-file.cpp diff --git a/utils/.gitignore b/utils/.gitignore index 0d18f08a..c126e465 100644 --- a/utils/.gitignore +++ b/utils/.gitignore @@ -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 diff --git a/utils/Makefile b/utils/Makefile index ef1332d7..8b80653e 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -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 diff --git a/utils/cp.cpp b/utils/cp.cpp index 330a2c28..bb4eee98 100644 --- a/utils/cp.cpp +++ b/utils/cp.cpp @@ -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); diff --git a/utils/install-file.cpp b/utils/install-file.cpp new file mode 100644 index 00000000..c945a509 --- /dev/null +++ b/utils/install-file.cpp @@ -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 . + + install-file.cpp + Installs files into system directories. + +*******************************************************************************/ + +#define CP_PRETEND_TO_BE_INSTALL +#include "cp.cpp"