$NetBSD: patch-bs,v 1.3 2002/12/23 18:28:20 cjep Exp $

Eradicate setprogname() on NetBSD.
Kill me for doing this for many programs in one patch, but I've got
RSI now in both hands, dammit.

--- tests/append-over-page.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/append-over-page.c	Tue Aug 20 18:45:32 2002
@@ -971,7 +971,9 @@
 {
     const char *file = "blaha";
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
     if (argc != 1 && argc != 2)
 	errx (1, "usage: %s [file]", argv[0]);
     if (argc == 2)
--- tests/apwd.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/apwd.c	Tue Aug 20 18:45:55 2002
@@ -432,7 +432,9 @@
     int ret = 0;
     int optind = 0;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     verbose_flag = getenv ("VERBOSE") != NULL;
 
--- tests/create-dirs.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/create-dirs.c	Tue Aug 20 18:46:15 2002
@@ -82,7 +82,9 @@
     char *ptr;
     int count;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 2)
 	usage (1);
--- tests/create-files.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/create-files.c	Tue Aug 20 18:46:29 2002
@@ -101,7 +101,9 @@
     int count;
     long size;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 3)
 	usage (1);
--- tests/create-remove.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/create-remove.c	Tue Aug 20 18:46:45 2002
@@ -118,7 +118,9 @@
     char *ptr;
     int count;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 3)
 	usage (1);
--- tests/create-stat.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/create-stat.c	Tue Aug 20 18:58:18 2002
@@ -79,7 +79,9 @@
     char *filename;
     ino_t afsfileid;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (!k_hasafs())
 	errx (1, "!k_hasafs");
@@ -161,7 +163,9 @@
 int
 main (int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     errx (1, "no kafs");
 }
--- tests/create-symlinks.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/create-symlinks.c	Tue Aug 20 18:47:13 2002
@@ -115,7 +115,9 @@
     char *ptr;
     int count;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 2)
 	usage (1);
--- tests/dup2-and-unlog.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/dup2-and-unlog.c	Tue Aug 20 18:59:01 2002
@@ -18,7 +18,9 @@
 {
     int fd;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (!k_hasafs())
 	errx (1, "no afs");
@@ -45,7 +47,9 @@
 int
 main (int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     errx (1, "no kafs");
 }
--- tests/exit-wo-close.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/exit-wo-close.c	Tue Aug 20 18:47:40 2002
@@ -119,7 +119,9 @@
 {
     const char *file = "foo";
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 2 && argc != 1)
 	errx (1, "usage: %s [file]", argv[0]);
--- tests/fchmod.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/fchmod.c	Tue Aug 20 18:47:50 2002
@@ -52,7 +52,9 @@
     int fd, ret;
     struct stat sb;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     fd = open ("deps", O_WRONLY|O_CREAT|O_TRUNC, 0666);
     if (fd < 0)
--- tests/fhbench.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/fhbench.c	Tue Aug 20 18:48:00 2002
@@ -327,7 +327,9 @@
     int i;
     struct fhb_handle *handles;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (agetarg (args, argc, argv, &optind, AARG_GNUSTYLE))
 	usage (1);
--- tests/ga-test.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/ga-test.c	Tue Aug 20 18:48:10 2002
@@ -316,7 +316,9 @@
 int
 main (int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     test_simple_string();
     test_simple_strings();
--- tests/hardlink1.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/hardlink1.c	Tue Aug 20 18:48:21 2002
@@ -55,7 +55,9 @@
     int ret;
     struct stat sb1, sb2;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     fd1 = open("foo", O_RDWR|O_CREAT, 0666);
     if (fd1 < 0)
--- tests/hardlink2.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/hardlink2.c	Tue Aug 20 18:48:30 2002
@@ -55,7 +55,9 @@
     int ret;
     struct stat sb1;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     ret = mkdir ("1", 0777);
     if (ret < 0)
--- tests/invalidate-file.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/invalidate-file.c	Tue Aug 20 18:48:40 2002
@@ -167,7 +167,9 @@
 {
     char *filename = "foo";
     
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (!k_hasafs())
 	exit (1);
--- tests/kill-softer.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/kill-softer.c	Tue Aug 20 18:48:53 2002
@@ -177,7 +177,9 @@
 int
 main(int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     verbose = fdopen (4, "w");
     if (verbose == NULL) {
--- tests/kill-softly.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/kill-softly.c	Tue Aug 20 18:49:03 2002
@@ -154,7 +154,9 @@
 int
 main(int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 2)
 	errx (1, "usage: %s directory", argv[0]);
--- tests/large-dir.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/large-dir.c	Tue Aug 20 18:49:16 2002
@@ -146,7 +146,9 @@
     char *ptr;
     int count;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 3)
 	usage (1);
--- tests/large-dir2.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/large-dir2.c	Tue Aug 20 18:49:42 2002
@@ -125,7 +125,9 @@
     char *ptr;
     int count;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 3)
 	usage (1);
--- tests/large-dir3.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/large-dir3.c	Tue Aug 20 18:49:53 2002
@@ -113,7 +113,9 @@
     char *ptr;
     int count;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 3)
 	usage (1);
--- tests/mkdir2.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/mkdir2.c	Tue Aug 20 18:50:09 2002
@@ -54,7 +54,9 @@
     int ret;
     struct stat dot_sb, sb;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     ret = mkdir ("foo", 0777);
     if (ret < 0)
--- tests/mmap-and-read.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/mmap-and-read.c	Tue Aug 20 18:50:20 2002
@@ -150,7 +150,9 @@
 main (int argc, char **argv)
 {
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     srand (time(NULL));
 
--- tests/mmap-cat.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/mmap-cat.c	Tue Aug 20 18:50:30 2002
@@ -134,7 +134,9 @@
 {
     int optind = 0;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (agetarg (args, argc, argv, &optind, AARG_AFSSTYLE))
 	usage (1);
--- tests/mmap-shared-write.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/mmap-shared-write.c	Tue Aug 20 18:50:39 2002
@@ -91,7 +91,9 @@
 {
     const char *filename = "foo";
 
+#if !defined(__NetBSD__)
     setprogname(argv[0]);
+#endif
 
     if (argc != 1 && argc != 2)
 	usage ();
--- tests/mmap-vs-read.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/mmap-vs-read.c	Tue Aug 20 18:50:50 2002
@@ -154,7 +154,9 @@
 int
 main (int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 1)
 	debug = 1;
--- tests/mmap-vs-read2.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/mmap-vs-read2.c	Tue Aug 20 18:50:59 2002
@@ -154,7 +154,9 @@
 int
 main (int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 1)
 	debug = 1;
--- tests/pine.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/pine.c	Tue Aug 20 18:51:08 2002
@@ -57,7 +57,9 @@
     char unique[1024];
     int retrycount = 0;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     snprintf (unique, sizeof(unique), LOCK ".%d.%d",
 	      getpid(), (int)time(NULL));
--- tests/read-vs-mmap.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/read-vs-mmap.c	Tue Aug 20 18:51:17 2002
@@ -154,7 +154,9 @@
 int
 main (int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 1)
 	debug = 1;
--- tests/read-vs-mmap2.c.orig	Tue Aug 20 18:44:47 2002
+++ tests/read-vs-mmap2.c	Tue Aug 20 18:51:26 2002
@@ -113,7 +113,9 @@
     void *mmap_buf;
     int fd;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     srand (time(NULL));
 
--- tests/read-write.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/read-write.c	Tue Aug 20 18:51:38 2002
@@ -116,7 +116,9 @@
     char *read_buf2;
     int fd;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     srand (time(NULL));
 
--- tests/readdir-vs-lstat.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/readdir-vs-lstat.c	Tue Aug 20 18:51:51 2002
@@ -92,7 +92,9 @@
 {
     char *name = ".";
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc > 2)
 	usage (1);
--- tests/rename-under-feet.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/rename-under-feet.c	Tue Aug 20 18:52:04 2002
@@ -129,7 +129,9 @@
     char buf[1];
     int status;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     emkdir ("one", 0777);
     emkdir ("two", 0777);
--- tests/rename5.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/rename5.c	Tue Aug 20 18:52:15 2002
@@ -87,7 +87,9 @@
     int ret;
     struct stat old_sb, new_sb, dot_sb;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
     emkdir ("old_parent", 0777);
     emkdir ("new_parent", 0777);
     emkdir ("old_parent/victim", 0777);
--- tests/rm-rf.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/rm-rf.c	Tue Aug 20 18:52:25 2002
@@ -128,7 +128,9 @@
 int
 main(int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
 #ifdef KERBEROS
     has_afs = k_hasafs();
--- tests/still-there-p.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/still-there-p.c	Tue Aug 20 18:52:36 2002
@@ -61,7 +61,9 @@
     char buf[TEST_BUFFER_SZ];
     int fd;
 	
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     fd = open (file, O_RDWR|O_TRUNC|O_CREAT, 0644);
     if (fd < 0)
--- tests/strange-characters-c.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/strange-characters-c.c	Tue Aug 20 18:52:45 2002
@@ -84,7 +84,9 @@
 {
     char *file = "";
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 1)
 	usage (1);
--- tests/symlink.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/symlink.c	Tue Aug 20 18:52:54 2002
@@ -57,7 +57,9 @@
     int ret;
     struct stat sb;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     ret = symlink ("foo", "bar");
     if (ret < 0)
--- tests/test-parallel1.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/test-parallel1.c	Tue Aug 20 18:53:02 2002
@@ -80,7 +80,9 @@
 {
     int i, ret;
     
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     for (i = 0; i < NUM_WORKER ; i++) {
 	int ret;
--- tests/test-parallel2.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/test-parallel2.c	Tue Aug 20 18:53:11 2002
@@ -162,7 +162,9 @@
 {
     int i, ret;
     
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     for (i = 0; i < NUM_WORKER ; i++) {
 	int ret;
--- tests/test-setgroups.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/test-setgroups.c	Tue Aug 20 18:53:40 2002
@@ -80,7 +80,9 @@
     int ngroups;
     gid_t pag0, pag1, pag2;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 2)
 	errx (1, "Usage: %s user", argv[0]);
@@ -138,7 +140,9 @@
 int
 main (int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     errx (1, "no kafs");
 }
--- tests/test-setpag.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/test-setpag.c	Tue Aug 20 18:54:04 2002
@@ -79,7 +79,9 @@
     gid_t pag1, pag2;
     pid_t pid;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (argc != 1)
 	errx (1, "Usage: %s", argv[0]);
@@ -131,7 +133,9 @@
 int
 main (int argc, char **argv)
 {
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     errx (1, "no kafs");
 }
--- tests/truncate.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/truncate.c	Tue Aug 20 18:54:16 2002
@@ -82,7 +82,9 @@
 {
     int ret;
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     create_and_write ("foo", "hej\n");
 
--- tests/utime-dir.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/utime-dir.c	Tue Aug 20 18:54:27 2002
@@ -71,7 +71,9 @@
 {
     const char *file = "blaha";
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
     if (argc != 1 && argc != 2)
 	errx (1, "usage: %s [file]", argv[0]);
     if (argc == 2)
--- tests/write-closed.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/write-closed.c	Tue Aug 20 18:54:41 2002
@@ -89,7 +89,9 @@
 {
     const char *file = "foo";
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
     if (argc != 1 && argc != 2)
 	errx (1, "usage: %s [file]", argv[0]);
     if (argc == 2)
--- tests/write-closed2.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/write-closed2.c	Tue Aug 20 18:55:00 2002
@@ -120,7 +120,9 @@
 {
     const char *file = "foo";
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
 
     if (!k_hasafs())
 	errx (1, "!k_hasafs");
--- tests/write-ro-file.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/write-ro-file.c	Tue Aug 20 18:55:13 2002
@@ -52,7 +52,9 @@
   int fd;
   int ret;
 
+#if !defined(__NetBSD__)
   setprogname (argv[0]);
+#endif
 
   fd = open("foo", O_RDWR|O_CREAT, 0);
   if (fd < 0)
--- tests/write-ucc.c.orig	Tue Aug 20 18:44:48 2002
+++ tests/write-ucc.c	Tue Aug 20 18:55:22 2002
@@ -95,7 +95,9 @@
 {
     const char *file = "blaha";
 
+#if !defined(__NetBSD__)
     setprogname (argv[0]);
+#endif
     if (argc != 1 && argc != 2)
 	errx (1, "usage: %s [file]", argv[0]);
     if (argc == 2)
