home *** CD-ROM | disk | FTP | other *** search
- /* ==( help/edit.c )== */
- /* ----------------------------------------------- */
- /* Pro-C Copyright (C) 1988 - 1990 Vestronix Inc. */
- /* Modification to this source is not supported */
- /* by Vestronix Inc. */
- /* All Rights Reserved */
- /* ----------------------------------------------- */
- /* Written JPK 26-Sep-88 */
- /* Modified SBF 1-Mar-90 See comments below */
- /* ----------------------------------------------- */
- /* %W% (%H% %T%) */
-
- /*
- * Modifications
- *
- * 1-Mar-90 SBF - multi-user and cleanup
- * 12-Dec-89 Geo - V2 version with variable lines
- * 25-Oct-89 Geo - 1.32 Merge
- *
- *
- */
-
- /*
- * Routines in this file :
- *
- * static void get_editor(void);
- * prompts the user for their choice of editors
- *
- * int invoke_editor(void);
- * copies the help text into the edit file, invokes the editor
- *
- */
-
- # include <stdio.h>
- # include <bench.h>
- # include "field.h"
- # include "help.h"
-
- # ifdef ANSI
- static void get_editor(void);
- # else
- static void get_editor();
- # endif
-
-
- /*
- * TurboC turns PHXXXXXX into PHAA.AAA, therefore
- * we cannot append .txt because the file name becomes
- * jibberish.
- */
- int invoke_editor()
- {
- char editfile[20];
-
- strcpy(editfile, "PHXXXXXX");
- mktemp(editfile);
- #ifndef __TURBOC__
- strcat(editfile, ".txt");
- #endif
-
- /* invoke the editor chosen by the user passing it the filename to use*/
- if (*editorname == '\0')
- {
- get_editor();
- if (*editorname == '\0')
- return(FALSE);
- }
- if (helptofile(editfile) == FALSE)
- {
- #ifdef HDEBUG
- errmsg("invoke_editor(): helptofile failed");
- #endif
- unlink(editfile);
- return(FALSE);
- }
-
- resetscr();
- if (do_cmd(editorname, editfile, NULL) == -1)
- {
- # ifdef HDEBUG
- perror("Error from editor call");
- getchar();
- # endif
- redraws();
- unlink(editfile);
- return(FALSE);
- }
-
- if (filetohelp(editfile) == FALSE)
- errmsg("invoke_editor(): filetohelp failed");
-
- unlink(editfile);
-
- redraws();
- return(TRUE);
- }
-
- char editorname_mask[] = "BVVVVVVVVV";
-
- FIELD f_editorname =
- {
- 5, 9, 1, editorname, editorname_mask, 1,
- 10, F_TEXT, UNDERLINED, REVVID,
- CONFIRM_NEEDED | NO_BLANK,
- NULL, text_input, NULL, NULL
- };
-
- static void get_editor()
- {
- /* setup the editor input window */
- create_w(9, 30, 7, 20);
- border_w(0, BOLD);
- underln_w(3, 1, BOLD, 20);
- disp_w(2, 2, REVVID, " Editor Selection ");
- disp_w(5, 3, NORMAL, "Name: ");
-
- /* get editor name */
- input_wx(&f_editorname, K_ESC, 0);
-
- delete_w();
- }
-
-