summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuta SATOH <nigoro@gentoo.gr.jp>2012-11-29 22:42:43 +0900
committerYuta SATOH <nigoro@gentoo.gr.jp>2012-11-29 22:42:43 +0900
commit4942019a33606078eef8e0590928af9f0973d6bf (patch)
tree1a30a0a5181679d65d1082c841eaa0c03983b804 /app-misc
parentcatalyst-2.0.12.1 -- correctly fix lbzip2 support (diff)
downloadgentoo-bsd-4942019a33606078eef8e0590928af9f0973d6bf.tar.gz
gentoo-bsd-4942019a33606078eef8e0590928af9f0973d6bf.tar.bz2
gentoo-bsd-4942019a33606078eef8e0590928af9f0973d6bf.zip
added app-misc/screen -- fixed bug #409819
Diffstat (limited to 'app-misc')
-rw-r--r--app-misc/screen/Manifest17
-rw-r--r--app-misc/screen/files/4.0.2-64bit-time.patch11
-rw-r--r--app-misc/screen/files/4.0.2-no-libelf.patch18
-rw-r--r--app-misc/screen/files/4.0.2-no-pty.patch14
-rw-r--r--app-misc/screen/files/4.0.2-no-utempter.patch14
-rw-r--r--app-misc/screen/files/4.0.2-nonblock.patch11
-rw-r--r--app-misc/screen/files/4.0.2-windowlist-multiuser-fix.patch12
-rw-r--r--app-misc/screen/files/4.0.3-extend-d_termname-ng2.patch203
-rw-r--r--app-misc/screen/files/screen-4.0.1-int-overflow-fix.patch31
-rw-r--r--app-misc/screen/files/screen-4.0.1-vsprintf.patch13
-rw-r--r--app-misc/screen/files/screen-4.0.3-config.h-autoconf-2.62.patch14
-rw-r--r--app-misc/screen/files/screen-4.0.3-cppflags.patch20
-rw-r--r--app-misc/screen/files/screen-4.0.3-crosscompile.patch598
-rw-r--r--app-misc/screen/files/screen-4.0.3-fbsd.patch55
-rw-r--r--app-misc/screen/files/screen-4.0.3-setenv_autoconf.patch79
-rw-r--r--app-misc/screen/files/screenrc356
-rw-r--r--app-misc/screen/screen-4.0.3-r7.ebuild159
17 files changed, 1625 insertions, 0 deletions
diff --git a/app-misc/screen/Manifest b/app-misc/screen/Manifest
new file mode 100644
index 0000000..c8c044c
--- /dev/null
+++ b/app-misc/screen/Manifest
@@ -0,0 +1,17 @@
+AUX 4.0.2-64bit-time.patch 298 SHA256 d974e14a1d8e32a0a05b211cd76d9335a066c6b85538505f1d95f25209c99057 SHA512 c6f90f0626d90fbd48a2ccbb769d0578915d0b804df8fa75fc8036c89b54a056d97116e82335908d84250f1576647be9ec43e3fd49227c181b88e8a1b2024b0d WHIRLPOOL 6f4b67237495a42f4495ab815b332bf13ca37df612bc6b96b89ebe84f208335acd7940f9c4ce09953f4dd4e48f75ae22eaf181c90e861e6ae9364a7e1f93382c
+AUX 4.0.2-no-libelf.patch 555 SHA256 56cc1f7b2d02ba230501c7c87da170fa791639cb1f36b2b0b87d8644e5372059 SHA512 384446f2e99e2f13bc10e1805c35a97fa83b78a5a2e64d18f5499f60053ac4bdc02ec3d64a14e2bd143c524c333c1179a0731c801eec4f7311e926ccbfeef661 WHIRLPOOL 4ce057418c587d93e6ee77a1e8c301eacd5ed24fb3639b3000dac0540a1c945d2057ff9745de980913434158768d80c9aef7b8350621fccc3057d24ebfb3aade
+AUX 4.0.2-no-pty.patch 392 SHA256 edc29bc7b7bea89c2f937ca9c95f2ce51b437e4ea042741d9f4ac6d7954178d5 SHA512 91ec6bc1f14636450492cbf4ab7dc5c0ecbbf1a7da6c3832798d9f5bc96c39e5c12f49f3ac7aa5b929956d2292a0f4d24f3d71017d29c5493cbf21607555c9a8 WHIRLPOOL 8869101f1ba94e660a140032bd3bcfa9fc857a76f477d44692a433d0cb27218909d68a936d634e87f628145c2b47bc22efabeabdc290e2ea622d265917093b71
+AUX 4.0.2-no-utempter.patch 440 SHA256 cc0178fb86971c0975e3d6d60677f2ad3a393ea126790dc5d56f566c42ebe384 SHA512 f506ae6f58b33040b406a4b3a18e40f1092da749ac96b4919ceb612608585fb29a87a3d8dca40e71bbf2c8c2a4c7e217a06e61e130a2356757759bf25e2219c6 WHIRLPOOL 205ab728570609883457136a95508f1ef57481f8e561c6d4d4c15f1bb316c3f0d18a61951b4c5c8b35d45ac6c5516c83b7738f776dd2b2f3f221f657b1480ad9
+AUX 4.0.2-nonblock.patch 423 SHA256 4a5f1666d7f680a9a8157969318b525bc08885ef673000e902c8ffc23ef49159 SHA512 138545a208c8c9df4b915baaecb9f8d3c8d71af970dc6e562ab37c12c78507fe471adca13b6625ef659765971959f1e15814a44a0ef74a2f6f533b3327364b4d WHIRLPOOL 3b5f3bde1fbb203c3668427c87aa60465019ba79ba20ce0b61d1a59ae0b140270541825fec306734b8d8114c491235c8ee3bb1f6200d8cb5c1bccdb115cbc5b9
+AUX 4.0.2-windowlist-multiuser-fix.patch 491 SHA256 edec52981859cfad0a2d780352405dc7575ad7901bc101d25e95baccf1060cc7 SHA512 095c58f4b21775965c4618553be35aacad832eb563e91fa4210a2f4f2d73e020870611354b9958cd876669a7f1fdc76c04989a567836638c09c8c18e64bed570 WHIRLPOOL 97b2637630c16f91a7228716b961a1ad5e4ee322c7cad01368cce1bc729af5bfdb3040396e2313be07acf4f695f1fe058c473a4d8f7dede211df44118ab72cf2
+AUX 4.0.3-extend-d_termname-ng2.patch 5136 SHA256 e87caeab9c4dfc59816c0faf237f26704e63079f8576b93f26029a9e7b550102 SHA512 b2c6488f022472c9b1db6490b73771d26f19c3c824ce082d8834a9453a06afa8dea5a64f11d2b3617c8c7b03a559f85accb5eb76a8c75ea2ca802b624564e8c5 WHIRLPOOL 67847b9ae86519bc2c2cdffdba83e07873d093fc59e977fd516eb5d2e8d2ceb68161d0fbe7df697a3bbcd1f76a6edd34759c232fc459ede61116fdbfb9056ab0
+AUX screen-4.0.1-int-overflow-fix.patch 930 SHA256 fe495d43c367082099cfcb890c7b66629d2ad656a7a15fee6fcd60884abee7d0 SHA512 cb678fb3b879ff61b79995f8a63aa7c84639c1daa4150abb527769c8e6f3dd993f3b0d126b71e60ecea1050bfa1bfc6d1c4756fc4f280ee01143ab8d6caa283b WHIRLPOOL ff0a6668b3531557584af3742a62179bdbb3e2adee1279761e9e4f4e2e6ec37c0107aec2279a679aacd3a6e745551124339611b0bd8202aab7e678e12c060491
+AUX screen-4.0.1-vsprintf.patch 480 SHA256 34d2f9d6101555fbc37e983542f3db549ea96ede89c7d87c21c69b7331d9c3cd SHA512 f221b84bb753538871000e545610f0b5d5bb221dfe4f963cea8f2ba195d90fc6d217d45bd82081247be2e5307b125225635bee27a618ae570bf2bc097e241871 WHIRLPOOL ed62e461f50bb8c0c14f5221a4beb525dd1fa8ae0cdc370e0a90cd82bb252b8f64d0ee6f617ced90063c70751bf69b9778200982276d16d7db50f586177ed29c
+AUX screen-4.0.3-config.h-autoconf-2.62.patch 388 SHA256 71897394211d9e00e008f7c34b3a37bff0cfa54bcfa31a23e849c7021471ca2f SHA512 e08abcdd2f339012cb53f953b1963021614c2de0626f2b23deadc7335f8b0b76138a9f3aa259b86b4fdf740619bf4416cd17cd0e88b97f2578e1ec4b26f736f5 WHIRLPOOL c0aec99c177dad57d506b6cc1b23333313767fa74342a1f1e1949392c8ebdeb4f444eb9f5e75afdd399b10cfbf0c3c58eaf3737fff1eb4bbbef8418f508dcb5b
+AUX screen-4.0.3-cppflags.patch 752 SHA256 40f4c4321170096984466665e3af9aead03490de521205da61a8d31d04cf718d SHA512 92c42ed8d9c2a9ee539784b2fb43119968bdce5b6cd371d82bcf21d9c12f9fd1353ae9630ee1bce3ed73c1528d7bdee64abd4fd1919aaf5ecd412c895ce4a3b4 WHIRLPOOL 8e7c2ef2b4d019cd8820a72660cee8614d0490c65c6ffa85a7c161753cae6f13ebf053623db33685d4cf15af53fbd894dfd224b0a5896d823f6ac165eb20e085
+AUX screen-4.0.3-crosscompile.patch 18900 SHA256 7e4109cd3f6d58ea799fe069472a58f16ea75c2397392c15f58bfcb7cbb354f9 SHA512 9d34d6245d50f0ea84735cad7148b2c6af70709efc788fe9113752081a05138172acc4d6dc33c87ac71739dead1338000b9bd64978c0edf3c44d9ead92487afb WHIRLPOOL 037ec13508ec669791fda248d4a056abb54c1d9aa6893ddcb8aa4785365231b8c4aea46e07cd5367853039c0876cc8e1ee18df4952d9aa3168806eea9f994846
+AUX screen-4.0.3-fbsd.patch 1726 SHA256 90e97fbf728240e828fa2c792fdd0d7d3b6fc5045977df232ba15a9dd3e55633 SHA512 b5d604c29d91b8ae6a610f8be91a2864356e0708764d8e2d2589deef7354e3fa07dccf2e81f4fa6c662f9b2a6288f0cef9f3d19145eeb52b29ce0b067c96eed7 WHIRLPOOL f05dbb11ce4d0c278a02e4e5e5c678c95656b13353da21de3afaa225d74a992c3501f56a8ada7b37ad7d3893a7d246691bb6c5769c1d700f30b58e551b633616
+AUX screen-4.0.3-setenv_autoconf.patch 2485 SHA256 091eb224a097bbc1b5f1b3dd8048dbb04b8c7476818a9444eae5bdb8b52bce75 SHA512 72dcfd9180d05edf85ce9f459e69ccd709a6c0a4593802d0f4e88ffe2daf56215ce8049a641701693dafeab3cc8a0df796338d92338ee0d39c51d46ed718af7b WHIRLPOOL fa7645c3488f75c8acdb2305864459e3eada89e7a29e39a6048cdda7459c707b090c68ce93023a53c57a7beabb3c66f9f9f26237126e68d00cc888a7581b867c
+AUX screenrc 10409 SHA256 f2fbb2de649df9d6b0afbb913d002eb7fdabec5525930515452c286dffcde072 SHA512 32783353cadb403999041e184c7c69570869d45793df4aff35c341f222903dab23d7872e24a78dcf84d82d636890950ad2719614c5475d7084f58769a24e8e71 WHIRLPOOL 3d1a75bcaad7870637dee9c4549062ffcddfd6be614e73e786d166b45f82b35a7f5311d9a60060a7d38afa96264b8eed3719f23244fc3799b7f8fe6ca774a754
+DIST screen-4.0.3.tar.gz 840602 SHA256 78f0d5b1496084a5902586304d4a73954b2bfe33ea13edceecf21615c39e6c77 SHA512 24c1f598972f3dc9ed49cd2c05852190a0190d22fa01401eee8484627c8dd2815f0a422d9b2697faa8aaa0b3efc6730a94e2d5aa787dbe5e9ec719143176c338 WHIRLPOOL 6774786126eb05749d432593bc2c1febdc57896959220a609feb138bdc16b8da278aea63af1ccfd5c7d38ccaa9e7d28980e9e14d0009d36a54cdbd9e4cb0fca7
+EBUILD screen-4.0.3-r7.ebuild 4725 SHA256 6fc348d5d78e676f75ad063ebdaca3955fb364f1cb5febb165c7a8715d656499 SHA512 3a650aef3ee4a7e617e3565196afdbff201e63b28294d1ceef7aebe9970b0128d07dc1b8939dc470db25704d90cfa97766d0b86e5f42bebea237e9b01570cb23 WHIRLPOOL f03eeea25dba3dd8dfb099d16e578bc758197d92f4aa0f05ab872483442300ee4a1b7fbdeb6201c738c096f8592a78ff552cb13fa36845e55ff6e485ab0f96bf
diff --git a/app-misc/screen/files/4.0.2-64bit-time.patch b/app-misc/screen/files/4.0.2-64bit-time.patch
new file mode 100644
index 0000000..645b37f
--- /dev/null
+++ b/app-misc/screen/files/4.0.2-64bit-time.patch
@@ -0,0 +1,11 @@
+--- utmp.c.orig 2004-11-14 23:15:28.000000000 +0100
++++ utmp.c 2004-11-14 23:15:39.000000000 +0100
+@@ -618,7 +618,7 @@
+ #endif /* sgi */
+ strncpy(u->ut_line, line, sizeof(u->ut_line));
+ u->ut_pid = pid;
+- (void)time((time_t *)&u->ut_time);
++ u->ut_time = time(NULL);
+ }
+
+ static slot_t
diff --git a/app-misc/screen/files/4.0.2-no-libelf.patch b/app-misc/screen/files/4.0.2-no-libelf.patch
new file mode 100644
index 0000000..df06383
--- /dev/null
+++ b/app-misc/screen/files/4.0.2-no-libelf.patch
@@ -0,0 +1,18 @@
+--- screen-4.0.2/configure.in 2005-05-22 19:55:06.559874997 +0000
++++ screen-4.0.2-no-libelf/configure.in 2005-05-22 19:56:05.895801017 +0000
+@@ -195,15 +195,6 @@
+ #endif
+ ], LIBS="$LIBS -lsocket -linet";seqptx=1)
+
+-oldlibs="$LIBS"
+-LIBS="$LIBS -lelf"
+-AC_CHECKING(SVR4)
+-AC_TRY_LINK([#include <utmpx.h>
+-],,
+-[AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN),
+-[AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])]
+-,LIBS="$oldlibs")
+-
+ AC_CHECKING(for Solaris 2.x)
+ AC_EGREP_CPP(yes,
+ [#if defined(SVR4) && defined(sun)
diff --git a/app-misc/screen/files/4.0.2-no-pty.patch b/app-misc/screen/files/4.0.2-no-pty.patch
new file mode 100644
index 0000000..7b7b798
--- /dev/null
+++ b/app-misc/screen/files/4.0.2-no-pty.patch
@@ -0,0 +1,14 @@
+--- screen-4.0.2/pty.c.orig 2004-07-29 23:53:45.313533536 -0400
++++ screen-4.0.2/pty.c 2004-07-29 23:53:59.011451136 -0400
+@@ -33,11 +33,6 @@
+ # include <sys/ioctl.h>
+ #endif
+
+-/* for solaris 2.1, Unixware (SVR4.2) and possibly others */
+-#ifdef HAVE_SVR4_PTYS
+-# include <sys/stropts.h>
+-#endif
+-
+ #if defined(sun) && defined(LOCKPTY) && !defined(TIOCEXCL)
+ # include <sys/ttold.h>
+ #endif
diff --git a/app-misc/screen/files/4.0.2-no-utempter.patch b/app-misc/screen/files/4.0.2-no-utempter.patch
new file mode 100644
index 0000000..2a06119
--- /dev/null
+++ b/app-misc/screen/files/4.0.2-no-utempter.patch
@@ -0,0 +1,14 @@
+--- screen-4.0.2/configure.in.orig 2004-12-17 19:55:45.314670411 +0100
++++ screen-4.0.2/configure.in 2004-12-17 19:55:50.575941541 +0100
+@@ -855,11 +855,6 @@
+ #include <utmp.h>
+ #endif
+ ],[struct utmp u; u.ut_host[0] = 0;], AC_DEFINE(UTHOST))
+-AC_CHECK_HEADER(utempter.h, have_utempter=yes, have_utempter=no)
+-if test "$have_utempter" = yes; then
+- AC_DEFINE(HAVE_UTEMPTER)
+- LIBS="$LIBS -lutempter"
+-fi
+
+ dnl
+ dnl **** loadav ****
diff --git a/app-misc/screen/files/4.0.2-nonblock.patch b/app-misc/screen/files/4.0.2-nonblock.patch
new file mode 100644
index 0000000..f27c903
--- /dev/null
+++ b/app-misc/screen/files/4.0.2-nonblock.patch
@@ -0,0 +1,11 @@
+--- screen.c.orig 2006-04-02 17:05:28.000000000 +0200
++++ screen.c 2006-04-02 17:05:39.000000000 +0200
+@@ -1197,7 +1197,7 @@ char **av;
+ if (!detached)
+ {
+ /* reopen tty. must do this, because fd 0 may be RDONLY */
+- if ((n = secopen(attach_tty, O_RDWR, 0)) < 0)
++ if ((n = secopen(attach_tty, O_RDWR | O_NONBLOCK, 0)) < 0)
+ Panic(0, "Cannot reopen '%s' - please check.", attach_tty);
+ }
+ else
diff --git a/app-misc/screen/files/4.0.2-windowlist-multiuser-fix.patch b/app-misc/screen/files/4.0.2-windowlist-multiuser-fix.patch
new file mode 100644
index 0000000..09848e9
--- /dev/null
+++ b/app-misc/screen/files/4.0.2-windowlist-multiuser-fix.patch
@@ -0,0 +1,12 @@
+diff -Nur screen-4.0.2.orig/process.c screen-4.0.2/process.c
+--- screen-4.0.2.orig/process.c 2003-09-18 14:53:54.000000000 +0200
++++ screen-4.0.2/process.c 2005-07-06 19:55:08.370772955 +0200
+@@ -4841,7 +4841,7 @@
+ s = buf;
+ for (display = displays; display; display = display->d_next)
+ {
+- if (D_user == olddisplay->d_user)
++ if (olddisplay && D_user == olddisplay->d_user)
+ continue;
+ for (cv = D_cvlist; cv; cv = cv->c_next)
+ if (Layer2Window(cv->c_layer) == p)
diff --git a/app-misc/screen/files/4.0.3-extend-d_termname-ng2.patch b/app-misc/screen/files/4.0.3-extend-d_termname-ng2.patch
new file mode 100644
index 0000000..701682f
--- /dev/null
+++ b/app-misc/screen/files/4.0.3-extend-d_termname-ng2.patch
@@ -0,0 +1,203 @@
+diff --git a/acls.c b/acls.c
+index 0f98df2..5f26d70 100644
+--- a/acls.c
++++ b/acls.c
+@@ -178,7 +178,7 @@ struct acluser **up;
+ #endif
+ (*up)->u_Esc = DefaultEsc;
+ (*up)->u_MetaEsc = DefaultMetaEsc;
+- strncpy((*up)->u_name, name, 20);
++ strncpy((*up)->u_name, name, MAXSTR);
+ (*up)->u_password = NULL;
+ if (pass)
+ (*up)->u_password = SaveStr(pass);
+@@ -314,8 +314,8 @@ struct acluser **up;
+ return UserAdd(name, pass, up);
+ if (!strcmp(name, "nobody")) /* he remains without password */
+ return -1;
+- strncpy((*up)->u_password, pass ? pass : "", 20);
+- (*up)->u_password[20] = '\0';
++ strncpy((*up)->u_password, pass ? pass : "", MAXSTR);
++ (*up)->u_password[MAXSTR] = '\0';
+ return 0;
+ }
+ #endif
+diff --git a/acls.h b/acls.h
+index c41b714..7f20f55 100644
+--- a/acls.h
++++ b/acls.h
+@@ -36,6 +36,16 @@
+ #define ACLBYTE(data, w) ((data)[(w) >> 3])
+ #define ACLBIT(w) (0x80 >> ((w) & 7))
+
++#include <limits.h>
++
++#ifndef NAME_MAX
++# ifndef MAXNAMELEN
++# define NAME_MAX 255
++# else
++# define NAME_MAX MAXNAMELEN
++# endif
++#endif
++
+ typedef unsigned char * AclBits;
+
+ /*
+@@ -73,7 +83,7 @@ struct plop
+ typedef struct acluser
+ {
+ struct acluser *u_next; /* continue the main user list */
+- char u_name[20+1]; /* login name how he showed up */
++ char u_name[NAME_MAX+1]; /* login name how he showed up */
+ char *u_password; /* his password (may be NullStr). */
+ int u_checkpassword; /* nonzero if this u_password is valid */
+ int u_detachwin; /* the window where he last detached */
+diff --git a/display.h b/display.h
+index ef99954..563fcd0 100644
+--- a/display.h
++++ b/display.h
+@@ -22,6 +22,16 @@
+ * $Id: 4.0.3-extend-d_termname-ng2.patch,v 1.2 2010/12/08 21:28:15 jlec Exp $ FAU
+ */
+
++#include <limits.h>
++
++#ifndef NAME_MAX
++# ifndef MAXNAMELEN
++# define NAME_MAX 255
++# else
++# define NAME_MAX MAXNAMELEN
++# endif
++#endif
++
+ #ifdef MAPKEYS
+
+ #define KMAP_KEYS (T_OCAPS-T_CAPS)
+@@ -85,7 +95,7 @@ struct display
+ struct win *d_other; /* pointer to other window */
+ int d_nonblock; /* -1 don't block if obufmax reached */
+ /* >0: block after nonblock secs */
+- char d_termname[20 + 1]; /* $TERM */
++ char d_termname[NAME_MAX + 1]; /* $TERM */
+ char *d_tentry; /* buffer for tgetstr */
+ char d_tcinited; /* termcap inited flag */
+ int d_width, d_height; /* width/height of the screen */
+diff --git a/screen.c b/screen.c
+index 70741df..6f45b60 100644
+--- a/screen.c
++++ b/screen.c
+@@ -106,6 +106,16 @@ FILE *dfp;
+ #endif
+
+
++#include <limits.h>
++
++#ifndef NAME_MAX
++# ifndef MAXNAMELEN
++# define NAME_MAX 255
++# else
++# define NAME_MAX MAXNAMELEN
++# endif
++#endif
++
+ extern char Term[], screenterm[], **environ, Termcap[];
+ int force_vt = 1;
+ int VBellWait, MsgWait, MsgMinWait, SilenceWait;
+@@ -877,13 +887,13 @@ char **av;
+
+ if (home == 0 || *home == '\0')
+ home = ppp->pw_dir;
+- if (strlen(LoginName) > 20)
++ if (strlen(LoginName) > NAME_MAX)
+ Panic(0, "LoginName too long - sorry.");
+ #ifdef MULTIUSER
+- if (multi && strlen(multi) > 20)
++ if (multi && strlen(multi) > NAME_MAX)
+ Panic(0, "Screen owner name too long - sorry.");
+ #endif
+- if (strlen(home) > MAXPATHLEN - 25)
++ if (strlen(home) > MAXPATHLEN - NAME_MAX)
+ Panic(0, "$HOME too long - sorry.");
+
+ attach_tty = "";
+diff --git a/screen.h b/screen.h
+index 4f9f354..bcaaaf6 100644
+--- a/screen.h
++++ b/screen.h
+@@ -43,6 +43,15 @@
+ #include "comm.h"
+ #include "layer.h"
+ #include "term.h"
++#include <limits.h>
++
++#ifndef NAME_MAX
++# ifndef MAXNAMELEN
++# define NAME_MAX 255
++# else
++# define NAME_MAX MAXNAMELEN
++# endif
++#endif
+
+
+ #ifdef DEBUG
+@@ -195,26 +204,26 @@ struct msg
+ create;
+ struct
+ {
+- char auser[20 + 1]; /* username */
++ char auser[NAME_MAX + 1]; /* username */
+ int apid; /* pid of frontend */
+ int adaptflag; /* adapt window size? */
+ int lines, columns; /* display size */
+ char preselect[20];
+ int esc; /* his new escape character unless -1 */
+ int meta_esc; /* his new meta esc character unless -1 */
+- char envterm[20 + 1]; /* terminal type */
++ char envterm[NAME_MAX + 1]; /* terminal type */
+ int encoding; /* encoding of display */
+ }
+ attach;
+ struct
+ {
+- char duser[20 + 1]; /* username */
++ char duser[NAME_MAX + 1]; /* username */
+ int dpid; /* pid of frontend */
+ }
+ detach;
+ struct
+ {
+- char auser[20 + 1]; /* username */
++ char auser[NAME_MAX + 1]; /* username */
+ int nargs;
+ char cmd[MAXPATHLEN]; /* command */
+ int apid; /* pid of frontend */
+diff --git a/socket.c b/socket.c
+index 62a73af..1cc9c27 100644
+--- a/socket.c
++++ b/socket.c
+@@ -45,6 +45,16 @@
+
+ #include "extern.h"
+
++#include <limits.h>
++
++#ifndef NAME_MAX
++# ifndef MAXNAMELEN
++# define NAME_MAX 255
++# else
++# define NAME_MAX MAXNAMELEN
++# endif
++#endif
++
+ static int CheckPid __P((int));
+ static void ExecCreate __P((struct msg *));
+ static void DoCommandMsg __P((struct msg *));
+@@ -1248,7 +1258,7 @@ static void PasswordProcessInput __P((char *, int));
+
+ struct pwdata {
+ int l;
+- char buf[20 + 1];
++ char buf[NAME_MAX + 1];
+ struct msg m;
+ };
+
diff --git a/app-misc/screen/files/screen-4.0.1-int-overflow-fix.patch b/app-misc/screen/files/screen-4.0.1-int-overflow-fix.patch
new file mode 100644
index 0000000..4a40c8d
--- /dev/null
+++ b/app-misc/screen/files/screen-4.0.1-int-overflow-fix.patch
@@ -0,0 +1,31 @@
+--- ansi.c.orig 2003-09-08 10:24:44.000000000 -0400
++++ ansi.c 2003-11-29 10:41:15.000000000 -0500
+@@ -559,7 +559,7 @@
+ {
+ case '0': case '1': case '2': case '3': case '4':
+ case '5': case '6': case '7': case '8': case '9':
+- if (curr->w_NumArgs < MAXARGS)
++ if (curr->w_NumArgs >= 0 && curr->w_NumArgs < MAXARGS)
+ {
+ if (curr->w_args[curr->w_NumArgs] < 100000000)
+ curr->w_args[curr->w_NumArgs] =
+--- resize.c.orig 2003-09-08 10:26:31.000000000 -0400
++++ resize.c 2003-11-29 10:41:50.000000000 -0500
+@@ -682,6 +682,17 @@
+ if (wi == 0)
+ he = hi = 0;
+
++ if (wi > 1000)
++ {
++ Msg(0, "Window width too large, truncated");
++ wi = 1000;
++ }
++ if (he > 1000)
++ {
++ Msg(0, "Window height too large, truncated");
++ he = 1000;
++ }
++
+ if (p->w_width == wi && p->w_height == he && p->w_histheight == hi)
+ {
+ debug("ChangeWindowSize: No change.\n");
diff --git a/app-misc/screen/files/screen-4.0.1-vsprintf.patch b/app-misc/screen/files/screen-4.0.1-vsprintf.patch
new file mode 100644
index 0000000..b2f7a20
--- /dev/null
+++ b/app-misc/screen/files/screen-4.0.1-vsprintf.patch
@@ -0,0 +1,13 @@
+--- screen-4.0.1/configure.in 2003-06-03 07:58:24.000000000 -0400
++++ screen-4.0.1/configure.in.agriffis 2004-01-13 12:07:37.000000000 -0500
+@@ -1206,7 +1206,9 @@
+ rm -f /tmp/conftest*
+
+ AC_MSG_CHECKING(for vsprintf)
+-AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no))
++AC_TRY_LINK([#include <stdarg.h>],[va_list valist; vsprintf(0,0,valist);],
++ [AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS)],
++ [AC_MSG_RESULT(no)])
+
+ AC_HEADER_DIRENT
+
diff --git a/app-misc/screen/files/screen-4.0.3-config.h-autoconf-2.62.patch b/app-misc/screen/files/screen-4.0.3-config.h-autoconf-2.62.patch
new file mode 100644
index 0000000..5605fda
--- /dev/null
+++ b/app-misc/screen/files/screen-4.0.3-config.h-autoconf-2.62.patch
@@ -0,0 +1,14 @@
+compability for sys-devel/autoconf-2.62
+
+https://bugs.gentoo.org/show_bug.cgi?id=217311
+
+--- screen/config.h.in
++++ screen/config.h.in
+@@ -563,7 +563,6 @@
+ * If you are on a SYS V machine that restricts filename length to 14
+ * characters, you may need to enforce that by setting NAME_MAX to 14
+ */
+-#undef NAME_MAX /* KEEP_UNDEF_HERE override system value */
+ #undef NAME_MAX
+
+ /*
diff --git a/app-misc/screen/files/screen-4.0.3-cppflags.patch b/app-misc/screen/files/screen-4.0.3-cppflags.patch
new file mode 100644
index 0000000..ee3455f
--- /dev/null
+++ b/app-misc/screen/files/screen-4.0.3-cppflags.patch
@@ -0,0 +1,20 @@
+--- screen-4.0.3/Makefile.in
++++ screen-4.0.3/Makefile.in
+@@ -68,7 +68,7 @@
+ $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS)
+
+ .c.o:
+- $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $<
++ $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CPPFLAGS) $(CFLAGS) $<
+
+ install_bin: .version screen
+ -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \
+@@ -122,7 +122,7 @@
+ sh $(srcdir)/tty.sh tty.c
+
+ comm.h: comm.c comm.sh config.h
+- AWK=$(AWK) CC="$(CC) $(CFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh
++ AWK=$(AWK) CC="$(CC) $(CFLAGS) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/comm.sh
+
+ osdef.h: osdef.sh config.h osdef.h.in
+ CPP="$(CPP) $(CPPFLAGS)" srcdir=${srcdir} sh $(srcdir)/osdef.sh
diff --git a/app-misc/screen/files/screen-4.0.3-crosscompile.patch b/app-misc/screen/files/screen-4.0.3-crosscompile.patch
new file mode 100644
index 0000000..6e6bb94
--- /dev/null
+++ b/app-misc/screen/files/screen-4.0.3-crosscompile.patch
@@ -0,0 +1,598 @@
+--- configure.in~ 2008-11-23 17:43:48.000000000 +0000
++++ configure.in 2008-11-23 17:43:48.000000000 +0000
+@@ -46,6 +46,7 @@
+ AC_PROG_GCC_TRADITIONAL
+ AC_ISC_POSIX
+
++AC_MSG_CHECKING([for compiler sanity])
+ AC_TRY_RUN(main(){exit(0);},,[
+ if test $CC != cc ; then
+ AC_NOTE(Your $CC failed - restarting with CC=cc)
+@@ -54,22 +55,17 @@
+ export CC
+ exec $0 $configure_args
+ fi
+-])
+-
+-AC_TRY_RUN(main(){exit(0);},,
+-exec 5>&2
+-eval $ac_link
+-AC_NOTE(CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;)
+-AC_NOTE($ac_compile)
+-AC_MSG_ERROR(Can't run the compiler - sorry))
++],AC_MSG_WARN([skipping test due to crosscompilation]))
+
++AC_MSG_CHECKING([if compiler sets exit status])
+ AC_TRY_RUN([
+ main()
+ {
+ int __something_strange_();
+ __something_strange_(0);
+ }
+-],AC_MSG_ERROR(Your compiler does not set the exit status - sorry))
++],AC_MSG_ERROR(Your compiler does not set the exit status - sorry),,
++AC_MSG_WARN(skipping test due to crosscompilation))
+
+ AC_PROG_AWK
+
+@@ -103,6 +99,7 @@
+ dnl
+ dnl **** special unix variants ****
+ dnl
++AH_TEMPLATE(ISC,[])
+ if test -n "$ISC"; then
+ AC_DEFINE(ISC) LIBS="$LIBS -linet"
+ fi
+@@ -114,11 +111,13 @@
+ dnl fi
+ dnl fi
+
++AH_TEMPLATE([sysV68],[])
+ if test -f /sysV68 ; then
+ AC_DEFINE(sysV68)
+ fi
+
+ AC_CHECKING(for MIPS)
++AH_TEMPLATE([MIPS],[])
+ if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then
+ oldlibs="$LIBS"
+ test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha.
+@@ -132,6 +131,8 @@
+ AC_CHECKING(wait3)
+ AC_TRY_LINK(,[wait3();], ,
+ AC_CHECKING(wait2)
++AH_TEMPLATE([USE_WAIT2],[On RISCOS we prefer wait2() over wait3(). rouilj@sni-usa.com])
++dnl TODO(Hannes) shipped config.h.in wraps the define in #ifdef BSDWAIT
+ AC_TRY_LINK(,[wait2();],
+ dnl John Rouillard (rouilj@sni-usa.com):
+ dnl need -I/usr/include/bsd in RISCOS otherwise sockets are broken, no
+@@ -154,9 +155,11 @@
+ oldlibs="$LIBS"
+ LIBS="$LIBS -lpyr"
+ AC_CHECKING(Pyramid OSX)
++AH_TEMPLATE([OSX], [Pyramid OSX])
+ AC_TRY_LINK(,[open_controlling_pty("")], AC_DEFINE(OSX), LIBS="$oldlibs")
+ fi
+
++AH_TEMPLATE([POSIX],[Define POSIX if your system supports IEEE Std 1003.1-1988 (POSIX).])
+ dnl ghazi@caip.rutgers.edu (Kaveh R. Ghazi):
+ dnl BBN butterfly is not POSIX, but a MACH BSD system.
+ dnl Do not define POSIX and TERMIO.
+@@ -183,6 +186,7 @@
+ fi
+
+ AC_CHECKING(for System V)
++AH_TEMPLATE([SYSV], [Define SYSV if your machine is SYSV complient (Sys V, HPUX, A/UX)])
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>
+ #include <signal.h>
+@@ -226,6 +230,9 @@
+ dnl
+
+ AC_CHECKING(BSD job jontrol)
++AH_TEMPLATE([BSDJOBS],
++[Define BSDJOBS if you have BSD-style job control (both process
++ groups and a tty that deals correctly with them)])
+ AC_TRY_LINK(
+ [#include <sys/types.h>
+ #include <sys/ioctl.h>
+@@ -246,6 +253,10 @@
+ dnl **** setreuid(), seteuid() ****
+ dnl
+ AC_CHECKING(setreuid)
++AH_TEMPLATE([HAVE_SETREUID],
++[If your system has the calls setreuid() and setregid(),
++ define HAVE_SETREUID. Otherwise screen will use a forked process to
++ safely create output files without retaining any special privileges.])
+ AC_TRY_LINK(,[
+ #ifdef __hpux
+ setresuid(0, 0, 0);
+@@ -260,6 +271,9 @@
+ dnl Solaris seteuid doesn't change the saved uid, bad for
+ dnl multiuser screen sessions
+ AC_CHECKING(seteuid)
++AH_TEMPLATE([HAVE_SETEUID],
++[If your system supports BSD4.4's seteuid() and setegid(), define
++ HAVE_SETEUID.])
+ AC_TRY_LINK(,[
+ #if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news)
+ seteuid_is_broken(0);
+@@ -284,6 +298,8 @@
+ dnl
+
+ AC_CHECKING(fifos)
++AC_CACHE_CHECK([usable fifos],
++ [screen_cv_sys_fifo_usable],
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -348,12 +364,15 @@
+ exit(1);
+ exit(0);
+ }
+-], AC_NOTE(- your fifos are usable) fifo=1,
+-AC_NOTE(- your fifos are not usable))
++], screen_cv_sys_fifo_usable=yes, screen_cv_sys_fifo_usable=no))
+ rm -f /tmp/conftest*
+
+-if test -n "$fifo"; then
+-AC_CHECKING(for broken fifo implementation)
++if test X"$screen_cv_sys_fifo_usable" = Xyes; then
++AH_TEMPLATE([BROKEN_PIPE],
++[Define this if your system exits select() immediatly if a pipe is
++ opened read-only and no writer has opened it.])
++AC_CACHE_CHECK([broken fifo implementation],
++ [screen_cv_sys_fifo_broken_impl],
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <fcntl.h>
+@@ -398,9 +416,12 @@
+ exit(1);
+ exit(0);
+ }
+-], AC_NOTE(- your implementation is ok),
+-AC_NOTE(- you have a broken implementation) AC_DEFINE(BROKEN_PIPE) fifobr=1)
++], screen_cv_sys_fifo_broken_impl=no,
++screen_cv_sys_fifo_broken_impl=yes))
++if test X"$screen_cv_sys_fifo_broken_impl" = Xyes; then
++ AC_DEFINE(BROKEN_PIPE)
++fi
+ rm -f /tmp/conftest*
+ fi
+
+ dnl
+@@ -410,6 +430,8 @@
+ dnl
+
+ AC_CHECKING(sockets)
++AC_CACHE_CHECK([sockets are usable],
++ [screen_cv_sys_sockets_usable],
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/socket.h>
+@@ -460,12 +482,16 @@
+ exit(1);
+ exit(0);
+ }
+-], AC_NOTE(- your sockets are usable) sock=1,
+-AC_NOTE(- your sockets are not usable))
+-rm -f /tmp/conftest*
++], screen_cv_sys_sockets_usable=yes,
++screen_cv_sys_sockets_usable=no))
+
+-if test -n "$sock"; then
++if test X"$screen_cv_sys_sockets_usable" = Xyes; then
+ AC_CHECKING(socket implementation)
++AH_TEMPLATE([SOCK_NOT_IN_FS],
++[Define this if the unix-domain socket implementation doesn't
++ create a socket in the filesystem.])
++AC_CACHE_CHECK([if sockets are not stored in the filesystem],
++ [screen_cv_sys_sockets_nofs],
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -491,22 +517,25 @@
+ close(s);
+ exit(0);
+ }
+-],AC_NOTE(- you are normal),
+-AC_NOTE(- unix domain sockets are not kept in the filesystem)
+-AC_DEFINE(SOCK_NOT_IN_FS) socknofs=1)
+-rm -f /tmp/conftest*
++], screen_cv_sys_sockets_nofs=no,
++screen_cv_sys_sockets_nofs=yes))
++
++if test X"$screen_cv_sys_sockets_nofs" = Xyes; then
++ AC_DEFINE(SOCK_NOT_IN_FS)
++fi
+ fi
+
+
+ dnl
+ dnl **** choose sockets or fifos ****
+ dnl
+-if test -n "$fifo"; then
+- if test -n "$sock"; then
+- if test -n "$nore"; then
++AH_TEMPLATE([NAMEDPIPE], [Define this if your system supports named pipes.])
++if test X"$screen_cv_sys_fifo_usable" = Xyes; then
++ if test X"$screen_cv_sys_sockets_usable" = Xyes; then
++ if test X"$screen_cv_sys_sockets_nofs" = Xyes; then
+ AC_NOTE(- hmmm... better take the fifos)
+ AC_DEFINE(NAMEDPIPE)
+- elif test -n "$fifobr"; then
++ elif test X"$screen_cv_sys_fifo_broken_impl" = Xyes; then
+ AC_NOTE(- as your fifos are broken lets use the sockets.)
+ else
+ AC_NOTE(- both sockets and fifos usable. let's take fifos.)
+@@ -516,7 +545,7 @@
+ AC_NOTE(- using named pipes, of course)
+ AC_DEFINE(NAMEDPIPE)
+ fi
+-elif test -n "$sock"; then
++elif test X"$screen_cv_sys_sockets_usable" = Xyes; then
+ AC_NOTE(- using unix-domain sockets, of course)
+ else
+ AC_MSG_ERROR(you have neither usable sockets nor usable pipes -> no screen)
+@@ -526,7 +555,11 @@
+ dnl **** check the select implementation ****
+ dnl
+
+-AC_CHECKING(select return value)
++AH_TEMPLATE([SELECT_BROKEN],
++[If the select return value doesn't treat a descriptor that is
++ usable for reading and writing as two hits, define SELECT_BROKEN.])
++AC_CACHE_CHECK([for broken select return value],
++ [screen_cv_sys_select_broken_retval],
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <sys/stat.h>
+@@ -625,17 +658,26 @@
+ exit(1);
+ exit(0);
+ }
+-],AC_NOTE(- select is ok),
+-AC_NOTE(- select can't count) AC_DEFINE(SELECT_BROKEN))
++], screen_cv_sys_select_broken_retval=no,
++screen_cv_sys_select_broken_retval=yes))
++if test X"$screen_cv_sys_select_broken_retval" = Xyes; then
++ AC_DEFINE(SELECT_BROKEN)
++fi
+
+ dnl
+ dnl **** termcap or terminfo ****
+ dnl
++AH_TEMPLATE([TERMINFO],
++[Define TERMINFO if your machine emulates the termcap routines
++ with the terminfo database.
++ Thus the .screenrc file is parsed for
++ the command 'terminfo' and not 'termcap'])
++
+ AC_CHECKING(for tgetent)
+ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+ olibs="$LIBS"
+-LIBS="-lcurses $olibs"
+ AC_CHECKING(libcurses)
++AC_CHECK_LIB(ncursesw,tgetent)
+ AC_TRY_LINK(,[
+ #ifdef __hpux
+ __sorry_hpux_libcurses_is_totally_broken_in_10_10();
+@@ -654,24 +696,39 @@
+ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,,
+ AC_MSG_ERROR(!!! no tgetent - no screen))))))
+
+-AC_TRY_RUN([
++AC_CACHE_CHECK([using terminfo database],[screen_cv_sys_terminfo_used],
++ AC_TRY_RUN([
+ main()
+ {
+ exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1);
+-}], AC_NOTE(- you use the termcap database),
+-AC_NOTE(- you use the terminfo database) AC_DEFINE(TERMINFO))
++}
++ ], screen_cv_sys_terminfo_used=no,
++ screen_cv_sys_terminfo_used=yes)
++)
++
++if test X"$screen_cv_sys_terminfo_used" = Xyes; then
++ AC_DEFINE(TERMINFO)
++fi
++
+ AC_CHECKING(ospeed)
++AH_TEMPLATE([NEED_OSPEED],[If your library does not define ospeed, define this.])
+ AC_TRY_LINK(extern short ospeed;,ospeed=5;,,AC_DEFINE(NEED_OSPEED))
+
+ dnl
+ dnl **** PTY specific things ****
+ dnl
++AH_TEMPLATE([HAVE_DEV_PTC],
++[define HAVE_DEV_PTC if you have a /dev/ptc character special
++ device.])
+ AC_CHECKING(for /dev/ptc)
+ if test -r /dev/ptc; then
+ AC_DEFINE(HAVE_DEV_PTC)
+ fi
+
+ AC_CHECKING(for SVR4 ptys)
++AH_TEMPLATE([HAVE_SVR4_PTYS],
++[define HAVE_SVR4_PTYS if you have a /dev/ptmx character special
++ device and support the ptsname(), grantpt(), unlockpt() functions.])
+ sysvr4ptys=
+ if test -c /dev/ptmx ; then
+ AC_TRY_LINK([],[ptsname(0);grantpt(0);unlockpt(0);],[AC_DEFINE(HAVE_SVR4_PTYS)
+@@ -687,6 +744,13 @@
+ fi
+
+ AC_CHECKING(for ptyranges)
++AH_TEMPLATE([PTYRANGE0],
++[define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen
++ to unusual environments. E.g. For SunOs the defaults are "qpr" and
++ "0123456789abcdef". For SunOs 4.1.2
++ #define PTYRANGE0 "pqrstuvwxyzPQRST"
++ is recommended by Dan Jacobson.])
++AH_TEMPLATE([PTYRANGE1],[])
+ if test -d /dev/ptym ; then
+ pdir='/dev/ptym'
+ else
+@@ -850,20 +914,39 @@
+ dnl
+ dnl **** loadav ****
+ dnl
++
++AH_TEMPLATE([LOADAV],
++[If you want the "time" command to display the current load average
++ define LOADAV. Maybe you must install screen with the needed
++ privileges to read /dev/kmem.
++ Note that NLIST_ stuff is only checked, when getloadavg() is not available.
++])
++AH_TEMPLATE([LOADAV_NUM])
++AH_TEMPLATE([LOADAV_TYPE])
++AH_TEMPLATE([LOADAV_SCALE])
++AH_TEMPLATE([LOADAV_GETLOADAVG])
++AH_TEMPLATE([LOADAV_UNIX])
++AH_TEMPLATE([LOADAV_AVENRUN])
++AH_TEMPLATE([LOADAV_USE_NLIST64])
++
++AH_TEMPLATE([NLIST_DECLARED])
++AH_TEMPLATE([NLIST_STRUCT])
++AH_TEMPLATE([NLIST_NAME_UNION])
++
+ AC_CHECKING(for libutil(s))
+-test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils"
+-test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil"
++dnl I have no idea whether "login" is an appropriate symbol to check for here - Hannes
++AC_CHECK_LIB(utils,login)
++AC_CHECK_LIB(util,login)
+
+ AC_CHECKING(getloadavg)
+ AC_TRY_LINK(,[getloadavg((double *)0, 0);],
+ AC_DEFINE(LOADAV_GETLOADAVG) load=1,
+-if test -f /usr/lib/libkvm.a ; then
+ olibs="$LIBS"
+-LIBS="$LIBS -lkvm"
++AC_CHECK_LIB(kvm,kvm_open,
+ AC_CHECKING(getloadavg with -lkvm)
+ AC_TRY_LINK(,[getloadavg((double *)0, 0);],
+ AC_DEFINE(LOADAV_GETLOADAVG) load=1, LIBS="$olibs")
+-fi
++)
+ )
+
+ if test -z "$load" ; then
+@@ -1005,6 +1088,11 @@
+ dnl
+ dnl **** signal handling ****
+ dnl
++
++AH_TEMPLATE([SIGVOID],
++[Define SIGVOID if your signal handlers return void. On older
++ systems, signal returns int, but on newer ones, it returns void.])
++
+ if test -n "$posix" ; then
+
+ dnl POSIX has reliable signals with void return type.
+@@ -1014,6 +1102,7 @@
+ else
+
+ AC_CHECKING(return type of signal handlers)
++AH_TEMPLATE([USESIGSET], [Define USESIGSET if you have sigset for BSD 4.1 reliable signals.])
+ AC_TRY_COMPILE(
+ [#include <sys/types.h>
+ #include <signal.h>
+@@ -1033,6 +1122,9 @@
+ #endif
+ ], AC_DEFINE(USESIGSET))
+ AC_CHECKING(signal implementation)
++AH_TEMPLATE([SYSVSIGS],
++[Define SYSVSIGS if signal handlers must be reinstalled after
++ they have been called.])
+ AC_TRY_RUN([
+ #include <sys/types.h>
+ #include <signal.h>
+@@ -1075,13 +1167,14 @@
+ dnl
+
+ AC_CHECKING(for crypt and sec libraries)
+-test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d"
++dnl I have no idea whether "crypt" is an appropriate symbol to check for here - Hannes
++AC_CHECK_LIB(crypt_d,crypt)
+ oldlibs="$LIBS"
+-LIBS="$LIBS -lcrypt"
+ AC_CHECKING(crypt)
+ AC_TRY_LINK(,,,LIBS="$oldlibs")
+-test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec"
+-test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow"
++AC_CHECK_LIB(crypt,crypt)
++AC_CHECK_LIB(sec,crypt)
++AC_CHECK_LIB(shadow,getspnam)
+ oldlibs="$LIBS"
+ LIBS="$LIBS -lsun"
+ AC_CHECKING(IRIX sun library)
+@@ -1104,6 +1197,13 @@
+ dnl **** misc things ****
+ dnl
+ AC_CHECKING(wait union)
++AH_TEMPLATE([BSDWAIT],
++[Define BSDWAIT if your system defines a 'union wait' in <sys/wait.h>
++
++ Only allow BSDWAIT i.e. wait3 on nonposix systems, since
++ posix implies wait(3) and waitpid(3). vdlinden@fwi.uva.nl
++ TODO(Hannes) shipped config.h.in does that with a #ifdef
++])
+ AC_TRY_COMPILE([#include <sys/types.h>
+ #include <sys/wait.h>
+ ],[
+@@ -1114,6 +1214,13 @@
+ #endif
+ ],AC_DEFINE(BSDWAIT))
+
++AH_TEMPLATE([TERMIO],
++[Define TERMIO if you have struct termio instead of struct sgttyb.
++ This is usually the case for SVID systems, where BSD uses sgttyb.
++ POSIX systems should define this anyway, even though they use
++ struct termios.])
++
++
+ if test -z "$butterfly"; then
+ AC_CHECKING(for termio or termios)
+ AC_TRY_CPP([#include <termio.h>], AC_DEFINE(TERMIO),
+@@ -1123,17 +1230,35 @@
+ )
+ fi
+
++AH_TEMPLATE([CYTERMIO], [Define CYTERMIO if you have cyrillic termio modes.])
++
+ dnl AC_CHECK_HEADER(shadow.h, AC_DEFINE(SHADOWPW))
+ AC_CHECKING(getspnam)
++AH_TEMPLATE([SHADOWPW],
++[If the passwords are stored in a shadow file and you want the
++ builtin lock to work properly, define SHADOWPW.])
+ AC_TRY_LINK([#include <shadow.h>], [getspnam("x");],AC_DEFINE(SHADOWPW))
+
+ AC_CHECKING(getttyent)
++AH_TEMPLATE([GETTTYENT],
++[If your system has the new format /etc/ttys (like 4.3 BSD) and the
++ getttyent(3) library functions, define GETTTYENT.])
+ AC_TRY_LINK(,[getttyent();], AC_DEFINE(GETTTYENT))
+
+ AC_CHECKING(fdwalk)
++AH_TEMPLATE([HAVE_FDWALK],
++[Newer versions of Solaris include fdwalk, which can greatly improve
++ the startup time of screen; otherwise screen spends a lot of time
++ closing file descriptors.])
+ AC_TRY_LINK([#include <stdlib.h>], [fdwalk(NULL, NULL);],AC_DEFINE(HAVE_FDWALK))
+
+-AC_CHECKING(whether memcpy/memmove/bcopy handles overlapping arguments)
++AH_TEMPLATE([USEBCOPY],
++[Define USEBCOPY if the bcopy/memcpy from your system's C library
++ supports the overlapping of source and destination blocks. When
++ undefined, screen uses its own (probably slower) version of bcopy().])
++
++AC_CACHE_CHECK([if bcopy handles overlap],
++ [screen_cv_sys_bcopy_overlap],
+ AC_TRY_RUN([
+ main() {
+ char buf[10];
+@@ -1146,7 +1271,21 @@
+ if (strncmp(buf, "cdedef", 6))
+ exit(1);
+ exit(0); /* libc version works properly. */
+-}], AC_DEFINE(USEBCOPY))
++}], screen_cv_sys_bcopy_overlap=yes,
++screen_cv_sys_bcopy_overlap=no))
++if test X"$screen_cv_sys_bcopy_overlap" = Xyes; then
++ AC_DEFINE(USEBCOPY)
++fi
++
++AH_TEMPLATE([USEMEMMOVE],
++[SYSV machines may have a working memcpy() -- Oh, this is
++ quite unlikely. Tell me if you see one.
++ "But then, memmove() should work, if at all available" he thought...
++ Boing, never say "works everywhere" unless you checked SCO UNIX.
++ Their memove fails the test in the configure script. Sigh. (Juergen)
++])
++AC_CACHE_CHECK([if memmove handles overlap],
++ [screen_cv_sys_memmove_overlap],
+
+ AC_TRY_RUN([
+ #define bcopy(s,d,l) memmove(d,s,l)
+@@ -1161,9 +1300,15 @@
+ if (strncmp(buf, "cdedef", 6))
+ exit(1);
+ exit(0); /* libc version works properly. */
+-}], AC_DEFINE(USEMEMMOVE))
+-
++}], screen_cv_sys_memmove_overlap=yes,
++screen_cv_sys_memmove_overlap=no))
++if test X"$screen_cv_sys_memmove_overlap" = Xyes; then
++ AC_DEFINE(USEMEMMOVE)
++fi
+
++AH_TEMPLATE([USEMEMCPY],[])
++AC_CACHE_CHECK([if memcpy handles overlap],
++ [screen_cv_sys_memcpy_overlap],
+ AC_TRY_RUN([
+ #define bcopy(s,d,l) memcpy(d,s,l)
+ main() {
+@@ -1177,9 +1322,19 @@
+ if (strncmp(buf, "cdedef", 6))
+ exit(1);
+ exit(0); /* libc version works properly. */
+-}], AC_DEFINE(USEMEMCPY))
++}], screen_cv_sys_memcpy_overlap=yes,
++screen_cv_sys_memcpy_overlap=no))
++if test X"$screen_cv_sys_memcpy_overlap" = Xyes; then
++ AC_DEFINE(USEMEMCPY)
++fi
+
+ AC_MSG_CHECKING(long file names)
++AH_TEMPLATE([NAME_MAX],
++[If you are on a SYS V machine that restricts filename length to 14
++ characters, you may need to enforce that by setting NAME_MAX to 14])
++dnl TODO(Hannes) shipped config.h.in has
++dnl #undef NAME_MAX /* KEEP_UNDEF_HERE override system value */
++dnl ahead of this
+ (echo 1 > /tmp/conftest9012345) 2>/dev/null
+ (echo 2 > /tmp/conftest9012346) 2>/dev/null
+ val=`cat /tmp/conftest9012345 2>/dev/null`
+@@ -1192,6 +1347,10 @@
+ rm -f /tmp/conftest*
+
+ AC_MSG_CHECKING(for vsprintf)
++AH_TEMPLATE([USEVARARGS],
++[If your system has vsprintf() and requires the use of the macros in
++ "varargs.h" to use functions with variable arguments,
++ define USEVARARGS.])
+ AC_TRY_LINK([#include <stdarg.h>],[va_list valist; vsprintf(0,0,valist);],
+ [AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS)],
+ [AC_MSG_RESULT(no)])
+@@ -1199,12 +1358,19 @@
+ AC_HEADER_DIRENT
+
+ AC_MSG_CHECKING(for setenv)
++AH_TEMPLATE([USESETENV], [If your system has setenv() and unsetenv() define USESETENV])
+ AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
+ AC_MSG_RESULT(no)
+ AC_MSG_CHECKING(for putenv)
++AH_TEMPLATE([NEEDPUTENV],
++[If your system does not come with a setenv()/putenv()/getenv()
++ functions, you may bring in our own code by defining NEEDPUTENV.])
+ AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)
+ ))
+ AC_MSG_CHECKING([for nl_langinfo(CODESET)])
++AH_TEMPLATE([HAVE_NL_LANGINFO],
++[define HAVE_NL_LANGINFO if your system has the nl_langinfo() call
++ and <langinfo.h> defines CODESET.])
+ AC_TRY_LINK([
+ #include <langinfo.h>
+ ],[nl_langinfo(CODESET);], AC_MSG_RESULT(yes);AC_DEFINE(HAVE_NL_LANGINFO), AC_MSG_RESULT(no))
+@@ -1254,7 +1420,8 @@
+ dnl Ptx bug workaround -- insert -lc after -ltermcap
+ test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq"
+
+-AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.))
++AC_MSG_CHECKING(compiler sanity)
++AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.), AC_MSG_WARN(Skipping test due to crosscompilation))
+
+ ETCSCREENRC="\"/usr/local/etc/screenrc\""
+ if test -n "$prefix"; then
diff --git a/app-misc/screen/files/screen-4.0.3-fbsd.patch b/app-misc/screen/files/screen-4.0.3-fbsd.patch
new file mode 100644
index 0000000..773f15f
--- /dev/null
+++ b/app-misc/screen/files/screen-4.0.3-fbsd.patch
@@ -0,0 +1,55 @@
+diff -Nur screen-4.0.3.orig/os.h screen-4.0.3/os.h
+--- screen-4.0.3.orig/os.h 2002-01-09 00:42:33.000000000 +0900
++++ screen-4.0.3/os.h 2012-11-29 22:36:22.000000000 +0900
+@@ -260,9 +260,13 @@
+ #endif
+
+ #if defined(UTMPOK) || defined(BUGGYGETLOGIN)
+-# if defined(SVR4) && !defined(DGUX) && !defined(__hpux) && !defined(linux)
++# if (defined(SVR4) && !defined(DGUX) && !defined(__hpux) && !defined(linux)) || defined(__FreeBSD__)
++# ifdef UTMPX_FILE
++# define UTMPFILE UTMPX_FILE
++# else
++# define UTMPFILE "/nonexistent"
++# endif
+ # include <utmpx.h>
+-# define UTMPFILE UTMPX_FILE
+ # define utmp utmpx
+ # define getutent getutxent
+ # define getutid getutxid
+@@ -271,6 +275,10 @@
+ # define setutent setutxent
+ # define endutent endutxent
+ # define ut_time ut_xtime
++# ifdef __FreeBSD__
++# define ut_time ut_tv.tv_sec
++# define GETUTENT
++# endif
+ # else /* SVR4 */
+ # include <utmp.h>
+ # endif /* SVR4 */
+diff -Nur screen-4.0.3.orig/screen.h screen-4.0.3/screen.h
+--- screen-4.0.3.orig/screen.h 2003-08-22 21:28:43.000000000 +0900
++++ screen-4.0.3/screen.h 2012-11-29 22:38:16.000000000 +0900
+@@ -22,6 +22,9 @@
+ * $Id: screen.h,v 1.12 1994/05/31 12:32:54 mlschroe Exp $ FAU
+ */
+
++#if defined(__FreeBSD__)
++# include <string.h>
++#endif
+ #include "os.h"
+
+ #if defined(__STDC__)
+diff -Nur screen-4.0.3.orig/utmp.c screen-4.0.3/utmp.c
+--- screen-4.0.3.orig/utmp.c 2003-09-08 23:27:17.000000000 +0900
++++ screen-4.0.3/utmp.c 2012-11-29 22:36:22.000000000 +0900
+@@ -589,7 +589,7 @@
+ struct utmp *u;
+ {
+ u->ut_type = DEAD_PROCESS;
+-#if !defined(linux) || defined(EMPTY)
++#if (!defined(__FreeBSD__) && (!defined(linux) || defined(EMPTY)))
+ u->ut_exit.e_termination = 0;
+ u->ut_exit.e_exit = 0;
+ #endif
diff --git a/app-misc/screen/files/screen-4.0.3-setenv_autoconf.patch b/app-misc/screen/files/screen-4.0.3-setenv_autoconf.patch
new file mode 100644
index 0000000..e47a15d
--- /dev/null
+++ b/app-misc/screen/files/screen-4.0.3-setenv_autoconf.patch
@@ -0,0 +1,79 @@
+--- configure.in.DIST 2006-10-31 21:39:07.010473000 -0800
++++ configure.in 2006-10-31 21:43:05.630162000 -0800
+@@ -1211,15 +1211,32 @@
+ AC_HEADER_DIRENT
+
+ AC_MSG_CHECKING(for setenv)
+-AH_TEMPLATE([USESETENV], [If your system has setenv() and unsetenv() define USESETENV])
+-AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV),
+-AC_MSG_RESULT(no)
+-AC_MSG_CHECKING(for putenv)
+-AH_TEMPLATE([NEEDPUTENV],
+-[If your system does not come with a setenv()/putenv()/getenv()
+- functions, you may bring in our own code by defining NEEDPUTENV.])
+-AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)
+-))
++if test -z "$ac_setenv_args"; then
++ AC_TRY_LINK(
++ [#include <stdlib.h>],
++ [
++ setenv((char *) 0, (char *) 0, 0);
++ ], ac_setenv_args=3)
++fi
++if test -z "$ac_setenv_args"; then
++ AC_TRY_LINK(
++ [#include <stdlib.h>],
++ [
++ setenv((char *) 0, (char *) 0);
++ ], ac_setenv_args=2)
++fi
++if test -n "$ac_setenv_args"; then
++ AC_DEFINE(USESETENV)
++ if test "$ac_setenv_args" = 3; then
++ AC_DEFINE(HAVE_SETENV_3)
++ elif test "$ac_setenv_args" = 2; then
++ AC_DEFINE(HAVE_SETENV_2)
++ fi
++else
++ AC_MSG_RESULT(no)
++ AC_MSG_CHECKING(for putenv)
++ AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV))
++fi
+ AC_MSG_CHECKING([for nl_langinfo(CODESET)])
+ AH_TEMPLATE([HAVE_NL_LANGINFO],
+ [define HAVE_NL_LANGINFO if your system has the nl_langinfo() call
+--- config.h.in.DIST 2006-10-31 21:43:23.233714000 -0800
++++ config.h.in 2006-10-31 21:44:27.346275000 -0800
+@@ -548,6 +548,16 @@
+ #undef USESETENV
+
+ /*
++ * If setenv() takes 3 arguments define HAVE_SETENV_3
++ */
++#undef HAVE_SETENV_3
++
++/*
++ * If setenv() takes 2 arguments define HAVE_SETENV_2
++ */
++#undef HAVE_SETENV_2
++
++/*
+ * If your system does not come with a setenv()/putenv()/getenv()
+ * functions, you may bring in our own code by defining NEEDPUTENV.
+ */
+--- misc.c.DIST 2006-10-31 20:55:42.481760000 -0800
++++ misc.c 2006-10-31 21:53:24.143551000 -0800
+@@ -613,11 +613,11 @@
+ */
+ # endif /* NEEDSETENV */
+ #else /* USESETENV */
+-# if defined(linux) || defined(__convex__) || (BSD >= 199103)
++# if HAVE_SETENV_3
+ setenv(var, value, 1);
+ # else
+ setenv(var, value);
+-# endif /* linux || convex || BSD >= 199103 */
++# endif /* HAVE_SETENV_3 */
+ #endif /* USESETENV */
+ }
+
diff --git a/app-misc/screen/files/screenrc b/app-misc/screen/files/screenrc
new file mode 100644
index 0000000..02e63bf
--- /dev/null
+++ b/app-misc/screen/files/screenrc
@@ -0,0 +1,356 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+#
+# /etc/screenrc
+#
+# This is the system wide screenrc.
+#
+# You can use this file to change the default behavior of screen system wide
+# or copy it to ~/.screenrc and use it as a starting point for your own
+# settings.
+#
+# Commands in this file are used to set options, bind screen functions to
+# keys, redefine terminal capabilities, and to automatically establish one or
+# more windows at the beginning of your screen session.
+#
+# This is not a comprehensive list of options, look at the screen manual for
+# details on everything that you can put in this file.
+#
+#
+
+# ==============================================================================
+# SCREEN SETTINGS
+# ==============================================================================
+
+# ESCAPE - the COMMAND CHARACTER
+# ===============================================================
+# escape ^aa # default
+# escape ^^^^ # suggested binding (Control-^) for Emacs users
+
+
+# PASSWORD
+# ===============================================================
+# This commands sets the *internal* password for the screen session.
+# WARNING!! If this is set then a "lock" command will only let you in to the
+# session after you enter the user's account password and then *also*
+# the internal password for that session. This gives additional safety but,
+# if you forget the internal password then you cannot resume your session.
+# Use :password to generate a password
+# password ODSJQf.4IJN7E # "1234"
+
+
+# VARIABLES
+# ===============================================================
+# No annoying audible bell, using "visual bell"
+# vbell on # default: off
+# vbell_msg " -- Bell,Bell!! -- " # default: "Wuff,Wuff!!"
+
+# Automatically detach on hangup.
+ autodetach on # default: on
+
+# Don't display the copyright page
+ startup_message off # default: on
+
+# Uses nethack-style messages
+# nethack on # default: off
+
+# Affects the copying of text regions
+ crlf off # default: off
+
+# Enable/disable multiuser mode. Standard screen operation is singleuser.
+# In multiuser mode the commands acladd, aclchg, aclgrp and acldel can be used
+# to enable (and disable) other user accessing this screen session.
+# Requires suid-root.
+ multiuser off
+
+# Change default scrollback value for new windows
+ defscrollback 1000 # default: 100
+
+# Define the time that all windows monitored for silence should
+# wait before displaying a message. Default 30 seconds.
+ silencewait 15 # default: 30
+
+# bufferfile: The file to use for commands
+# "readbuf" ('<') and "writebuf" ('>'):
+ bufferfile $HOME/.screen_exchange
+#
+# hardcopydir: The directory which contains all hardcopies.
+# hardcopydir ~/.hardcopy
+# hardcopydir ~/.screen
+#
+# shell: Default process started in screen's windows.
+# Makes it possible to use a different shell inside screen
+# than is set as the default login shell.
+# If begins with a '-' character, the shell will be started as a login shell.
+# shell zsh
+# shell bash
+# shell ksh
+ shell -$SHELL
+
+# shellaka '> |tcsh'
+# shelltitle '$ |bash'
+
+# emulate .logout message
+ pow_detach_msg "Screen session of \$LOGNAME \$:cr:\$:nl:ended."
+
+# caption always " %w --- %c:%s"
+# caption always "%3n %t%? @%u%?%? [%h]%?%=%c"
+
+# advertise hardstatus support to $TERMCAP
+# termcapinfo * '' 'hs:ts=\E_:fs=\E\\:ds=\E_\E\\'
+
+# set every new windows hardstatus line to somenthing descriptive
+# defhstatus "screen: ^En (^Et)"
+
+# don't kill window after the process died
+# zombie "^["
+
+# ignore displays that block on output
+defnonblock on
+
+# XTERM TWEAKS
+# ===============================================================
+
+# xterm understands both im/ic and doesn't have a status line.
+# Note: Do not specify im and ic in the real termcap/info file as
+# some programs (e.g. vi) will not work anymore.
+ termcap xterm hs@:cs=\E[%i%d;%dr:im=\E[4h:ei=\E[4l
+ terminfo xterm hs@:cs=\E[%i%p1%d;%p2%dr:im=\E[4h:ei=\E[4l
+
+# 80/132 column switching must be enabled for ^AW to work
+# change init sequence to not switch width
+ termcapinfo xterm Z0=\E[?3h:Z1=\E[?3l:is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l
+
+# Make the output buffer large for (fast) xterms.
+# termcapinfo xterm* OL=10000
+ termcapinfo xterm* OL=100
+
+# tell screen that xterm can switch to dark background and has function
+# keys.
+ termcapinfo xterm 'VR=\E[?5h:VN=\E[?5l'
+ termcapinfo xterm 'k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~'
+ termcapinfo xterm 'kh=\EOH:kI=\E[2~:kD=\E[3~:kH=\EOF:kP=\E[5~:kN=\E[6~'
+
+# special xterm hardstatus: use the window title.
+ termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'
+
+#terminfo xterm 'vb=\E[?5h$<200/>\E[?5l'
+ termcapinfo xterm 'vi=\E[?25l:ve=\E[34h\E[?25h:vs=\E[34l'
+
+# emulate part of the 'K' charset
+ termcapinfo xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334,{\344,|\366,}\374,~\337'
+
+# xterm-52 tweaks:
+# - uses background color for delete operations
+ termcapinfo xterm* be
+
+# Do not use xterm's alternative window buffer, it breaks scrollback (see bug #61195)
+ termcapinfo xterm|xterms|xs ti@:te=\E[2J
+
+# WYSE TERMINALS
+# ===============================================================
+
+#wyse-75-42 must have flow control (xo = "terminal uses xon/xoff")
+#essential to have it here, as this is a slow terminal.
+ termcapinfo wy75-42 xo:hs@
+
+# New termcap sequences for cursor application mode.
+ termcapinfo wy* CS=\E[?1h:CE=\E[?1l:vi=\E[?25l:ve=\E[?25h:VR=\E[?5h:VN=\E[?5l:cb=\E[1K:CD=\E[1J
+
+
+# OTHER TERMINALS
+# ===============================================================
+
+# make hp700 termcap/info better
+ termcapinfo hp700 'Z0=\E[?3h:Z1=\E[?3l:hs:ts=\E[62"p\E[0$~\E[2$~\E[1$}:fs=\E[0}\E[61"p:ds=\E[62"p\E[1$~\E[61"p:ic@'
+
+# Extend the vt100 desciption by some sequences.
+ termcap vt100* ms:AL=\E[%dL:DL=\E[%dM:UP=\E[%dA:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC
+ terminfo vt100* ms:AL=\E[%p1%dL:DL=\E[%p1%dM:UP=\E[%p1%dA:DO=\E[%p1%dB:LE=\E[%p1%dD:RI=\E[%p1%dC
+ termcapinfo linux C8
+# old rxvt versions also need this
+# termcapinfo rxvt C8
+
+
+# KEYBINDINGS
+# ==============================================================
+# The "bind" command assign keys to (internal) commands
+# SCREEN checks all the keys you type; you type the key
+# which is known as the "command character" then SCREEN
+# eats this key, too, and checks whether this key is
+# "bound" to a command. If so then SCREEN will execute it.
+#
+# The command "bind" allows you to chose which keys
+# will be assigned to the commands.
+#
+# Some commands are bound to several keys -
+# usually to both some letter and its corresponding
+# control key combination, eg the command
+# "(create) screen" is bound to both 'c' and '^C'.
+#
+# The following list shows the default bindings:
+#
+# break ^B b
+# clear C
+# colon :
+# copy ^[ [
+# detach ^D d
+# digraph ^V
+# displays *
+# dumptermcap .
+# fit F
+# flow ^F f
+# focus ^I
+# hardcopy h
+# help ?
+# history { }
+# info i
+# kill K k
+# lastmsg ^M m
+# license ,
+# log H
+# login L
+# meta x
+# monitor M
+# next ^@ ^N sp n
+# number N
+# only Q
+# other ^X
+# pow_break B
+# pow_detach D
+# prev ^H ^P p ^?
+# quit \
+# readbuf <
+# redisplay ^L l
+# remove X
+# removebuf =
+# reset Z
+# screen ^C c
+# select " '
+# silence _
+# split S
+# suspend ^Z z
+# time ^T t
+# title A
+# vbell ^G
+# version v
+# width W
+# windows ^W w
+# wrap ^R r
+# writebuf >
+# xoff ^S s
+# xon ^Q q
+# ^] paste .
+# - select -
+# 0 select 0
+# 1 select 1
+# 2 select 2
+# 3 select 3
+# 4 select 4
+# 5 select 5
+# 6 select 6
+# 7 select 7
+# 8 select 8
+# 9 select 9
+# I login on
+# O login off
+# ] paste .
+#
+
+# And here are the default bind commands if you need them:
+#
+# bind A title
+# bind C clear
+# bind D pow_detach
+# bind F fit
+# bind H log
+# bind I login on
+# bind K kill
+# bind L login
+# bind M monitor
+# bind N number
+# bind O login off
+# bind Q only
+# bind S split
+# bind W width
+# bind X remove
+# bind Z reset
+
+# Let's remove some dangerous key bindings ...
+ bind k
+ bind ^k
+# bind . dumptermcap # default
+ bind .
+# bind ^\ quit # default
+ bind ^\
+# bind \\ quit # default
+ bind \\
+# bind ^h ??? # default
+ bind ^h
+# bind h hardcopy # default
+ bind h
+
+# ... and make them better.
+ bind 'K' kill
+ bind 'I' login on
+ bind 'O' login off
+ bind '}' history
+
+# Yet another hack:
+# Prepend/append register [/] to the paste if ^a^] is pressed.
+# This lets me have autoindent mode in vi.
+ register [ "\033:se noai\015a"
+ register ] "\033:se ai\015a"
+ bind ^] paste [.]
+
+
+# hardstatus alwaysignore
+# hardstatus alwayslastline "%Lw"
+
+# Resize the current region. The space will be removed from or added to
+# the region below or if there's not enough space from the region above.
+ bind = resize =
+ bind + resize +3
+ bind - resize -3
+# bind _ resize max
+#
+# attrcolor u "-u b"
+# attrcolor b "R"
+
+# STARTUP SCREENS
+# ===============================================================
+# Defines the time screen delays a new message when one message
+# is currently displayed. The default is 1 second.
+# msgminwait 2
+
+# Time a message is displayed if screen is not disturbed by
+# other activity. The dafault is 5 seconds:
+# msgwait 2
+
+# Briefly show the version number of this starting
+# screen session - but only for *one* second:
+# msgwait 1
+# version
+
+# Welcome the user:
+# echo "welcome :-)"
+# echo "I love you today."
+
+# Uncomment one/some following lines to automatically let
+# SCREEN start some programs in the given window numbers:
+# screen -t MAIL 0 mutt
+# screen -t EDIT 1 vim
+# screen -t GOOGLE 2 links http://www.google.com
+# screen -t NEWS 3 slrn
+# screen -t WWW 4 links http://www.math.fu-berlin.de/~guckes/
+# screen 5
+# screen 6
+
+# Set the environment variable var to value string. If only var is specified,
+# you'll be prompted to enter a value. If no parameters are specified,
+# you'll be prompted for both variable and value. The environment is
+# inherited by all subsequently forked shells.
+# setenv PROMPT_COMMAND 'echo -n -e "\033k\033\134"'
+
+# Don't you want to start programs which need a DISPLAY ?
+# setenv DISPLAY ''
diff --git a/app-misc/screen/screen-4.0.3-r7.ebuild b/app-misc/screen/screen-4.0.3-r7.ebuild
new file mode 100644
index 0000000..a3751cc
--- /dev/null
+++ b/app-misc/screen/screen-4.0.3-r7.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+WANT_AUTOCONF="2.5"
+
+inherit eutils flag-o-matic toolchain-funcs pam autotools user
+
+DESCRIPTION="Full-screen window manager that multiplexes physical terminals between several processes"
+HOMEPAGE="http://www.gnu.org/software/screen/"
+SRC_URI="ftp://ftp.uni-erlangen.de/pub/utilities/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~sparc-fbsd ~x86-fbsd ~hppa-hpux ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="debug nethack pam selinux multiuser"
+
+RDEPEND=">=sys-libs/ncurses-5.2
+ pam? ( virtual/pam )
+ selinux? ( sec-policy/selinux-screen )"
+DEPEND="${RDEPEND}"
+
+pkg_setup() {
+ # Make sure utmp group exists, as it's used later on.
+ enewgroup utmp 406
+}
+
+src_prepare() {
+ # Bug 34599: integer overflow in 4.0.1
+ # (Nov 29 2003 -solar)
+ epatch "${FILESDIR}"/screen-4.0.1-int-overflow-fix.patch
+
+ # Bug 31070: configure problem which affects alpha
+ # (13 Jan 2004 agriffis)
+ epatch "${FILESDIR}"/screen-4.0.1-vsprintf.patch
+
+ # uclibc doesnt have sys/stropts.h
+ if ! (echo '#include <sys/stropts.h>' | $(tc-getCC) -E - &>/dev/null) ; then
+ epatch "${FILESDIR}"/4.0.2-no-pty.patch
+ fi
+
+ # Don't use utempter even if it is found on the system
+ epatch "${FILESDIR}"/4.0.2-no-utempter.patch
+
+ # Don't link against libelf even if it is found on the system
+ epatch "${FILESDIR}"/4.0.2-no-libelf.patch
+
+ # Patch for time function on 64bit systems
+ epatch "${FILESDIR}"/4.0.2-64bit-time.patch
+
+ # Patch that makes %u work for windowlist -b formats
+ epatch "${FILESDIR}"/4.0.2-windowlist-multiuser-fix.patch
+
+ # Open tty in non-blocking mode
+ epatch "${FILESDIR}"/4.0.2-nonblock.patch
+
+ # compability for sys-devel/autoconf-2.62
+ epatch "${FILESDIR}"/screen-4.0.3-config.h-autoconf-2.62.patch
+
+ # crosscompile patch
+ epatch "${FILESDIR}"/"${P}"-crosscompile.patch
+
+ # sched.h is a system header and causes problems with some C libraries
+ mv sched.h _sched.h || die
+ sed -i '/include/s:sched.h:_sched.h:' screen.h || die
+
+ # Allow for more rendition (color/attribute) changes in status bars
+ sed -i \
+ -e "s:#define MAX_WINMSG_REND 16:#define MAX_WINMSG_REND 64:" \
+ screen.c \
+ || die "sed screen.c failed"
+
+ # Fix manpage.
+ sed -i \
+ -e "s:/usr/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \
+ -e "s:/usr/local/screens:${EPREFIX}/var/run/screen:g" \
+ -e "s:/local/etc/screenrc:${EPREFIX}/etc/screenrc:g" \
+ -e "s:/etc/utmp:${EPREFIX}/var/run/utmp:g" \
+ -e "s:/local/screens/S-:${EPREFIX}/var/run/screen/S-:g" \
+ doc/screen.1 \
+ || die "sed doc/screen.1 failed"
+
+ # proper setenv detection for Solaris
+ epatch "${FILESDIR}"/${P}-setenv_autoconf.patch
+
+ # Allow TERM string large enough to use with rxvt-unicode-256color
+ # Allow usernames up to 32 chars
+ epatch "${FILESDIR}"/${PV}-extend-d_termname-ng2.patch
+
+ # support CPPFLAGS
+ epatch "${FILESDIR}"/${P}-cppflags.patch
+
+ # support >=Gentoo/FreeBSD 9.0, bug #409819
+ epatch "${FILESDIR}"/${P}-fbsd.patch
+
+ # reconfigure
+ eautoconf
+}
+
+src_configure() {
+ append-cppflags "-DMAXWIN=${MAX_SCREEN_WINDOWS:-100}"
+
+ [[ ${CHOST} == *-solaris* ]] && append-libs -lsocket -lnsl
+
+ use nethack || append-cppflags "-DNONETHACK"
+ use debug && append-cppflags "-DDEBUG"
+
+ econf \
+ --with-socket-dir="${EPREFIX}/var/run/screen" \
+ --with-sys-screenrc="${EPREFIX}/etc/screenrc" \
+ --with-pty-mode=0620 \
+ --with-pty-group=5 \
+ --enable-rxvt_osc \
+ --enable-telnet \
+ --enable-colors256 \
+ $(use_enable pam) \
+ $(use multiuser || echo --disable-socket-dir)
+
+ # Second try to fix bug 12683, this time without changing term.h
+ # The last try seemed to break screen at run-time.
+ # (16 Jan 2003 agriffis)
+ LC_ALL=POSIX make term.h || die "Failed making term.h"
+}
+
+src_install() {
+ dobin screen
+
+ if use multiuser || use prefix
+ then
+ fperms 4755 /usr/bin/screen
+ else
+ fowners root:utmp /usr/bin/screen
+ fperms 2755 /usr/bin/screen
+ fi
+
+ insinto /usr/share/screen
+ doins terminfo/{screencap,screeninfo.src}
+ insinto /usr/share/screen/utf8encodings
+ doins utf8encodings/??
+ insinto /etc
+ doins "${FILESDIR}"/screenrc
+
+ pamd_mimic_system screen auth
+
+ dodoc \
+ README ChangeLog INSTALL TODO NEWS* patchlevel.h \
+ doc/{FAQ,README.DOTSCREEN,fdpat.ps,window_to_display.ps}
+
+ doman doc/screen.1
+ doinfo doc/screen.info*
+}
+
+pkg_postinst() {
+ elog "Some dangerous key bindings have been removed or changed to more safe values."
+ elog "We enable some xterm hacks in our default screenrc, which might break some"
+ elog "applications. Please check /etc/screenrc for information on these changes."
+}