home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / MAGAZINE / DDJ9309.ZIP / NETSQL.ZIP / DEL_TRSP.C < prev    next >
C/C++ Source or Header  |  1991-08-06  |  806b  |  35 lines

  1. /*---------------------------------------------------------------------
  2.  
  3. DESCRIPTION: Self explainatory - deletes trailing spaces from string...
  4.  
  5.   Date     by                      Description
  6. --------  ----  -------------------------------------------------------
  7. 07/01/87   DR    Made loop and len into register variables.
  8.  
  9. 03/19/89   DR    Fix up function for 1 character strings.
  10. ---------------------------------------------------------------------*/
  11. #include "tests.h"
  12. del_trsp(char *op_str)
  13. {
  14. register int loop;
  15. register int len;
  16.  
  17.    if ( allspace(op_str) )
  18.    {
  19.       op_str[0]=0;
  20.    }
  21.    else
  22.    {
  23.       len=strlen(op_str);
  24.       for (loop=len-1 ; loop>=0 && op_str[loop]==32 ; )
  25.       {
  26.          loop--;
  27.       }
  28.       op_str[loop+1]=EOS;
  29.    }
  30.    return(0);
  31.  
  32. }
  33.  
  34.  
  35.