[sane-devel] Proposals for scanimage and sane-find-scanner

Henning Meier-Geinitz henning@meier-geinitz.de
Mon, 14 Jan 2002 20:02:53 +0100


Hi,

On Mon, Jan 14, 2002 at 07:46:10PM +0100, Henning Meier-Geinitz wrote:
> I made a match for the patch for some things I noticed:

I always forget to press 'a' before sending the mail :-)

Index: scanimage.c
===================================================================
RCS file: /cvsroot/external/sane/sane-backends/frontend/scanimage.c,v
retrieving revision 1.21
diff -u -u -r1.21 scanimage.c
--- scanimage.c	2002/01/13 20:46:35	1.21
+++ scanimage.c	2002/01/14 18:40:03
@@ -32,6 +32,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <stdarg.h>
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -1496,14 +1497,14 @@
 	        const char **arglist = malloc(8 * sizeof(char**));
 	        if (arglist == 0)
 	          {
-	            printf("no enough memory\n");
+	            fprintf(stderr, "%s: not enough memory\n", prog_name);
 	            exit(1);
 	          }
 	        
 	        fmt = malloc(strlen(optarg));
 	        if (fmt == 0)
 	          {
-	            printf("no enough memory\n");
+	            fprintf(stderr, "%s: not enough memory\n", prog_name);
 	            exit(1);
 	          }
 	        
@@ -1523,7 +1524,8 @@
 	                        arglist = realloc(arglist, maxarg * sizeof(char**));
 	                        if (arglist == 0)
 	                          {
-	  	                    printf("no enough memory\n");
+				    fprintf(stderr, "%s: not enough memory\n", 
+					    prog_name);
 		                    exit(1);
 	                          } 
 	                      }
@@ -1551,13 +1553,16 @@
 	                        case '%':
 	                          break;
 	                        default:
-	                          printf("unkonwn format specifier %%%c\n", *percent);
+	                          fprintf(stderr, "%s: unknown format specifier %%%c\n",
+					  prog_name, *percent);
 	                      }
 	                    percent++;
 	                  }
 	                start = percent;
 	              }
 	            vprintf(fmt, arglist);
+		    va_end(arglist);
+		    printf("\n");
 	          }
 	      }
 	        
@@ -1602,6 +1607,9 @@
 -d, --device-name=DEVICE   use a given scanner device (e.g. hp:/dev/scanner)\n\
 -h, --help                 display this help message and exit\n\
 -L, --list-devices         show available scanner devices\n\
+-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the output\n\
+                           can be specified: %%d (device name), %%v (vendor),\n\
+                           %%m (model), %%t (type), and %%i (index number)\n\
 -T, --test                 test backend thoroughly\n\
 -v, --verbose              give even more status messages\n\
 -V, --version              print version information\n\