home *** CD-ROM | disk | FTP | other *** search
/ Shareware 1 2 the Maxx / sw_1.zip / sw_1 / EDITORS / TDE20.ZIP / CFGMACRO.C < prev    next >
C/C++ Source or Header  |  1992-06-05  |  2KB  |  87 lines

  1. /*
  2.  * This module contains all the routines needed to save an existing macro
  3.  * definition file in tde.exe
  4.  *
  5.  * Program Name:  tdecfg
  6.  * Author:        Frank Davis
  7.  * Date:          October 5, 1991
  8.  */
  9.  
  10. #include <io.h>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <string.h>
  14.  
  15. #include "tdecfg.h"
  16. #include "cfgmacro.h"
  17.  
  18. extern struct vcfg cfg;
  19. extern FILE *tde_exe;                  /* FILE pointer to tde.exe */
  20.  
  21. static WINDOW *w_ptr;
  22.  
  23. MACRO macros;
  24.  
  25. /********    EXTREMELY IMPORTANT   ************/
  26. /*
  27.  * If you modify tde, it is your responsibility to find the offset of
  28.  * the macro buffer in your new executable, tde.exe.
  29.  *
  30.  */
  31.  
  32.  
  33.  
  34. /*
  35.  * Name:    tdehelp
  36.  * Date:    October 1, 1991
  37.  * Notes:   Set up most of the window global variables.
  38.  */
  39. void tdemacro( void )
  40. {
  41. int c;
  42. int i;
  43. char line[200];
  44. char out_line[82];
  45. char fname[82];
  46. char *rc;
  47. FILE *macro_file;                  /* FILE pointer to macro */
  48. long offset;
  49.  
  50.  
  51.    cls( );
  52.    show_box( 0, 0, macro_screen, NORMAL );
  53.    xygoto( 42, 14 );
  54.    c = getkey( );
  55.    while (c != '1' && c != '2')
  56.       c = getkey( );
  57.    if (c == '1') {
  58.       puts( "" );
  59.       puts( "" );
  60.       puts( "" );
  61.       puts( "Enter file name that contains the macro definitions :" );
  62.       gets( fname );
  63.       if ((c = access( fname, EXIST )) != 0) {
  64.          puts( "\nFile not found.  Press any key to continue." );
  65.          c = getkey( );
  66.          cls( );
  67.          return;
  68.       } else if ((macro_file = fopen( fname, "rb" )) == NULL ) {
  69.          puts( "\nCannot open macro file.  Press any key to contine." );
  70.          c = getkey( );
  71.          cls( );
  72.          return;
  73.       }
  74.  
  75.       fread( (void *)¯os, sizeof(MACRO), 1, macro_file );
  76.       fseek( tde_exe, MACRO_OFFSET, SEEK_SET );
  77.       fwrite( (void *)¯os, sizeof(MACRO), 1, tde_exe );
  78.       fclose( macro_file );
  79.       puts( "" );
  80.       puts( "" );
  81.       puts( "" );
  82.       puts( "New macros successfully installed.  Press any key to continue." );
  83.       c = getkey( );
  84.    }
  85.    cls( );
  86. }
  87.