On 2001.07.30, in <[EMAIL PROTECTED]>,
        "Andrey R. Urazov" <[EMAIL PROTECTED]> wrote:
> Actually, it's not hard to write it. And it's what was supposed while writing mutt 
>manual.
> it could look something like:
>   ps -e|grep -q netscape

Not if you left netscape running on your console when you left your
computer, and you're logged in remotely to use mutt. I do this every
day.... The safest check is to talk X. You can might be able to
find standard shell tools (xlsatoms, xlsclients, etc.) that return
well-defined exit statuses under known conditions on all platforms, but
I wouldn't count on it.

Since I'm not sure this is in the archive enough times, I'll include a
one here. :) It's more friendly than is necessary.

gcc -o RunningX RunningX.c -lX11

-- 
 -D.    [EMAIL PROTECTED]        NSIT    University of Chicago
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

main(int argc, char *argv[])
{
        char *d;

        if (argc == 2) {
                if (!strcmp(argv[1], "-h")) {
                        fprintf(stderr, "usage: %s [display-name]\n", argv[0]);
                        exit(1);
                }
                d = argv[1];
        } else {
                d = getenv("DISPLAY");
        }

        if (d)
                exit(!XOpenDisplay(d));

        exit(2);
}

Reply via email to