rem: while (argc--) {
add: while (argc-- && argv[first] != NULL) {
context: NsTclSchedCmd(ClientData arg, Tcl_Interp *interp, int argc, char **argv){    Callback	*cbPtr;    int          interval;    int          flags;    int          first;    int          id;    /* 12 cases (arg count & number after cmd and -options are handled):     *      0    1        2          3         4     *   * cmd interval script                               (3 args)/2     *   * cmd interval procname                             (3 args)/2     *   * cmd interval procname  arg                        (4 args)/3     *   * cmd -once    interval  script                     (4 args)/2     *   * cmd -once    interval  procname                   (4 args)/2     *   * cmd -once    interval  procname  arg              (5 args)/3     *   * cmd -thread  interval  script                     (4 args)/2     *   * cmd -thread  interval  procname                   (4 args)/2     *   * cmd -thread  interval  procname  arg              (5 args)/3     *   * cmd -once    -thread   interval  script           (5 args)/2     *   * cmd -once    -thread   interval  procname         (5 args)/2     *   * cmd -once    -thread   interval  procname arg     (6 args)/3     */    if (argc < 3 || argc > 6) {        Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0],			 " ?-once? ?-thread? interval "			 "{ script | procname ?arg? }\"", 			 (char *) NULL);        return TCL_ERROR;    }    first = 1;    flags = 0;    while (argc--) {        if (strcmp(argv[first], "-thread") == 0) {            flags |= NS_SCHED_THREAD;        } else if (strcmp(argv[first], "-once") == 0) {            flags |= NS_SCHED_ONCE;        } else {	    break;	}        first++;    }    /*     * First is now the first argument that is not a switch.     */    if (Tcl_GetInt(interp, argv[first++], &interval) != TCL_OK) {        return TCL_ERROR;    }    cbPtr = NewCallback(interp, argv[first], argv[first+1]);    id = Ns_ScheduleProcEx(NsTclSchedProc, cbPtr, flags, interval, FreeSched);    return ReturnValidId(interp, id, cbPtr);}