Rev | Line | |
---|
[9] | 1 | /*
|
---|
| 2 | * The line command. Reads one line from the standard input and writes it
|
---|
| 3 | * to the standard output.
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) 1989 by Kenneth Almquist. All rights reserved.
|
---|
| 6 | * This file is part of ash, which is distributed under the terms specified
|
---|
| 7 | * by the Ash General Public License. See the file named LICENSE.
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | #define main linecmd
|
---|
| 11 |
|
---|
| 12 | #include "bltin.h"
|
---|
| 13 |
|
---|
| 14 |
|
---|
| 15 | main(argc, argv) char **argv; {
|
---|
| 16 | char c;
|
---|
| 17 |
|
---|
| 18 | for (;;) {
|
---|
| 19 | if (read(0, &c, 1) != 1) {
|
---|
| 20 | putchar('\n');
|
---|
| 21 | return 1;
|
---|
| 22 | }
|
---|
| 23 | putchar(c);
|
---|
| 24 | if (c == '\n')
|
---|
| 25 | return 0;
|
---|
| 26 | }
|
---|
| 27 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.