summaryrefslogtreecommitdiff
path: root/apps/plugins/lib/button_helper.pl
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lib/button_helper.pl')
-rwxr-xr-xapps/plugins/lib/button_helper.pl5
1 files changed, 5 insertions, 0 deletions
diff --git a/apps/plugins/lib/button_helper.pl b/apps/plugins/lib/button_helper.pl
index 45c3fd9073..192df18d7f 100755
--- a/apps/plugins/lib/button_helper.pl
+++ b/apps/plugins/lib/button_helper.pl
@@ -26,12 +26,15 @@ my @buttons = ();
26my $count = 1; #null sentinel 26my $count = 1; #null sentinel
27my $val; 27my $val;
28my $def; 28my $def;
29my $len_max_button = 0;
29while(my $line = <STDIN>) 30while(my $line = <STDIN>)
30{ 31{
31 chomp($line); 32 chomp($line);
32 if($line =~ /^#define (BUTTON_[^\s]+) (.+)$/) 33 if($line =~ /^#define (BUTTON_[^\s]+) (.+)$/)
33 { 34 {
34 $def = "{\"$1\", $2},\n"; 35 $def = "{\"$1\", $2},\n";
36 my $slen = length($1) + 1; # NULL terminator
37 if ($slen > $len_max_button) { $len_max_button = $slen; }
35 $val = $2; 38 $val = $2;
36 if($val =~ /^0/) 39 if($val =~ /^0/)
37 { 40 {
@@ -53,6 +56,8 @@ print <<EOF
53#include "button.h" 56#include "button.h"
54#include "button_helper.h" 57#include "button_helper.h"
55 58
59const size_t button_helper_maxbuffer = $len_max_button;
60
56static const struct available_button buttons[$count] = { 61static const struct available_button buttons[$count] = {
57EOF 62EOF
58; 63;