Integrating bash with a C program
From: David Colby (dlcolby_at_hotmail.com)
Date: 05/26/04
- Previous message: Jim Cochrane: "Good open-source CMS packages, etc.?"
- Next in thread: Matthias Czapla: "Re: Integrating bash with a C program"
- Reply: Matthias Czapla: "Re: Integrating bash with a C program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 25 May 2004 17:40:40 -0700
I have been experimenting with this one for a while now, and can't
seem to come up with a solution.
What I want to do is create an application, ASYNCOUT that runs in the
background and monitors a named pipe. Other processes would then be
able to output asynchronous messages to the terminal by writing to the
pipe. My goal was to have ASYNCOUT behave nicely, and only output to
the terminal when the user was not in the middle of typing something
(or in the middle of executing something, like ls or tail).
First question: If somebody knows the proper way to do this, let me
know!
Otherwise, my next question relates to my attempted solution.
The way that I attempted to solve this was to write an app that would
montitor standard output for the prompt. Whenever the prompt is
detected, then queued asynchronous messages could be output. The app
would be started by:
sh > ASYNCOUT
The ASYNCOUT program would forward stdout to the terminal, while
looking for the prompt. With this method, I see the output of ls (and
similar builtins and programs), but I don't see the prompt.
(Other solutions that I've thought of: modifying the shell or writing
my own simple shell. These were both thrown out because they limited
the user to one shell (and potentially limited a lot of
functionality). Incidentally, this is an embedded, closed system, so I
am in complete control of everything that is running in the system.
Thanks for any help,
David
- Previous message: Jim Cochrane: "Good open-source CMS packages, etc.?"
- Next in thread: Matthias Czapla: "Re: Integrating bash with a C program"
- Reply: Matthias Czapla: "Re: Integrating bash with a C program"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|