source:
trunk/minix/commands/simple/yes.c@
15
Last change on this file since 15 was 9, checked in by , 14 years ago | |
---|---|
File size: 374 bytes |
Line | |
---|---|
1 | /* yes 1.4 - print 'y' or argv[1] continuously. Author: Kees J. Bot |
2 | * 15 Apr 1989 |
3 | */ |
4 | #include <sys/types.h> |
5 | #include <stdlib.h> |
6 | #include <string.h> |
7 | #include <unistd.h> |
8 | |
9 | int main(int argc, char **argv) |
10 | { |
11 | char *yes; |
12 | static char y[] = "y"; |
13 | int n; |
14 | |
15 | yes= argc == 1 ? y : argv[1]; |
16 | |
17 | n= strlen(yes); |
18 | |
19 | yes[n++]= '\n'; |
20 | |
21 | while (write(1, yes, n) != -1) {} |
22 | exit(1); |
23 | } |
Note:
See TracBrowser
for help on using the repository browser.