home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / timer / wait / wait.c next >
Encoding:
C/C++ Source or Header  |  1986-11-06  |  1.0 KB  |  51 lines

  1. #include "stdio.h"
  2.  
  3. main(a_c,a_v)
  4.  int a_c;
  5.  char **a_v;
  6.   {
  7.     long i,c,wait;
  8.      
  9.      if(a_c < 2)
  10.       {
  11.        wait=3;
  12.       }
  13.      else
  14.       {
  15.        wait=abs(atoi(a_v[1]));
  16.       } 
  17.      
  18.       c=time(NULL);                /* Get seconds */
  19.      
  20.      do { 
  21.       i=time(NULL);              /* Get again   */
  22.       }
  23.      while(i <= c+wait);          /* While below first get */
  24.  }   if(col < 0){
  25.                col=0;}
  26.                break;
  27.         case 13:printf("\n");      /* Return and clear */
  28.                 for(i=0;i<=80;++i){
  29.                 ch[i]=0;}col=0;break;
  30.       }
  31.        if(ch[col] >31 && ch[col]<128)   /* Is it a valid character ? */
  32.        {
  33.         printf("%c",ch[col]);        /* If so print it */
  34.         ++col;
  35.        }
  36.      if(col == 78) { wrap(col); }  /* Wrap at line 78 */
  37.     }
  38.   }
  39.  }
  40.  
  41. wrap()
  42.  {
  43.   int i,pos=0;
  44.   for(i=78;i>=0;--i)    /* Find 1st space in buffer */
  45.    {
  46.          if(ch[i] == 32)
  47.           {
  48.             pos=i+1;
  49.         
  50.              for(i=78;i>=pos;--i)  /* Go back to it */
  51.