On 1/3/19 11:08 AM, [email protected] wrote:
> Alright, these ones get rid of is_stdin altogether. Isn't it better this
> way? 
> 
Looks OK to me, anyone else want to OK this?

martijn@

>        --zeurkous.
> 
> Index: src/usr.bin/tail/extern.h
> ===================================================================
> RCS file: /cvs/src/usr.bin/tail/extern.h,v
> retrieving revision 1.12
> diff -u -p -r1.12 extern.h
> --- src/usr.bin/tail/extern.h 19 Nov 2015 17:50:04 -0000      1.12
> +++ src/usr.bin/tail/extern.h 3 Jan 2019 10:00:59 -0000
> @@ -55,4 +55,3 @@ void oerr(void);
>  void printfname(const char *);
>  
>  extern int fflag, rflag, rval;
> -extern int is_stdin;
> 
> Index: src/usr.bin/tail/forward.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/tail/forward.c,v
> retrieving revision 1.31
> diff -u -p -r1.31 forward.c
> --- src/usr.bin/tail/forward.c        5 Jul 2016 05:06:27 -0000       1.31
> +++ src/usr.bin/tail/forward.c        3 Jan 2019 10:00:59 -0000
> @@ -335,7 +335,8 @@ tfreopen(struct tailfile *tf) {
>       struct tailfile                 **treopen, *ttf;
>       int                               i;
>  
> -     if (tf && ((stat(tf->fname, &sb) != 0) || sb.st_ino != tf->sb.st_ino)) {
> +     if (tf && !(tf->fp == stdin) &&
> +         ((stat(tf->fname, &sb) != 0) || sb.st_ino != tf->sb.st_ino)) {
>               if (afiles < ++nfiles) {
>                       afiles += AFILESINCR;
>                       treopen = reallocarray(reopen, afiles, sizeof(*reopen));
> 
> Index: src/usr.bin/tail/tail.c
> ===================================================================
> RCS file: /cvs/src/usr.bin/tail/tail.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 tail.c
> --- src/usr.bin/tail/tail.c   3 Feb 2016 12:23:57 -0000       1.21
> +++ src/usr.bin/tail/tail.c   3 Jan 2019 10:00:59 -0000
> @@ -45,7 +45,6 @@
>  #include "extern.h"
>  
>  int fflag, rflag, rval;
> -int is_stdin;
>  
>  static void obsolete(char **);
>  static void usage(void);
> @@ -173,7 +172,6 @@ main(int argc, char *argv[])
>  
>               tf[0].fname = "stdin";
>               tf[0].fp = stdin;
> -             is_stdin = 1;
>  
>               if (fstat(fileno(stdin), &(tf[0].sb))) {
>                       ierr(tf[0].fname);
> 

Reply via email to