]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: fix compilation error on OpenBSD and Solaris
authorBruno Haible <bruno@clisp.org>
Mon, 23 Jun 2025 20:59:47 +0000 (22:59 +0200)
committerPádraig Brady <P@draigBrady.com>
Mon, 23 Jun 2025 21:56:36 +0000 (22:56 +0100)
* src/speedgen: Use 'printf', not 'sed', to emit code with newlines.

src/speedgen

index 56998d6a72c72d6113ac737704991acf89a249fa..a4af8c8e243f4f8dea1f9e7fd872f43bb3e9c3e5 100755 (executable)
@@ -61,8 +61,9 @@ baud_to_value (speed_t speed)
     {
 EOF
 
-sed -e 's/^.*$/#  ifdef B&\n      case B&: return &;\n#  endif/' \
-    < "$tmp" >> "$out"
+while read n; do
+  printf '#  ifdef B%s\n      case B%s: return %s;\n#  endif\n' "$n" "$n" "$n"
+done < "$tmp" >> "$out"
 
 cat >> "$out" <<'EOF'
       default: return -1;
@@ -84,8 +85,9 @@ value_to_baud (unsigned long int value)
     {
 EOF
 
-sed -e 's/^.*$/#  ifdef B&\n      case &: return B&;\n#  endif/' \
-    < "$tmp" >> "$out"
+while read n; do
+  printf '#  ifdef B%s\n      case %s: return B%s;\n#  endif\n' "$n" "$n" "$n"
+done < "$tmp" >> "$out"
 
 cat >> "$out" <<'EOF'
       default: return (speed_t) -1;