Changeset 4710

Show
Ignore:
Timestamp:
03/22/10 18:46:47 (4 years ago)
Author:
soohyunc
Message:

-- updated main.cpp by consulting meeg4 branch

so that Vic can take query with -Q switch to list available input devices.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • vic/branches/cc/main.cpp

    r4703 r4710  
    130130#endif 
    131131 
    132         static void 
     132static void 
    133133usage(char *szOffending) 
    134134{ 
     
    147147        \t[-K key ] [-L flowLabel (ip6 only)] [-l (creates log file)]\n\ 
    148148        \t[-M colormap] [-m mtu] [-N session] [-n atm|ip|ip6|rtip]\n\ 
    149         \t[-o clipfile] [-t ttl] [-U interval] [-u script] [-v version] [-V visual]\n\ 
     149        \t[-o clipfile] [-Q (queries and lists input devices)] [-t ttl]\n\  
     150        \t[-U interval] [-u script] [-v version] [-V visual]\n\ 
    150151        \t[-x ifIndex (ip6 only)] [-X resource=value] [-j numlayers] dest/port[/fmt/ttl]\n"; 
    151152 
     
    178179 
    179180#ifndef SIGARGS 
    180 #if defined(__SUNPRO_CC) || defined(Linux) || defined(__FreeBSD__) 
     181#if defined(__SUNPRO_CC) || defined(Linux) || defined(__FreeBSD__) || defined(WIN32) 
    181182#define SIGARGS int arg 
    182183#else 
     
    411412} 
    412413 
     414#ifdef WIN32 
     415#if (TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION == 0) 
     416int 
     417SimplePutsCmd(ClientData clientData, Tcl_Interp *interp, int argc, char **argv) 
     418#else 
     419int 
     420SimplePutsCmd(ClientData clientData, Tcl_Interp *interp, int argc, const char **argv) 
     421#endif 
     422{ 
     423        int i, newline; 
     424 
     425        i = 1; 
     426        newline = 1; 
     427        if ((argc >= 2) && (strcmp(argv[1], "-nonewline") == 0)) { 
     428                newline = 0; 
     429                i++; 
     430        } 
     431        printf("%s", argv[i]); 
     432        if (newline) printf("\n"); 
     433 
     434        return TCL_OK; 
     435} 
     436#endif 
     437 
     438void print_input_device_details(Tcl& tcl) 
     439{ 
     440#ifdef WIN32 
     441        tcl.CreateCommand("puts", SimplePutsCmd, NULL); 
     442#endif 
     443 
     444        tcl.evalc("print_input_device_details"); 
     445        exit(0); 
     446} 
     447 
    413448void loadbitmaps(Tcl_Interp* tcl) 
    414449{ 
     
    495530        // Option list; If letter is followed by ':' then it takes an argument 
    496531        const char* options =  
    497                 "A:B:C:c:D:d:f:F:HI:i:j:K:lL:M:m:N:n:o:Pq:rsST:t:U:u:vV:w:x:X:y"; 
     532                "A:B:C:c:D:d:f:F:HI:i:j:K:lL:M:m:N:n:o:Pq:QrsST:t:U:u:vV:w:x:X:y"; 
    498533        /* process display and window (-use) options before initialising tcl/tk */ 
    499534        char buf[256], tmp[256]; 
     
    680715                        tcl.add_option("jpegQfactor", optarg); 
    681716                        break; 
     717 
     718        case 'Q': 
     719            print_input_device_details(tcl); 
     720            break; 
    682721 
    683722                case 'r':