home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / snpd9707.zip / SETLEVEL.C < prev    next >
Text File  |  1997-07-05  |  2KB  |  56 lines

  1. .I 0 1
  2. /* +++Date last modified: 05-Jul-1997 */
  3. .D 1 1
  4. .I 121 1
  5.                   case '-':         /* Answers are flagged by '-' */
  6. .D 122 1
  7. .I 129 13
  8.                         j++;
  9.                         if ((wk_ptr = strtok (argv[i]+j, "=")) != NULL)
  10.                         {
  11.                               /*
  12.                                * Allocate space for the new answer entry and
  13.                                * link in into the list. Answers are linked
  14.                                * into the list in reverse order from their
  15.                                * command line specification since the logic
  16.                                * is considerably simpler and it shouldn't
  17.                                * matter much anyway.
  18.                                */
  19.  
  20.                               if (answer_tab == NULL)
  21. .D 130 2
  22. .I 132 10
  23.                                     answer_tab = wk_ans = (VALID_ANS *)
  24.                                           calloc (1, sizeof(VALID_ANS));
  25.                               }
  26.                               else
  27.                               {
  28.                                     wk_ans = (VALID_ANS *)
  29.                                              calloc (1, sizeof(VALID_ANS));
  30.                                     wk_ans->next_ans = answer_tab;
  31.                                     answer_tab = wk_ans;
  32.                               }
  33. .D 133 21
  34. .I 155 8
  35.                                * Store the answer string and errorlevel value
  36.                                * into the answer element.
  37.                                */
  38.  
  39.                               wk_ans->ans_key = strdup (wk_ptr);
  40.                               wk_ptr          = strtok (NULL, "=");
  41.                               if (wk_ptr != NULL)
  42.                               {
  43. .D 156 8
  44. .I 164 6
  45.                                      * Allow only positive returns since -1 is
  46.                                      * and error return from the program.
  47.                                      */
  48.                                     
  49.                                     wk_ans->rtn_err_lev =
  50.                                           abs (atoi (wk_ptr));
  51. .D 165 8
  52. .I 173 2
  53.                               else  wk_ans->rtn_err_lev = 0;
  54.                         }
  55. .D 186 1
  56.