home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmmac.zip / SLNOHOST.E < prev    next >
Text File  |  1995-10-03  |  3KB  |  117 lines

  1. /****************************************/
  2. /*            SLNoHost.E                */
  3. /*  procedures for file saving/loading  */
  4. /*                                      */
  5. /*              WITHOUT                 */
  6. /*         host file support            */
  7. /*         (saves about 1K)             */
  8. /****************************************/
  9.  
  10. defproc loadfile(files,options)
  11.    'xcom e 'options files
  12.  
  13. defproc savefile(name)
  14.    src = check_for_printer(name)        -- Returns 0 or printer number.
  15.    if src then                          -- If a printer (i.e., non-zero),
  16.       if not printer_ready(src) then    -- and it's not ready,
  17.          call messageNwait(PRINTER_NOT_READY__MSG'  'PRESS_A_KEY__MSG)
  18.          return 1
  19.       endif
  20.    else                                 -- Not a printer:
  21. compile if EVERSION >= '5.50'  --@HPFS
  22.       name_same = (name = .filename)
  23.       if pos(' ',name) & leftstr(name,1)<>'"' then
  24.          name = '"'name'"'
  25.       endif
  26. compile endif
  27.       -- jbl 1/89 new feature.  Editors in the real marketplace keep at least
  28.       -- one backup copy when a file is written.
  29. compile if BACKUP_PATH
  30.  compile if EVERSION >= '4.10'    -- OS/2 - redirect STDOUT & STDERR
  31.       quietshell 'copy' name MakeBakName() '1>nul 2>nul'
  32.  compile else
  33.       quietshell 'copy' name MakeBakName() '>nul'
  34.  compile endif
  35. compile endif
  36.    endif
  37.    'xcom s 'arg(2) name; src=rc
  38. compile if EVERSION >= '5.50'  --@HPFS
  39.    if not rc and name_same then
  40. compile else
  41.    if not rc and name=.filename then
  42. compile endif
  43.       .modify=0
  44.       'deleteautosavefile'
  45.    endif
  46.    return src
  47.  
  48. defproc namefile()
  49.    newname=arg(1)
  50.    if parse_filename(newname,.filename) then
  51.       sayerror INVALID_FILENAME__MSG
  52.    else
  53. compile if EVERSION >= '5.50'  --@HPFS
  54.       if pos(' ',newname) & leftstr(newname,1)<>'"' then
  55.          newname = '"'newname'"'
  56.       endif
  57. compile endif
  58.       'xcom n 'newname
  59.    endif
  60.  
  61. defproc quitfile()
  62. compile if EVERSION < 5
  63.    k='Y'
  64.    if .windowoverlap then
  65.       modify=(.modify and .views=1)
  66.    else
  67.       modify=.modify
  68.    endif
  69.    if modify then
  70.  compile if SMARTQUIT
  71.       call message(QUIT_PROMPT1__MSG '('FILEKEY')')
  72.  compile else
  73.       call message(QUIT_PROMPT2__MSG)
  74.  compile endif
  75.       loop
  76.          k=upcase(getkey())
  77.  compile if SMARTQUIT
  78.          if k=$FILEKEY then 'File'; return 1              endif
  79.  compile endif
  80.          if k=YES_CHAR or k=NO_CHAR or k=esc then leave            endif
  81.       endloop
  82.       call message(1)
  83.    endif
  84.    if k<>YES_CHAR then
  85.       return 1
  86.    endif
  87.    if not .windowoverlap or .views=1 then
  88.      .modify=0
  89.    endif
  90. compile endif
  91.  
  92.    'deleteautosavefile'
  93. compile if EVERSION < 5
  94.    if .windowoverlap then
  95.       quitview
  96.    else
  97.       'xcom q'
  98.    endif
  99. compile else
  100.    'xcom q'
  101. compile endif
  102.  
  103. defproc filetype()
  104.    fileid=arg(1)
  105.    if fileid='' then fileid=.filename  endif
  106.    if substr(fileid, 1, 5)=='.DOS ' then
  107.       return ''
  108.    endif
  109.    i=lastpos('\',fileid)
  110.    if i then
  111.       fileid=substr(fileid,i+1)
  112.    endif
  113.    i=lastpos('.',fileid)
  114.    if i then
  115.       return upcase(substr(fileid,i+1))
  116.    endif
  117.