pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/34695



The following reply was made to PR pkg/34695; it has been noted by GNATS.

From: Roland Illig <rillig%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: pkg/34695
Date: Fri, 06 Oct 2006 21:16:23 +0200

 Mike M. Volokhov wrote:
 > The following reply was made to PR pkg/34695; it has been noted by GNATS.
 > 
 > From: "Mike M. Volokhov" <mishka%NetBSD.org@localhost>
 > To: gnats-bugs%NetBSD.org@localhost
 > Cc: 
 > Subject: Re: pkg/34695
 > Date: Thu, 5 Oct 2006 15:16:44 +0300
 > 
 >  The single objection I've seen is that awk-based randomization logic
 >  might not work with non NetBSD awks (for example, on Solaris). So, can
 >  anybody confirm that the following script is workable on non NetBSD
 >  platform?
 >  
 >  {
 >          srand(systime());
 >          n = split($0, words);
 >          for (i = n; i > 0; i--) {
 >                  ir = int(rand() * i + 1);
 >                  t = words[i];
 >                  words[i] = words[ir];
 >                  words[ir] = t;
 >                  print words[i];
 >          }
 >  }
 >  
 >  Usage:
 >  echo "one two three four five six seven eight nine ten" | awk -f random.awk
 
 rzdspc8:~: uname -a
 SunOS rzdspc8 5.10 Generic_118833-18 sun4u sparc SUNW,Sun-Fire-V440
 
 rzdspc8:~: alias e="echo \"one two three four five six seven eight nine 
 ten\""
 
 rzdspc8:~: e | /usr/bin/awk -f r.awk
 awk: syntax error near line 2
 awk: illegal statement near line 2
 awk: syntax error near line 5
 awk: illegal statement near line 5
 
 rzdspc8:~: e | /usr/pkg/2006Q2/bin/nawk -f r.awk
 /usr/pkg/2006Q2/bin/nawk: calling undefined function systime
   input record number 1, file
   source line number 2
 
 rzdspc8:~: e | /usr/bin/nawk -f r.awk
 /usr/bin/nawk: calling undefined function systime
   input record number 1
   source line number 2
 
 rzdspc8:~: e | /usr/pkg/2006Q2/bin/gawk -f r.awk
 seven
 one
 four
 five
 two
 three
 eight
 nine
 six
 ten
 
 rzdspc8:~: e | /opt/sfw/bin/gawk -f r.awk
 nine
 four
 five
 ten
 three
 six
 two
 seven
 eight
 one
 
 ^D
 
 Roland
 



Home | Main Index | Thread Index | Old Index