home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / thesrc15.zip / commset2.c < prev    next >
C/C++ Source or Header  |  1993-11-29  |  64KB  |  2,124 lines

  1. /***********************************************************************/
  2. /* COMMSET2.C - SET commands O-Z                                       */
  3. /***********************************************************************/
  4. /*
  5.  * THE - The Hessling Editor. A text editor similar to VM/CMS xedit.
  6.  * Copyright (C) 1991-1993 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@gu.edu.au
  33.  * 36 David Road                     Phone: +61 7 849 7731
  34.  * Holland Park                      Fax:   +61 7 875 5314
  35.  * QLD 4121
  36.  * Australia
  37.  */
  38.  
  39. /*
  40. $Header: C:\THE\RCS\commset2.c 1.4 1993/09/01 16:25:53 MH Interim MH $
  41. */
  42.  
  43. #include <stdio.h>
  44.  
  45. #include "the.h"
  46. #include "proto.h"
  47.  
  48. /*#define DEBUG 1*/
  49.  
  50. /*--------------------------- global data -----------------------------*/
  51. bool rexx_output=FALSE;
  52.  
  53. /*-------------------------- external data ----------------------------*/
  54. extern char in_profile;    /* indicates if processing profile */
  55. extern VIEW_DETAILS *vd_current;
  56. extern char current_screen;
  57. extern SCREEN_DETAILS screen[MAX_SCREENS];        /* screen structures */
  58. /*man-start*********************************************************************
  59. COMMAND
  60.      pending - set status of pending prefix commands
  61.  
  62. SYNTAX
  63.      [SET] PENDing ON string
  64.      [SET] PENDing OFF
  65.      [SET] PENDing BLOCK string
  66.  
  67. DESCRIPTION
  68.      The PENDING command allows the user to insert or remove commands
  69.      from the pending prefix list.
  70.  
  71.      [SET] PENDing ON 'string', simulates the user typing 'string'
  72.      in the prefix area of the focus line.
  73.  
  74.      [SET] PENDing OFF, removes any pending prefix command from the
  75.      focus line.
  76.  
  77.      [SET] PENDing BLOCK 'string', simulates the user typing 'string'
  78.      in the prefix area of the focus line and identifies the prefix 
  79.      command to be a BLOCK command.
  80.  
  81. COMPATIBILITY
  82.      XEDIT: Does not support ERROR option.
  83.      KEDIT: N/A
  84.  
  85. STATUS
  86.      Complete.
  87. **man-end**********************************************************************/
  88. #ifdef PROTO
  89. int Pending(char *params)
  90. #else
  91. int Pending(params)
  92. char *params;
  93. #endif
  94. /***********************************************************************/
  95. {
  96. #define PEND_ON    1
  97. #define PEND_OFF   2
  98. #define PEND_BLOCK 3
  99. /*------------------------- external data -----------------------------*/
  100. extern char *pre_rec;
  101. extern unsigned short pre_rec_len;
  102. /*--------------------------- local data ------------------------------*/
  103. #define PEN_PARAMS  3
  104.  char *word[PEN_PARAMS+1];
  105.  unsigned short num_params;
  106.  int rc=RC_OK;
  107.  LINE *curr;
  108.  long true_line;
  109.  int command;
  110. /*--------------------------- processing ------------------------------*/
  111. #ifdef TRACE
  112.  trace_function("commset2.c:Pending");
  113. #endif
  114. /*---------------------------------------------------------------------*/
  115. /* Validate parameters.                                                */
  116. /*---------------------------------------------------------------------*/
  117.  num_params = param_split(params,word,PEN_PARAMS,WORD_DELIMS,TEMP_PARAM);
  118. /*---------------------------------------------------------------------*/
  119. /* If no arguments, error.                                             */
  120. /*---------------------------------------------------------------------*/
  121.  if (num_params == 0)
  122.    {
  123.     display_error(3,(char *)""); 
  124. #ifdef TRACE
  125.     trace_return();
  126. #endif
  127.     return(RC_INVALID_OPERAND);
  128.    }
  129. /*---------------------------------------------------------------------*/
  130. /* If more than 2 arguments, error.                                    */
  131. /*---------------------------------------------------------------------*/
  132.  if (num_params > 2)
  133.    {
  134.     display_error(2,(char *)"");
  135. #ifdef TRACE
  136.     trace_return();
  137. #endif
  138.     return(RC_INVALID_OPERAND);
  139.    }
  140. /*---------------------------------------------------------------------*/
  141. /* Validate first parameter...                                         */
  142. /*---------------------------------------------------------------------*/
  143.  if (equal((char *)"off",word[0],3))
  144.     command = PEND_OFF;
  145.  else
  146.     if (equal((char *)"on",word[0],2))
  147.        command = PEND_ON;
  148.     else
  149.        if (equal((char *)"block",word[0],5))
  150.           command = PEND_BLOCK;
  151.        else
  152.          {
  153.           display_error(1,word[0]);
  154. #ifdef TRACE
  155.           trace_return();
  156. #endif
  157.           return(RC_INVALID_OPERAND);
  158.          }
  159.  true_line = get_true_line();
  160.  post_process_line(CURRENT_VIEW->focus_line);
  161.  switch(command)
  162.    {
  163. /*---------------------------------------------------------------------*/
  164. /* PENDING ON and PENDING BLOCK...                                     */
  165. /*---------------------------------------------------------------------*/
  166.     case PEND_ON:
  167.     case PEND_BLOCK:
  168. /*---------------------------------------------------------------------*/
  169. /* The second argument must be present and <= PREFIX_WIDTH.            */
  170. /*---------------------------------------------------------------------*/
  171.          if (num_params != 2)
  172.            {
  173.             display_error(3,(char *)"");
  174.             rc = RC_INVALID_OPERAND;
  175.             break;
  176.            }
  177.          if (strlen(word[1]) > PREFIX_WIDTH)
  178.            {
  179.             display_error(1,word[1]); /* different error ?? */
  180.             rc = RC_INVALID_OPERAND;
  181.             break;
  182.            }
  183. /*---------------------------------------------------------------------*/
  184. /* Copy the string into pre_rec and set its length.                    */
  185. /*---------------------------------------------------------------------*/
  186.          memset(pre_rec,' ',PREFIX_WIDTH);
  187.          strcpy(pre_rec,word[1]);
  188.          pre_rec_len = strlen(word[1]);
  189.          pre_rec[pre_rec_len] = ' ';
  190.          pre_rec[PREFIX_WIDTH] = '\0';
  191.          curr = lll_find(CURRENT_FILE->first_line,true_line);
  192.          if (command == PEND_BLOCK)
  193.             add_prefix_command(curr,true_line,TRUE);
  194.          else
  195.             add_prefix_command(curr,true_line,FALSE);
  196.          break;
  197. /*---------------------------------------------------------------------*/
  198. /* PENDING OFF...                                                      */
  199. /*---------------------------------------------------------------------*/
  200.     case PEND_OFF:
  201.          if (num_params != 1)
  202.            {
  203.             display_error(2,(char *)"");
  204.             rc = RC_INVALID_OPERAND;
  205.             break;
  206.            }
  207.          curr = lll_find(CURRENT_FILE->first_line,true_line);
  208.          clear_pending_prefix_command(curr->pre,curr);
  209.          memset(pre_rec,' ',PREFIX_WIDTH);
  210.          pre_rec_len = 0;
  211.          break;
  212.    }
  213.  if (rc == RC_OK)
  214.    {
  215.     if (!in_profile)
  216.        show_page();
  217.    }
  218. #ifdef TRACE
  219.  trace_return();
  220. #endif
  221.  return(rc);
  222. }
  223. /*man-start*********************************************************************
  224. COMMAND
  225.      point - give a name to the current line
  226.  
  227. SYNTAX
  228.      [SET] Point .name [OFF]
  229.  
  230. DESCRIPTION
  231.      The POINT command assignes the specified name to the current
  232.      line, or removes the name from the line with the specified name.
  233.      A valid line name must start with a '.' followed by an alphabetic
  234.      character. eg. .a .fred and .GG are valid names; fred and .3 are
  235.      invalid line names.
  236.  
  237.      When a line is moved within the same file, its line name stays
  238.      with the line.
  239.  
  240. COMPATIBILITY
  241.      XEDIT: Compatible. See below.
  242.      KEDIT: Compatible. See below.
  243.      Does not allow for multiple names for the same line.
  244.  
  245. STATUS
  246.      Complete.
  247. **man-end**********************************************************************/
  248. #ifdef PROTO
  249. int Point(char *params)
  250. #else
  251. int Point(params)
  252. char *params;
  253. #endif
  254. /***********************************************************************/
  255. {
  256. /*------------------------- external date -----------------------------*/
  257. /*--------------------------- local data ------------------------------*/
  258. #define POI_PARAMS  2
  259.  char *word[POI_PARAMS+1];
  260.  unsigned short num_params;
  261.  int rc;
  262. /*--------------------------- processing ------------------------------*/
  263. #ifdef TRACE
  264.  trace_function("commset2.c:Point");
  265. #endif
  266. /*---------------------------------------------------------------------*/
  267. /* Validate parameters.                                                */
  268. /*---------------------------------------------------------------------*/
  269.  num_params = param_split(params,word,POI_PARAMS,WORD_DELIMS,TEMP_PARAM);
  270.  if (num_params < 1)
  271.    {
  272.     display_error(3,(char *)"");
  273. #ifdef TRACE
  274.     trace_return();
  275. #endif
  276.     return(RC_INVALID_OPERAND);
  277.    }
  278. /*---------------------------------------------------------------------*/
  279. /* Turning on line name...                                             */
  280. /*---------------------------------------------------------------------*/
  281.  if (num_params == 1)
  282.    {
  283.     if (word[0][0] != '.'
  284.     ||  !isalpha(word[0][1]))
  285.       {
  286.        display_error(18,word[0]);
  287. #ifdef TRACE
  288.        trace_return();
  289. #endif
  290.        return(RC_INVALID_OPERAND);
  291.       }
  292.     if ((rc = execute_set_point(word[0],get_true_line(),TRUE)) != RC_OK)
  293.       {
  294. #ifdef TRACE
  295.        trace_return();
  296. #endif
  297.        return(rc);
  298.       }
  299.    }
  300. /*---------------------------------------------------------------------*/
  301. /* Turning off line name...                                            */
  302. /*---------------------------------------------------------------------*/
  303.  else
  304.    {
  305.     if (!equal((char *)"off",word[1],3))
  306.       {
  307.        display_error(1,word[1]);
  308. #ifdef TRACE
  309.        trace_return();
  310. #endif
  311.        return(RC_INVALID_OPERAND);
  312.       }
  313.     if ((rc = execute_set_point(word[0],get_true_line(),FALSE)) != RC_OK)
  314.       {
  315. #ifdef TRACE
  316.        trace_return();
  317. #endif
  318.        return(rc);
  319.       }
  320.    }
  321. #ifdef TRACE
  322.  trace_return();
  323. #endif
  324.  return(RC_OK);
  325. }
  326. /*man-start*********************************************************************
  327. COMMAND
  328.      prefix - set prefix area attributes
  329.  
  330. SYNTAX
  331.      [SET] PREfix ON [Left|Right]
  332.      [SET] PREfix OFF
  333.      [SET] PREfix Synonym newname oldname
  334.  
  335. DESCRIPTION
  336.      The first form of the PREFIX allows the user to display the
  337.      prefix area and optionally to select the position the prefix
  338.      should be displayed at.
  339.      The second form, turns the display of the prefix area off.
  340.      Executed from within the profile, the only effect is that the
  341.      defaults for all files is changed.
  342.      Executed from the command line, the PREFIX command changes the
  343.      current window displays to reflect the required options.
  344.  
  345.      The third form of the PREFIX command allows the users to specify
  346.      a synonym for a prefix command or REXX prefix macro. The 'newname' 
  347.      is the command entered in the prefix area and 'oldname' corresponds 
  348.      to an existing prefix command or a REXX macro file in the MACROPATH 
  349.      ending in .the or whatever the value of MACROEXT is at the time the 
  350.      prefix command is executed. The 'oldname' can also be the fully 
  351.      qualified filename of a REXX macro.
  352.  
  353. COMPATIBILITY
  354.      XEDIT: Compatible. See below.
  355.      KEDIT: Compatible. See below.
  356.      Does not support PREFIX NULLS.
  357.  
  358. DEFAULT
  359.      PREFIX ON LEFT
  360.  
  361. STATUS
  362.      Strange display behaviour occurs when you have multiple files with
  363.      mixed prefix settings.
  364. **man-end**********************************************************************/
  365. #ifdef PROTO
  366. int Prefix(char *params)
  367. #else
  368. int Prefix(params)
  369. char *params;
  370. #endif
  371. /***********************************************************************/
  372. {
  373. /*--------------------------- extern data -----------------------------*/
  374. extern char PREFIXx;
  375. /*--------------------------- local data ------------------------------*/
  376. #define PRE_PARAMS  4
  377.  char *word[PRE_PARAMS+1];
  378.  char parm=(char)UNDEFINED_OPERAND;
  379.  register int i;
  380.  unsigned short num_params;
  381.  unsigned short x,y;
  382.  char pre_col;
  383.  short rc;
  384. /*--------------------------- processing ------------------------------*/
  385. #ifdef TRACE
  386.  trace_function("commset2.c:Prefix");
  387. #endif
  388.  num_params = param_split(params,word,PRE_PARAMS,WORD_DELIMS,TEMP_PARAM);
  389.  if (equal((char *)"on",word[0],2))
  390.    {
  391.     if (num_params > 2)
  392.       {
  393.        display_error(2,(char *)"");
  394. #ifdef TRACE
  395.        trace_return();
  396. #endif
  397.        return(RC_INVALID_OPERAND);
  398.       }
  399.     if (equal((char *)"left",word[1],1))
  400.        parm = PREFIX_LEFT;
  401.     else
  402.        if (equal((char *)"right",word[1],1))
  403.           parm = PREFIX_RIGHT;
  404.        else
  405.           if (num_params == 1)       /* no left/right, default to left */
  406.              parm = PREFIX_LEFT;
  407.           else
  408.             {
  409.              display_error(1,word[1]);
  410. #ifdef TRACE
  411.              trace_return();
  412. #endif
  413.              return(RC_INVALID_OPERAND);
  414.             }
  415.    }
  416.  else
  417.    {
  418.     if (equal((char *)"off",word[0],3))
  419.       {
  420.        if (num_params > 1)
  421.          {
  422.           display_error(2,(char *)"");
  423. #ifdef TRACE
  424.           trace_return();
  425. #endif
  426.           return(RC_INVALID_OPERAND);
  427.          }
  428.        if (strcmp(word[1],"") == 0)
  429.           parm = PREFIX_OFF;
  430.        else
  431.          {
  432.           display_error(2,word[1]);
  433. #ifdef TRACE
  434.           trace_return();
  435. #endif
  436.           return(RC_INVALID_OPERAND);
  437.          }
  438.       }
  439.     else
  440.        if (equal((char *)"synonym",word[0],1))
  441.          {
  442.           if (num_params < 3)
  443.             {
  444.              display_error(3,(char *)"");
  445. #ifdef TRACE
  446.              trace_return();
  447. #endif
  448.              return(RC_INVALID_OPERAND);
  449.             }
  450.           if (num_params > 3)
  451.             {
  452.              display_error(2,(char *)"");
  453. #ifdef TRACE
  454.              trace_return();
  455. #endif
  456.              return(RC_INVALID_OPERAND);
  457.             }
  458.           if (strlen(word[1]) > PREFIX_WIDTH)
  459.             {
  460.              display_error(37,word[1]);
  461. #ifdef TRACE
  462.              trace_return();
  463. #endif
  464.              return(RC_INVALID_OPERAND);
  465.             }
  466.           rc = add_prefix_synonym(word[1],word[2]);
  467. #ifdef TRACE
  468.           trace_return();
  469. #endif
  470.           return(rc);
  471.          }
  472.        else
  473.          {
  474.           display_error(1,word[0]);
  475. #ifdef TRACE
  476.           trace_return();
  477. #endif
  478.           return(RC_INVALID_OPERAND);
  479.          }
  480.    }
  481.  
  482.  PREFIXx = parm;
  483. /*---------------------------------------------------------------------*/
  484. /* Now for the real work. Depending on the current state of the prefix */
  485. /* and the intentions of the user, turn on or off the prefix area and  */
  486. /* rearrange the MAIN window.                                          */
  487. /*---------------------------------------------------------------------*/
  488.  switch(CURRENT_VIEW->prefix)
  489.    {
  490.     case PREFIX_LEFT:
  491.     case PREFIX_RIGHT:
  492. /*---------------------------------------------------------------------*/
  493. /* If the prefix is already on and in the same place as requested,     */
  494. /* ignore the command.                                                 */
  495. /*---------------------------------------------------------------------*/
  496.          if (CURRENT_VIEW->prefix == parm)
  497.             break;
  498.          switch(parm)
  499.            {
  500.             case PREFIX_LEFT:
  501.             case PREFIX_RIGHT:
  502. /*---------------------------------------------------------------------*/
  503. /* Now we have to swap the position of the MAIN and PREFIX windows.    */
  504. /* The simplest way is to move the windows to their new positions.     */
  505. /*---------------------------------------------------------------------*/
  506.                  if (CURRENT_VIEW->prefix == PREFIX_LEFT)
  507.                    {
  508.                     CURRENT_SCREEN.top_col -= PREFIX_WIDTH;
  509.                     pre_col = CURRENT_SCREEN.origin_x+CURRENT_SCREEN.screen_cols-PREFIX_WIDTH;
  510.                    }
  511.                  else
  512.                    {
  513.                     CURRENT_SCREEN.top_col += PREFIX_WIDTH;
  514.                     pre_col = CURRENT_SCREEN.origin_x;
  515.                    }
  516.                  if (!in_profile)
  517.                    {
  518.                     rc = mvwin(CURRENT_WINDOW_MAIN,CURRENT_SCREEN.top_row,
  519.                                               CURRENT_SCREEN.top_col);
  520.                     rc = mvwin(CURRENT_WINDOW_PREFIX,CURRENT_SCREEN.top_row,
  521.                                               pre_col);
  522.                    }
  523.                  CURRENT_VIEW->prefix = parm;
  524.                  break;
  525.             case PREFIX_OFF:                /* prefix to be turned off */
  526.                  if (!in_profile)
  527.                    {
  528.                     delwin(CURRENT_WINDOW_PREFIX);
  529.                     getyx(CURRENT_WINDOW_MAIN,y,x);
  530.                    }
  531.                  CURRENT_SCREEN.cols += PREFIX_WIDTH;
  532.                  CURRENT_SCREEN.top_col = CURRENT_SCREEN.origin_x;
  533.                  CURRENT_VIEW->prefix = PREFIX_OFF;
  534.                  if (!in_profile)
  535.                    {
  536.                     CURRENT_WINDOW_MAIN = adjust_window(CURRENT_WINDOW_MAIN,CURRENT_SCREEN.top_row,
  537.                                                    CURRENT_SCREEN.top_col,
  538.                                                    CURRENT_SCREEN.rows,
  539.                                                    CURRENT_SCREEN.cols);
  540.                     wattrset(CURRENT_WINDOW_MAIN,colour[ATTR_FILEAREA]);
  541. #if !defined(NO_KEYPAD)
  542.                     keypad(CURRENT_WINDOW_MAIN,TRUE);
  543. #endif
  544.                    }
  545.                  if (CURRENT_VIEW->current_window == WINDOW_COMMAND)
  546.                     CURRENT_VIEW->previous_window = WINDOW_MAIN;
  547.                  else
  548.                    {
  549.                     CURRENT_VIEW->current_window = WINDOW_MAIN;
  550.                     CURRENT_VIEW->previous_window = WINDOW_COMMAND;
  551.                    }
  552.                  if (!in_profile)
  553.                    {
  554.                     show_page();
  555.                     wmove(CURRENT_WINDOW_MAIN,y,x);
  556.                    }
  557.                  break;
  558.            }
  559.          break;
  560.     case PREFIX_OFF:                        /* prefix is currently off */
  561.          switch(parm)
  562.            {
  563.             case PREFIX_LEFT:
  564.             case PREFIX_RIGHT:
  565. /*---------------------------------------------------------------------*/
  566. /* Determine where the prefix is to go.                                */
  567. /*---------------------------------------------------------------------*/
  568.                  if (parm == PREFIX_LEFT)      /* prefix to go on left */
  569.                    {
  570.                     pre_col = CURRENT_SCREEN.origin_x;
  571.                     CURRENT_SCREEN.top_col = CURRENT_SCREEN.origin_x+PREFIX_WIDTH;
  572.                    }
  573.                  else
  574.                     pre_col = CURRENT_SCREEN.origin_x+CURRENT_SCREEN.screen_cols-PREFIX_WIDTH;
  575.                  CURRENT_SCREEN.cols -= PREFIX_WIDTH;
  576.  
  577.                  if (!in_profile)
  578.                     getyx(CURRENT_WINDOW_MAIN,y,x);
  579.  
  580.                  CURRENT_VIEW->prefix = parm;
  581.  
  582.                  if (!in_profile)
  583.                    {
  584.                     CURRENT_WINDOW_MAIN = adjust_window(CURRENT_WINDOW_MAIN,CURRENT_SCREEN.top_row,
  585.                                                    CURRENT_SCREEN.top_col,
  586.                                                    CURRENT_SCREEN.rows,
  587.                                                    CURRENT_SCREEN.cols);
  588.                     wattrset(CURRENT_WINDOW_MAIN,colour[ATTR_FILEAREA]);
  589. #if !defined(NO_KEYPAD)
  590.                     keypad(CURRENT_WINDOW_MAIN,TRUE);
  591. #endif
  592.                     CURRENT_WINDOW_PREFIX = newwin(CURRENT_SCREEN.rows,PREFIX_WIDTH,
  593.                                          CURRENT_SCREEN.top_row,pre_col);
  594.                     wattrset(CURRENT_WINDOW_PREFIX,colour[ATTR_PENDING]);
  595. #if !defined(NO_KEYPAD)
  596.                     keypad(CURRENT_WINDOW_PREFIX,TRUE);
  597. #endif
  598.                     show_page();
  599. /*---------------------------------------------------------------------*/
  600. /* If the previous column position is now no longer valid, set the     */
  601. /* column position to 0.                                               */
  602. /*---------------------------------------------------------------------*/
  603.                     if (x > CURRENT_SCREEN.cols)
  604.                        x = 0;
  605.                     wmove(CURRENT_WINDOW_MAIN,y,x);
  606.                    }
  607.                  break;
  608.             case PREFIX_OFF:
  609. /*---------------------------------------------------------------------*/
  610. /* If the prefix is already off, ignore request to turn it off.        */
  611. /*---------------------------------------------------------------------*/
  612.                  break;
  613.            }
  614.          break;
  615.    }
  616. #ifdef TRACE
  617.  trace_return();
  618. #endif
  619.  return(RC_OK);
  620. }
  621. /*man-start*********************************************************************
  622. COMMAND
  623.      printer - define printer spooler name
  624.  
  625. SYNTAX
  626.      [SET] PRINTER spooler
  627.  
  628. DESCRIPTION
  629.      The PRINTER command sets up the print spooler name to determine
  630.      where output from the PRINT command goes.
  631.  
  632. COMPATIBILITY
  633.      XEDIT: N/A
  634.      KEDIT: Compatible.
  635.  
  636. SEE ALSO
  637.      print
  638.  
  639. STATUS
  640.      Incomplete. This command does nothing in the DOS version.
  641. **man-end**********************************************************************/
  642. #ifdef PROTO
  643. int Printer(char *params)
  644. #else
  645. int Printer(params)
  646. char *params;
  647. #endif
  648. /***********************************************************************/
  649. {
  650. /*------------------------- external date -----------------------------*/
  651. #if defined(UNIX) || defined(OS2)
  652.  extern char *spooler_name;
  653. /*--------------------------- processing ------------------------------*/
  654. #ifdef TRACE
  655.  trace_function("commset2.c:Printer");
  656. #endif
  657.  if ((spooler_name = (char *)realloc(spooler_name,strlen(params)+1)) == NULL)
  658.    {
  659.     display_error(30,(char *)"");
  660. #ifdef TRACE
  661.     trace_return();
  662. #endif
  663.     return(RC_OUT_OF_MEMORY);
  664.    }
  665.  strcpy(spooler_name,params);
  666. #endif
  667. #ifdef TRACE
  668.  trace_return();
  669. #endif
  670.  return(RC_OK);
  671. }
  672. /*man-start*********************************************************************
  673. COMMAND
  674.      reprofile - indicate if profile file to be executed for all files
  675.  
  676. SYNTAX
  677.      [SET] REPROFile ON|OFF
  678.  
  679. DESCRIPTION
  680.      The REPROFILE command allows the user to determine if the profile 
  681.      file is to reexecuted for files subsequenlty edited.
  682.  
  683. COMPATIBILITY
  684.      XEDIT: N/A
  685.      KEDIT: Compatible.
  686.  
  687. DEFAULT
  688.      OFF
  689.  
  690. SEE ALSO
  691.      xedit
  692.  
  693. STATUS
  694.      Complete
  695. **man-end**********************************************************************/
  696. #ifdef PROTO
  697. int Reprofile(char *params)
  698. #else
  699. int Reprofile(params)
  700. char *params;
  701. #endif
  702. /***********************************************************************/
  703. {
  704. /*-------------------------- external data ----------------------------*/
  705.  extern bool REPROFILEx;
  706. /*--------------------------- local data ------------------------------*/
  707. /*--------------------------- processing ------------------------------*/
  708. #ifdef TRACE
  709.  trace_function("commset2.c:Reprofile");
  710. #endif
  711.  if (equal((char *)"off",params,3))
  712.     REPROFILEx = FALSE;
  713.  else
  714.     if (equal((char *)"on",params,2))
  715.        REPROFILEx = TRUE;
  716.     else
  717.       {
  718.        display_error(1,(char *)params);
  719. #ifdef TRACE
  720.        trace_return();
  721. #endif
  722.        return(RC_INVALID_OPERAND);
  723.       }
  724. #ifdef TRACE
  725.  trace_return();
  726. #endif
  727.  return(RC_OK);
  728. }
  729. /*man-start*********************************************************************
  730. COMMAND
  731.      reserved - reserve a line
  732.  
  733. SYNTAX
  734.      [SET] RESERved +|-n text|OFF
  735.  
  736. DESCRIPTION
  737.      The RESERVED command reseves a line for the display of arbitrary
  738.      text by the user. The position is determined by +|-n.
  739.      This number, if positive, specifies the line relative from the
  740.      top of the display. A negative number is relative from the
  741.      bottom of the display.
  742.  
  743.      By specifying a line, say +3, then THREE lines from the top will
  744.      be reserved, with the supplied text being displayed in line 3.
  745.  
  746.      The idline of a file will always be displayed after any reserved
  747.      lines.
  748.  
  749.      The status area will always be displayed on the very last line
  750.      of the screen and any reserved lines will display above that.
  751.      The status area then is effectively line -0;
  752.  
  753. COMPATIBILITY
  754.      XEDIT: Compatible. See below.
  755.      KEDIT: Compatible. See below.
  756.      Does not allow a colour to be specified. Use SET COLOUR instead.
  757.  
  758. STATUS
  759.      Not implemented.
  760. **man-end**********************************************************************/
  761. #ifdef PROTO
  762. int Reserved(char *params)
  763. #else
  764. int Reserved(params)
  765. char *params;
  766. #endif
  767. /***********************************************************************/
  768. {
  769. extern int reserved_top,reserved_bottom;
  770. /*--------------------------- local data ------------------------------*/
  771. #define RSR_PARAMS  2
  772.  char *word[RSR_PARAMS+1];
  773.  char parm[RSR_PARAMS];
  774.  unsigned short num_params;
  775.  int line;
  776. /*--------------------------- processing ------------------------------*/
  777. #ifdef TRACE
  778.  trace_function("commset2.c:Reserved");
  779. #endif
  780.  display_error(0,(char *)"This function has not yet been implemented");
  781.  return(RC_OK);
  782. #ifdef TO_BE_IMPLEMENTED
  783.  num_params = param_split(params,word,RSR_PARAMS,WORD_DELIMS,TEMP_PARAM);
  784.  if (num_params < 2)
  785.     {
  786.      display_error(3,(char *)"");
  787. #ifdef TRACE
  788.      trace_return();
  789. #endif
  790.      return(RC_INVALID_OPERAND);
  791.     }
  792.  if (*word[0] != '+'
  793.  &&  *word[0] != '-')
  794.    {
  795.      display_error(1,word[0]);
  796. #ifdef TRACE
  797.      trace_return();
  798. #endif
  799.      return(RC_INVALID_OPERAND);
  800.     }
  801.  if (valid_integer(word[0]) == NO)
  802.    {
  803.     display_error(4,word[0]);
  804. #ifdef TRACE
  805.     trace_return();
  806. #endif
  807.     return(RC_INVALID_OPERAND);
  808.    }
  809.  line = atoi(word[0]);
  810.  if ((line > 0 && line > 10)
  811.  ||  (line < 0 && line*(-1) > 10))
  812.    {
  813.     display_error(6,word[0]);
  814. #ifdef TRACE
  815.     trace_return();
  816. #endif
  817.     return(RC_INVALID_OPERAND);
  818.    }
  819.  if (line > 0)
  820.     reserved_top = max(reserved_top,line);
  821.  if (line < 0)
  822.     reserved_bottom = min(reserved_bottom,line);
  823. /*---------------------------------------------------------------------*/
  824. /* This is where we have to resize the display (if necessary) and      */
  825. /* add the string to stdscr.                                           */
  826. /*---------------------------------------------------------------------*/
  827.  attrset(colour[ATTR_RESERVED]);
  828.  if (line > 0)
  829.     mvaddstr(line-1,0,word[1]);
  830.  else
  831.     mvaddstr(LINES-1+line,0,word[1]);
  832.  clrtoeol();
  833.  wnoutrefresh(stdscr);
  834. #ifdef TRACE
  835.  trace_return();
  836. #endif
  837.  return(RC_OK);
  838. #endif
  839. }
  840. #if !defined(NOREXX)
  841. /*man-start*********************************************************************
  842. COMMAND
  843.      rexxoutput - indicate where REXX output is to go
  844.  
  845. SYNTAX
  846.      [SET] REXXOUTput File|Display n
  847.  
  848. DESCRIPTION
  849.      The REXXOUTPUT command indicates where output from the REXX
  850.      interpreter is to go; either captured to a file in the ring
  851.      or displayed in a scrolling fashion on the screen.
  852.  
  853.      Also specified is the maximum number of lines from the REXX
  854.      interpreter that are to be displayed or captured. This is
  855.      particularly useful when a REXX macro gets into an infinite
  856.      loop.
  857.  
  858. COMPATIBILITY
  859.      XEDIT: N/A
  860.      KEDIT: N/A
  861.  
  862. DEFAULT
  863.      Display 1000
  864.  
  865. STATUS
  866.      Complete.
  867. **man-end**********************************************************************/
  868. #ifdef PROTO
  869. int Rexxoutput(char *params)
  870. #else
  871. int Rexxoutput(params)
  872. char *params;
  873. #endif
  874. /***********************************************************************/
  875. {
  876. /*--------------------------- extern data -----------------------------*/
  877. extern long CAPREXXMAXx;
  878. extern bool CAPREXXOUTx;
  879. extern bool rexx_output;/*indicates if we are currently trapping output*/
  880. /*--------------------------- local data ------------------------------*/
  881. #define REX_PARAMS  2
  882.  char *word[REX_PARAMS+1];
  883.  register int i;
  884.  unsigned short num_params;
  885.  long num_pages,num_lines;
  886.  unsigned short x,y;
  887. /*--------------------------- processing ------------------------------*/
  888. #ifdef TRACE
  889.  trace_function("commset2.c:Rexxoutput");
  890. #endif
  891.  if (rexx_output)
  892.    {
  893.     display_error(0,(char *)"Error: Unable to alter REXXOUTPUT settings");
  894. #ifdef TRACE
  895.     trace_return();
  896. #endif
  897.     return(RC_INVALID_OPERAND);
  898.    }
  899.  num_params = param_split(params,word,REX_PARAMS,WORD_DELIMS,TEMP_PARAM);
  900.  if (num_params < 2)
  901.    {
  902.     display_error(3,(char *)"");
  903. #ifdef TRACE
  904.     trace_return();
  905. #endif
  906.     return(RC_INVALID_OPERAND);
  907.    }
  908.  if (equal((char *)"file",word[0],1))
  909.     CAPREXXOUTx = TRUE;
  910.  else
  911.     if (equal((char *)"display",word[0],1))
  912.        CAPREXXOUTx = FALSE;
  913.     else
  914.       {
  915.        display_error(1,(char *)word[0]);
  916. #ifdef TRACE
  917.        trace_return();
  918. #endif
  919.        return(RC_INVALID_OPERAND);
  920.       }
  921.  
  922.  if (!valid_positive_integer(word[1]))
  923.    {
  924.     display_error(4,(char *)word[1]);
  925. #ifdef TRACE
  926.     trace_return();
  927. #endif
  928.     return(RC_INVALID_OPERAND);
  929.    }
  930.  CAPREXXMAXx =  atol(word[1]);
  931.  return(RC_OK);
  932. }
  933. #endif
  934. /*man-start*********************************************************************
  935. COMMAND
  936.      scope - sets which lines are to be excluded from commands
  937.  
  938. SYNTAX
  939.      [SET] SCOPE All|Display
  940.  
  941. DESCRIPTION
  942.      The SCOPE command indicates whether lines not displayed as
  943.      the result of a SET DISPLAY or ALL command are included in
  944.      the scope of lines to be acted upon by other THE commands.
  945.  
  946. COMPATIBILITY
  947.      XEDIT: Compatible.
  948.      KEDIT: Compatible.
  949.  
  950. DEFAULT
  951.      Display
  952.  
  953. SEE ALSO
  954.      SET DISPLAY, SET SELECT, ALL
  955.  
  956. STATUS
  957.      Not started.
  958. **man-end**********************************************************************/
  959. #ifdef PROTO
  960. int Scope(char *params)
  961. #else
  962. int Scope(params)
  963. char *params;
  964. #endif
  965. /***********************************************************************/
  966. {
  967. /*--------------------------- local data ------------------------------*/
  968.  int rc=RC_OK;
  969. /*--------------------------- processing ------------------------------*/
  970. #ifdef TRACE
  971.  trace_function("commset2.c:Scope");
  972. #endif
  973.  display_error(0,(char *)"This function has not yet been implemented");
  974. #ifdef TRACE
  975.  trace_return();
  976. #endif
  977.  return(rc);
  978. }
  979. /*man-start*********************************************************************
  980. COMMAND
  981.      screen - specifiy number of screens displayed
  982.  
  983. SYNTAX
  984.      [SET] SCReen n [Horizontal|Vertical]
  985.  
  986. DESCRIPTION
  987.      The SCREEN command specifies the number of views of file(s) to
  988.      display on screen at once. If the number of views specified is 2
  989.      and only one file is currently in the ring, two views of the
  990.      same file are displayed.
  991.  
  992. COMPATIBILITY
  993.      XEDIT: Does not support Size,Width or Define options.
  994.      KEDIT: Does not support Size option.
  995.      Only 2 views are supported.
  996.  
  997. STATUS
  998.      Not complete. (Unavailable)
  999. **man-end**********************************************************************/
  1000. #ifdef PROTO
  1001. int Screen(char *params)
  1002. #else
  1003. int Screen(params)
  1004. char *params;
  1005. #endif
  1006. /***********************************************************************/
  1007. {
  1008. /*--------------------------- local data ------------------------------*/
  1009. #define SCR_PARAMS  2
  1010.  char *word[SCR_PARAMS+1];
  1011.  register int i;
  1012.  unsigned short num_params,num_views;
  1013.  char save_display_screens;
  1014.  bool save_horizontal;
  1015.  unsigned short x,y;
  1016.  char horiz=(-1);
  1017.  VIEW_DETAILS *save_current_view;
  1018.  int rc;
  1019.  
  1020. #ifndef VMS
  1021.  SCREEN_DETAILS *screen0 = &screen[0];
  1022.  SCREEN_DETAILS *screen1 = &screen[1];
  1023. #endif
  1024. /*--------------------------- processing ------------------------------*/
  1025. #ifdef TRACE
  1026.  trace_function("commset2.c:Screen");
  1027. #endif
  1028.  display_error(0,(char *)"This function has not yet been implemented");
  1029.  
  1030. #ifdef TRACE
  1031.  trace_return();
  1032. #endif
  1033.  return(RC_OK);
  1034. #ifdef TO_BE_IMPLEMENTED
  1035.  num_params = param_split(params,word,SCR_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1036.  if (!valid_positive_integer(word[0]))
  1037.    {
  1038.     display_error(1,word[0]);
  1039. #ifdef TRACE
  1040.     trace_return();
  1041. #endif
  1042.     return(RC_INVALID_OPERAND);
  1043.    }
  1044.  if ((num_views = atoi(word[0])) > MAX_SCREENS)
  1045.    {
  1046.     display_error(6,word[0]);
  1047. #ifdef TRACE
  1048.     trace_return();
  1049. #endif
  1050.     return(RC_INVALID_OPERAND);
  1051.    }
  1052.  if (num_views == 1)
  1053.     horiz = TRUE;
  1054.  else
  1055.    {
  1056.     if (equal((char *)"horizontal",word[1],1)
  1057.     || strcmp(word[1],"") == 0)
  1058.        horiz = TRUE;
  1059.     if (equal((char *)"vertical",word[1],1))
  1060.        horiz = FALSE;
  1061.     if (horiz == (-1))
  1062.       {
  1063.        display_error(1,word[1]);
  1064. #ifdef TRACE
  1065.        trace_return();
  1066. #endif
  1067.        return(RC_INVALID_OPERAND);
  1068.       }
  1069.    }
  1070. /*---------------------------------------------------------------------*/
  1071. /* Set the global variable display_screens to indicate the number of   */
  1072. /* screens currently displayed and the orientation of those screens    */
  1073. /* Save the old values first so we know how the screens were oriented. */
  1074. /*---------------------------------------------------------------------*/
  1075.  save_display_screens = display_screens;
  1076.  save_horizontal = horizontal;
  1077.  
  1078.  display_screens = (char)num_views;
  1079.  horizontal=(bool)horiz;
  1080.  
  1081.  if (in_profile)
  1082.    {
  1083. #ifdef TRACE
  1084.     trace_return();
  1085. #endif
  1086.     return(RC_OK);
  1087.    }
  1088. /*---------------------------------------------------------------------*/
  1089. /* If there is no change to the screens, exit.                         */
  1090. /*---------------------------------------------------------------------*/
  1091.  if (display_screens == save_display_screens
  1092.  &&  horizontal == save_horizontal)
  1093.    {
  1094. #ifdef TRACE
  1095.     trace_return();
  1096. #endif
  1097.     return(RC_OK);
  1098.    }
  1099. /*---------------------------------------------------------------------*/
  1100. /* CURRENTLY ONLY FOR MAKING 2 VIEWS. NOT FOR GOING BACK TO 1 VIEW.....*/
  1101. /*---------------------------------------------------------------------*/
  1102.  post_process_line(CURRENT_VIEW->focus_line);
  1103.  
  1104.  save_current_view = CURRENT_VIEW;
  1105.  
  1106.  set_screen_defaults();
  1107.  
  1108.  if (!horizontal && display_screens > 1)
  1109.     wnoutrefresh(divider);
  1110.  
  1111.  if (display_screens == 1)
  1112.    {
  1113.     if (CURRENT_SCREEN.screen_view->file_for_view == OTHER_SCREEN.screen_view->file_for_view)
  1114.       {
  1115.        CURRENT_VIEW = OTHER_SCREEN.screen_view;
  1116.        free_view_memory();
  1117.        CURRENT_VIEW = save_current_view;
  1118.       }
  1119.     else
  1120.       {
  1121.        CURRENT_VIEW = OTHER_SCREEN.screen_view;
  1122.        for (i=0;i<VIEW_WINDOWS;i++)
  1123.            getyx(CURRENT_VIEW->win[i],save_coord_y[i],save_coord_x[i]);
  1124.        getyx(CURRENT_WINDOW,y,x);
  1125.        delete_windows();
  1126.        if ((rc = set_up_windows()) != RC_OK)
  1127.          {
  1128. #ifdef TRACE
  1129.           trace_return();
  1130. #endif
  1131.           return(rc);
  1132.          }
  1133.        for (i=0;i<VIEW_WINDOWS;i++)
  1134.            wmove(CURRENT_VIEW->win[i],save_coord_y[i],save_coord_x[i]);
  1135.        y = get_row_for_focus_line(CURRENT_VIEW->current_row,
  1136.                             CURRENT_VIEW->focus_line,
  1137.                             CURRENT_VIEW->current_line);
  1138.        if (x > CURRENT_SCREEN.cols)
  1139.           x = 0;
  1140.        wmove(CURRENT_WINDOW,y,x);
  1141.        CURRENT_VIEW = save_current_view;
  1142.       }
  1143.     current_screen = 0;
  1144.     CURRENT_SCREEN.screen_view = CURRENT_VIEW;
  1145.    }
  1146.  
  1147.  getyx(CURRENT_WINDOW,y,x);
  1148.  delete_windows();
  1149.  if ((rc = set_up_windows()) != RC_OK)
  1150.    {
  1151. #ifdef TRACE
  1152.     trace_return();
  1153. #endif
  1154.     return(rc);
  1155.    }
  1156.  repaint_screen();
  1157.  
  1158.  if (display_screens == 1)
  1159.    {
  1160. #ifdef TRACE
  1161.     trace_return();
  1162. #endif
  1163.     return(RC_OK);
  1164.    }
  1165. /* now create the new view, if this is the only file */
  1166.  
  1167.  if (number_of_views == 1)
  1168.    {
  1169.     if ((rc = defaults_for_other_files()) != RC_OK)
  1170.       {
  1171. #ifdef TRACE
  1172.        trace_return();
  1173. #endif
  1174.        return(rc);
  1175.       }
  1176.     CURRENT_FILE = save_current_view->file_for_view;
  1177.     CURRENT_FILE->file_views++;
  1178.     x = y = 0;
  1179.    }
  1180.  else
  1181.    {
  1182.     if (NEXT_VIEW == (VIEW_DETAILS *)NULL)
  1183.        CURRENT_VIEW = vd_first;
  1184.     else
  1185.        CURRENT_VIEW = NEXT_VIEW;
  1186.     getyx(CURRENT_WINDOW,y,x);
  1187.     delete_windows();
  1188.    }
  1189.  current_screen = 1;
  1190.  if ((rc = set_up_windows()) != RC_OK)
  1191.    {
  1192. #ifdef TRACE
  1193.     trace_return();
  1194. #endif
  1195.     return(rc);
  1196.    }
  1197.  CURRENT_SCREEN.screen_view = CURRENT_VIEW;
  1198.  repaint_screen();
  1199.  if (!horizontal)
  1200.    {
  1201.     CURRENT_VIEW = save_current_view;
  1202.     current_screen = 0;
  1203.     pre_process_line(CURRENT_VIEW->focus_line);
  1204.    }
  1205.  
  1206. #ifdef TRACE
  1207.  trace_return();
  1208. #endif
  1209.  return(RC_OK);
  1210. #endif
  1211. }
  1212. /*man-start*********************************************************************
  1213. COMMAND
  1214.      select - sets the selection level for the specified lines
  1215.  
  1216. SYNTAX
  1217.      [SET] SELect [+|-]n target
  1218.  
  1219. DESCRIPTION
  1220.      The SELECT command sets the selection level for the indicated
  1221.      lines equal to n (if no signs are specified) or adds or subtracts
  1222.      n from the selection level currently set for the lines in the
  1223.      target.
  1224.  
  1225. COMPATIBILITY
  1226.      XEDIT: Compatible.
  1227.      KEDIT: Compatible.
  1228.  
  1229. SEE ALSO
  1230.      SET SCOPE, SET SELECT, ALL
  1231.  
  1232. STATUS
  1233.      Not started.
  1234. **man-end**********************************************************************/
  1235. #ifdef PROTO
  1236. int Select(char *params)
  1237. #else
  1238. int Select(params)
  1239. char *params;
  1240. #endif
  1241. /***********************************************************************/
  1242. {
  1243. /*--------------------------- local data ------------------------------*/
  1244.  short rc=RC_OK;
  1245. /*--------------------------- processing ------------------------------*/
  1246. #ifdef TRACE
  1247.  trace_function("commset2.c:Select");
  1248. #endif
  1249.  display_error(0,(char *)"This function has not yet been implemented");
  1250.  
  1251. #ifdef TRACE
  1252.  trace_return();
  1253. #endif
  1254.  return(rc);
  1255. }
  1256. /*man-start*********************************************************************
  1257. COMMAND
  1258.      stay - set condition of cursor position after CHANGE/LOCATE commands
  1259.  
  1260. SYNTAX
  1261.      [SET] STAY ON|OFF
  1262.  
  1263. DESCRIPTION
  1264.      The STAY set command determines what line is displayed as the current
  1265.      line after an unsuccessful LOCATE command or after a CHANGE command.
  1266.      With STAY ON, the current line remains where it currently is. With
  1267.      STAY OFF, after an unsuccessful LOCATE, the current line is "Bottom
  1268.      of File". After a successful CHANGE, the current line is the last
  1269.      line affected by the CHANGE command.
  1270.  
  1271. COMPATIBILITY
  1272.      XEDIT: Compatible.
  1273.      KEDIT: Compatible.
  1274.  
  1275. DEFAULT
  1276.      STAY ON
  1277.  
  1278. STATUS
  1279.      Complete
  1280. **man-end**********************************************************************/
  1281. #ifdef PROTO
  1282. int Stay(char *params)
  1283. #else
  1284. int Stay(params)
  1285. char *params;
  1286. #endif
  1287. /***********************************************************************/
  1288. {
  1289. /*--------------------------- extern data -----------------------------*/
  1290. extern char STAYx;
  1291. /*--------------------------- local data ------------------------------*/
  1292. #define STA_PARAMS  1
  1293.  char parm[STA_PARAMS];
  1294.  char *word[STA_PARAMS+1];
  1295.  register int i;
  1296.  unsigned short num_params;
  1297. /*--------------------------- processing ------------------------------*/
  1298. #ifdef TRACE
  1299.  trace_function("commset2.c:Stay");
  1300. #endif
  1301.  num_params = param_split(params,word,STA_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1302.  
  1303.  parm[0] = (char)UNDEFINED_OPERAND;
  1304.  if (equal((char *)"on",word[0],2))
  1305.     parm[0] = ON;
  1306.  if (equal((char *)"off",word[0],3))
  1307.     parm[0] = OFF;
  1308.  if (parm[0] == (char)UNDEFINED_OPERAND)
  1309.    {
  1310.     display_error(1,word[0]);
  1311. #ifdef TRACE
  1312.     trace_return();
  1313. #endif
  1314.     return(RC_INVALID_OPERAND);
  1315.    }
  1316.  STAYx = CURRENT_VIEW->stay = parm[0];
  1317. #ifdef TRACE
  1318.  trace_return();
  1319. #endif
  1320.  return(RC_OK);
  1321. }
  1322. /*man-start*********************************************************************
  1323. COMMAND
  1324.      tabkey - set characteristics of the tab key
  1325.  
  1326. SYNTAX
  1327.      [SET] TABKey Tab|Character Tab|Character
  1328.  
  1329. DESCRIPTION
  1330.      The TABKEY sets the action to be taken when the tab key is hit.
  1331.      Depending on the insert mode, the tab key will either display
  1332.      a raw tab character or will move to the next tab column.
  1333.      The first operand refers to the behaviour of the TAB key when
  1334.      INSERTMODE is OFF; the second operand specifies the behaviour
  1335.      when the TAB key is hit when INSERTMODE is ON.
  1336.  
  1337. COMPATIBILITY
  1338.      XEDIT: N/A
  1339.      KEDIT: N/A
  1340.  
  1341. DEFAULT
  1342.      TAB CHARACTER
  1343.  
  1344. STATUS
  1345.      Complete
  1346. **man-end**********************************************************************/
  1347. #ifdef PROTO
  1348. int Tabkey(char *params)
  1349. #else
  1350. int Tabkey(params)
  1351. char *params;
  1352. #endif
  1353. /***********************************************************************/
  1354. {
  1355. /*--------------------------- extern data -----------------------------*/
  1356. extern char tabkey_insert,tabkey_overwrite;
  1357. /*--------------------------- local data ------------------------------*/
  1358. #define TKY_PARAMS  3
  1359.  char *word[TKY_PARAMS+1];
  1360.  unsigned short num_params;
  1361.  char tabo=tabkey_overwrite;
  1362.  char tabi=tabkey_insert;
  1363.  int rc=RC_INVALID_OPERAND;
  1364. /*--------------------------- processing ------------------------------*/
  1365. #ifdef TRACE
  1366.  trace_function("commset2.c:Tabkey");
  1367. #endif
  1368. /*---------------------------------------------------------------------*/
  1369. /* Validate the parameters that have been supplied.                    */
  1370. /*---------------------------------------------------------------------*/
  1371.  num_params = param_split(params,word,TKY_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1372.  switch(num_params)
  1373.    {
  1374. /*---------------------------------------------------------------------*/
  1375. /* Too few parameters, error.                                          */
  1376. /*---------------------------------------------------------------------*/
  1377.     case 0: 
  1378.     case 1:
  1379.          display_error(3,(char *)""); 
  1380.          break;
  1381. /*---------------------------------------------------------------------*/
  1382. /* 2 parameters, validate them...                                      */
  1383. /*---------------------------------------------------------------------*/
  1384.     case 2: 
  1385. /*---------------------------------------------------------------------*/
  1386. /* Validate first parameter; overwrite mode setting...                 */
  1387. /*---------------------------------------------------------------------*/
  1388.          if (equal((char *)"character",word[0],1))
  1389.            {
  1390.             tabo = 'C';
  1391.             rc = RC_OK;
  1392.            }
  1393.          if (equal((char *)"tab",word[0],1))
  1394.            {
  1395.             tabo = 'T';
  1396.             rc = RC_OK;
  1397.            }
  1398. /*---------------------------------------------------------------------*/
  1399. /* If not a valid first parameter, display an error and exit.          */
  1400. /*---------------------------------------------------------------------*/
  1401.          if (rc != RC_OK)
  1402.            {
  1403.             display_error(1,word[0]);
  1404.             break;
  1405.            }
  1406.          rc = RC_INVALID_OPERAND;
  1407. /*---------------------------------------------------------------------*/
  1408. /* Validate second parameter; insert mode setting...                   */
  1409. /*---------------------------------------------------------------------*/
  1410.          if (equal((char *)"character",word[1],1))
  1411.            {
  1412.             tabi = 'C';
  1413.             rc = RC_OK;
  1414.            }
  1415. /*---------------------------------------------------------------------*/
  1416. /* Validate second parameter; insert mode setting...                   */
  1417. /*---------------------------------------------------------------------*/
  1418.          if (equal((char *)"tab",word[1],1))
  1419.            {
  1420.             tabi = 'T';
  1421.             rc = RC_OK;
  1422.            }
  1423. /*---------------------------------------------------------------------*/
  1424. /* If not a valid second parameter, display an error and exit.         */
  1425. /*---------------------------------------------------------------------*/
  1426.          if (rc != RC_OK)
  1427.            {
  1428.             display_error(1,word[1]);
  1429.             break;
  1430.            }
  1431.          rc = RC_OK;
  1432.          break;
  1433. /*---------------------------------------------------------------------*/
  1434. /* Too many parameters...                                              */
  1435. /*---------------------------------------------------------------------*/
  1436.     default:
  1437.          display_error(2,(char *)""); 
  1438.          break;
  1439.    }
  1440. /*---------------------------------------------------------------------*/
  1441. /* If valid parameters, change the settings...                         */
  1442. /*---------------------------------------------------------------------*/
  1443.  if (rc == RC_OK)
  1444.    {
  1445.     tabkey_insert = tabi;
  1446.     tabkey_overwrite = tabo;
  1447.    }
  1448. #ifdef TRACE
  1449.  trace_return();
  1450. #endif
  1451.  return(RC_OK);
  1452. }
  1453. /*man-start*********************************************************************
  1454. COMMAND
  1455.      tabs - set tab length for TAB key
  1456.  
  1457. SYNTAX
  1458.      [SET] TABS INCR n
  1459.  
  1460. DESCRIPTION
  1461.      The TABS command determines the position of tab columns when the
  1462.      TAB key is pressed.
  1463.  
  1464. COMPATIBILITY
  1465.      XEDIT: Does not support specification of actual tab columns.
  1466.      KEDIT: Does not support specification of actual tab columns.
  1467.  
  1468. SEE ALSO
  1469.      SOS TABF
  1470.  
  1471. STATUS
  1472.      Complete.
  1473. **man-end**********************************************************************/
  1474. #ifdef PROTO
  1475. int Tabs(char *params)
  1476. #else
  1477. int Tabs(params)
  1478. char *params;
  1479. #endif
  1480. /***********************************************************************/
  1481. {
  1482. /*--------------------------- extern data -----------------------------*/
  1483. extern char TABSx;
  1484. /*--------------------------- local data ------------------------------*/
  1485. #define TABS_PARAMS  2
  1486.  char *word[TABS_PARAMS+1];
  1487.  char parm[TABS_PARAMS];
  1488.  register int i;
  1489.  unsigned short num_params;
  1490.  unsigned short x,y;
  1491.  short rc;
  1492. /*--------------------------- processing ------------------------------*/
  1493. #ifdef TRACE
  1494.  trace_function("commset2.c:Tabs");
  1495. #endif
  1496.  num_params = param_split(params,word,TABS_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1497.  for (i=0;i<TABS_PARAMS;i++)
  1498.      parm[0] = (char)UNDEFINED_OPERAND;
  1499.  if (equal((char *)"incr",word[0],2))
  1500.     parm[0] = TRUE;
  1501.  if (parm[0] == (char)UNDEFINED_OPERAND)
  1502.    {
  1503.     display_error(1,word[0]);
  1504. #ifdef TRACE
  1505.     trace_return();
  1506. #endif
  1507.     return(RC_INVALID_OPERAND);
  1508.    }
  1509.  if (!valid_positive_integer(word[1]))
  1510.    {
  1511.     display_error(4,word[1]);
  1512. #ifdef TRACE
  1513.     trace_return();
  1514. #endif
  1515.     return(RC_INVALID_OPERAND);
  1516.    }
  1517.  parm[1] = (char)atoi(word[1]);
  1518.  if (parm[1] < 1)
  1519.    {
  1520.     display_error(5,word[1]);
  1521. #ifdef TRACE
  1522.     trace_return();
  1523. #endif
  1524.     return(RC_INVALID_OPERAND);
  1525.    }
  1526.  if (parm[1] > 32)
  1527.    {
  1528.     display_error(6,word[1]);
  1529. #ifdef TRACE
  1530.     trace_return();
  1531. #endif
  1532.     return(RC_INVALID_OPERAND);
  1533.    }
  1534.  TABSx = CURRENT_VIEW->tabs = parm[1];
  1535. #ifdef TRACE
  1536.  trace_return();
  1537. #endif
  1538.  return(RC_OK);
  1539. }
  1540. /*man-start*********************************************************************
  1541. COMMAND
  1542.      tabsin - set tab processing on file input
  1543.  
  1544. SYNTAX
  1545.      [SET] TABSIn ON|OFF [n]
  1546.  
  1547. DESCRIPTION
  1548.      The TABSIN command determines if tabs read from a file are to be
  1549.      expanded to spaces and if so how many spaces.
  1550.  
  1551. COMPATIBILITY
  1552.      XEDIT: N/A
  1553.      KEDIT: Does not support TABQUOTE option.
  1554.  
  1555. SEE ALSO
  1556.      tabsout
  1557.  
  1558. STATUS
  1559.      Complete.
  1560. **man-end**********************************************************************/
  1561. #ifdef PROTO
  1562. int Tabsin(char *params)
  1563. #else
  1564. int Tabsin(params)
  1565. char *params;
  1566. #endif
  1567. /***********************************************************************/
  1568. {
  1569. /*---------------------------------------------------------------------*/
  1570. /* The settings for TABSIN is a global value, despite it supposedly    */
  1571. /* being a file level value.                                           */
  1572. /*---------------------------------------------------------------------*/
  1573. /*--------------------------- extern data -----------------------------*/
  1574. extern char TABI_ONx;
  1575. extern char TABI_Nx;
  1576. /*--------------------------- local data ------------------------------*/
  1577. #define TABI_PARAMS  3
  1578.  char *word[TABI_PARAMS+1];
  1579.  unsigned short num_params;
  1580.  int rc=RC_INVALID_OPERAND;
  1581.  char tabsts=TABI_ONx;
  1582.  char tabn  =TABI_Nx;
  1583. /*--------------------------- processing ------------------------------*/
  1584. #ifdef TRACE
  1585.  trace_function("commset2.c:Tabsin");
  1586. #endif
  1587. /*---------------------------------------------------------------------*/
  1588. /* Validate the parameters that have been supplied.                    */
  1589. /*---------------------------------------------------------------------*/
  1590.  num_params = param_split(params,word,TABI_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1591.  switch(num_params)
  1592.    {
  1593. /*---------------------------------------------------------------------*/
  1594. /* Too few parameters, error.                                          */
  1595. /*---------------------------------------------------------------------*/
  1596.     case 0: 
  1597.          display_error(3,(char *)""); 
  1598.          break;
  1599. /*---------------------------------------------------------------------*/
  1600. /* 1 or 2 parameters, validate them...                                 */
  1601. /*---------------------------------------------------------------------*/
  1602.     case 1:
  1603.     case 2: 
  1604. /*---------------------------------------------------------------------*/
  1605. /* Validate first parameter; on or off...                              */
  1606. /*---------------------------------------------------------------------*/
  1607.          if (equal((char *)"on",word[0],2))
  1608.            {
  1609.             tabsts = TRUE;
  1610.             rc = RC_OK;
  1611.            }
  1612.          if (equal((char *)"off",word[0],3))
  1613.            {
  1614.             tabsts = FALSE;
  1615.             rc = RC_OK;
  1616.            }
  1617. /*---------------------------------------------------------------------*/
  1618. /* If not a valid first parameter, display an error and exit.          */
  1619. /*---------------------------------------------------------------------*/
  1620.          if (rc != RC_OK)
  1621.            {
  1622.             display_error(1,word[0]);
  1623.             break;
  1624.            }
  1625. /*---------------------------------------------------------------------*/
  1626. /* For 1 parameter, don't check any more.                              */
  1627. /*---------------------------------------------------------------------*/
  1628.          if (num_params == 1)
  1629.             break;
  1630. /*---------------------------------------------------------------------*/
  1631. /* Validate second parameter; number of spaces for a TAB...            */
  1632. /*---------------------------------------------------------------------*/
  1633.          if (!valid_positive_integer(word[1]))
  1634.            {
  1635.             display_error(4,word[1]);
  1636.             break;
  1637.            }
  1638.          tabn = (char)atoi(word[1]);
  1639. /*---------------------------------------------------------------------*/
  1640. /* tabn must be between 1 and 32...                                    */
  1641. /*---------------------------------------------------------------------*/
  1642.          if (tabn < 1)
  1643.            {
  1644.             display_error(5,word[1]);
  1645.             break;
  1646.            }
  1647.          if (tabn > 32)
  1648.            {
  1649.             display_error(6,word[1]);
  1650.             break;
  1651.            }
  1652.          rc = RC_OK;
  1653.          break;
  1654. /*---------------------------------------------------------------------*/
  1655. /* Too many parameters...                                              */
  1656. /*---------------------------------------------------------------------*/
  1657.     default:
  1658.          display_error(2,(char *)""); 
  1659.          break;
  1660.    }
  1661. /*---------------------------------------------------------------------*/
  1662. /* If valid parameters, change the settings...                         */
  1663. /*---------------------------------------------------------------------*/
  1664.  if (rc == RC_OK)
  1665.    {
  1666.     TABI_ONx = tabsts;
  1667.     TABI_Nx = tabn;
  1668. /*---------------------------------------------------------------------*/
  1669. /* If this command is issued from the profile file, we need to run     */
  1670. /* EXPAND ALL on it, as we have already read in the file.              */
  1671. /*---------------------------------------------------------------------*/
  1672.     if (in_profile)
  1673.        rc = Expand("ALL");
  1674.    }
  1675. #ifdef TRACE
  1676.  trace_return();
  1677. #endif
  1678.  return(rc);
  1679. }
  1680. /*man-start*********************************************************************
  1681. COMMAND
  1682.      tabsout - set tab processing on file output
  1683.  
  1684. SYNTAX
  1685.      [SET] TABSOut ON n
  1686.      [SET] TABSOut OFF
  1687.  
  1688. DESCRIPTION
  1689.      The TABSOUT command determines if spaces written to a file are to be
  1690.      compressed to tabs and if so how many spaces.
  1691.  
  1692. COMPATIBILITY
  1693.      XEDIT: N/A
  1694.      KEDIT: Compatible.
  1695.  
  1696. SEE ALSO
  1697.      tabsin
  1698.  
  1699. STATUS
  1700.      Complete.
  1701. **man-end**********************************************************************/
  1702. #ifdef PROTO
  1703. int Tabsout(char *params)
  1704. #else
  1705. int Tabsout(params)
  1706. char *params;
  1707. #endif
  1708. /***********************************************************************/
  1709. {
  1710. /*--------------------------- extern data -----------------------------*/
  1711. extern char TABO_ONx;
  1712. extern char TABO_Nx;
  1713. /*--------------------------- local data ------------------------------*/
  1714. #define TABO_PARAMS  3
  1715.  char *word[TABO_PARAMS+1];
  1716.  unsigned short num_params;
  1717.  int rc=RC_INVALID_OPERAND;
  1718.  char tabsts=CURRENT_FILE->tabsout_on;
  1719.  char tabn  =CURRENT_FILE->tabsout_num;
  1720. /*--------------------------- processing ------------------------------*/
  1721. #ifdef TRACE
  1722.  trace_function("commset2.c:Tabsout");
  1723. #endif
  1724. /*---------------------------------------------------------------------*/
  1725. /* Validate the parameters that have been supplied.                    */
  1726. /*---------------------------------------------------------------------*/
  1727.  num_params = param_split(params,word,TABO_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1728.  switch(num_params)
  1729.    {
  1730. /*---------------------------------------------------------------------*/
  1731. /* Too few parameters, error.                                          */
  1732. /*---------------------------------------------------------------------*/
  1733.     case 0: 
  1734.          display_error(3,(char *)""); 
  1735.          break;
  1736. /*---------------------------------------------------------------------*/
  1737. /* 1 or 2 parameters, validate them...                                 */
  1738. /*---------------------------------------------------------------------*/
  1739.     case 1:
  1740.     case 2: 
  1741. /*---------------------------------------------------------------------*/
  1742. /* Validate first parameter; on or off...                              */
  1743. /*---------------------------------------------------------------------*/
  1744.          if (equal((char *)"on",word[0],2))
  1745.            {
  1746.             tabsts = TRUE;
  1747.             rc = RC_OK;
  1748.            }
  1749.          if (equal((char *)"off",word[0],3))
  1750.            {
  1751.             tabsts = FALSE;
  1752.             rc = RC_OK;
  1753.            }
  1754. /*---------------------------------------------------------------------*/
  1755. /* If not a valid first parameter, display an error and exit.          */
  1756. /*---------------------------------------------------------------------*/
  1757.          if (rc != RC_OK)
  1758.            {
  1759.             display_error(1,word[0]);
  1760.             break;
  1761.            }
  1762. /*---------------------------------------------------------------------*/
  1763. /* For 1 parameter, don't check any more.                              */
  1764. /*---------------------------------------------------------------------*/
  1765.          if (num_params == 1)
  1766.             break;
  1767. /*---------------------------------------------------------------------*/
  1768. /* Validate second parameter; number of spaces for a TAB...            */
  1769. /*---------------------------------------------------------------------*/
  1770.          if (!valid_positive_integer(word[1]))
  1771.            {
  1772.             display_error(4,word[1]);
  1773.             break;
  1774.            }
  1775.          tabn = (char)atoi(word[1]);
  1776. /*---------------------------------------------------------------------*/
  1777. /* tabn must be between 1 and 32...                                    */
  1778. /*---------------------------------------------------------------------*/
  1779.          if (tabn < 1)
  1780.            {
  1781.             display_error(5,word[1]);
  1782.             break;
  1783.            }
  1784.          if (tabn > 32)
  1785.            {
  1786.             display_error(6,word[1]);
  1787.             break;
  1788.            }
  1789.          rc = RC_OK;
  1790.          break;
  1791. /*---------------------------------------------------------------------*/
  1792. /* Too many parameters...                                              */
  1793. /*---------------------------------------------------------------------*/
  1794.     default:
  1795.          display_error(2,(char *)""); 
  1796.          break;
  1797.    }
  1798. /*---------------------------------------------------------------------*/
  1799. /* If valid parameters, change the settings...                         */
  1800. /*---------------------------------------------------------------------*/
  1801.  if (rc == RC_OK)
  1802.    {
  1803.     TABO_ONx = CURRENT_FILE->tabsout_on = tabsts;
  1804.     TABO_Nx = CURRENT_FILE->tabsout_num = tabn;
  1805.    }
  1806. #ifdef TRACE
  1807.  trace_return();
  1808. #endif
  1809.  return(RC_OK);
  1810. }
  1811. /*man-start*********************************************************************
  1812. COMMAND
  1813.      verify - set column display limits
  1814.  
  1815. SYNTAX
  1816.      [SET] Verify first [last]
  1817.  
  1818. DESCRIPTION
  1819.      The VERIFY command sets the column limits for the display of the
  1820.      current file. 'first' specifies the first column to be displayed
  1821.      and 'last' specifies the last column to be displayed.
  1822.  
  1823.      If no 'last' option is specified '*' is assumed.
  1824.  
  1825. COMPATIBILITY
  1826.      XEDIT: Does not implement HEX display nor multiple column pairs.
  1827.      KEDIT: Does not implement HEX display nor multiple column pairs.
  1828.  
  1829. SEE ALSO
  1830.      Zone
  1831.  
  1832. STATUS
  1833.      Complete.
  1834. **man-end**********************************************************************/
  1835. #ifdef PROTO
  1836. int Verify(char *params)
  1837. #else
  1838. int Verify(params)
  1839. char *params;
  1840. #endif
  1841. /***********************************************************************/
  1842. {
  1843. /*--------------------------- extern data -----------------------------*/
  1844.  extern unsigned short VER_STAx;
  1845.  extern unsigned short VER_COLx;
  1846.  extern unsigned short VER_ENDx;
  1847. /*--------------------------- local data ------------------------------*/
  1848. #define VER_PARAMS  2
  1849.  char *word[VER_PARAMS+1];
  1850.  unsigned short num_params;
  1851.  long col1,col2;
  1852.  unsigned short x,y;
  1853. /*--------------------------- processing ------------------------------*/
  1854. #ifdef TRACE
  1855.  trace_function("commset2.c:Verify");
  1856. #endif
  1857. /*---------------------------------------------------------------------*/
  1858. /* Validate the parameters that have been supplied. One or two         */
  1859. /* parameters can be supplied. The first parameter MUST be a positive  */
  1860. /* integer. The second can be a positive integer or '*'. If no second  */
  1861. /* parameter is supplied, '*' is assumed. The second parameter MUST be */
  1862. /* >= first parameter. '*' is regarded as the biggest number and is    */
  1863. /* literally max_line_length.                                          */
  1864. /*---------------------------------------------------------------------*/
  1865.  num_params = param_split(params,word,VER_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1866.  if (num_params == 0)
  1867.    {
  1868.     display_error(3,(char *)"");
  1869. #ifdef TRACE
  1870.     trace_return();
  1871. #endif
  1872.     return(RC_INVALID_OPERAND);
  1873.    }
  1874.  if (num_params > 2)
  1875.    {
  1876.     display_error(2,(char *)"");
  1877. #ifdef TRACE
  1878.     trace_return();
  1879. #endif
  1880.     return(RC_INVALID_OPERAND);
  1881.    }
  1882.  if (!valid_positive_integer(word[0]))
  1883.    {
  1884.     display_error(4,word[0]);
  1885. #ifdef TRACE
  1886.     trace_return();
  1887. #endif
  1888.     return(RC_INVALID_OPERAND);
  1889.    }
  1890.  col1 = atol(word[0]);
  1891.  if (num_params == 1)
  1892.      col2 = max_line_length;
  1893.  else
  1894.      if (strcmp(word[1],"*") == 0)
  1895.         col2 = max_line_length;
  1896.      else
  1897.         if (!valid_positive_integer(word[1]))
  1898.           {
  1899.            display_error(4,word[1]);
  1900. #ifdef TRACE
  1901.            trace_return();
  1902. #endif
  1903.            return(RC_INVALID_OPERAND);
  1904.           }
  1905.         else
  1906.            col2 = atol(word[1]);
  1907.  
  1908.  if (col2 > max_line_length)
  1909.     col2 = max_line_length;
  1910.  if (col1 > col2)
  1911.    {
  1912.     display_error(6,word[0]);
  1913. #ifdef TRACE
  1914.     trace_return();
  1915. #endif
  1916.     return(RC_INVALID_OPERAND);
  1917.    }
  1918.  CURRENT_VIEW->verify_start = col1;
  1919.  CURRENT_VIEW->verify_col = col1;
  1920.  CURRENT_VIEW->verify_end   = col2;
  1921.  if (in_profile)
  1922.    {
  1923.     VER_STAx = col1;
  1924.     VER_COLx = col1;
  1925.     VER_ENDx = col2;
  1926.    }
  1927.  else
  1928.    {
  1929.     getyx(CURRENT_WINDOW,y,x);
  1930.     show_page();
  1931.     if (CURRENT_VIEW->current_window != WINDOW_COMMAND)
  1932.        wmove(CURRENT_WINDOW,y,x);
  1933.    }
  1934.  
  1935. #ifdef TRACE
  1936.  trace_return();
  1937. #endif
  1938.  return(RC_OK);
  1939. }
  1940. /*man-start*********************************************************************
  1941. COMMAND
  1942.      wordwrap - set wordwrap feature on or off
  1943.  
  1944. SYNTAX
  1945.      [SET] WORDWrap ON|OFF
  1946.  
  1947. DESCRIPTION
  1948.      The WORDWRAP set command determines whether wordwrap occurs when
  1949.      the cursor moves past the right margin (as set my [SET] MARGINS 
  1950.      command).
  1951.      With WORDWRAP ON, the line, from the beginning of the word that
  1952.      exceeds the right margin, is wrapped onto the next line. The cursor
  1953.      position stays in the same position relative to the current word.
  1954.      WIth WORDWRAP OFF, no word wrap occurs.
  1955.  
  1956. COMPATIBILITY
  1957.      XEDIT: N/A
  1958.      KEDIT: Compatible.
  1959.  
  1960. DEFAULT
  1961.      WORDWRAP OFF
  1962.  
  1963. STATUS
  1964.      Complete.
  1965. **man-end**********************************************************************/
  1966. #ifdef PROTO
  1967. int Wordwrap(char *params)
  1968. #else
  1969. int Wordwrap(params)
  1970. char *params;
  1971. #endif
  1972. /***********************************************************************/
  1973. {
  1974. /*--------------------------- extern data -----------------------------*/
  1975. extern char WORx;
  1976. /*--------------------------- local data ------------------------------*/
  1977. #define WOR_PARAMS  1
  1978.  char parm[WOR_PARAMS];
  1979.  char *word[WOR_PARAMS+1];
  1980.  register int i;
  1981.  unsigned short num_params;
  1982. /*--------------------------- processing ------------------------------*/
  1983. #ifdef TRACE
  1984.  trace_function("commset1.c:Wordwrap");
  1985. #endif
  1986.  num_params = param_split(params,word,WOR_PARAMS,WORD_DELIMS,TEMP_PARAM);
  1987.  
  1988.  parm[0] = (char)UNDEFINED_OPERAND;
  1989.  if (equal((char *)"on",word[0],2))
  1990.     parm[0] = ON;
  1991.  if (equal((char *)"off",word[0],3))
  1992.     parm[0] = OFF;
  1993.  if (parm[0] == (char)UNDEFINED_OPERAND)
  1994.    {
  1995.     display_error(1,word[0]);
  1996. #ifdef TRACE
  1997.     trace_return();
  1998. #endif
  1999.     return(RC_INVALID_OPERAND);
  2000.    }
  2001.  CURRENT_VIEW->wordwrap = parm[0];
  2002. #ifdef TRACE
  2003.  trace_return();
  2004. #endif
  2005.  return(RC_OK);
  2006. }
  2007. /*man-start*********************************************************************
  2008. COMMAND
  2009.      zone - set column limits for editing
  2010.  
  2011. SYNTAX
  2012.      [SET] Zone first [last]
  2013.  
  2014. DESCRIPTION
  2015.      The ZONE command sets the column limits for various other editor
  2016.      commands, such as 'locate' and 'change'. It effectively restricts
  2017.      to the specified columns those parts of the file which can be
  2018.      acted upon.
  2019.  
  2020.      If no 'last' option is specified '*' is assumed.
  2021.  
  2022. COMPATIBILITY
  2023.      XEDIT: Compatible.
  2024.      KEDIT: Compatible.
  2025.  
  2026. SEE ALSO
  2027.      Verify
  2028.  
  2029. STATUS
  2030.      Complete.
  2031. **man-end**********************************************************************/
  2032. #ifdef PROTO
  2033. int Zone(char *params)
  2034. #else
  2035. int Zone(params)
  2036. char *params;
  2037. #endif
  2038. /***********************************************************************/
  2039. {
  2040. /*--------------------------- extern data -----------------------------*/
  2041.  extern unsigned short ZON_STAx;
  2042.  extern unsigned short ZON_ENDx;
  2043.  extern char file_read; /* indicates if we have read the file */
  2044. /*--------------------------- local data ------------------------------*/
  2045. #define ZON_PARAMS  2
  2046.  char *word[ZON_PARAMS+1];
  2047.  unsigned short num_params;
  2048.  long col1,col2;
  2049.  unsigned short x,y;
  2050. /*--------------------------- processing ------------------------------*/
  2051. #ifdef TRACE
  2052.  trace_function("commset2.c:Zone");
  2053. #endif
  2054. /*---------------------------------------------------------------------*/
  2055. /* Validate the parameters that have been supplied. One only           */
  2056. /* parameter MUST be supplied. The first parameter MUST be a positive  */
  2057. /* integer. The second can be a positive integer or '*'. If no second  */
  2058. /* parameter is supplied, ERROR.          The second parameter MUST be */
  2059. /* >= first parameter. '*' is regarded as the biggest number and is    */
  2060. /* literally max_line_length.                                          */
  2061. /*---------------------------------------------------------------------*/
  2062.  num_params = param_split(params,word,ZON_PARAMS,WORD_DELIMS,TEMP_PARAM);
  2063.  if (num_params < 2)
  2064.    {
  2065.     display_error(3,(char *)"");
  2066. #ifdef TRACE
  2067.     trace_return();
  2068. #endif
  2069.     return(RC_INVALID_OPERAND);
  2070.    }
  2071.  if (num_params > 2)
  2072.    {
  2073.     display_error(2,(char *)"");
  2074. #ifdef TRACE
  2075.     trace_return();
  2076. #endif
  2077.     return(RC_INVALID_OPERAND);
  2078.    }
  2079.  if (!valid_positive_integer(word[0]))
  2080.    {
  2081.     display_error(4,word[0]);
  2082. #ifdef TRACE
  2083.     trace_return();
  2084. #endif
  2085.     return(RC_INVALID_OPERAND);
  2086.    }
  2087.  col1 = atol(word[0]);
  2088.  if (strcmp(word[1],"*") == 0)
  2089.     col2 = max_line_length;
  2090.  else
  2091.     if (!valid_positive_integer(word[1]))
  2092.       {
  2093.        display_error(4,word[1]);
  2094. #ifdef TRACE
  2095.        trace_return();
  2096. #endif
  2097.        return(RC_INVALID_OPERAND);
  2098.       }
  2099.     else
  2100.        col2 = atol(word[1]);
  2101.  
  2102.  if (col2 > max_line_length)
  2103.     col2 = max_line_length;
  2104.  if (col1 > col2)
  2105.    {
  2106.     display_error(6,word[0]);
  2107. #ifdef TRACE
  2108.     trace_return();
  2109. #endif
  2110.     return(RC_INVALID_OPERAND);
  2111.    }
  2112.  CURRENT_VIEW->zone_start = col1;
  2113.  CURRENT_VIEW->zone_end   = col2;
  2114.  if (in_profile)
  2115.    {
  2116.     ZON_STAx = col1;
  2117.     ZON_ENDx = col2;
  2118.    }
  2119. #ifdef TRACE
  2120.  trace_return();
  2121. #endif
  2122.  return(RC_OK);
  2123. }
  2124.