ports/110862: [misc/mshell] Port to termios

Ed Schouten ed at fxq.nl
Mon Mar 26 15:50:02 UTC 2007


>Number:         110862
>Category:       ports
>Synopsis:       [misc/mshell] Port to termios
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 26 15:50:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Ed Schouten
>Release:        FreeBSD 6.2-STABLE i386
>Organization:
>Environment:
System: FreeBSD palm.hoeg.nl 6.2-STABLE FreeBSD 6.2-STABLE #0: Sun Feb 11 22:32:09 CET 2007 root at palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386
>Description:
Just like a bunch of other programs (which isn't so big anymore), the
mshell application makes use of sgtty. sgtty depends on COMPAT_43TTY. It
isn't hard to port this application to termios.

The application's termio bits make use of TAB3. In termios, TAB3 is the
same as OXTABS.
>How-To-Repeat:
>Fix:
Because the patch contains some control characters (and I don't know how
GNATS wrecks those), I've attached the patch in two forms: plain and
uuencoded. If there are problems with the plain text patch, use the
uuencoded one.

Plain:

--- misc/mshell/files/patch-ab	Sat Sep 24 05:57:13 1994
+++ misc/mshell/files/patch-ab	Mon Mar 26 15:02:20 2007
@@ -1,46 +1,37 @@
-*** settatr.c.orig	Sat Sep 24 00:47:17 1994
---- settatr.c	Sat Sep 24 00:49:46 1994
-***************
-*** 15,21 ****
-  	ioctl ( 0, TIOCGETP, &sg );
-  	if (access(".stty", 0) == -1) {	/* not already set up */
-  		sg.sg_erase = '';
-! 		sg.sg_kill  = '';
-  		sg.sg_flags |= XTABS;
-  	}
-  	sg.sg_flags |= ECHO;
---- 15,21 ----
-  	ioctl ( 0, TIOCGETP, &sg );
-  	if (access(".stty", 0) == -1) {	/* not already set up */
-  		sg.sg_erase = '';
-! 		sg.sg_kill  = 21; /* ^U */
-  		sg.sg_flags |= XTABS;
-  	}
-  	sg.sg_flags |= ECHO;
-***************
-*** 25,36 ****
-  	ioctl ( 0, TIOCSETP, &sg );
-  
-  	ioctl ( 0, TIOCGETC, &tc );
-! 	tc.t_intrc  = '';
-  	ioctl ( 0, TIOCSETC, &tc );
-  
-  	ioctl ( 0, TIOCGLTC, &lt );
-! 	lt.t_werasc = '';
-! 	lt.t_rprntc = '';
-  	ioctl ( 0, TIOCSLTC, &lt );
-  #endif
-  #ifdef SYSV
---- 25,36 ----
-  	ioctl ( 0, TIOCSETP, &sg );
-  
-  	ioctl ( 0, TIOCGETC, &tc );
-! 	tc.t_intrc  = 3; /* ^C */
-  	ioctl ( 0, TIOCSETC, &tc );
-  
-  	ioctl ( 0, TIOCGLTC, &lt );
-! 	lt.t_werasc = 23; /* ^W */
-! 	lt.t_rprntc = 18; /* ^R */
-  	ioctl ( 0, TIOCSLTC, &lt );
-  #endif
-  #ifdef SYSV
+--- settatr.c.orig	Mon Mar 26 14:59:01 2007
++++ settatr.c	Mon Mar 26 15:00:41 2007
+@@ -4,7 +4,7 @@
+ 
+ set_terminal_attributes()
+ {
+-#ifdef BSD
++#if 0
+ 	struct sgttyb  sg;
+ 	struct tchars  tc;
+ 	struct ltchars lt;
+@@ -33,20 +33,19 @@
+ 	lt.t_rprntc = '';
+ 	ioctl ( 0, TIOCSLTC, &lt );
+ #endif
+-#ifdef SYSV
+-	struct termio t;
++#if 1
++	struct termios t;
+ 
+-	ioctl ( 0, TCGETA, &t );
++	tcgetattr(0, &t);
+ 
+ 	t.c_cc[VINTR] = '\003';
+ 	t.c_cc[VERASE] = '\b';
+ 	t.c_cc[VKILL] = '\025';
+ 	t.c_iflag = IGNBRK | IGNPAR | ICRNL | IXON ;
+-	t.c_oflag = OPOST | ONLCR ;
++	t.c_oflag = OPOST | ONLCR | OXTABS;
+ 	t.c_lflag = ISIG | ICANON | ECHO | ECHOE | ECHOK ;
+-	t.c_cflag |= TAB3;
+ 
+-	ioctl ( 0, TCSETA, &t );
++	tcsetattr(0, TCSANOW, &t);
+ #endif
+ }
+ set_resource_limits()
--- misc/mshell/files/patch-ag	Mon Oct 21 01:14:56 2002
+++ misc/mshell/files/patch-ag	Mon Mar 26 15:03:30 2007
@@ -1,11 +1,13 @@
 --- mshell.h.orig	Sun Oct 20 16:15:25 2002
 +++ mshell.h	Sun Oct 20 16:14:30 2002
-@@ -5,7 +5,7 @@
+@@ -5,8 +5,8 @@
  #include <sys/types.h>
  #include <sys/stat.h>
  #ifdef BSD
 -#include <sys/dir.h>		/* accessing the directory structure	*/
+-#include <sgtty.h>		/* struct for terminal attributes       */
 +#include <dirent.h>		/* accessing the directory structure	*/
- #include <sgtty.h>		/* struct for terminal attributes       */
++#include <termios.h>		/* struct for terminal attributes       */
  #endif
  #ifdef SYSV
+ #define index	strchr



uuencoded:

begin 644 mshell.patch
M+2TM(&UI<V,O;7-H96QL+V9I;&5S+W!A=&-H+6%B"5-A="!397`@,C0@,#4Z
M-3<Z,3,@,3DY-`HK*RL@;6ES8R]M<VAE;&PO9FEL97,O<&%T8V at M86()36]N
M($UA<B`R-B`Q-3HP,CHR,"`R,#`W"D!`("TQ+#0V("LQ+#,W($!`"BTJ*BH@
M<V5T=&%T<BYC+F]R:6<)4V%T(%-E<"`R-"`P,#HT-SHQ-R`Q.3DT"BTM+2T@
M<V5T=&%T<BYC"5-A="!397`@,C0@,#`Z-#DZ-#8@,3DY-`HM*BHJ*BHJ*BHJ
M*BHJ*BHJ"BTJ*BH@,34L,C$@*BHJ*@HM("`):6]C=&P@*"`P+"!424]#1T54
M4"P@)G-G("D["BT@(`EI9B`H86-C97-S*"(N<W1T>2(L(#`I(#T]("TQ*2![
M"2\J(&YO="!A;')E861Y('-E="!U<"`J+PHM("`)"7-G+G-G7V5R87-E(#T@
M)P at G.PHM(2`)"7-G+G-G7VMI;&P@(#T@)R<["BT@(`D)<V<N<V=?9FQA9W,@
M?#T at 6%1!0E,["BT@(`E]"BT@(`ES9RYS9U]F;&%G<R!\/2!%0TA/.PHM+2TM
M(#$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T@("-E;F1I9 at HM("`C:69D968 at 4UE3
M5 at HK+2TM('-E='1A='(N8RYO<FEG"4UO;B!-87(@,C8@,30Z-3DZ,#$@,C`P
M-PHK*RLK('-E='1A='(N8PE-;VX at 36%R(#(V(#$U.C`P.C0Q(#(P,#<**T!`
M("TT+#<@*S0L-R!`0`HK(`HK('-E=%]T97)M:6YA;%]A='1R:6)U=&5S*"D*
M*R!["BLM(VEF9&5F($)31`HK*R-I9B`P"BL@"7-T<G5C="!S9W1T>6(@('-G
M.PHK(`ES=')U8W0@=&-H87)S("!T8SL**R`)<W1R=6-T(&QT8VAA<G,@;'0[
M"BM`0"`M,S,L,C`@*S,S+#$Y($!`"BL@"6QT+G1?<G!R;G1C(#T@)R<["BL@
M"6EO8W1L("@@,"P at 5$E/0U-,5$,L("9L="`I.PHK("-E;F1I9 at HK+2-I9F1E
M9B!365-6"BLM"7-T<G5C="!T97)M:6\@=#L**RLC:68@,0HK*PES=')U8W0@
M=&5R;6EO<R!T.PHK(`HK+0EI;V-T;"`H(#`L(%1#1T5402P@)G0@*3L**RL)
M=&-G971A='1R*#`L("9T*3L**R`**R`)="YC7V-C6U9)3E1272`]("=<,#`S
M)SL**R`)="YC7V-C6U9%4D%315T@/2`G7&(G.PHK(`ET+F-?8V-;5DM)3$Q=
M(#T@)UPP,C4G.PHK(`ET+F-?:69L86<@/2!)1TY"4DL@?"!)1TY005(@?"!)
M0U).3"!\($E83TX at .PHK+0ET+F-?;V9L86<@/2!/4$]35"!\($].3$-2(#L*
M*RL)="YC7V]F;&%G(#T at 3U!/4U0@?"!/3DQ#4B!\($]85$%"4SL**R`)="YC
M7VQF;&%G(#T at 25-)1R!\($E#04Y/3B!\($5#2$\@?"!%0TA/12!\($5#2$]+
M(#L**RT)="YC7V-F;&%G('P](%1!0C,["BL@"BLM"6EO8W1L("@@,"P at 5$-3
M151!+"`F="`I.PHK*PET8W-E=&%T='(H,"P at 5$-304Y/5RP@)G0I.PHK("-E
M;F1I9 at HK('T**R!S971?<F5S;W5R8V5?;&EM:71S*"D*+2TM(&UI<V,O;7-H
M96QL+V9I;&5S+W!A=&-H+6%G"4UO;B!/8W0@,C$@,#$Z,30Z-38@,C`P, at HK
M*RL@;6ES8R]M<VAE;&PO9FEL97,O<&%T8V at M86<)36]N($UA<B`R-B`Q-3HP
M,SHS,"`R,#`W"D!`("TQ+#$Q("LQ+#$S($!`"B`M+2T@;7-H96QL+F at N;W)I
M9PE3=6X at 3V-T(#(P(#$V.C$U.C(U(#(P,#(*("LK*R!M<VAE;&PN:`E3=6X@
M3V-T(#(P(#$V.C$T.C,P(#(P,#(*+4!`("TU+#<@*S4L-R!`0`HK0$`@+34L
M."`K-2PX($!`"B`@(VEN8VQU9&4@/'-Y<R]T>7!E<RYH/@H@("-I;F-L=61E
M(#QS>7,O<W1A="YH/@H@("-I9F1E9B!"4T0*("TC:6YC;'5D92`\<WES+V1I
M<BYH/@D)+RH at 86-C97-S:6YG('1H92!D:7)E8W1O<GD@<W1R=6-T=7)E"2HO
M"BLM(VEN8VQU9&4@/'-G='1Y+F@^"0DO*B!S=')U8W0 at 9F]R('1E<FUI;F%L
M(&%T=')I8G5T97,@("`@("`@*B\*("LC:6YC;'5D92`\9&ER96YT+F@^"0DO
M*B!A8V-E<W-I;F<@=&AE(&1I<F5C=&]R>2!S=')U8W1U<F4)*B\*+2`C:6YC
M;'5D92`\<V=T='DN:#X)"2\J('-T<G5C="!F;W(@=&5R;6EN86P at 871T<FEB
M=71E<R`@("`@("`J+PHK*R-I;F-L=61E(#QT97)M:6]S+F@^"0DO*B!S=')U
M8W0 at 9F]R('1E<FUI;F%L(&%T=')I8G5T97,@("`@("`@*B\*("`C96YD:68*
E("`C:69D968 at 4UE35@HK("-D969I;F4@:6YD97@)<W1R8VAR"@``
`
end
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list