#!/bin/sh
# Find fvwm commands from function.c struct functions
# Written by Toshi Isogai

ff="FvwmCommand.f";
fc="../../fvwm/functions.c";


echo "# $ff" > $ff;
echo "# Collection of fvwm2 builtin commands for FvwmCommand" >> $ff
echo "# Generated by findcmd, written by Toshi Isogai" >> $ff
echo "" >> $ff;

echo "alias FvwmCommand='$1/FvwmCommand'" >> $ff;
echo 'AM () { FvwmCommand "+ $*" }' >> $ff;


awk '/struct function/,/""/ {
 
	if( $0 ~ /\{ *"[a-zA-Z_]/ ) {
		sub(/^ *\{ *"/,"",$0); 
		sub(/".*/,"",$0);
		print  $0,"() { FvwmCommand \"",$0," $*\" }" ;
	}
}' $fc >> $ff;



