Subroutine ADDQUOTE for program GSAS2CIF

This subroutine is used to surround an ASCII string with quotes, when needed. See the gsas2cif documentation for an explanation of this code.

link to documentation
      SUBROUTINE addquote(lbl,lbl1,ln)
      CHARACTER*(*) LBL,LBL1            
      INTEGER*4     LN                  
      INTEGER*4     I,J                 
      ln = LENCH(lbl)
      j = 1
C remove initial blanks
      do while (lbl(j:j) .eq. ' ' .and. j .le. ln)
        j = j + 1
      END DO
      lbl1 = lbl(j:)
      ln = LENCH(lbl1)
C is there a blank in the string?
      i = J
      do while (lbl(I:I) .ne. ' ')
        i = i + 1
        if (i .gt. ln+J-1) return ! no
      END DO
C yes
      lbl1 = '"'//lbl(J:ln+J-1)//'"'
      ln = ln + 2
      RETURN
      END