home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmsmp.zip / TAGLINE.E < prev    next >
Text File  |  1995-08-08  |  1KB  |  53 lines

  1. /* Tagline.e - a routine for adding a tagline to a note or append. */
  2.  
  3. compile if not defined(SMALL)  -- Being compiled separately?
  4.  
  5.    tryinclude 'mycnf.e'
  6.  
  7.    defmain
  8.       'tagline' arg(1)
  9.  
  10. compile endif
  11.  
  12. const
  13. compile if not defined(my_TAGLINE_COUNTER)
  14.    my_TAGLINE_COUNTER = 'd:\doc\tagline.cnt'
  15. compile endif
  16. compile if not defined(my_TAGLINE_FILE)
  17.    my_TAGLINE_FILE = 'd:\doc\taglines'
  18. compile endif
  19.  
  20. defc tagline =
  21.    getfileid startfid
  22.    'e' my_TAGLINE_FILE
  23.    if rc=sayerror('New file') then
  24.       'q'
  25.       sayerror 'Tagline file' my_TAGLINE_FILE 'does not exist.'
  26.       return
  27.    elseif rc then
  28.       sayerror 'Error' rc 'editing tagline file' my_TAGLINE_FILE '-' sayerrortext(rc)
  29.       return
  30.    endif
  31.    getfileid taglinefid
  32.    'e' my_TAGLINE_COUNTER
  33.    if rc=sayerror('New file') then
  34.       line_num = 0
  35.    elseif rc then
  36.       sayerror 'Error' rc 'editing tagline counter' my_TAGLINE_COUNTER '-' sayerrortext(rc)
  37.       return
  38.    else
  39.       getline line_num, 1
  40.    endif
  41.    line_num = line_num + 1
  42.    if line_num > taglinefid.last then
  43.       line_num = 1
  44.    endif
  45.    replaceline line_num, 1
  46.    'file /q'
  47.    activatefile taglinefid
  48.    tagline = textline(line_num)
  49.    'quit'
  50.    activatefile startfid
  51.    insertline '*EPM*' tagline, .last+1
  52.  
  53.