Esempio n. 1
0
/* Stick a string in the scrolly display */
static void
display_string(char *string)
{
   D(("In display_string: String -->%s<--\n", string));

   if (dtext.str)
      free(dtext.str);
   dtext.str = _Strdup(string);
   dtext.len = strlen(string);
   dtext.pos = 0;
   Epplet_timer(scroll_string, NULL, 0.1, "SCROLL_TIMER");
   Epplet_timer(reset_string, NULL, 20, "RESET_TIMER");
}
Esempio n. 2
0
/* Examine the file for changes */
static void
check_url_file(void *data)
{
   static off_t        lastfilesize = 0;
   off_t               filesize = 0;
   struct stat         filestat;

   D(("In check_url_file, url_file -->%s<--\n", opt.url_file));

   if (stat(opt.url_file, &filestat) != 0)
     {
	D(("stat() failed on -->%s<--\n", opt.url_file));
     }
   else
     {
	filesize = filestat.st_size;

	if ((filesize != lastfilesize) && (lastfilesize != 0))
	   display_url_from_file(get_url_from_file_list(opt.url_file, -1));

	lastfilesize = filesize;
     }

   if (opt.check_url_file)
      Epplet_timer(check_url_file, NULL, 1, "URLCHECK_TIMER");

   return;
   data = NULL;
}
Esempio n. 3
0
static void
timer_cb(void *data)
{
   char                buff[64];
   double              d1, d2, d3;

   get_load_average(&d1, &d2, &d3);
   one = ((d1 > 100.0) ? (100) : ((int)d1));
   five = ((d2 > 100.0) ? (100) : ((int)d2));
   fifteen = ((d3 > 100.0) ? (100) : ((int)d3));

   Epplet_gadget_data_changed(vbar1);
   Epplet_gadget_data_changed(vbar2);
   Epplet_gadget_data_changed(vbar3);

   Esnprintf(buff, sizeof(buff), "%3.2f", d1);
   Epplet_change_label(label1, buff);
   Esnprintf(buff, sizeof(buff), "%3.2f", d2);
   Epplet_change_label(label2, buff);
   Esnprintf(buff, sizeof(buff), "%3.2f", d3);
   Epplet_change_label(label3, buff);

   Epplet_timer(timer_cb, NULL, 5.0, "TIMER");
   return;
   data = NULL;
}
Esempio n. 4
0
File: E-Time.c Progetto: Limsik/e17
static void
timer_cb(void *data)
{
   char                tm[64];
   struct tm           tim;
   struct tm          *tim2;
   time_t              t2;

   if (timezone_str && *timezone_str)
     {
	Esnprintf(tm, sizeof(tm), "TZ=%s", timezone_str);
	putenv(tm);
     }
   t2 = time(NULL);
   tim2 = localtime(&t2);
   if (tim2)
     {
	memcpy(&tim, tim2, sizeof(struct tm));
	strftime(tm, 63, line1, &tim);
	Epplet_change_label(label1, tm);
	strftime(tm, 63, line2, &tim);
	Epplet_change_label(label2, tm);
	strftime(tm, 63, line3, &tim);
	Epplet_change_label(label3, tm);
	strftime(tm, 63, line4, &tim);
	Epplet_change_label(label4, tm);
     }
   Epplet_timer(timer_cb, NULL, 0.5, "TIMER");
   return;
   data = NULL;
}
Esempio n. 5
0
File: E-Magic.c Progetto: Limsik/e17
static void
button_click_cb(void *data)
{
   unsigned long       last_idx = idx;

   do
     {
	idx = (unsigned long)(cnt * ((float)rand()) / (RAND_MAX + 1.0));
	if (idx >= cnt)
	  {
      /********** FIXME ***********/
	     fprintf(stderr, "Eek!\n");
	     fflush(stderr);
	     idx = last_idx;
	  }
     }
   while (idx == last_idx);

   Epplet_gadget_hide(picture);
   Epplet_gadget_hide(close_button);
   Epplet_gadget_hide(cfg_button);
   Epplet_change_label(label, answers[idx]);
   Epplet_gadget_show(label);

   Epplet_timer(button_show_cb, NULL, delay, "SHOW_BUTTON");
   return;
   data = NULL;
}
Esempio n. 6
0
static void
apply_config(void)
{
   /* Apply options from settings dialog */
   if (opt.new_url_command)
      free(opt.new_url_command);
   opt.new_url_command = _Strdup(Epplet_textbox_contents(txt_new_url_command));
   if (opt.url_save_file)
      free(opt.url_save_file);
   opt.url_save_file = _Strdup(Epplet_textbox_contents(txt_url_save_file));
   if (opt.url_file)
      free(opt.url_file);
   opt.url_file = _Strdup(Epplet_textbox_contents(txt_url_file));
   if (opt.www_command)
      free(opt.www_command);
   opt.www_command = _Strdup(Epplet_textbox_contents(txt_www_command));
   if (opt.ftp_command)
      free(opt.ftp_command);
   opt.ftp_command = _Strdup(Epplet_textbox_contents(txt_ftp_command));
   if (opt.get_command)
      free(opt.get_command);
   opt.get_command = _Strdup(Epplet_textbox_contents(txt_get_command));
   if (opt.check_url_file)
      Epplet_timer(check_url_file, NULL, 1, "URLCHECK_TIMER");

   return;
}
Esempio n. 7
0
int
main(int argc, char **argv)
{
   Epplet_Init("E-Power", "0.1", "Enlightenment Laptop Power Epplet",
	       3, 3, argc, argv, 0);
   atexit(Epplet_cleanup);
   Epplet_timer(cb_timer, NULL, 30.0, "TIMER");
   b_close = Epplet_create_button(NULL, NULL,
				  2, 2, 0, 0, "CLOSE", 0, NULL, cb_close, NULL);
   b_help = Epplet_create_button(NULL, NULL,
				 34, 2, 0, 0, "HELP", 0, NULL, cb_help, NULL);
   b_suspend = Epplet_create_button(NULL, NULL,
				    2, 34, 0, 0, "PAUSE", 0, NULL,
				    cb_suspend, NULL);
   b_sleep = Epplet_create_button(NULL, NULL,
				  34, 34, 0, 0, "STOP", 0, NULL,
				  cb_sleep, NULL);
   Epplet_gadget_show(image = Epplet_create_image(2, 2, 44, 24,
						  "E-Power-Bat-100.png"));
   Epplet_gadget_show(label =
		      Epplet_create_label(2, 28, "APM, ACPI\nmissing", 1));
   Epplet_register_focus_in_handler(cb_in, NULL);
   Epplet_register_focus_out_handler(cb_out, NULL);
   cb_timer(NULL);
   Epplet_show();
   Epplet_Loop();
   return 0;
}
Esempio n. 8
0
/* Scroll the string around */
static void
scroll_string(void *data)
{
   char                buf[20];
   static int          back = 0;
   static int          pause = 0;

   if (dtext.len > 19)
     {
	if (dtext.pos > (dtext.len - 19))
	  {
	     dtext.pos = dtext.len - 19;
	     back = 1;
	     pause = 1;
	  }
	else if (dtext.pos == 0)
	  {
	     back = 0;
	     pause = 1;
	  }

	Esnprintf(buf, sizeof(buf), "%s", dtext.str + dtext.pos);

	if (!back)
	   dtext.pos += 1;
	else
	   dtext.pos -= 1;

	Epplet_change_label(lbl_url, buf);
     }
   else
      Epplet_change_label(lbl_url, dtext.str);

   if (pause)
     {
	Epplet_timer(scroll_string, NULL, 1.0, "SCROLL_TIMER");
	pause = 0;
     }
   else
      Epplet_timer(scroll_string, NULL, 0.3, "SCROLL_TIMER");

   Esync();

   return;
   data = NULL;
}
Esempio n. 9
0
static void
cb_cloak_delay(void *data)
{
   Epplet_remove_timer("CLOAK_TIMER");

   opt.cloak_delay = *(int *)data;
   Epplet_timer(cloak_epplet, NULL, opt.cloak_delay, "CLOAK_TIMER");
   return;
   data = NULL;
}
Esempio n. 10
0
static void
timer_cb(void *data)
{

   char                buff[1024];
   unsigned long       days, hours, mins, secs;
   double              total_secs, delay;

#ifdef HAVE_LIBGTOP

   glibtop_uptime      uptime;

   glibtop_get_uptime(&uptime);
   secs = (unsigned long)uptime.uptime;

#else

   FILE               *fp;

   if (!(fp = fopen("/proc/uptime", "r")))
     {
	D(("Failed to open /proc/uptime -- %s\n", strerror(errno)));
	return;
     }
   fgets(buff, sizeof(buff), fp);
   sscanf(buff, "%lf", &total_secs);
   secs = (unsigned long)total_secs;
   fclose(fp);

#endif

   days = secs / 86400;
   secs %= 86400;
   hours = secs / 3600;
   secs %= 3600;
   mins = secs / 60;
   secs %= 60;
   if (secs == 0)
     {
	secs = 60;
     }
   delay = (double)secs;

   Esnprintf(buff, sizeof(buff), "%lu days", days);
   Epplet_change_label(label2, buff);
   Esnprintf(buff, sizeof(buff), "%lu hours", hours);
   Epplet_change_label(label3, buff);
   Esnprintf(buff, sizeof(buff), "%lu mins", mins);
   Epplet_change_label(label4, buff);

   Esync();
   Epplet_timer(timer_cb, NULL, delay, "TIMER");
   return;
   data = NULL;
}
Esempio n. 11
0
static void
cb_out(void *data, Window w)
{
   if (w == Epplet_get_main_window())
     {
	Epplet_remove_timer("CLOAK_TIMER");
	if ((!cloaked) && (opt.do_cloak))
	   Epplet_timer(cloak_epplet, NULL, opt.cloak_delay, "CLOAK_TIMER");
     }
   return;
   data = NULL;
}
Esempio n. 12
0
File: E-Xss.c Progetto: Limsik/e17
static void
change_hack(void *data)
{

   stop_hack();
   start_hack(hacks[idx]);
   INC_HACK();

   Epplet_timer(change_hack, NULL, delay, "CHANGE_HACK");
   return;
   data = NULL;
}
Esempio n. 13
0
File: Emix.c Progetto: Limsik/e17
/* callback_function to update the volumes with a timer */
static void
update_volumes_callback(void *data)
{
   channels[0].value = read_volume(0);
   channels[1].value = read_volume(1);
   channels[2].value = read_volume(2);
   channels[3].value = read_volume(3);
   Epplet_gadget_data_changed(vs_master);
   Epplet_gadget_data_changed(vs_pcm);
   Epplet_gadget_data_changed(vs_lin);
   Epplet_gadget_data_changed(vs_cda);
   Epplet_timer(update_volumes_callback, NULL, 0.5, "TIMER");
}
Esempio n. 14
0
static void
cb_shoot(void *data)
{
   Epplet_remove_timer("SHOOT_TIMER");
   if (opt.delay < 1)
      do_shot(NULL);
   else if (!strcmp(opt.grabber, "import"))
      Epplet_timer(do_shot, NULL, opt.delay, "SHOOT_TIMER");
   else
      do_shot(NULL);
   return;
   data = NULL;
}
Esempio n. 15
0
File: E-Xss.c Progetto: Limsik/e17
static void
child_cb(void *data, int pid, int exit_code)
{

   if (pid == hack_pid)
     {
	fprintf(stderr, "E-Xss:  Child process exited with return code %d\n",
		exit_code);
	Epplet_remove_timer("CHANGE_HACK");
	Epplet_timer(change_hack, NULL, 0.1, "CHANGE_HACK");
     }
   return;
   data = NULL;
}
Esempio n. 16
0
static void
choose_random_cloak(void *data)
{
   static int          last_anim = 0;

   do
     {
	opt.cloak_anim = (int)(16 * ((float)rand()) / (RAND_MAX + 1.0)) + 1;
     }
   while (opt.cloak_anim == last_anim);	/* Don't pick the same one twice in a row. */
   last_anim = opt.cloak_anim;
   Epplet_timer(choose_random_cloak, NULL, opt.rand_delay, "RAND_TIMER");
   return;
   data = NULL;
}
Esempio n. 17
0
File: Emix.c Progetto: Limsik/e17
int
main(int argc, char *argv[])
{

   if (!open_mixer())
      return 1;
   initialize_channels();

   atexit(Epplet_cleanup);
   Epplet_Init("Emix", "0.9", "Audio mixer Epplet", 3, 3, argc, argv, 0);
   vs_master = Epplet_create_vslider(2, 2, 44, 0, 20, 1, 5,
				     &channels[0].value, set_volume,
				     &channels[0]);
   vs_pcm =
      Epplet_create_vslider(10, 2, 44, 0, 20, 1, 5, &channels[1].value,
			    set_volume, &channels[1]);
   vs_lin =
      Epplet_create_vslider(18, 2, 44, 0, 20, 1, 5, &channels[2].value,
			    set_volume, &channels[2]);
   vs_cda =
      Epplet_create_vslider(26, 2, 44, 0, 20, 1, 5, &channels[3].value,
			    set_volume, &channels[3]);
   b_close =
      Epplet_create_button(NULL, NULL, 34, 3, 0, 0, "CLOSE", 0, NULL, cb_close,
			   NULL);
   b_mute =
      Epplet_create_togglebutton("M", NULL, 34, 18, 12, 12, &mute_status,
				 toggle_mute, &channels[0]);
   b_help =
      Epplet_create_button(NULL, NULL, 34, 33, 0, 0, "HELP", 0, NULL, cb_help,
			   NULL);

   Epplet_gadget_show(vs_master);
   Epplet_gadget_show(vs_pcm);
   Epplet_gadget_show(vs_lin);
   Epplet_gadget_show(vs_cda);
   Epplet_gadget_show(b_close);
   Epplet_gadget_show(b_mute);
   Epplet_gadget_show(b_help);

   Epplet_show();
   Epplet_timer(update_volumes_callback, NULL, 0.5, "TIMER");
   Epplet_Loop();
   return 0;
}
Esempio n. 18
0
void temporizador(void *datos){
  FILE *aTemp;
  FILE *aFreq;
  aTemp=fopen("/sys/class/hwmon/hwmon0/temp1_input","r");
  fgets(textoTemperatura,3,aTemp);
  fclose(aTemp);
  aFreq=popen("cpufreq-info -f","r");
  fgets(texto,5,aFreq);
  if(texto[0]=='8')texto[3]='\0';
  pclose(aFreq);
  
  temperatura=atoi(textoTemperatura);
  Epplet_gadget_data_changed(barra);
  sprintf(textoTemperatura,"%s C",textoTemperatura);
  Epplet_change_label(visorNumerico,texto);
  Epplet_change_label(visorTemperatura,textoTemperatura);
  Esync();
  Epplet_timer(temporizador, NULL, REFRESCO, "TIMER");
  //datos = NULL;
}
Esempio n. 19
0
static void
cb_cloak_anim(void *data)
{
   cb_in(NULL, 0);
   opt.do_cloak = 1;
   opt.cloak_anim = *((int *)data);
   if (opt.cloak_anim == 25)
     {
	opt.rand_cloak = 1;
	choose_random_cloak(NULL);
     }
   else
     {
	if (opt.rand_cloak)
	  {
	     Epplet_remove_timer("RAND_TIMER");
	  }
	opt.rand_cloak = 0;
     }
   Epplet_timer(cloak_epplet, NULL, opt.cloak_delay, "CLOAK_TIMER");
   return;
   data = NULL;
}
Esempio n. 20
0
static void
create_epplet_layout(void)
{
   Epplet_gadget_show(lbl_url = Epplet_create_label(2, 34, " ", 0));

   Epplet_gadget_show(btn_close =
		      Epplet_create_std_button("CLOSE", 2, 2, cb_close, NULL));
   Epplet_gadget_show(btn_help =
		      Epplet_create_std_button("HELP", 16, 2, cb_help, NULL));
   Epplet_gadget_show(btn_www =
		      Epplet_create_text_button("WWW",
						4, 17, 28, 13,
						cb_shoot, "www"));
   Epplet_gadget_show(btn_ftp =
		      Epplet_create_text_button("FTP",
						34, 17, 28, 13,
						cb_shoot, "ftp"));
   Epplet_gadget_show(btn_wget =
		      Epplet_create_text_button("GET",
						64, 17, 28, 13,
						cb_shoot, "get"));
   btn_file_url = Epplet_create_text_button("New!",
					    30, 2, 34, 12,
					    cb_btn_file_url, NULL);
   Epplet_gadget_show(btn_conf =
		      Epplet_create_std_button("CONFIGURE",
					       82, 2, cb_config, NULL));
   url_p = Epplet_create_popup();
   Epplet_add_popup_entry(url_p, "Url List is currently empty", NULL, NULL,
			  NULL);
   Epplet_gadget_show(btn_urllist =
		      Epplet_create_popupbutton(NULL, NULL, 68, 2, 12, 12,
						"ARROW_DOWN", url_p));
   if (opt.check_url_file)
      Epplet_timer(check_url_file, NULL, 1, "URLCHECK_TIMER");
   display_string("Welcome to E-UrlWatch ;-)");
}
Esempio n. 21
0
int main (int argc, char **argv)
{
  texto=malloc(8);
  textoTemperatura=malloc(8);
  atexit(Epplet_cleanup);
  Epplet_Init("E-cpuStat", "0.1", "Enlightenment cpu temp/freq",
	       3, 3, argc, argv, 0);
  Epplet_timer(temporizador, NULL, 0, "TIMER");
  botonCerrar=Epplet_create_button(NULL, NULL,
					   2, 2, 0, 0, "CLOSE", 0, NULL,
					   cerrar, NULL);
  Epplet_register_focus_in_handler(enFoco,NULL);
  Epplet_register_focus_out_handler(fueraFoco,NULL);
  barra = Epplet_create_vbar(32, 3, 12, 41,
				     1, &temperatura);
  Epplet_gadget_show(barra);
  visorNumerico=Epplet_create_label(3,35,texto,0);
  visorTemperatura=Epplet_create_label(6,18,textoTemperatura,0);
  Epplet_gadget_show(visorTemperatura);
  Epplet_gadget_show(visorNumerico);
  Epplet_show();
  Epplet_Loop();
  return 0;
}
Esempio n. 22
0
static void
timer_cb(void *data)
{

   FILE               *fp;
   char                buff[1024];
   unsigned long       a, b, c, d, e;
   unsigned long       in_blks = 0, out_blks = 0;
   static unsigned long last_in = 0, last_out = 0, in_delta = 0, out_delta = 0;

   if (!(fp = fopen("/proc/diskstats", "r")))
     {
	if (!(fp = fopen("/proc/stat", "r")))
	  {
	     D(("Failed to open /proc/stat -- %s\n", strerror(errno)));
	     return;
	  }
     }

   for (; fgets(buff, sizeof(buff), fp);)
     {
	if (BEGMATCH(buff, "disk_rblk"))
	  {
	     sscanf(buff, "%*s %lu %lu %lu %lu", &a, &b, &c, &d);
	     in_blks = a + b + c + d;
	     fgets(buff, sizeof(buff), fp);
	     sscanf(buff, "%*s %lu %lu %lu %lu", &a, &b, &c, &d);
	     out_blks = a + b + c + d;
	  }
	else if (BEGMATCH(buff, "disk_io"))
	  {
	     char               *pbuff = buff + 9;

	     for (in_blks = out_blks = 0; *pbuff == '(';
		  pbuff = strchr(pbuff, ' ') + 1)
	       {
		  pbuff = strchr(++pbuff, '(');
		  sscanf(++pbuff, "%lu,%lu,%lu,%lu,%lu", &a, &b, &c, &d, &e);
		  in_blks += c;
		  out_blks += e;
	       }
	  }
	else
	  {
	     char                tmp[64];

	     /* Hopefully no one can exploit /proc/diskstats without root. :-) */
	     sscanf(buff, "%lu %lu %s %*u %*u %lu %*u %*u %*u %lu", &a, &b, tmp,
		    &c, &d);
	     /* Check for hdX or sdX, or md#, or...??? */
	     if ((((*tmp == 'h') || (*tmp == 's')) && (tmp[1] == 'd')
		  && (isalpha(tmp[2])) && (tmp[3] == 0)) || ((*tmp == 'm')
							     && (tmp[1] == 'd')
							     &&
							     (isdigit(tmp[2]))))
	       {
		  in_blks += c;
		  out_blks += d;
	       }
	  }
     }
   in_blks -= last_in;
   out_blks -= last_out;
   fclose(fp);

   if (last_in)
     {
	/* We must have some history data to do anything. */
	if (in_blks > max_in)
	  {
	     max_in = in_blks;
	     Esnprintf(buff, sizeof(buff), "%lu", max_in);
	     Epplet_modify_config("max_in", buff);
	  }
	if (in_blks != in_delta)
	  {
	     in_val = (int)((((float)in_blks) / max_in) * 100.0);
	     Epplet_gadget_data_changed(in_bar);
	     sprintf(buff, "I: ");
	     show_size(in_blks * 512, buff + 3);
	     strcat(buff, "/s");
	     Epplet_change_label(in_label, buff);
	  }
	in_delta = in_blks;
     }
   last_in += in_blks;

   if (last_out)
     {
	/* We must have some history data to do anything. */
	if (out_blks > max_out)
	  {
	     max_out = out_blks;
	     Esnprintf(buff, sizeof(buff), "%lu", max_out);
	     Epplet_modify_config("max_out", buff);
	  }
	if (out_blks != out_delta)
	  {
	     out_val = (int)((((float)out_blks) / max_out) * 100.0);
	     Epplet_gadget_data_changed(out_bar);
	     sprintf(buff, "O: ");
	     show_size(out_blks * 512, buff + 3);
	     strcat(buff, "/s");
	     Epplet_change_label(out_label, buff);
	  }
	out_delta = out_blks;
     }
   last_out += out_blks;

   Esync();
   Epplet_timer(timer_cb, NULL, 1.0, "TIMER");
   return;
   data = NULL;
}
Esempio n. 23
0
static void
create_epplet_layout(void)
{
   Epplet_gadget_show(btn_close =
		      Epplet_create_button(NULL, NULL, 2, 2, 0, 0, "CLOSE", 0,
					   NULL, cb_close, NULL));
   Epplet_gadget_show(btn_help =
		      Epplet_create_button(NULL, NULL, 18, 2, 0, 0, "HELP", 0,
					   NULL, cb_help, NULL));
   Epplet_gadget_show(btn_shoot =
		      Epplet_create_button(NULL, "E-ScreenShoot_shoot.png",
					   23, 31, 22, 13, 0, 0, NULL,
					   cb_shoot, NULL));
   Epplet_gadget_show(tog_win =
		      Epplet_create_togglebutton(NULL, "E-ScreenShoot_win.png",
						 11, 17, 10, 13, &opt.win,
						 NULL, NULL));
   Epplet_gadget_show(sldr_qual =
		      Epplet_create_vslider(2, 17, 28, 0, 100, 1, 25,
					    &invquality, cb_quality, NULL));
   p = Epplet_create_popup();
   Epplet_add_popup_entry(p, "Don't Cloak", NULL, cb_dont_cloak, NULL);
   Epplet_add_popup_entry(p, "Blank Epplet", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[0])));
   Epplet_add_popup_entry(p, "RasterFire", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[1])));
   Epplet_add_popup_entry(p, "Radar", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[2])));
   Epplet_add_popup_entry(p, "AA Radar", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[3])));
   Epplet_add_popup_entry(p, "AA Triangle", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[4])));
   Epplet_add_popup_entry(p, "AA Star", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[5])));
   Epplet_add_popup_entry(p, "Starfield", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[6])));
   Epplet_add_popup_entry(p, "AA Starfield", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[7])));
   Epplet_add_popup_entry(p, "Mesh", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[8])));
   Epplet_add_popup_entry(p, "Funky Mesh", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[15])));
/* 
 *   Epplet_add_popup_entry (p, "Bendy Mesh", NULL, cb_cloak_anim,
 * 			  (void *) (&(cloak_anims[16])));
 */
   Epplet_add_popup_entry(p, "Scanner", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[9])));
   Epplet_add_popup_entry(p, "ColorShift", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[10])));
   Epplet_add_popup_entry(p, "Bouncy Ball", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[11])));
   Epplet_add_popup_entry(p, "Atoms", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[12])));
   Epplet_add_popup_entry(p, "Banner", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[13])));
   Epplet_add_popup_entry(p, "SineWave", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[14])));
   Epplet_add_popup_entry(p, "Random", NULL, cb_cloak_anim,
			  (void *)(&(cloak_anims[25])));

   col_p = Epplet_create_popup();
   Epplet_add_popup_entry(col_p, "Flame Colors", NULL, NULL, NULL);
   Epplet_add_popup_entry(col_p, "Funky", NULL, cb_color,
			  (void *)(&(colors[0 * 9])));
   Epplet_add_popup_entry(col_p, "Turquoise", NULL, cb_color,
			  (void *)(&(colors[1 * 9])));
   Epplet_add_popup_entry(col_p, "Fire", NULL, cb_color,
			  (void *)(&(colors[2 * 9])));
   Epplet_add_popup_entry(col_p, "Copper", NULL, cb_color,
			  (void *)(&(colors[3 * 9])));
   Epplet_add_popup_entry(col_p, "Violet", NULL, cb_color,
			  (void *)(&(colors[4 * 9])));
   Epplet_add_popup_entry(col_p, "Night", NULL, cb_color,
			  (void *)(&(colors[5 * 9])));
   Epplet_add_popup_entry(col_p, "Sunrise", NULL, cb_color,
			  (void *)(&(colors[6 * 9])));
   Epplet_add_popup_entry(col_p, "Sunset", NULL, cb_color,
			  (void *)(&(colors[7 * 9])));

   ctimer_p = Epplet_create_popup();
   Epplet_add_popup_entry(ctimer_p, "Cloak Delay", NULL, NULL, NULL);
   Epplet_add_popup_entry(ctimer_p, "1 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[0])));
   Epplet_add_popup_entry(ctimer_p, "2 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[1])));
   Epplet_add_popup_entry(ctimer_p, "3 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[2])));
   Epplet_add_popup_entry(ctimer_p, "4 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[3])));
   Epplet_add_popup_entry(ctimer_p, "5 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[4])));
   Epplet_add_popup_entry(ctimer_p, "10 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[5])));
   Epplet_add_popup_entry(ctimer_p, "15 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[6])));
   Epplet_add_popup_entry(ctimer_p, "20 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[7])));
   Epplet_add_popup_entry(ctimer_p, "30 Sec", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[8])));
   Epplet_add_popup_entry(ctimer_p, "1 min", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[9])));
   Epplet_add_popup_entry(ctimer_p, "2 mins", NULL, cb_cloak_delay,
			  (void *)(&(cloak_delays[10])));

   stimer_p = Epplet_create_popup();
   Epplet_add_popup_entry(stimer_p, "Shot Delay", NULL, NULL, NULL);
   Epplet_add_popup_entry(stimer_p, "No Delay", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[0])));
   Epplet_add_popup_entry(stimer_p, "1 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[1])));
   Epplet_add_popup_entry(stimer_p, "2 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[2])));
   Epplet_add_popup_entry(stimer_p, "3 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[3])));
   Epplet_add_popup_entry(stimer_p, "4 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[4])));
   Epplet_add_popup_entry(stimer_p, "5 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[5])));
   Epplet_add_popup_entry(stimer_p, "10 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[6])));
   Epplet_add_popup_entry(stimer_p, "15 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[7])));
   Epplet_add_popup_entry(stimer_p, "20 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[8])));
   Epplet_add_popup_entry(stimer_p, "30 Sec", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[9])));
   Epplet_add_popup_entry(stimer_p, "1 min", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[10])));
   Epplet_add_popup_entry(stimer_p, "2 mins", NULL, cb_shot_delay,
			  (void *)(&(shot_delays[11])));

   grabber_p = Epplet_create_popup();
   Epplet_add_popup_entry(grabber_p, "import", NULL, cb_grabber,
			  _Strdup("import"));
   Epplet_add_popup_entry(grabber_p, "scrot", NULL, cb_grabber,
			  _Strdup("scrot"));

   Epplet_gadget_show(btn_conf =
		      Epplet_create_button(NULL, NULL, 34, 2, 12, 12,
					   "CONFIGURE", 0, NULL, cb_config,
					   NULL));

   Epplet_gadget_show(btn_col =
		      Epplet_create_popupbutton(NULL, "E-ScreenShoot_col.png",
						11, 31, 10, 13, NULL, col_p));
   Epplet_gadget_show(btn_ctimer =
		      Epplet_create_popupbutton(NULL,
						"E-ScreenShoot_minitime.png",
						23, 17, 10, 13, NULL,
						ctimer_p));

   Epplet_gadget_show(btn_stimer =
		      Epplet_create_popupbutton(NULL,
						"E-ScreenShoot_minitime2.png",
						35, 17, 10, 13, NULL,
						stimer_p));

   da = Epplet_create_drawingarea(2, 2, 44, 44);
   win = Epplet_get_drawingarea_window(da);
   buf = Epplet_make_rgb_buf(40, 40);

   cloaked = 0;
   set_flame_col(0);
   if (opt.do_cloak)
      Epplet_timer(cloak_epplet, NULL, opt.cloak_delay, "CLOAK_TIMER");

   Epplet_register_mouse_enter_handler(cb_in, (void *)win);
   Epplet_register_mouse_leave_handler(cb_out, NULL);
}
Esempio n. 24
0
static void
cb_timer_apm(void *data)
{
   static FILE        *f;

   f = fopen("/proc/apm", "r");
   if (f)
     {
	char                s[256], s1[32], s2[32], s3[32];
	int                 apm_flags, ac_stat, bat_stat, bat_flags;
	int                 i, hours, minutes, up, up2;
	char               *s_ptr;

	fgets(s, 255, f);
	sscanf(s, "%*s %*s %x %x %x %x %s %s %s", &apm_flags, &ac_stat,
	       &bat_stat, &bat_flags, s1, s2, s3);
	s1[strlen(s1) - 1] = 0;
	bat_val = atoi(s1);
	if (!strcmp(s3, "sec"))
	   time_val = atoi(s2);
	else if (!strcmp(s3, "min"))
	   time_val = atoi(s2) * 60;
	fclose(f);

	up = bat_val - prev_bat_val;
	up2 = up;
	for (i = 0; i < 16; i++)
	   up2 = +prev_up[i];
	up2 = (up2 * 60) / 17;

	prev_up[prev_count] = up;

	prev_count++;
	if (prev_count >= 16)
	   prev_count = 0;

	s_ptr = s;

	if (bat_flags != 0xff && bat_flags & 0x80)
	  {
	     s_ptr += sprintf(s_ptr, "no battery");
	  }
	else
	  {
	     if (bat_val > 0)
		s_ptr += sprintf(s_ptr, "%i%%", bat_val);

	     switch (bat_stat)
	       {
	       case 0:
		  s_ptr += sprintf(s_ptr, ", high");
		  break;
	       case 1:
		  s_ptr += sprintf(s_ptr, ", low");
		  break;
	       case 2:
		  s_ptr += sprintf(s_ptr, ", crit.");
		  break;
	       case 3:
		  s_ptr += sprintf(s_ptr, ", charge");
		  break;
	       }
	  }
	s_ptr += sprintf(s_ptr, "\n");

	if (ac_stat == 1)
	  {
	     s_ptr += sprintf(s_ptr, "AC on-line");
	  }
	else
	  {
	     hours = time_val / 3600;
	     minutes = (time_val / 60) % 60;
	     if (up2 > 0)
		s_ptr += sprintf(s_ptr, "(%i:%02i)\n%i:%02i",
				 (((100 - bat_val) * 2 * 60) / up2) / 60,
				 (((100 - bat_val) * 2 * 60) / up2) % 60,
				 hours, minutes);
	     else
		s_ptr += sprintf(s_ptr, "%i:%02i", hours, minutes);
	  }
	Epplet_change_label(label, s);

	sprintf(s, "E-Power-Bat-%i.png", ((bat_val + 5) / 10) * 10);
	Epplet_change_image(image, 44, 24, s);
	Epplet_timer(cb_timer, NULL, 30.0, "TIMER");

	prev_bat_val = bat_val;
     }
   data = NULL;
}
Esempio n. 25
0
static void
cb_timer_acpi(void *data)
{
   /* We don't have any data from the remaining percentage, and time directly,
    * so we have to calculate and measure them.
    * (Measure the time and calculate the percentage.)
    */
   static int          prev_bat_drain = 1;

   FILE               *f;
   DIR                *dirp;
   struct dirent      *dp;

   int                 bat_max = 0;
   int                 bat_filled = 0;
   int                 bat_level = 0;
   int                 bat_drain = 1;

   int                 bat_val = 0;

   char                current_status[256];
   char               *line = 0;
   size_t              lsize = 0;
   int                 discharging = 0;
   int                 charging = 0;
   int                 battery = 0;

   int                 design_cap_unknown = 0;
   int                 last_full_unknown = 0;
   int                 rate_unknown = 0;
   int                 level_unknown = 0;

   int                 hours, minutes;

   /* Read some information on first run. */
   dirp = opendir("/proc/acpi/battery");
   if (dirp)
     {
	while ((dp = readdir(dirp)))
	  {
	     char                buf[4096];

	     if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, "..")))
		continue;
	     snprintf(buf, sizeof(buf), "/proc/acpi/battery/%s/info",
		      dp->d_name);
	     f = fopen(buf, "r");
	     if (f)
	       {
		  int                 design_cap = 0;
		  int                 last_full = 0;

		  getline(&line, &lsize, f);
		  getline(&line, &lsize, f);
		  sscanf(line, "%*[^:]: %250s %*s", buf);
		  if (!strcmp(buf, "unknown"))
		     design_cap_unknown = 1;
		  else
		     sscanf(line, "%*[^:]: %i %*s", &design_cap);
		  getline(&line, &lsize, f);
		  sscanf(line, "%*[^:]: %250s %*s", buf);
		  if (!strcmp(buf, "unknown"))
		     last_full_unknown = 1;
		  else
		     sscanf(line, "%*[^:]: %i %*s", &last_full);
		  fclose(f);
		  bat_max += design_cap;
		  bat_filled += last_full;
	       }
	     snprintf(buf, sizeof(buf), "/proc/acpi/battery/%s/state",
		      dp->d_name);
	     f = fopen(buf, "r");
	     if (f)
	       {
		  char                present[256];
		  char                capacity_state[256];
		  char                charging_state[256];
		  int                 rate = 1;
		  int                 level = 0;

		  getline(&line, &lsize, f);
		  sscanf(line, "%*[^:]: %250s", present);
		  getline(&line, &lsize, f);
		  sscanf(line, "%*[^:]: %250s", capacity_state);
		  getline(&line, &lsize, f);
		  sscanf(line, "%*[^:]: %250s", charging_state);
		  getline(&line, &lsize, f);
		  sscanf(line, "%*[^:]: %250s %*s", buf);
		  if (!strcmp(buf, "unknown"))
		     rate_unknown = 1;
		  else
		     sscanf(line, "%*[^:]: %i %*s", &rate);
		  getline(&line, &lsize, f);
		  sscanf(line, "%*[^:]: %250s %*s", buf);
		  if (!strcmp(buf, "unknown"))
		     level_unknown = 1;
		  else
		     sscanf(line, "%*[^:]: %i %*s", &level);
		  fclose(f);
		  if (!strcmp(present, "yes"))
		     battery++;
		  if (!strcmp(charging_state, "discharging"))
		     discharging++;
		  if (!strcmp(charging_state, "charging"))
		     charging++;
		  bat_drain += rate;
		  bat_level += level;
	       }
	  }
	closedir(dirp);
     }

   if (prev_bat_drain < 1)
      prev_bat_drain = 1;
   if (bat_drain < 1)
      bat_drain = prev_bat_drain;
   prev_bat_drain = bat_drain;

   if (bat_filled > 0)
      bat_val = (100 * bat_level) / bat_filled;
   else
      bat_val = 100;

   if (discharging)
      minutes = (60 * bat_level) / bat_drain;
   else
     {
	if (bat_filled > 0)
	   minutes = (60 * (bat_filled - bat_level)) / bat_drain;
	else
	   minutes = 0;
     }
   hours = minutes / 60;
   minutes -= (hours * 60);

   if (charging)
     {
	if (level_unknown)
	   snprintf(current_status, sizeof(current_status),
		    "Level ???\n" "Bad Driver");
	else if (rate_unknown)
	   snprintf(current_status, sizeof(current_status),
		    "%i%% PWR\n" "Time ???", bat_val);
	else
	   snprintf(current_status, sizeof(current_status),
		    "%i%% PWR\n" "%02i:%02i", bat_val, hours, minutes);
     }
   else if (discharging)
     {
	if (level_unknown)
	   snprintf(current_status, sizeof(current_status),
		    "Level ???\n" "Bad Driver");
	else if (rate_unknown)
	   snprintf(current_status, sizeof(current_status),
		    "%i%%\n" "Time ???", bat_val);
	else
	   snprintf(current_status, sizeof(current_status),
		    "%i%%\n" "%02i:%02i", bat_val, hours, minutes);
     }
   else if (!battery)
      snprintf(current_status, sizeof(current_status), "No Bat");
   else
      snprintf(current_status, sizeof(current_status), "Full");

   /* Display current status */
   Epplet_change_label(label, current_status);
   sprintf(current_status, "E-Power-Bat-%i.png", ((bat_val + 5) / 10) * 10);
   Epplet_change_image(image, 44, 24, current_status);
   Epplet_timer(cb_timer, NULL, 5.0, "TIMER");

   /* Final steps before ending the status update. */
   data = NULL;
   if (lsize)
      free(line);
}
Esempio n. 26
0
static void
cloak_draw(void *data)
{
   switch (opt.cloak_anim)
     {
     case 0:
	{
	   blank_buf();
	   break;
	}
     case 1:
	{
	   load_val = (opt.quality / 2);
	   draw_flame();
	   break;
	}
     case 2:
	{
	   draw_radar();
	   break;
	}
     case 3:
	{
	   draw_aa_radar();
	   break;
	}
     case 4:
	{
	   draw_aa_triangle();
	   break;
	}
     case 5:
	{
	   draw_aa_star();
	   break;
	}
     case 6:
	{
	   draw_starfield();
	   break;
	}
     case 7:
	{
	   draw_aa_starfield();
	   break;
	}
     case 8:
	{
	   draw_rotator();
	   break;
	}
     case 9:
	{
	   draw_scanner();
	   break;
	}
     case 10:
	{
	   draw_colorwarp();
	   break;
	}
     case 11:
	{
	   draw_ball();
	   break;
	}
     case 12:
	{
	   draw_atoms();
	   break;
	}
     case 13:
	{
	   draw_text();
	   break;
	}
     case 14:
	{
	   draw_sine();
	   break;
	}
     case 15:
	{
	   draw_funky_rotator();
	   break;
	}
     default:
	{
	   blank_buf();
	   break;
	}
     }
   Epplet_paste_buf(buf, win, 0, 0);
   Epplet_timer(cloak_draw, NULL, opt.draw_interval, "DRAW_TIMER");
   return;
   data = NULL;
}
Esempio n. 27
0
static void
timer_cb(void *data)
{
   char                buff[1024];
   double              val = -1.0, val2 = -1.0;
   unsigned char       invalid;
   unsigned long       in_bytes, out_bytes;
   static unsigned long in_delta = -1, out_delta = -1;

   invalid = net_get_bytes_inout(device_string, &val, &val2);
   if (invalid)
     {
	D(("Failed to open %s -- %s\n", device_string, strerror(errno)));
	Esync();
	Epplet_timer(timer_cb, NULL, 10.0, "TIMER");
	return;
     }
   if ((last_in == 0) && (last_out == 0))
     {
	last_in = (unsigned long)val;
	last_out = (unsigned long)val2;
	Esync();
	Epplet_timer(timer_cb, NULL, 1.0, "TIMER");
	return;
     }

   in_bytes = (unsigned long)val - last_in;
   out_bytes = (unsigned long)val2 - last_out;
   D(("In %lu, out %lu\n", in_bytes, out_bytes));

   if (in_bytes > max_in)
     {
	max_in = in_bytes;
	Esnprintf(buff, sizeof(buff), "%lu", max_in);
	Epplet_modify_config("max_in", buff);
	D(("Set max_in to %lu\n", max_in));
     }
   if (in_bytes != in_delta)
     {
	in_val = (int)((((float)in_bytes) / max_in) * 100.0);
	Epplet_gadget_data_changed(in_bar);
	sprintf(buff, "I: ");
	show_size(in_bytes, buff + 3);
	strcat(buff, "/s");
	Epplet_change_label(in_label, buff);
	in_delta = in_bytes;
     }
   last_in += in_bytes;

   if (out_bytes > max_out)
     {
	max_out = out_bytes;
	Esnprintf(buff, sizeof(buff), "%lu", max_out);
	Epplet_modify_config("max_out", buff);
	D(("Set max_out to %lu\n", max_out));
     }
   if (out_bytes != out_delta)
     {
	out_val = (int)((((float)out_bytes) / max_out) * 100.0);
	Epplet_gadget_data_changed(out_bar);
	sprintf(buff, "O: ");
	show_size(out_bytes, buff + 3);
	strcat(buff, "/s");
	Epplet_change_label(out_label, buff);
	out_delta = out_bytes;
     }
   last_out += out_bytes;

   Esync();
   Epplet_timer(timer_cb, NULL, 1.0, "TIMER");
   return;
   data = NULL;
}
Esempio n. 28
0
File: E-Power.c Progetto: Limsik/e17
static void
cb_timer_sys(void *data)
{
   /* We don't have any data from the remaining percentage, and time directly,
    * so we have to calculate and measure them.
    * (Measure the time and calculate the percentage.)
    */
   static int          prev_bat_drain = 1;

   FILE               *f;
   DIR                *dirp;
   struct dirent      *dp;

   int                 bat_max = 0;
   int                 bat_filled = 0;
   int                 bat_level = 0;
   int                 bat_drain = 1;

   int                 bat_val = 0;

   char                current_status[256];
   char               *line = 0;
   size_t              lsize = 0;
   int                 discharging = 0;
   int                 charging = 0;
   int                 battery = 0;

   int                 design_cap_unknown = 1;
   int                 last_full_unknown = 1;
   int                 rate_unknown = 1;
   int                 level_unknown = 1;

   int                 hours, minutes;

   /* Read some information on first run. */
   dirp = opendir("/sys/class/power_supply/");
   if (dirp)
     {
	while ((dp = readdir(dirp)))
	  {
	     char                buf[4096];

	     if ((!strcmp(dp->d_name, ".")) || (!strcmp(dp->d_name, ".."))
		 || (!strstr(dp->d_name, "BAT")))
		continue;
	     snprintf(buf, sizeof(buf), "/sys/class/power_supply/%s/uevent",
		      dp->d_name);
	     f = fopen(buf, "r");
	     if (f)
	       {
		  int                 design_cap = 0;
		  int                 last_full = 0;
		  char                present[256];
		  char                key[256];
		  char                capacity_state[256];
		  char                charging_state[256];
		  char                name[256];
		  int                 rate = 1;
		  int                 level = 0;

		  while (getline(&line, &lsize, f) != -1)
		    {
		       sscanf(line, "%[^=]= %250s", key, name);
		       if (strcmp(key, "POWER_SUPPLY_NAME") == 0)
			 {
			 }
		       else if (strcmp(key, "POWER_SUPPLY_STATUS") == 0)
			 {
			    sscanf(line, "%*[^=]= %250s", charging_state);
			    if (!strcmp(charging_state, "Discharging"))
			       discharging++;
			    if (!strcmp(charging_state, "Charging"))
			       charging++;
			 }
		       else if (strcmp(key, "POWER_SUPPLY_PRESENT") == 0)
			 {
			    sscanf(line, "%*[^=]= %250s", present);
			    if (!strcmp(present, "1"))
			       battery++;
			 }
		       else if (strcmp(key, "POWER_SUPPLY_CURRENT_NOW") == 0)
			 {
			    sscanf(line, "%*[^=]= %i %*s", &rate);
			    rate_unknown = 0;
			    bat_drain += (rate);
			 }
		       else if (strcmp(key, "POWER_SUPPLY_CHARGE_FULL_DESIGN")
				== 0)
			 {
			    sscanf(line, "%*[^=]=%i", &design_cap);
			    design_cap_unknown = 0;
			    bat_max += design_cap;
			 }
		       else if (strcmp(key, "POWER_SUPPLY_CHARGE_FULL") == 0)
			 {
			    sscanf(line, "%*[^=]= %i", &last_full);
			    last_full_unknown = 0;
			    bat_filled += last_full;
			 }
		       else if (strcmp(key, "POWER_SUPPLY_CHARGE_NOW") == 0)
			 {
			    sscanf(line, "%*[^=]= %i", &level);
			    level_unknown = 0;
			    bat_level += level;
			 }
		    }
		  fclose(f);
	       }
	  }
	closedir(dirp);
     }

   if (prev_bat_drain < 1)
      prev_bat_drain = 1;
   if (bat_drain < 1)
      bat_drain = prev_bat_drain;
   prev_bat_drain = bat_drain;

   if (bat_filled > 0)
      bat_val = (100 * bat_level) / bat_filled;
   else
      bat_val = 100;

   if (discharging)
      minutes = (60 * bat_level) / bat_drain;
   else
     {
	if (bat_filled > 0)
	   minutes = (60 * (bat_filled - bat_level)) / bat_drain;
	else
	   minutes = 0;
     }
   hours = minutes / 60;
   minutes -= (hours * 60);

   if (charging)
     {
	if (level_unknown)
	   snprintf(current_status, sizeof(current_status),
		    "Level ???\n" "Bad Driver");
	else if (rate_unknown)
	   snprintf(current_status, sizeof(current_status),
		    "%i%% PWR\n" "Time ???", bat_val);
	else
	   snprintf(current_status, sizeof(current_status),
		    "%i%% PWR\n" "%02i:%02i", bat_val, hours, minutes);
     }
   else if (discharging)
     {
	if (level_unknown)
	   snprintf(current_status, sizeof(current_status),
		    "Level ???\n" "Bad Driver");
	else if (rate_unknown)
	   snprintf(current_status, sizeof(current_status),
		    "%i%%\n" "Time ???", bat_val);
	else
	   snprintf(current_status, sizeof(current_status),
		    "%i%%\n" "%02i:%02i", bat_val, hours, minutes);
     }
   else if (!battery)
      snprintf(current_status, sizeof(current_status), "No Bat");
   else
      snprintf(current_status, sizeof(current_status), "Full");

   /* Display current status */
   Epplet_change_label(label, current_status);
   sprintf(current_status, "E-Power-Bat-%i.png", ((bat_val + 5) / 10) * 10);
   Epplet_change_image(image, 44, 24, current_status);
   Epplet_timer(cb_timer, NULL, 5.0, "TIMER");

   /* Final steps before ending the status update. */
   data = NULL;
   if (lsize)
      free(line);
}