jed-users mailing list

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

Re: [Jed-users-l] "chat mode"?


Ulli Horlacher <framstag@xxxxxxxxxxxxxxxxxxxx> wrote:
> I have found open_process() but this starts an external program. 
> I would like to have it implemented with slang, and no external code.

What about using a subprocess that calls /usr/bin/tail?  For example,

private variable Chat_Input_FIFO = "/path/to/inputfifo";
private variable Chat_Output_FIFO = "/path/to/outputfifo";
private variable Chat_Output_PID = NULL;
define chat_send_input ()
{
   variable fp = fopen (Chat_Input_FIFO, "a");
   if (fp == NULL)
     throw IOError, "Unable to open ${Chat_Input_FIFO}"$;
   () = fputs (line_as_string() + "\n", fp);
   () = fclose (fp);
   newline ();
}

define chat ()
{
   variable
     input_buffer = "*chat input*",
     output_buffer = "*chat output*";

   pop2buf (output_buffer);
   if (Chat_Output_PID != NULL)
     {
	try
	  {
	     kill_process (Chat_Output_PID);
	  }
	catch AnyError;
     }
   Chat_Output_PID = open_process ("/usr/bin/tail", "-f", Chat_Output_FIFO, 2);
   pop2buf (input_buffer);
   no_mode ();
   local_setkey ("chat_send_input", "^M");
}

Thanks,
--John
_______________________________________________
Jed-users-l mailing list
Jed-users-l@xxxxxxxx
http://mailman.jtan.com/mailman/listinfo/jed-users-l


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