2 # Find fvwm commands from functions.c struct functions
3 # Written by Toshi Isogai
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #find "func_t func_config[] =" in various spacing
23 if (s/func_t.*\[\]\s*=(\s|\n)*\{// ) {
27 print stderr
"Can't find func_t\n";
36 s/.*CMD_ENTRY[^,]*,\s*CMD_([^,]+).*/\1/s;
42 s/(.*)CMD_ENTRY.*/\1/s;
49 my( $fvwmdir ) = $ARGV[0];
50 my( $pm ) = "FvwmCommand.pm";
54 if ($ARGV[1] eq "-sh") {
55 print "# FvwmCommand.sh\n";
56 print "# Collection of fvwm builtin commands for FvwmCommand\n";
58 print "alias FvwmCommand=\'$fvwmdir/FvwmCommand\'\n";
60 for( $i=0; $i<=$#cmd; $i++) {
61 print "$cmd[$i] () {\n";
62 print "\tFvwmCommand \"$cmd[$i] \$\*\"\n";
67 print " FvwmCommand \"+ \$\*\"\n";
72 print "# Collection of fvwm builtin commands for FvwmCommand\n";
73 print "package FvwmCommand;\nuse Exporter;\n";
74 print "\@ISA=qw(Exporter);\n\
@EXPORT=qw(";
75 for( $i=0; $i<=$#cmd; $i++) {
83 print "\nsub FvwmCommand { system \"$fvwmdir/FvwmCommand '\@_'\"}\n\n";
85 print "sub $i { FvwmCommand \"$i \@_ \" }\n";
87 print "sub AM { FvwmCommand \"+ \@_ \" }\n";