Print this page
5088 it's probably ok for vi to stop working around pdp-11 bugs now

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/vi/port/ex_subr.c
          +++ new/usr/src/cmd/vi/port/ex_subr.c
↓ open down ↓ 216 lines elided ↑ open up ↑
 217  217  {
 218  218  
 219  219          getaline(*dot);
 220  220  }
 221  221  
 222  222  line *
 223  223  getmark(c)
 224  224          int c;
 225  225  {
 226  226          line *addr;
 227      -        
      227 +
 228  228          for (addr = one; addr <= dol; addr++)
 229  229                  if (names[c - 'a'] == (*addr &~ 01)) {
 230  230                          return (addr);
 231  231                  }
 232  232          return (0);
 233  233  }
 234  234  
 235  235  void
 236  236  ignnEOF(void)
 237  237  {
↓ open down ↓ 331 lines elided ↑ open up ↑
 569  569          OO = Outchar;
 570  570          Outchar = qcount;
 571  571          vcntcol = 0;
 572  572          if (lim != NULL) {
 573  573                  if(lim == linebuf - 1 || lim == &linebuf[LBSIZE-2])
 574  574                          length = 1;
 575  575                  else
 576  576                          length = mbtowc(&wchar, (char *)lim, MULTI_BYTE_MAX);
 577  577                  if(length < 0)
 578  578                          length = 1;
 579      -                x = lim[length]; 
      579 +                x = lim[length];
 580  580                  lim[length] = 0;
 581  581          }
 582  582          pline(0);
 583  583          if (lim != NULL)
 584  584                  lim[length] = x;
 585  585          if(length > 1 && !gp) {
 586  586                  /* put cursor at beginning of multibyte character */
 587  587                  if ((col = wcwidth(wchar)) < 0)
 588  588                          col = 0;
 589  589                  vcntcol = vcntcol - col + 1;
↓ open down ↓ 25 lines elided ↑ open up ↑
 615  615          OO = Outchar;
 616  616          Outchar = qcount;
 617  617          vcntcol = 0;
 618  618          if (lim != NULL) {
 619  619                  if(lim == linebuf - 1 || lim == &linebuf[LBSIZE-2])
 620  620                          length = 1;
 621  621                  else
 622  622                          length = mbtowc(&wchar, (char *)lim, MULTI_BYTE_MAX);
 623  623                  if(length < 0)
 624  624                          length = 1;
 625      -                x = lim[length]; 
      625 +                x = lim[length];
 626  626                  lim[length] = 0;
 627  627          }
 628  628          pline(0);
 629  629          if (lim != NULL)
 630  630                  lim[length] = x;
 631  631          if (gp)
 632  632                  while (*gp) {
 633  633                          length = mbtowc(&wchar, (char *)gp, MULTI_BYTE_MAX);
 634  634                          if(length < 0) {
 635  635                                  putoctal = 1;
↓ open down ↓ 281 lines elided ↑ open up ↑
 917  917  
 918  918  void
 919  919  markit(line *addr)
 920  920  {
 921  921  
 922  922          if (addr != dot && addr >= one && addr <= dol)
 923  923                  markDOT();
 924  924  }
 925  925  
 926  926  /*
 927      - * The following code is defensive programming against a bug in the
 928      - * pdp-11 overlay implementation.  Sometimes it goes nuts and asks
 929      - * for an overlay with some garbage number, which generates an emt
 930      - * trap.  This is a less than elegant solution, but it is somewhat
 931      - * better than core dumping and losing your work, leaving your tty
 932      - * in a weird state, etc.
 933      - */
 934      -int _ovno;
 935      -
 936      -/*ARGSUSED*/
 937      -void 
 938      -onemt(sig)
 939      -int sig;
 940      -{
 941      -        int oovno;
 942      -
 943      -        signal(SIGEMT, onemt);
 944      -        oovno = _ovno;
 945      -        /* 2 and 3 are valid on 11/40 type vi, so */
 946      -        if (_ovno < 0 || _ovno > 3)
 947      -                _ovno = 0;
 948      -        error(value(vi_TERSE) ? gettext("emt trap, _ovno is %d ") :
 949      -gettext("emt trap, _ovno is %d   - try again"));
 950      -}
 951      -
 952      -/*
 953  927   * When a hangup occurs our actions are similar to a preserve
 954  928   * command.  If the buffer has not been [Modified], then we do
 955  929   * nothing but remove the temporary files and exit.
 956  930   * Otherwise, we sync the temp file and then attempt a preserve.
 957  931   * If the preserve succeeds, we unlink our temp files.
 958  932   * If the preserve fails, we leave the temp files as they are
 959  933   * as they are a backup even without preservation if they
 960  934   * are not removed.
 961  935   */
 962  936  
 963  937  /*ARGSUSED*/
 964      -void 
      938 +void
 965  939  onhup(sig)
 966  940  int sig;
 967  941  {
 968  942  
 969  943          /*
 970  944           * USG tty driver can send multiple HUP's!!
 971  945           */
 972  946          signal(SIGINT, SIG_IGN);
 973  947          signal(SIGHUP, SIG_IGN);
 974  948          if (chng == 0) {
↓ open down ↓ 52 lines elided ↑ open up ↑
1027 1001  /*
1028 1002   * An interrupt occurred.  Drain any output which
1029 1003   * is still in the output buffering pipeline.
1030 1004   * Catch interrupts again.  Unless we are in visual
1031 1005   * reset the output state (out of -nl mode, e.g).
1032 1006   * Then like a normal error (with the \n before Interrupt
1033 1007   * suppressed in visual mode).
1034 1008   */
1035 1009  
1036 1010  /*ARGSUSED*/
1037      -void 
     1011 +void
1038 1012  onintr(sig)
1039 1013  int sig;
1040 1014  {
1041 1015  #ifndef CBREAK
1042 1016          signal(SIGINT, onintr);
1043 1017  #else
1044 1018          signal(SIGINT, inopen ? vintr : onintr);
1045 1019  #endif
1046 1020          cancelalarm();
1047 1021          draino();
↓ open down ↓ 68 lines elided ↑ open up ↑
1116 1090  }
1117 1091  #endif
1118 1092  
1119 1093  #ifdef SIGTSTP
1120 1094  /*
1121 1095   * We have just gotten a susp.  Suspend and prepare to resume.
1122 1096   */
1123 1097  extern void redraw();
1124 1098  
1125 1099  /*ARGSUSED*/
1126      -void 
     1100 +void
1127 1101  onsusp(sig)
1128 1102  int sig;
1129 1103  {
1130 1104          ttymode f;
1131 1105          int savenormtty;
1132 1106  
1133 1107          f = setty(normf);
1134 1108          vnfl();
1135 1109          putpad((unsigned char *)exit_ca_mode);
1136 1110          flush();
↓ open down ↓ 17 lines elided ↑ open up ↑
1154 1128                  if(vcnt < 0) {
1155 1129                          vcnt = -vcnt;
1156 1130                          if(state == VISUAL)
1157 1131                                  vclear();
1158 1132                          else if(state == CRTOPEN)
1159 1133                                  vcnt = 0;
1160 1134                  }
1161 1135                  vdirty(0, lines);
1162 1136                  if (sig)
1163 1137                          vrepaint(cursor);
1164      -        }       
     1138 +        }
1165 1139  }
1166 1140  #endif
1167 1141  
1168 1142  unsigned char *nextchr(cursor)
1169 1143  unsigned char *cursor;
1170 1144  {
1171 1145  
1172 1146          wchar_t wchar;
1173 1147          int length;
1174 1148          length = mbtowc(&wchar, (char *)cursor, MULTI_BYTE_MAX);
↓ open down ↓ 13 lines elided ↑ open up ↑
1188 1162          ccursor = ocursor = linebuf;
1189 1163          while(ccursor < cursor) {
1190 1164                  length = mbtowc(&wchar, (char *)ccursor, MULTI_BYTE_MAX);
1191 1165                  ocursor =  ccursor;
1192 1166                  if(length <= 0)
1193 1167                          ccursor++;
1194 1168                  else
1195 1169                          ccursor += length;
1196 1170          }
1197 1171          return(ocursor);
1198      -}                       
     1172 +}
1199 1173  
1200 1174  int
1201 1175  ixlatctl(int flag)
1202 1176  {
1203 1177          static struct strioctl sb = {0, 0, 0, 0};
1204 1178  
1205 1179          if (!(MULTI_BYTE_MAX > 1))
1206 1180                  return (0);
1207 1181  
1208 1182          switch (flag) {
↓ open down ↓ 41 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX