NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: bin/41758



The following reply was made to PR bin/41758; it has been noted by GNATS.

From: Christopher Berardi <cberardi%natoufa.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: bin/41758
Date: Fri, 19 Feb 2010 20:47:20 -0500

 This patch makes it so that if it is a file that is in error, it says so. It 
should be noted that this patch (nor the PR) addresses an issue that even if 
the file (or stdin) is empty of commands, if there is a space or newline or 
similar type characters, it will still go through.
 
 
 
 --- at.c.orig  2010-02-19 20:24:31.000000000 -0500
 +++ at.c       2010-02-19 20:30:57.000000000 -0500
 @@ -88,6 +88,7 @@
  char *atinput = NULL;         /* where to get input from */
  unsigned char atqueue = 0;    /* which queue to examine for jobs (atq) */
  char atverify = 0;            /* verify time instead of queuing job */
 +int is_file = 0;              /* is the input coming from file or stdin */
  
  /* Function declarations */
  
 @@ -386,8 +387,12 @@
            "\t exit 1\n"
            "}\n");
  
 -      if ((ch = getchar()) == EOF)
 -              panic("Input error");
 +      if ((ch = getchar()) == EOF) {
 +              if (is_file)
 +                      panic("Input file is empty");
 +              else
 +                      panic("Input error");
 +      }
  
        do {
                (void)fputc(ch, fp);
 @@ -617,6 +622,7 @@
  
                case 'f':
                        atinput = optarg;
 +                      is_file = 1;
                        break;
  
                case 'q':       /* specify queue */
 
 
 
 -- 
 Christopher Berardi
 http://www.natoufa.com/
 
 Be still, and know that I am God (Psalms 46:10)
 


Home | Main Index | Thread Index | Old Index