Re: gpm 1.20.1-cvs bug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday 11 July 2002 13:39, Peter Berg Larsen wrote:
> On Wed, 10 Jul 2002, Xiong Quanren wrote:
> > Check out the newest cvs snapshot of gpm. find following bugs:
> > 2) After fixing previous bug by myself, when using the conf/gpm-syn.conf
> > in the package as my configuration file, it complained about 10 parameter
> > values are invalid.
>
> Are you sure it complained about values, and not option names? This would
> happen if you used an old 1.19.6 conf file. If it is not so, I would
> like to know which ones it complained about.

I reproduced this problem and found that it exists when
gpm-syn.conf contains TABs.

Example of warrning message:
*** warning [synaptics.c(1850)]: Value (	TRUE
) for parameter edge_motion_speed_enabled is invalid


In src/synaptics.c is this test:
[...]
              if (index ("YyTt1", token [0])) {
                *(param_data [param].addr.flag_p) = 1;
              } else if (index ("NnFf0", token [0])) {                          
                *(param_data [param].addr.flag_p) = 0;
              } else {
                gpm_report (GPM_PR_WARN,"Value (%s) for parameter %s is 
invalid", 
		token, param_data [param].name);                    
[...]  

but token[0] contains '\t'.


I think that the best solution is to fix strtok command.
I suppose to use:
	token = strtok (NULL, "[] \t\n");


Simply patch against gpm-1.20.1rc1 is attached.
It was fine also for yesterday's CVS snapshot.

-- 
With greetings,

Petr Mladek
software developer
---------------------------------------------------------------------  
SuSE CR, s.r.o.                             e-mail: pmladek@xxxxxxx
Drahobejlova 27                             tel:+420 2 9654 2373 
190 00 Praha 9                              fax:+420 2 9654 2374   
Ceska republika                             http://www.suse.cz    
--- src/synaptics.c
+++ src/synaptics.c
@@ -1801,7 +1801,7 @@
   }else{
     while (fgets (line, 80, config)) {
       if (line [0] == '[') {
-	if ( (token = strtok (line, "[] ")) ) {
+	if ( (token = strtok (line, "[] \t\n")) ) {
 	  param = 0;
 
 	  /* which param is it */
@@ -1814,7 +1814,7 @@
 	  if (!param_data [param].name) {
 	    gpm_report (GPM_PR_WARN,"Unknown parameter %s", token);
 	  } else {
-	    token = strtok (NULL, "[] ");
+	    token = strtok (NULL, "[] \t\n");
 
 	    switch (param_data [param].p_type) {
 	    case Integer_Param:

[Index of Archives]     [Kernel Development]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Gimp]     [Yosemite News]