home *** CD-ROM | disk | FTP | other *** search
/ Quake 'em / QUAKEEM.BIN / doom_i / program / tcpsrv12.exe / TCPSRV12.TAR / dfcss.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-27  |  1.2 KB  |  57 lines

  1. /* dfcss.c */
  2. /*
  3.  
  4.  * Copyright 1994 A.Oliver De Guzman
  5.  * All rights reserved
  6.  
  7.  *   Permission is granted to any individual to copy, use, and/or
  8.  * distribute this software provided that the distribution retains this
  9.  * entire copyright notice. No part of this software may be used and/or
  10.  * sold for profit or used with any commercial product.
  11.  
  12.  * DISCLAIMER:
  13.  *   This software comes with NO WARRANTIES of any kind. In no event
  14.  * will the author be liable for any financial, physical, moral, and/or
  15.  * mental damages incurred directly or indirectly by the use or intent
  16.  * to use of this software.
  17.  
  18.  */
  19.  
  20. #include <stdlib.h>
  21. #include <stdio.h>
  22. #include <ctype.h>
  23. #include <time.h>
  24. #include "dfcss.h"
  25.  
  26. int CheckParm(check, argc, argv)
  27. char *check;
  28. int argc;
  29. char *argv[];
  30. {
  31.     int i;
  32.     for (i=1; i<argc; i++)
  33.         if (!strcmp(check,argv[i]))
  34.             return i;
  35.     return 0;
  36. }
  37.  
  38. int StripWhite(s)
  39. char *s;
  40. {
  41.     int i=0, j;
  42.  
  43.     /* skip trailing whites */
  44.     for (; strlen(s) && isspace(s[strlen(s)-1]);)
  45.         s[strlen(s)-1] = '\0';
  46.  
  47.     /* skip leading whites */
  48.     for (i=0; isspace(s[i]) && s[i]; i++);
  49.     for (j=i; j && s[j-1]; j++) s[j-i] = s[j];
  50.  
  51.     /* search for non-white */
  52.     for (i=0; !isspace(s[i]) && s[i]; i++);
  53.  
  54.     if (s[i]) StripWhite(s+i+1);
  55. }
  56.  
  57.