projects
/
unix-history
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5504c5d
)
change so that the command line file name is used for error/info messages
author
Keith Bostic
<bostic@ucbvax.Berkeley.EDU>
Tue, 12 Mar 1991 06:31:22 +0000
(22:31 -0800)
committer
Keith Bostic
<bostic@ucbvax.Berkeley.EDU>
Tue, 12 Mar 1991 06:31:22 +0000
(22:31 -0800)
SCCS-vsn: usr.bin/ar/append.c 5.3
SCCS-vsn: usr.bin/ar/ar.c 5.8
SCCS-vsn: usr.bin/ar/contents.c 5.4
SCCS-vsn: usr.bin/ar/delete.c 5.4
SCCS-vsn: usr.bin/ar/extract.c 5.3
SCCS-vsn: usr.bin/ar/move.c 5.4
SCCS-vsn: usr.bin/ar/print.c 5.4
SCCS-vsn: usr.bin/ar/replace.c 5.5
usr/src/usr.bin/ar/append.c
patch
|
blob
|
blame
|
history
usr/src/usr.bin/ar/ar.c
patch
|
blob
|
blame
|
history
usr/src/usr.bin/ar/contents.c
patch
|
blob
|
blame
|
history
usr/src/usr.bin/ar/delete.c
patch
|
blob
|
blame
|
history
usr/src/usr.bin/ar/extract.c
patch
|
blob
|
blame
|
history
usr/src/usr.bin/ar/move.c
patch
|
blob
|
blame
|
history
usr/src/usr.bin/ar/print.c
patch
|
blob
|
blame
|
history
usr/src/usr.bin/ar/replace.c
patch
|
blob
|
blame
|
history
diff --git
a/usr/src/usr.bin/ar/append.c
b/usr/src/usr.bin/ar/append.c
index
d52bfbd
..
bea9963
100644
(file)
--- a/
usr/src/usr.bin/ar/append.c
+++ b/
usr/src/usr.bin/ar/append.c
@@
-9,7
+9,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)append.c 5.
2
(Berkeley) %G%";
+static char sccsid[] = "@(#)append.c 5.
3
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-52,7
+52,7
@@
append(argv)
continue;
}
if (options & AR_V)
continue;
}
if (options & AR_V)
- (void)printf("q - %s\n",
rname(file)
);
+ (void)printf("q - %s\n",
file
);
cf.rfd = fd;
cf.rname = file;
put_object(&cf, &sb);
cf.rfd = fd;
cf.rname = file;
put_object(&cf, &sb);
diff --git
a/usr/src/usr.bin/ar/ar.c
b/usr/src/usr.bin/ar/ar.c
index
5d6fdac
..
8a49071
100644
(file)
--- a/
usr/src/usr.bin/ar/ar.c
+++ b/
usr/src/usr.bin/ar/ar.c
@@
-15,7
+15,7
@@
char copyright[] =
#endif /* not lint */
#ifndef lint
#endif /* not lint */
#ifndef lint
-static char sccsid[] = "@(#)ar.c 5.
7
(Berkeley) %G%";
+static char sccsid[] = "@(#)ar.c 5.
8
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-28,7
+28,7
@@
static char sccsid[] = "@(#)ar.c 5.7 (Berkeley) %G%";
CHDR chdr;
u_int options;
CHDR chdr;
u_int options;
-char *archive, *envtmp, *posname;
+char *archive, *envtmp, *pos
arg, *pos
name;
/*
* main --
/*
* main --
@@
-141,12
+141,12
@@
main(argc, argv)
}
/* -ab require a position argument. */
if (options & (AR_A|AR_B)) {
}
/* -ab require a position argument. */
if (options & (AR_A|AR_B)) {
- if (!(pos
name
= *argv++)) {
+ if (!(pos
arg
= *argv++)) {
(void)fprintf(stderr,
"ar: no position operand specified.\n");
usage();
}
(void)fprintf(stderr,
"ar: no position operand specified.\n");
usage();
}
- posname = rname(pos
name
);
+ posname = rname(pos
arg
);
}
/* -d only valid with -sv. */
if (options & AR_D && options & ~(AR_D|AR_S|AR_V))
}
/* -d only valid with -sv. */
if (options & AR_D && options & ~(AR_D|AR_S|AR_V))
diff --git
a/usr/src/usr.bin/ar/contents.c
b/usr/src/usr.bin/ar/contents.c
index
d5e7e06
..
c5fbb7a
100644
(file)
--- a/
usr/src/usr.bin/ar/contents.c
+++ b/
usr/src/usr.bin/ar/contents.c
@@
-9,7
+9,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)contents.c 5.
3
(Berkeley) %G%";
+static char sccsid[] = "@(#)contents.c 5.
4
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-37,26
+37,30
@@
contents(argv)
register int afd, all;
int eval;
struct tm *tp;
register int afd, all;
int eval;
struct tm *tp;
- char buf[25];
+ char
*file,
buf[25];
afd = open_archive(O_RDONLY);
for (all = !*argv; get_header(afd);) {
afd = open_archive(O_RDONLY);
for (all = !*argv; get_header(afd);) {
- if (all || files(argv)) {
- if (options & AR_V) {
- (void)strmode(chdr.mode, buf);
- (void)printf("%s %6d/%-6d %8ld ",
- buf + 1, chdr.uid, chdr.gid, chdr.size);
- tp = localtime(&chdr.date);
- (void)strftime(buf, sizeof(buf),
- "%b %e %H:%M %Y", tp);
- (void)printf("%s %s\n", buf, chdr.name);
- } else
- (void)printf("%s\n", chdr.name);
- if (!all && !*argv)
- break;
+ if (all)
+ file = chdr.name;
+ else {
+ file = *argv;
+ if (!files(argv))
+ goto next;
}
}
- skipobj(afd);
+ if (options & AR_V) {
+ (void)strmode(chdr.mode, buf);
+ (void)printf("%s %6d/%-6d %8ld ",
+ buf + 1, chdr.uid, chdr.gid, chdr.size);
+ tp = localtime(&chdr.date);
+ (void)strftime(buf, sizeof(buf), "%b %e %H:%M %Y", tp);
+ (void)printf("%s %s\n", buf, file);
+ } else
+ (void)printf("%s\n", file);
+ if (!all && !*argv)
+ break;
+next: skipobj(afd);
}
eval = 0;
ORPHANS;
}
eval = 0;
ORPHANS;
diff --git
a/usr/src/usr.bin/ar/delete.c
b/usr/src/usr.bin/ar/delete.c
index
b98accb
..
489cb0d
100644
(file)
--- a/
usr/src/usr.bin/ar/delete.c
+++ b/
usr/src/usr.bin/ar/delete.c
@@
-9,7
+9,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)delete.c 5.
3
(Berkeley) %G%";
+static char sccsid[] = "@(#)delete.c 5.
4
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-36,6
+36,7
@@
delete(argv)
CF cf;
off_t size;
int afd, eval, tfd;
CF cf;
off_t size;
int afd, eval, tfd;
+ char *file;
afd = open_archive(O_RDWR);
tfd = tmp();
afd = open_archive(O_RDWR);
tfd = tmp();
@@
-43,9
+44,9
@@
delete(argv)
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, tfd, tname, RPAD|WPAD);
while (get_header(afd)) {
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, tfd, tname, RPAD|WPAD);
while (get_header(afd)) {
- if (
*argv
&& files(argv)) {
+ if (
(file = *argv)
&& files(argv)) {
if (options & AR_V)
if (options & AR_V)
- (void)printf("d - %s\n",
chdr.nam
e);
+ (void)printf("d - %s\n",
fil
e);
skipobj(afd);
continue;
}
skipobj(afd);
continue;
}
diff --git
a/usr/src/usr.bin/ar/extract.c
b/usr/src/usr.bin/ar/extract.c
index
569e37c
..
7b33931
100644
(file)
--- a/
usr/src/usr.bin/ar/extract.c
+++ b/
usr/src/usr.bin/ar/extract.c
@@
-9,7
+9,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)extract.c 5.
2
(Berkeley) %G%";
+static char sccsid[] = "@(#)extract.c 5.
3
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-41,7
+41,7
@@
extract(argv)
struct stat sb;
CF cf;
int eval;
struct stat sb;
CF cf;
int eval;
- char *file
, *rname()
;
+ char *file;
eval = 0;
tv[0].tv_usec = tv[1].tv_usec = 0;
eval = 0;
tv[0].tv_usec = tv[1].tv_usec = 0;
@@
-74,7
+74,7
@@
extract(argv)
}
if (options & AR_V)
}
if (options & AR_V)
- (void)printf("x - %s\n",
rname(file)
);
+ (void)printf("x - %s\n",
file
);
cf.wfd = tfd;
cf.wname = file;
cf.wfd = tfd;
cf.wname = file;
diff --git
a/usr/src/usr.bin/ar/move.c
b/usr/src/usr.bin/ar/move.c
index
3f5d856
..
a4008bc
100644
(file)
--- a/
usr/src/usr.bin/ar/move.c
+++ b/
usr/src/usr.bin/ar/move.c
@@
-9,7
+9,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)move.c 5.
3
(Berkeley) %G%";
+static char sccsid[] = "@(#)move.c 5.
4
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-36,10
+36,11
@@
extern char *tname; /* temporary file "name" */
move(argv)
char **argv;
{
move(argv)
char **argv;
{
- extern char *pos
name; /* positioning file name
*/
+ extern char *pos
arg, *posname; /* positioning file names
*/
CF cf;
off_t size, tsize;
int afd, curfd, eval, mods, tfd1, tfd2, tfd3;
CF cf;
off_t size, tsize;
int afd, curfd, eval, mods, tfd1, tfd2, tfd3;
+ char *file;
afd = open_archive(O_RDWR);
mods = options & (AR_A|AR_B);
afd = open_archive(O_RDWR);
mods = options & (AR_A|AR_B);
@@
-59,9
+60,9
@@
move(argv)
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, 0, tname, RPAD|WPAD);
for (curfd = tfd1; get_header(afd);) {
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, 0, tname, RPAD|WPAD);
for (curfd = tfd1; get_header(afd);) {
- if (
*argv
&& files(argv)) {
+ if (
(file = *argv)
&& files(argv)) {
if (options & AR_V)
if (options & AR_V)
- (void)printf("m - %s\n",
chdr.nam
e);
+ (void)printf("m - %s\n",
fil
e);
cf.wfd = tfd2;
put_object(&cf, (struct stat *)NULL);
continue;
cf.wfd = tfd2;
put_object(&cf, (struct stat *)NULL);
continue;
@@
-82,7
+83,7
@@
move(argv)
if (mods) {
(void)fprintf(stderr, "ar: %s: archive member not found.\n",
if (mods) {
(void)fprintf(stderr, "ar: %s: archive member not found.\n",
- pos
name
);
+ pos
arg
);
close_archive(afd);
return(1);
}
close_archive(afd);
return(1);
}
diff --git
a/usr/src/usr.bin/ar/print.c
b/usr/src/usr.bin/ar/print.c
index
d4bd724
..
cd15b8b
100644
(file)
--- a/
usr/src/usr.bin/ar/print.c
+++ b/
usr/src/usr.bin/ar/print.c
@@
-9,7
+9,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)print.c 5.
3
(Berkeley) %G%";
+static char sccsid[] = "@(#)print.c 5.
4
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-33,18
+33,24
@@
print(argv)
CF cf;
register int afd, all;
int eval;
CF cf;
register int afd, all;
int eval;
+ char *file;
afd = open_archive(O_RDONLY);
/* Read from an archive, write to stdout; pad on read. */
SETCF(afd, archive, STDOUT_FILENO, "stdout", RPAD);
for (all = !*argv; get_header(afd);) {
afd = open_archive(O_RDONLY);
/* Read from an archive, write to stdout; pad on read. */
SETCF(afd, archive, STDOUT_FILENO, "stdout", RPAD);
for (all = !*argv; get_header(afd);) {
- if (!all && !files(argv)) {
- skipobj(afd);
- continue;
+ if (all)
+ file = chdr.name;
+ else {
+ file = *argv;
+ if (!files(argv)) {
+ skipobj(afd);
+ continue;
+ }
}
if (options & AR_V) {
}
if (options & AR_V) {
- (void)printf("\n<%s>\n\n",
chdr.nam
e);
+ (void)printf("\n<%s>\n\n",
fil
e);
(void)fflush(stdout);
}
copyfile(&cf, chdr.size);
(void)fflush(stdout);
}
copyfile(&cf, chdr.size);
diff --git
a/usr/src/usr.bin/ar/replace.c
b/usr/src/usr.bin/ar/replace.c
index
9407070
..
a3ace0f
100644
(file)
--- a/
usr/src/usr.bin/ar/replace.c
+++ b/
usr/src/usr.bin/ar/replace.c
@@
-9,7
+9,7
@@
*/
#ifndef lint
*/
#ifndef lint
-static char sccsid[] = "@(#)replace.c 5.
4
(Berkeley) %G%";
+static char sccsid[] = "@(#)replace.c 5.
5
(Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
@@
-36,7
+36,7
@@
extern char *tname; /* temporary file "name" */
replace(argv)
char **argv;
{
replace(argv)
char **argv;
{
- extern char *pos
name;
/* positioning file name */
+ extern char *pos
arg, *posname;
/* positioning file name */
register char *file;
register int afd, curfd, mods, sfd;
struct stat sb;
register char *file;
register int afd, curfd, mods, sfd;
struct stat sb;
@@
-82,7
+82,7
@@
replace(argv)
goto useold;
if (options & AR_V)
goto useold;
if (options & AR_V)
- (void)printf("r - %s\n",
chdr.nam
e);
+ (void)printf("r - %s\n",
fil
e);
/* Read from disk, write to an archive; pad on write */
SETCF(sfd, file, curfd, tname, WPAD);
/* Read from disk, write to an archive; pad on write */
SETCF(sfd, file, curfd, tname, WPAD);
@@
-110,7
+110,7
@@
useold: SETCF(afd, archive, curfd, tname, RPAD|WPAD);
if (mods) {
(void)fprintf(stderr, "ar: %s: archive member not found.\n",
if (mods) {
(void)fprintf(stderr, "ar: %s: archive member not found.\n",
- pos
name
);
+ pos
arg
);
close_archive(afd);
return(1);
}
close_archive(afd);
return(1);
}
@@
-118,7
+118,7
@@
useold: SETCF(afd, archive, curfd, tname, RPAD|WPAD);
/* Append any left-over arguments to the end of the after file. */
append: while (file = *argv++) {
if (options & AR_V)
/* Append any left-over arguments to the end of the after file. */
append: while (file = *argv++) {
if (options & AR_V)
- (void)printf("a - %s\n",
rname(file)
);
+ (void)printf("a - %s\n",
file
);
if ((sfd = open(file, O_RDONLY)) < 0) {
err = 1;
(void)fprintf(stderr, "ar: %s: %s.\n",
if ((sfd = open(file, O_RDONLY)) < 0) {
err = 1;
(void)fprintf(stderr, "ar: %s: %s.\n",