Browse Source

Accept parameter to set_device "help" as a request for help on a specific setting

Luke Dashjr 12 years ago
parent
commit
d0b5be96c4
1 changed files with 8 additions and 0 deletions
  1. 8 0
      deviceapi.c

+ 8 - 0
deviceapi.c

@@ -12,6 +12,7 @@
 
 #include "config.h"
 
+#include <ctype.h>
 #ifdef WIN32
 #include <winsock2.h>
 #else
@@ -859,10 +860,17 @@ const char *proc_set_device_help(struct cgpu_info * const proc, const char * con
 nohelp:
 		return "No help available";
 	
+	size_t matchlen = 0;
+	if (newvalue)
+		while (!isspace(newvalue[0]))
+			++matchlen;
+	
 	for ( ; sdf->optname; ++sdf)
 	{
 		if (!sdf->description)
 			continue;
+		if (matchlen && (strncasecmp(optname, sdf->optname, matchlen) || optname[matchlen]))
+			continue;
 		if (first)
 			first = false;
 		else