Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. /* See LICENSE file for copyright and license details. */
  2. #include <stdio.h>
  3.  
  4. #include "util.h"
  5.  
  6. #define BUFSIZE 1024
  7.  
  8. static void
  9. usage(void)
  10. {
  11.     eprintf("usage: %s [string ...]\n", argv0);
  12. }
  13.  
  14. int
  15. main(int argc, char *argv[])
  16. {
  17.     char **p;
  18.  
  19.     ARGBEGIN {
  20.     default:
  21.         usage();
  22.     } ARGEND
  23.  
  24.     p = argv;
  25.   char *buf = malloc(BUFSIZE);
  26.   int bufu = 0;
  27.   while (bufu < BUFSIZE) {
  28.       memcpy(buf+bufu, *p ? *p : "y\n", 2);
  29.       bufu += 2;
  30.   }
  31.   while(write(1, buf, BUFSIZE));
  32.  
  33.     return 1; /* not reached */
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement