home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / the25.zip / thesrc251.zip / commset1.c < prev    next >
C/C++ Source or Header  |  1998-06-08  |  142KB  |  4,869 lines

  1. /***********************************************************************/
  2. /* COMMSET1.C - SET commands A-N                                       */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991-1997 Mark Hessling
  7.  *
  8.  * This program is free software; you can redistribute it and/or
  9.  * modify it under the terms of the GNU General Public License as
  10.  * published by the Free Software Foundation; either version 2 of
  11.  * the License, or any later version.
  12.  *
  13.  * This program is distributed in the hope that it will be useful,
  14.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16.  * General Public License for more details.
  17.  *
  18.  * You should have received a copy of the GNU General Public License
  19.  * along with this program; if not, write to:
  20.  *
  21.  *    The Free Software Foundation, Inc.
  22.  *    675 Mass Ave,
  23.  *    Cambridge, MA 02139 USA.
  24.  *
  25.  *
  26.  * If you make modifications to this software that you feel increases
  27.  * it usefulness for the rest of the community, please email the
  28.  * changes, enhancements, bug fixes as well as any and all ideas to me.
  29.  * This software is going to be maintained and enhanced as deemed
  30.  * necessary by the community.
  31.  *
  32.  * Mark Hessling                 Email:             M.Hessling@qut.edu.au
  33.  * PO Box 203                    Phone:                    +617 3802 0800
  34.  * Bellara                       http://www.gu.edu.au/gext/the/markh.html
  35.  * QLD 4507                      **** Maintainer PDCurses & REXX/SQL ****
  36.  * Australia                     ************* Author of THE ************
  37.  */
  38.  
  39. /*
  40. $Id: commset1.c 2.1 1995/06/24 16:29:05 MH Rel MH $
  41. */
  42.  
  43. #include <the.h>
  44. #include <proto.h>
  45.  
  46. /*#define DEBUG 1*/
  47. /*man-start*********************************************************************
  48.  
  49.  
  50. ========================================================================
  51. SET COMMAND REFERENCE
  52. ========================================================================
  53. **man-end**********************************************************************/
  54.  
  55. /*man-start*********************************************************************
  56. COMMAND
  57.      set alt - change alteration counts
  58.  
  59. SYNTAX
  60.      [SET] ALT [n] [m]
  61.  
  62. DESCRIPTION
  63.      The SET ALT command allows the user to change the alteration counts.
  64.      This command is usually called from within a macro.
  65.  
  66.      The first number; 'n' sets the number of changes since the last
  67.      AUTOSAVE was issued.
  68.  
  69.      The second number; 'm' sets the number of changes since the last
  70.      SAVE or SSAVE command was issued.
  71.  
  72. COMPATIBILITY
  73.      XEDIT: Compatible.
  74.      KEDIT: Compatible.
  75.  
  76. DEFAULT
  77.      OFF
  78.  
  79. STATUS
  80.      Complete.
  81. **man-end**********************************************************************/
  82. #ifdef HAVE_PROTO
  83. short Alt(CHARTYPE *params)
  84. #else
  85. short Alt(params)
  86. CHARTYPE *params;
  87. #endif
  88. /***********************************************************************/
  89. {
  90. /*------------------------- external data -----------------------------*/
  91. /*--------------------------- local data ------------------------------*/
  92. #define ALT_PARAMS  2
  93.  CHARTYPE strip[ALT_PARAMS];
  94.  CHARTYPE *word[ALT_PARAMS+1];
  95.  unsigned short num_params=0;
  96.  unsigned short autosave_alt=CURRENT_FILE->autosave_alt;
  97.  unsigned short save_alt=CURRENT_FILE->save_alt;
  98. /*--------------------------- processing ------------------------------*/
  99. #ifdef TRACE
  100.  trace_function("commset1.c:Alt");
  101. #endif
  102.  strip[0]=STRIP_BOTH;
  103.  num_params = param_split(params,word,ALT_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  104.  if (num_params == 0)
  105.    {
  106.     display_error(3,(CHARTYPE *)"",FALSE);
  107. #ifdef TRACE
  108.     trace_return();
  109. #endif
  110.     return(RC_INVALID_OPERAND);
  111.    }
  112.  if (num_params > 2)
  113.    {
  114.     display_error(2,(CHARTYPE *)"",FALSE);
  115. #ifdef TRACE
  116.     trace_return();
  117. #endif
  118.     return(RC_INVALID_OPERAND);
  119.    }
  120.  if (!valid_positive_integer(word[0]))
  121.    {
  122.     display_error(1,word[0],FALSE);
  123. #ifdef TRACE
  124.     trace_return();
  125. #endif
  126.     return(RC_INVALID_OPERAND);
  127.    }
  128.  autosave_alt = atoi((DEFCHAR *)word[0]);
  129.  
  130.  if (num_params == 2)
  131.    {
  132.     if (!valid_positive_integer(word[1]))
  133.       {
  134.        display_error(1,word[1],FALSE);
  135. #ifdef TRACE
  136.        trace_return();
  137. #endif
  138.        return(RC_INVALID_OPERAND);
  139.       }
  140.     save_alt = atoi((DEFCHAR *)word[1]);
  141.    }
  142.  
  143.  CURRENT_FILE->autosave_alt = autosave_alt;
  144.  CURRENT_FILE->save_alt = save_alt;
  145.  
  146. #ifdef TRACE
  147.  trace_return();
  148. #endif
  149.  return(RC_OK);
  150. }
  151. /*man-start*********************************************************************
  152. COMMAND
  153.      set arbchar - set arbitrary character(s) for targets
  154.  
  155. SYNTAX
  156.      [SET] ARBchar ON|OFF [char1] [char2]
  157.  
  158. DESCRIPTION
  159.      Set the character to use as an 'arbitrary character' in string
  160.      targets. The first arbitrary character matches a group of zero
  161.      or more characters, the second will match exactly one character.
  162.  
  163. COMPATIBILITY
  164.      XEDIT: Compatible.
  165.             Single arbitrary character not supported.
  166.      KEDIT: Compatible.
  167.  
  168. DEFAULT
  169.      Off $ ?
  170.  
  171. STATUS
  172.      Complete.
  173. **man-end**********************************************************************/
  174. #ifdef HAVE_PROTO
  175. short Arbchar(CHARTYPE *params)
  176. #else
  177. short Arbchar(params)
  178. CHARTYPE *params;
  179. #endif
  180. /***********************************************************************/
  181. {
  182. /*------------------------- external data -----------------------------*/
  183. /*--------------------------- local data ------------------------------*/
  184. #define ARB_PARAMS  4
  185.  CHARTYPE *word[ARB_PARAMS+1];
  186.  CHARTYPE strip[ARB_PARAMS];
  187.  unsigned short num_params=0;
  188.  short rc=RC_INVALID_OPERAND;
  189.  bool arbsts=CURRENT_VIEW->arbchar_status;
  190.  CHARTYPE arbchr_single=CURRENT_VIEW->arbchar_single;
  191.  CHARTYPE arbchr_multiple=CURRENT_VIEW->arbchar_multiple;
  192. /*--------------------------- processing ------------------------------*/
  193. #ifdef TRACE
  194.  trace_function("commset1.c:Arbchar");
  195. #endif
  196. /*---------------------------------------------------------------------*/
  197. /* Validate the parameters that have been supplied.                    */
  198. /*---------------------------------------------------------------------*/
  199.  strip[0]=STRIP_BOTH;
  200.  strip[1]=STRIP_BOTH;
  201.  strip[2]=STRIP_BOTH;
  202.  strip[3]=STRIP_BOTH;
  203.  num_params = param_split(params,word,ARB_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  204.  switch(num_params)
  205.    {
  206. /*---------------------------------------------------------------------*/
  207. /* No parameters, error.                                               */
  208. /*---------------------------------------------------------------------*/
  209.     case 0: 
  210.          display_error(3,(CHARTYPE *)"",FALSE); 
  211.          break;
  212. /*---------------------------------------------------------------------*/
  213. /* 1 or 2 parameters, validate them...                                 */
  214. /*---------------------------------------------------------------------*/
  215.     case 1: 
  216.          rc = execute_set_on_off(word[0],&arbsts);
  217.          break;
  218.     case 2: 
  219.     case 3:
  220.          rc = execute_set_on_off(word[0],&arbsts);
  221.          if (rc != RC_OK)
  222.             break;
  223.          rc = RC_INVALID_OPERAND;
  224. /*---------------------------------------------------------------------*/
  225. /* For 2 parameters, check that a single character has been supplied...*/
  226. /*---------------------------------------------------------------------*/
  227.          if (strlen((DEFCHAR *)word[1]) != 1)
  228.            {
  229.             display_error(1,word[1],FALSE);
  230.             break;
  231.            }
  232.          arbchr_multiple = word[1][0];
  233.          rc = RC_OK;
  234. /*---------------------------------------------------------------------*/
  235. /* For 2 parameters, don't check any more.                             */
  236. /*---------------------------------------------------------------------*/
  237.          if (num_params == 2)
  238.             break;
  239.          rc = RC_INVALID_OPERAND;
  240. /*---------------------------------------------------------------------*/
  241. /* For 3 parameters, check that a single character has been supplied...*/
  242. /*---------------------------------------------------------------------*/
  243.          if (strlen((DEFCHAR *)word[2]) != 1)
  244.            {
  245.             display_error(1,word[2],FALSE);
  246.             break;
  247.            }
  248.          arbchr_single = word[2][0];
  249.          rc = RC_OK;
  250.          break;
  251. /*---------------------------------------------------------------------*/
  252. /* Too many parameters...                                              */
  253. /*---------------------------------------------------------------------*/
  254.     default:
  255.          display_error(2,(CHARTYPE *)"",FALSE); 
  256.          break;
  257.    }
  258. /*---------------------------------------------------------------------*/
  259. /* If valid parameters, change the settings...                         */
  260. /*---------------------------------------------------------------------*/
  261.  if (rc == RC_OK)
  262.    {
  263.     CURRENT_VIEW->arbchar_single = arbchr_single;
  264.     CURRENT_VIEW->arbchar_multiple = arbchr_multiple;
  265.     CURRENT_VIEW->arbchar_status = arbsts;
  266.    }
  267. #ifdef TRACE
  268.  trace_return();
  269. #endif
  270.  return(rc);
  271. }
  272. /*man-start*********************************************************************
  273. COMMAND
  274.      set autosave - set autosave period
  275.  
  276. SYNTAX
  277.      [SET] AUtosave n|OFF
  278.  
  279. DESCRIPTION
  280.      The SET AUTOSAVE command sets the interval between automatic saves
  281.      of the file, or turns it off altogether.  The interval 'n' refers
  282.      to the number of alterations made to the file.  Hence a value of
  283.      10 for 'n' would result in the file being automatically saved after
  284.      each 10 alterations have been made to the file.
  285.  
  286.      It is not possible to set AUTOSAVE for 'psuedo' files such as the
  287.      directory listing 'file', REXX output 'file' and the key definitions 
  288.      'file'
  289.  
  290. COMPATIBILITY
  291.      XEDIT: Does not support [mode] option.
  292.      KEDIT: Compatible.
  293.  
  294. DEFAULT
  295.      OFF
  296.  
  297. STATUS
  298.      Complete.
  299. **man-end**********************************************************************/
  300. #ifdef HAVE_PROTO
  301. short Autosave(CHARTYPE *params)
  302. #else
  303. short Autosave(params)
  304. CHARTYPE *params;
  305. #endif
  306. /***********************************************************************/
  307. {
  308. /*------------------------- external data -----------------------------*/
  309. /*--------------------------- local data ------------------------------*/
  310. #define AUS_PARAMS  1
  311.  CHARTYPE strip[AUS_PARAMS];
  312.  CHARTYPE *word[AUS_PARAMS+1];
  313.  unsigned short num_params=0;
  314. /*--------------------------- processing ------------------------------*/
  315. #ifdef TRACE
  316.  trace_function("commset1.c:Autosave");
  317. #endif
  318.  strip[0]=STRIP_BOTH;
  319.  num_params = param_split(params,word,AUS_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  320.  if (num_params == 0)
  321.    {
  322.     display_error(3,(CHARTYPE *)"",FALSE);
  323. #ifdef TRACE
  324.     trace_return();
  325. #endif
  326.     return(RC_INVALID_OPERAND);
  327.    }
  328.  if (num_params != 1)
  329.    {
  330.     display_error(2,(CHARTYPE *)"",FALSE);
  331. #ifdef TRACE
  332.     trace_return();
  333. #endif
  334.     return(RC_INVALID_OPERAND);
  335.    }
  336.  if (equal((CHARTYPE *)"off",word[0],3))
  337.    {
  338.     CURRENT_FILE->autosave = 0;
  339. #ifdef TRACE
  340.     trace_return();
  341. #endif
  342.     return(RC_OK);
  343.    }
  344.  if (!valid_positive_integer(word[0]))
  345.    {
  346.     display_error(4,(CHARTYPE *)word[0],FALSE);
  347. #ifdef TRACE
  348.     trace_return();
  349. #endif
  350.     return(RC_INVALID_OPERAND);
  351.    }
  352.  CURRENT_FILE->autosave = (CHARTYPE)atoi((DEFCHAR *)word[0]);
  353.  return(RC_OK);
  354. }
  355. /*man-start*********************************************************************
  356. COMMAND
  357.      set backup - indicate if a backup copy of the file is to be kept
  358.  
  359. SYNTAX
  360.      [SET] BACKup OFF|TEMP|KEEP|ON
  361.  
  362. DESCRIPTION
  363.      The SET BACKUP command allows the user to determine if a backup copy
  364.      of the original file is to be kept when the file being edited is
  365.      saved or filed.
  366.  
  367.      'KEEP' and 'ON' options are the same. 'ON' is
  368.      kept for compatability with previous versions of THE.
  369.  
  370.      With 'OFF', the file being written to disk will replace an
  371.      existing file. There is a chance that you will end up with neither
  372.      the old version of the file or the new one if problems occur
  373.      while the file is being written.
  374.  
  375.      With 'TEMP' or 'KEEP' options, the file being written is first 
  376.      renamed to the filename with a .bak extension. The file in memory 
  377.      is then written to disk. If 'TEMP' is in effect, the backup
  378.      file is then deleted.
  379.  
  380. COMPATIBILITY
  381.      XEDIT: N/A
  382.      KEDIT: Compatible.
  383.  
  384. DEFAULT
  385.      KEEP
  386.  
  387. SEE ALSO
  388.      <FILE>, <FFILE>, <SAVE>, <SSAVE>
  389.  
  390. STATUS
  391.      Complete.
  392. **man-end**********************************************************************/
  393. #ifdef HAVE_PROTO
  394. short Backup(CHARTYPE *params)
  395. #else
  396. short Backup(params)
  397. CHARTYPE *params;
  398. #endif
  399. /***********************************************************************/
  400. {
  401. /*------------------------- external data -----------------------------*/
  402. /*--------------------------- local data ------------------------------*/
  403.  short rc=RC_OK;
  404.  short backup_type=0;
  405. /*--------------------------- processing ------------------------------*/
  406. #ifdef TRACE
  407.  trace_function("commset1.c:Backup");
  408. #endif
  409.  if (equal((CHARTYPE *)"off",params,3))
  410.     backup_type = BACKUP_OFF;
  411.  if (equal((CHARTYPE *)"on",params,2))
  412.     backup_type = BACKUP_ON;
  413.  if (equal((CHARTYPE *)"keep",params,4))
  414.     backup_type = BACKUP_KEEP;
  415.  if (equal((CHARTYPE *)"temp",params,4))
  416.     backup_type = BACKUP_TEMP;
  417.  if (backup_type == 0)
  418.    {
  419.     display_error(1,params,FALSE);
  420. #ifdef TRACE
  421.     trace_return();
  422. #endif
  423.     return(RC_INVALID_OPERAND);
  424.    }
  425.  CURRENT_FILE->backup = backup_type;
  426. #ifdef TRACE
  427.  trace_return();
  428. #endif
  429.  return(rc);
  430. }
  431. /*man-start*********************************************************************
  432. COMMAND
  433.      set beep - turn on or off the audible alarm when displaying errors
  434.  
  435. SYNTAX
  436.      [SET] BEEP ON|OFF
  437.  
  438. DESCRIPTION
  439.      The SET BEEP command allows the user to determine if an audible 
  440.      alarm is sounded when an error is displayed.
  441.  
  442. COMPATIBILITY
  443.      XEDIT: N/A
  444.      KEDIT: Compatible.
  445.  
  446. DEFAULT
  447.      OFF
  448.  
  449. STATUS
  450.      Complete.
  451. **man-end**********************************************************************/
  452. #ifdef HAVE_PROTO
  453. short BeepSound(CHARTYPE *params)
  454. #else
  455. short BeepSound(params)
  456. CHARTYPE *params;
  457. #endif
  458. /***********************************************************************/
  459. {
  460. /*-------------------------- external data ----------------------------*/
  461.  extern bool BEEPx;
  462. /*--------------------------- local data ------------------------------*/
  463.  short rc=RC_OK;
  464. /*--------------------------- processing ------------------------------*/
  465. #ifdef TRACE
  466.  trace_function("commset1.c:BeepSound");
  467. #endif
  468.  rc = execute_set_on_off(params,&BEEPx);
  469. #ifdef TRACE
  470.  trace_return();
  471. #endif
  472.  return(rc);
  473. }
  474. /*man-start*********************************************************************
  475. COMMAND
  476.      set case - set case sensitivity parameters
  477.  
  478. SYNTAX
  479.      [SET] CASE Mixed|Lower|Upper [Respect|Ignore] [Respect|Ignore] [Respect|Ignore]
  480.  
  481. DESCRIPTION
  482.      The CASE command sets the editor's handling of the case of text.
  483.  
  484.      The first option (which is mandatory) controls how text is entered
  485.      by the user. When 'LOWER' or 'UPPER' are in effect, the shift or caps
  486.      lock keys have no effect on the text being entered. When 'MIXED' is
  487.      in effect, text is entered in the case set by the use of the shift
  488.      and caps lock keys.
  489.  
  490.      The second option determines how the editor determines if a string
  491.      target matches text in the file when the target is used in a <LOCATE>
  492.      command.  With 'IGNORE' in effect, a match is
  493.      found irrespective of the case of the target or the found text.
  494.      The following strings are treated as equivalent: the THE The ThE...
  495.      With 'RESPECT' in effect, the target and text must be the same case.
  496.      Therefore a target of 'The' only matches text containing 'The', not
  497.      'THE' or 'ThE' etc.
  498.  
  499.      The third option determines how the editor determines if a string
  500.      target matches text in the file when the target is used in a <CHANGE>
  501.      command.  With 'IGNORE' in effect, a match is
  502.      found irrespective of the case of the target or the found text.
  503.      The following strings are treated as equivalent: the THE The ThE...
  504.      With 'RESPECT' in effect, the target and text must be the same case.
  505.      Therefore a target of 'The' only matches text containing 'The', not
  506.      'THE' or 'ThE' etc.
  507.  
  508.      The fourth option determines how the editor determines the sort 
  509.      order of upper and lower case with the <SORT> command.
  510.      With 'IGNORE' in effect, upper and lower case letters are treated as
  511.      equivalent.
  512.      With 'RESPECT' in effect, upper and lower case letters are treated as
  513.      different values and uppercase characters will sort before lowercase
  514.      characters.
  515.  
  516. COMPATIBILITY
  517.      XEDIT: Adds support for case significance in CHANGE commands.
  518.      KEDIT: Adds support for LOWER option.
  519.      Both:  Adds support for case significance in SORT command.
  520.  
  521. DEFAULT
  522.      Mixed Ignore Respect Respect
  523.  
  524. STATUS
  525.      Complete
  526. **man-end**********************************************************************/
  527. #ifdef HAVE_PROTO
  528. short Case(CHARTYPE *params)
  529. #else
  530. short Case(params)
  531. CHARTYPE *params;
  532. #endif
  533. /***********************************************************************/
  534. {
  535. /*------------------------- external data -----------------------------*/
  536. /*--------------------------- local data ------------------------------*/
  537. #define CAS_PARAMS  4
  538.  CHARTYPE parm[CAS_PARAMS];
  539.  CHARTYPE *word[CAS_PARAMS+1];
  540.  CHARTYPE strip[CAS_PARAMS];
  541.  register short i=0;
  542.  short num_params=0;
  543. /*--------------------------- processing ------------------------------*/
  544. #ifdef TRACE
  545.  trace_function("commset1.c:Case");
  546. #endif
  547.  strip[0]=STRIP_BOTH;
  548.  strip[1]=STRIP_BOTH;
  549.  strip[2]=STRIP_BOTH;
  550.  strip[3]=STRIP_BOTH;
  551.  num_params = param_split(params,word,CAS_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  552. /*---------------------------------------------------------------------*/
  553. /* Validate the first parameter: must be Mixed, Upper or Lower         */
  554. /*---------------------------------------------------------------------*/
  555.  parm[0] = (CHARTYPE)UNDEFINED_OPERAND;
  556.  if (equal((CHARTYPE *)"mixed",word[0],1))
  557.     parm[0] = CASE_MIXED;
  558.  if (equal((CHARTYPE *)"upper",word[0],1))
  559.     parm[0] = CASE_UPPER;
  560.  if (equal((CHARTYPE *)"lower",word[0],1))
  561.     parm[0] = CASE_LOWER;
  562.  if (parm[0] == (CHARTYPE)UNDEFINED_OPERAND)
  563.     {
  564.      display_error(1,(CHARTYPE *)word[0],FALSE);
  565. #ifdef TRACE
  566.      trace_return();
  567. #endif
  568.      return(RC_INVALID_OPERAND);
  569.     }
  570. /*---------------------------------------------------------------------*/
  571. /* Save the current values of each remaining case setting.             */
  572. /*---------------------------------------------------------------------*/
  573.  parm[1] = CURRENT_VIEW->case_locate;
  574.  parm[2] = CURRENT_VIEW->case_change;
  575.  parm[3] = CURRENT_VIEW->case_sort;
  576. /*---------------------------------------------------------------------*/
  577. /* Validate the remainder of the arguments.                            */
  578. /* Each must be Respect or Ignore, if present.                         */
  579. /*---------------------------------------------------------------------*/
  580.  for (i=1;i<num_params;i++)
  581.    {
  582.     if (strcmp((DEFCHAR *)word[1],"") != 0)
  583.       {
  584.        if (equal((CHARTYPE *)"respect",word[i],1))
  585.           parm[i] = CASE_RESPECT;
  586.        else
  587.           if (equal((CHARTYPE *)"ignore",word[i],1))
  588.              parm[i] = CASE_IGNORE;
  589.           else
  590.             {
  591.              display_error(1,(CHARTYPE *)word[i],FALSE);
  592. #ifdef TRACE
  593.              trace_return();
  594. #endif
  595.              return(RC_INVALID_OPERAND);
  596.             }
  597.       }
  598.    }
  599. /*---------------------------------------------------------------------*/
  600. /* Set the new values of case settings for the view.                   */
  601. /*---------------------------------------------------------------------*/
  602.  CURRENT_VIEW->case_enter  = parm[0];
  603.  CURRENT_VIEW->case_locate = parm[1];
  604.  CURRENT_VIEW->case_change = parm[2];
  605.  CURRENT_VIEW->case_sort   = parm[3];
  606.  
  607. #ifdef TRACE
  608.  trace_return();
  609. #endif
  610.  return(RC_OK);
  611. }
  612. /*man-start*********************************************************************
  613. COMMAND
  614.      set clearscreen - indicate if the screen is to be cleared on exit
  615.  
  616. SYNTAX
  617.      [SET] CLEARScreen ON|OFF
  618.  
  619. DESCRIPTION
  620.      The SET CLEARSCREEN command allows the user to request that the
  621.      screen be cleared on exit from THE.
  622.  
  623. COMPATIBILITY
  624.      XEDIT: N/A
  625.      KEDIT: N/A
  626.  
  627. DEFAULT
  628.      OFF
  629.  
  630. STATUS
  631.      Complete
  632. **man-end**********************************************************************/
  633. #ifdef HAVE_PROTO
  634. short Clearscreen(CHARTYPE *params)
  635. #else
  636. short Clearscreen(params)
  637. CHARTYPE *params;
  638. #endif
  639. /***********************************************************************/
  640. {
  641. /*-------------------------- external data ----------------------------*/
  642.  extern bool CLEARSCREENx;
  643. /*--------------------------- local data ------------------------------*/
  644.  short rc=RC_OK;
  645. /*--------------------------- processing ------------------------------*/
  646. #ifdef TRACE
  647.  trace_function("commset1.c:Clearscreen");
  648. #endif
  649.  rc = execute_set_on_off(params,&CLEARSCREENx);
  650. #ifdef TRACE
  651.  trace_return();
  652. #endif
  653.  return(rc);
  654. }
  655. /*man-start*********************************************************************
  656. COMMAND
  657.      set clock - turn on or off display of time on status line
  658.  
  659. SYNTAX
  660.      [SET] CLOCK ON|OFF
  661.  
  662. DESCRIPTION
  663.      The SET CLOCK command turns on or off the display of the time on the
  664.      <status line>.
  665.  
  666. COMPATIBILITY
  667.      XEDIT: N/A
  668.      KEDIT: Compatible.
  669.  
  670. DEFAULT
  671.      ON
  672.  
  673. STATUS
  674.      Complete
  675. **man-end**********************************************************************/
  676. #ifdef HAVE_PROTO
  677. short Clock(CHARTYPE *params)
  678. #else
  679. short Clock(params)
  680. CHARTYPE *params;
  681. #endif
  682. /***********************************************************************/
  683. {
  684. /*-------------------------- external data ----------------------------*/
  685.  extern bool CLOCKx;
  686.  extern bool curses_started;
  687. /*--------------------------- local data ------------------------------*/
  688.  short rc=RC_OK;
  689. /*--------------------------- processing ------------------------------*/
  690. #ifdef TRACE
  691.  trace_function("commset1.c:Clock");
  692. #endif
  693.  rc = execute_set_on_off(params,&CLOCKx);
  694.  if (rc == RC_OK
  695.  &&  curses_started)
  696.     clear_statarea();
  697. #ifdef TRACE
  698.  trace_return();
  699. #endif
  700.  return(rc);
  701. }
  702. /*man-start*********************************************************************
  703. COMMAND
  704.      set cmdarrows - sets the behaviour of the up and down arrow keys
  705.  
  706. SYNTAX
  707.      [SET] CMDArrows Retrieve|Tab 
  708.  
  709. DESCRIPTION
  710.      The SET CMDARROWS command determines the action that occurs when the
  711.      up and down arrows keys are hit while on the <command line>.
  712.  
  713.      'RETRIEVE' will set the up and down arrows to retrieve the last or 
  714.      next command entered on the <command line>.
  715.  
  716.      'TAB' will set the up and down arrows to move to the last
  717.      or first line respectively of the main window.
  718.  
  719. COMPATIBILITY
  720.      XEDIT: N/A
  721.      KEDIT: N/A
  722.  
  723. DEFAULT
  724.      RETRIEVE
  725.  
  726. SEE ALSO
  727.      <CURSOR>, <?>
  728.  
  729. STATUS
  730.      Complete.
  731. **man-end**********************************************************************/
  732. #ifdef HAVE_PROTO
  733. short Cmdarrows(CHARTYPE *params)
  734. #else
  735. short Cmdarrows(params)
  736. CHARTYPE *params;
  737. #endif
  738. /***********************************************************************/
  739. {
  740. /*------------------------- external data -----------------------------*/
  741.  extern CHARTYPE CMDARROWSTABCMDx;
  742. /*--------------------------- local data ------------------------------*/
  743.  short rc=RC_OK;
  744. /*--------------------------- processing ------------------------------*/
  745. #ifdef TRACE
  746.  trace_function("commset1.c:Cmdarrows");
  747. #endif
  748. /*---------------------------------------------------------------------*/
  749. /* Determine values for first parameter; command line behaviour        */
  750. /*---------------------------------------------------------------------*/
  751.  if (equal((CHARTYPE *)"tab",params,1))
  752.     CMDARROWSTABCMDx = TRUE;
  753.  else
  754.    if (equal((CHARTYPE *)"retrieve",params,1))
  755.       CMDARROWSTABCMDx = FALSE;
  756.    else
  757.      {
  758.       display_error(1,params,FALSE);
  759.       rc = RC_INVALID_OPERAND;
  760.      }
  761. #ifdef TRACE
  762.  trace_return();
  763. #endif
  764.  return(rc);
  765. }
  766. /*man-start*********************************************************************
  767. COMMAND
  768.      set cmdline - sets the position of the command line.
  769.  
  770. SYNTAX
  771.      [SET] CMDline ON|OFF|Top|Bottom
  772.  
  773. DESCRIPTION
  774.      The SET CMDLINE command sets the position of the <command line>, 
  775.      either at the top of the screen, the bottom of the screen or off.
  776.  
  777. COMPATIBILITY
  778.      XEDIT: Compatible.
  779.             CMDLINE ON is equivalent to CMDLINE Bottom
  780.      KEDIT: Compatible. 
  781.  
  782. DEFAULT
  783.      BOTTOM
  784.  
  785. STATUS
  786.      Complete.
  787. **man-end**********************************************************************/
  788. #ifdef HAVE_PROTO
  789. short Cmdline(CHARTYPE *params)
  790. #else
  791. short Cmdline(params)
  792. CHARTYPE *params;
  793. #endif
  794. /***********************************************************************/
  795. {
  796. /*------------------------- external data -----------------------------*/
  797.  extern bool curses_started;
  798. /*--------------------------- local data ------------------------------*/
  799.  CHARTYPE cmd_place='?';
  800.  short off=0;
  801.  short rc=RC_OK;
  802. /*--------------------------- processing ------------------------------*/
  803. #ifdef TRACE
  804.  trace_function("commset1.c:Cmdline");
  805. #endif
  806.  if (equal((CHARTYPE *)"top",params,1))
  807.    {
  808.     cmd_place='T';
  809.     off = 1;
  810.    }
  811.  if (equal((CHARTYPE *)"bottom",params,1)
  812.  ||  equal((CHARTYPE *)"on",params,2))
  813.    {
  814.     cmd_place='B';
  815.     off = (-1);
  816.    }
  817.  if (equal((CHARTYPE *)"off",params,3))
  818.    {
  819.     cmd_place='O';
  820.     off = 0;
  821.    }
  822.  if (cmd_place=='?')
  823.    {
  824.     display_error(1,(CHARTYPE *)params,FALSE);
  825. #ifdef TRACE
  826.     trace_return();
  827. #endif
  828.     return(RC_INVALID_OPERAND);
  829.    }
  830. /*---------------------------------------------------------------------*/
  831. /* If the setting supplied is the same as the current setting, just    */
  832. /* return without doing anything.                                      */
  833. /*---------------------------------------------------------------------*/
  834.  if (cmd_place == CURRENT_VIEW->cmd_line)
  835.    {
  836. #ifdef TRACE
  837.     trace_return();
  838. #endif
  839.     return(RC_OK);
  840.    }
  841. /*---------------------------------------------------------------------*/
  842. /* Now we need to move the windows around.                             */
  843. /*---------------------------------------------------------------------*/
  844.  CURRENT_VIEW->cmd_line = cmd_place;
  845. /*---------------------------------------------------------------------*/
  846. /* Rebuild the windows and display...                                  */
  847. /*---------------------------------------------------------------------*/
  848.  set_screen_defaults();
  849.  if (curses_started)
  850.    {
  851.     if (set_up_windows(current_screen) != RC_OK)
  852.       {
  853. #ifdef TRACE
  854.        trace_return();
  855. #endif
  856.        return(rc);
  857.       }
  858.    }
  859.  if (CURRENT_VIEW->cmd_line == 'O')
  860.     CURRENT_VIEW->current_window = WINDOW_FILEAREA;
  861.  build_screen(current_screen);
  862.  if (curses_started)
  863.     display_screen(current_screen);
  864.  
  865. #ifdef TRACE
  866.  trace_return();
  867. #endif
  868.  return(rc);
  869. }
  870. /*man-start*********************************************************************
  871. COMMAND
  872.      set colour - set colours for display
  873.  
  874. SYNTAX
  875.      [SET] COLOUR area [modifier[...]] [foreground] [on] [background]
  876.      [SET] COLOR  area [modifier[...]] [foreground] [on] [background]
  877.  
  878. DESCRIPTION
  879.      The SET COLOUR command changes the colours or display attributes of
  880.      various display areas in THE.
  881.  
  882.      Valid values for 'area':
  883.  
  884.           Arrow      - command line prompt
  885.           Block      - marked <block>
  886.           CBlock     - <current line> if in marked <block>
  887.           CHIghlight - highlighted line if the same as <current line>
  888.           Cmdline    - <command line>
  889.           CTofeof    - as for TOfeof if the same as <current line>
  890.           CUrline    - the <current line>
  891.           Divider    - dividing line between vertical split screens
  892.           Filearea   - area containing file lines
  893.           GAP        - the gap between the <prefix area> and <filearea>
  894.           HIghlight  - highlighted line
  895.           Idline     - line containing file specific info
  896.           Msgline    - error messages
  897.           Nondisp    - Non-display characters (<SET ETMODE> OFF)
  898.           Pending    - pending commands in <prefix area>
  899.           PRefix     - <prefix area>
  900.           Reserved   - default for <reserved line>
  901.           Scale      - line showing <scale line>
  902.           SHadow     - hidden line marker lines
  903.           SLK        - soft label keys
  904.           STatarea   - line showing status of editing session
  905.           Tabline    - line showing tab positions
  906.           TOfeof     - <Top-of-File line> and <Bottom-of-File line>
  907.  
  908.      Valid values for 'foreground' and 'background':
  909.  
  910.           BLAck
  911.           BLUe
  912.           Brown
  913.           Green
  914.           GRAy
  915.           GREy
  916.           Cyan
  917.           RED
  918.           Magenta
  919.           Pink
  920.           Turquoise
  921.           Yellow
  922.           White
  923.  
  924.      Valid values for 'modifier':
  925.  
  926.           NORmal
  927.           BLInk
  928.           BOld
  929.           BRIght
  930.           High
  931.           REVerse
  932.           Underline
  933.  
  934.      It is an error to attempt to set a colour on a mono display.
  935.  
  936. COMPATIBILITY
  937.      XEDIT: Functionally compatible. See below.
  938.      KEDIT: Functionally compatible. See below.
  939.      Does not implement all modifiers.
  940.  
  941. DEFAULT
  942.      Depends on compatibility mode setting and monitor type.
  943.  
  944. SEE ALSO
  945.      <SET COMPAT>
  946.  
  947. STATUS  
  948.      Complete.
  949. **man-end**********************************************************************/
  950. #ifdef HAVE_PROTO
  951. short Colour(CHARTYPE *params)
  952. #else
  953. short Colour(params)
  954. CHARTYPE *params;
  955. #endif
  956.  
  957. /***********************************************************************/
  958. {
  959. /*-------------------------- external data ----------------------------*/
  960.  extern WINDOW *statarea;
  961.  extern WINDOW *divider;
  962.  extern bool curses_started;
  963.  extern bool horizontal;
  964.  extern bool SLKx;
  965.  extern CHARTYPE display_screens;
  966.  extern chtype etmode_table[256];
  967.  extern bool   etmode_flag[256];
  968.  extern AREAS valid_areas[ATTR_MAX];
  969. /*--------------------------- local data ------------------------------*/
  970. #define COL_PARAMS 2
  971.  CHARTYPE *word[COL_PARAMS+1];
  972.  CHARTYPE strip[COL_PARAMS];
  973.  CHARTYPE parm[COL_PARAMS];
  974.  register short i=0;
  975.  unsigned short num_params=0;
  976.  short area=0;
  977.  COLOUR_ATTR attr;
  978.  CHARTYPE *dummy=NULL;
  979.  bool any_colours=FALSE;
  980.  chtype ch=0L,nondisp_attr=0L;
  981. /*--------------------------- processing ------------------------------*/
  982. #ifdef TRACE
  983.  trace_function("commset1.c:Colour");
  984. #endif
  985.  strip[0]=STRIP_BOTH;
  986.  strip[1]=STRIP_BOTH;
  987.  num_params = param_split(params,word,COL_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  988.  if (num_params < 2 )
  989.     {
  990.      display_error(3,(CHARTYPE *)"",FALSE);
  991. #ifdef TRACE
  992.      trace_return();
  993. #endif
  994.      return(RC_INVALID_OPERAND);
  995.     }
  996. /*---------------------------------------------------------------------*/
  997. /* Check that the supplied area matches one of the values in the area  */
  998. /* array and that the length is at least as long as the minimum.       */
  999. /*---------------------------------------------------------------------*/
  1000.  parm[0] = FALSE;
  1001.  for (i=0;i<ATTR_MAX;i++)
  1002.     {
  1003.      if (equal(valid_areas[i].area,word[0],valid_areas[i].area_min_len))
  1004.        {
  1005.         parm[0] = TRUE;
  1006.         area = i;
  1007.         break;
  1008.        }
  1009.     }
  1010.  if (parm[0] == FALSE)
  1011.     {
  1012.      display_error(1,(CHARTYPE *)word[0],FALSE);
  1013. #ifdef TRACE
  1014.      trace_return();
  1015. #endif
  1016.      return(RC_INVALID_OPERAND);
  1017.     }
  1018.  memcpy(&attr,CURRENT_FILE->attr+area,sizeof(COLOUR_ATTR));
  1019. /*---------------------------------------------------------------------*/
  1020. /* Determine colours and modifiers.                                    */
  1021. /*---------------------------------------------------------------------*/
  1022.  if (parse_colours(word[1],&attr,&dummy,FALSE,&any_colours) != RC_OK)
  1023.    {
  1024. #ifdef TRACE
  1025.     trace_return();
  1026. #endif
  1027.     return(RC_INVALID_OPERAND);
  1028.    }
  1029. /*---------------------------------------------------------------------*/
  1030. /* Special handling required for NONDISP...                            */
  1031. /*---------------------------------------------------------------------*/
  1032.  if (equal("NONDISP",word[0],1))
  1033.    {
  1034.     nondisp_attr = set_colour(&attr);
  1035.     for (i=0;i<256;i++)
  1036.       {
  1037.        if (etmode_flag[i])
  1038.          {
  1039.           ch = etmode_table[i] & A_CHARTEXT;
  1040.           etmode_table[i] = ch | nondisp_attr;
  1041.          }
  1042.       }
  1043.    }
  1044. /*---------------------------------------------------------------------*/
  1045. /* Now we have the new colours, save them with the current file...     */
  1046. /*---------------------------------------------------------------------*/
  1047.  memcpy(CURRENT_FILE->attr+area,&attr,sizeof(COLOUR_ATTR));
  1048. /*---------------------------------------------------------------------*/
  1049. /* If we haven't started curses (in profile first time) exit now...    */
  1050. /*---------------------------------------------------------------------*/
  1051.  if (!curses_started)
  1052.    {
  1053. #ifdef TRACE
  1054.     trace_return();
  1055. #endif
  1056.     return(RC_OK);
  1057.    }
  1058. /*---------------------------------------------------------------------*/
  1059. /* Update the appropriate window with the new colour combination...    */
  1060. /*---------------------------------------------------------------------*/
  1061.  switch (valid_areas[area].area_window)
  1062.    {
  1063.     case WINDOW_FILEAREA:
  1064.                         if (area == ATTR_FILEAREA)
  1065.                            wattrset(CURRENT_WINDOW_FILEAREA,set_colour(CURRENT_FILE->attr+area));
  1066.                         build_screen(current_screen); 
  1067.                         display_screen(current_screen);
  1068.                         break;
  1069.     case WINDOW_PREFIX:
  1070.                         if (CURRENT_WINDOW_PREFIX != NULL)
  1071.                           {
  1072.                            wattrset(CURRENT_WINDOW_PREFIX,set_colour(CURRENT_FILE->attr+area));
  1073.                            build_screen(current_screen);
  1074.                            display_screen(current_screen);
  1075.                           }
  1076.                         break;
  1077.     case WINDOW_COMMAND:
  1078.                         if (CURRENT_WINDOW_COMMAND != NULL)
  1079.                           {
  1080.                            wattrset(CURRENT_WINDOW_COMMAND,set_colour(CURRENT_FILE->attr+area));
  1081.                            redraw_window(CURRENT_WINDOW_COMMAND);
  1082.                            touchwin(CURRENT_WINDOW_COMMAND);
  1083.                            wnoutrefresh(CURRENT_WINDOW_COMMAND);
  1084.                           }
  1085.                         break;
  1086.     case WINDOW_ARROW:
  1087.                         if (CURRENT_WINDOW_ARROW != NULL)
  1088.                           {
  1089.                            wattrset(CURRENT_WINDOW_ARROW,set_colour(CURRENT_FILE->attr+area));
  1090.                            redraw_window(CURRENT_WINDOW_ARROW);
  1091.                            touchwin(CURRENT_WINDOW_ARROW);
  1092.                            wnoutrefresh(CURRENT_WINDOW_ARROW);
  1093.                           }
  1094.                         break;
  1095.     case WINDOW_IDLINE:
  1096.                         if (CURRENT_WINDOW_IDLINE != NULL)
  1097.                           {
  1098.                            wattrset(CURRENT_WINDOW_IDLINE,set_colour(CURRENT_FILE->attr+area));
  1099.                            redraw_window(CURRENT_WINDOW_IDLINE);
  1100.                            touchwin(CURRENT_WINDOW_IDLINE);
  1101.                            wnoutrefresh(CURRENT_WINDOW_IDLINE);
  1102.                           }
  1103.                         break;
  1104.     case WINDOW_STATAREA:
  1105.                         if (statarea != NULL)
  1106.                           {
  1107.                            wattrset(statarea,set_colour(CURRENT_FILE->attr+area));
  1108.                            redraw_window(statarea);
  1109.                            touchwin(statarea);
  1110.                            wnoutrefresh(statarea);
  1111.                           }
  1112.                         break;
  1113.     case WINDOW_DIVIDER:
  1114.                         if (divider != (WINDOW *)NULL)
  1115.                           {
  1116.                            wattrset(divider,set_colour(CURRENT_FILE->attr+area));
  1117.                            if (display_screens > 1
  1118.                            &&  !horizontal)
  1119.                              {
  1120.                               draw_divider();
  1121.                               touchwin(divider);
  1122.                               wnoutrefresh(divider);
  1123.                              }
  1124.                           }
  1125.                         break;
  1126.     case WINDOW_SLK:
  1127. #if defined(HAVE_SLK_INIT)
  1128.                         if (SLKx)
  1129.                           {
  1130. #if defined(HAVE_SLK_ATTRSET)
  1131.                            slk_attrset(set_colour(CURRENT_FILE->attr+area));
  1132. #else
  1133.                            display_error(61,(CHARTYPE *)"slk_attrset not in curses library",FALSE);
  1134. #endif
  1135.                            slk_touch();
  1136.                            slk_noutrefresh();
  1137.                           }
  1138. #endif
  1139.                         break;
  1140.     default:
  1141.                         break;
  1142.    }
  1143. #ifdef TRACE
  1144.  trace_return();
  1145. #endif
  1146.  return(RC_OK);
  1147. }
  1148. /*man-start*********************************************************************
  1149. COMMAND
  1150.      set compat - set compatibility mode
  1151.  
  1152. SYNTAX
  1153.      [SET] COMPat The|Xedit|Kedit|= [The|Xedit|Kedit|=] [The|Xedit|Kedit|=]
  1154.  
  1155. DESCRIPTION
  1156.      The SET COMPAT command changes some settings of THE to make it
  1157.      more compatible with the look and/or feel of XEDIT and KEDIT.
  1158.  
  1159.      This command is most useful as the first <SET> command in a
  1160.      profile file. It will change the default settings of THE to
  1161.      initially look like the chosen editor. You can then make any
  1162.      additional changes in THE by issuing other <SET> commands.
  1163.  
  1164.      It is recommended that this command NOT be executed from the
  1165.      command line, particularly if you have 2 files being displayed
  1166.      at the same time.  Although the command works, things may look
  1167.      and behave strangely :-)
  1168.  
  1169.      The first parameter affects the look of THE, the second parameter
  1170.      affects the feel of THE, and the third parameter determines
  1171.      which default function key settings you require.
  1172.  
  1173.      Any of the parameters can be specified as =, which will not
  1174.      change that aspect of THE's compatability.
  1175.  
  1176. COMPATIBILITY
  1177.      XEDIT: N/A
  1178.      KEDIT: N/A
  1179.  
  1180. DEFAULT
  1181.      THE THE THE
  1182.  
  1183. STATUS  
  1184.      Complete.
  1185. **man-end**********************************************************************/
  1186. #ifdef HAVE_PROTO
  1187. short Compat(CHARTYPE *params)
  1188. #else
  1189. short Compat(params)
  1190. CHARTYPE *params;
  1191. #endif
  1192.  
  1193. /***********************************************************************/
  1194. {
  1195. /*-------------------------- external data ----------------------------*/
  1196.  extern WINDOW *statarea;
  1197.  extern WINDOW *divider;
  1198.  extern bool curses_started;
  1199.  extern bool horizontal;
  1200.  extern short compatible_look;
  1201.  extern short compatible_feel;
  1202.  extern short compatible_keys;
  1203.  extern CHARTYPE display_screens;
  1204. #ifdef FOR_ALL_VIEWS
  1205.  extern VIEW_DETAILS *vd_first;
  1206. #endif
  1207. /*--------------------------- local data ------------------------------*/
  1208. #define COM_PARAMS  4
  1209.  CHARTYPE *word[COM_PARAMS+1];
  1210.  CHARTYPE strip[COM_PARAMS];
  1211.  short num_params=0;
  1212.  int rc=RC_OK;
  1213.  int prey=0,prex=0;
  1214.  short save_look=compatible_look;
  1215.  short save_feel=compatible_feel;
  1216.  short save_keys=compatible_keys;
  1217.  short new_look=0;
  1218.  short new_feel=0;
  1219.  short new_keys=0;
  1220.  unsigned short save_autosave_alt=0;
  1221.  unsigned short save_save_alt=0;
  1222. /*--------------------------- processing ------------------------------*/
  1223. #ifdef TRACE
  1224.  trace_function("commset1.c:Compat");
  1225. #endif
  1226. /*---------------------------------------------------------------------*/
  1227. /* Parse the parameters...                                             */
  1228. /*---------------------------------------------------------------------*/
  1229.  strip[0]=STRIP_BOTH;
  1230.  strip[1]=STRIP_BOTH;
  1231.  strip[2]=STRIP_BOTH;
  1232.  strip[3]=STRIP_NONE;
  1233.  num_params = param_split(params,word,COM_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  1234.  if (num_params < 1)
  1235.    {
  1236.     display_error(3,(CHARTYPE *)"",FALSE);
  1237. #ifdef TRACE
  1238.     trace_return();
  1239. #endif
  1240.     return(RC_INVALID_OPERAND);
  1241.    }
  1242.  if (num_params > 3)
  1243.    {
  1244.     display_error(2,(CHARTYPE *)"",FALSE);
  1245. #ifdef TRACE
  1246.     trace_return();
  1247. #endif
  1248.     return(RC_INVALID_OPERAND);
  1249.    }
  1250.  if (equal((CHARTYPE *)"THE",word[0],1))
  1251.     new_look = COMPAT_THE;
  1252.  else
  1253.     if (equal((CHARTYPE *)"XEDIT",word[0],1))
  1254.        new_look = COMPAT_XEDIT;
  1255.     else
  1256.        if (equal((CHARTYPE *)"KEDIT",word[0],1))
  1257.           new_look = COMPAT_KEDIT;
  1258.        else
  1259.           if (equal((CHARTYPE *)"=",word[0],1))
  1260.              new_look = save_look;
  1261.           else
  1262.             {
  1263.              display_error(1,word[0],FALSE);
  1264. #ifdef TRACE
  1265.              trace_return();
  1266. #endif
  1267.              return(RC_INVALID_OPERAND);
  1268.             }
  1269.  if (num_params == 1)
  1270.    {
  1271.     new_feel = save_feel;
  1272.     new_keys = save_keys;
  1273.    }
  1274.  else
  1275.    {
  1276.     if (equal((CHARTYPE *)"THE",word[1],1))
  1277.        new_feel = COMPAT_THE;
  1278.     else
  1279.        if (equal((CHARTYPE *)"XEDIT",word[1],1))
  1280.           new_feel = COMPAT_XEDIT;
  1281.        else
  1282.           if (equal((CHARTYPE *)"KEDIT",word[1],1))
  1283.              new_feel = COMPAT_KEDIT;
  1284.           else
  1285.              if (equal((CHARTYPE *)"=",word[1],1))
  1286.                 new_feel = save_feel;
  1287.              else
  1288.                {
  1289.                 display_error(1,word[1],FALSE);
  1290. #ifdef TRACE
  1291.                 trace_return();
  1292. #endif
  1293.                 return(RC_INVALID_OPERAND);
  1294.                }
  1295.     if (num_params == 2)
  1296.        new_keys = save_keys;
  1297.     else
  1298.       {
  1299.        if (equal((CHARTYPE *)"THE",word[2],1))
  1300.           new_keys = COMPAT_THE;
  1301.        else
  1302.           if (equal((CHARTYPE *)"XEDIT",word[2],1))
  1303.              new_keys = COMPAT_XEDIT;
  1304.           else
  1305.              if (equal((CHARTYPE *)"KEDIT",word[2],1))
  1306.                 new_keys = COMPAT_KEDIT;
  1307.              else
  1308.                 if (equal((CHARTYPE *)"=",word[2],1))
  1309.                    new_keys = save_keys;
  1310.                 else
  1311.                   {
  1312.                    display_error(1,word[2],FALSE);
  1313. #ifdef TRACE
  1314.                    trace_return();
  1315. #endif
  1316.                    return(RC_INVALID_OPERAND);
  1317.                   }
  1318.       }
  1319.    }
  1320.  compatible_look = new_look;
  1321.  compatible_feel = new_feel;
  1322.  compatible_keys = new_keys;
  1323.  /*
  1324.   * ---------------------------------------------------------------------
  1325.   * If the FEEL has changed, change the default feel...
  1326.   * ---------------------------------------------------------------------
  1327.   */
  1328. #if 0
  1329.  if (save_feel != compatible_feel)
  1330. #endif
  1331.    {
  1332.     set_global_feel_defaults();
  1333.    }
  1334.  /*
  1335.   * ---------------------------------------------------------------------
  1336.   * If the KEYS has changed, change the default key definitions...
  1337.   * ---------------------------------------------------------------------
  1338.   */
  1339.  if (save_keys != compatible_keys)
  1340.    {
  1341.     switch(compatible_keys)
  1342.       {
  1343.        case COMPAT_THE:
  1344.             rc = set_THE_defaults(prey,prex);
  1345.             break;
  1346.        case COMPAT_XEDIT:
  1347.             rc = set_XEDIT_defaults(prey,prex);
  1348.             break;
  1349.        case COMPAT_KEDIT:
  1350.             rc = set_KEDIT_defaults(prey,prex);
  1351.             break;
  1352.       }
  1353.     if (rc != RC_OK)
  1354.       {
  1355. #ifdef TRACE
  1356.        trace_return();
  1357. #endif
  1358.        return(rc);
  1359.       }
  1360.    }
  1361.  /*
  1362.   * ---------------------------------------------------------------------
  1363.   * If the LOOK remains the same, exit here...
  1364.   * ---------------------------------------------------------------------
  1365.   */
  1366. #if 0
  1367.  if (save_look == compatible_look)
  1368.    {
  1369. #ifdef TRACE
  1370.     trace_return();
  1371. #endif
  1372.     return(rc);
  1373.    }
  1374. #endif
  1375.  /*
  1376.   * ---------------------------------------------------------------------
  1377.   * Now we have to change the LOOK of the current view...
  1378.   * ---------------------------------------------------------------------
  1379.   */
  1380.  if (curses_started)
  1381.    {
  1382.     if (CURRENT_WINDOW_PREFIX != NULL)
  1383.        getyx(CURRENT_WINDOW_PREFIX,prey,prex);
  1384.    }
  1385.  post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
  1386. /*---------------------------------------------------------------------*/
  1387. /* Reset common settings to defaults for THE...                        */
  1388. /*---------------------------------------------------------------------*/
  1389.  set_global_look_defaults();
  1390.  
  1391. #ifdef FOR_ALL_VIEWS
  1392. /*---------------------------------------------------------------------*/
  1393. /* Change the settings for all views.                                  */
  1394. /*---------------------------------------------------------------------*/
  1395.  viewp = vd_first;
  1396.  while(viewp != NULL)
  1397.    {
  1398.     set_file_defaults(viewp->file_for_view);
  1399.     set_view_defaults(viewp);
  1400.     viewp = viewp->next;
  1401.    }
  1402. #else
  1403.  save_autosave_alt = CURRENT_FILE->autosave_alt;
  1404.  save_save_alt = CURRENT_FILE->save_alt;
  1405.  set_file_defaults(CURRENT_FILE);
  1406.  CURRENT_FILE->autosave_alt = save_autosave_alt;
  1407.  CURRENT_FILE->save_alt = save_save_alt;
  1408.  set_view_defaults(CURRENT_VIEW);
  1409. #endif
  1410. /*---------------------------------------------------------------------*/
  1411. /* Determine the size of each window in each screen in case any changes*/
  1412. /* in defaults caused some settings to include/exclude some windows... */
  1413. /*---------------------------------------------------------------------*/
  1414.  set_screen_defaults();
  1415. /*---------------------------------------------------------------------*/
  1416. /* For the common windows, set their attributes to match the new values*/
  1417. /*---------------------------------------------------------------------*/
  1418.  if (curses_started
  1419.  &&  statarea != NULL)
  1420.    {
  1421.     wattrset(statarea,set_colour(CURRENT_FILE->attr+ATTR_STATAREA));
  1422.     clear_statarea();
  1423.    }
  1424. /*---------------------------------------------------------------------*/
  1425. /* If more than one screen displayed, redisplay the 'other' screen...  */
  1426. /*---------------------------------------------------------------------*/
  1427.  if (display_screens > 1)
  1428.    {
  1429.     OTHER_SCREEN.screen_view->current_row = calculate_actual_row(OTHER_SCREEN.screen_view->current_base,
  1430.                                                   OTHER_SCREEN.screen_view->current_off,
  1431.                                                   OTHER_SCREEN.rows[WINDOW_FILEAREA],TRUE);
  1432.     pre_process_line(OTHER_SCREEN.screen_view,OTHER_SCREEN.screen_view->focus_line,(LINE *)NULL);
  1433.     if (OTHER_SCREEN.screen_view->cmd_line == 'O')
  1434.        OTHER_SCREEN.screen_view->current_window = WINDOW_FILEAREA;
  1435.     if (curses_started)
  1436.       {
  1437.        if (set_up_windows(current_screen) != RC_OK)
  1438.          {
  1439. #ifdef TRACE
  1440.           trace_return();
  1441. #endif
  1442.           return(rc);
  1443.          }
  1444.        if (!horizontal)
  1445.          {
  1446. /*#ifdef A_ALTCHARSET*/
  1447. #if 0
  1448.           wattrset(divider,A_ALTCHARSET|set_colour(OTHER_SCREEN.screen_view->file_for_view->attr+ATTR_DIVIDER));
  1449. #else
  1450.           wattrset(divider,set_colour(OTHER_SCREEN.screen_view->file_for_view->attr+ATTR_DIVIDER));
  1451. #endif
  1452. /*          redraw_window(divider);*/
  1453.           touchwin(divider);
  1454.           wnoutrefresh(divider);
  1455.          }
  1456.       }
  1457.     redraw_screen((current_screen == 0)?1:0);
  1458.     build_screen(other_screen);
  1459.     display_screen(other_screen);
  1460.    }
  1461. /*---------------------------------------------------------------------*/
  1462. /* Redisplay the current screen...                                     */
  1463. /*---------------------------------------------------------------------*/
  1464.  CURRENT_VIEW->current_row = calculate_actual_row(CURRENT_VIEW->current_base,
  1465.                                                   CURRENT_VIEW->current_off,
  1466.                                                   CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE);
  1467.  pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
  1468.  if (CURRENT_VIEW->cmd_line == 'O')
  1469.     CURRENT_VIEW->current_window = WINDOW_FILEAREA;
  1470.  if (curses_started)
  1471.    {
  1472.     if (set_up_windows(current_screen) != RC_OK)
  1473.       {
  1474. #ifdef TRACE
  1475.        trace_return();
  1476. #endif
  1477.        return(rc);
  1478.       }
  1479.    }
  1480.  redraw_screen(current_screen);
  1481.  build_screen(current_screen); 
  1482.  display_screen(current_screen);
  1483.  
  1484. #ifdef TRACE
  1485.  trace_return();
  1486. #endif
  1487.  return(rc);
  1488. }
  1489. /*man-start*********************************************************************
  1490. COMMAND
  1491.      set curline - set position of current line on screen
  1492.  
  1493. SYNTAX
  1494.      [SET] CURLine M[+n|-n] | [+|-]n
  1495.  
  1496. DESCRIPTION
  1497.      The SET CURLINE command sets the position of the <current line> to
  1498.      the physical screen line specified by supplied arguments.
  1499.  
  1500.      The first form of parameters is:
  1501.  
  1502.      M[+n|-n] 
  1503.      this sets the <current line> to be relative to the middle of
  1504.      the screen. A positive value adds to the middle line number, 
  1505.      a negative subtracts from it.
  1506.      eg. M+3 on a 24 line screen will be line 15
  1507.          M-5 on a 24 line screen will be line 7
  1508.  
  1509.      The second form of parameters is:
  1510.  
  1511.      [+|-]n
  1512.      this sets the <current line> to be relative to the top of the
  1513.      screen (if positive or no sign) or relative to the bottom 
  1514.      of the screen if negative.
  1515.      eg. +3 or 3 will set current line to line 3
  1516.          -3 on a 24 line screen will be line 21
  1517.  
  1518.      If the resulting line is outside the bounds of the screen
  1519.      the position of the current line will become the middle line
  1520.      on the screen.
  1521.  
  1522.      It is an error to try to position the CURLINE on the same
  1523.      line as a line already allocated by one of <SET HEXSHOW>,
  1524.      <SET RESERVED>, <SET SCALE> or <SET TABLINE>.
  1525.  
  1526. COMPATIBILITY
  1527.      XEDIT: Compatible.
  1528.      KEDIT: Compatible.
  1529.  
  1530. DEFAULT
  1531.      M
  1532.  
  1533. STATUS
  1534.      Complete.
  1535. **man-end**********************************************************************/
  1536. #ifdef HAVE_PROTO
  1537. short Curline(CHARTYPE *params)
  1538. #else
  1539. short Curline(params)
  1540. CHARTYPE *params;
  1541. #endif
  1542. /***********************************************************************/
  1543. {
  1544. /*-------------------------- external data ----------------------------*/
  1545. /*--------------------------- local data ------------------------------*/
  1546. #define CUR_PARAMS  1
  1547.  CHARTYPE *word[CUR_PARAMS+1];
  1548.  CHARTYPE strip[CUR_PARAMS];
  1549.  short num_params=0;
  1550.  short rc=0;
  1551.  short base = (short)CURRENT_VIEW->current_base;
  1552.  short off = CURRENT_VIEW->current_off;
  1553.  short hexshow_row=0,curline_row=0;
  1554. /*--------------------------- processing ------------------------------*/
  1555. #ifdef TRACE
  1556.  trace_function("commset1.c:Curline");
  1557. #endif
  1558.  strip[0]=STRIP_BOTH;
  1559.  num_params = param_split(params,word,CUR_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  1560.  if (num_params < 1)
  1561.    {
  1562.     display_error(3,(CHARTYPE *)"",FALSE);
  1563. #ifdef TRACE
  1564.     trace_return();
  1565. #endif
  1566.     return(RC_INVALID_OPERAND);
  1567.    }
  1568.  if (num_params > 1)
  1569.    {
  1570.     display_error(2,(CHARTYPE *)"",FALSE);
  1571. #ifdef TRACE
  1572.     trace_return();
  1573. #endif
  1574.     return(RC_INVALID_OPERAND);
  1575.    }
  1576. /*---------------------------------------------------------------------*/
  1577. /* Parse the parameter...                                              */
  1578. /*---------------------------------------------------------------------*/
  1579.  rc = execute_set_row_position(params,&base,&off);
  1580.  if (rc != RC_OK)
  1581.    {
  1582. #ifdef TRACE
  1583.     trace_return();
  1584. #endif
  1585.     return(rc);
  1586.    }
  1587. /*---------------------------------------------------------------------*/
  1588. /* If the CURLINE is the same line as HEXSHOW, SCALE, TABLE or has a   */
  1589. /* RESERVED line on it, return ERROR.                                  */
  1590. /*---------------------------------------------------------------------*/
  1591.  curline_row = calculate_actual_row(base,off,CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE);
  1592.  if (calculate_actual_row(CURRENT_VIEW->scale_base,
  1593.                           CURRENT_VIEW->scale_off,
  1594.                           CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE) == curline_row
  1595.  && CURRENT_VIEW->scale_on)
  1596.    {
  1597.     display_error(64,(CHARTYPE *)"- same as SCALE",FALSE);
  1598. #ifdef TRACE
  1599.     trace_return();
  1600. #endif
  1601.     return(rc);
  1602.    }
  1603.  if (calculate_actual_row(CURRENT_VIEW->tab_base,
  1604.                           CURRENT_VIEW->tab_off,
  1605.                           CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE) == curline_row
  1606.  && CURRENT_VIEW->tab_on)
  1607.    {
  1608.     display_error(64,(CHARTYPE *)"- same as TABLINE",FALSE);
  1609. #ifdef TRACE
  1610.     trace_return();
  1611. #endif
  1612.     return(rc);
  1613.    }
  1614.  hexshow_row = calculate_actual_row(CURRENT_VIEW->hexshow_base,
  1615.                                     CURRENT_VIEW->hexshow_off,
  1616.                                     CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE);
  1617.  if ((hexshow_row == curline_row
  1618.     ||  hexshow_row + 1 == curline_row)
  1619.  && CURRENT_VIEW->hexshow_on)
  1620.    {
  1621.     display_error(64,(CHARTYPE *)"- same as HEXSHOW",FALSE);
  1622. #ifdef TRACE
  1623.     trace_return();
  1624. #endif
  1625.     return(rc);
  1626.    }
  1627.  if (find_reserved_line(current_screen,TRUE,curline_row,0,0) != NULL)
  1628.    {
  1629.     display_error(64,(CHARTYPE *)"- same as RESERVED line",FALSE);
  1630. #ifdef TRACE
  1631.     trace_return();
  1632. #endif
  1633.     return(rc);
  1634.    }
  1635. /*---------------------------------------------------------------------*/
  1636. /* If the "real" row for CURLINE is not the same as the generated one, */
  1637. /* set the base and offset to reflect the generated row.               */
  1638. /*---------------------------------------------------------------------*/
  1639.  if (calculate_actual_row(base,off,CURRENT_SCREEN.rows[WINDOW_FILEAREA],FALSE) != curline_row)
  1640.    {
  1641.     CURRENT_VIEW->current_base = (CHARTYPE)POSITION_MIDDLE;
  1642.     CURRENT_VIEW->current_off = 0;
  1643.    }
  1644.  else
  1645.    {
  1646.     CURRENT_VIEW->current_base = (CHARTYPE)base;
  1647.     CURRENT_VIEW->current_off = off;
  1648.    }
  1649.  post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
  1650.  CURRENT_VIEW->current_row = curline_row;
  1651.  build_screen(current_screen); 
  1652.  display_screen(current_screen);
  1653.  
  1654. #ifdef TRACE
  1655.  trace_return();
  1656. #endif
  1657.  return(RC_OK);
  1658. }
  1659. /*man-start*********************************************************************
  1660. COMMAND
  1661.      set cursorstay - set on or off the behaviour of the cursor on a scroll
  1662.  
  1663. SYNTAX
  1664.      [SET] CURSORSTay ON|OFF
  1665.  
  1666. DESCRIPTION
  1667.      The SETCURSORSTAY command allows the user to set the behaviour of
  1668.      the cursor when the file is scrolled with a <FORWARD> or <BACKWARD>
  1669.      command.
  1670.  
  1671.      Before this command was introduced, the position of the cursor
  1672.      after the file was scrolled depended on <SET COMPAT>; for
  1673.      THE, the cursor moved to the current line, for XEDIT and KEDIT
  1674.      modes the cursor stayed on the same screen line.
  1675.  
  1676. COMPATIBILITY
  1677.      XEDIT: N/A
  1678.      KEDIT: N/A
  1679.  
  1680. DEFAULT
  1681.      ON
  1682.  
  1683. STATUS
  1684.      Complete.
  1685. **man-end**********************************************************************/
  1686. #ifdef HAVE_PROTO
  1687. short CursorStay(CHARTYPE *params)
  1688. #else
  1689. short CursorStay(params)
  1690. CHARTYPE *params;
  1691. #endif
  1692. /***********************************************************************/
  1693. {
  1694. /*-------------------------- external data ----------------------------*/
  1695.  extern bool scroll_cursor_stay;
  1696. /*--------------------------- local data ------------------------------*/
  1697.  short rc=RC_OK;
  1698. /*--------------------------- processing ------------------------------*/
  1699. #ifdef TRACE
  1700.  trace_function("commset1.c:CursorStay");
  1701. #endif
  1702.  rc = execute_set_on_off(params,&scroll_cursor_stay);
  1703. #ifdef TRACE
  1704.  trace_return();
  1705. #endif
  1706.  return(rc);
  1707. }
  1708. /*man-start*********************************************************************
  1709. COMMAND
  1710.      set defsort - specify the order in which files appear in DIR.DIR
  1711.  
  1712. SYNTAX
  1713.      [SET] DEFSORT OFF|DIRectory|Size|Date|Time|Name [Ascending|Descending]
  1714.  
  1715. DESCRIPTION
  1716.      The SET DEFSORT command allows the user to determine the order
  1717.      in which files appear in a DIR.DIR file.
  1718.  
  1719.      'Directory' specifies that directories within the current directory
  1720.      are shown before other files.
  1721.  
  1722.      'Size' specifies that the size of the file determines the order
  1723.      in which files are displayed.
  1724.  
  1725.      'Date' specifies that the date of the last change to the file
  1726.      determines the order in which files are displayed. If the dates 
  1727.      are the same, the time the file was last changed is used as a
  1728.      secondary sort key.
  1729.  
  1730.      'Time' specifies that the time of the file determines the order
  1731.      in which files are displayed.
  1732.  
  1733.      'Name' specifies that the name of the file determines the order in
  1734.      which files are displayed. This is the default.  Files are sorted
  1735.      by name as a secondary sort key when any of the above options are
  1736.      specified and two files have equal values for that sort option.
  1737.  
  1738.      'OFF' indicates that no ordering of the files in the directory
  1739.      is performed.  On directories with a large number of files, this
  1740.      option results in a displayed DIR.DIR file much quicker than any
  1741.      sorted display.
  1742.  
  1743.      The second parameter specifies if the sort order is ascending or
  1744.      descending.
  1745.  
  1746.      This command does not affect how any current DIR.DIR file is shown
  1747.      but is applicable the next time a directory is displayed as a
  1748.      result of a DIR or LS command.
  1749.  
  1750. COMPATIBILITY
  1751.      XEDIT: N/A
  1752.      KEDIT: Similar in functionality.
  1753.  
  1754. DEFAULT
  1755.      NAME ASCENDING
  1756.  
  1757. STATUS
  1758.      Complete.
  1759. **man-end**********************************************************************/
  1760. #ifdef HAVE_PROTO
  1761. short Defsort(CHARTYPE *params)
  1762. #else
  1763. short Defsort(params)
  1764. CHARTYPE *params;
  1765. #endif
  1766. /***********************************************************************/
  1767. {
  1768. /*------------------------- external date -----------------------------*/
  1769.  extern int DEFSORTx;
  1770.  extern int DIRORDERx;
  1771. /*--------------------------- local data ------------------------------*/
  1772. #define DIR_PARAMS  2
  1773.  CHARTYPE *word[DIR_PARAMS+1];
  1774.  CHARTYPE strip[DIR_PARAMS];
  1775.  short num_params=0;
  1776.  short rc=RC_OK;
  1777.  int defsort=0;
  1778.  int dirorder=DIRSORT_ASC;
  1779. /*--------------------------- processing ------------------------------*/
  1780. #ifdef TRACE
  1781.  trace_function("commset1.c:Defsort");
  1782. #endif
  1783.  strip[0]=STRIP_BOTH;
  1784.  strip[1]=STRIP_BOTH;
  1785.  num_params = param_split(params,word,DIR_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  1786.  if (num_params < 1)
  1787.    {
  1788.     display_error(3,(CHARTYPE *)"",FALSE);
  1789. #ifdef TRACE
  1790.     trace_return();
  1791. #endif
  1792.     return(RC_INVALID_OPERAND);
  1793.    }
  1794.  if (num_params > 2)
  1795.    {
  1796.     display_error(2,(CHARTYPE *)"",FALSE);
  1797. #ifdef TRACE
  1798.     trace_return();
  1799. #endif
  1800.     return(RC_INVALID_OPERAND);
  1801.    }
  1802.  if (equal((CHARTYPE *)"directory",word[0],3))
  1803.     defsort = DIRSORT_DIR;
  1804.  else
  1805.     if (equal((CHARTYPE *)"name",word[0],1))
  1806.        defsort = DIRSORT_NAME;
  1807.     else
  1808.        if (equal((CHARTYPE *)"time",word[0],1))
  1809.           defsort = DIRSORT_TIME;
  1810.        else
  1811.           if (equal((CHARTYPE *)"size",word[0],1))
  1812.              defsort = DIRSORT_SIZE;
  1813.           else
  1814.              if (equal((CHARTYPE *)"date",word[0],1))
  1815.                 defsort = DIRSORT_DATE;
  1816.              else
  1817.                 if (equal((CHARTYPE *)"OFF",word[0],3))
  1818.                    defsort = DIRSORT_NONE;
  1819.                 else
  1820.                   {
  1821.                    display_error(1,(CHARTYPE *)word[0],FALSE);
  1822. #ifdef TRACE
  1823.                    trace_return();
  1824. #endif
  1825.                    return(RC_INVALID_OPERAND);
  1826.                   }
  1827.  if (num_params == 2)
  1828.    {
  1829.     if (equal((CHARTYPE *)"ascending",word[1],1))
  1830.        dirorder = DIRSORT_ASC;
  1831.     else
  1832.        if (equal((CHARTYPE *)"descending",word[1],1))
  1833.           dirorder = DIRSORT_DESC;
  1834.        else
  1835.          {
  1836.           display_error(1,(CHARTYPE *)word[1],FALSE);
  1837. #ifdef TRACE
  1838.           trace_return();
  1839. #endif
  1840.           return(RC_INVALID_OPERAND);
  1841.          }
  1842.    }
  1843.  DEFSORTx = defsort;
  1844.  DIRORDERx = dirorder;
  1845. #ifdef TRACE
  1846.  trace_return();
  1847. #endif
  1848.  return(rc);
  1849. }
  1850. /*man-start*********************************************************************
  1851. COMMAND
  1852.      set dirinclude - set the file mask for directory command
  1853.  
  1854. SYNTAX
  1855.      [SET] DIRInclude * 
  1856.      [SET] DIRInclude [Normal] [Readonly] [System] [Hidden] [Directory]
  1857.  
  1858. DESCRIPTION
  1859.      The DIRINCLUDE command sets the file mask for files that will be
  1860.      displayed on subsequent DIRECTORY commands. The operand "*" will
  1861.      set the mask to all files, the other options will set the
  1862.      mask to include those options specified together with "normal"
  1863.      files eg.
  1864.  
  1865.         DIRINCLUDE R S
  1866.  
  1867.      will display readonly and system files together with "normal" files
  1868.      the next time the DIRECTORY command is issued.
  1869.  
  1870.      The effects of DIRINCLUDE are ignored in the Unix version.
  1871.  
  1872. COMPATIBILITY
  1873.      XEDIT: N/A
  1874.      KEDIT: N/A
  1875.  
  1876. DEFAULT
  1877.      *
  1878.  
  1879. SEE ALSO
  1880.      <DIRECTORY>, <LS>
  1881.  
  1882. STATUS
  1883.      Complete.
  1884. **man-end**********************************************************************/
  1885. #ifdef HAVE_PROTO
  1886. short Dirinclude(CHARTYPE *params)
  1887. #else
  1888. short Dirinclude(params)
  1889. CHARTYPE *params;
  1890. #endif
  1891. /***********************************************************************/
  1892. {
  1893. /*--------------------------- local data ------------------------------*/
  1894.  short rc=RC_OK;
  1895. /*--------------------------- processing ------------------------------*/
  1896. #ifdef TRACE
  1897.  trace_function("commset1.c:Dirinclude");
  1898. #endif
  1899.  rc = set_dirtype(params);
  1900. #ifdef TRACE
  1901.  trace_return();
  1902. #endif
  1903.  return(rc);
  1904. }
  1905. /*man-start*********************************************************************
  1906. COMMAND
  1907.      set display - specify which level of lines to display
  1908.  
  1909. SYNTAX
  1910.      [SET] DISPlay n [m|*]
  1911.  
  1912. DESCRIPTION
  1913.      The SET DISPLAY command sets the selection level for lines to be
  1914.      displayed on the screen.
  1915.  
  1916. COMPATIBILITY
  1917.      XEDIT: Compatible.
  1918.      KEDIT: Compatible.
  1919.  
  1920. DEFAULT
  1921.      0 0
  1922.  
  1923. SEE ALSO
  1924.      <SET SCOPE>, <SET SELECT>, <ALL>
  1925.  
  1926. STATUS
  1927.      Complete.
  1928. **man-end**********************************************************************/
  1929. #ifdef HAVE_PROTO
  1930. short Display(CHARTYPE *params)
  1931. #else
  1932. short Display(params)
  1933. CHARTYPE *params;
  1934. #endif
  1935. /***********************************************************************/
  1936. {
  1937. /*-------------------------- external data ----------------------------*/
  1938. /*--------------------------- local data ------------------------------*/
  1939.  short rc=RC_OK;
  1940.  short col1=0,col2=0;
  1941. /*--------------------------- processing ------------------------------*/
  1942. #ifdef TRACE
  1943.  trace_function("commset1.c:Display");
  1944. #endif
  1945.  if ((rc = validate_n_m(params,&col1,&col2)) != RC_OK)
  1946.    {
  1947. #ifdef TRACE
  1948.     trace_return();
  1949. #endif
  1950.     return(rc);
  1951.    }
  1952.  CURRENT_VIEW->display_low = col1;
  1953.  CURRENT_VIEW->display_high = col2;
  1954. /*---------------------------------------------------------------------*/
  1955. /* If we are on the command line and the result of this statement means*/
  1956. /* that the current line is no longer in scope, we need to make the    */
  1957. /* current line and possibly the focus line the next line in scope.    */
  1958. /*---------------------------------------------------------------------*/
  1959.  if (CURRENT_VIEW->current_window == WINDOW_COMMAND)
  1960.    {
  1961.     CURRENT_VIEW->current_line = find_next_in_scope(CURRENT_VIEW,NULL,get_true_line(TRUE),DIRECTION_FORWARD);
  1962.     build_screen(current_screen); 
  1963.     if (!line_in_view(current_screen,CURRENT_VIEW->focus_line))
  1964.       {
  1965.        CURRENT_VIEW->focus_line = CURRENT_VIEW->current_line;
  1966.        pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
  1967.       }
  1968.    }
  1969.  pre_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL);
  1970.  build_screen(current_screen); 
  1971.  display_screen(current_screen);
  1972.  
  1973. #ifdef TRACE
  1974.  trace_return();
  1975. #endif
  1976.  return(rc);
  1977. }
  1978. /*man-start*********************************************************************
  1979. COMMAND
  1980.      set eolout - set end of line terminating character(s)
  1981.  
  1982. SYNTAX
  1983.      [SET] EOLout CRLF|LF|CR|NONE
  1984.  
  1985. DESCRIPTION
  1986.      The EOLOUT command allows the user to specify the combination of
  1987.      characters that terminate a line. Lines of text in Unix files are
  1988.      usually terminated with a 'LF', DOS file usually end with a 'CR' and
  1989.      'LF' combination. Files on the Apple Macintosh are usually terminated
  1990.      with a 'CR'.
  1991.  
  1992.      The 'NONE' option can be used to specify that no end of line
  1993.      character is written.
  1994.  
  1995. COMPATIBILITY
  1996.      XEDIT: N/A
  1997.      KEDIT: N/A
  1998.  
  1999. DEFAULT
  2000.      LF - UNIX
  2001.      CRLF - DOS/OS2/WIN32
  2002.      NONE - if THE started with -u option
  2003.  
  2004. STATUS
  2005.      Complete.
  2006. **man-end**********************************************************************/
  2007. #ifdef HAVE_PROTO
  2008. short Eolout(CHARTYPE *params)
  2009. #else
  2010. short Eolout(params)
  2011. CHARTYPE *params;
  2012. #endif
  2013. /***********************************************************************/
  2014. {
  2015. /*-------------------------- external data ----------------------------*/
  2016.  extern CHARTYPE EOLx;
  2017. /*--------------------------- local data ------------------------------*/
  2018.  CHARTYPE eolchar=0;
  2019. /*--------------------------- processing ------------------------------*/
  2020. #ifdef TRACE
  2021.  trace_function("commset1.c:Eolout");
  2022. #endif
  2023.  if (equal((CHARTYPE *)"lf",params,2))
  2024.     eolchar = EOLOUT_LF;
  2025.  else
  2026.     if (equal((CHARTYPE *)"cr",params,2))
  2027.        eolchar = EOLOUT_CR;
  2028.     else
  2029.       {
  2030.        if (equal((CHARTYPE *)"crlf",params,4))
  2031.           eolchar = EOLOUT_CRLF;
  2032.        else
  2033.           if (equal((CHARTYPE *)"none",params,4))
  2034.              eolchar = EOLOUT_NONE;
  2035.           else
  2036.             {
  2037.              display_error(1,(CHARTYPE *)params,FALSE);
  2038. #ifdef TRACE
  2039.              trace_return();
  2040. #endif
  2041.              return(RC_INVALID_OPERAND);
  2042.             }
  2043.       }
  2044.  EOLx = CURRENT_FILE->eolout = eolchar;
  2045. #ifdef TRACE
  2046.  trace_return();
  2047. #endif
  2048.  return(RC_OK);
  2049. }
  2050. /*man-start*********************************************************************
  2051. COMMAND
  2052.      set etmode - indicate if extended display mode is possible
  2053.  
  2054. SYNTAX
  2055.      [SET] ETMODE ON|OFF [character list]
  2056.  
  2057. DESCRIPTION
  2058.      The SET ETMODE command allows the user to specify which characters
  2059.      in a character set are to be displayed as their actual representation.
  2060.  
  2061.      Those characters not explicitly specified to be displayed as they are
  2062.      represented, will be displayed as the <SET NONDISP> character in the 
  2063.      colour specified by <SET COLOUR> NONDISP. Characters below 32, will 
  2064.      be displayed with an alphabetic character representing the "control" 
  2065.      code. 
  2066.  
  2067.      eg.
  2068.      character code with a value of 7, will display as "G" in the colour
  2069.      specified by <SET COLOUR> NONDISP.
  2070.  
  2071.      'ON' with no optional 'character list' will display ALL
  2072.      characters as their actual representation.
  2073.  
  2074.      'OFF' with no optional 'character list' will display
  2075.      characters below 32, as a "control" character; characters greater 
  2076.      than 126 will be displayed as the <SET NONDISP> characters.
  2077.      [SET] ETMODE OFF is equivalent  to [SET] ETMODE ON 32-126.
  2078.  
  2079.      The 'character list' is a list of positive numbers between 0 and
  2080.      255 (inclusive).  The format of this character list can be either
  2081.      a single number; eg. 124, or a range of numbers specified; eg.
  2082.      32-126. (The first number must be less than or equal to the second 
  2083.      number).
  2084.  
  2085.      As an example; ETMODE ON 32-127 160-250  would result in the
  2086.      characters with a decimal value between 32 and 127 inclusive
  2087.      and 160 and 250 inclusive being displayed as their actual
  2088.      representation (depending on the current font), and the
  2089.      characters between 0 and 31 inclusive, being displayed as
  2090.      an equivalent "control" character; characters between 128 and 
  2091.      159 inculsive and 250 to 255 being displayed with the <SET NONDISP>
  2092.      character.
  2093.  
  2094.      Up to 20 character specifiers (single number or range) can be 
  2095.      specified.
  2096.  
  2097. COMPATIBILITY
  2098.      XEDIT: Similar function but deals with Double-Byte characters
  2099.      KEDIT: N/A
  2100.  
  2101. DEFAULT
  2102.      ON - DOS/OS2/WIN32
  2103.      ON 32-255 - X11
  2104.      OFF - UNIX
  2105.  
  2106. SEE ALSO
  2107.      <SET NONDISP>, <SET COLOUR>
  2108.  
  2109. STATUS
  2110.      Complete.
  2111. **man-end**********************************************************************/
  2112. #ifdef HAVE_PROTO
  2113. short Etmode(CHARTYPE *params)
  2114. #else
  2115. short Etmode(params)
  2116. CHARTYPE *params;
  2117. #endif
  2118. /***********************************************************************/
  2119. {
  2120. /*-------------------------- external data ----------------------------*/
  2121.  extern bool NONDISPx;
  2122.  extern chtype etmode_table[256];
  2123.  extern bool   etmode_flag[256];
  2124.  extern CHARTYPE number_of_files;
  2125. /*--------------------------- local data ------------------------------*/
  2126. #define ETM_PARAMS  21
  2127.  CHARTYPE *word[ETM_PARAMS+1];
  2128.  CHARTYPE strip[ETM_PARAMS];
  2129.  short num_params=0;
  2130.  register short i=0,j=0;
  2131.  short rc=RC_OK;
  2132.  bool tmp_mode=FALSE;
  2133.  chtype attr=0L;
  2134.  COLOUR_ATTR curr_attr;
  2135.  bool flags[256];
  2136.  int num=0,num1=0;
  2137.  CHARTYPE *wptr=NULL,*wptr1=NULL;
  2138. /*--------------------------- processing ------------------------------*/
  2139. #ifdef TRACE
  2140.  trace_function("commset1.c:Etmode");
  2141. #endif
  2142.  for(i=0;i<ETM_PARAMS;i++)
  2143.     strip[i]=STRIP_BOTH;
  2144.  num_params = param_split(params,word,ETM_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  2145.  if (num_params < 1)
  2146.    {
  2147.     display_error(3,(CHARTYPE *)"",FALSE);
  2148. #ifdef TRACE
  2149.     trace_return();
  2150. #endif
  2151.     return(RC_INVALID_OPERAND);
  2152.    }
  2153.  rc = execute_set_on_off(word[0],&tmp_mode);
  2154.  if (rc != RC_OK)
  2155.    {
  2156.     display_error(1,word[0],FALSE);
  2157. #ifdef TRACE
  2158.     trace_return();
  2159. #endif
  2160.     return(RC_INVALID_OPERAND);
  2161.    }
  2162.  if (CURRENT_VIEW == NULL
  2163.  ||  CURRENT_FILE == NULL)
  2164.     set_up_default_colours((FILE_DETAILS *)NULL,&curr_attr,ATTR_NONDISP);
  2165.  else
  2166.     memcpy(&curr_attr,CURRENT_FILE->attr+ATTR_NONDISP,sizeof(COLOUR_ATTR));
  2167.  attr = set_colour(&curr_attr);
  2168.  if (num_params == 1)  /* absolute ON or OFF */
  2169.    {
  2170.     if (tmp_mode)  /* ETMODE ON */
  2171.       {
  2172.        for (i=0;i<256;i++)
  2173.          {
  2174.           etmode_table[i] = i;
  2175.           etmode_flag[i] = FALSE;
  2176.          }
  2177.       }
  2178.     else
  2179.       {
  2180.        for (i=0;i<256;i++)
  2181.          {
  2182.           if (i < 32)
  2183.             {
  2184.              etmode_table[i] = ('@' + i) | attr;
  2185.              etmode_flag[i] = (attr)?TRUE:FALSE;
  2186.             }
  2187.           else
  2188.              if (i > 126)
  2189.                {
  2190.                 etmode_table[i] = NONDISPx | attr;
  2191.                 etmode_flag[i] = (attr)?TRUE:FALSE;
  2192.                }
  2193.              else
  2194.                {
  2195.                 etmode_table[i] = i;
  2196.                 etmode_flag[i] = FALSE;
  2197.                }
  2198.          }
  2199.       }
  2200.     if (number_of_files != 0)
  2201.       {
  2202.        build_screen(current_screen); 
  2203.        display_screen(current_screen);
  2204.       }
  2205. #ifdef TRACE
  2206.     trace_return();
  2207. #endif
  2208.     return(RC_INVALID_OPERAND);
  2209.    }
  2210.  memset(flags,FALSE,sizeof(flags));
  2211.  for (i=1;i<num_params;i++)
  2212.    {
  2213.     if (valid_positive_integer(word[i]))
  2214.       {
  2215.        num = atoi((DEFCHAR *)word[i]);
  2216.        if (num > 255)
  2217.          {
  2218.           display_error(6,word[i],FALSE);
  2219. #ifdef TRACE
  2220.           trace_return();
  2221. #endif
  2222.           return(RC_INVALID_OPERAND);
  2223.          }
  2224.        flags[num] = TRUE;
  2225.        continue;
  2226.       }
  2227.     num = strzeq(word[i],(CHARTYPE)'-');
  2228.     num1 = strzreveq(word[i],(CHARTYPE)'-');
  2229.     if (num != num1
  2230.     || num == (-1))
  2231.       {
  2232.        display_error(1,word[i],FALSE);
  2233. #ifdef TRACE
  2234.        trace_return();
  2235. #endif
  2236.        return(RC_INVALID_OPERAND);
  2237.       }
  2238.     wptr = word[i];
  2239.     *(wptr+num) = '\0';
  2240.     wptr1 = wptr+num+1;
  2241.     if (!valid_positive_integer(wptr))
  2242.       {
  2243.        display_error(1,wptr,FALSE);
  2244. #ifdef TRACE
  2245.        trace_return();
  2246. #endif
  2247.        return(RC_INVALID_OPERAND);
  2248.       }
  2249.     if (!valid_positive_integer(wptr))
  2250.       {
  2251.        display_error(1,wptr1,FALSE);
  2252. #ifdef TRACE
  2253.        trace_return();
  2254. #endif
  2255.        return(RC_INVALID_OPERAND);
  2256.       }
  2257.     num = atoi((DEFCHAR *)wptr);
  2258.     num1 = atoi((DEFCHAR *)wptr1);
  2259.     if (num > num1)
  2260.       {
  2261.        display_error(1,word[i],FALSE);
  2262. #ifdef TRACE
  2263.        trace_return();
  2264. #endif
  2265.        return(RC_INVALID_OPERAND);
  2266.       }
  2267.     if (num > 255)
  2268.       {
  2269.        display_error(6,wptr,FALSE);
  2270. #ifdef TRACE
  2271.        trace_return();
  2272. #endif
  2273.        return(RC_INVALID_OPERAND);
  2274.       }
  2275.     if (num1 > 255)
  2276.       {
  2277.        display_error(6,wptr1,FALSE);
  2278. #ifdef TRACE
  2279.        trace_return();
  2280. #endif
  2281.        return(RC_INVALID_OPERAND);
  2282.       }
  2283.     for (j=num;j<num1+1;j++)
  2284.       {
  2285.        flags[j] = TRUE;
  2286.       }
  2287.    }
  2288.  for (i=0;i<256;i++)
  2289.    {
  2290.     if (flags[i])
  2291.       {
  2292.        etmode_table[i] = i;
  2293.        etmode_flag[i] = FALSE;
  2294.       }
  2295.     else
  2296.       {
  2297.        if (i < 32)
  2298.          {
  2299.           etmode_table[i] = ('@' + i) | attr;
  2300.           etmode_flag[i] = TRUE;
  2301.          }
  2302.        else
  2303.          {
  2304.           etmode_table[i] = NONDISPx | attr;
  2305.           etmode_flag[i] = TRUE;
  2306.          }
  2307.       }
  2308.    }
  2309.  if (number_of_files != 0)
  2310.    {
  2311.     build_screen(current_screen); 
  2312.     display_screen(current_screen);
  2313.    }
  2314. #ifdef TRACE
  2315.  trace_return();
  2316. #endif
  2317.  return(rc);
  2318. }
  2319. /*man-start*********************************************************************
  2320. COMMAND
  2321.      set fext - change the extension of the existing file
  2322.  
  2323. SYNTAX
  2324.      [SET] FExt ext
  2325.      [SET] FType ext
  2326.  
  2327. DESCRIPTION
  2328.      The SET FEXT command allows the user to change the path of
  2329.      the file currently being edited.
  2330.  
  2331.      The 'path' parameter can be specified with or without the
  2332.      trailing directory seperator.  Under DOS, OS/2 and Windows ports,
  2333.      the drive letter is considered part of the file's path.
  2334.  
  2335.      See <SET FILENAME> for a full explanation of THE's definitions
  2336.      of fpath, filename, fname, fext and fmode.
  2337.  
  2338.      It is not possible to use this command on pseudo files.
  2339.  
  2340. COMPATIBILITY
  2341.      XEDIT: N/A
  2342.      KEDIT: N/A
  2343.  
  2344. SEE ALSO
  2345.      <SET FNAME>, <SET FILENAME>, <SET FEXT>, <SET FMODE>
  2346.  
  2347. STATUS
  2348.      Complete.
  2349. **man-end**********************************************************************/
  2350. #ifdef HAVE_PROTO
  2351. short Fext(CHARTYPE *params)
  2352. #else
  2353. short Fext(params)
  2354. CHARTYPE *params;
  2355. #endif
  2356. /***********************************************************************/
  2357. {
  2358. /*-------------------------- external data ----------------------------*/
  2359.  extern CHARTYPE sp_fname[MAX_FILE_NAME+1];
  2360.  extern CHARTYPE sp_path[MAX_FILE_NAME+1];
  2361.  extern CHARTYPE display_screens;
  2362. /*--------------------------- local data ------------------------------*/
  2363.  CHARTYPE tmp_name[MAX_FILE_NAME+1];
  2364.  short rc=RC_OK;
  2365.  int len=0,last_period=0;
  2366. /*--------------------------- processing ------------------------------*/
  2367. #ifdef TRACE
  2368.  trace_function("commset1.c:Fext");
  2369. #endif
  2370. /*
  2371.  * If a pseudo file is being changed, then error...
  2372.  */
  2373.  if (CURRENT_FILE->pseudo_file)
  2374.    {
  2375.     display_error(8,(CHARTYPE *)"",FALSE);
  2376. #ifdef TRACE
  2377.     trace_return();
  2378. #endif
  2379.     return(RC_INVALID_OPERAND);
  2380.    }
  2381.  strcpy((DEFCHAR *)tmp_name,(DEFCHAR *)CURRENT_FILE->fpath);
  2382.  strcat((DEFCHAR*)tmp_name,(DEFCHAR*)CURRENT_FILE->fname);
  2383.  last_period = strzreveq(CURRENT_FILE->fname,(CHARTYPE)'.');
  2384.  if (last_period == (-1)) /* no period */
  2385.    {
  2386.     if (blank_field(params)) /* and no extension, return... */
  2387.       {
  2388. #ifdef TRACE
  2389.        trace_return();
  2390. #endif
  2391.        return(RC_OK);
  2392.       }
  2393.     strcat((DEFCHAR*)tmp_name,"."); /* add a period */
  2394.    }
  2395.  else
  2396.    {
  2397.     tmp_name[strlen((DEFCHAR*)CURRENT_FILE->fpath)+last_period+1] = '\0';
  2398.    }
  2399.  strcat((DEFCHAR*)tmp_name,(DEFCHAR*)params);
  2400. /*
  2401.  * Split the new path supplied...
  2402.  */
  2403.  if ((rc = splitpath(strrmdup(strtrans(tmp_name,OSLASH,ISLASH),ISLASH))) != RC_OK)
  2404.    {
  2405.     display_error(10,tmp_name,FALSE);
  2406. #ifdef TRACE
  2407.     trace_return();
  2408. #endif
  2409.     return(rc);
  2410.    }
  2411. /*
  2412.  * If the path is NOT the same as already assigned, error...
  2413.  */
  2414.  if (strcmp((DEFCHAR *)sp_path,(DEFCHAR *)CURRENT_FILE->fpath) != 0)
  2415.    {
  2416.     display_error(1,params,FALSE);
  2417. #ifdef TRACE
  2418.     trace_return();
  2419. #endif
  2420.     return(RC_OK);
  2421.    }
  2422. /*
  2423.  * If the length of the new path is > the existing one,
  2424.  * free up any memory for the existing path and allocate some
  2425.  * more. Save the new path.
  2426.  */
  2427.  if (strlen((DEFCHAR*)sp_fname) > strlen((DEFCHAR*)CURRENT_FILE->fname))
  2428.    {
  2429.     (*the_free)(CURRENT_FILE->fname);
  2430.     if ((CURRENT_FILE->fname = (CHARTYPE *)(*the_malloc)(strlen((DEFCHAR *)sp_fname))) == NULL)
  2431.       {
  2432.        display_error(30,(CHARTYPE *)"",FALSE);
  2433. #ifdef TRACE
  2434.        trace_return();
  2435. #endif
  2436.        return(RC_OUT_OF_MEMORY);
  2437.       }
  2438.    }
  2439.  strcpy((DEFCHAR *)CURRENT_FILE->fname,(DEFCHAR *)sp_fname);
  2440. /*
  2441.  * Re-display the IDLINE
  2442.  */
  2443.  if (display_screens > 1
  2444.  &&  SCREEN_FILE(current_screen) == SCREEN_FILE(other_screen))
  2445.     show_heading(other_screen);
  2446.  show_heading(current_screen);
  2447. #ifdef TRACE
  2448.  trace_return();
  2449. #endif
  2450.  return(rc);
  2451. }
  2452. /*man-start*********************************************************************
  2453. COMMAND
  2454.      set filename - change the filename of the file being edited
  2455.  
  2456. SYNTAX
  2457.      [SET] FILEName filename
  2458.  
  2459. DESCRIPTION
  2460.      The SET FNAME command allows the user to change the filename of
  2461.      the file currently being edited.
  2462.  
  2463.      In THE, a fully qualified file name consists of a file path and a
  2464.      file name.  THE treats all characters up to and including the
  2465.      last directory seperator (usually / or \) as the file's path.
  2466.      From the first character after the end of the file's path, to
  2467.      the end of the fully qualified file name is the file name.
  2468.  
  2469.      A file name is further broken down into a fname and fext.
  2470.      The fname of a file consists of all characters from the start 
  2471.      of the filename up to but not including the last period (if 
  2472.      there is one).  The fext of a file consists of all characters 
  2473.      from the end of the filename up to but not including the last 
  2474.      period. If there is no period in the filename then the fext is
  2475.      empty.
  2476.  
  2477.      The fmode of a file is equivalent to the drive letter of the file's
  2478.      path. This is only valid under DOS, OS/2 and Windows ports.
  2479.  
  2480.      Some examples.
  2481.  
  2482.      *----------------------------------------------------------------
  2483.      Full File Name     File            File     Fname  Fext     Fmode
  2484.                         Path            Name
  2485.      -----------------------------------------------------------------
  2486.      /usr/local/bin/the /usr/local/bin/ the      the             N/A
  2487.      c:\tools\the.exe   c:\tools\       the.exe  the    exe      c
  2488.      /etc/a.b.c         /etc/           a.b.c    a.b    c        N/A
  2489.      *----------------------------------------------------------------
  2490.  
  2491.      A limited amount of validation of the resulting file name is
  2492.      carried out by this command, but some errors in the file name
  2493.      will not be evident until the file is saved.
  2494.  
  2495.      A leading "=" indicates that the fname portion of the current file 
  2496.      name is be retained.  This is equivalent to the command 
  2497.      <SET FEXT>.  A trailing "=" indicates that the fext portion of
  2498.      the current file name is to be retained. This is equivalent to the
  2499.      command <SET FNAME>.
  2500.  
  2501.      Only one "=" is allowed in the parameter.
  2502.  
  2503.      Some examples.
  2504.  
  2505.      *----------------------------------------------------------------
  2506.      File Name   Parameter  New File Name
  2507.      -----------------------------------------------------------------
  2508.      a.b.c       fred.c=    fred.c.c      SET FNAME fred.c
  2509.      a.b.c       fred.c.=   fred.c..c     SET FNAME fred.c.
  2510.      a.b.c       =fred      a.c.fred      SET FEXT fred
  2511.      a.b.c       =.fred     a.c..fred     SET FEXT .fred
  2512.      a           =d         a.d           SET FEXT d
  2513.      a.b.c       =          a.b.c         does nothing
  2514.      *----------------------------------------------------------------
  2515.  
  2516.      It is not possible to use this command on pseudo files.
  2517.  
  2518. COMPATIBILITY
  2519.      XEDIT: N/A
  2520.      KEDIT: Compatible.
  2521.  
  2522. SEE ALSO
  2523.      <SET FPATH>, <SET FNAME>, <SET FEXT>, <SET FMODE>
  2524.  
  2525. STATUS
  2526.      Complete.
  2527. **man-end**********************************************************************/
  2528. #ifdef HAVE_PROTO
  2529. short Filename(CHARTYPE *params)
  2530. #else
  2531. short Filename(params)
  2532. CHARTYPE *params;
  2533. #endif
  2534. /***********************************************************************/
  2535. {
  2536. /*-------------------------- external data ----------------------------*/
  2537.  extern CHARTYPE sp_fname[MAX_FILE_NAME+1];
  2538.  extern CHARTYPE sp_path[MAX_FILE_NAME+1];
  2539.  extern CHARTYPE display_screens;
  2540. /*--------------------------- local data ------------------------------*/
  2541.  CHARTYPE tmp_name[MAX_FILE_NAME+1];
  2542.  short rc=RC_OK;
  2543.  int i=0,cnt=0,len_params=0;
  2544. /*--------------------------- processing ------------------------------*/
  2545. #ifdef TRACE
  2546.  trace_function("commset1.c:Filename");
  2547. #endif
  2548. /*
  2549.  * Must supply a parameter...
  2550.  */
  2551.  if (blank_field(params))
  2552.    {
  2553.     display_error(3,(CHARTYPE *)"",FALSE);
  2554. #ifdef TRACE
  2555.     trace_return();
  2556. #endif
  2557.     return(RC_INVALID_OPERAND);
  2558.    }
  2559. /*
  2560.  * If a pseudo file is being changed, then error...
  2561.  */
  2562.  if (CURRENT_FILE->pseudo_file)
  2563.    {
  2564.     display_error(8,(CHARTYPE *)"",FALSE);
  2565. #ifdef TRACE
  2566.     trace_return();
  2567. #endif
  2568.     return(RC_INVALID_OPERAND);
  2569.    }
  2570. /*
  2571.  * If a = is specified...
  2572.  */
  2573.  if (strcmp((DEFCHAR*)"=",(DEFCHAR*)params) == 0)
  2574.    {
  2575. #ifdef TRACE
  2576.     trace_return();
  2577. #endif
  2578.     return(RC_OK);
  2579.    }
  2580. /*
  2581.  * Find out how many = are specified...
  2582.  */
  2583.  len_params = strlen((DEFCHAR*)params);
  2584.  for (i=0,cnt=0;i<len_params;i++)
  2585.    {
  2586.     if (params[i] == '=')
  2587.        cnt++;
  2588.    }
  2589.  if (cnt > 1)
  2590.    {
  2591.     display_error(1,params,FALSE);
  2592. #ifdef TRACE
  2593.     trace_return();
  2594. #endif
  2595.     return(RC_OK);
  2596.    }
  2597. /*
  2598.  * If we do have a leading or trailing = then call the equivalent
  2599.  * SET FEXT or FNAME command...
  2600.  */
  2601.  if (cnt == 1)
  2602.    {
  2603.     if (params[0] == '=')
  2604.       {
  2605.        strcpy((DEFCHAR*)tmp_name,(DEFCHAR*)params+1);
  2606.        rc = Fext(tmp_name);
  2607. #ifdef TRACE
  2608.        trace_return();
  2609. #endif
  2610.        return(rc);
  2611.       }
  2612.     else
  2613.       {
  2614.        if (params[len_params-1] == '=')
  2615.          {
  2616.           strcpy((DEFCHAR*)tmp_name,(DEFCHAR*)params);
  2617.           tmp_name[len_params-1] = '\0';
  2618.           rc = Fname(tmp_name);
  2619. #ifdef TRACE
  2620.           trace_return();
  2621. #endif
  2622.           return(rc);
  2623.          }
  2624.        else
  2625.          {
  2626.           display_error(1,params,FALSE);
  2627. #ifdef TRACE
  2628.           trace_return();
  2629. #endif
  2630.           return(rc);
  2631.          }
  2632.       }
  2633.    }
  2634. /*
  2635.  * To get here, no = was in the parameter...
  2636.  */
  2637.  strcpy((DEFCHAR *)tmp_name,(DEFCHAR *)CURRENT_FILE->fpath);
  2638.  strcat((DEFCHAR *)tmp_name,(DEFCHAR *)params);
  2639.  if ((rc = splitpath(strrmdup(strtrans(tmp_name,OSLASH,ISLASH),ISLASH))) != RC_OK)
  2640.    {
  2641.     display_error(10,tmp_name,FALSE);
  2642. #ifdef TRACE
  2643.     trace_return();
  2644. #endif
  2645.     return(rc);
  2646.    }
  2647. /*
  2648.  * If the resulting path is different to the current one, error.
  2649.  */
  2650.  if (strcmp((DEFCHAR *)sp_path,(DEFCHAR *)CURRENT_FILE->fpath) != 0)
  2651.    {
  2652.     display_error(8,params,FALSE);
  2653. #ifdef TRACE
  2654.     trace_return();
  2655. #endif
  2656.     return(RC_INVALID_OPERAND);
  2657.    }
  2658. /*
  2659.  * If the file name is the same as already assigned, exit...
  2660.  */
  2661.  if (strcmp((DEFCHAR *)sp_fname,(DEFCHAR *)CURRENT_FILE->fname) == 0)
  2662.    {
  2663. #ifdef TRACE
  2664.     trace_return();
  2665. #endif
  2666.     return(RC_OK);
  2667.    }
  2668. /*
  2669.  * If the length of the new filename is > the existing one, 
  2670.  * free up any memory for the existing name and allocate some
  2671.  * more. Save the new name.
  2672.  */
  2673.  if (strlen((DEFCHAR*)sp_fname) > strlen((DEFCHAR*)CURRENT_FILE->fname))
  2674.    {
  2675.     (*the_free)(CURRENT_FILE->fname);
  2676.     if ((CURRENT_FILE->fname = (CHARTYPE *)(*the_malloc)(strlen((DEFCHAR *)sp_fname)+1)) == NULL)
  2677.       {
  2678.        display_error(30,(CHARTYPE *)"",FALSE);
  2679. #ifdef TRACE
  2680.        trace_return();
  2681. #endif
  2682.        return(RC_OUT_OF_MEMORY);
  2683.       }
  2684.    }
  2685.  strcpy((DEFCHAR *)CURRENT_FILE->fname,(DEFCHAR *)sp_fname);
  2686. /*
  2687.  * Re-display the IDLINE
  2688.  */
  2689.  if (display_screens > 1
  2690.  &&  SCREEN_FILE(current_screen) == SCREEN_FILE(other_screen))
  2691.     show_heading(other_screen);
  2692.  show_heading(current_screen);
  2693. #ifdef TRACE
  2694.  trace_return();
  2695. #endif
  2696.  return(rc);
  2697. }
  2698. /*man-start*********************************************************************
  2699. COMMAND
  2700.      set fmode - change the drive letter of the existing file
  2701.  
  2702. SYNTAX
  2703.      [SET] FMode d[:]
  2704.  
  2705. DESCRIPTION
  2706.      The SET FMode command allows the user to change the drive letter
  2707.      of the file currently being edited.
  2708.  
  2709.      This command is only valid under the DOS, OS/2 and Windows ports.
  2710.  
  2711.      See <SET FILENAME> for a full explanation of THE's definitions
  2712.      of fpath, filename, fname, fext and fmode.
  2713.  
  2714.      It is not possible to use this command on pseudo files.
  2715.  
  2716. COMPATIBILITY
  2717.      XEDIT: N/A
  2718.      KEDIT: Compatible
  2719.  
  2720. SEE ALSO
  2721.      <SET FNAME>, <SET FILENAME>, <SET FEXT>, <SET FPATH>
  2722.  
  2723. STATUS
  2724.      Complete.
  2725. **man-end**********************************************************************/
  2726. #ifdef HAVE_PROTO
  2727. short Fmode(CHARTYPE *params)
  2728. #else
  2729. short Fmode(params)
  2730. CHARTYPE *params;
  2731. #endif
  2732. /***********************************************************************/
  2733. {
  2734. /*-------------------------- external data ----------------------------*/
  2735.  extern CHARTYPE sp_fname[MAX_FILE_NAME+1];
  2736.  extern CHARTYPE sp_path[MAX_FILE_NAME+1];
  2737.  extern CHARTYPE display_screens;
  2738. /*--------------------------- local data ------------------------------*/
  2739.  CHARTYPE tmp_name[MAX_FILE_NAME+1];
  2740.  short rc=RC_OK;
  2741.  int len=0;
  2742.  int len_params=0;
  2743. /*--------------------------- processing ------------------------------*/
  2744. #ifdef TRACE
  2745.  trace_function("commset1.c:Fmode");
  2746. #endif
  2747. /*
  2748.  * Not valid for Unix...
  2749.  */
  2750. #ifdef UNIX
  2751.  display_error(82,(CHARTYPE *)"",FALSE);
  2752. #ifdef TRACE
  2753.  trace_return();
  2754. #endif
  2755.  return(RC_INVALID_OPERAND);
  2756. #endif
  2757. /*
  2758.  * Must supply a parameter...
  2759.  */
  2760.  if (blank_field(params))
  2761.    {
  2762.     display_error(3,(CHARTYPE *)"",FALSE);
  2763. #ifdef TRACE
  2764.     trace_return();
  2765. #endif
  2766.     return(RC_INVALID_OPERAND);
  2767.    }
  2768. /*
  2769.  * If a pseudo file is being changed, then error...
  2770.  */
  2771.  if (CURRENT_FILE->pseudo_file)
  2772.    {
  2773.     display_error(8,(CHARTYPE *)"",FALSE);
  2774. #ifdef TRACE
  2775.     trace_return();
  2776. #endif
  2777.     return(RC_INVALID_OPERAND);
  2778.    }
  2779. /*
  2780.  * The only valid parameter is an alphabetic with an optional
  2781.  * ':'
  2782.  */
  2783.  len_params = strlen((DEFCHAR*)params);
  2784.  if (len_params > 2
  2785.  || !isalpha(*params)
  2786.  || (len_params == 2
  2787.    && *params != ':'))
  2788.    {
  2789.     display_error(1,params,FALSE);
  2790. #ifdef TRACE
  2791.     trace_return();
  2792. #endif
  2793.     return(RC_INVALID_OPERAND);
  2794.    }
  2795.  strcpy((DEFCHAR*)tmp_name,(DEFCHAR*)CURRENT_FILE->fpath);
  2796.  memcpy((DEFCHAR*)tmp_name,(DEFCHAR*)params,len_params);
  2797. /*
  2798.  * Split the new path supplied...
  2799.  */
  2800.  if ((rc = splitpath(strrmdup(strtrans(tmp_name,OSLASH,ISLASH),ISLASH))) != RC_OK)
  2801.    {
  2802.     display_error(10,tmp_name,FALSE);
  2803. #ifdef TRACE
  2804.     trace_return();
  2805. #endif
  2806.     return(rc);
  2807.    }
  2808. /*
  2809.  * If a filename results, then the path name specified would conflict
  2810.  * with an existing file.
  2811.  */
  2812.  if (!blank_field(sp_fname))
  2813.    {
  2814.     display_error(8,params,FALSE);
  2815. #ifdef TRACE
  2816.     trace_return();
  2817. #endif
  2818.     return(RC_INVALID_OPERAND);
  2819.    }
  2820. /*
  2821.  * If the path is the same as already assigned, exit...
  2822.  */
  2823.  if (strcmp((DEFCHAR *)sp_path,(DEFCHAR *)CURRENT_FILE->fpath) == 0)
  2824.    {
  2825. #ifdef TRACE
  2826.     trace_return();
  2827. #endif
  2828.     return(RC_OK);
  2829.    }
  2830. /*
  2831.  * If the length of the new path is > the existing one,
  2832.  * free up any memory for the existing path and allocate some
  2833.  * more. Save the new path.
  2834.  */
  2835.  if (strlen((DEFCHAR*)sp_path) > strlen((DEFCHAR*)CURRENT_FILE->fpath))
  2836.    {
  2837.     (*the_free)(CURRENT_FILE->fpath);
  2838.     if ((CURRENT_FILE->fpath = (CHARTYPE *)(*the_malloc)(strlen((DEFCHAR *)sp_path))) == NULL)
  2839.       {
  2840.        display_error(30,(CHARTYPE *)"",FALSE);
  2841. #ifdef TRACE
  2842.        trace_return();
  2843. #endif
  2844.        return(RC_OUT_OF_MEMORY);
  2845.       }
  2846.    }
  2847.  strcpy((DEFCHAR *)CURRENT_FILE->fpath,(DEFCHAR *)sp_path);
  2848. /*
  2849.  * Re-display the IDLINE
  2850.  */
  2851.  if (display_screens > 1
  2852.  &&  SCREEN_FILE(current_screen) == SCREEN_FILE(other_screen))
  2853.     show_heading(other_screen);
  2854.  show_heading(current_screen);
  2855. #ifdef TRACE
  2856.  trace_return();
  2857. #endif
  2858.  return(rc);
  2859. }
  2860. /*man-start*********************************************************************
  2861. COMMAND
  2862.      set fname - change the filename of the file being edited
  2863.  
  2864. SYNTAX
  2865.      [SET] FName filename
  2866.  
  2867. DESCRIPTION
  2868.      The SET FNAME command allows the user to change the fname of
  2869.      the file currently being edited.
  2870.  
  2871.      See <SET FILENAME> for a full explanation of THE's definitions
  2872.      of fpath, filename, fname, fext and fmode.
  2873.  
  2874.      A limited amount of validation of the resulting file name is
  2875.      carried out by this command, but some errors in the file name
  2876.      will not be evident until the file is saved.
  2877.  
  2878.      It is not possible to use this command on pseudo files.
  2879.  
  2880. COMPATIBILITY
  2881.      XEDIT: N/A
  2882.      KEDIT: Compatible.
  2883.  
  2884. SEE ALSO
  2885.      <SET FPATH>, <SET FILENAME>, <SET FEXT>, <SET FMODE>
  2886.  
  2887. STATUS
  2888.      Complete.
  2889. **man-end**********************************************************************/
  2890. #ifdef HAVE_PROTO
  2891. short Fname(CHARTYPE *params)
  2892. #else
  2893. short Fname(params)
  2894. CHARTYPE *params;
  2895. #endif
  2896. /***********************************************************************/
  2897. {
  2898. /*-------------------------- external data ----------------------------*/
  2899.  extern CHARTYPE sp_fname[MAX_FILE_NAME+1];
  2900.  extern CHARTYPE sp_path[MAX_FILE_NAME+1];
  2901.  extern CHARTYPE display_screens;
  2902. /*--------------------------- local data ------------------------------*/
  2903.  CHARTYPE tmp_name[MAX_FILE_NAME+1];
  2904.  short rc=RC_OK;
  2905.  int last_period=0;
  2906. /*--------------------------- processing ------------------------------*/
  2907. #ifdef TRACE
  2908.  trace_function("commset1.c:Fname");
  2909. #endif
  2910. /*
  2911.  * Must supply a parameter...
  2912.  */
  2913.  if (blank_field(params))
  2914.    {
  2915.     display_error(3,(CHARTYPE *)"",FALSE);
  2916. #ifdef TRACE
  2917.     trace_return();
  2918. #endif
  2919.     return(RC_INVALID_OPERAND);
  2920.    }
  2921. /*
  2922.  * If a pseudo file is being changed, then error...
  2923.  */
  2924.  if (CURRENT_FILE->pseudo_file)
  2925.    {
  2926.     display_error(8,(CHARTYPE *)"",FALSE);
  2927. #ifdef TRACE
  2928.     trace_return();
  2929. #endif
  2930.     return(RC_INVALID_OPERAND);
  2931.    }
  2932.  strcpy((DEFCHAR *)tmp_name,(DEFCHAR *)CURRENT_FILE->fpath);
  2933.  last_period = strzreveq(CURRENT_FILE->fname,(CHARTYPE)'.');
  2934.  if (last_period == (-1)) /* no period */
  2935.    {
  2936.     strcat((DEFCHAR*)tmp_name,(DEFCHAR*)params);
  2937.    }
  2938.  else
  2939.    {
  2940.     int len=strlen((DEFCHAR*)CURRENT_FILE->fpath);
  2941.     int lenext=strlen((DEFCHAR*)CURRENT_FILE->fname)-last_period;
  2942.     strcat((DEFCHAR*)tmp_name,(DEFCHAR*)CURRENT_FILE->fname+last_period);
  2943.     meminsmem(tmp_name,params,strlen((DEFCHAR*)params),len,MAX_FILE_NAME+1,
  2944.               len+lenext+1);
  2945.    }
  2946.  
  2947. /*
  2948.  * Split the new path supplied...
  2949.  */
  2950.  if ((rc = splitpath(strrmdup(strtrans(tmp_name,OSLASH,ISLASH),ISLASH))) != RC_OK)
  2951.    {
  2952.     display_error(10,tmp_name,FALSE);
  2953. #ifdef TRACE
  2954.     trace_return();
  2955. #endif
  2956.     return(rc);
  2957.    }
  2958. /*
  2959.  * If the resulting path is different to the current one, error.
  2960.  */
  2961.  if (strcmp((DEFCHAR *)sp_path,(DEFCHAR *)CURRENT_FILE->fpath) != 0)
  2962.    {
  2963.     display_error(8,params,FALSE);
  2964. #ifdef TRACE
  2965.     trace_return();
  2966. #endif
  2967.     return(RC_INVALID_OPERAND);
  2968.    }
  2969. /*
  2970.  * If the file name is the same as already assigned, exit...
  2971.  */
  2972.  if (strcmp((DEFCHAR *)sp_fname,(DEFCHAR *)CURRENT_FILE->fname) == 0)
  2973.    {
  2974. #ifdef TRACE
  2975.     trace_return();
  2976. #endif
  2977.     return(RC_OK);
  2978.    }
  2979. /*
  2980.  * If the length of the new path is > the existing one,
  2981.  * free up any memory for the existing path and allocate some
  2982.  * more. Save the new path.
  2983.  */
  2984.  if (strlen((DEFCHAR*)sp_fname) > strlen((DEFCHAR*)CURRENT_FILE->fname))
  2985.    {
  2986.     (*the_free)(CURRENT_FILE->fname);
  2987.     if ((CURRENT_FILE->fname = (CHARTYPE *)(*the_malloc)(strlen((DEFCHAR *)sp_fname))) == NULL)
  2988.       {
  2989.        display_error(30,(CHARTYPE *)"",FALSE);
  2990. #ifdef TRACE
  2991.        trace_return();
  2992. #endif
  2993.        return(RC_OUT_OF_MEMORY);
  2994.       }
  2995.    }
  2996.  strcpy((DEFCHAR *)CURRENT_FILE->fname,(DEFCHAR *)sp_fname);
  2997. /*
  2998.  * Re-display the IDLINE
  2999.  */
  3000.  if (display_screens > 1
  3001.  &&  SCREEN_FILE(current_screen) == SCREEN_FILE(other_screen))
  3002.     show_heading(other_screen);
  3003.  show_heading(current_screen);
  3004. #ifdef TRACE
  3005.  trace_return();
  3006. #endif
  3007.  return(rc);
  3008. }
  3009. /*man-start*********************************************************************
  3010. COMMAND
  3011.      set fpath - change the path of the existing file
  3012.  
  3013. SYNTAX
  3014.      [SET] FPath path
  3015.  
  3016. DESCRIPTION
  3017.      The SET FPATH command allows the user to change the path of
  3018.      the file currently being edited.
  3019.  
  3020.      The 'path' parameter can be specified with or without the
  3021.      trailing directory seperator.  Under DOS, OS/2 and Windows ports,
  3022.      the drive letter is considered part of the file's path.
  3023.  
  3024.      See <SET FILENAME> for a full explanation of THE's definitions
  3025.      of fpath, filename, fname, fext and fmode.
  3026.  
  3027.      It is not possible to use this command on pseudo files.
  3028.  
  3029. COMPATIBILITY
  3030.      XEDIT: N/A
  3031.      KEDIT: N/A
  3032.  
  3033. SEE ALSO
  3034.      <SET FNAME>, <SET FILENAME>, <SET FEXT>, <SET FMODE>
  3035.  
  3036. STATUS
  3037.      Complete.
  3038. **man-end**********************************************************************/
  3039. #ifdef HAVE_PROTO
  3040. short Fpath(CHARTYPE *params)
  3041. #else
  3042. short Fpath(params)
  3043. CHARTYPE *params;
  3044. #endif
  3045. /***********************************************************************/
  3046. {
  3047. /*-------------------------- external data ----------------------------*/
  3048.  extern CHARTYPE sp_fname[MAX_FILE_NAME+1];
  3049.  extern CHARTYPE sp_path[MAX_FILE_NAME+1];
  3050.  extern CHARTYPE display_screens;
  3051. /*--------------------------- local data ------------------------------*/
  3052.  short rc=RC_OK;
  3053.  int len=0;
  3054. /*--------------------------- processing ------------------------------*/
  3055. #ifdef TRACE
  3056.  trace_function("commset1.c:Fpath");
  3057. #endif
  3058. /*
  3059.  * Must supply a parameter...
  3060.  */
  3061.  if (blank_field(params))
  3062.    {
  3063.     display_error(3,(CHARTYPE *)"",FALSE);
  3064. #ifdef TRACE
  3065.     trace_return();
  3066. #endif
  3067.     return(RC_INVALID_OPERAND);
  3068.    }
  3069. /*
  3070.  * If a pseudo file is being changed, then error...
  3071.  */
  3072.  if (CURRENT_FILE->pseudo_file)
  3073.    {
  3074.     display_error(8,(CHARTYPE *)"",FALSE);
  3075. #ifdef TRACE
  3076.     trace_return();
  3077. #endif
  3078.     return(RC_INVALID_OPERAND);
  3079.    }
  3080. /*
  3081.  * Split the new path supplied...
  3082.  */
  3083.  if ((rc = splitpath(strrmdup(strtrans(params,OSLASH,ISLASH),ISLASH))) != RC_OK)
  3084.    {
  3085.     display_error(10,params,FALSE);
  3086. #ifdef TRACE
  3087.     trace_return();
  3088. #endif
  3089.     return(rc);
  3090.    }
  3091. /*
  3092.  * If a filename results, then the path name specified would conflict
  3093.  * with an existing file.
  3094.  */
  3095.  if (!blank_field(sp_fname))
  3096.    {
  3097.     display_error(8,params,FALSE);
  3098. #ifdef TRACE
  3099.     trace_return();
  3100. #endif
  3101.     return(RC_INVALID_OPERAND);
  3102.    }
  3103. /*
  3104.  * If the path is the same as already assigned, exit...
  3105.  */
  3106.  if (strcmp((DEFCHAR *)sp_path,(DEFCHAR *)CURRENT_FILE->fpath) == 0)
  3107.    {
  3108. #ifdef TRACE
  3109.     trace_return();
  3110. #endif
  3111.     return(RC_OK);
  3112.    }
  3113. /*
  3114.  * If the length of the new path is > the existing one,
  3115.  * free up any memory for the existing path and allocate some
  3116.  * more. Save the new path.
  3117.  */
  3118.  if (strlen((DEFCHAR*)sp_path) > strlen((DEFCHAR*)CURRENT_FILE->fpath))
  3119.    {
  3120.     (*the_free)(CURRENT_FILE->fpath);
  3121.     if ((CURRENT_FILE->fpath = (CHARTYPE *)(*the_malloc)(strlen((DEFCHAR *)sp_path))) == NULL)
  3122.       {
  3123.        display_error(30,(CHARTYPE *)"",FALSE);
  3124. #ifdef TRACE
  3125.        trace_return();
  3126. #endif
  3127.        return(RC_OUT_OF_MEMORY);
  3128.       }
  3129.    }
  3130.  strcpy((DEFCHAR *)CURRENT_FILE->fpath,(DEFCHAR *)sp_path);
  3131. /*
  3132.  * Re-display the IDLINE
  3133.  */
  3134.  if (display_screens > 1
  3135.  &&  SCREEN_FILE(current_screen) == SCREEN_FILE(other_screen))
  3136.     show_heading(other_screen);
  3137.  show_heading(current_screen);
  3138. #ifdef TRACE
  3139.  trace_return();
  3140. #endif
  3141.  return(rc);
  3142. }
  3143. /*man-start*********************************************************************
  3144. COMMAND
  3145.      set fullfname - specify if complete filename to be displayed
  3146.  
  3147. SYNTAX
  3148.      [SET] FULLFName ON|OFF
  3149.  
  3150. DESCRIPTION
  3151.      The SET FULLFNAME command allows the user to determine if the
  3152.      fully qualified filename is displayed on the IDLINE or just the
  3153.      filename that the user entered.
  3154.  
  3155. COMPATIBILITY
  3156.      XEDIT: N/A
  3157.      KEDIT: N/A
  3158.  
  3159. DEFAULT
  3160.      ON
  3161.  
  3162. STATUS
  3163.      Complete.
  3164. **man-end**********************************************************************/
  3165. #ifdef HAVE_PROTO
  3166. short Fullfname(CHARTYPE *params)
  3167. #else
  3168. short Fullfname(params)
  3169. CHARTYPE *params;
  3170. #endif
  3171. /***********************************************************************/
  3172. {
  3173. /*------------------------- external date -----------------------------*/
  3174.  extern CHARTYPE display_screens;
  3175. /*--------------------------- local data ------------------------------*/
  3176.  short rc=RC_OK;
  3177. /*--------------------------- processing ------------------------------*/
  3178. #ifdef TRACE
  3179.  trace_function("commset1.c:Fullfname");
  3180. #endif
  3181.  rc = execute_set_on_off(params,&CURRENT_FILE->display_actual_filename);
  3182.  if (display_screens > 1
  3183.  &&  SCREEN_FILE(current_screen) == SCREEN_FILE(other_screen))
  3184.     show_heading(other_screen);
  3185.  show_heading(current_screen);
  3186. #ifdef TRACE
  3187.  trace_return();
  3188. #endif
  3189.  return(rc);
  3190. }
  3191. /*man-start*********************************************************************
  3192. COMMAND
  3193.      set hex - set how hexadecimal strings are treated in string operands
  3194.  
  3195. SYNTAX
  3196.      [SET] HEX ON|OFF
  3197.  
  3198. DESCRIPTION
  3199.      The SET HEX set command determines whether hexadecimal strings are
  3200.      treated as such in string operands.
  3201.  
  3202.      With the 'ON' option, any string operand of the form
  3203.         /x'31 32 33'/ or
  3204.         /d'49 50 51'/
  3205.      will be converted to /123/ before the command is executed.
  3206.  
  3207.      With the 'OFF' option, no conversion is done.
  3208.  
  3209.      This conversion should work wherever a string operand is used
  3210.      in any command.
  3211.  
  3212. COMPATIBILITY
  3213.      XEDIT: Adds support for decimal representation. See below.
  3214.      KEDIT: Compatible. See below.
  3215.      Spaces must seperate each character representation.
  3216.  
  3217. DEFAULT
  3218.      OFF
  3219.  
  3220. STATUS
  3221.      Complete.
  3222. **man-end**********************************************************************/
  3223. #ifdef HAVE_PROTO
  3224. short Hex(CHARTYPE *params)
  3225. #else
  3226. short Hex(params)
  3227. CHARTYPE *params;
  3228. #endif
  3229. /***********************************************************************/
  3230. {
  3231. /*-------------------------- external data ----------------------------*/
  3232. /*--------------------------- local data ------------------------------*/
  3233.  short rc=RC_OK;
  3234. /*--------------------------- processing ------------------------------*/
  3235. #ifdef TRACE
  3236.  trace_function("commset1.c:Hex");
  3237. #endif
  3238.  rc = execute_set_on_off(params,&CURRENT_VIEW->hex);
  3239. #ifdef TRACE
  3240.  trace_return();
  3241. #endif
  3242.  return(rc);
  3243. }
  3244. /*man-start*********************************************************************
  3245. COMMAND
  3246.      set hexdisplay - turn on or off display of character under cursor
  3247.  
  3248. SYNTAX
  3249.      [SET] HEXDISPlay ON|OFF
  3250.  
  3251. DESCRIPTION
  3252.      The SET HEXDISPLAY command turns on or off the display of the 
  3253.      character under the cursor on the <status line>.
  3254.  
  3255. COMPATIBILITY
  3256.      XEDIT: N/A
  3257.      KEDIT: Compatible.
  3258.  
  3259. DEFAULT
  3260.      ON
  3261.  
  3262. STATUS
  3263.      Complete
  3264. **man-end**********************************************************************/
  3265. #ifdef HAVE_PROTO
  3266. short Hexdisplay(CHARTYPE *params)
  3267. #else
  3268. short Hexdisplay(params)
  3269. CHARTYPE *params;
  3270. #endif
  3271. /***********************************************************************/
  3272. {
  3273. /*-------------------------- external data ----------------------------*/
  3274.  extern bool HEXDISPLAYx;
  3275.  extern bool curses_started;
  3276. /*--------------------------- local data ------------------------------*/
  3277.  short rc=RC_OK;
  3278. /*--------------------------- processing ------------------------------*/
  3279. #ifdef TRACE
  3280.  trace_function("commset1.c:Hexdisplay");
  3281. #endif
  3282.  rc = execute_set_on_off(params,&HEXDISPLAYx);
  3283.  if (rc == RC_OK
  3284.  &&  curses_started)
  3285.     clear_statarea();
  3286. #ifdef TRACE
  3287.  trace_return();
  3288. #endif
  3289.  return(rc);
  3290. }
  3291. /*man-start*********************************************************************
  3292. COMMAND
  3293.      set hexshow - turn on or off hex display of current line
  3294.  
  3295. SYNTAX
  3296.      [SET] HEXShow ON|OFF [M[+n|-n]|[+|-]n]
  3297.  
  3298. DESCRIPTION
  3299.      The SET HEXShow command indicates if and where a hexadecimal
  3300.      representation of the <current line> will be displayed.
  3301.  
  3302.      The first form of parameters is:
  3303.  
  3304.      M[+n|-n] 
  3305.      this sets the hexshow line to be relative to the middle of
  3306.      the screen. A positive value adds to the middle line number, 
  3307.      a negative subtracts from it.
  3308.      eg. M+3 on a 24 line screen will be line 15
  3309.          M-5 on a 24 line screen will be line 7
  3310.  
  3311.      The second form of parameters is:
  3312.  
  3313.      [+|-]n
  3314.      this sets the hexshow line to be relative to the top of the
  3315.      screen (if positive or no sign) or relative to the bottom 
  3316.      of the screen if negative.
  3317.      eg. +3 or 3 will set current line to line 3
  3318.          -3 on a 24 line screen will be line 21
  3319.  
  3320.      If the resulting line is outside the bounds of the screen
  3321.      the position of the hexshow line will become the middle line
  3322.      on the screen.
  3323.  
  3324.      The position argument specifies the position of the first line
  3325.      of the hexadecimal display.
  3326.  
  3327.      It is an error to try to position the HEXSHOW lines on the same
  3328.      line as <SET CURLINE>.
  3329.  
  3330. COMPATIBILITY
  3331.      XEDIT: N/A
  3332.      KEDIT: N/A
  3333.  
  3334. DEFAULT
  3335.      OFF 7
  3336.  
  3337. STATUS
  3338.      Complete
  3339. **man-end**********************************************************************/
  3340. #ifdef HAVE_PROTO
  3341. short Hexshow(CHARTYPE *params)
  3342. #else
  3343. short Hexshow(params)
  3344. CHARTYPE *params;
  3345. #endif
  3346. /***********************************************************************/
  3347. {
  3348. /*-------------------------- external data ----------------------------*/
  3349. /*--------------------------- local data ------------------------------*/
  3350. #define HEXS_PARAMS  2
  3351.  CHARTYPE *word[HEXS_PARAMS+1];
  3352.  CHARTYPE strip[HEXS_PARAMS];
  3353.  short num_params=0;
  3354.  short rc=RC_OK;
  3355.  short base=(short)CURRENT_VIEW->hexshow_base;
  3356.  short off=CURRENT_VIEW->hexshow_off;
  3357.  bool hexshowsts=FALSE;
  3358. /*--------------------------- processing ------------------------------*/
  3359. #ifdef TRACE
  3360.  trace_function("commset1.c:Hexshow");
  3361. #endif
  3362.  strip[0]=STRIP_BOTH;
  3363.  strip[1]=STRIP_BOTH;
  3364.  num_params = param_split(params,word,HEXS_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  3365.  if (num_params < 1)
  3366.    {
  3367.     display_error(3,(CHARTYPE *)"",FALSE);
  3368. #ifdef TRACE
  3369.     trace_return();
  3370. #endif
  3371.     return(RC_INVALID_OPERAND);
  3372.    }
  3373. /*---------------------------------------------------------------------*/
  3374. /* Parse the status parameter...                                       */
  3375. /*---------------------------------------------------------------------*/
  3376.  rc = execute_set_on_off(word[0],&hexshowsts);
  3377.  if (rc != RC_OK)
  3378.    {
  3379. #ifdef TRACE
  3380.     trace_return();
  3381. #endif
  3382.     return(rc);
  3383.    }
  3384. /*---------------------------------------------------------------------*/
  3385. /* Parse the position parameter...                                     */
  3386. /*---------------------------------------------------------------------*/
  3387.  if (num_params > 1)
  3388.    {
  3389.     rc = execute_set_row_position(word[1],&base,&off);
  3390.     if (rc != RC_OK)
  3391.       {
  3392. #ifdef TRACE
  3393.        trace_return();
  3394. #endif
  3395.        return(rc);
  3396.       }
  3397.    }
  3398. /*---------------------------------------------------------------------*/
  3399. /* If the HEXSHOW row (or the next row) is the same row as CURLINE and */
  3400. /* it is being turned on, return ERROR.                                */
  3401. /*---------------------------------------------------------------------*/
  3402.  if ((calculate_actual_row(CURRENT_VIEW->current_base,
  3403.                           CURRENT_VIEW->current_off,
  3404.                           CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE) ==
  3405.      calculate_actual_row(base,off,CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE)
  3406.      || calculate_actual_row(CURRENT_VIEW->current_base,
  3407.                              CURRENT_VIEW->current_off,
  3408.                              CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE) ==
  3409.         calculate_actual_row(base,off,CURRENT_SCREEN.rows[WINDOW_FILEAREA],TRUE) + 1)
  3410.  && hexshowsts)
  3411.    {
  3412.     display_error(64,(CHARTYPE *)"- same line as CURLINE",FALSE);
  3413. #ifdef TRACE
  3414.     trace_return();
  3415. #endif
  3416.     return(RC_INVALID_ENVIRON);
  3417.    }
  3418.  CURRENT_VIEW->hexshow_base = (CHARTYPE)base;
  3419.  CURRENT_VIEW->hexshow_off = off;
  3420.  CURRENT_VIEW->hexshow_on = hexshowsts;
  3421.  post_process_line(CURRENT_VIEW,CURRENT_VIEW->focus_line,(LINE *)NULL,TRUE);
  3422.  build_screen(current_screen); 
  3423.  display_screen(current_screen);
  3424. #ifdef TRACE
  3425.  trace_return();
  3426. #endif
  3427.  return(rc);
  3428. }
  3429. /*man-start*********************************************************************
  3430. COMMAND
  3431.      set highlight - specify which lines (if any) are to be highlighted
  3432.  
  3433. SYNTAX
  3434.      [SET] HIGHlight OFF|TAGged|ALTered|SELect n [m]
  3435.  
  3436. DESCRIPTION
  3437.      The SET HIGHLIGHT command allows for the user to specify which
  3438.      lines are to be displayed in the highlighted colour.
  3439.  
  3440.      'OFF' turns all highlighting display off
  3441.  
  3442.      'TAGGED' displays all lines tagged in highlight colour.
  3443.  
  3444.      'ALTERED' displays all lines that have been added or
  3445.      changed in the current session in the highlight colour.
  3446.  
  3447.      'SELECT n [m]' displays all lines with the specified selection
  3448.      level in highlight colour.
  3449.  
  3450.  
  3451. COMPATIBILITY
  3452.      XEDIT: N/A
  3453.      KEDIT: Compatible
  3454.  
  3455. DEFAULT
  3456.      OFF
  3457.  
  3458. SEE ALSO
  3459.      <SET SELECT>, TAG
  3460.  
  3461. STATUS
  3462.      Incomplete. No support for TAGGED lines.
  3463. **man-end**********************************************************************/
  3464. #ifdef HAVE_PROTO
  3465. short Highlight(CHARTYPE *params)
  3466. #else
  3467. short Highlight(params)
  3468. CHARTYPE *params;
  3469. #endif
  3470. /***********************************************************************/
  3471. {
  3472. /*-------------------------- external data ----------------------------*/
  3473. /*--------------------------- local data ------------------------------*/
  3474. #define HIGH_PARAMS  2
  3475.  CHARTYPE *word[HIGH_PARAMS+1];
  3476.  CHARTYPE strip[HIGH_PARAMS];
  3477.  short num_params=0;
  3478.  short col1=0,col2=0;
  3479.  short rc=RC_OK;
  3480. /*--------------------------- processing ------------------------------*/
  3481. #ifdef TRACE
  3482.  trace_function("commset1.c:Highlight");
  3483. #endif
  3484.  strip[0]=STRIP_BOTH;
  3485.  strip[1]=STRIP_BOTH;
  3486.  num_params = param_split(params,word,HIGH_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  3487.  if (num_params < 1)
  3488.    {
  3489.     display_error(3,(CHARTYPE *)"",FALSE);
  3490. #ifdef TRACE
  3491.     trace_return();
  3492. #endif
  3493.     return(RC_INVALID_OPERAND);
  3494.    }
  3495.  switch (num_params)
  3496.    {
  3497.     case 1:
  3498.          if (equal((CHARTYPE *)"OFF",word[0],3))
  3499.            {
  3500.             CURRENT_VIEW->highlight = HIGHLIGHT_NONE;
  3501.             break;
  3502.            }
  3503.          if (equal((CHARTYPE *)"TAGGED",word[0],3))
  3504.            {
  3505.             CURRENT_VIEW->highlight = HIGHLIGHT_TAG;
  3506.             break;
  3507.            }
  3508.          if (equal((CHARTYPE *)"ALTERED",word[0],3))
  3509.            {
  3510.             CURRENT_VIEW->highlight = HIGHLIGHT_ALT;
  3511.             break;
  3512.            }
  3513.          display_error(1,word[0],FALSE);
  3514.          rc = RC_INVALID_OPERAND;
  3515.          break;
  3516.     case 2:
  3517.     case 3:
  3518.          if (!equal((CHARTYPE *)"SELECT",word[0],3))
  3519.            {
  3520.             display_error(1,word[0],FALSE);
  3521. #ifdef TRACE
  3522.             trace_return();
  3523. #endif
  3524.             return(RC_INVALID_OPERAND);
  3525.            }
  3526.          if ((rc = validate_n_m(word[1],&col1,&col2)) != RC_OK)
  3527.            {
  3528. #ifdef TRACE
  3529.             trace_return();
  3530. #endif
  3531.             return(rc);
  3532.            }
  3533.          CURRENT_VIEW->highlight = HIGHLIGHT_SELECT;
  3534.          CURRENT_VIEW->highlight_low = col1;
  3535.          CURRENT_VIEW->highlight_high = col2;
  3536.          break;
  3537.     default:
  3538.          display_error(1,word[0],FALSE);
  3539.          rc = RC_INVALID_OPERAND;
  3540.          break;
  3541.   }
  3542.  if (rc == RC_OK)
  3543.    {
  3544.     build_screen(current_screen); 
  3545.     display_screen(current_screen);
  3546.    }
  3547. #ifdef TRACE
  3548.  trace_return();
  3549. #endif
  3550.  return(rc);
  3551. }
  3552. /*man-start*********************************************************************
  3553. COMMAND
  3554.      set idline - specify if IDLINE is displayed
  3555.  
  3556. SYNTAX
  3557.      [SET] IDline ON|OFF
  3558.  
  3559. DESCRIPTION
  3560.      The SET IDLINE set command determines if the <idline> for a file is
  3561.      displayed or not.
  3562.  
  3563. COMPATIBILITY
  3564.      XEDIT: N/A
  3565.      KEDIT: Compatible.
  3566.  
  3567. DEFAULT
  3568.      ON
  3569.  
  3570. STATUS
  3571.      Complete
  3572. **man-end**********************************************************************/
  3573. #ifdef HAVE_PROTO
  3574. short Idline(CHARTYPE *params)
  3575. #else
  3576. short Idline(params)
  3577. CHARTYPE *params;
  3578. #endif
  3579. /***********************************************************************/
  3580. {
  3581. /*-------------------------- external data ----------------------------*/
  3582.  extern bool curses_started;
  3583. /*--------------------------- local data ------------------------------*/
  3584.  short rc=RC_OK;
  3585.  bool save_id_line=FALSE;
  3586. /*--------------------------- processing ------------------------------*/
  3587. #ifdef TRACE
  3588.  trace_function("commset1.c:Idline");
  3589. #endif
  3590.  save_id_line = CURRENT_VIEW->id_line;
  3591.  rc = execute_set_on_off(params,&CURRENT_VIEW->id_line);
  3592.  if (rc != RC_OK)
  3593.    {
  3594. #ifdef TRACE
  3595.     trace_return();
  3596. #endif
  3597.     return(rc);
  3598.    }
  3599. /*---------------------------------------------------------------------*/
  3600. /* If the new value of id_line is the same as before, exit now.        */
  3601. /*---------------------------------------------------------------------*/
  3602.  if (save_id_line == CURRENT_VIEW->id_line)
  3603.    {
  3604. #ifdef TRACE
  3605.     trace_return();
  3606. #endif
  3607.     return(rc);
  3608.    }
  3609. /*---------------------------------------------------------------------*/
  3610. /* Redefine the screen sizes...                                        */
  3611. /*---------------------------------------------------------------------*/
  3612.  set_screen_defaults();
  3613. /*---------------------------------------------------------------------*/
  3614. /* Recreate windows for the current screen...                          */
  3615. /*---------------------------------------------------------------------*/
  3616.  if (curses_started)
  3617.    {
  3618.     if (set_up_windows(current_screen) != RC_OK)
  3619.       {
  3620. #ifdef TRACE
  3621.        trace_return();
  3622. #endif
  3623.        return(rc);
  3624.       }
  3625.    }
  3626.  build_screen(current_screen);
  3627.  display_screen(current_screen);
  3628. #ifdef TRACE
  3629.  trace_return();
  3630. #endif
  3631.  return(rc);
  3632. }
  3633. /*man-start*********************************************************************
  3634. COMMAND
  3635.      set impcmscp - set implied operating system command processing
  3636.  
  3637. SYNTAX
  3638.      [SET] IMPcmscp ON|OFF
  3639.  
  3640. DESCRIPTION
  3641.      The SET IMPCMSCP command is used to toggle implied operating system
  3642.      command processing from the command line. By turning this feature 
  3643.      on you can then issue an operating system command without the need 
  3644.      to prefix the operating system command with the <OS> command.
  3645.  
  3646. COMPATIBILITY
  3647.      XEDIT: Compatible.
  3648.      KEDIT: N/A
  3649.  
  3650. DEFAULT
  3651.      ON
  3652.  
  3653. SEE ALSO
  3654.      <SET IMPOS>
  3655.  
  3656. STATUS
  3657.      Complete.
  3658. **man-end**********************************************************************/
  3659.  
  3660. /*man-start*********************************************************************
  3661. COMMAND
  3662.      set impmacro - set implied macro command processing
  3663.  
  3664. SYNTAX
  3665.      [SET] IMPMACro ON|OFF
  3666.  
  3667. DESCRIPTION
  3668.      The SET IMPMACRO command is used to toggle implied macro processing
  3669.      from the command line. By turning this feature on you can then
  3670.      issue a <macro> command without the need to prefix the macro name
  3671.      with the <MACRO> command.
  3672.  
  3673. COMPATIBILITY
  3674.      XEDIT: N/A
  3675.      KEDIT: Compatible.
  3676.  
  3677. DEFAULT
  3678.      ON
  3679.  
  3680. SEE ALSO
  3681.      <MACRO>, <SET MACROPATH>
  3682.  
  3683. STATUS
  3684.      Complete.
  3685. **man-end**********************************************************************/
  3686. #ifdef HAVE_PROTO
  3687. short Impmacro(CHARTYPE *params)
  3688. #else
  3689. short Impmacro(params)
  3690. CHARTYPE *params;
  3691. #endif
  3692. /***********************************************************************/
  3693. {
  3694. /*-------------------------- external data ----------------------------*/
  3695. /*--------------------------- local data ------------------------------*/
  3696.  short rc=RC_OK;
  3697. /*--------------------------- processing ------------------------------*/
  3698. #ifdef TRACE
  3699.  trace_function("commset1.c:Impmacro");
  3700. #endif
  3701.  rc = execute_set_on_off(params,&CURRENT_VIEW->imp_macro);
  3702. #ifdef TRACE
  3703.  trace_return();
  3704. #endif
  3705.  return(rc);
  3706. }
  3707. /*man-start*********************************************************************
  3708. COMMAND
  3709.      set impos - set implied operating system command processing
  3710.  
  3711. SYNTAX
  3712.      [SET] IMPOS ON|OFF
  3713.  
  3714. DESCRIPTION
  3715.      The SET IMPOS command is used to toggle implied operating system
  3716.      command processing from the command line. By turning this feature 
  3717.      on you can then issue an operating system command without the need 
  3718.      to prefix the operating system command with the <OS> command.
  3719.  
  3720. COMPATIBILITY
  3721.      XEDIT: Compatible.
  3722.      KEDIT: N/A
  3723.  
  3724. DEFAULT
  3725.      ON
  3726.  
  3727. SEE ALSO
  3728.      <SET IMPCMSCP>
  3729.  
  3730. STATUS
  3731.      Complete.
  3732. **man-end**********************************************************************/
  3733. #ifdef HAVE_PROTO
  3734. short Impos(CHARTYPE *params)
  3735. #else
  3736. short Impos(params)
  3737. CHARTYPE *params;
  3738. #endif
  3739. /***********************************************************************/
  3740. {
  3741. /*-------------------------- external data ----------------------------*/
  3742. /*--------------------------- local data ------------------------------*/
  3743.  short rc=RC_OK;
  3744. /*--------------------------- processing ------------------------------*/
  3745. #ifdef TRACE
  3746.  trace_function("commset1.c:Impos");
  3747. #endif
  3748.  rc = execute_set_on_off(params,&CURRENT_VIEW->imp_os);
  3749. #ifdef TRACE
  3750.  trace_return();
  3751. #endif
  3752.  return(rc);
  3753. }
  3754. /*man-start*********************************************************************
  3755. COMMAND
  3756.      set inputmode - set input mode behaviour
  3757.  
  3758. SYNTAX
  3759.      [SET] INPUTMode OFF|FUll|LIne
  3760.  
  3761. DESCRIPTION
  3762.      The SET INPUTMODE command changes the way THE handles input.
  3763.  
  3764.      When INPUTMODE LINE is in effect, pressing the ENTER key while
  3765.      in the <filearea> will result in a new line being added.
  3766.  
  3767.      When INPUTMODE OFF is in effect, pressing the ENTER key while
  3768.      in the <filearea> will result in the cursor moving to the
  3769.      beginning of the next line; scrolling the screen if necessary.
  3770.  
  3771.      When INPUTMODE FULL is in effect, pressing the ENTER key while
  3772.      in the <filearea> will result in the cursor moving to the
  3773.      beginning of the next line; scrolling the screen if necessary.
  3774.  
  3775.  
  3776. COMPATIBILITY
  3777.      XEDIT: N/A
  3778.      KEDIT: Compatible.
  3779.  
  3780. DEFAULT
  3781.      LINE
  3782.  
  3783. SEE ALSO
  3784.      <INPUT>
  3785.  
  3786. STATUS
  3787.      Incomplete. No support for FULL option.
  3788. **man-end**********************************************************************/
  3789. #ifdef HAVE_PROTO
  3790. short Inputmode(CHARTYPE *params)
  3791. #else
  3792. short Inputmode(params)
  3793. CHARTYPE *params;
  3794. #endif
  3795. /***********************************************************************/
  3796. {
  3797. /*-------------------------- external data ----------------------------*/
  3798. /*--------------------------- local data ------------------------------*/
  3799. /*--------------------------- processing ------------------------------*/
  3800. #ifdef TRACE
  3801.  trace_function("commset1.c:Inputmode");
  3802. #endif
  3803.  if (equal((CHARTYPE *)"off",params,3))
  3804.     CURRENT_VIEW->inputmode = INPUTMODE_OFF;
  3805.  else
  3806.     if (equal((CHARTYPE *)"full",params,2))
  3807.        CURRENT_VIEW->inputmode = INPUTMODE_FULL;
  3808.     else
  3809.        if (equal((CHARTYPE *)"line",params,2))
  3810.           CURRENT_VIEW->inputmode = INPUTMODE_LINE;
  3811.        else
  3812.          {
  3813.           display_error(1,(CHARTYPE *)params,FALSE);
  3814. #ifdef TRACE
  3815.           trace_return();
  3816. #endif
  3817.           return(RC_INVALID_OPERAND);
  3818.          }
  3819. #ifdef TRACE
  3820.  trace_return();
  3821. #endif
  3822.  return(RC_OK);
  3823. }
  3824. /*man-start*********************************************************************
  3825. COMMAND
  3826.      set insertmode - put editor into or out of insert mode
  3827.  
  3828. SYNTAX
  3829.      [SET] INSERTMode ON|OFF|TOGGLE
  3830.  
  3831. DESCRIPTION
  3832.      The SET INSERTMODE command enable the user to set the insert mode 
  3833.      within THE.
  3834.  
  3835.      The 'TOGGLE' option turns insert mode 'ON' if it is currently
  3836.      'OFF' and vice versa.
  3837.  
  3838. COMPATIBILITY
  3839.      XEDIT: N/A
  3840.      KEDIT: Compatible.
  3841.  
  3842. DEFAULT
  3843.      OFF
  3844.  
  3845. STATUS
  3846.      Complete.
  3847. **man-end**********************************************************************/
  3848. #ifdef HAVE_PROTO
  3849. short Insertmode(CHARTYPE *params)
  3850. #else
  3851. short Insertmode(params)
  3852. CHARTYPE *params;
  3853. #endif
  3854. /***********************************************************************/
  3855. {
  3856. /*-------------------------- external data ----------------------------*/
  3857.  extern bool INSERTMODEx;
  3858.  extern bool curses_started;
  3859. /*--------------------------- local data ------------------------------*/
  3860. /*--------------------------- processing ------------------------------*/
  3861. #ifdef TRACE
  3862.  trace_function("commset1.c:Insertmode");
  3863. #endif
  3864.  if (equal((CHARTYPE *)"off",params,3))
  3865.     INSERTMODEx = FALSE;
  3866.  else
  3867.     if (equal((CHARTYPE *)"on",params,2))
  3868.        INSERTMODEx = TRUE;
  3869.     else
  3870.        if (equal((CHARTYPE *)"toggle",params,6))
  3871.           INSERTMODEx = (INSERTMODEx) ? FALSE : TRUE;
  3872.        else
  3873.          {
  3874.           display_error(1,(CHARTYPE *)params,FALSE);
  3875. #ifdef TRACE
  3876.           trace_return();
  3877. #endif
  3878.           return(RC_INVALID_OPERAND);
  3879.          }
  3880.  if (curses_started)
  3881.     draw_cursor(TRUE);
  3882. #ifdef TRACE
  3883.  trace_return();
  3884. #endif
  3885.  return(RC_OK);
  3886. }
  3887. /*man-start*********************************************************************
  3888. COMMAND
  3889.      set linend - allow/disallow multiple commands on command line
  3890.  
  3891. SYNTAX
  3892.      [SET] LINENd ON|OFF [character]
  3893.  
  3894. DESCRIPTION
  3895.      The SET LINEND command allows or disallows the execution of multiple
  3896.      commands on the <command line>. When setting LINEND ON, a 'character'
  3897.      is specified as the LINEND character which delimits each command.
  3898.  
  3899. COMPATIBILITY
  3900.      XEDIT: Compatible.
  3901.      KEDIT: Compatible.
  3902.  
  3903. DEFAULT
  3904.      OFF #
  3905.  
  3906. STATUS
  3907.      Complete.
  3908. **man-end**********************************************************************/
  3909. #ifdef HAVE_PROTO
  3910. short Linend(CHARTYPE *params)
  3911. #else
  3912. short Linend(params)
  3913. CHARTYPE *params;
  3914. #endif
  3915. /***********************************************************************/
  3916. {
  3917. /*-------------------------- external data ----------------------------*/
  3918. /*--------------------------- local data ------------------------------*/
  3919. #define LE_PARAMS  2
  3920.  CHARTYPE *word[LE_PARAMS+1];
  3921.  CHARTYPE strip[LE_PARAMS];
  3922.  unsigned short num_params=0;
  3923.  bool le_status=CURRENT_VIEW->linend_status;
  3924.  CHARTYPE le_value=CURRENT_VIEW->linend_value;
  3925.  short rc=RC_OK;
  3926. /*--------------------------- processing ------------------------------*/
  3927. #ifdef TRACE
  3928.  trace_function("commset1.c:Linend");
  3929. #endif
  3930.  strip[0]=STRIP_BOTH;
  3931.  strip[1]=STRIP_BOTH;
  3932.  num_params = param_split(params,word,LE_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  3933.  switch(num_params)
  3934.    {
  3935.     case 1:
  3936.     case 2:
  3937.            rc = execute_set_on_off(word[0],&le_status);
  3938.            if (rc != RC_OK)
  3939.              {
  3940.               display_error(1,word[0],FALSE);
  3941.               rc = RC_INVALID_OPERAND;
  3942.               break;
  3943.              }
  3944.            if (num_params == 1)
  3945.               break;
  3946.            if ((int)strlen((DEFCHAR *)word[1]) > (int)1)
  3947.              {
  3948.               display_error(1,word[1],FALSE);
  3949.               break;
  3950.              }
  3951.            le_value = word[1][0];
  3952.            break;
  3953.     case 0:
  3954.            display_error(3,(CHARTYPE *)"",FALSE);
  3955.            rc = RC_INVALID_OPERAND;
  3956.            break;
  3957.     default:
  3958.            display_error(2,(CHARTYPE *)"",FALSE);
  3959.            rc = RC_INVALID_OPERAND;
  3960.            break;
  3961.    }
  3962.  if (rc == RC_OK)
  3963.    {
  3964.     CURRENT_VIEW->linend_status = le_status;
  3965.     CURRENT_VIEW->linend_value = le_value;
  3966.    }
  3967. #ifdef TRACE
  3968.  trace_return();
  3969. #endif
  3970.  return(rc);
  3971. }
  3972. /*man-start*********************************************************************
  3973. COMMAND
  3974.      set macro - indicate if macros executed before commands
  3975.  
  3976. SYNTAX
  3977.      SET MACRO ON|OFF
  3978.  
  3979. DESCRIPTION
  3980.      The SET MACRO command allows the user to determine if macros
  3981.      are executed before a built-in command of the same name.
  3982.  
  3983.      This command MUST be prefixed with <SET> to distinguish it
  3984.      from the <MACRO> command.
  3985.  
  3986.      A macro with the same name as a built-in command will only
  3987.      be executed before the built-in command if <SET IMPMACRO> 
  3988.      is ON, <SET MACRO> is ON, and the command was NOT executed 
  3989.      with the <COMMAND> command.
  3990.  
  3991. COMPATIBILITY
  3992.      XEDIT: Compatible.
  3993.      KEDIT: N/A
  3994.  
  3995. DEFAULT
  3996.      OFF
  3997.  
  3998. SEE ALSO
  3999.      <MACRO>, <SET IMPMACRO>, <COMMAND>
  4000.  
  4001. STATUS
  4002.      Complete.
  4003. **man-end**********************************************************************/
  4004. #ifdef HAVE_PROTO
  4005. short SetMacro(CHARTYPE *params)
  4006. #else
  4007. short SetMacro(params)
  4008. CHARTYPE *params;
  4009. #endif
  4010. /***********************************************************************/
  4011. {
  4012. /*-------------------------- external data ----------------------------*/
  4013. /*--------------------------- local data ------------------------------*/
  4014.  short rc=RC_OK;
  4015. /*--------------------------- processing ------------------------------*/
  4016. #ifdef TRACE
  4017.  trace_function("commset1.c:SetMacro");
  4018. #endif
  4019.  rc = execute_set_on_off(params,&CURRENT_VIEW->macro);
  4020. #ifdef TRACE
  4021.  trace_return();
  4022. #endif
  4023.  return(rc);
  4024. }
  4025. /*man-start*********************************************************************
  4026. COMMAND
  4027.      set macroext - set default macro extension value
  4028.  
  4029. SYNTAX
  4030.      [SET] MACROExt [ext]
  4031.  
  4032. DESCRIPTION
  4033.      The SET MACROEXT command sets the value of the file extension to be
  4034.      used for <macro> files. When a macro file name is specified on the
  4035.      <command line>, a period '.', then this value will be appended.
  4036.      If no value is specified for 'ext', then THE assumes that the
  4037.      supplied macro file name is the fully specified name for a macro.
  4038.  
  4039.      The length of 'ext' must be 10 characters or less.
  4040.  
  4041.      The macro extension is only appended to a file if that file does
  4042.      not include any path specifiers.
  4043.  
  4044. COMPATIBILITY
  4045.      XEDIT: N/A
  4046.      KEDIT: N/A
  4047.  
  4048. DEFAULT
  4049.      the
  4050.  
  4051. STATUS
  4052.      Complete.
  4053. **man-end**********************************************************************/
  4054. #ifdef HAVE_PROTO
  4055. short Macroext(CHARTYPE *params)
  4056. #else
  4057. short Macroext(params)
  4058. CHARTYPE *params;
  4059. #endif
  4060. /***********************************************************************/
  4061. {
  4062. /*-------------------------- external data ----------------------------*/
  4063.  extern CHARTYPE macro_suffix[12];
  4064. /*--------------------------- local data ------------------------------*/
  4065. /*--------------------------- processing ------------------------------*/
  4066. #ifdef TRACE
  4067.  trace_function("commset1.c:Macroext");
  4068. #endif
  4069. /*---------------------------------------------------------------------*/
  4070. /* If no value is specified for ext, set the value of macro_suffix to  */
  4071. /* "", otherwise set it to the supplied value, prefixed with '.'       */
  4072. /*---------------------------------------------------------------------*/
  4073.  if (strlen((DEFCHAR *)params) == 0)
  4074.     strcpy((DEFCHAR *)macro_suffix,"");
  4075.  else
  4076.    {
  4077.     if ((int)strlen((DEFCHAR *)params) > (int)10)
  4078.       {
  4079.        display_error(85,(CHARTYPE *)params,FALSE);
  4080. #ifdef TRACE
  4081.        trace_return();
  4082. #endif
  4083.        return(RC_INVALID_OPERAND);
  4084.       }
  4085.     strcpy((DEFCHAR *)macro_suffix,".");
  4086.     strcat((DEFCHAR *)macro_suffix,(DEFCHAR *)params);
  4087.    }
  4088. #ifdef TRACE
  4089.  trace_return();
  4090. #endif
  4091.  return(RC_OK);
  4092. }
  4093. /*man-start*********************************************************************
  4094. COMMAND
  4095.      set macropath - set default path for macro commands
  4096.  
  4097. SYNTAX
  4098.      [SET] MACROPath path[s]
  4099.  
  4100. DESCRIPTION
  4101.      The SET MACROPATH command sets up the search path from which macro
  4102.      command files are executed. Each directory is seperated by a
  4103.      colon (Unix) or semi-colon (DOS & OS/2). Only 20 directories are
  4104.      allowed to be specified.
  4105.  
  4106. COMPATIBILITY
  4107.      XEDIT: N/A
  4108.      KEDIT: Incompatible.
  4109.  
  4110. DEFAULT
  4111.      Path specified by env variable THE_MACRO_PATH
  4112.  
  4113. SEE ALSO
  4114.      <MACRO>, <SET IMPMACRO>
  4115.  
  4116. STATUS
  4117.      Complete.
  4118. **man-end**********************************************************************/
  4119. #ifdef HAVE_PROTO
  4120. short Macropath(CHARTYPE *params)
  4121. #else
  4122. short Macropath(params)
  4123. CHARTYPE *params;
  4124. #endif
  4125. /***********************************************************************/
  4126. {
  4127. #if defined(UNIX)
  4128. #   define PATH_DELIM ':'
  4129. #else
  4130. #   define PATH_DELIM ';'
  4131. #endif
  4132. /*-------------------------- external data ----------------------------*/
  4133.  extern CHARTYPE the_macro_path[MAX_FILE_NAME+1];
  4134.  extern CHARTYPE the_macro_path_buf[MAX_FILE_NAME+1];
  4135.  extern CHARTYPE *the_macro_dir[MAX_MACRO_DIRS];
  4136.  extern int max_macro_dirs;
  4137. /*--------------------------- local data ------------------------------*/
  4138.  register int i=0,len=0;
  4139.  DEFCHAR *ptr=NULL;
  4140. /*--------------------------- processing ------------------------------*/
  4141. #ifdef TRACE
  4142.  trace_function("commset1.c:Macropath");
  4143. #endif
  4144. /*---------------------------------------------------------------------*/
  4145. /* No checking is done on macro path supplied other than it contains a */
  4146. /* value. Path delimiters are translated if necessary.                 */
  4147. /*---------------------------------------------------------------------*/
  4148.  if (strlen((DEFCHAR *)params) == 0)
  4149.    {
  4150.     display_error(3,(CHARTYPE *)"",FALSE);
  4151. #ifdef TRACE
  4152.     trace_return();
  4153. #endif
  4154.     return(RC_INVALID_OPERAND);
  4155.    }
  4156.  strcpy((DEFCHAR *)the_macro_path_buf,(DEFCHAR *)params);
  4157.  (void *)strrmdup(strtrans(the_macro_path_buf,OSLASH,ISLASH),ISLASH);
  4158.  (void *)strrmdup(the_macro_path_buf,PATH_DELIM);
  4159.  len = strlen((DEFCHAR *)the_macro_path_buf);
  4160.  if (the_macro_path_buf[len-1] == PATH_DELIM)
  4161.    {
  4162.      the_macro_path_buf[len-1] = '\0';
  4163.      len--;
  4164.    }
  4165.  strcpy((DEFCHAR *)the_macro_path,(DEFCHAR *)the_macro_path_buf);
  4166.  the_macro_dir[0] = the_macro_path_buf;
  4167.  max_macro_dirs = 1;
  4168.  for (ptr=the_macro_path_buf; *ptr != '\0'; ptr++)
  4169.    {
  4170.     if (*ptr == PATH_DELIM)
  4171.       {
  4172.        *ptr = '\0';
  4173.        the_macro_dir[max_macro_dirs++] = ++ptr;
  4174.        if (max_macro_dirs > MAX_MACRO_DIRS)
  4175.          {
  4176.           display_error(2,(CHARTYPE *)"More than 20 directories specified",FALSE);
  4177. #ifdef TRACE
  4178.           trace_return();
  4179. #endif
  4180.           return(RC_INVALID_OPERAND);
  4181.          }
  4182.       }
  4183.    }
  4184. #ifdef TRACE
  4185.  trace_return();
  4186. #endif
  4187.  return(RC_OK);
  4188. }
  4189. /*man-start*********************************************************************
  4190. COMMAND
  4191.      set margins - set left and right margins for wordwrap
  4192.  
  4193. SYNTAX
  4194.      [SET] MARgins left right [[+|-]indent]
  4195.  
  4196. DESCRIPTION
  4197.      The SET MARGINS command sets the 'left' and 'right' margins and the
  4198.      number of columns to 'indent' a paragraph.
  4199.  
  4200.      These values are used with the <SET WORDWRAP> option.
  4201.  
  4202. COMPATIBILITY
  4203.      XEDIT: N/A
  4204.      KEDIT: Compatible.
  4205.  
  4206. DEFAULT
  4207.      1 72 +0
  4208.  
  4209. SEE ALSO
  4210.      <SET WORDWRAP>
  4211.  
  4212. STATUS
  4213.      Complete.
  4214. **man-end**********************************************************************/
  4215. #ifdef HAVE_PROTO
  4216. short Margins(CHARTYPE *params)
  4217. #else
  4218. short Margins(params)
  4219. CHARTYPE *params;
  4220. #endif
  4221. /***********************************************************************/
  4222. {
  4223. /*-------------------------- external data ----------------------------*/
  4224.  extern CHARTYPE *temp_cmd;
  4225. /*--------------------------- local data ------------------------------*/
  4226. #define MAR_PARAMS  3
  4227.  CHARTYPE *word[MAR_PARAMS+1];
  4228.  CHARTYPE strip[MAR_PARAMS];
  4229.  short num_params=0;
  4230.  short left=0,right=0,indent=0;
  4231.  bool offset=FALSE,consistancy_error=FALSE;
  4232. /*--------------------------- processing ------------------------------*/
  4233. #ifdef TRACE
  4234.  trace_function("commset1.c:Margins");
  4235. #endif
  4236. /*---------------------------------------------------------------------*/
  4237. /* Two parameters are mandatory, the third is optional.                */
  4238. /*---------------------------------------------------------------------*/
  4239.  strip[0]=STRIP_BOTH;
  4240.  strip[1]=STRIP_BOTH;
  4241.  strip[2]=STRIP_BOTH;
  4242.  num_params = param_split(params,word,MAR_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  4243.  if (num_params < 2)
  4244.    {
  4245.     display_error(3,(CHARTYPE *)"",FALSE);
  4246. #ifdef TRACE
  4247.     trace_return();
  4248. #endif
  4249.     return(RC_INVALID_OPERAND);
  4250.    }
  4251.  if (num_params > 3)
  4252.    {
  4253.     display_error(2,(CHARTYPE *)"",FALSE);
  4254. #ifdef TRACE
  4255.     trace_return();
  4256. #endif
  4257.     return(RC_INVALID_OPERAND);
  4258.    }
  4259. /*---------------------------------------------------------------------*/
  4260. /* Parse the parameters...                                             */
  4261. /*---------------------------------------------------------------------*/
  4262.  left = atoi((DEFCHAR *)word[0]);
  4263.  if (left < 1)
  4264.    {
  4265.     display_error(5,word[0],FALSE);
  4266. #ifdef TRACE
  4267.     trace_return();
  4268. #endif
  4269.     return(RC_INVALID_OPERAND);
  4270.    }
  4271. /*---------------------------------------------------------------------*/
  4272. /* Right margin value can be *, set to maximum line length.            */
  4273. /*---------------------------------------------------------------------*/
  4274.  if (*(word[1]+1) == '*')
  4275.    {
  4276.     right = max_line_length;
  4277.    }
  4278.  else
  4279.    {
  4280.     right = atoi((DEFCHAR *)word[1]);
  4281.     if (right < 1)
  4282.       {
  4283.        display_error(5,word[1],FALSE);
  4284. #ifdef TRACE
  4285.        trace_return();
  4286. #endif
  4287.        return(RC_INVALID_OPERAND);
  4288.       }
  4289.    }
  4290. /*---------------------------------------------------------------------*/
  4291. /* Left margin must be less than right margin.                         */
  4292. /*---------------------------------------------------------------------*/
  4293.  if (right < left)
  4294.    {
  4295.     display_error(5,word[1],FALSE);
  4296. #ifdef TRACE
  4297.     trace_return();
  4298. #endif
  4299.     return(RC_INVALID_OPERAND);
  4300.    }
  4301. /*---------------------------------------------------------------------*/
  4302. /* Obtain current values for indent, in case they aren't changed by    */
  4303. /* the current command. (ie. no third parameter)                       */
  4304. /*---------------------------------------------------------------------*/
  4305.  indent = CURRENT_VIEW->margin_indent;
  4306.  offset = CURRENT_VIEW->margin_indent_offset_status;
  4307. /*---------------------------------------------------------------------*/
  4308. /* Determine the type of offset for the indent value. If a sign is     */
  4309. /* specified, then the number supplied is relative to the left margin  */
  4310. /* otherwise it is an absolute column value.                           */
  4311. /*---------------------------------------------------------------------*/
  4312.  if (num_params == 3)
  4313.    {
  4314.     if (*(word[2]) == '-'
  4315.     ||  *(word[2]) == '+')
  4316.       {
  4317.        offset = TRUE;
  4318.        if ((indent = atoi((DEFCHAR *)word[2])) == 0)
  4319.          {
  4320.           if (strcmp((DEFCHAR *)word[2],"+0") != 0)
  4321.             {
  4322.              display_error(1,word[2],FALSE);
  4323. #ifdef TRACE
  4324.              trace_return();
  4325. #endif
  4326.              return(RC_INVALID_OPERAND);
  4327.             }
  4328.          }
  4329.       }
  4330.     else
  4331.       {
  4332.        offset = FALSE;
  4333. /*---------------------------------------------------------------------*/
  4334. /* Absolute indent cannot be negative.                                 */
  4335. /*---------------------------------------------------------------------*/
  4336.        if ((indent = atoi((DEFCHAR *)word[2])) < 0)
  4337.          {
  4338.           display_error(1,word[2],FALSE);
  4339. #ifdef TRACE
  4340.           trace_return();
  4341. #endif
  4342.           return(RC_INVALID_OPERAND);
  4343.          }
  4344.       }
  4345.    }
  4346. /*---------------------------------------------------------------------*/
  4347. /* Once all values are determined, validate the relationship between   */
  4348. /* the margins and the indent values.                                  */
  4349. /* Rules:                                                              */
  4350. /*       o If indent is a negative offset, the resultant column value  */
  4351. /*         cannot be negative.                                         */
  4352. /*       o If indent is a positive offset, the resultant column value  */
  4353. /*         cannot be > max_line_length or right margin                 */
  4354. /*       o If indent is an absolute value, it cannot be > right margin */
  4355. /*---------------------------------------------------------------------*/
  4356.  consistancy_error = FALSE;
  4357.  if (offset
  4358.  && indent < 0
  4359.  && indent + left < 0)
  4360.     consistancy_error = TRUE;
  4361.  if (offset
  4362.  && indent > 0
  4363.  && indent + left > right)
  4364.     consistancy_error = TRUE;
  4365.  if (offset
  4366.  && indent > 0
  4367.  && (LENGTHTYPE)(indent + left) > max_line_length)
  4368.     consistancy_error = TRUE;
  4369.  if (!offset
  4370.  && indent > right)
  4371.     consistancy_error = TRUE;
  4372.  if (consistancy_error)
  4373.    {
  4374.     if (offset)
  4375.        sprintf((DEFCHAR *)temp_cmd,"%d %d %+d",left,right,indent);
  4376.     else
  4377.        sprintf((DEFCHAR *)temp_cmd,"%d %d %d",left,right,indent);
  4378.     display_error(12,temp_cmd,FALSE);
  4379. #ifdef TRACE
  4380.     trace_return();
  4381. #endif
  4382.     return(RC_INVALID_OPERAND);
  4383.    }
  4384. /*---------------------------------------------------------------------*/
  4385. /* All OK, so save the values...                                       */
  4386. /*---------------------------------------------------------------------*/
  4387.  CURRENT_VIEW->margin_left = left;
  4388.  CURRENT_VIEW->margin_right = right;
  4389.  CURRENT_VIEW->margin_indent = indent;
  4390.  CURRENT_VIEW->margin_indent_offset_status = offset;
  4391. /*---------------------------------------------------------------------*/
  4392. /* If the SCALE line is currently displayed, display the page so that  */
  4393. /* any changes are reflected in the SCALE line.                        */
  4394. /*---------------------------------------------------------------------*/
  4395.  if (CURRENT_VIEW->scale_on)
  4396.    {
  4397.     build_screen(current_screen); 
  4398.     display_screen(current_screen);
  4399.    }
  4400. #ifdef TRACE
  4401.  trace_return();
  4402. #endif
  4403.  return(RC_OK);
  4404. }
  4405. /*man-start*********************************************************************
  4406. COMMAND
  4407.      set mouse - turn mouse support on or off
  4408.  
  4409. SYNTAX
  4410.      [SET] MOUSE ON|OFF
  4411.  
  4412. DESCRIPTION
  4413.      The SET MOUSE command allows the user to turn on or off mouse
  4414.      support in THE.  With mouse support, THE commands assigned to
  4415.      a mouse button event will be executed.  See APPENDIX 3 for
  4416.      details on default mouse support.
  4417.  
  4418.      If the platform does not support mouse operations, the default
  4419.      setting will be OFF.
  4420.  
  4421. COMPATIBILITY
  4422.      XEDIT: N/A
  4423.      KEDIT: Compatible. Does not support all options.
  4424.  
  4425. DEFAULT
  4426.      ON - if mouse supported, OFF - otherwise
  4427.  
  4428. SEE ALSO
  4429.      <DEFINE>
  4430.  
  4431. STATUS
  4432.      Complete.
  4433. **man-end**********************************************************************/
  4434. #ifdef HAVE_PROTO
  4435. short Mouse(CHARTYPE *params)
  4436. #else
  4437. short Mouse(params)
  4438. CHARTYPE *params;
  4439. #endif
  4440. /***********************************************************************/
  4441. {
  4442. /*-------------------------- external data ----------------------------*/
  4443. extern bool MOUSEx;
  4444. /*--------------------------- local data ------------------------------*/
  4445.  short rc=RC_OK;
  4446. /*--------------------------- processing ------------------------------*/
  4447. #ifdef TRACE
  4448.  trace_function("commset1.c:Mouse");
  4449. #endif
  4450.  rc = execute_set_on_off(params,&MOUSEx);
  4451. #if defined(MOUSE_SUPPORT_ENABLED)
  4452.  mouse_set((MOUSEx)?ALL_MOUSE_EVENTS:0L);
  4453. #endif
  4454. #ifdef TRACE
  4455.  trace_return();
  4456. #endif
  4457.  return(rc);
  4458. }
  4459. /*man-start*********************************************************************
  4460. COMMAND
  4461.      set msgline - set position and size of message line
  4462.  
  4463. SYNTAX
  4464.      [SET] MSGLine ON M[+n|-n]|[+|-]n [lines] [Overlay]
  4465.  
  4466. DESCRIPTION
  4467.      The SET MSGLINE set command specifies the position of the 
  4468.      <message line> and the size of the message line window.
  4469.  
  4470.      The first form of parameters is:
  4471.  
  4472.      M[+n|-n] 
  4473.      this sets the first line to be relative to the middle of
  4474.      the screen. A positive value adds to the middle line number, 
  4475.      a negative subtracts from it.
  4476.      eg. M+3 on a 24 line screen will be line 15
  4477.          M-5 on a 24 line screen will be line 7
  4478.  
  4479.      The second form of parameters is:
  4480.  
  4481.      [+|-]n
  4482.      this sets the first line to be relative to the top of the
  4483.      screen (if positive or no sign) or relative to the bottom 
  4484.      of the screen if negative.
  4485.      eg. +3 or 3 will set current line to line 3
  4486.          -3 on a 24 line screen will be line 21
  4487.  
  4488.      If the resulting line is outside the bounds of the screen
  4489.      the position of the message line will become the middle line
  4490.      on the screen.
  4491.  
  4492. COMPATIBILITY
  4493.      XEDIT: Compatible.
  4494.             The OVERLAY option is the default but ignored.
  4495.      KEDIT: Compatible
  4496.             The OVERLAY option is the default but ignored.
  4497.  
  4498. DEFAULT
  4499.      ON 2 5 Overlay
  4500.  
  4501. STATUS
  4502.      Complete
  4503. **man-end**********************************************************************/
  4504. #ifdef HAVE_PROTO
  4505. short Msgline(CHARTYPE *params)
  4506. #else
  4507. short Msgline(params)
  4508. CHARTYPE *params;
  4509. #endif
  4510. /***********************************************************************/
  4511. {
  4512. #define MSG_PARAMS  5
  4513.  CHARTYPE *word[MSG_PARAMS+1];
  4514.  CHARTYPE strip[MSG_PARAMS];
  4515.  short num_params=0;
  4516.  short rc=RC_OK;
  4517.  short base=(short)CURRENT_VIEW->msgline_base;
  4518.  short off=CURRENT_VIEW->msgline_off;
  4519.  bool msgsts=FALSE;
  4520.  ROWTYPE num_lines=CURRENT_VIEW->msgline_rows;
  4521. /*--------------------------- processing ------------------------------*/
  4522. #ifdef TRACE
  4523.  trace_function("commset1.c:Msgline");
  4524. #endif
  4525.  strip[0]=STRIP_BOTH;
  4526.  strip[1]=STRIP_BOTH;
  4527.  strip[2]=STRIP_BOTH;
  4528.  strip[3]=STRIP_BOTH;
  4529.  strip[4]=STRIP_NONE;
  4530.  num_params = param_split(params,word,MSG_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  4531.  if (num_params < 2)
  4532.    {
  4533.     display_error(3,(CHARTYPE *)"",FALSE);
  4534. #ifdef TRACE
  4535.     trace_return();
  4536. #endif
  4537.     return(RC_INVALID_OPERAND);
  4538.    }
  4539.  if (num_params > 4)
  4540.    {
  4541.     display_error(2,(CHARTYPE *)"",FALSE);
  4542. #ifdef TRACE
  4543.     trace_return();
  4544. #endif
  4545.     return(RC_INVALID_OPERAND);
  4546.    }
  4547. /*---------------------------------------------------------------------*/
  4548. /* Parse the status parameter...                                       */
  4549. /*---------------------------------------------------------------------*/
  4550.  rc = execute_set_on_off(word[0],&msgsts);
  4551.  if (rc != RC_OK)
  4552.    {
  4553. #ifdef TRACE
  4554.     trace_return();
  4555. #endif
  4556.     return(rc);
  4557.    }
  4558. /*---------------------------------------------------------------------*/
  4559. /* ... only "ON" is allowed...                                         */
  4560. /*---------------------------------------------------------------------*/
  4561.  if (!msgsts)
  4562.    {
  4563.     display_error(1,word[0],FALSE);
  4564. #ifdef TRACE
  4565.     trace_return();
  4566. #endif
  4567.     return(RC_INVALID_OPERAND);
  4568.    }
  4569. /*---------------------------------------------------------------------*/
  4570. /* Parse the position parameter...                                     */
  4571. /*---------------------------------------------------------------------*/
  4572.  if (num_params > 1)
  4573.    {
  4574.     rc = execute_set_row_position(word[1],&base,&off);
  4575.     if (rc != RC_OK)
  4576.       {
  4577. #ifdef TRACE
  4578.        trace_return();
  4579. #endif
  4580.        return(rc);
  4581.       }
  4582.    }
  4583. /*---------------------------------------------------------------------*/
  4584. /* To get here we have either two arguments or one. If two, the first  */
  4585. /* is the number of lines, and the second MUST be Overlay.             */
  4586. /* If one argument, it is either Overlay or number of lines.           */
  4587. /*---------------------------------------------------------------------*/
  4588.  switch(num_params)
  4589.    {
  4590.     case 3:
  4591.          if (equal((CHARTYPE *)"overlay",word[2],1))
  4592.             num_lines = 1;
  4593.          else
  4594.            {
  4595.             num_lines = atoi((DEFCHAR *)word[2]);
  4596.             if (num_lines < 1)
  4597.               {
  4598.                display_error(5,word[2],FALSE);
  4599. #ifdef TRACE
  4600.                trace_return();
  4601. #endif
  4602.                return(rc);
  4603.               }
  4604.            }
  4605.          break;
  4606.     case 4:
  4607.          num_lines = atoi((DEFCHAR *)word[2]);
  4608.          if (num_lines < 1)
  4609.            {
  4610.             display_error(5,word[2],FALSE);
  4611. #ifdef TRACE
  4612.             trace_return();
  4613. #endif
  4614.             return(rc);
  4615.            }
  4616.          if (!equal((CHARTYPE *)"overlay",word[3],1))
  4617.            {
  4618.             display_error(1,word[3],FALSE);
  4619. #ifdef TRACE
  4620.             trace_return();
  4621. #endif
  4622.             return(rc);
  4623.            }
  4624.          break;
  4625.     default:
  4626.          num_lines = 1;
  4627.          break;
  4628.    }
  4629.  CURRENT_VIEW->msgline_base = (CHARTYPE)base;
  4630.  CURRENT_VIEW->msgline_off = off;
  4631.  CURRENT_VIEW->msgline_rows = num_lines;
  4632. #ifdef TRACE
  4633.  trace_return();
  4634. #endif
  4635.  return(rc);
  4636. }
  4637. /*man-start*********************************************************************
  4638. COMMAND
  4639.      set msgmode - set display of messages on or off
  4640.  
  4641. SYNTAX
  4642.      [SET] MSGMode ON|OFF
  4643.  
  4644. DESCRIPTION
  4645.      The SET MSGMODE set command determines whether error messages will
  4646.      be displayed or suppressed.
  4647.  
  4648. COMPATIBILITY
  4649.      XEDIT: Does not support [Short|Long] options.
  4650.      KEDIT: Compatible
  4651.  
  4652. DEFAULT
  4653.      ON
  4654.  
  4655. STATUS
  4656.      Complete
  4657. **man-end**********************************************************************/
  4658. #ifdef HAVE_PROTO
  4659. short Msgmode(CHARTYPE *params)
  4660. #else
  4661. short Msgmode(params)
  4662. CHARTYPE *params;
  4663. #endif
  4664. /***********************************************************************/
  4665. {
  4666. /*-------------------------- external data ----------------------------*/
  4667. /*--------------------------- local data ------------------------------*/
  4668.  short rc=RC_OK;
  4669. /*--------------------------- processing ------------------------------*/
  4670. #ifdef TRACE
  4671.  trace_function("commset1.c:Msgmode");
  4672. #endif
  4673.  rc = execute_set_on_off(params,&CURRENT_VIEW->msgmode_status);
  4674. #ifdef TRACE
  4675.  trace_return();
  4676. #endif
  4677.  return(rc);
  4678. }
  4679. /*man-start*********************************************************************
  4680. COMMAND
  4681.      set newlines - set position of cursor after adding blank line
  4682.  
  4683. SYNTAX
  4684.      [SET] NEWLines Aligned|Left
  4685.  
  4686. DESCRIPTION
  4687.      The SET NEWLINES set command determines where the cursor displays
  4688.      after a new line is added to the file.
  4689.  
  4690.      With 'ALIGNED', the cursor will display in the column of the new line
  4691.      immediately underneath the first non-blank character in the line
  4692.      above.
  4693.      With 'LEFT', the cursor will display in the first column of the new
  4694.      line.
  4695.  
  4696. COMPATIBILITY
  4697.      XEDIT: N/A
  4698.      KEDIT: Same command, different functionality.
  4699.  
  4700. DEFAULT
  4701.      Aligned
  4702.  
  4703. STATUS
  4704.      Complete
  4705. **man-end**********************************************************************/
  4706. #ifdef HAVE_PROTO
  4707. short Newlines(CHARTYPE *params)
  4708. #else
  4709. short Newlines(params)
  4710. CHARTYPE *params;
  4711. #endif
  4712. /***********************************************************************/
  4713. {
  4714. /*-------------------------- external data ----------------------------*/
  4715. /*--------------------------- local data ------------------------------*/
  4716. #define NEW_PARAMS  1
  4717.  CHARTYPE parm[NEW_PARAMS];
  4718.  CHARTYPE *word[NEW_PARAMS+1];
  4719.  CHARTYPE strip[NEW_PARAMS];
  4720.  unsigned short num_params=0;
  4721. /*--------------------------- processing ------------------------------*/
  4722. #ifdef TRACE
  4723.  trace_function("commset1.c:Newlines");
  4724. #endif
  4725.  strip[0]=STRIP_BOTH;
  4726.  num_params = param_split(params,word,NEW_PARAMS,WORD_DELIMS,TEMP_PARAM,strip,FALSE);
  4727.  if (num_params > 1)
  4728.    {
  4729.     display_error(2,(CHARTYPE *)"",FALSE);
  4730. #ifdef TRACE
  4731.     trace_return();
  4732. #endif
  4733.     return(RC_INVALID_OPERAND);
  4734.    }
  4735.  if (num_params < 1)
  4736.    {
  4737.     display_error(3,(CHARTYPE *)"",FALSE);
  4738. #ifdef TRACE
  4739.     trace_return();
  4740. #endif
  4741.     return(RC_INVALID_OPERAND);
  4742.    }
  4743.  
  4744.  parm[0] = (CHARTYPE)UNDEFINED_OPERAND;
  4745.  if (equal((CHARTYPE *)"aligned",word[0],1))
  4746.     parm[0] = TRUE;
  4747.  if (equal((CHARTYPE *)"left",word[0],1))
  4748.     parm[0] = FALSE;
  4749.  if (parm[0] == (CHARTYPE)UNDEFINED_OPERAND)
  4750.    {
  4751.     display_error(1,word[0],FALSE);
  4752. #ifdef TRACE
  4753.     trace_return();
  4754. #endif
  4755.     return(RC_INVALID_OPERAND);
  4756.    }
  4757.  CURRENT_VIEW->newline_aligned = parm[0];
  4758. #ifdef TRACE
  4759.  trace_return();
  4760. #endif
  4761.  return(RC_OK);
  4762. }
  4763. /*man-start*********************************************************************
  4764. COMMAND
  4765.      set nondisp - specify character to display for non-displaying characters
  4766.  
  4767. SYNTAX
  4768.      [SET] NONDisp character
  4769.  
  4770. DESCRIPTION
  4771.      The SET NONDISP command allows the user to change the 'character' 
  4772.      that is displayed for non-displaying commands when <SET ETMODE> 
  4773.      is OFF.
  4774.  
  4775. COMPATIBILITY
  4776.      XEDIT: Compatible.
  4777.      KEDIT: N/A
  4778.  
  4779. DEFAULT
  4780.      #
  4781.  
  4782. SEE ALSO
  4783.      <SET ETMODE>
  4784.  
  4785. STATUS
  4786.      Complete.
  4787. **man-end**********************************************************************/
  4788. #ifdef HAVE_PROTO
  4789. short Nondisp(CHARTYPE *params)
  4790. #else
  4791. short Nondisp(params)
  4792. CHARTYPE *params;
  4793. #endif
  4794. /***********************************************************************/
  4795. {
  4796. /*-------------------------- external data ----------------------------*/
  4797.  extern bool NONDISPx;
  4798. /*--------------------------- local data ------------------------------*/
  4799. /*--------------------------- processing ------------------------------*/
  4800. #ifdef TRACE
  4801.  trace_function("commset1.c:Nondisp");
  4802. #endif
  4803.  if (strlen((DEFCHAR *)params) != 1)
  4804.    {
  4805.     display_error(1,params,FALSE);
  4806. #ifdef TRACE
  4807.     trace_return();
  4808. #endif
  4809.     return(RC_INVALID_OPERAND);
  4810.    }
  4811.  NONDISPx = *params;
  4812.  build_screen(current_screen); 
  4813.  display_screen(current_screen);
  4814. #ifdef TRACE
  4815.  trace_return();
  4816. #endif
  4817.  return(RC_OK);
  4818. }
  4819. /*man-start*********************************************************************
  4820. COMMAND
  4821.      set number - turn prefix numbers on or off
  4822.  
  4823. SYNTAX
  4824.      [SET] NUMber ON|OFF
  4825.  
  4826. DESCRIPTION
  4827.      The SET NUMBER command allows the user to toggle the display of 
  4828.      numbers in the <prefix area>.
  4829.  
  4830. COMPATIBILITY
  4831.      XEDIT: Compatible.
  4832.      KEDIT: Compatible.
  4833.  
  4834. DEFAULT
  4835.      ON
  4836.  
  4837. SEE ALSO
  4838.      <SET PREFIX>
  4839.  
  4840. STATUS
  4841.      Complete.
  4842. **man-end**********************************************************************/
  4843. #ifdef HAVE_PROTO
  4844. short Number(CHARTYPE *params)
  4845. #else
  4846. short Number(params)
  4847. CHARTYPE *params;
  4848. #endif
  4849. /***********************************************************************/
  4850. {
  4851. /*-------------------------- external data ----------------------------*/
  4852. /*--------------------------- local data ------------------------------*/
  4853.  short rc=RC_OK;
  4854. /*--------------------------- processing ------------------------------*/
  4855. #ifdef TRACE
  4856.  trace_function("commset1.c:Number");
  4857. #endif
  4858.  rc = execute_set_on_off(params,&CURRENT_VIEW->number);
  4859.  if (rc == RC_OK)
  4860.    {
  4861.     build_screen(current_screen); 
  4862.     display_screen(current_screen);
  4863.    }
  4864. #ifdef TRACE
  4865.  trace_return();
  4866. #endif
  4867.  return(rc);
  4868. }
  4869.