This is the code in question.  any help would be appreciated.  Is my I/O 
not buffered here or what else am I missing?

thanks,
Jim

(defclass File-Follower ()
  ((Filename   :accessor Filename :initarg :Filename)
   (FileStream :accessor FileStream :initform ())
   (Inode      :accessor Inode :initform ())
   (offset     :accessor offset :initform ())
   ))

(defmethod get-line ((ff file-follower))
  "Return the next line of this file.  We refuse to read eof.  When we 
have reached end of the file, we check to see if there is a new inode 
associated with our filename. if there is, we start following that 
filename."
  (or
   (and 
                                        ;we're at the end of the file
    (not (eq (file-length (FileStream ff))
       (file-position (FileStream ff))))
   (read-line (filestream ff) ()))
   ;; eof, possibly with new file
   (or 
    ; there is a new file to look at
    (and 
     (probe-file (Filename ff))
     (let ((stat-inode (multiple-value-bind (ok dev ino)
                           (unix:unix-stat (filename ff))
                         (declare (ignore ok dev))
                         ino)))
       (if
        (eq (Inode ff) stat-inode)
        ()
        (progn
          (format t "starting new file follower~%")
          (read-line (start-file-follower ff) ()))))))))


(defmethod get-logline ((ff file-follower))
  (let ((line (get-line ff)))
    (and line
         (make-instance 'message :message (get-line ff)))))


On 29 Apr 2004, Christopher C. Stacy wrote:

> Post the code.
> 

-- 
James E. Prewett                 "everything that is, that was, was not enough"
Systems Team Leader                                                505.277.8210
Designated Security Officer                [EMAIL PROTECTED] [EMAIL PROTECTED]
HPC Systems Engineer III @ [EMAIL PROTECTED]             OpenPGP key: pub  
1024D/31816D93



  • I/O Jim Prewett
    • Jim Prewett

Reply via email to