write.c 883 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #include <u.h>
  10. #include <libc.h>
  11. static char x[1024];
  12. static char s[64] = " ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  13. static void
  14. fill(void)
  15. {
  16. int i;
  17. for(i = 0; i < sizeof(x); i += sizeof(s)){
  18. memmove(&x[i], s, sizeof(s));
  19. x[i] = i>>8;
  20. x[i+1] = i;
  21. }
  22. }
  23. void
  24. main(int argc, char *argv[])
  25. {
  26. int i = 2560;
  27. if(argc > 1){
  28. argc--; argv++;
  29. i = atoi(*argv);
  30. }
  31. USED(argc);
  32. fill();
  33. while(i--)
  34. write(1, x, sizeof(x));
  35. exits(0);
  36. }