Tcl Source Code

Hex Artifact Content
Login

Artifact a611fdb5cd9869850b9897deeae9b94b7d4b7164:

Attachment "ignoredcd.diff" to ticket [3324195fff] added by egavilan 2011-06-22 02:32:40.
0000: 2d 2d 2d 20 75 6e 69 78 2f 74 63 6c 55 6e 69 78  --- unix/tclUnix
0010: 43 68 61 6e 2e 63 0a 2b 2b 2b 20 75 6e 69 78 2f  Chan.c.+++ unix/
0020: 74 63 6c 55 6e 69 78 43 68 61 6e 2e 63 0a 40 40  tclUnixChan.c.@@
0030: 20 2d 38 33 36 2c 31 32 20 2b 38 33 36 2c 33 35   -836,12 +836,35
0040: 20 40 40 0a 20 09 53 45 54 43 4f 4e 54 52 4f 4c   @@. .SETCONTROL
0050: 28 66 73 50 74 72 2d 3e 66 64 2c 20 26 63 6f 6e  (fsPtr->fd, &con
0060: 74 72 6f 6c 29 3b 0a 20 09 63 6b 66 72 65 65 28  trol);. .ckfree(
0070: 61 72 67 76 29 3b 0a 20 09 72 65 74 75 72 6e 20  argv);. .return 
0080: 54 43 4c 5f 4f 4b 3b 0a 20 20 20 20 20 7d 0a 20  TCL_OK;.     }. 
0090: 0a 2b 23 69 66 64 65 66 20 43 4c 4f 43 41 4c 0a  .+#ifdef CLOCAL.
00a0: 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20 2a 20  +    /*.+     * 
00b0: 4f 70 74 69 6f 6e 20 2d 69 6e 67 6f 72 65 64 63  Option -ingoredc
00c0: 64 20 62 6f 6f 6c 0a 2b 20 20 20 20 20 2a 2f 0a  d bool.+     */.
00d0: 2b 0a 2b 20 20 20 20 69 66 20 28 28 6c 65 6e 20  +.+    if ((len 
00e0: 3e 20 32 29 20 26 26 20 28 73 74 72 6e 63 6d 70  > 2) && (strncmp
00f0: 28 6f 70 74 69 6f 6e 4e 61 6d 65 2c 20 22 2d 69  (optionName, "-i
0100: 67 6e 6f 72 65 64 63 64 22 2c 20 6c 65 6e 29 20  gnoredcd", len) 
0110: 3d 3d 20 30 29 29 20 7b 0a 2b 20 20 20 20 20 20  == 0)) {.+      
0120: 20 20 69 66 20 28 54 63 6c 5f 47 65 74 42 6f 6f    if (Tcl_GetBoo
0130: 6c 65 61 6e 28 69 6e 74 65 72 70 2c 20 76 61 6c  lean(interp, val
0140: 75 65 2c 20 26 66 6c 61 67 29 20 3d 3d 20 54 43  ue, &flag) == TC
0150: 4c 5f 45 52 52 4f 52 29 20 7b 0a 2b 20 20 20 20  L_ERROR) {.+    
0160: 20 20 20 20 20 20 20 20 72 65 74 75 72 6e 20 54          return T
0170: 43 4c 5f 45 52 52 4f 52 3b 0a 2b 20 20 20 20 20  CL_ERROR;.+     
0180: 20 20 20 7d 0a 2b 20 20 20 20 20 20 20 20 47 45     }.+        GE
0190: 54 49 4f 53 54 41 54 45 28 66 73 50 74 72 2d 3e  TIOSTATE(fsPtr->
01a0: 66 64 2c 20 26 69 6f 73 74 61 74 65 29 3b 0a 2b  fd, &iostate);.+
01b0: 20 20 20 20 20 20 20 20 69 66 20 28 66 6c 61 67          if (flag
01c0: 29 20 7b 0a 2b 20 20 20 20 20 20 20 20 20 20 20  ) {.+           
01d0: 20 20 20 20 20 53 45 54 5f 42 49 54 53 28 69 6f       SET_BITS(io
01e0: 73 74 61 74 65 2e 63 5f 63 66 6c 61 67 2c 20 43  state.c_cflag, C
01f0: 4c 4f 43 41 4c 29 3b 0a 2b 20 20 20 20 20 20 20  LOCAL);.+       
0200: 20 7d 20 65 6c 73 65 20 7b 0a 2b 20 20 20 20 20   } else {.+     
0210: 20 20 20 20 20 20 20 20 20 20 20 43 4c 45 41 52             CLEAR
0220: 5f 42 49 54 53 28 69 6f 73 74 61 74 65 2e 63 5f  _BITS(iostate.c_
0230: 63 66 6c 61 67 2c 20 43 4c 4f 43 41 4c 29 3b 0a  cflag, CLOCAL);.
0240: 2b 20 20 20 20 20 20 20 20 7d 0a 2b 20 20 20 20  +        }.+    
0250: 20 20 20 20 53 45 54 49 4f 53 54 41 54 45 28 66      SETIOSTATE(f
0260: 73 50 74 72 2d 3e 66 64 2c 20 26 69 6f 73 74 61  sPtr->fd, &iosta
0270: 74 65 29 3b 0a 2b 20 20 20 20 20 20 20 20 72 65  te);.+        re
0280: 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 2b 20 20  turn TCL_OK;.+  
0290: 20 20 7d 0a 2b 0a 2b 20 20 20 20 72 65 74 75 72    }.+.+    retur
02a0: 6e 20 54 63 6c 5f 42 61 64 43 68 61 6e 6e 65 6c  n Tcl_BadChannel
02b0: 4f 70 74 69 6f 6e 28 69 6e 74 65 72 70 2c 20 6f  Option(interp, o
02c0: 70 74 69 6f 6e 4e 61 6d 65 2c 0a 2b 09 20 20 20  ptionName,.+.   
02d0: 20 22 69 67 6e 6f 72 65 64 63 64 20 6d 6f 64 65   "ignoredcd mode
02e0: 20 68 61 6e 64 73 68 61 6b 65 20 74 69 6d 65 6f   handshake timeo
02f0: 75 74 20 74 74 79 63 6f 6e 74 72 6f 6c 20 78 63  ut ttycontrol xc
0300: 68 61 72 22 29 3b 0a 2b 23 65 6c 73 65 20 2f 2a  har");.+#else /*
0310: 20 21 43 4c 4f 43 41 4c 20 2a 2f 0a 20 20 20 20   !CLOCAL */.    
0320: 20 72 65 74 75 72 6e 20 54 63 6c 5f 42 61 64 43   return Tcl_BadC
0330: 68 61 6e 6e 65 6c 4f 70 74 69 6f 6e 28 69 6e 74  hannelOption(int
0340: 65 72 70 2c 20 6f 70 74 69 6f 6e 4e 61 6d 65 2c  erp, optionName,
0350: 0a 20 09 20 20 20 20 22 6d 6f 64 65 20 68 61 6e  . .    "mode han
0360: 64 73 68 61 6b 65 20 74 69 6d 65 6f 75 74 20 74  dshake timeout t
0370: 74 79 63 6f 6e 74 72 6f 6c 20 78 63 68 61 72 22  tycontrol xchar"
0380: 29 3b 0a 2b 23 65 6e 64 69 66 20 2f 2a 20 43 4c  );.+#endif /* CL
0390: 4f 43 41 4c 20 2a 2f 0a 20 0a 20 23 65 6c 73 65  OCAL */. . #else
03a0: 20 2f 2a 20 21 55 53 45 5f 54 45 52 4d 49 4f 53   /* !USE_TERMIOS
03b0: 20 2a 2f 0a 20 20 20 20 20 72 65 74 75 72 6e 20   */.     return 
03c0: 54 63 6c 5f 42 61 64 43 68 61 6e 6e 65 6c 4f 70  Tcl_BadChannelOp
03d0: 74 69 6f 6e 28 69 6e 74 65 72 70 2c 20 6f 70 74  tion(interp, opt
03e0: 69 6f 6e 4e 61 6d 65 2c 20 22 6d 6f 64 65 22 29  ionName, "mode")
03f0: 3b 0a 20 23 65 6e 64 69 66 20 2f 2a 20 55 53 45  ;. #endif /* USE
0400: 5f 54 45 52 4d 49 4f 53 20 2a 2f 0a 20 7d 0a 40  _TERMIOS */. }.@
0410: 40 20 2d 39 36 32 2c 31 38 20 2b 39 38 35 2c 34  @ -962,18 +985,4
0420: 32 20 40 40 0a 20 0a 20 09 76 61 6c 69 64 20 3d  2 @@. . .valid =
0430: 20 31 3b 0a 20 09 47 45 54 43 4f 4e 54 52 4f 4c   1;. .GETCONTROL
0440: 28 66 73 50 74 72 2d 3e 66 64 2c 20 26 73 74 61  (fsPtr->fd, &sta
0450: 74 75 73 29 3b 0a 20 09 54 74 79 4d 6f 64 65 6d  tus);. .TtyModem
0460: 53 74 61 74 75 73 53 74 72 28 73 74 61 74 75 73  StatusStr(status
0470: 2c 20 64 73 50 74 72 29 3b 0a 20 20 20 20 20 7d  , dsPtr);.     }
0480: 0a 2b 0a 2b 23 69 66 64 65 66 20 43 4c 4f 43 41  .+.+#ifdef CLOCA
0490: 4c 0a 2b 20 20 20 20 2f 2a 0a 2b 20 20 20 20 20  L.+    /*.+     
04a0: 2a 20 47 65 74 20 6f 70 74 69 6f 6e 20 2d 69 67  * Get option -ig
04b0: 6e 6f 72 65 64 63 64 0a 2b 20 20 20 20 20 2a 2f  noredcd.+     */
04c0: 0a 2b 0a 2b 20 20 20 20 69 66 20 28 28 6c 65 6e  .+.+    if ((len
04d0: 20 3e 20 34 29 20 26 26 20 28 73 74 72 6e 63 6d   > 4) && (strncm
04e0: 70 28 6f 70 74 69 6f 6e 4e 61 6d 65 2c 20 22 2d  p(optionName, "-
04f0: 69 67 6e 6f 72 65 64 63 64 22 2c 20 6c 65 6e 29  ignoredcd", len)
0500: 20 3d 3d 20 30 29 29 20 7b 0a 2b 09 49 4f 53 54   == 0)) {.+.IOST
0510: 41 54 45 20 69 6f 73 74 61 74 65 3b 0a 2b 0a 2b  ATE iostate;.+.+
0520: 09 76 61 6c 69 64 20 3d 20 31 3b 0a 2b 20 20 20  .valid = 1;.+   
0530: 20 20 20 20 20 54 63 6c 5f 44 53 74 72 69 6e 67       Tcl_DString
0540: 41 70 70 65 6e 64 45 6c 65 6d 65 6e 74 28 64 73  AppendElement(ds
0550: 50 74 72 2c 20 22 2d 69 67 6e 6f 72 65 64 63 64  Ptr, "-ignoredcd
0560: 22 29 3b 0a 2b 09 47 45 54 49 4f 53 54 41 54 45  ");.+.GETIOSTATE
0570: 28 66 73 50 74 72 2d 3e 66 64 2c 20 26 69 6f 73  (fsPtr->fd, &ios
0580: 74 61 74 65 29 3b 0a 2b 20 20 20 20 20 20 20 20  tate);.+        
0590: 69 66 20 28 69 6f 73 74 61 74 65 2e 63 5f 63 66  if (iostate.c_cf
05a0: 6c 61 67 20 26 20 43 4c 4f 43 41 4c 29 20 7b 0a  lag & CLOCAL) {.
05b0: 2b 20 20 20 20 20 20 20 20 20 20 20 20 54 63 6c  +            Tcl
05c0: 5f 44 53 74 72 69 6e 67 41 70 70 65 6e 64 45 6c  _DStringAppendEl
05d0: 65 6d 65 6e 74 28 64 73 50 74 72 2c 20 22 31 22  ement(dsPtr, "1"
05e0: 29 3b 0a 2b 20 20 20 20 20 20 20 20 7d 20 65 6c  );.+        } el
05f0: 73 65 20 7b 0a 2b 20 20 20 20 20 20 20 20 20 20  se {.+          
0600: 20 20 54 63 6c 5f 44 53 74 72 69 6e 67 41 70 70    Tcl_DStringApp
0610: 65 6e 64 45 6c 65 6d 65 6e 74 28 64 73 50 74 72  endElement(dsPtr
0620: 2c 20 22 30 22 29 3b 0a 2b 20 20 20 20 20 20 20  , "0");.+       
0630: 20 7d 0a 2b 20 20 20 20 7d 0a 2b 23 65 6e 64 69   }.+    }.+#endi
0640: 66 20 2f 2a 20 43 4c 4f 43 41 4c 20 2a 2f 0a 20  f /* CLOCAL */. 
0650: 23 65 6e 64 69 66 20 2f 2a 20 55 53 45 5f 54 45  #endif /* USE_TE
0660: 52 4d 49 4f 53 20 2a 2f 0a 20 0a 20 20 20 20 20  RMIOS */. .     
0670: 69 66 20 28 76 61 6c 69 64 29 20 7b 0a 20 09 72  if (valid) {. .r
0680: 65 74 75 72 6e 20 54 43 4c 5f 4f 4b 3b 0a 20 20  eturn TCL_OK;.  
0690: 20 20 20 7d 0a 2d 20 20 20 20 72 65 74 75 72 6e     }.-    return
06a0: 20 54 63 6c 5f 42 61 64 43 68 61 6e 6e 65 6c 4f   Tcl_BadChannelO
06b0: 70 74 69 6f 6e 28 69 6e 74 65 72 70 2c 20 6f 70  ption(interp, op
06c0: 74 69 6f 6e 4e 61 6d 65 2c 20 22 6d 6f 64 65 22  tionName, "mode"
06d0: 0a 2b 20 20 20 20 72 65 74 75 72 6e 20 54 63 6c  .+    return Tcl
06e0: 5f 42 61 64 43 68 61 6e 6e 65 6c 4f 70 74 69 6f  _BadChannelOptio
06f0: 6e 28 69 6e 74 65 72 70 2c 20 6f 70 74 69 6f 6e  n(interp, option
0700: 4e 61 6d 65 2c 0a 20 23 69 66 64 65 66 20 55 53  Name,. #ifdef US
0710: 45 5f 54 45 52 4d 49 4f 53 0a 2d 09 20 20 20 20  E_TERMIOS.-.    
0720: 22 20 71 75 65 75 65 20 74 74 79 73 74 61 74 75  " queue ttystatu
0730: 73 20 78 63 68 61 72 22 0a 2b 23 69 66 64 65 66  s xchar".+#ifdef
0740: 20 43 4c 4f 43 41 4c 0a 2b 20 20 20 20 20 20 20   CLOCAL.+       
0750: 20 20 20 20 20 22 69 67 6e 6f 72 65 64 63 64 20       "ignoredcd 
0760: 22 0a 2b 23 65 6e 64 69 66 20 2f 2a 20 43 4c 4f  ".+#endif /* CLO
0770: 43 41 4c 20 2a 2f 0a 2b 09 20 20 20 20 22 6d 6f  CAL */.+.    "mo
0780: 64 65 20 71 75 65 75 65 20 74 74 79 73 74 61 74  de queue ttystat
0790: 75 73 20 78 63 68 61 72 22 0a 2b 23 65 6c 73 65  us xchar".+#else
07a0: 20 2f 2a 20 21 55 53 45 5f 54 45 52 4d 49 4f 53   /* !USE_TERMIOS
07b0: 20 2a 2f 0a 2b 20 20 20 20 20 20 20 20 20 20 20   */.+           
07c0: 20 22 6d 6f 64 65 22 0a 20 23 65 6e 64 69 66 20   "mode". #endif 
07d0: 2f 2a 20 55 53 45 5f 54 45 52 4d 49 4f 53 20 2a  /* USE_TERMIOS *
07e0: 2f 0a 20 09 20 20 20 20 29 3b 0a 20 7d 0a 20 0c  /. .    );. }. .
07f0: 0a 20 23 69 66 64 65 66 20 44 49 52 45 43 54 5f  . #ifdef DIRECT_
0800: 42 41 55 44 0a 0a                                BAUD..