head	1.10;
access;
symbols
	perseant-exfatfs-base-20250801:1.10
	perseant-exfatfs-base-20240630:1.10
	perseant-exfatfs:1.10.0.46
	perseant-exfatfs-base:1.10
	cjep_sun2x:1.10.0.44
	cjep_sun2x-base:1.10
	cjep_staticlib_x-base1:1.10
	cjep_staticlib_x:1.10.0.42
	cjep_staticlib_x-base:1.10
	phil-wifi-20200421:1.10
	phil-wifi-20200411:1.10
	phil-wifi-20200406:1.10
	pgoyette-compat-merge-20190127:1.10
	pgoyette-compat-20190127:1.10
	pgoyette-compat-20190118:1.10
	pgoyette-compat-1226:1.10
	pgoyette-compat-1126:1.10
	pgoyette-compat-1020:1.10
	pgoyette-compat-0930:1.10
	pgoyette-compat-0906:1.10
	pgoyette-compat-0728:1.10
	pgoyette-compat-0625:1.10
	pgoyette-compat-0521:1.10
	pgoyette-compat-0502:1.10
	pgoyette-compat-0422:1.10
	pgoyette-compat-0415:1.10
	pgoyette-compat-0407:1.10
	pgoyette-compat-0330:1.10
	pgoyette-compat-0322:1.10
	pgoyette-compat-0315:1.10
	pgoyette-compat:1.10.0.40
	pgoyette-compat-base:1.10
	perseant-stdc-iso10646:1.10.0.38
	perseant-stdc-iso10646-base:1.10
	prg-localcount2-base3:1.10
	prg-localcount2-base2:1.10
	prg-localcount2-base1:1.10
	prg-localcount2:1.10.0.36
	prg-localcount2-base:1.10
	pgoyette-localcount-20170426:1.10
	bouyer-socketcan-base1:1.10
	pgoyette-localcount-20170320:1.10
	bouyer-socketcan:1.10.0.34
	bouyer-socketcan-base:1.10
	pgoyette-localcount-20170107:1.10
	pgoyette-localcount-20161104:1.10
	localcount-20160914:1.10
	pgoyette-localcount-20160806:1.10
	pgoyette-localcount-20160726:1.10
	pgoyette-localcount:1.10.0.32
	pgoyette-localcount-base:1.10
	netbsd-5-2-3-RELEASE:1.10
	netbsd-5-1-5-RELEASE:1.10
	yamt-pagecache-base9:1.10
	yamt-pagecache-tag8:1.10
	tls-earlyentropy:1.10.0.28
	tls-earlyentropy-base:1.10
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.10
	riastradh-drm2-base3:1.10
	netbsd-5-2-2-RELEASE:1.10
	netbsd-5-1-4-RELEASE:1.10
	netbsd-5-2-1-RELEASE:1.10
	netbsd-5-1-3-RELEASE:1.10
	agc-symver:1.10.0.30
	agc-symver-base:1.10
	tls-maxphys-base:1.10
	yamt-pagecache-base8:1.10
	netbsd-5-2:1.10.0.26
	yamt-pagecache-base7:1.10
	netbsd-5-2-RELEASE:1.10
	netbsd-5-2-RC1:1.10
	yamt-pagecache-base6:1.10
	yamt-pagecache-base5:1.10
	yamt-pagecache-base4:1.10
	netbsd-5-1-2-RELEASE:1.10
	netbsd-5-1-1-RELEASE:1.10
	yamt-pagecache-base3:1.10
	yamt-pagecache-base2:1.10
	yamt-pagecache:1.10.0.24
	yamt-pagecache-base:1.10
	bouyer-quota2-nbase:1.10
	bouyer-quota2:1.10.0.22
	bouyer-quota2-base:1.10
	matt-nb5-pq3:1.10.0.20
	matt-nb5-pq3-base:1.10
	netbsd-5-1:1.10.0.18
	netbsd-5-1-RELEASE:1.10
	netbsd-5-1-RC4:1.10
	netbsd-5-1-RC3:1.10
	netbsd-5-1-RC2:1.10
	netbsd-5-1-RC1:1.10
	netbsd-5-0-2-RELEASE:1.10
	netbsd-5-0-1-RELEASE:1.10
	jym-xensuspend-nbase:1.10
	netbsd-5-0:1.10.0.16
	netbsd-5-0-RELEASE:1.10
	netbsd-5-0-RC4:1.10
	netbsd-5-0-RC3:1.10
	netbsd-5-0-RC2:1.10
	jym-xensuspend:1.10.0.14
	jym-xensuspend-base:1.10
	netbsd-5-0-RC1:1.10
	netbsd-5:1.10.0.12
	netbsd-5-base:1.10
	mjf-devfs2:1.10.0.10
	mjf-devfs2-base:1.10
	yamt-pf42-base4:1.10
	yamt-pf42-base3:1.10
	hpcarm-cleanup-nbase:1.10
	yamt-pf42-base2:1.10
	yamt-pf42:1.10.0.8
	yamt-pf42-base:1.10
	keiichi-mipv6-nbase:1.10
	keiichi-mipv6:1.10.0.6
	keiichi-mipv6-base:1.10
	cube-autoconf:1.10.0.4
	cube-autoconf-base:1.10
	hpcarm-cleanup:1.10.0.2
	hpcarm-cleanup-base:1.10
	netbsd-1-3-PATCH003:1.9
	netbsd-1-3-PATCH003-CANDIDATE2:1.9
	netbsd-1-3-PATCH003-CANDIDATE1:1.9
	netbsd-1-3-PATCH003-CANDIDATE0:1.9
	netbsd-1-3-PATCH002:1.9
	netbsd-1-3-PATCH001:1.9
	netbsd-1-3-RELEASE:1.9
	netbsd-1-3-BETA:1.9
	netbsd-1-3:1.9.0.2
	netbsd-1-3-base:1.9
	netbsd-1-2-PATCH001:1.6
	netbsd-1-2-RELEASE:1.6
	netbsd-1-2-BETA:1.6
	netbsd-1-2:1.6.0.6
	netbsd-1-2-base:1.6
	netbsd-1-1-PATCH001:1.6
	netbsd-1-1-RELEASE:1.6
	netbsd-1-1:1.6.0.2
	netbsd-1-1-base:1.6
	lite-2:1.1.1.3
	netbsd-1-0-PATCH06:1.2
	netbsd-1-0-PATCH05:1.2
	netbsd-1-0-PATCH04:1.2
	netbsd-1-0-PATCH03:1.2
	netbsd-1-0-PATCH02:1.2
	netbsd-1-0-PATCH1:1.2
	netbsd-1-0-PATCH0:1.2
	netbsd-1-0-RELEASE:1.2
	lite-1:1.1.1.2
	CSRG:1.1.1
	netbsd-1-0:1.2.0.2
	netbsd-1-0-base:1.2
	netbsd-0-9-RELEASE:1.1.1.1
	netbsd-0-9-BETA:1.1.1.1
	netbsd-0-9-ALPHA2:1.1.1.1
	netbsd-0-9-ALPHA:1.1.1.1
	netbsd-0-9:1.1.1.1.0.2
	netbsd-0-9-base:1.1.1.1
	netbsd-0-8:1.1.1.1
	netbsd-alpha-1:1.1.1.1
	patchkit-0-2-2:1.1.1.1
	WFJ-386bsd-01:1.1.1.1
	WFJ-920714:1.1.1;
locks; strict;
comment	@ * @;


1.10
date	98.08.22.05.33.20;	author tv;	state dead;
branches;
next	1.9;

1.9
date	97.10.19.13.36.05;	author lukem;	state Exp;
branches;
next	1.8;

1.8
date	97.10.18.11.53.17;	author lukem;	state Exp;
branches;
next	1.7;

1.7
date	97.01.09.12.40.10;	author tls;	state Exp;
branches;
next	1.6;

1.6
date	95.03.26.03.27.55;	author glass;	state Exp;
branches;
next	1.5;

1.5
date	95.03.25.06.39.48;	author glass;	state Exp;
branches;
next	1.4;

1.4
date	94.09.19.03.35.16;	author mycroft;	state Exp;
branches;
next	1.3;

1.3
date	94.09.19.03.34.16;	author mycroft;	state Exp;
branches;
next	1.2;

1.2
date	93.08.01.18.18.32;	author mycroft;	state Exp;
branches;
next	1.1;

1.1
date	93.03.21.09.45.37;	author cgd;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	93.03.21.09.45.37;	author cgd;	state Exp;
branches;
next	1.1.1.2;

1.1.1.2
date	94.09.19.03.05.19;	author mycroft;	state Exp;
branches;
next	1.1.1.3;

1.1.1.3
date	95.09.04.20.31.22;	author tls;	state Exp;
branches;
next	;


desc
@@


1.10
log
@Nuke the Berkeley tools (except strip).  The GNU binutils are now
standard.
@
text
@/*	$NetBSD: misc.c,v 1.9 1997/10/19 13:36:05 lukem Exp $	*/

/*-
 * Copyright (c) 1990, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * Hugh Smith at The University of Guelph.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@@(#)misc.c	8.4 (Berkeley) 4/27/95";
#else
__RCSID("$NetBSD: misc.c,v 1.9 1997/10/19 13:36:05 lukem Exp $");
#endif
#endif /* not lint */

#include <sys/param.h>

#include <dirent.h>
#include <err.h>
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "archive.h"
#include "extern.h"
#include "pathnames.h"

char *tname = "temporary file";		/* temporary file "name" */

int
tmp()
{
	extern char *envtmp;
	sigset_t set, oset;
	static int first;
	int fd;
	char path[MAXPATHLEN];

	if (!first && !envtmp) {
		envtmp = getenv("TMPDIR");
		first = 1;
	}

	if (envtmp)
		(void)sprintf(path, "%s/%s", envtmp, _NAME_ARTMP);
	else
		strcpy(path, _PATH_ARTMP);
	
	sigfillset(&set);
	(void)sigprocmask(SIG_BLOCK, &set, &oset);
	if ((fd = mkstemp(path)) == -1)
		err(1, "mkstemp %s", tname);
        (void)unlink(path);
	(void)sigprocmask(SIG_SETMASK, &oset, NULL);
	return (fd);
}

/*
 * files --
 *	See if the current file matches any file in the argument list; if it
 * 	does, remove it from the argument list.
 */
char *
files(argv)
	char **argv;
{
	char **list, *p;

	for (list = argv; *list; ++list)
		if (compare(*list)) {
			p = *list;
			for (; (list[0] = list[1]) != NULL; ++list)
				continue;
			return (p);
		}
	return (NULL);
}

void
orphans(argv)
	char **argv;
{

	for (; *argv; ++argv)
		warnx("%s: not found in archive", *argv);
}

char *
rname(path)
	char *path;
{
	char *ind;

	return ((ind = strrchr(path, '/')) ? ind + 1 : path);
}

int
compare(dest)
	char *dest;
{

	if (options & AR_TR)
		return (!strncmp(chdr.name, rname(dest), OLDARMAXNAME));
	return (!strcmp(chdr.name, rname(dest)));
}

void
badfmt()
{
	errno = EFTYPE;
	err(1, "%s", archive);
}
@


1.9
log
@replace error() with err()
@
text
@d1 1
a1 1
/*	$NetBSD: misc.c,v 1.8 1997/10/18 11:53:17 lukem Exp $	*/
d44 1
a44 1
__RCSID("$NetBSD: misc.c,v 1.8 1997/10/18 11:53:17 lukem Exp $");
@


1.8
log
@WARNSify, fix .Nm usage
@
text
@d1 1
a1 1
/*	$NetBSD: misc.c,v 1.7 1997/01/09 12:40:10 tls Exp $	*/
d44 1
a44 1
__RCSID("$NetBSD$");
d87 1
a87 1
		error(tname);
a146 7
}

void
error(name)
	char *name;
{
	err(1, "%s", name);
@


1.7
log
@Sync to 4.4BSD-Lite2
@
text
@d1 1
a1 1
/*	$NetBSD: misc.c,v 1.6 1995/03/26 03:27:55 glass Exp $	*/
d39 1
d44 1
a44 1
static char rcsid[] = "$NetBSD: misc.c,v 1.6 1995/03/26 03:27:55 glass Exp $";
d107 1
a107 1
			for (; list[0] = list[1]; ++list)
@


1.6
log
@consistency..bleh
@
text
@d1 1
a1 1
/*	$NetBSD: misc.c,v 1.5 1995/03/25 06:39:48 glass Exp $	*/
d41 1
a41 1
static char sccsid[] = "@@(#)misc.c	8.3 (Berkeley) 4/2/94";
d43 1
a43 1
static char rcsid[] = "$NetBSD: misc.c,v 1.5 1995/03/25 06:39:48 glass Exp $";
a143 1

a151 1

@


1.5
log
@update rcsid format
@
text
@d1 1
a1 1
/*	$NetBSD$	*/
d43 1
a43 1
static char *rcsid = "$NetBSD: misc.c,v 1.4 1994/09/19 03:35:16 mycroft Exp $";
@


1.4
log
@Fix typo.
@
text
@d1 2
d40 5
a44 2
/*static char sccsid[] = "from: @@(#)misc.c	8.3 (Berkeley) 4/2/94";*/
static char *rcsid = "$Id: misc.c,v 1.3 1994/09/19 03:34:16 mycroft Exp $";
@


1.3
log
@Merge with 4.4-Lite.
@
text
@d39 1
a39 1
static char *rcsid = "$Id: $";
d140 1
a140 1
	error = EFTYPE;
@


1.2
log
@Add RCS identifiers.
@
text
@d2 2
a3 2
 * Copyright (c) 1990 The Regents of the University of California.
 * All rights reserved.
d38 2
a39 2
/*static char sccsid[] = "from: @@(#)misc.c	5.7 (Berkeley) 5/27/91";*/
static char rcsid[] = "$Id: $";
d43 4
a46 1
#include <sys/errno.h>
a47 2
#include <dirent.h>
#include <unistd.h>
d51 2
a56 2
extern CHDR chdr;			/* converted header */
extern char *archive;			/* archive name */
d59 1
d76 1
a76 1
		bcopy(_PATH_ARTMP, path, sizeof(_PATH_ARTMP));
d84 1
a84 1
	return(fd);
d96 1
a96 2
	register char **list;
	char *p;
d101 3
a103 2
			for (; list[0] = list[1]; ++list);
			return(p);
d105 1
a105 1
	return(NULL);
d112 1
d114 1
a114 2
		(void)fprintf(stderr,
		    "ar: %s: not found in archive.\n", *argv);
d121 1
a121 1
	register char *ind;
d123 1
a123 1
	return((ind = rindex(path, '/')) ? ind + 1 : path);
d126 1
d130 1
d132 2
a133 2
		return(!strncmp(chdr.name, rname(dest), OLDARMAXNAME));
	return(!strcmp(chdr.name, rname(dest)));
d139 3
a141 2
	errno = EFTYPE;
	error(archive);
d148 2
a149 2
	(void)fprintf(stderr, "ar: %s: %s\n", name, strerror(errno));
	exit(1);
@


1.1
log
@Initial revision
@
text
@d38 2
a39 1
static char sccsid[] = "@@(#)misc.c	5.7 (Berkeley) 5/27/91";
@


1.1.1.1
log
@initial import of 386bsd-0.1 sources
@
text
@@


1.1.1.2
log
@Import original 4.4-Lite version.
@
text
@d2 2
a3 2
 * Copyright (c) 1990, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
d38 1
a38 1
static char sccsid[] = "@@(#)misc.c	8.3 (Berkeley) 4/2/94";
d42 2
a43 1

d45 1
a45 3
#include <err.h>
#include <errno.h>
#include <signal.h>
a48 2
#include <unistd.h>

d53 2
a56 1
int
d73 1
a73 1
		strcpy(path, _PATH_ARTMP);
d81 1
a81 1
	return (fd);
d93 2
a94 1
	char **list, *p;
d99 2
a100 3
			for (; list[0] = list[1]; ++list)
				continue;
			return (p);
d102 1
a102 1
	return (NULL);
a108 1

d110 2
a111 1
		warnx("%s: not found in archive", *argv);
d118 1
a118 1
	char *ind;
d120 1
a120 1
	return ((ind = strrchr(path, '/')) ? ind + 1 : path);
a122 1
int
a125 1

d127 2
a128 2
		return (!strncmp(chdr.name, rname(dest), OLDARMAXNAME));
	return (!strcmp(chdr.name, rname(dest)));
d134 2
a135 2

	errx(1, "%s: %s", archive, strerror(EFTYPE));
d142 2
a143 2

	errx(1, "%s", name);
@


1.1.1.3
log
@imported from 44lite2
@
text
@d38 1
a38 1
static char sccsid[] = "@@(#)misc.c	8.4 (Berkeley) 4/27/95";
d139 1
a139 2
	errno = EFTYPE;
	err(1, "%s", archive);
d147 1
a147 1
	err(1, "%s", name);
@
