mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-30 04:33:01 +00:00
Checkin of install version 1.2. New to this version is use of GS/OS
sessions, and a verbose flag to print out file names as they are copied.
This commit is contained in:
parent
32ccee5a06
commit
5af9e3b875
@ -1,4 +1,4 @@
|
|||||||
Copyright 1996-1997 Devin Reade <gdr@myrias.com>.
|
Copyright 1996-1998 Devin Reade <gdr@trenco.gno.org>.
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# $Id: Makefile,v 1.2 1998/03/08 18:18:57 gdr-ftp Exp $
|
# $Id: Makefile,v 1.3 1998/04/24 00:53:59 gdr-ftp Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
# Don't name this "install"; we change the name later.
|
# Don't name this "install"; we change the name later.
|
||||||
@ -7,8 +7,8 @@ PROG = inst
|
|||||||
BINDIR = /usr/bin
|
BINDIR = /usr/bin
|
||||||
CUSTOM_RELEASE = true
|
CUSTOM_RELEASE = true
|
||||||
LDADD = -lcontrib
|
LDADD = -lcontrib
|
||||||
OPTIMIZE = 78
|
OPTIMIZE = -1
|
||||||
STACK = 1024
|
STACK = 1024 # largest observed is 707 bytes
|
||||||
|
|
||||||
.INCLUDE: /src/gno/prog.mk
|
.INCLUDE: /src/gno/prog.mk
|
||||||
|
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
$Id: README,v 1.2 1997/10/30 04:14:21 gdr Exp $
|
$Id: README,v 1.3 1998/04/24 00:54:00 gdr-ftp Exp $
|
||||||
|
|
||||||
As the describe file says, install(1) is a utility similar to cp(1),
|
As the describe file says, install(1) is a utility similar to cp(1),
|
||||||
except that it does a few more things and is intended for use in
|
except that it does a few more things and is intended for use in
|
||||||
makefiles and scripts.
|
makefiles and scripts.
|
||||||
|
|
||||||
To install install, type "dmake doinstall". By default, it places the
|
To install install, type "dmake install". By default, it places the
|
||||||
binary in /usr/bin and the man page in /usr/man/man1. If you don't
|
binary in /usr/bin and the man page in /usr/man/man1. If you don't
|
||||||
like these locations, either modify the makefile or copy the two files
|
like these locations, either modify the makefile or copy the two files
|
||||||
by hand. There are no support files.
|
by hand. There are no support files. [Note: As of v1.1, the
|
||||||
|
assumption is that you're building these files from within the GNO
|
||||||
|
base source hierarchy.]
|
||||||
|
|
||||||
As usual, please email me or post to comp.sys.apple2.gno if you
|
As usual, please email me or post to comp.sys.apple2.gno if you
|
||||||
encounter problems or bugs.
|
encounter problems or bugs.
|
||||||
@ -19,6 +21,11 @@ March 1996
|
|||||||
CHANGE LOG
|
CHANGE LOG
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
v1.2 April 1998
|
||||||
|
- Added sessions to (hopefully) speed things up.
|
||||||
|
- Increased to use optimization level -1. It seems to work.
|
||||||
|
- Added the -V (verbose) flag.
|
||||||
|
|
||||||
v1.1 August 1997
|
v1.1 August 1997
|
||||||
- Incorporated install(1) into base GNO v2.0.6 distribution
|
- Incorporated install(1) into base GNO v2.0.6 distribution
|
||||||
- Use the GNO v2.0.6 libcontrib library
|
- Use the GNO v2.0.6 libcontrib library
|
||||||
@ -27,4 +34,4 @@ v1.1 August 1997
|
|||||||
usual UNIX usage.
|
usual UNIX usage.
|
||||||
|
|
||||||
v1.0 March 1996
|
v1.0 March 1996
|
||||||
Initial Version
|
- Initial Version
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
.\" Copyright 1996-1997 Devin Reade <gdr@myrias.com>
|
.\" Copyright 1996-1997 Devin Reade <gdr@trenco.gno.org>.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id: inst.1,v 1.2 1997/10/30 04:14:21 gdr Exp $
|
.\" $Id: inst.1,v 1.3 1998/04/24 00:54:02 gdr-ftp Exp $
|
||||||
.\"
|
.\"
|
||||||
.TH INSTALL 1 "16 October 1997" GNO "Commands and Applications"
|
.TH INSTALL 1 "23 April 1998" GNO "Commands and Applications"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
install \- copy files and set their attributes
|
install \- copy files and set their attributes
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
@ -99,14 +99,27 @@ may also be numeric user ID.
|
|||||||
Strip the symbol tables from the installed programs.
|
Strip the symbol tables from the installed programs.
|
||||||
.sp
|
.sp
|
||||||
\fBThis is currently ignored under GNO.\fR
|
\fBThis is currently ignored under GNO.\fR
|
||||||
|
.IP \fB-V\fR
|
||||||
|
Verbose output;
|
||||||
|
.BR install
|
||||||
|
will print out the name of each file or directory as it is created.
|
||||||
.IP \fB-v\fR
|
.IP \fB-v\fR
|
||||||
Show version number.
|
Show version number.
|
||||||
|
.SH BUGS
|
||||||
|
When installing multiple files into a directory and the
|
||||||
|
.BR -V
|
||||||
|
flag is given, the respective file names are printed
|
||||||
|
.I after
|
||||||
|
the file has been copied, rather than before. This was done since the
|
||||||
|
final file name is known only after the copying subroutine has returned.
|
||||||
|
While the name could be determined prior to the copy, this extra work
|
||||||
|
was left out for efficiency reasons.
|
||||||
.SH VERSION
|
.SH VERSION
|
||||||
This manual page documents
|
This manual page documents
|
||||||
.BR install
|
.BR install
|
||||||
version 1.1.
|
version 1.2.
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
Devin Reade <gdr@eddore.myrias.com>
|
Devin Reade <gdr@trenco.gno.org>.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR cp (1)
|
.BR cp (1)
|
||||||
.BR chmod (2).
|
.BR chmod (2).
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1996-1997 Devin Reade <gdr@myrias.com>.
|
* Copyright 1996-1997 Devin Reade <gdr@trenco.gno.org>.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* For copying and distribution information, see the file "COPYING"
|
* For copying and distribution information, see the file "COPYING"
|
||||||
* accompanying this file.
|
* accompanying this file.
|
||||||
*
|
*
|
||||||
* $Id: inst.c,v 1.4 1998/03/08 18:18:58 gdr-ftp Exp $
|
* $Id: inst.c,v 1.5 1998/04/24 00:54:03 gdr-ftp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define VERSION "1.2"
|
||||||
|
#define EMAIL "<gdr@trenco.gno.org>"
|
||||||
|
|
||||||
#define __USE_DYNAMIC_GSSTRING__
|
#define __USE_DYNAMIC_GSSTRING__
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -40,23 +43,8 @@
|
|||||||
#define S_WRITE 0222
|
#define S_WRITE 0222
|
||||||
#define S_EXECUTE 0111
|
#define S_EXECUTE 0111
|
||||||
|
|
||||||
#define VERSION "1.1"
|
|
||||||
#define EMAIL "<gdr@myrias.com>"
|
|
||||||
|
|
||||||
char *versionMsg = "Version %s by Devin Reade %s\n";
|
char *versionMsg = "Version %s by Devin Reade %s\n";
|
||||||
int dFlag;
|
int dFlag, verbose;
|
||||||
|
|
||||||
#ifdef __STACK_CHECK__
|
|
||||||
/*
|
|
||||||
* printStack
|
|
||||||
*
|
|
||||||
* prints stack usage (debugging only)
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
printStack (void) {
|
|
||||||
fprintf(stderr, "stack usage: %d bytes\n", _endStackCheck());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* usage
|
* usage
|
||||||
@ -67,7 +55,7 @@ printStack (void) {
|
|||||||
void
|
void
|
||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fputs("Usage: install [-cdhsv] [-o owner] [-g group] [-m mode] ", stderr);
|
fputs("Usage: install [-cdhsvV] [-o owner] [-g group] [-m mode] ", stderr);
|
||||||
fputs("source [...] dest\n\n", stderr);
|
fputs("source [...] dest\n\n", stderr);
|
||||||
fputs("Options:\n", stderr);
|
fputs("Options:\n", stderr);
|
||||||
fputs("\t-c Ignored. (Backwards Unix compatibility)\n", stderr);
|
fputs("\t-c Ignored. (Backwards Unix compatibility)\n", stderr);
|
||||||
@ -77,6 +65,8 @@ usage(void)
|
|||||||
fputs("\t-m mode Specify (Unix) access mode\n", stderr);
|
fputs("\t-m mode Specify (Unix) access mode\n", stderr);
|
||||||
fputs("\t-o owner Specify owner id (not implemented)\n", stderr);
|
fputs("\t-o owner Specify owner id (not implemented)\n", stderr);
|
||||||
fputs("\t-s Strip binary (not implemented)\n", stderr);
|
fputs("\t-s Strip binary (not implemented)\n", stderr);
|
||||||
|
fputs("\t-V Print each file as it is created (verbose).\n",
|
||||||
|
stderr);
|
||||||
fputs("\t-v Show version number\n\n", stderr);
|
fputs("\t-v Show version number\n\n", stderr);
|
||||||
fprintf(stderr, versionMsg, VERSION, EMAIL);
|
fprintf(stderr, versionMsg, VERSION, EMAIL);
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -252,10 +242,15 @@ mkdirs(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* go ahead and create the directory */
|
/* go ahead and create the directory */
|
||||||
if (makeit && mkdir(path)) {
|
if (makeit) {
|
||||||
warn("couldn't create directory %s", path);
|
if (verbose) {
|
||||||
abortpath = 1;
|
fprintf(stderr, "%s\n", path);
|
||||||
result = 1;
|
}
|
||||||
|
if (mkdir(path)) {
|
||||||
|
warn("couldn't create directory %s", path);
|
||||||
|
abortpath = 1;
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* reinstate the ':' that we "nulled-out" */
|
/* reinstate the ':' that we "nulled-out" */
|
||||||
if (p != path + pathlen) {
|
if (p != path + pathlen) {
|
||||||
@ -288,8 +283,11 @@ copyfiles(int argc, char **argv, int action, mode_t mode)
|
|||||||
{
|
{
|
||||||
static FileInfoRecGS inforec;
|
static FileInfoRecGS inforec;
|
||||||
GSStringPtr src, dest, newname;
|
GSStringPtr src, dest, newname;
|
||||||
int total, i, result;
|
int total, i, result, printWhen;
|
||||||
unsigned short flags;
|
unsigned short flags;
|
||||||
|
#define PRINT_NEVER 0 /* used for printWhen (verbose mode) */
|
||||||
|
#define PRINT_BEFORE 1
|
||||||
|
#define PRINT_AFTER 2
|
||||||
|
|
||||||
static const char *nodup = "couldn't duplicate %s file name \"%s\"";
|
static const char *nodup = "couldn't duplicate %s file name \"%s\"";
|
||||||
|
|
||||||
@ -301,8 +299,8 @@ copyfiles(int argc, char **argv, int action, mode_t mode)
|
|||||||
flags = LC_COPY_DATA | LC_COPY_REZ | LC_COPY_KEEPBUF;
|
flags = LC_COPY_DATA | LC_COPY_REZ | LC_COPY_KEEPBUF;
|
||||||
|
|
||||||
/* duplicate the destination name */
|
/* duplicate the destination name */
|
||||||
if ((dest = __C2GSMALLOC(argv[argc - 1])) == NULL) {
|
if ((dest = __C2GSMALLOC(argv[total])) == NULL) {
|
||||||
err(1, nodup, "destination", argv[argc - 1]);
|
err(1, nodup, "destination", argv[total]);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +325,15 @@ copyfiles(int argc, char **argv, int action, mode_t mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* copy each file */
|
/* copy each file */
|
||||||
|
if (verbose) {
|
||||||
|
printWhen = (argc == 2) ? PRINT_BEFORE : PRINT_AFTER;
|
||||||
|
} else {
|
||||||
|
printWhen = PRINT_NEVER;
|
||||||
|
}
|
||||||
for (i=0; i<total; i++) {
|
for (i=0; i<total; i++) {
|
||||||
|
if (printWhen == PRINT_BEFORE) {
|
||||||
|
fprintf(stderr, "%s\n", argv[total]);
|
||||||
|
}
|
||||||
if ((src = __C2GSMALLOC(argv[i])) == NULL) {
|
if ((src = __C2GSMALLOC(argv[i])) == NULL) {
|
||||||
err(1, nodup, "source", argv[i]);
|
err(1, nodup, "source", argv[i]);
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
@ -336,8 +342,11 @@ copyfiles(int argc, char **argv, int action, mode_t mode)
|
|||||||
if (newname == NULL) {
|
if (newname == NULL) {
|
||||||
result = errno;
|
result = errno;
|
||||||
warn("install of %s to %s failed", argv[i],
|
warn("install of %s to %s failed", argv[i],
|
||||||
argv[argc-1]);
|
argv[total]);
|
||||||
} else {
|
} else {
|
||||||
|
if (printWhen == PRINT_AFTER) {
|
||||||
|
fprintf(stderr, "%s\n", newname->text);
|
||||||
|
}
|
||||||
if (action & ACTION_CHANGE_MODE) {
|
if (action & ACTION_CHANGE_MODE) {
|
||||||
if (chmod(newname->text, mode) < 0) {
|
if (chmod(newname->text, mode) < 0) {
|
||||||
result = errno;
|
result = errno;
|
||||||
@ -363,11 +372,8 @@ main(int argc, char **argv)
|
|||||||
int c, nfiles;
|
int c, nfiles;
|
||||||
int action = 0;
|
int action = 0;
|
||||||
|
|
||||||
#ifdef __STACK_CHECK__
|
__REPORT_STACK();
|
||||||
_beginStackCheck();
|
|
||||||
atexit(printStack);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (needsgno() == 0) {
|
if (needsgno() == 0) {
|
||||||
errx(1, "requires GNO");
|
errx(1, "requires GNO");
|
||||||
}
|
}
|
||||||
@ -377,7 +383,7 @@ main(int argc, char **argv)
|
|||||||
newmode = 0L;
|
newmode = 0L;
|
||||||
|
|
||||||
/* parse command line */
|
/* parse command line */
|
||||||
while ((c = getopt(argc, argv, "cdg:hm:o:sv")) != EOF) {
|
while ((c = getopt(argc, argv, "cdg:hm:o:svV")) != EOF) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'v':
|
case 'v':
|
||||||
errx(1, versionMsg, VERSION, EMAIL);
|
errx(1, versionMsg, VERSION, EMAIL);
|
||||||
@ -391,6 +397,10 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'V':
|
||||||
|
verbose=1;
|
||||||
|
break;
|
||||||
|
|
||||||
case 'd': dFlag++;
|
case 'd': dFlag++;
|
||||||
case 'c': /* not implemented */
|
case 'c': /* not implemented */
|
||||||
case 'g': /* not implemented */
|
case 'g': /* not implemented */
|
||||||
@ -404,6 +414,30 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
nfiles = argc - optind;
|
nfiles = argc - optind;
|
||||||
|
#if 1
|
||||||
|
if (nfiles < (dFlag ? 1 : 2)) {
|
||||||
|
usage();
|
||||||
|
}
|
||||||
|
|
||||||
|
c = 0; /* using c as a temp variable */
|
||||||
|
BeginSessionGS(&c);
|
||||||
|
if (_toolErr) {
|
||||||
|
errno = _mapErr(_toolErr);
|
||||||
|
err(EXIT_FAILURE, "BeginSessionGS failed (0x%x)", _toolErr);
|
||||||
|
}
|
||||||
|
if (dFlag) {
|
||||||
|
c = mkdirs(nfiles, &argv[optind]);
|
||||||
|
} else {
|
||||||
|
/* ignore new user and group for now */
|
||||||
|
c = copyfiles(nfiles, &argv[optind], action, newmode);
|
||||||
|
}
|
||||||
|
action = 0; /* using action as a temp variable */
|
||||||
|
EndSessionGS(&action);
|
||||||
|
if (_toolErr) {
|
||||||
|
errno = _mapErr(_toolErr);
|
||||||
|
err(EXIT_FAILURE, "EndSessionGS failed (0x%x)", _toolErr);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
if (dFlag) {
|
if (dFlag) {
|
||||||
if (nfiles < 1) {
|
if (nfiles < 1) {
|
||||||
@ -417,7 +451,7 @@ main(int argc, char **argv)
|
|||||||
/* ignore new user and group for now */
|
/* ignore new user and group for now */
|
||||||
c = copyfiles(nfiles, &argv[optind], action, newmode);
|
c = copyfiles(nfiles, &argv[optind], action, newmode);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
Name: install
|
Name: install
|
||||||
Version: 1.1 (16 Oct 97)
|
Version: 1.2 (23 Apr 98)
|
||||||
Shell: GNO
|
Shell: GNO
|
||||||
Author: Devin Reade
|
Author: Devin Reade
|
||||||
Contact: gdr@eddore.myrias.com
|
Contact: gdr@trenco.gno.org
|
||||||
Where: /usr/bin
|
Where: /usr/bin
|
||||||
FTP: apple2.caltech.edu, ground.isca.uiowa.edu, trenco.myrias.com
|
FTP: ftp.gno.org
|
||||||
|
|
||||||
Install is similar to cp(1) in that it copies files. It will also create
|
Install is similar to cp(1) in that it copies files. It will also create
|
||||||
directory hierarchies, modify certain access bits, and convert TXT or SRC
|
directory hierarchies, modify certain access bits, and convert TXT or SRC
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 1996-1997 Devin Reade <gdr@myrias.com>.
|
* Copyright 1996-1997 Devin Reade <gdr@trenco.gno.org>.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* For copying and distribution information, see the file "COPYING"
|
* For copying and distribution information, see the file "COPYING"
|
||||||
* accompanying this file.
|
* accompanying this file.
|
||||||
*
|
*
|
||||||
* $Id: inst.rez,v 1.3 1998/03/08 18:19:00 gdr-ftp Exp $
|
* $Id: inst.rez,v 1.4 1998/04/24 00:54:06 gdr-ftp Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Types.Rez"
|
#include "Types.Rez"
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
resource rVersion (0x1, purgeable3, nocrossbank) {
|
resource rVersion (0x1, purgeable3, nocrossbank) {
|
||||||
|
|
||||||
{ 1, 1, 0, /* version 1.1.0 */
|
{ 1, 2, 0, /* version; also in inst.c and inst.desc */
|
||||||
release, /* development|alpha|beta|final|release */
|
release, /* development|alpha|beta|final|release */
|
||||||
0 /* non-final release number */
|
0 /* non-final release number */
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user