      subroutine edit (ili,iol)                                         EDIT001
c ----------------------------------------------------------------------EDIT002
c     line editor for input files SEXIE.DBF                             EDIT003
c ----------------------------------------------------------------------EDIT004
c     This program module is part of the PhysiSoft X-ray Library        EDIT005
c     and may not be sold or reproduced for commercial purposes.        EDIT006
c     Although it has been tested carefully, there is no warranty       EDIT007
c     regarding accuracy or freedom from side-effects.                  EDIT008
c                   (C) 1986-1990 Bernhard Rupp                         EDIT009
c ----------------------------------------------------------------------EDIT010
                                                                        EDIT011
      parameter (iat=20)                                                EDIT012
      character answ, ili*60                                            EDIT013
      dimension ili(iat+5)                                              EDIT014
      ipr=6                                                             EDIT015
                                                                        EDIT016
 7007 write (ipr,'(/a$)')'  Edit (E) any line, or delete (D) or add (A) EDIT017
     &an atom line : '                                                  EDIT018
      call inkey(answ)                                                  EDIT019
      if (answ.eq.'A') then                                             EDIT020
         write(ipr,'(a)')'  Enter the new atom line below the last line EDIT021
     &played now : '                                                    EDIT022
         iol=iol+1                                                      EDIT023
         if (iol.gt.(iat+5)) then                                       EDIT024
            write (ipr,*)' You are entering too mant atom lines ',      EDIT025
     &      '- recompile with larger IAT - see manual'                  EDIT026
            return                                                      EDIT027
         end if                                                         EDIT028
         write (ipr,'(1x,a)') ili(iol-1)                                EDIT029
         read(*,'(a60)') ili(iol)                                       EDIT030
         return                                                         EDIT031
      elseif (answ.eq.'D') then                                         EDIT032
         write(ipr,'(a$)')'  Number of line to delete : '               EDIT033
         read(*,*,err=7007) idel                                        EDIT034
         if (idel.gt.(iol-1)) then                                      EDIT035
            write(ipr,'(a,i2,a/)')'  There are no more than ',iol-1,    EDIT036
     &      ' lines ....'                                               EDIT037
            write(ipr,'(a)') '  Hit enter to return to input display'   EDIT038
            call inkey (answ)                                           EDIT039
            return                                                      EDIT040
         end if                                                         EDIT041
         do 0001 i=idel+1,iol-1                                         EDIT042
            ili(i)=ili(i+1)                                             EDIT043
 0001    continue                                                       EDIT044
         iol=iol-1                                                      EDIT045
         return                                                         EDIT046
      elseif (answ.eq.'E') then                                         EDIT047
         write(ipr,'(a$)')'  Number of line to edit : '                 EDIT048
         read(*,*,err=7007) il                                          EDIT049
         if (il.gt.(iol-1)) then                                        EDIT050
            write(ipr,'(a,i2,a)')'  There are no more than ',iol-1,     EDIT051
     &      ' lines .... '                                              EDIT052
            write(ipr,'(a)') '  Hit enter to return to input display'   EDIT053
            call inkey (answ)                                           EDIT054
            return                                                      EDIT055
         end if                                                         EDIT056
         write(ipr,'(a)')      '  Enter complete new line below the old EDIT057
     &line displayed now : '                                            EDIT058
         write (ipr,'(1x,a)') ili(il+1)                                 EDIT059
         read (*,'(a60)') ili(il+1)                                     EDIT060
         return                                                         EDIT061
      else                                                              EDIT062
         write(ipr,'(a)')'  Grr....'                                    EDIT063
      end if                                                            EDIT064
      return                                                            EDIT065
      end                                                               EDIT066
