test/testrumble.c
changeset 11416 7e7d8a125d6a
parent 10737 3406a0f8b041
child 11811 5d94cb6b24d3
equal deleted inserted replaced
11415:41bc8b8e9758 11416:7e7d8a125d6a
    52     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    52     SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
    53 
    53 
    54     name = NULL;
    54     name = NULL;
    55     index = -1;
    55     index = -1;
    56     if (argc > 1) {
    56     if (argc > 1) {
       
    57         size_t l;
    57         name = argv[1];
    58         name = argv[1];
    58         if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) {
    59         if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) {
    59             SDL_Log("USAGE: %s [device]\n"
    60             SDL_Log("USAGE: %s [device]\n"
    60                    "If device is a two-digit number it'll use it as an index, otherwise\n"
    61                    "If device is a two-digit number it'll use it as an index, otherwise\n"
    61                    "it'll use it as if it were part of the device's name.\n",
    62                    "it'll use it as if it were part of the device's name.\n",
    62                    argv[0]);
    63                    argv[0]);
    63             return 0;
    64             return 0;
    64         }
    65         }
    65 
    66 
    66         i = strlen(name);
    67         l = SDL_strlen(name);
    67         if ((i < 3) && isdigit(name[0]) && ((i == 1) || isdigit(name[1]))) {
    68         if ((l < 3) && SDL_isdigit(name[0]) && ((l == 1) || SDL_isdigit(name[1]))) {
    68             index = atoi(name);
    69             index = SDL_atoi(name);
    69             name = NULL;
    70             name = NULL;
    70         }
    71         }
    71     }
    72     }
    72 
    73 
    73     /* Initialize the force feedbackness */
    74     /* Initialize the force feedbackness */