write.c 471 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <u.h>
  2. #include <libc.h>
  3. static char x[1024];
  4. static char s[64] = " ABCDEFGHIJKLMNOPQRSTUVWYYZabcdefghijklmnopqrstuvwxyz0123456789";
  5. static void
  6. fill(void)
  7. {
  8. int i;
  9. for(i = 0; i < sizeof(x); i += sizeof(s)){
  10. memmove(&x[i], s, sizeof(s));
  11. x[i] = i>>8;
  12. x[i+1] = i;
  13. }
  14. }
  15. void
  16. main(int argc, char *argv[])
  17. {
  18. int i = 2560;
  19. if(argc > 1){
  20. argc--; argv++;
  21. i = atoi(*argv);
  22. }
  23. USED(argc);
  24. fill();
  25. while(i--)
  26. write(1, x, sizeof(x));
  27. exits(0);
  28. }