SCCS-vsn: usr.bin/ar/append.c 5.5
SCCS-vsn: usr.bin/ar/archive.c 5.6
SCCS-vsn: usr.bin/ar/archive.h 5.6
SCCS-vsn: usr.bin/ar/contents.c 5.6
SCCS-vsn: usr.bin/ar/delete.c 5.6
SCCS-vsn: usr.bin/ar/extract.c 5.5
SCCS-vsn: usr.bin/ar/move.c 5.6
SCCS-vsn: usr.bin/ar/print.c 5.6
SCCS-vsn: usr.bin/ar/replace.c 5.7
-static char sccsid[] = "@(#)append.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)append.c 5.5 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
(void)printf("q - %s\n", file);
cf.rfd = fd;
cf.rname = file;
(void)printf("q - %s\n", file);
cf.rfd = fd;
cf.rname = file;
(void)close(fd);
}
close_archive(afd);
(void)close(fd);
}
close_archive(afd);
-static char sccsid[] = "@(#)archive.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)archive.c 5.6 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
* read the archive header for this member
*/
* read the archive header for this member
*/
int fd;
{
struct ar_hdr *hdr;
int fd;
{
struct ar_hdr *hdr;
static int already_written;
/*
static int already_written;
/*
* Write an archive member to a file.
*/
* Write an archive member to a file.
*/
CF *cfp;
struct stat *sb;
{
CF *cfp;
struct stat *sb;
{
error(cfp->wname);
already_written = lname;
}
error(cfp->wname);
already_written = lname;
}
already_written = 0;
}
/*
already_written = 0;
}
/*
* Copy size bytes from one file to another - taking care to handle the
* extra byte (for odd size files) when reading archives and writing an
* extra byte if necessary when adding files to archive. The length of
* Copy size bytes from one file to another - taking care to handle the
* extra byte (for odd size files) when reading archives and writing an
* extra byte if necessary when adding files to archive. The length of
* because 16-bit word addressed copies were faster?) Anyhow, it should
* have been ripped out long ago.
*/
* because 16-bit word addressed copies were faster?) Anyhow, it should
* have been ripped out long ago.
*/
* Skip over an object -- taking care to skip the pad bytes.
*/
void
* Skip over an object -- taking care to skip the pad bytes.
*/
void
* This code is derived from software contributed to Berkeley by
* Hugh Smith at The University of Guelph.
*
* This code is derived from software contributed to Berkeley by
* Hugh Smith at The University of Guelph.
*
- * @(#)archive.h 5.5 (Berkeley) %G%
+ * @(#)archive.h 5.6 (Berkeley) %G%
__BEGIN_DECLS
void close_archive __P((int));
__BEGIN_DECLS
void close_archive __P((int));
-void skipobj __P((int));
-int copyfile __P((CF *, off_t));
-int get_header __P((int));
+void skip_arobj __P((int));
+int copy_ar __P((CF *, off_t));
+int get_arobj __P((int));
int open_archive __P((int));
struct stat;
int open_archive __P((int));
struct stat;
-int put_object __P((CF *, struct stat *));
+int put_arobj __P((CF *, struct stat *));
-static char sccsid[] = "@(#)contents.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)contents.c 5.6 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
afd = open_archive(O_RDONLY);
afd = open_archive(O_RDONLY);
- for (all = !*argv; get_header(afd);) {
+ for (all = !*argv; get_arobj(afd);) {
if (all)
file = chdr.name;
else if (!(file = files(argv)))
if (all)
file = chdr.name;
else if (!(file = files(argv)))
(void)printf("%s\n", file);
if (!all && !*argv)
break;
(void)printf("%s\n", file);
if (!all && !*argv)
break;
-static char sccsid[] = "@(#)delete.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)delete.c 5.6 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, tfd, tname, RPAD|WPAD);
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, tfd, tname, RPAD|WPAD);
- while (get_header(afd)) {
+ while (get_arobj(afd)) {
if (*argv && (file = files(argv))) {
if (options & AR_V)
(void)printf("d - %s\n", file);
if (*argv && (file = files(argv))) {
if (options & AR_V)
(void)printf("d - %s\n", file);
- put_object(&cf, (struct stat *)NULL);
+ put_arobj(&cf, (struct stat *)NULL);
}
size = lseek(tfd, (off_t)0, SEEK_CUR);
(void)lseek(tfd, (off_t)0, SEEK_SET);
(void)lseek(afd, (off_t)SARMAG, SEEK_SET);
SETCF(tfd, tname, afd, archive, NOPAD);
}
size = lseek(tfd, (off_t)0, SEEK_CUR);
(void)lseek(tfd, (off_t)0, SEEK_SET);
(void)lseek(afd, (off_t)SARMAG, SEEK_SET);
SETCF(tfd, tname, afd, archive, NOPAD);
(void)close(tfd);
(void)ftruncate(afd, size + SARMAG);
close_archive(afd);
(void)close(tfd);
(void)ftruncate(afd, size + SARMAG);
close_archive(afd);
-static char sccsid[] = "@(#)extract.c 5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)extract.c 5.5 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
/* Read from an archive, write to disk; pad on read. */
SETCF(afd, archive, 0, 0, RPAD);
/* Read from an archive, write to disk; pad on read. */
SETCF(afd, archive, 0, 0, RPAD);
- for (all = !*argv; get_header(afd);) {
+ for (all = !*argv; get_arobj(afd);) {
if (all)
file = chdr.name;
else if (!(file = files(argv))) {
if (all)
file = chdr.name;
else if (!(file = files(argv))) {
if ((tfd = open(file, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR)) < 0) {
(void)fprintf(stderr, "ar: %s: %s.\n",
file, strerror(errno));
if ((tfd = open(file, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR)) < 0) {
(void)fprintf(stderr, "ar: %s: %s.\n",
file, strerror(errno));
cf.wfd = tfd;
cf.wname = file;
cf.wfd = tfd;
cf.wname = file;
- copyfile(&cf, chdr.size);
+ copy_ar(&cf, chdr.size);
if (fchmod(tfd, (short)chdr.mode)) {
(void)fprintf(stderr, "ar: %s: chmod: %s\n",
if (fchmod(tfd, (short)chdr.mode)) {
(void)fprintf(stderr, "ar: %s: chmod: %s\n",
-static char sccsid[] = "@(#)move.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)move.c 5.6 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, 0, tname, RPAD|WPAD);
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, 0, tname, RPAD|WPAD);
- for (curfd = tfd1; get_header(afd);) {
+ for (curfd = tfd1; get_arobj(afd);) {
if (*argv && (file = files(argv))) {
if (options & AR_V)
(void)printf("m - %s\n", file);
cf.wfd = tfd2;
if (*argv && (file = files(argv))) {
if (options & AR_V)
(void)printf("m - %s\n", file);
cf.wfd = tfd2;
- put_object(&cf, (struct stat *)NULL);
+ put_arobj(&cf, (struct stat *)NULL);
continue;
}
if (mods && compare(posname)) {
continue;
}
if (mods && compare(posname)) {
if (options & AR_B)
curfd = tfd3;
cf.wfd = curfd;
if (options & AR_B)
curfd = tfd3;
cf.wfd = curfd;
- put_object(&cf, (struct stat *)NULL);
+ put_arobj(&cf, (struct stat *)NULL);
if (options & AR_A)
curfd = tfd3;
} else {
cf.wfd = curfd;
if (options & AR_A)
curfd = tfd3;
} else {
cf.wfd = curfd;
- put_object(&cf, (struct stat *)NULL);
+ put_arobj(&cf, (struct stat *)NULL);
SETCF(tfd1, tname, afd, archive, NOPAD);
tsize = size = lseek(tfd1, (off_t)0, SEEK_CUR);
(void)lseek(tfd1, (off_t)0, SEEK_SET);
SETCF(tfd1, tname, afd, archive, NOPAD);
tsize = size = lseek(tfd1, (off_t)0, SEEK_CUR);
(void)lseek(tfd1, (off_t)0, SEEK_SET);
tsize += size = lseek(tfd2, (off_t)0, SEEK_CUR);
(void)lseek(tfd2, (off_t)0, SEEK_SET);
cf.rfd = tfd2;
tsize += size = lseek(tfd2, (off_t)0, SEEK_CUR);
(void)lseek(tfd2, (off_t)0, SEEK_SET);
cf.rfd = tfd2;
tsize += size = lseek(tfd3, (off_t)0, SEEK_CUR);
(void)lseek(tfd3, (off_t)0, SEEK_SET);
cf.rfd = tfd3;
tsize += size = lseek(tfd3, (off_t)0, SEEK_CUR);
(void)lseek(tfd3, (off_t)0, SEEK_SET);
cf.rfd = tfd3;
(void)ftruncate(afd, tsize + SARMAG);
close_archive(afd);
(void)ftruncate(afd, tsize + SARMAG);
close_archive(afd);
-static char sccsid[] = "@(#)print.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)print.c 5.6 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
/* Read from an archive, write to stdout; pad on read. */
SETCF(afd, archive, STDOUT_FILENO, "stdout", RPAD);
/* Read from an archive, write to stdout; pad on read. */
SETCF(afd, archive, STDOUT_FILENO, "stdout", RPAD);
- for (all = !*argv; get_header(afd);) {
+ for (all = !*argv; get_arobj(afd);) {
if (all)
file = chdr.name;
else if (!(file = files(argv))) {
if (all)
file = chdr.name;
else if (!(file = files(argv))) {
continue;
}
if (options & AR_V) {
(void)printf("\n<%s>\n\n", file);
(void)fflush(stdout);
}
continue;
}
if (options & AR_V) {
(void)printf("\n<%s>\n\n", file);
(void)fflush(stdout);
}
- copyfile(&cf, chdr.size);
+ copy_ar(&cf, chdr.size);
if (!all && !*argv)
break;
}
if (!all && !*argv)
break;
}
-static char sccsid[] = "@(#)replace.c 5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)replace.c 5.7 (Berkeley) %G%";
#endif /* not lint */
#include <sys/param.h>
#endif /* not lint */
#include <sys/param.h>
* all back together at the end.
*/
mods = (options & (AR_A|AR_B));
* all back together at the end.
*/
mods = (options & (AR_A|AR_B));
- for (err = 0, curfd = tfd1; get_header(afd);) {
+ for (err = 0, curfd = tfd1; get_arobj(afd);) {
if (*argv && (file = files(argv))) {
if ((sfd = open(file, O_RDONLY)) < 0) {
err = 1;
if (*argv && (file = files(argv))) {
if ((sfd = open(file, O_RDONLY)) < 0) {
err = 1;
/* 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);
curfd = tfd2;
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, curfd, tname, RPAD|WPAD);
curfd = tfd2;
/* Read and write to an archive; pad on both. */
SETCF(afd, archive, curfd, tname, RPAD|WPAD);
- put_object(&cf, (struct stat *)NULL);
+ put_arobj(&cf, (struct stat *)NULL);
if (options & AR_A)
curfd = tfd2;
} else {
/* Read and write to an archive; pad on both. */
useold: SETCF(afd, archive, curfd, tname, RPAD|WPAD);
if (options & AR_A)
curfd = tfd2;
} else {
/* Read and write to an archive; pad on both. */
useold: SETCF(afd, archive, curfd, tname, RPAD|WPAD);
- put_object(&cf, (struct stat *)NULL);
+ put_arobj(&cf, (struct stat *)NULL);
/* Read from disk, write to an archive; pad on write. */
SETCF(sfd, file,
options & (AR_A|AR_B) ? tfd1 : tfd2, tname, WPAD);
/* Read from disk, write to an archive; pad on write. */
SETCF(sfd, file,
options & (AR_A|AR_B) ? tfd1 : tfd2, tname, WPAD);
if (tfd1 != -1) {
tsize = size = lseek(tfd1, (off_t)0, SEEK_CUR);
(void)lseek(tfd1, (off_t)0, SEEK_SET);
if (tfd1 != -1) {
tsize = size = lseek(tfd1, (off_t)0, SEEK_CUR);
(void)lseek(tfd1, (off_t)0, SEEK_SET);
} else
tsize = 0;
tsize += size = lseek(tfd2, (off_t)0, SEEK_CUR);
(void)lseek(tfd2, (off_t)0, SEEK_SET);
cf.rfd = tfd2;
} else
tsize = 0;
tsize += size = lseek(tfd2, (off_t)0, SEEK_CUR);
(void)lseek(tfd2, (off_t)0, SEEK_SET);
cf.rfd = tfd2;
(void)ftruncate(afd, tsize + SARMAG);
close_archive(afd);
(void)ftruncate(afd, tsize + SARMAG);
close_archive(afd);