[BACK]Return to grep.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / mg

Diff for /src/usr.bin/mg/grep.c between version 1.45 and 1.46

version 1.45, 2017/10/12 14:12:00 version 1.46, 2018/01/09 17:59:29
Line 4 
Line 4 
   
 #include <sys/queue.h>  #include <sys/queue.h>
 #include <sys/types.h>  #include <sys/types.h>
   #include <sys/wait.h>
   
 #include <ctype.h>  #include <ctype.h>
 #include <libgen.h>  #include <libgen.h>
 #include <limits.h>  #include <limits.h>
Line 180 
Line 182 
         char    *buf;          char    *buf;
         size_t   sz;          size_t   sz;
         ssize_t  len;          ssize_t  len;
         int      ret, n;          int      ret, n, status;
         char     cwd[NFILEN], qcmd[NFILEN];          char     cwd[NFILEN], qcmd[NFILEN];
         char     timestr[NTIME];          char     timestr[NTIME];
         time_t   t;          time_t   t;
Line 226 
Line 228 
         t = time(NULL);          t = time(NULL);
         strftime(timestr, sizeof(timestr), "%a %b %e %T %Y", localtime(&t));          strftime(timestr, sizeof(timestr), "%a %b %e %T %Y", localtime(&t));
         addline(bp, "");          addline(bp, "");
         if (ret != 0)          if (WIFEXITED(ret)) {
                 addlinef(bp, "Command exited abnormally with code %d"                  status = WEXITSTATUS(ret);
                     " at %s", ret, timestr);                  if (status == 0)
         else                          addlinef(bp, "Command finished at %s", timestr);
                 addlinef(bp, "Command finished at %s", timestr);                  else
                           addlinef(bp, "Command exited abnormally with code %d "
                               "at %s", status, timestr);
           } else
                   addlinef(bp, "Subshell killed by signal %d at %s",
                       WTERMSIG(ret), timestr);
   
         bp->b_dotp = bfirstlp(bp);          bp->b_dotp = bfirstlp(bp);
         bp->b_modes[0] = name_mode("fundamental");          bp->b_modes[0] = name_mode("fundamental");

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46