FPTED R4.0 By Fernando J. G. Pereira FPTED is a, easy to use, text editor, that allows the user to do almost all of the most used features in other text editors. It isn't as powerful as "vi", or "emacs", but I think, it's easy to use, its runtime version is very small (in disk space), it lets you do almost everything you usually do in other editors, and lots of other things like using a mouse or performing word completion. Its main characteristics are: 1 - Its user friendly (at least that's what I think...). 2 - It lets you edit several (up to 20) text files at the same time. 3 - You can cut & paste between files, and you can recover deleted text, even after you exit and return to the editor. 4 - You can redefine keys (define macros). 5 - You can repeat sequences of key commands. 6 - It has "search and replace", with individual confirmations. 7 - It has abbreviation substitutions (performed with TAB). 8 - You can create definition files that could be read each time the editor is called (using one environment variable). 9 - It has online help. 10- It has MOUSE SUPPORT, word wrap and word completion. 11- It has autoindent and parenthesis match (useful when writing programs). 12 -It doesn't create tmp files, like other editors do, so if the system goes down, you may loose all changes you've made since the last time you save. To minimize this problem, the editor catches a lot of signals (SIGDANGER,SIGPWR,SIGHUP,SIGTERM etc) and saves a copy of each changed file. Also, this editor was designed to be portable between different architectures, so it's very easy to port a wide range of machines. To make it portable, the default key bindings use almost only alphabetic keys, but, as you can redefine keys, this shouldn't be a big problem... This program was written in traditional C, using the curses library and some portable UNIX features (like signals, etc.). To create a runtime version of this editor you must start by extracting this articles from the newsgroup and execute the shell archives. sh sh When this is finished, you can make a runtime version using make and selecting the desired makefile (or changing one of the existing ones). Attention: This makefile will attempt to send a mail message to me, so that I can make a list of users. From times to times I intend to send to those people a file containing all the patches needed to remove bugs found meanwhile. The makefile will automatically erase the "mail" code from itself in the first time you compile FPTED successfully, after the message is sent. make or make -f Makefile If your system does not have the SIGNAL UNIX system call, then you should remove the flag -DUNIX from the compiler line in the respective makefile. Also, if you are not using terminals with VT like key code sequences (starting with "["), then you should remove the flag -DVT_TERM. If you are running a system V machine and your curses lib parses a lot of function and other keys, then you wouldn't need the flag VT_TERM. There are several important compilation flags: 1 - QUICK_SCROLL enables a multi-line scroll mode. This mode can be useful when your terminal normal scroll is very slow. This option is the default in BSD systems. If you don't like jump scrolls you should disable it, removing the compilation flag in BSD.make. 2 - STATUS_LINE enables a status line with the name of the file currently edited and the key used to access the menu. If you disable it, the editor will perform faster when displaying error messages. 3 - MOUSE_SUPPORT lets you use the mouse keys to locate text in the editor when using a xterm. You can still use the standard X clipboard using the shift key. This option works only if the option -DVT_TERM is enabled. 4 - SMART_INDENT automatically erases all the spaces and tabs in the lines left blanc when auto-indenting with . 5 - POSIX_IO - Supports POSIX multilanguage input (only available if you system has a include file called /usr/include/locale.h ). This is not a default flag: If you want to use it, you should insert the flag -DPOSIX_IO into the compilation line of the makefile. To use this feature you should define all the necessary locale environment variables. Although the editor supports 8 bit characters. 6 - DISABLE_SHELL_ESCAPES - Will disable the user to access the shell. 7 - AVOID_FRAGMENTATION - Avoid dynamic memory fragmentation. In this mode fpted will only alloc memory blocks with sizes that are a multiple of a certain value ( in fact: n * BLOCK_SIZE -1 ). The default BLOCK_SIZE is 4 bytes, but you can set it to 8 or 16, changing fpted.h before compiling. With this option enabled memory allocation will perform faster, and memory fragmentation can be avoided, beacuse freed blocks will soon be reused. On the other side, there will be a statistically constant rate of unused memory, since fpted will only alloc memory blocks with sizes multiple of BLOCK_SIZE. In order to minimize this problem, BLOCK_SIZE was set to a small value (4 bytes), but if your system's memory allocation is slow you can set a bigger value. 8 - USE_LAST_COLUMN: Some curses implementations get confused when a program draws text in the last column of the screen/window. If your curses doesn't have this particular bug, you can enable the flag -DUSE_LAST_COLUMN to enable the use of the last column. If your system has more than one version of curses (as it is the case in ULTRIX), you can change the name of the include files in fpted.c and change the respective names in the makefile... If your curses library doesn't have some functions like keypad(), scrollok() and idlok(), you should edit fpted.c and remove, or comment, the lines where these functions appear [these lines are documented]. After installing the runtime version, before you start using this editor you should define the following environment variables: FPTED_HELP is the path to the help file: FPTED will search for a file named fpted_help in the directory where it was compiled. If you want to use a different file or directory, you should define the environment variable FPTED_HELP. If you are using a csh, do as follows: setenv FPTED_HELP `pwd`/fpted_help ( if you are in a different directory, instead of `pwd`, you should specify a complete path ) FPTED_CLIPFILE is the file where the clipboard is saved when you exit the editor. If you want to use a file named fpted_clip inside a directory named tmp in your home directory do as follows: mkdir ~/tmp setenv FPTED_CLIPFILE ~/tmp/fpted_clip FPTED_DEFS is the definitions file that is automatically readded each time you run this editor: setenv FPTED_DEFS ~/.fpted_defs This file can be created with this editor (saving the definitions created interactively), or you can copy one of the sample files in this directory: c_fpted_defs - Key and abbreviations useful for C programmers. vt_fpted_defs - Key definitions for VT200 like terminals. (Defines DO, HELP, INSERT, DELETE, PREV-SCREEN, ...). As one example, if you want to use a VT200, you should do as follows: cp vt_fpted_defs ~/.fpted_defs If you like this program you should also put all of the environment definition in your .chsrc or .profile. If you don't like the use of ESCaped keys (timeout, etc.) you can redefine other key (using ^K^V) to access the menu. Then you just have to save the definition in a file using the "s" command in command line mode. ********** IMPORTANT NOTE ********** I intend this program to be FREE software, that is: you can distribute it, but you shouldn't use it for selling... So, you are free to use this application, and you can distribute any number of copies, as long as this notice will appear in every copy. Also, I DENY any responsibility for any kind of possible problems caused by this application (That means, if something unexpected goes wrong, you are at your own...). ************* I hope you enjoy. Fernando Pereira 18/Feb/92 Lisboa - Portugal fjp@minerva.inesc.pt