Logo Search packages:      
Sourcecode: waimea version File versions  Download package

main ( int  argc,
char **  argv 
)

Main function for Waimea window manager.

Parses command line options. Creates a new waimea object. Enters the eventloop.

Parameters:
argc Number of command line arguments
argv Vector with command line arguments
Returns:
0 on successful execution else >0

Definition at line 46 of file main.cc.

References help(), and usage().

                                {
    struct waoptions options;
    sprintf(program_name, "%s", argv[0]);
    int i;
    XEvent e;
    char *__m_wastrdup_tmp;

    options.menufile = options.actionfile = options.stylefile =
        options.rcfile = options.display = NULL;

    for (i = 1; i < argc; i++) {
        if (! strcmp(argv[i], "--display")) {
            if (i + 1 < argc) options.display = argv[i++ + 1];
            else { cerr << program_name << ": option `" <<
                       argv[i] << "' requires an argument" << endl; return 1; }
        } else if (! strncmp(argv[i], "--display=", 10) &&
                   strlen(argv[i]) >= 11) { options.display = argv[i] + 10;
        } else if (! strcmp(argv[i], "--rcfile")) {
            if (i++ + 1 < argc) options.rcfile = __m_wastrdup(argv[i]);
            else { cerr << program_name << ": option `" <<
                       argv[i] << "' requires an argument" << endl; return 1; }
        } else if (! strncmp(argv[i], "--rcfile=", 9) &&
                   strlen(argv[i]) >= 10) {
            options.rcfile = __m_wastrdup(argv[i] + 9);
        } else if (! strcmp(argv[i], "--stylefile")) {
            if (i++ + 1 < argc) options.stylefile = __m_wastrdup(argv[i]);
            else { cerr << program_name << ": option `" <<
                       argv[i] << "' requires an argument" << endl; return 1; }
        } else if (! strncmp(argv[i], "--stylefile=", 12) &&
                   strlen(argv[i]) >= 13) {
            options.stylefile = __m_wastrdup(argv[i] + 12);
        } else if (! strcmp(argv[i], "--actionfile")) {
            if (i++ + 1 < argc) options.actionfile = __m_wastrdup(argv[i]);
            else { cerr << program_name << ": option `" <<
                       argv[i] << "' requires an argument" << endl; return 1; }
        } else if (! strncmp(argv[i], "--actionfile=", 13) &&
                   strlen(argv[i]) >= 14) {
            options.actionfile = __m_wastrdup(argv[i] + 13);
        } else if (! strcmp(argv[i], "--menufile")) {
            if (i++ + 1 < argc) options.menufile = __m_wastrdup(argv[i]);
            else { cerr << program_name << ": option `" <<
                       argv[i] << "' requires an argument" << endl; return 1; }
        } else if (! strncmp(argv[i], "--menufile=", 11) &&
                   strlen(argv[i]) >= 12) {
            options.menufile = __m_wastrdup(argv[i] + 11);
        } else if (! strcmp(argv[i], "--usage")) {
            usage(); return 0;
        } else if (! strcmp(argv[i], "--help")) {
            help(); return 0;
        } else if (! strcmp(argv[i], "--version")) {
            cout << PACKAGE << " " << VERSION << endl; return 0;
        } else {
            cerr << program_name << ": unrecognized option `" <<
                argv[i] << "'" << endl; usage(); return 1;
        }
    }
    
    Waimea *waimea = new Waimea(argv, &options);
    waimea->eh->EventLoop(waimea->eh->empty_return_mask, &e);
    
    return 1;
}


Generated by  Doxygen 1.6.0   Back to index