Building without perl

Peter Stuge stuge-openssh-unix-dev at cdy.org
Thu Dec 5 20:16:56 EST 2002


On Tue, Dec 03, 2002 at 11:08:51PM +1100, Damien Miller wrote:
> >Is perl required? The docs don't say it is... if not, how do I get 
> 
> Perl is required to build OpenSSH, or more specifically: to fix
> up the paths in the manpages. If you install with normalish
> 
> A while back, someone converted the script to awk & sed. If you
> want to revive (check the list archives) and clean this up, it
> would probably get committed.

I've tried to create a bugzilla account two times now but failed..  So
here's a patch attached, along with the full file.  It uses sh, sed and
grep.  (grep only for syntax validation)

It might not handle difficult characters [\"'] etc very well, if at all,
but this might not matter either.


//Peter
-------------- next part --------------
#!/bin/sh
#
# fixpaths  - substitute makefile variables into text files

die() {
  echo $*
  exit -1
}

test -n "`echo $1|grep -- -D`" || die $0: nothing to do - no substitutions listed!
test -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || die $0: error in command line arguments.
test -n "`echo $*|grep -- ' [^-]'`" || die Usage: $0 '[-Dstring=replacement] [[infile] ...]'

sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`
exit 0
-------------- next part --------------
--- fixpaths.orig	Mon Apr 16 02:41:47 2001
+++ fixpaths	Thu Dec  5 10:08:07 2002
@@ -1,43 +1,15 @@
-#!/usr/bin/perl -w
+#!/bin/sh
 #
 # fixpaths  - substitute makefile variables into text files
 
-
-$usage = "Usage: $0 [-Dstring=replacement] [[infile] ...]\n";
-
-if (!defined(@ARGV)) { die ("$usage"); }
-
-# read in the command line and get some definitions
-while ($_=$ARGV[0], /^-/) {
-  if (/^-D/) {
-    # definition
-    shift(@ARGV);
-    if ( /-D(.*)=(.*)/ ) {
-      $def{"$1"}=$2;
-    } else {
-      die ("$usage$0: error in command line arguments.\n");
-    }
-  } else {
-    @cmd = split(//, $ARGV[0]); $opt = $cmd[1];
-    die ("$usage$0: unknown option '-$opt'\n");
-  }
-} # while parsing arguments
-
-if (!defined(%def)) {
-  die ("$0: nothing to do - no substitutions listed!\n");
+die() {
+  echo $*
+  exit -1
 }
 
-for $f (@ARGV) {
-
-  $f =~ /(.*\/)*(.*)$/;
-
-  open(IN, "<$f")          || die ("$0: input file $f missing!\n");
-  while (<IN>) {
-    for $s (keys(%def)) {
-      s#$s#$def{$s}#;
-    } # for $s
-    print;
-  } # while <IN>
-} # for $f
+test -n "`echo $1|grep -- -D`" || die $0: nothing to do - no substitutions listed!
+test -n "`echo $1|grep -- '-D[^=]\+=[^ ]\+'`" || die $0: error in command line arguments.
+test -n "`echo $*|grep -- ' [^-]'`" || die Usage: $0 '[-Dstring=replacement] [[infile] ...]'
 
-exit 0;
+sed `echo $*|sed -e 's/-D\([^=]\+\)=\([^ ]*\)/-e s=\1=\2=g/g'`
+exit 0


More information about the openssh-unix-dev mailing list