home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume1 / 8710 / 14 / pflemv.f < prev    next >
Encoding:
Text File  |  1990-07-13  |  1.6 KB  |  60 lines

  1.     subroutine pflemv (newfle)
  2. c **** Subroutine to rename the ps_plot file.
  3. c ---- newfile = new name for file. ----
  4.  
  5. c Graig McHendrie, USGS, Feb 6, 1985 - original for Houston plotter
  6. c Rex Sanders, USGS, February 1987 - modified for PostScript printers
  7.  
  8.     external system,getyna
  9.     integer system
  10.     logical lans,lmvit
  11.     character newfle*(*), tcmd*48, mcmd*48, gpif*32
  12.         character*8 pflenm
  13.  
  14.         pflenm = 'ps_plot'
  15.  
  16. c ---- Build commands for test and move operations. ----
  17.     tcmd = 'test -s ' // newfle
  18.     mcmd = 'mv ' // pflenm // newfle
  19.     lmvit = .false.
  20.  
  21. c ---- Perform test command on new name.  If file doesn't exist,
  22. c ---- 'icde' will be 1 and it is ok to rename h_plot.
  23.     icde = system (tcmd)
  24.     if (icde .ne. 0) then
  25.       lmvit = .true.
  26. c ---- File already exists. ----
  27.     else
  28.       write(*,100) newfle, pflenm
  29. 100      format(/' ',a, ' already exists.'/
  30.      &' Renaming ''',a,''' to this name will destroy the old version.'/
  31.      &    ' Is that acceptable  (y/n)  ?'$)
  32.       call getyna(lans)
  33. c ---- Find out if user wants to overwrite the existing file. ----
  34.       if (lans) then
  35.         lmvit = .true.
  36.       else
  37.         gpif = pflenm
  38.       end if
  39.     end if
  40.     
  41. c ---- It's ok to rename h_plot to newfile. ----
  42.     if (lmvit) then
  43.       icde = system (mcmd)
  44.       if (icde .ne. 0) then
  45.         write(*,90) mcmd,icde
  46. 90        format(' There was a system problem with the command:'/
  47.      &      ' ',a/
  48.      &      ' The error return code was ',i5)
  49.         gpif = pflenm
  50.       else
  51.         gpif = newfle
  52.       end if
  53.     end if
  54.  
  55. c ---- Write to standard_output the final name of the plot file. ----
  56.     write(*,120) gpif
  57. 120    format(/' The plot file from this run is: ',a)
  58.     return
  59.     end
  60.