"Fossies" - the Fresh Open Source Software Archive

Member "gawk-5.1.0/test/functab4.awk" (6 Feb 2020, 589 Bytes) of package /linux/misc/gawk-5.1.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) (G)AWK source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "functab4.awk": 5.0.1_vs_5.1.0.

    1 @load "filefuncs"
    2 
    3 function foo()
    4 {
    5     print "foo!"
    6 }
    7 
    8 BEGIN {
    9     f = FUNCTAB["foo"]
   10     @f()
   11 
   12     # Do the two stats one after the other, and use ".." instead
   13     # of "." to avoid race conditions seen using ".".
   14     ret1 = stat("..", data1)
   15 
   16     f = "stat"
   17     ret2 = @f("..", data2)
   18 
   19     print "ret1 =", ret1
   20     print "ret2 =", ret2
   21 
   22     problem = 0
   23     for (i in data1) {
   24         if (! isarray(data1[i])) {
   25 #           print i, data1[i]
   26             if (! (i in data2) || data1[i] != data2[i]) {
   27                 printf("mismatch element \"%s\"\n", i)
   28                 problems++
   29             }
   30         }
   31     }
   32     print(problems ? (problems+0) "encountered" : "no problems encountered")
   33 }