summaryrefslogtreecommitdiff
path: root/lirc/20150109124636-35d9b9a-lirc-lsplugins-bugfixes.patch
blob: e85d82e649c491a5dffb6debbad6b5ea7c91b38c (plain)
    1 commit 35d9b9aa0290d393767f9169b7cdf6333be11c6f
    2 Author: Alec Leamas <leamas.alec@gmail.com>
    3 Date:   Fri Jan 9 12:46:36 2015 +0100
    4 
    5     lirc-lsplugins: Bugfixes, list also default device (#90).
    6     
    7     Since we should use the default device, it should also be
    8     possible to check. Added to the -l output.
    9 
   10 diff --git a/tools/lirc-lsplugins.c b/tools/lirc-lsplugins.c
   11 index 139fa1e..9ed8f57 100644
   12 --- a/tools/lirc-lsplugins.c
   13 +++ b/tools/lirc-lsplugins.c
   14 @@ -86,6 +86,7 @@ typedef struct {
   15  	const char* features;
   16  	const char* version;
   17  	const char* info;
   18 +	const char* device;
   19  } line_t;
   20  
   21  static const line_t* lines[MAX_PLUGINS];
   22 @@ -126,6 +127,7 @@ static line_t* line_new(const char* path)
   23  	line->errors = NULL;
   24  	line->info = NULL;
   25  	line->version = NULL;
   26 +	line->device = NULL;
   27  	line->features = opt_long ? "              " : "";
   28  	return line;
   29  }
   30 @@ -212,7 +214,8 @@ static void line_print_long(const line_t* line)
   31  	}
   32  
   33  	printf("Plugin path:\t%s\n", line->path);
   34 -	printf("Driver name:\t%s\n", line->path ? line->name : "-");
   35 +	printf("Driver name:\t%s\n", line->name ? line->name : "-");
   36 +	printf("Default device:\t%s\n", line->device ? line->device : "-");
   37  	printf("Load state:\t%s\n", loadstate);
   38  	printf("Timing info:\t%s\n", handles_timing);
   39  	printf("Can send:\t%s\n", can_send);
   40 @@ -264,17 +267,22 @@ static void format_drivers(struct driver** drivers,
   41  			continue;
   42  		}
   43                  if ((*drivers)->name) {
   44 -                  	strncpy(buf, (*drivers)->name, sizeof(buf));
   45 +                  	strncpy(buf, (*drivers)->name, sizeof(buf) - 1);
   46  			line->name = strdup(buf);
   47                  }
   48                  if ((*drivers)->driver_version) {
   49 -                  	strncpy(buf, (*drivers)->driver_version, sizeof(buf));
   50 +                  	strncpy(buf,
   51 +				(*drivers)->driver_version, sizeof(buf) - 1);
   52  			line->version = strdup(buf);
   53                  }
   54                  if ((*drivers)->info) {
   55 -                  	strncpy(buf, (*drivers)->info, sizeof(buf));
   56 +                  	strncpy(buf, (*drivers)->info, sizeof(buf) - 1);
   57  			line->info = strdup(buf);
   58                  }
   59 +                if ((*drivers)->device) {
   60 +                  	strncpy(buf, (*drivers)->device, sizeof(buf) - 1);
   61 +			line->device = strdup(buf);
   62 +                }
   63  		snprintf(buf, sizeof(buf), "-%c%c",
   64  		 	 get(CAN_ANY, 'a', *drivers),
   65  			 get(CAN_SEND, 's', *drivers));

Generated by cgit