home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / unix / volume11 / watcher / part01 / getargv.c < prev    next >
Encoding:
C/C++ Source or Header  |  1987-09-27  |  495 b   |  28 lines

  1. /*
  2.    getargv: get a value from argv, whether it is immediately following
  3.    the flag or is the next argument.  Complain if not found and exit.
  4.  
  5.    Kenneth Ingham
  6.  
  7.    Copyright (C) 1987 The University of New Mexico
  8. */
  9.  
  10. #include "defs.h"
  11.  
  12. getargv(what, argv, i, err)
  13. char *what, *argv[], *err;
  14. int i;
  15. {
  16.     if (argv[i][2])
  17.         (void) strcpy(what, &argv[i][2]);
  18.     else {
  19.         if (argv[++i])
  20.             (void) strcpy(what, argv[i]);
  21.         else {
  22.             fprintf(stderr,"Missing %s!\n", err);
  23.             exit(1);
  24.         }
  25.     }
  26.     return i;
  27. }
  28.