CVS commit: src/bin/dd

2024-01-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jan 26 07:10:04 UTC 2024

Modified Files:
src/bin/dd: args.c

Log Message:
Don't use the signal handler to terminate when nothing is to do (count=0, 
files=0).

The signal handler tries to raise the signal again, so that a parent can 
retrieve
the signal from the exit code. Calling the terminate handler with signal code 0
doesn't raise a signal and dd continues with exit(127) making this case an 
error.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/bin/dd/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2024-01-25 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Jan 26 07:10:04 UTC 2024

Modified Files:
src/bin/dd: args.c

Log Message:
Don't use the signal handler to terminate when nothing is to do (count=0, 
files=0).

The signal handler tries to raise the signal again, so that a parent can 
retrieve
the signal from the exit code. Calling the terminate handler with signal code 0
doesn't raise a signal and dd continues with exit(127) making this case an 
error.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/bin/dd/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/args.c
diff -u src/bin/dd/args.c:1.42 src/bin/dd/args.c:1.43
--- src/bin/dd/args.c:1.42	Fri Jan 14 23:55:16 2022
+++ src/bin/dd/args.c	Fri Jan 26 07:10:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $	*/
+/*	$NetBSD: args.c,v 1.43 2024/01/26 07:10:04 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)args.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $");
+__RCSID("$NetBSD: args.c,v 1.43 2024/01/26 07:10:04 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -248,8 +248,10 @@ f_count(char *arg)
 {
 
 	cpy_cnt = strsuftoll("block count", arg, 0, LLONG_MAX);
-	if (!cpy_cnt)
-		terminate(0);
+	if (!cpy_cnt) {
+		summary();
+		exit(0);
+	}
 }
 
 static void
@@ -257,8 +259,10 @@ f_files(char *arg)
 {
 
 	files_cnt = (u_int)strsuftoll("file count", arg, 0, UINT_MAX);
-	if (!files_cnt)
-		terminate(0);
+	if (!files_cnt) {
+		summary();
+		exit(0);
+	}
 }
 
 static void



CVS commit: src/bin/dd

2022-01-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 14 23:56:35 UTC 2022

Modified Files:
src/bin/dd: extern.h

Log Message:
update header too.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/dd/extern.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/extern.h
diff -u src/bin/dd/extern.h:1.24 src/bin/dd/extern.h:1.25
--- src/bin/dd/extern.h:1.24	Fri Oct  4 04:57:38 2019
+++ src/bin/dd/extern.h	Fri Jan 14 18:56:35 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: extern.h,v 1.24 2019/10/04 08:57:38 mrg Exp $	*/
+/*	$NetBSD: extern.h,v 1.25 2022/01/14 23:56:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -81,7 +81,7 @@ extern uint64_t		progress;
 extern const u_char	*ctab;
 extern const u_char	a2e_32V[], a2e_POSIX[];
 extern const u_char	e2a_32V[], e2a_POSIX[];
-extern const u_char	a2ibm_32V[], a2ibm_POSIX[];
+extern const u_char	a2ibm[];
 extern u_char		casetab[];
 extern const char	*msgfmt;
 



CVS commit: src/bin/dd

2022-01-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 14 23:56:35 UTC 2022

Modified Files:
src/bin/dd: extern.h

Log Message:
update header too.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/dd/extern.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2022-01-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 14 23:55:16 UTC 2022

Modified Files:
src/bin/dd: args.c conv_tab.c dd.1

Log Message:
The "ibm" and "oldibm" tables are identical, because POSIX just
standardised the table from V7. Nobody, including the original authors,
seems to have noticed this.  Merge them and update the documentation.
Also fix the odd, inconsistent, spelling of "pre-4.3BSD-Reno").
(From nabijaczleweli)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/dd/args.c
cvs rdiff -u -r1.9 -r1.10 src/bin/dd/conv_tab.c
cvs rdiff -u -r1.37 -r1.38 src/bin/dd/dd.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/args.c
diff -u src/bin/dd/args.c:1.41 src/bin/dd/args.c:1.42
--- src/bin/dd/args.c:1.41	Sat Oct  9 17:31:36 2021
+++ src/bin/dd/args.c	Fri Jan 14 18:55:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.41 2021/10/09 21:31:36 rillig Exp $	*/
+/*	$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)args.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: args.c,v 1.41 2021/10/09 21:31:36 rillig Exp $");
+__RCSID("$NetBSD: args.c,v 1.42 2022/01/14 23:55:16 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -355,13 +355,13 @@ static const struct conv {
 	{ "ascii",	C_ASCII,	C_EBCDIC,	e2a_POSIX },
 	{ "block",	C_BLOCK,	C_UNBLOCK,	NULL },
 	{ "ebcdic",	C_EBCDIC,	C_ASCII,	a2e_POSIX },
-	{ "ibm",	C_EBCDIC,	C_ASCII,	a2ibm_POSIX },
+	{ "ibm",	C_EBCDIC,	C_ASCII,	a2ibm },
 	{ "lcase",	C_LCASE,	C_UCASE,	NULL },
 	{ "noerror",	C_NOERROR,	0,		NULL },
 	{ "notrunc",	C_NOTRUNC,	0,		NULL },
 	{ "oldascii",	C_ASCII,	C_EBCDIC,	e2a_32V },
 	{ "oldebcdic",	C_EBCDIC,	C_ASCII,	a2e_32V },
-	{ "oldibm",	C_EBCDIC,	C_ASCII,	a2ibm_32V },
+	{ "oldibm",	C_EBCDIC,	C_ASCII,	a2ibm },
 	{ "osync",	C_OSYNC,	C_BS,		NULL },
 	{ "sparse",	C_SPARSE,	0,		NULL },
 	{ "swab",	C_SWAB,		0,		NULL },

Index: src/bin/dd/conv_tab.c
diff -u src/bin/dd/conv_tab.c:1.9 src/bin/dd/conv_tab.c:1.10
--- src/bin/dd/conv_tab.c:1.9	Thu Aug  7 05:05:10 2003
+++ src/bin/dd/conv_tab.c	Fri Jan 14 18:55:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: conv_tab.c,v 1.9 2003/08/07 09:05:10 agc Exp $	*/
+/*	$NetBSD: conv_tab.c,v 1.10 2022/01/14 23:55:16 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)conv_tab.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: conv_tab.c,v 1.9 2003/08/07 09:05:10 agc Exp $");
+__RCSID("$NetBSD: conv_tab.c,v 1.10 2022/01/14 23:55:16 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -142,42 +142,6 @@ const u_char a2e_32V[] = {
 	0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377,		/* 0370 */
 };
 
-/* ASCII to IBM EBCDIC -- 32V compatible. */
-const u_char a2ibm_32V[] = {
-	, 0001, 0002, 0003, 0067, 0055, 0056, 0057,		/*  */
-	0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017,		/* 0010 */
-	0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046,		/* 0020 */
-	0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037,		/* 0030 */
-	0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175,		/* 0040 */
-	0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141,		/* 0050 */
-	0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,		/* 0060 */
-	0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157,		/* 0070 */
-	0174, 0301, 0302, 0303, 0304, 0305, 0306, 0307,		/* 0100 */
-	0310, 0311, 0321, 0322, 0323, 0324, 0325, 0326,		/* 0110 */
-	0327, 0330, 0331, 0342, 0343, 0344, 0345, 0346,		/* 0120 */
-	0347, 0350, 0351, 0255, 0340, 0275, 0137, 0155,		/* 0130 */
-	0171, 0201, 0202, 0203, 0204, 0205, 0206, 0207,		/* 0140 */
-	0210, 0211, 0221, 0222, 0223, 0224, 0225, 0226,		/* 0150 */
-	0227, 0230, 0231, 0242, 0243, 0244, 0245, 0246,		/* 0160 */
-	0247, 0250, 0251, 0300, 0117, 0320, 0241, 0007,		/* 0170 */
-	0040, 0041, 0042, 0043, 0044, 0025, 0006, 0027,		/* 0200 */
-	0050, 0051, 0052, 0053, 0054, 0011, 0012, 0033,		/* 0210 */
-	0060, 0061, 0032, 0063, 0064, 0065, 0066, 0010,		/* 0220 */
-	0070, 0071, 0072, 0073, 0004, 0024, 0076, 0341,		/* 0230 */
-	0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110,		/* 0240 */
-	0111, 0121, 0122, 0123, 0124, 0125, 0126, 0127,		/* 0250 */
-	0130, 0131, 0142, 0143, 0144, 0145, 0146, 0147,		/* 0260 */
-	0150, 0151, 0160, 0161, 0162, 0163, 0164, 0165,		/* 0270 */
-	0166, 0167, 0170, 0200, 0212, 0213, 0214, 0215,		/* 0300 */
-	0216, 0217, 0220, 0232, 0233, 0234, 0235, 0236,		/* 0310 */
-	0237, 0240, 0252, 0253, 0254, 0255, 0256, 0257,		/* 0320 */
-	0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,		/* 0330 */
-	0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,		/* 0340 */
-	0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333,		/* 0350 */
-	0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355,		/* 0360 */
-	0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377,		/* 0370 */
-};
-
 /* EBCDIC to ASCII -- POSIX and System V compatible. */
 const u_char e2a_POSIX[] = {
 	, 0001, 0002, 

CVS commit: src/bin/dd

2022-01-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jan 14 23:55:16 UTC 2022

Modified Files:
src/bin/dd: args.c conv_tab.c dd.1

Log Message:
The "ibm" and "oldibm" tables are identical, because POSIX just
standardised the table from V7. Nobody, including the original authors,
seems to have noticed this.  Merge them and update the documentation.
Also fix the odd, inconsistent, spelling of "pre-4.3BSD-Reno").
(From nabijaczleweli)


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/bin/dd/args.c
cvs rdiff -u -r1.9 -r1.10 src/bin/dd/conv_tab.c
cvs rdiff -u -r1.37 -r1.38 src/bin/dd/dd.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2021-10-09 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct  9 21:31:36 UTC 2021

Modified Files:
src/bin/dd: args.c

Log Message:
dd: fix lint warnings about effectively discarding 'const'

args.c(153): warning: call to 'bsearch' effectively discards 'const'
from argument [346]
args.c(383): dito
args.c(475): dito

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/dd/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/args.c
diff -u src/bin/dd/args.c:1.40 src/bin/dd/args.c:1.41
--- src/bin/dd/args.c:1.40	Wed Jan 30 01:40:02 2019
+++ src/bin/dd/args.c	Sat Oct  9 21:31:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: args.c,v 1.40 2019/01/30 01:40:02 mrg Exp $	*/
+/*	$NetBSD: args.c,v 1.41 2021/10/09 21:31:36 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)args.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: args.c,v 1.40 2019/01/30 01:40:02 mrg Exp $");
+__RCSID("$NetBSD: args.c,v 1.41 2021/10/09 21:31:36 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -127,7 +127,8 @@ static const struct arg {
 void
 jcl(char **argv)
 {
-	struct arg *ap, tmp;
+	const struct arg *ap;
+	struct arg tmp;
 	char *oper, *arg;
 
 	in.dbsz = out.dbsz = 512;
@@ -375,7 +376,8 @@ static const struct conv {
 static void
 f_conv(char *arg)
 {
-	struct conv *cp, tmp;
+	const struct conv *cp;
+	struct conv tmp;
 
 	while (arg != NULL) {
 		tmp.name = strsep(, ",");
@@ -466,7 +468,8 @@ static u_int
 f_ioflag(char *arg, u_int flagtype)
 {
 	u_int ioflag = 0;
-	struct ioflag *cp, tmp;
+	const struct ioflag *cp;
+	struct ioflag tmp;
 	const char *flagstr = (flagtype == C_IFLAG) ? "iflag" : "oflag";
 
 	while (arg != NULL) {



CVS commit: src/bin/dd

2021-10-09 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct  9 21:31:36 UTC 2021

Modified Files:
src/bin/dd: args.c

Log Message:
dd: fix lint warnings about effectively discarding 'const'

args.c(153): warning: call to 'bsearch' effectively discards 'const'
from argument [346]
args.c(383): dito
args.c(475): dito

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/bin/dd/args.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2021-10-09 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct  9 20:44:55 UTC 2021

Modified Files:
src/bin/dd: misc.c

Log Message:
dd: clean up function summary

No functional change. Ideally the binary would have stayed the same, but
GCC 10.3.0 inserts a nop and reorders the code.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/dd/misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/misc.c
diff -u src/bin/dd/misc.c:1.25 src/bin/dd/misc.c:1.26
--- src/bin/dd/misc.c:1.25	Sat Oct  9 20:29:23 2021
+++ src/bin/dd/misc.c	Sat Oct  9 20:44:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.25 2021/10/09 20:29:23 rillig Exp $	*/
+/*	$NetBSD: misc.c,v 1.26 2021/10/09 20:44:55 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)misc.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: misc.c,v 1.25 2021/10/09 20:29:23 rillig Exp $");
+__RCSID("$NetBSD: misc.c,v 1.26 2021/10/09 20:44:55 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -78,13 +78,11 @@ summary(void)
 #ifdef NO_MSGFMT
 	posix_summary();
 #else /* NO_MSGFMT */
-	if (strcmp(msgfmt, "human") == 0) {
+	if (strcmp(msgfmt, "human") == 0)
 		human_summary();
-		return;
-	} else if (strcmp(msgfmt, "posix") == 0) {
+	else if (strcmp(msgfmt, "posix") == 0)
 		posix_summary();
-		return;
-	} else if (strcmp(msgfmt, "quiet") == 0)
+	else if (strcmp(msgfmt, "quiet") == 0)
 		quiet_summary();
 	else
 		custom_summary();



CVS commit: src/bin/dd

2021-10-09 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct  9 20:44:55 UTC 2021

Modified Files:
src/bin/dd: misc.c

Log Message:
dd: clean up function summary

No functional change. Ideally the binary would have stayed the same, but
GCC 10.3.0 inserts a nop and reorders the code.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/bin/dd/misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2021-10-09 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct  9 20:29:23 UTC 2021

Modified Files:
src/bin/dd: misc.c

Log Message:
dd: fix lint error about 'return expr' from void function

No change to the resulting binary. The 'return' statements are necessary
for GCC to generate the exact same object code, even though they can be
removed without affecting the functionality, as seen before the 'else'.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/dd/misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/misc.c
diff -u src/bin/dd/misc.c:1.24 src/bin/dd/misc.c:1.25
--- src/bin/dd/misc.c:1.24	Fri Sep 10 22:11:03 2021
+++ src/bin/dd/misc.c	Sat Oct  9 20:29:23 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: misc.c,v 1.24 2021/09/10 22:11:03 rillig Exp $	*/
+/*	$NetBSD: misc.c,v 1.25 2021/10/09 20:29:23 rillig Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)misc.c	8.3 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: misc.c,v 1.24 2021/09/10 22:11:03 rillig Exp $");
+__RCSID("$NetBSD: misc.c,v 1.25 2021/10/09 20:29:23 rillig Exp $");
 #endif
 #endif /* not lint */
 
@@ -76,18 +76,18 @@ summary(void)
 		(void)write(STDERR_FILENO, "\n", 1);
 
 #ifdef NO_MSGFMT
-	return posix_summary();
+	posix_summary();
 #else /* NO_MSGFMT */
-	if (strncmp(msgfmt, "human", sizeof("human")) == 0)
-		return human_summary();
-
-	if (strncmp(msgfmt, "posix", sizeof("posix")) == 0)
-		return posix_summary();
-
-	if (strncmp(msgfmt, "quiet", sizeof("quiet")) == 0)
-		return quiet_summary();
-
-	return custom_summary();
+	if (strcmp(msgfmt, "human") == 0) {
+		human_summary();
+		return;
+	} else if (strcmp(msgfmt, "posix") == 0) {
+		posix_summary();
+		return;
+	} else if (strcmp(msgfmt, "quiet") == 0)
+		quiet_summary();
+	else
+		custom_summary();
 #endif /* NO_MSGFMT */
 }
 



CVS commit: src/bin/dd

2021-10-09 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Sat Oct  9 20:29:23 UTC 2021

Modified Files:
src/bin/dd: misc.c

Log Message:
dd: fix lint error about 'return expr' from void function

No change to the resulting binary. The 'return' statements are necessary
for GCC to generate the exact same object code, even though they can be
removed without affecting the functionality, as seen before the 'else'.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/bin/dd/misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2021-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  8 14:44:49 UTC 2021

Modified Files:
src/bin/dd: dd_swab.c

Log Message:
PR/56443: RVP: dd conv=swab doesn't always work


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/bin/dd/dd_swab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/dd_swab.c
diff -u src/bin/dd/dd_swab.c:1.1 src/bin/dd/dd_swab.c:1.2
--- src/bin/dd/dd_swab.c:1.1	Fri Oct  4 04:57:38 2019
+++ src/bin/dd/dd_swab.c	Fri Oct  8 10:44:48 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: dd_swab.c,v 1.1 2019/10/04 08:57:38 mrg Exp $	*/
+/*	$NetBSD: dd_swab.c,v 1.2 2021/10/08 14:44:48 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)swab.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: dd_swab.c,v 1.1 2019/10/04 08:57:38 mrg Exp $");
+__RCSID("$NetBSD: dd_swab.c,v 1.2 2021/10/08 14:44:48 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -71,7 +71,7 @@ dd_swab(const void * from, void * to, ss
 	}
 
 	/* round to multiple of 8 */
-	while ((--len % 8) != 0)
+	for (; (len % 8) != 0; --len)
 		STEP;
 	len /= 8;
 	if (len == 0)



CVS commit: src/bin/dd

2021-10-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Oct  8 14:44:49 UTC 2021

Modified Files:
src/bin/dd: dd_swab.c

Log Message:
PR/56443: RVP: dd conv=swab doesn't always work


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/bin/dd/dd_swab.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2019-10-04 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct  4 08:57:38 UTC 2019

Modified Files:
src/bin/dd: Makefile dd.c extern.h
Added Files:
src/bin/dd: dd_swab.c

Log Message:
copy libc's swab.c into dd as dd_swab(), and remove the restrict.

our implementation was fine, but the restrict marker is problematic
as gcc 8 is now more strict about checking for restrict issues.

this is the only actual consumer of swab(3) in our tree, though,
besides the test for it.  oh well.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/bin/dd/Makefile
cvs rdiff -u -r1.52 -r1.53 src/bin/dd/dd.c
cvs rdiff -u -r0 -r1.1 src/bin/dd/dd_swab.c
cvs rdiff -u -r1.23 -r1.24 src/bin/dd/extern.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2019-09-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Sep 15 23:58:31 UTC 2019

Modified Files:
src/bin/dd: Makefile

Log Message:
Drop -D_INCOMPLETE_XOPEN_C063 from dd(1)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/bin/dd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/dd

2019-09-15 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Sep 15 23:58:31 UTC 2019

Modified Files:
src/bin/dd: Makefile

Log Message:
Drop -D_INCOMPLETE_XOPEN_C063 from dd(1)


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/bin/dd/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/dd/Makefile
diff -u src/bin/dd/Makefile:1.18 src/bin/dd/Makefile:1.19
--- src/bin/dd/Makefile:1.18	Wed Mar 18 13:23:49 2015
+++ src/bin/dd/Makefile	Sun Sep 15 23:58:31 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2015/03/18 13:23:49 manu Exp $
+#	$NetBSD: Makefile,v 1.19 2019/09/15 23:58:31 kamil Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 
 .include 
@@ -12,7 +12,7 @@ LDADD+=	-lutil
 .ifdef SMALLPROG
 CPPFLAGS+=	-DNO_CONV -DNO_MSGFMT -DNO_IOFLAG -DSMALL
 .else
-CPPFLAGS+=	-D_NETBSD_SOURCE -D_INCOMPLETE_XOPEN_C063
+CPPFLAGS+=	-D_NETBSD_SOURCE
 SRCS+=		conv_tab.c
 .ifdef CRUNCHEDPROG
 CPPFLAGS+=	-DSMALL



Re: CVS commit: src/bin/dd

2010-11-24 Thread Jim Wise
David Holland dholland-sourcechan...@netbsd.org writes:

 Adding weird special case remote access hacks to dd (of all random
 tools) is also poor design. Why not for the next round add support for

dd ifurl=http://www.netbsd.org/index.html of=mycopy

 or

dd ifurl=http://www.netbsd.org/ recurse=true of=mytree/

 After all, all you have to do to implement this is open a pipe to ftp
 or wget.

Actually, neat idea (at least the first one)...

-- 
Jim Wise
jw...@draga.com


pgpTopM5vOIzq.pgp
Description: PGP signature


Re: CVS commit: src/bin/dd

2010-11-23 Thread Antti Kantee
On Tue Nov 23 2010 at 12:28:48 +, Matthias Scheler wrote:
 On Mon, Nov 22, 2010 at 09:04:28PM +, Antti Kantee wrote:
  Module Name:src
  Committed By:   pooka
  Date:   Mon Nov 22 21:04:28 UTC 2010
  
  Modified Files:
  src/bin/dd: Makefile args.c dd.c dd.h extern.h position.c
  
  Log Message:
  Add two new operands: rif and rof.  They operate exactly like
  if and of with the exception that the communicate with a rump
  kernel instead of the host kernel.
 
 This makes dd unusable if only / but not /usr is mounted because
 it now depends on /usr/lib/librumpclient.so.0.
 
 Utilities in /bin and /sbin are supposed to work without
 /usr mounted.

Good catch.  Fixed.  Sorry 'bout that oversight.

(on a slight tangent, wasn't getting rid of /usr vs. / on the roadmap?)


Re: CVS commit: src/bin/dd

2010-11-23 Thread Matthias Scheler
On Tue, Nov 23, 2010 at 02:42:04PM +0200, Antti Kantee wrote:
 (on a slight tangent, wasn't getting rid of /usr vs. / on the roadmap?)

I don't know that. I personally don't create /usr partitions on my
NetBSD systems anymore. But they usually have hard disks with multiple
gigabytes of storage space.

/usr over NFS is useful for a system with a shortage of local disk space.

Kind regards

-- 
Matthias Scheler  http://zhadum.org.uk/


Re: CVS commit: src/bin/dd

2010-11-23 Thread Bernd Ernesti
On Tue, Nov 23, 2010 at 02:42:04PM +0200, Antti Kantee wrote:
 On Tue Nov 23 2010 at 12:28:48 +, Matthias Scheler wrote:
  On Mon, Nov 22, 2010 at 09:04:28PM +, Antti Kantee wrote:
   Module Name:  src
   Committed By: pooka
   Date: Mon Nov 22 21:04:28 UTC 2010
   
   Modified Files:
 src/bin/dd: Makefile args.c dd.c dd.h extern.h position.c
   
   Log Message:
   Add two new operands: rif and rof.  They operate exactly like
   if and of with the exception that the communicate with a rump
   kernel instead of the host kernel.
  
  This makes dd unusable if only / but not /usr is mounted because
  it now depends on /usr/lib/librumpclient.so.0.
  
  Utilities in /bin and /sbin are supposed to work without
  /usr mounted.
 
 Good catch.  Fixed.  Sorry 'bout that oversight.

That doesn't resolve the concerns why this non standard options were added
to dd.

Can we go back to the previous versions for the moment and discuss it and
then do further changes?

Bernd



Re: CVS commit: src/bin/dd

2010-11-23 Thread David Laight
On Tue, Nov 23, 2010 at 12:19:36AM +0200, Antti Kantee wrote:
  
  Surely it would be more appropriate to make thye rump kernel directly
  forward some paths to the real kernel?
 
 Can you explain how that could work?

First thoughts are something like the way /../ is used to 'escape'
from the emulation root.
But maybe just mount the real filesystem within the rump kernel?
Making something work well enough to copy files is probably not that hard!

David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/bin/dd

2010-11-23 Thread Antti Kantee
On Tue Nov 23 2010 at 18:41:21 +, David Laight wrote:
 On Tue, Nov 23, 2010 at 12:19:36AM +0200, Antti Kantee wrote:
   
   Surely it would be more appropriate to make thye rump kernel directly
   forward some paths to the real kernel?
  
  Can you explain how that could work?
 
 First thoughts are something like the way /../ is used to 'escape'
 from the emulation root.
 But maybe just mount the real filesystem within the rump kernel?

The client may be on a different machine, so you'd have to, if not invent
a completely new protocol, at least include server side functionality
on the client and add some weird pingpong/adjust logic into the server.

 Making something work well enough to copy files is probably not that hard!

Adding a ton of special case code to copy files is extremely poor design!
Doubly so since the only reason is because you don't happen to like
some flags which bring 0 cost when not used.  If you don't like them,
don't use them.

Unless someone can actually name a *problem*, move along.


Re: CVS commit: src/bin/dd

2010-11-23 Thread David Holland
On Tue, Nov 23, 2010 at 02:42:04PM +0200, Antti Kantee wrote:
  (on a slight tangent, wasn't getting rid of /usr vs. / on the roadmap?)

No.

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/bin/dd

2010-11-23 Thread David Holland
On Tue, Nov 23, 2010 at 08:50:54PM +0200, Antti Kantee wrote:
 Surely it would be more appropriate to make thye rump kernel directly
 forward some paths to the real kernel?

Can you explain how that could work?
   
   First thoughts are something like the way /../ is used to 'escape'
   from the emulation root.
   But maybe just mount the real filesystem within the rump kernel?
  
  The client may be on a different machine, so you'd have to, if not invent
  a completely new protocol, at least include server side functionality
  on the client and add some weird pingpong/adjust logic into the server.

But you must already have this protocol in order to be able to reach
the client, no? But if not, we already have nfs, there's no need to
reinvent it.

   Making something work well enough to copy files is probably not that hard!
  
  Adding a ton of special case code to copy files is extremely poor design!

Adding weird special case remote access hacks to dd (of all random
tools) is also poor design. Why not for the next round add support for

   dd ifurl=http://www.netbsd.org/index.html of=mycopy

or

   dd ifurl=http://www.netbsd.org/ recurse=true of=mytree/

After all, all you have to do to implement this is open a pipe to ftp
or wget.

  Doubly so since the only reason is because you don't happen to like
  some flags which bring 0 cost when not used.  If you don't like them,
  don't use them.

Poorly thought-out features cause a lot of long-term overhead.

  Unless someone can actually name a *problem*, move along.

I'd say the first problem is that this wasn't discussed anywhere.

-- 
David A. Holland
dholl...@netbsd.org


Re: CVS commit: src/bin/dd

2010-11-22 Thread Antti Kantee
On Mon Nov 22 2010 at 22:09:24 +, David Laight wrote:
 On Mon, Nov 22, 2010 at 09:04:28PM +, Antti Kantee wrote:
  Module Name:src
  Committed By:   pooka
  Date:   Mon Nov 22 21:04:28 UTC 2010
  
  Modified Files:
  src/bin/dd: Makefile args.c dd.c dd.h extern.h position.c
  
  Log Message:
  Add two new operands: rif and rof.  They operate exactly like
  if and of with the exception that the communicate with a rump
  kernel instead of the host kernel.
 
 H this seems like polluting a standard utility to support
 a very specific use.
 
 Surely it would be more appropriate to make thye rump kernel directly
 forward some paths to the real kernel?

Can you explain how that could work?


Re: CVS commit: src/bin/dd

2010-11-22 Thread David Holland
On Mon, Nov 22, 2010 at 10:09:24PM +, David Laight wrote:
   Add two new operands: rif and rof.  They operate exactly like
   if and of with the exception that the communicate with a rump
   kernel instead of the host kernel.
  
  H this seems like polluting a standard utility to support
  a very specific use.

(Was this discussed anywhere?)

  Surely it would be more appropriate to make thye rump kernel directly
  forward some paths to the real kernel?

Yeah, that...

-- 
David A. Holland
dholl...@netbsd.org