pattern.c 655 B

12345678910111213141516171819202122232425
  1. /*
  2. * Copyright (c) 1993 W. Richard Stevens. All rights reserved.
  3. * Permission to use or modify this software and its documentation only for
  4. * educational purposes and without fee is hereby granted, provided that
  5. * the above copyright notice appear in all copies. The author makes no
  6. * representations about the suitability of this software for any purpose.
  7. * It is provided "as is" without express or implied warranty.
  8. */
  9. #include "sock.h"
  10. #include <ctype.h>
  11. void
  12. pattern(char *ptr, int len)
  13. {
  14. char c;
  15. c = 0;
  16. while(len-- > 0) {
  17. while(isprint((c & 0x7F)) == 0)
  18. c++; /* skip over nonprinting characters */
  19. *ptr++ = (c++ & 0x7F);
  20. }
  21. }