Subroutine WRVAL for program GSAS2CIF

This subroutine is used to write a CIF data item to file. Subroutine ADDQUOTE is used to add quotation marks (if any are needed). Note that this routine does not break lines, so it should not be passed values that are more than 78 characters. See the gsas2cif documentation for an explanation of this code.

link to documentation
      SUBROUTINE wrval(IUCIF,lbl,value)
      INTEGER*4     IUCIF               
      CHARACTER*(*) LBL,VALUE           
      CHARACTER*80  VALUE2              
      INTEGER*4     LN1,LN2             
      ln1 = max(1,LENCH(lbl))
      CALL ADDQUOTE(value,value2,ln2)
      IF (ln2 .le. 40) then
        write (IUCIF,'(a,t40,a)') lbl(:ln1),value2(:ln2)
      ELSEIF (ln2 .le. 60) then
        write (IUCIF,'(a,/,t20,a)') lbl(:ln1),value2(:ln2)
      ELSEIF (ln2 .le. 75) then
        write (IUCIF,'(a,/,t5,a)') lbl(:ln1),value2(:ln2)
      ELSE
        IF (ln2 .le. 79) write (*,*) 
     1    'Error -- value for ',lbl(:ln1),' is too long!'
        write (IUCIF,'(a,/,1x,a)') lbl(:ln1),value2(:ln2)
      END IF
      RETURN
      END