On Thu, Nov 19, 2009 at 1:13 PM, PCMan <[email protected]> wrote:
> Thanks for your patch.
> I, however, found that the patch is not portable.
> Since getting cwd from pid is OS-specific stuff, I'd suggest
> encapsulate this in a function, and do some conditional compilation
> for different OSes inside.
>
> For example:
>
> char* get_cwd_for_pid(pid_t pid)
> {
> char* cwd = NULL;
> #ifdef __linux__
> /* read cwd from /proc/... */
> #elif defined(some_other_OS)
> /* some OS-specific code here */
> #elif defined(yet_another_OS)
> /* some OS-specific code here */
> #endif
> return cwd;
> }
>
> You can find how to do this in the source code of gnome-terminal,
> roxterm, or sakura (patched by me previously).
Yes, I know it's not portable, I have read gnome-terminal code, it
supports both Linux and Solaris >= 10, in
gnome-terminal/src/terminal-screen.c; the problem now is I don't have
other operating systems, I can add this kind of code on, but cannnot
test it; and no interest with other os;
So would you mind integrating this first, and then some time later if
someone else want to request for or add other os support, he will do
it; seems reasonable?
char*
terminal_screen_get_current_dir (TerminalScreen *screen)
{
static const char patterns[][18] = {
"/proc/%d/cwd", /* Linux */
"/proc/%d/path/cwd", /* Solaris >= 10 */
};
--
from Cheng
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Lxde-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxde-list