Greetings,
While reading the source code for ed, I noticed a small stylistic
inconsistency in main.c whereby "isatty(0)" is called followed by a
series of calls to functions that take a fd being called with
STDIN_FILENO. Although this has little impact on readability, and
should make no difference in effect, for the purpose of stylistic
consistency I scanned the tree for similar calls, and composed a series
of diffs.
As this would be my first patch, any feedback is appreciated.
Thanks!
165c165
< if (!(interactive = isatty(0))) {
---
> if (!(interactive = isatty(STDIN_FILENO))) {
43c43
< if (isatty(0))
---
> if (isatty(STDIN_FILENO))
45c45
< else if (isatty(2))
---
> else if (isatty(STDERR_FILENO))
352c352
< if (isatty(0) && isatty(2)) {
---
> if (isatty(STDIN_FILENO) && isatty(STDERR_FILENO)) {
354c354
< /* The following only if isatty(0) */
---
> /* The following only if isatty(STDIN_FILENO) */
365c365
< if (fstat(0, &s_stdin) >= 0 && S_ISCHR(s_stdin.st_mode) &&
---
> if (fstat(STDIN_FILENO, &s_stdin) >= 0 && S_ISCHR(s_stdin.st_mode) &&
152c152
< if (!isatty(0)) /* don't let non-tty's play */
---
> if (!isatty(STDIN_FILENO)) /* don't let non-tty's play */
109c109
< if (isatty(0) == 0 || argc || Nflag)
---
> if (isatty(STDIN_FILENO) == 0 || argc || Nflag)
353c353
< HX((e = fstat(0, &st)) == -1, st);
---
> HX((e = fstat(STDIN_FILENO, &st)) == -1, st);
358c358
< HX(fstatvfs(0, &stvfs) == -1,
---
> HX(fstatvfs(STDIN_FILENO, &stvfs) == -1,
360c360
< HX((off = lseek(0, (off_t)0,
---
> HX((off = lseek(STDIN_FILENO, (off_t)0,
455c455
< HX((e = fstat(0, &st)) == -1, st);
---
> HX((e = fstat(STDIN_FILENO, &st)) == -1, st);
460c460
< HX(fstatvfs(0, &stvfs) == -1,
---
> HX(fstatvfs(STDIN_FILENO, &stvfs) == -1,
462c462
< HX(fstatfs(0, &stfs) == -1,
---
> HX(fstatfs(STDIN_FILENO, &stfs) == -1,
464c464
< HX((off = lseek(0, (off_t)0,
---
> HX((off = lseek(STDIN_FILENO, (off_t)0,
347c347
< HX((e = fstat(0, &st)) == -1, st);
---
> HX((e = fstat(STDIN_FILENO, &st)) == -1, st);
352c352
< HX(fstatvfs(0, &stvfs) == -1,
---
> HX(fstatvfs(STDIN_FILENO, &stvfs) == -1,
354c354
< HX((off = lseek(0, (off_t)0,
---
> HX((off = lseek(STDIN_FILENO, (off_t)0,
365c365
< HX((e = fstat(0, &st)) == -1, st);
---
> HX((e = fstat(STDIN_FILENO, &st)) == -1, st);
370c370
< HX(fstatvfs(0, &stvfs) == -1,
---
> HX(fstatvfs(STDIN_FILENO, &stvfs) == -1,
372c372
< HX(fstatfs(0, &stfs) == -1,
---
> HX(fstatfs(STDIN_FILENO, &stfs) == -1,
374c374
< HX((off = lseek(0, (off_t)0,
---
> HX((off = lseek(STDIN_FILENO, (off_t)0,