# If the construct does _not_ begin 'static', then delete it and return # to the top of the script. /^[ ]*static/!d # Strip off any trailing whitespace s/[ ]*$// # Strip off any trailing comment s/;[ ]*\/\*.*\*\/[ ]*$/;/ # We are looking for function declarations that end (...) :loop # If however the construct ends with a semi-colon, then empty # the pattern space and return to the top of the script. /;[ ]*$/d # If the construct does not end in ')' then get the next line and loop /)[ ]*$/!{ $!{ N s/\n[ ]*/ / bloop } } # We should now have something like "static type function(args)" # If the function starts fl_, print it out. #p / fl_/!d # Replace multiple consecutive ' ' chars with a single one. s/ \{2,\}//g p :end