slang-users mailing list

[2008 Date Index] [2008 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: [slang-users] slxosd-0.2


Hi,

2008/4/29, Laurent Perez <laurent.perez@xxxxxxxxxx>:
> Hi,
>
> There is a new slxosd release. It fixes a bug reported by Paul Boekholt.
>
> http://laurent.perez2.free.fr/comp/slang/modules/modules.html

Great! However, it still segfaults with this script:
#!/usr/bin/env slsh

require ("xosd");

variable fp,  line, osd, n, t, last_lines, persist, update;
variable cmd = "free";

last_lines = 10; % number of lines to print
update = 1; % update delay in seconds
persist = 10; % time to persist on screen (in seconds)


private define create_osd()
{
   variable osd = xosd_create (last_lines);

   if (-1 == xosd_set_colour (osd, "cornflower blue"))
     message (xosd_error);
   if (-1 == xosd_set_outline_colour (osd, "blue"))
     message (xosd_error);
   if (-1 == xosd_set_outline_offset (osd, 1))
     message (xosd_error);
   % if (-1 == xosd_set_shadow_offset (osd, 1))
   % message (xosd_error);
   if (-1 == xosd_set_pos (osd, XOSD_top))
     message (xosd_error);
   if (-1 == xosd_set_timeout (osd, persist))
     message (xosd_error);
   return osd;
}


n = 0;
t = 0;
forever
{
   n = 0;
   variable osd;
   try
     {	
	fp = popen (cmd, "r");
	if (fp == NULL)
	  throw OpenError;
	osd = create_osd();
	while (-1 != fgets (&line, fp))
	  {	    	
	     if (strlen (line) > 0)
	       {
		  if (n > 0)
		    () = xosd_scroll (osd, 1);
		  () = xosd_print (osd, last_lines - 1, line);
		  n += 1;
	       }	
	  }
	() = fclose (fp);
     }	
   catch OpenError:
     {
	() = xosd_print (osd, last_lines - 1, "Failed to open " + cmd);
     }
   sleep (update);
}


If I change the
	osd = create_osd();
to
  osd = NULL;
  osd = create_osd();
then it seems to work fine. I guess it's a problem in the xosd library.



[2008 date index] [2008 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]