[ttssh2-commit] [9516] cygwin/ を作成、cygterm/, cygtool/ を移動, cyglaunch/ 追加

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 11月 10日 (水) 22:01:23 JST


Revision: 9516
          https://osdn.net/projects/ttssh2/scm/svn/commits/9516
Author:   zmatsuo
Date:     2021-11-10 22:01:23 +0900 (Wed, 10 Nov 2021)
Log Message:
-----------
cygwin/ を作成、cygterm/, cygtool/ を移動, cyglaunch/ 追加

- cygwin/ でビルドできるよう sln, vcproj を追加
  - installer/build.bat 修正
- cyglaunch/ 追加
  - cygterm から cyglaunch を移動
  - cyglaunch は cygwinを利用しないバイナリで、cygwin(mingw)でビルドしなくてもよい
  - 起動時にコンソールを出さないよう subsystem:windows でリンク
- パス変更対応
  - installer/ の bat,iss など
  - teratermpro.rc アイコンパス

Modified Paths:
--------------
    trunk/CMakeLists.txt
    trunk/doc/CMakeLists.txt
    trunk/installer/CMakeLists.txt
    trunk/installer/build.bat
    trunk/installer/makearchive.bat
    trunk/installer/teraterm.iss
    trunk/installer/teraterm_cmake.iss.in
    trunk/teraterm/teraterm/ttermpro.rc

Added Paths:
-----------
    trunk/cygwin/
    trunk/cygwin/CMakeLists.txt
    trunk/cygwin/README.md
    trunk/cygwin/cyglaunch/
    trunk/cygwin/cyglaunch/CMakeLists.txt
    trunk/cygwin/cyglaunch/README.md
    trunk/cygwin/cyglaunch/cyglaunch.c
    trunk/cygwin/cyglaunch/cyglaunch.rc
    trunk/cygwin/cyglaunch/cyglaunch.v16.vcxproj
    trunk/cygwin/cyglaunch/cyglaunch.v8.vcproj
    trunk/cygwin/cygterm/
    trunk/cygwin/cygterm/.gitignore
    trunk/cygwin/cygterm/CMakeLists.txt
    trunk/cygwin/cygterm/COPYING
    trunk/cygwin/cygterm/Makefile
    trunk/cygwin/cygterm/README
    trunk/cygwin/cygterm/README-j
    trunk/cygwin/cygterm/build_cygterm.cmake
    trunk/cygwin/cygterm/cyglaunch.c
    trunk/cygwin/cygterm/cygterm+-x86_64/
    trunk/cygwin/cygterm/cygterm+-x86_64/cygterm.exe
    trunk/cygwin/cygterm/cygterm.bmp
    trunk/cygwin/cygterm/cygterm.cc
    trunk/cygwin/cygterm/cygterm.cfg
    trunk/cygwin/cygterm/cygterm.ico
    trunk/cygwin/cygtool/
    trunk/cygwin/cygtool/CMakeLists.txt
    trunk/cygwin/cygtool/build_cygtool.cmake
    trunk/cygwin/cygtool/cygtool.c
    trunk/cygwin/cygtool/cygtool.def
    trunk/cygwin/cygtool/cygtool.mak
    trunk/cygwin/cygtool/cygtool.v16.vcxproj
    trunk/cygwin/cygtool/cygtool.v8.vcproj
    trunk/cygwin/cygwin.v16.sln
    trunk/cygwin/cygwin.v8.sln

Removed Paths:
-------------
    trunk/cygterm/.gitignore
    trunk/cygterm/COPYING
    trunk/cygterm/Makefile
    trunk/cygterm/README
    trunk/cygterm/README-j
    trunk/cygterm/cyglaunch.c
    trunk/cygterm/cygterm+-x86_64/cygterm.exe
    trunk/cygterm/cygterm.bmp
    trunk/cygterm/cygterm.cc
    trunk/cygterm/cygterm.cfg
    trunk/cygterm/cygterm.ico
    trunk/installer/cygtool/CMakeLists.txt
    trunk/installer/cygtool/build_cygtool.cmake
    trunk/installer/cygtool/cygtool.c
    trunk/installer/cygtool/cygtool.def
    trunk/installer/cygtool/cygtool.mak

-------------- next part --------------
Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/CMakeLists.txt	2021-11-10 13:01:23 UTC (rev 9516)
@@ -183,6 +183,7 @@
 if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/TTXAdditional/CMakeLists.txt)
   add_subdirectory(TTXAdditional)
 endif()
+add_subdirectory(cygwin)
 
 ### create buildinfo.txt
 configure_file(

Deleted: trunk/cygterm/.gitignore
===================================================================
--- trunk/cygterm/.gitignore	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/cygterm/.gitignore	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,5 +0,0 @@
-cyglaunch.exe
-cygterm+.tar.gz
-cygterm.exe
-cygterm.rc
-cygterm.res

Deleted: trunk/cygterm/COPYING
===================================================================
--- trunk/cygterm/COPYING	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/cygterm/COPYING	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,339 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-                            NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc.,
-    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.

Deleted: trunk/cygterm/Makefile
===================================================================
--- trunk/cygterm/Makefile	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/cygterm/Makefile	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,71 +0,0 @@
-# Makefile for CygTerm
-
-BINDIR = $(HOME)/bin
-
-CC = gcc
-CFLAGS = -D_GNU_SOURCE -O2 -fno-exceptions
-#CFLAGS = -g -fno-exceptions
-LDFLAGS = -mwindows
-
-LAUNCH = cyglaunch.exe
-LAUNCH_SRC = cyglaunch.c
-EXE = cygterm.exe
-SRC = $(EXE:.exe=.cc)
-CFG = $(EXE:.exe=.cfg)
-RES = $(EXE:.exe=.res)
-ICO = $(EXE:.exe=.ico)
-RC  = $(EXE:.exe=.rc)
-ARCHIVE = cygterm+.tar.gz
-
-.PHONY: all clean install uninstall
-
-all : $(EXE) $(LAUNCH) $(ARCHIVE)
-
-$(EXE) : $(SRC) $(ICO) $(RC)
-	windres -O coff -o $(RES) $(RC)
-  ifeq (0, $(shell nm /usr/lib/crt0.o | grep -c WinMainCRTStartup))
-	$(CC) $(CFLAGS) $(LDFLAGS) -DNO_WIN_MAIN -o $(EXE) $(SRC) $(RES)
-  else
-	$(CC) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(SRC) $(RES)
-  endif
-	strip $(EXE)
-
-$(LAUNCH) : $(LAUNCH_SRC) $(ICO) $(RC)
-	@# gcc 4.3.2? or later doesn't support "-mno-cygwin" flag.
-	@#
-	@# $(CC)                   gcc less than 4.3.2 (supports "-mno-cygwin")
-	@# gcc-3                   gcc3 (supports "-mno-cygwin")
-	@# i686-pc-mingw32-gcc     mingw-gcc-core
-	@# i686-w64-mingw32-gcc    mingw64-i686-gcc-core
-	@# x86_64-w64-mingw32-gcc  mingw64-x86_64-gcc-core
-  ifeq (i686, $(shell uname -m))
-	windres -O coff -o $(RES) $(RC)
-	( i686-pc-mingw32-gcc $(CFLAGS) $(LDFLAGS) -o $(LAUNCH) $(LAUNCH_SRC) $(RES) ) || \
-	( i686-w64-mingw32-gcc $(CFLAGS) $(LDFLAGS) -o $(LAUNCH) $(LAUNCH_SRC) $(RES) ) || \
-	( $(CC) $(CFLAGS) $(LDFLAGS) -mno-cygwin -o $(LAUNCH) $(LAUNCH_SRC) $(RES) ) || \
-	( gcc-3 $(CFLAGS) $(LDFLAGS) -mno-cygwin -o $(LAUNCH) $(LAUNCH_SRC) $(RES) )
-	strip $(LAUNCH)
-  else
-	x86_64-w64-mingw32-windres -O coff -o $(RES) $(RC)
-	x86_64-w64-mingw32-gcc $(CFLAGS) $(LDFLAGS) -o $(LAUNCH) $(LAUNCH_SRC) $(RES)
-	x86_64-w64-mingw32-strip $(LAUNCH)
-  endif
-
-$(RC):
-	echo 'icon ICON $(ICO)' > $(RC)
-
-clean :
-	rm -f $(EXE) $(RC) $(RES) $(LAUNCH) $(ARCHIVE)
-
-install : $(EXE)
-	@ install -v $(EXE) $(BINDIR)/$(EXE)
-	@ if [ ! -f $(BINDIR)/$(CFG) ]; then \
-	    install -v $(CFG) $(BINDIR)/$(CFG) \
-	; fi
-
-uninstall :
-	rm -f $(BINDIR)/$(EXE)
-	rm -f $(BINDIR)/$(CFG)
-
-$(ARCHIVE) : $(SRC) $(ICO) $(CFG) $(LAUNCH_SRC) README README-j Makefile
-	tar cf - $(SRC) $(ICO) $(CFG) $(LAUNCH_SRC) COPYING README README-j Makefile | gzip > $(ARCHIVE)

Deleted: trunk/cygterm/README
===================================================================
--- trunk/cygterm/README	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/cygterm/README	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,447 +0,0 @@
-
-                CygTerm+ - yet another Cygwin console
-
-                Using Cygwin with a terminal emulator.
-
-                (C) 2006-2016 TeraTerm Project
-                https://ttssh2.osdn.jp/
-
-                Based on CygTerm by Original developer:
-                Copyright (C) 2000-2006 NSym
-
-                nsym****@dd*****
-
-      (English) https://googledrive.com/host/0B1s-dM6d6yC4fmhEZ3c0VTNFWEFtV3daUlRGQmFHVnBmVHRybUNnUVliNWktNDRlZ2NnZTQ/index-e.html
-
-     (Japanese) https://googledrive.com/host/0B1s-dM6d6yC4fmhEZ3c0VTNFWEFtV3daUlRGQmFHVnBmVHRybUNnUVliNWktNDRlZ2NnZTQ/index.html
-
-
-// P R E F A C E //
-
-    This is an experiment trying to substitute a terminal emulator for the
-    DOS window as Cygwin console.  However, assume that it is carried out
-    without the mechanism of remote login.  In other words, it doesn't use
-    `inetd', `in.telnetd' or `login'.
-
-// I D E A //
-
-    Invoking a terminal emulator and Cygwin shell, and relaying their I/O.
-    One simple solution is just to implement a program to do this.
-
-// S P E C I F I C A T I O N //
-
-    1. When this program is run, a terminal emulator starts, and a shell
-       prompt appears there, it can be used for Cygwin console.
-
-    2. The terminal emulator and the shell have to be selectable.
-
-    3. Screen control of the shell side has to work correctly and follow
-       window resizing of the terminal emulator.
-
-// D E S I G N //
-
-    Details of cygterm.exe
-
-      [1] Prepare a listener socket to wait for a TELNET connection.
-          Find out an unused TCP port number to assign to the socket from a
-          specified range.
-
-      [2] Invoke a terminal emulator in another thread.
-          Then specify IP address `127.0.0.1' and the port number [1] in the
-          command line arguments.
-
-      [3] Accept the connection from the terminal emulator.
-          Refuse it except a connection from `127.0.0.1' in security.
-
-      [4] Do fork(), and in the child process, invoke a shell under PTY
-          (pseudo terminal) slave side.
-
-      [5] Relay I/O between the TELNET connection socket [3] and the PTY
-          master side of [4].
-
-    Support for TELNET protocol (options negotiation)
-
-        Receive the notification of terminal-type from a terminal emulator,
-        and apply it to the environment variable TERM on a shell.
-
-        Receive the notification of terminal-size from a terminal emulator,
-        and apply it to window size of PTY.
-
-        [Ref. RFC854 TELNET PROTOCOL SPECIFICATION]
-
-    cygterm.exe is implemented as an window-less Win32 application.
-
-// S O U R C E //
-
-    README       -  this file
-    README-j     -  original README in Japanese
-    COPYING      -  GNU General Pulic License (GPL) Version 2
-    Makefile     -  MAKEFILE for installation
-    cygterm.cc   -  program source code
-    cygterm.cfg  -  configuration file
-
-    * CygTerm is a free software distributed under the terms of the GNU
-      General Public License (GPL) published by Free Software Foundation.
-      See COPYING. (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
-
-      Note: Any program including non-GPL program can invoke the CygTerm
-            executable (cygterm.exe) and communicate with it.
-
-// I N S T A L L //
-
-    Do `make install' under Cygwin.
-
-    * Be sure to specify the install directory by BINDIR in Makefile
-      in advance.  cygterm.exe and cygterm.cfg are installed in BINDIR.
-      cygterm.cfg is not overwritten.
-
-// C O N F I G U R A T I O N //
-
-    cygterm.cfg is a configuration file.  This includes definitions for the
-    command lines of a terminal emulator and a shell, and several parameters.
-    cygterm.cfg is loaded from the same directory cygterm.exe exists in.
-
-      An example of cygterm.cfg
-      +-----------------------------------------------------------------------
-      | TERM = C:\program files\ttermpro\ttermpro.exe %s %d /KR=SJIS /KT=SJIS
-      | TERM_TYPE = vt100
-      | PORT_START = 20000
-      | PORT_RANGE = 40
-      | SHELL = /bin/bash
-      | ENV_1 = MAKE_MODE=unix
-      | ENV_2 = HOME=/home
-      |   :         :
-
-    TERM
-    ----
-        This is the command line to execute a terminal emulaitor.
-        Specify the full path to the command if it isn't in Windows search path.
-        This needs to be described `%s' and `%d' for the host and port number.
-
-    TERM_TYPE
-    ---------
-        This terminal type is adopted when the terminal emulator did not give
-        a terminal type. (default: vt100)  Then this value is set to the
-        environment variable TERM on a shell.
-
-    PORT_START
-    ----------
-        This is the minimum TCP port number allowed for use. (default: 20000)
-
-    PORT_RANGE
-    ----------
-        This is the maximum number of TCP ports allowed for use. (default: 40)
-
-        cygterm.exe looks for an unused port number between PORT_START and
-        PORT_START+PORT_RANGE, and therefore can be run concurrently as many
-        as this number.
-
-    SHELL
-    -----
-        This is the command line to execute a shell in Cygwin side (normally
-        /bin/bash). (default: get from /etc/passwd)
-        Specify the full path to the shell or keyword "AUTO".
-
-    LOGIN_SHELL
-    -----------
-        If this parameter is set to yes, shell is invoked as a login shell.
-        (default: no)
-
-    HOME_CHDIR
-    ----------
-        If this parameter is set to yes, current directory is changed to home
-        directory before invoke a shell. (default: no)
-
-    SOCKET_TIMEOUT
-    --------------
-        Specify the timeout of socket for waiting telnet connection from
-        terminal emulator. (default: 5secs)
-
-    SSH_AGENT_PROXY
-    ---------------
-        If this parameter is set to yes, cygterm provides ssh-agent proxy.
-        (default: no)
-
-    ENV_X
-    -----
-        This is the environment variable to be set when starting the shell.
-        It should be of the form `name=value' (like putenv).  It is possible to
-        give as many environment variables as needed by beginning with "ENV_".
-
-// U S A G E //
-
-    Command Line Options
-
-        cygterm.exe [-t 'terminal-emulator'] [-p port-number] [-dumb]
-                    [-s 'shell'] [-ls | -nols] [-cd | -nocd] [-a | -A]
-                    [-v 'env-var' ...] [-d 'directory] [-o 'option']
-
-    -t 'terminal-emulator'
-            Specify the command line of a terminal emulator to execute.
-            This format is the same as TERM in the configuration file.
-            The command line should be enclosed in quotes to include spaces.
-
-    -p port-number
-            Instead of executing a terminal emulator, try connection to this
-            port number of localhost.  It is considered another program uses
-            `-p' option to use Cygwin via cygterm.exe
-
-    -dumb
-            Suppress the TELNET options negotiation.  And ignore any TELNET
-            commands sent from terminal side.  The environment variable
-            TERM is set to `dumb' on the shell side.
-
-    -s 'shell'
-            Specify the command line of a shell on Cygwin to execute.
-            This format is the same as SHELL in the configuration file.
-            The command line should be enclosed in quotes to include spaces.
-            Any command can be spedicied even if a non-shell command.
-
-    -ls
-            Execute a shell as a login shell.
-
-    -nols
-            Execute a shell as a normal (not login) shell.
-
-    -cd
-            The current directory is moved to the user home directory and
-            the shell is invoked.
-
-    -nocd
-            The shell is invoked without changing the current directory.
-
-    -A
-            Enable ssh-agent forwarding support.
-
-    -a
-            Disable ssh-agent forwarding support.
-
-    -v 'env-var'
-            Specify the environment variable to be set when starting the shell.
-            This format is the same as ENV_X in the configuration file.
-            The expression should be enclosed in quotes to include spaces.
-            One or more `-v' options are available.
-
-    -d 'directory'
-            The current directory is moved to the specified directory and
-            the shell is invoked.
-
-    -o 'parameter'
-            Additional parameter for terminal-emulator.
-
-    The terminal emulator or connection port number, and the shell on Cygwin,
-    these need to be specified at least.  If these are given on the command
-    line, cygterm.exe can be run without configuration file cygterm.cfg.
-
-    cygterm.exe is an Win32 application which uses cygwin1.dll.  It can be run
-    from Cygwin command line or a shortcut on Windows.
-
-    * It is necessary the Windows environment variable PATH includes a
-      directory path of cygwin1.dll (normally Cygwin-root\bin) to be run
-      from Windows.
-
-// N O T E S //
-
-    * Attention in Tera Term
-
-        If your terminal emulator is Tera Term be careful not to save [Setup]
-        [Save setup] in the situation that it was started by cygterm.exe.
-        Otherwise telnet port number of TCP/IP is saved but 23 you will be
-        confused by connection failure when you normally run Tera Term to do
-        telnet.  In that case it will be recovered by saving the setting
-        with specifying TCP/IP Port# 23.
-
-// T E S T E D  O N //
-
-    As of 2010-Oct, CygTerm+ has been tested in the following environments.
-
-        WindowsXP SP3 + Cygwin 1.5.25-15
-        WindowsXP SP3 + Cygwin 1.7.7
-
-        Terminal emulator:
-                Tera Term Pro 2.3
-                Tera Term 4.67
-                PuTTY 0.60
-        Shell:
-                bash 3.2.51
-                zsh 4.3.10
-
-// C H A N G E S //
-v1.07_28 2016/11/26 (by maya)
-        * Changed the icon image.
-
-v1.07_28 2016/02/17 (by doda)
-        * Add debug mode.
-
-v1.07_27 2016/02/09 (by doda)
-        * The directory selection by -d option is prior to -cd option
-          (HOME_CHDIR=y).
-        * When -d option is specified by using -ls option(LOGIN_SHELL=y),
-           CHERE_INVOKING=y is set.
-
-v1.07_26 2015/12/14 (by doda)
-        * Add multiple connections support for the ssh-agent proxy.
-
-v1.07_25 2015/02/21 (by doda)
-        * Bug fix: The TERM environment variable can not be configured.
-
-v1.07_24 2013/08/15 (by maya)
-        * Support for 64bit Cygwin. (cyglaunch)
-
-v1.07_23 2011/04/18 (by doda)
-        * Display error message when chdir() was failed.
-
-v1.07_22 2011/03/03 (by maya)
-        * Delete mutex object for running check by installer.
-
-v1.07_21 2011/02/28 (by maya)
-        * Add mutex object for running check by installer.
-
-v1.07_20 2010/10/20 (by doda)
-        * Directory change timing with '-d' option is delayed. (security fix)
-
-v1.07_19 2010/01/28 (by doda)
-        * Accept keyword "AUTO" with '-s' option.
-
-v1.07_18 2010/01/19 (by doda)
-        * Delete doubule quote character from '-d' option's parameter.
-
-v1.07_17 2009/06/16 (by doda)
-        * Added TELNET SGA/ECHO negotiation.
-
-v1.07_16 2008/11/21 (by doda)
-        * The option that enables ssh-agent proxy support is changed from '-a'
-          to '-A'.
-        * Added '-a' option that disables ssh-agent proxy support.
-
-v1.07_15 2008/11/01 (by doda)
-        * Added ssh-agent proxy support.
-
-v1.07_14 2007/12/17 (by doda)
-        * Added '-o' option that is specifies the additional parameters for
-          terminal-emulator.
-
-v1.07_13 2007/08/03 (by maya)
-        * Added '-d' option that is specifies the start directory.
-
-v1.07_12 2007/06/10 (by doda)
-        * Add 'SOCKET_TIMEOUT' entry which the timeout value of socket for
-          waiting telnet connection in cygterm.cfg file.
-
-v1.07_11 2007/01/31 (import from cygterm v1.07)
-        * Avoid WinMainCRTStartup() redefinition error with gcc 3.4.
-        * Give an output gap for keyboard interrupt.
-
-v1.06_11 2006/09/29 (by maya)
-        * Stopped using HOME from environment variable and /etc/passwd.
-          CygTerm passes HOME which is set by Cygwin. See also /etc/profile
-        * Changed the priority of config files.
-          command line arguments > ~/.cygtermrc > /etc/cygterm.conf
-          > cygterm.cfg > /etc/passwd
-
-v1.06_10 2006/09/28 (by doda)
-        * Use getlogin() instead of environment variable USERNAME to get
-          user name.
-
-v1.06_09 2006/09/25 (by doda)
-        * Get shell information from /etc/passwd if SHELL parameter is not
-          specified.
-
-v1.06_08 2006/08/30 (by maya)
-        * Changed the priority of config files. cygterm.cfg is top priority
-          config file.
-
-v1.06_07 2006/08/19 (by maya)
-        * Use `HOME' environment variable for changing home directory if the
-          variable will be set.
-
-v1.06_06 2006/08/18 (by doda)
-        * Limit a parameter length of both '-s' and '-t' option.
-
-v1.06_05 2006/08/18 (by maya)
-        * Create mutex object for running check by installer.
-
-v1.06_04 2006/08/15 (by doda)
-        * Add 'LOGIN_SHELL' entry which the shell is invoked as the login shell
-          in cygterm.cfg file.
-
-          LOGIN_SHELL: yes | no
-
-v1.06_03 2006/08/15 (by doda)
-        * Add 'HOME_CHDIR' entry which home directory is changed in cygterm.cfg
-          file.
-
-          HOME_CHDIR: yes | no
-
-v1.06_02 2006/02/09 (by babyd****@yahoo*****)
-        * Generated CygTerm's ICON by "DotWork 2.50".
-          "DotWork 2.50" is available at http://www5a.biglobe.ne.jp/~suuta/.
-          Special Thanks to "suuta at hamal dot freemal dot ne dot jp"
-
-        * Makefile was changed, "clean" target was changed to don't remove
-          cygterm.ico.
-
-v1.06_01 2006/02/08 (by babyd****@yahoo*****)
-        * The following configuration file reading was supported:
-            + /etc/cygterm.conf
-            + ~/.cygtermrc
-
-        * Shell is invoked with user's home-directory.
-
-        * Get account configuration from /etc/passwd by getpwnam(3),
-          getting account name from USERNAME environment by getenv(3).
-
-        * Makefile was changed, default build is with icon executable.
-
-v1.06 2004/01/24
-        * The following command line options were added:
-            -t 'terminal-emulator' (specifies the terminal emulator)
-            -p port-number (specifies the port# to connect)
-            -dumb (specifies dumb terminal mode)
-            -s 'shell' (specifies the shell)
-            -v 'env-var' (specifies environment variables)
-
-        * Fixed to fail in `make install' if BINDIR was not found.
-
-        * cygterm.cc and README.txt were changed to English version.
-
-v1.05 2003/01/14
-        * Fixed to transmit Ctrl+SPACE (NUL).
-          The NUL character was not able to be transmitted even if Ctrl+SPACE
-          was typed, because it was ignored simply as an way to handle the
-          newline CR+NUL.
-
-v1.04 2002/12/08
-        * Changed to display error messages for failure to execute a terminal
-          emulator or a shell.
-
-        * Makefile was changed.
-          + do not overwrite cygterm.cfg when `make install'.
-          + add the gcc option -fno-exceptions against the GCC-3 link error.
-
-v1.03 2002/07/24
-        * Fixed to convert terminal type into lower-case when cygterm received
-          it from a terminal emulator.  Because some upper-case values such as
-          `ANSI' `VT100' of the environment variable TERM might not be found
-          in terminfo depending on the kind of terminal emulator.
-          (Windows 2000 telnet.exe, etc)
-
-v1.02 2002/07/22
-        * Fix to be able to start a terminal emulator even if it was a console
-          application.  (Windows 2000 telnet.exe, etc)
-          There was a mistake in calling CreateProcess().
-
-        * Fixed to suppress duplicate newline on a shell by canceling LF when
-          a terminal emulator sent CR+LF.  (Windows 98 telnet.exe, etc)
-
-        * Embedded the version number in cygterm.exe executable code.
-          How to check: $ strings cygterm.exe | grep version
-
-v1.01 2002/07/19
-        * Fixed that cygterm did not work with zsh or tcsh.
-          Input was blocked when zsh or tcsh started, because the approach to
-          open the pseudo terminal was not good.
-
-v1.00 2000/12/17
-        * The initial version was released.
-

Deleted: trunk/cygterm/README-j
===================================================================
--- trunk/cygterm/README-j	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/cygterm/README-j	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,462 +0,0 @@
-
-                CygTerm+  -  yet another Cygwin console
-
-                $B%?!<%_%J%k!&%(%_%e%l!<%?$G(B Cygwin $B$r;H$&!#(B
-
-                (C) 2006-2016 TeraTerm Project
-                https://ttssh2.osdn.jp/
-
-                Based on CygTerm by Original developer:
-                Copyright (C) 2000-2006 NSym
-                nsym****@dd*****
-      (English) https://googledrive.com/host/0B1s-dM6d6yC4fmhEZ3c0VTNFWEFtV3daUlRGQmFHVnBmVHRybUNnUVliNWktNDRlZ2NnZTQ/index-e.html
-     (Japanese) https://googledrive.com/host/0B1s-dM6d6yC4fmhEZ3c0VTNFWEFtV3daUlRGQmFHVnBmVHRybUNnUVliNWktNDRlZ2NnZTQ/index.html
-
-
-// $B$O(B $B$8(B $B$a(B $B$K(B //
-
-    Cygwin$B%3%s%=!<%k$G$"$k(BDOS$BAk$r%?!<%_%J%k!&%(%_%e%l!<%?$GCV$-BX$($F$_$h$&!"(B
-    $B$H$$$&;n$_$G$9!#(B $B$?$@$7!X%j%b!<%H%m%0%$%s$N$7$/$_$rMxMQ$;$:$K!Y$H$$$&(B
-    $BA0Ds$G$9!#(B $B$7$?$,$C$F(B inetd $B$H$+(B in.telnetd $B$H$+(B login $BEy$O;HMQ$7$^$;$s!#(B
-
-// $B9M(B $B$((B $BJ}(B //
-
-    $B%?!<%_%J%k!&%(%_%e%l!<%?$H(BCygwin$B>e$N%7%'%k$r5/F0$7!"N><T$rCf7Q$9$k!#(B
-    $B$3$l$r9T$&%W%m%0%i%`$r:n$l$P$h$$!#(B
-
-// $B;E(B $BMM(B //
-
-    1. $B$3$N%W%m%0%i%`$r<B9T$9$k$H!"%?!<%_%J%k!&%(%_%e%l!<%?$,N)$A>e$,$j!"(B
-       $B$=$3$K%7%'%k$N%W%m%s%W%H$,8=$l!"(BCygwin$B%3%s%=!<%k$H$7$F;H$($k$3$H!#(B
-
-    2. $B5/F0$9$k%?!<%_%J%k!&%(%_%e%l!<%?$H%7%'%k$OA*Br2DG=$G$"$k$3$H!#(B
-
-    3. $B%7%'%kB&$N2hLL@)8f$, @ 5>o$KF0:n$7!"%?!<%_%J%k!&%(%_%e%l!<%?B&$N(B
-       $B2hLL%5%$%:JQ99$K$bDI?o$9$k$3$H!#(B
-
-// $B @ _(B $B7W(B //
-
-    cygterm.exe $B=hM}>\:Y(B
-
-      [1] TELNET$B@\B3$rBT$A<u$1$k%j%9%J!<%=%1%C%H$rMQ0U$9$k!#(B
-          $B%=%1%C%H$K3d$jEv$F$kL$;HMQ%]!<%HHV9f$O;XDjHO0OFb$+$iC5$7=P$9!#(B
-
-      [2] $BJL%9%l%C%I$G%?!<%_%J%k!&%(%_%e%l!<%?$r5/F0$9$k!#(B
-          $B$3$N$H$-5/F00z?t$K(B IP$B%"%I%l%9(B 127.0.0.1 $B$H(B [1]$B$N%]!<%HHV9f$r;XDj$9$k!#(B
-
-      [3] $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i$N@\B3$r<u$1F~$l$k!#(B
-          $B%;%-%e%j%F%#!<>e(B 127.0.0.1 $B0J30$+$i$N@\B3$O5Q2<$9$k!#(B
-
-      [4] fork()$B$7$?;R%W%m%;%9>e!"(BPTY($B5<;wC<Kv(B)$B%9%l!<%VB&$G%7%'%k$r5/F0$9$k!#(B
-
-      [5] [3]$B$N(B TELNET$B@\B3%=%1%C%H$H(B [4]$B$N(B PTY$B%^%9%?!<B&$NF~=PNO$r66EO$7$9$k!#(B
-
-    TELNET$B%W%m%H%3%k$X$NBP1~(B (option negotiation)
-
-        $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i%?!<%_%J%k%?%$%W$NDLCN$r<u$1!"(B
-        $B%7%'%k>e(B TERM $B4D6-JQ?t$K%;%C%H$9$k!#(B
-
-        $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i%?!<%_%J%k%5%$%:$NDLCN$r<u$1!"(B
-        PTY$B$N%&%#%s%I%&%5%$%:$rF1%5%$%:$KJQ99$9$k!#(B
-
-        $B<+J,$,(B Go Ahead $B$r;H$o$J$$;v$N5v2D$r%?!<%_%J%k%(%_%e%l!<%?$KMW5a$9$k!#(B
-
-        $B%?!<%_%J%k%(%_%e%l!<%?$,(B Go Ahead $B$r;HMQ$7$J$$$h$&$KMW5a$9$k!#(B
-
-        $B%?!<%_%J%k%(%_%e%l!<%?$NAw?.FbMF$r%(%3!<%P%C%/$9$k5v2D$rMW5a$9$k!#(B
-
-        [$B;2>H(B: RFC854 TELNET PROTOCOL SPECIFICATION]
-
-    cygterm.exe $B$O%&%#%s%I%&$r;}$?$J$$(B Win32$B%"%W%j$H$7$F<BAu$9$k!#(B
-
-// $B%=(B $B!<(B $B%9(B //
-
-    README-j     -  $B$3$N%U%!%$%k(B
-    README       -  README-j$B1QLu(B
-    COPYING      -  GNU General Public License (GPL) Version 2
-    Makefile     -  $B%a%$%/%U%!%$%k(B
-    cygterm.cc   -  $B%=!<%9%3!<%I(B
-    cygterm.cfg  -  $B @ _Dj%U%!%$%k(B
-
-    $B"((B Free Software Foundation $BH/9T(B GNU General Public License (GPL)
-       $B$K=`5r$9$k%U%j!<%=%U%H%&%'%"$H$7$FG[I[$7$^$9!#(B
-       COPYING $B;2>H!#(B(https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
-
-       $BJdB-(B: $BB>%W%m%0%i%`$,(B CygTerm$B<B9T7A<0(B(cygterm.exe)$B$r5/F0$7DL?.$7$F(B
-             $B;HMQ$9$k$3$H$O!"$=$l$,Hs(BGPL$B%W%m%0%i%`$N>l9g$G$b5v2D$5$l$^$9!#(B
-
-// $B%$(B $B%s(B $B%9(B $B%H(B $B!<(B $B%k(B //
-
-    Cygwin$B4D6-2<$G(B make install $B$r<B9T$7$^$9!#(B
-
-    $B"((B $B%$%s%9%H!<%k @ h%G%#%l%/%H%j$O(B Makefile $BCf(B BINDIR $B$G @ _Dj$7$F$*$-$^$9!#(B
-       BINDIR $B$K(B cygterm.exe $B$H(B cygterm.cfg $B$,%$%s%9%H!<%k$5$l$^$9!#(B
-       cygterm.cfg $B$O>e=q$-$5$l$^$;$s!#(B
-
-// $B @ _(B $BDj(B $B%U(B $B%!(B $B%$(B $B%k(B //
-
-    cygterm.cfg $B$O @ _Dj%U%!%$%k$G$9!#(B $B;HMQ$9$kC<Kv%(%_%e%l!<%?$N%3%^%s%I%i%$%s(B
-    $B$d5/F0$9$k%7%'%k$N%3%^%s%I%i%$%sEy$r @ _Dj$7$^$9!#(B
-    cygterm.cfg $B$O(B cygterm.exe $B$HF1$8%G%#%l%/%H%j$K$J$$$H$$$1$^$;$s!#(B
-
-      cygterm.cfg $B$NNc(B
-      +-----------------------------------------------------------------------
-      | TERM = C:\program files\ttermpro\ttermpro.exe %s %d /KR=SJIS /KT=SJIS
-      | TERM_TYPE = vt100
-      | PORT_START = 20000
-      | PORT_RANGE = 40
-      | SHELL = /bin/bash
-      | ENV_1 = MAKE_MODE=unix
-      | ENV_2 = HOME=/home
-      |   :         :
-
-    TERM
-    ----
-        $B%?!<%_%J%k!&%(%_%e%l!<%?$N5/F0%3%^%s%I%i%$%s$G$9!#(B
-        $B%3%^%s%IL>$O(B Windows$B4D6-$G%Q%9$,DL$C$F$J$1$l$P%U%k%Q%9$G=q$-$^$9!#(B
-        $B%[%9%H;XDj$N$H$3$m$O(B %s $B$H$7!"%]!<%H;XDj$N$H$3$m$O(B %d $B$H$7$^$9!#(B
-
-    TERM_TYPE
-    ---------
-        $B%?!<%_%J%k!&%(%_%e%l!<%?$,%?!<%_%J%k%?%$%W$rM?$($F$/$l$J$+$C$?(B
-        $B>l9g$K:NMQ$9$k%?!<%_%J%k%?%$%W$G$9!#(B ($B%G%U%)%k%H(B:vt100)
-        $B%7%'%k>e!"4D6-JQ?t(B TERM $B$K%;%C%H$5$l$^$9!#(B
-
-    PORT_START
-    ----------
-        $B;H$$;O$a$k(B ($B;H$C$F$h$$:G>.$N(B) $B%]!<%HHV9f$G$9!#(B ($B%G%U%)%k%H(B:20000)
-
-    PORT_RANGE
-    ----------
-        $B;H$C$F$h$$%]!<%HHV9f$N8D?t$G$9!#(B ($B%G%U%)%k%H(B:40)
-
-        PORT_START $B!A(B PORT_START+PORT_RANGE $B$NHO0O$G6u$-%]!<%H$rC5$7$^$9!#(B
-        $B$3$N?t$@$1F1;~<B9T$G$-$k$3$H$K$J$j$^$9!#(B
-
-    SHELL
-    -----
-        Cygwin$BB&%7%'%k(B ($BDL>o(B /bin/bash) $B$N5/F0%3%^%s%I%i%$%s$G$9!#(B
-        ($B%G%U%)%k%H(B: /etc/passwd$B$N>pJs$r;HMQ(B)
-        $B%3%^%s%IL>$N%U%k%Q%9$+!"(B"AUTO"$B$r;XDj$7$^$9!#(B
-
-    LOGIN_SHELL
-    -----------
-        $B%7%'%k$r%m%0%$%s%7%'%k$H$7$F5/F0$9$k$+$I$&$+$r;XDj$7$^$9!#(B
-        $B%G%U%)%k%H$OL58z$G$9!#(B
-
-        $B0lHLE*$J%7%'%k$G$O%m%0%$%s%7%'%k$H$7$F5/F0$5$l$k$H!"(B.profile$B$d(B
-        .login$B$J$I$N%m%0%$%s;~$N$_FI$_9~$`%9%?!<%H%"%C%W%U%!%$%k$r<B9T(B
-        $B$7$^$9!#(B
-        $B$3$l$i$N%U%!%$%k$G$O!"DL>o!"0J2<$N$h$&$J;v$,9T$o$l$^$9!#(B
-        $B!&(BPATH$B$d(BUSER$BEy$N3F<o4D6-JQ?t$N @ _Dj$r9T$&(B
-        $B!&C<Kv$N @ _Dj$rE, @ Z$K9T$&(B
-        $B!&%+%l%s%H%G%#%l%/%H%j$r%f!<%6$N%[!<%`%G%#%l%/%H%j$KJQ99$9$k!#(B
-
-        $B0lIt$N%7%'%k(B(tclsh$B$J$I(B)$B$d%7%'%k0J30$N%W%m%0%i%`$r5/F0$9$k>l9g$O(B
-        $B8z2L$,$"$j$^$;$s!#(B
-
-    HOME_CHDIR
-    ----------
-        patch level 01 $B$K4^$^$l$k(B"$B%[!<%`%G%#%l%/%H%j$X$N0\F0(B"$B$r5!G=$5$;$k$+(B
-        $B$I$&$+$r;XDj$7$^$9!#%G%U%)%k%H$OL58z$G$9!#(B
-
-    SOCKET_TIMEOUT
-    --------------
-        $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i$N(Btelnet$B@\B3$rBT$A<u$1$k%=%1%C%H$,(B
-	$B%?%$%`%"%&%H$9$k$^$G$N;~4V$r;XDj$7$^$9!#(B ($B%G%U%)%k%H(B: 5$BIC(B)
-
-    SSH_AGENT_PROXY
-    ---------------
-        ssh$BG'>Z%(!<%8%'%s%HE>Aw5!G=$rDs6!$9$k$+$r;XDj$7$^$9!#(B
-        $BM-8z$K$9$k$H!"(BOpenSSH$B$N(Bssh$BG'>Z%(!<%8%'%s%H$KBP1~$7$?%W%m%0%i%`$,!"(B
-        CygTerm+$B$rDL$7$F(BPageant$B$K%"%/%;%9$G$-$k$h$&$K$J$j$^$9!#(B
-        $B%G%U%)%k%H$OL58z$G$9!#(B
-
-    ENV_X
-    -----
-        $B%7%'%k5/F0;~$K @ _Dj$7$F$*$-$?$$4D6-JQ?t$G$9!#!VJQ?tL>(B=$BCM!W$N7A<0(B
-        (putenv$B7A<0(B) $B$G5-=R$7$^$9!#(B ENV_ $B$G;O$a$l$P$$$/$D$G$b5-=R$G$-$^$9!#(B
-
-
-// $B5/(B $BF0(B $BJ}(B $BK!(B //
-
-    $B%3%^%s%I%i%$%s!&%*%W%7%g%s(B
-
-        cygterm.exe [-t 'terminal-emulator'] [-p port-number] [-dumb]
-                    [-s 'shell'] [-ls | -nols] [-cd | -nocd] [-a | -A]
-                    [-v 'env-var' ...] [-d 'directory'] [-o 'parameter']
-
-        -t 'terminal-emulator'
-                $B%?!<%_%J%k!&%(%_%e%l!<%?$r;XDj$7$^$9!#(B
-                $B;XDj7A<0$O @ _Dj%U%!%$%k$N(B TERM $B$HF1$8$G$9!#(B
-                $B6uGrJ8;z$r4^$`>l9g$OI,$:%/%)!<%H$G0O$_$^$9!#(B
-
-        -p port-number
-                $B%?!<%_%J%k!&%(%_%e%l!<%?$r5/F0$9$k$N$G$O$J$/!"(B
-                $B%m!<%+%k%[%9%H$N$3$N%]!<%HHV9f$X$N@\B3$r;n$_$^$9!#(B
-                $BB>$N%"%W%j%1!<%7%g%s!&%W%m%0%i%`$,(B -p $B%*%W%7%g%s$r;H$C$F!"(B
-                cygterm.exe $B7PM3$G(B Cygwin$B$rMxMQ$9$k!"Ey$,9M$($i$l$^$9!#(B
-
-        -dumb
-                TELNET$B%*%W%7%g%s!&%M%4%7%(!<%7%g%s$r9T$$$^$;$s!#(B
-                $B$5$i$K(B TELNET$B%3%^%s%I$,Aw?.$5$l$F$-$F$bL5;k$7$^$9!#(B
-                $B%7%'%kB&$N4D6-JQ?t(B TERM $B$O(B 'dumb' $B$H$J$j$^$9!#(B
-
-        -s 'shell'
-                Cygwin$B>e$N%7%'%k$r;XDj$7$^$9!#(B
-                $B;XDj7A<0$O @ _Dj%U%!%$%k$N(B SHELL $B$HF1$8$G$9!#(B
-                $B6uGrJ8;z$r4^$`>l9g$OI,$:%/%)!<%H$G0O$_$^$9!#(B
-                $BI,$:$7$b%7%'%k%3%^%s%I$G$"$kI,MW$O$"$j$^$;$s!#(B
-
-        -ls
-                $B%7%'%k$r%m%0%$%s%7%'%k$H$7$F5/F0$7$^$9!#(B
-
-        -nols
-                $B%7%'%k$r(B($B%m%0%$%s%7%'%k$G$O$J$/(B)$BDL>o$N%7%'%k$H$7$F5/F0$7$^$9!#(B
-
-        -cd
-                $B%+%l%s%H%G%#%l%/%H%j$r%[!<%`%G%#%l%/%H%j$K0\F0$7$F$+$i(B
-                $B%7%'%k$r5/F0$7$^$9!#(B
-
-        -nocd
-                $B%+%l%s%H%G%#%l%/%H%j$r0\F0$;$:$K%7%'%k$r5/F0$7$^$9!#(B
-
-        -A
-                ssh$BG'>Z%(!<%8%'%s%HE>Aw5!G=$rM-8z$K$7$^$9!#(B
-
-        -a
-                ssh$BG'>Z%(!<%8%'%s%HE>Aw5!G=$rL58z$K$7$^$9!#(B
-
-        -v 'env-var'
-                $B%7%'%k5/F0;~$K @ _Dj$7$F$*$-$?$$4D6-JQ?t$r;XDj$7$^$9!#(B
-                $B;XDj7A<0$O @ _Dj%U%!%$%k$N(B ENV_X $B$HF1$8$G$9!#(B
-                $B6uGrJ8;z$r4^$`>l9g$OI,$:%/%)!<%H$G0O$_$^$9!#(B
-                -v $B%*%W%7%g%s$O$$$/$D$G$b;XDj$G$-$^$9!#(B
-
-        -d 'directory'
-                $B%+%l%s%H%G%#%l%/%H%j$r;XDj$5$l$?%G%#%l%/%H%j$K0\F0$7$F$+$i(B
-                $B%7%'%k$r5/F0$7$^$9!#(B
-
-        -o 'parameter'
-                $B%?!<%_%J%k!&%(%_%e%l!<%?$X$NDI2C$N%Q%i%a!<%?$r;XDj$7$^$9!#(B
-                TERM$B$rJQ$($:$KDI2C$N%Q%i%a!<%?$r;XDj$7$?$$;~$K;H$$$^$9!#(B
-
-    $B%?!<%_%J%k!&%(%_%e%l!<%?$b$7$/$O@\B3 @ h%]!<%HHV9f!"$H(B Cygwin$BB&%7%'%k$N(B
-    $B;XDj$,:GDcI,MW$H$J$j$^$9!#(B $B$3$l$i$,%3%^%s%I%i%$%s!&%*%W%7%g%s$K$h$C$F(B
-    $BM?$($i$l$k$J$i$P!"@_Dj%U%!%$%k(B cygterm.cfg $B$,L5$/$F$b<B9T$G$-$^$9!#(B
-
-    cygterm.exe $B$O(B cygwin1.dll $B$rMxMQ$9$k(B Win32$B%"%W%j%1!<%7%g%s$G$9!#(B
-    Cygwin$B>e$+$i<B9T$9$k$3$H$b!"(BWindows$B>e$N%7%g!<%H%+%C%H$+$i<B9T$9$k$3$H$b(B
-    $B$G$-$^$9!#(B
-
-    $B"((B Windows$B>e$+$i<B9T$9$k$K$O(B cygwin1.dll $B$N%G%#%l%/%H%j%Q%9$,(B
-       Windows$B4D6-JQ?t(B PATH $B$KDI2C$5$l$F$$$kI,MW$,$"$j$^$9!#(B
-       ($BDL>o(B Cygwin$B%k!<%H%G%#%l%/%H%j(B\bin)
-
-// $BCm(B $B0U(B $B;v(B $B9`(B //
-
-    * Tera Term$B;HMQ;~$NCm0U(B
-
-    $B%?!<%_%J%k!&%(%_%e%l!<%?$,(B Tera Term $B$N>l9g!"(Bcygterm.exe $B$+$i5/F0$5$l$?(B
-    $B>uBV$G @ _DjJ]B8(B [Setup][Save setup] $B$r9T$o$J$$$h$&Cm0U$7$F$/$@$5$$!#(B
-    TCP/IP$B @ _Dj$N(B Telnet$B%]!<%HHV9f$,(B 23 $B0J30$GJ]B8$5$l!"DL>o$N(B Telnet$BL\E*$N(B
-    $B<B9T;~$K@\B3$G$-$:!"92$F$k$3$H$K$J$C$F$7$^$$$^$9!#(B
-    TCP/IP Port# $B$K(B 23 $B$r;XDj$7$F @ _DjJ]B8$7D>$;$P85$KLa$j$^$9!#(B
-
-// $BF0(B $B:n(B $B3N(B $BG'(B //
-
-    2010$BG/(B 10$B7n8=:_!"0J2<$N4D6-$GF0:n$,3NG'$G$-$F$$$^$9!#(B
-
-        WindowsXP SP3 + Cygwin 1.5.25-15
-        WindowsXP SP3 + Cygwin 1.7.7
-
-        $B%?!<%_%J%k%(%_%e%l!<%?(B
-                Tera Term Pro 2.3
-                Tera Term 4.67
-                PuTTY 0.60
-        $B%7%'%k(B
-                bash 3.2.51
-                zsh 4.3.10
-
-// $BJQ(B $B99(B $BMz(B $BNr(B //
-v1.07_29 2016/11/26 (by maya)
-        * $B%"%$%3%s$rJQ99$7$?!#(B
-
-v1.07_28 2016/02/17 (by doda)
-        * $B%G%P%C%0%b!<%I$rDI2C$7$?!#(B
-
-v1.07_27 2016/02/09 (by doda)
-        * -cd $B%*%W%7%g%s(B(HOME_CHDIR=y) $B$h$j(B -d $B%*%W%7%g%s$G$N%G%#%l%/(B
-          $B%H%j;XDj$rM%@h$9$k$h$&$K$7$?!#(B
-        * -ls $B%*%W%7%g%s(B(LOGIN_SHELL=y) $B$N;XDj;~$K(B -d $B%*%W%7%g%s$r;XDj(B
-          $B$7$?>l9g!"(BCHERE_INVOKING=y $B$r%;%C%H$9$k$h$&$K$7$?!#(B
-
-v1.07_26 2015/12/14 (by doda)
-        * ssh $BG'>Z%(!<%8%'%s%HE>Aw$GJ#?t%3%M%/%7%g%s$KBP1~$7$?!#(B
-
-v1.07_25 2015/02/21 (by doda)
-        * TERM $B4D6-JQ?t$, @ 5$7$/@_Dj$5$l$k$h$&$K$7$?!#(B
-
-v1.07_24 2013/08/15 (by maya)
-        * 64bit Cygwin $B$G$bF0:n$9$k$h$&$K$7$?!#(B (cyglaunch)
-
-v1.07_23 2011/04/18 (by doda)
-        * -d $B%*%W%7%g%s$G;XDj$5$l$?%G%#%l%/%H%j$X$N0\F0$,<:GT$7$?;~!"(B
-	  $B%(%i!<%a%C%;!<%8$rI=<($9$k$h$&$K$7$?!#(B
-
-v1.07_22 2011/03/03 (by maya)
-        * $B%$%s%9%H!<%i$+$i5/F0%A%'%C%/$r$9$k$?$a$N(B mutex $B$r:o=|$7$?!#(B
-
-v1.07_21 2011/02/28 (by maya)
-        * $B%$%s%9%H!<%i$+$i5/F0%A%'%C%/$r$9$k$?$a$N(B mutex $B$rDI2C$7$?!#(B
-
-v1.07_20 2010/10/20 (by doda)
-        * '-d' $B%*%W%7%g%s$G$N%G%#%l%/%H%jJQ99$N%?%$%_%s%0$rCY$i$;$?!#(B
-	  (security fix)
-
-v1.07_19 2010/01/28 (by doda)
-        * '-s' $B%*%W%7%g%s$N0z?t$K(B 'AUTO' $B$r<u$1IU$1$k$h$&$K$7$?!#(B
-
-v1.07_18 2010/01/19 (by doda)
-        * '-d' $B%*%W%7%g%s$N0z?t$+$iFs=E0zMQId$r:o=|$9$k$h$&$K$7$?!#(B
-
-v1.07_17 2009/06/16 (by doda)
-        * TELNET SGA/ECHO$B%*%W%7%g%s$N%M%4%7%(!<%7%g%s$r9T$&$h$&$K$7$?!#(B
-
-v1.07_16 2008/11/21 (by doda)
-        * ssh $BG'>Z%(!<%8%'%s%HE>Aw5!G=$rM-8z$K$9$k%*%W%7%g%s$r(B '-a' $B$+$i(B
-          '-A' $B$KJQ99$7$?!#(B
-        * ssh $BG'>Z%(!<%8%'%s%HE>Aw5!G=$rL58z$K$9$k%*%W%7%g%s(B '-a' $B$rDI2C$7$?!#(B
-
-v1.07_15 2008/11/01 (by doda)
-        * ssh $BG'>Z%(!<%8%'%s%HE>Aw5!G=$r%5%]!<%H$7$?!#(B
-
-v1.07_14 2007/12/17 (by doda)
-        * $B%?!<%_%J%k!&%(%_%e%l!<%?$NDI2C$N%Q%i%a!<%?$r;XDj$9$k%*%W%7%g%s(B
-          '-o' $B$rDI2C$7$?!#(B
-
-v1.07_13 2007/08/03 (by maya)
-        * $B3+;O%G%#%l%/%H%j$r;XDj$9$k(B '-d' $B%*%W%7%g%s$rDI2C$7$?!#(B
-
-v1.07_12 2007/06/10 (by doda)
-        * telnet $B$NBT$A<u$1%=%1%C%H$N%?%$%`%"%&%H$r @ _Dj$9$k%*%W%7%g%s(B
-          SOCKET_TIMEOUT $B$rDI2C$7$?!#(B
-
-          SOCKET_TIMEOUT = $BIC?t(B
-
-v1.07_11 2007/01/31 (import from cygterm v1.07)
-        * gcc 3.4 $B$G$N(B WinMainCRTStartup() $B:FDj5A%(%i!<2sHr(B
-        * $BO"B3=PNO;~$G$b%-!<%\!<%I3d$j9~$_$,F~$k$h$&$K!#(B
-
-v1.06_11 2006/09/29 (by maya)
-        * $B4D6-JQ?t$H(B /etc/passwd $B$N(B HOME $B$r;H$o$J$$$h$&$K$7$?!#(B
-          Cygwin $B$K$h$C$F%;%C%H$5$l$?(B HOME $B$,MxMQ$5$l$k!#4XO"9`L\(B /etc/profile
-        * $B @ _Dj%U%!%$%k$NM%@h=g0L$rJQ99$7$?!#(B
-          $B%3%^%s%I%i%$%s0z?t(B > ~/.cygtermrc > /etc/cygterm.conf > cygterm.cfg
-          > /etc/passwd
-
-v1.06_10 2006/09/28 (by doda)
-        * $B%f!<%6L>$rF@$k$N$K!"4D6-JQ?t(B USERNAME $B$NBe$o$j$K(B getlogin() $B$r;H$&(B
-          $B$h$&$K$7$?!#(B
-
-v1.06_09 2006/09/25 (by doda)
-        * SHELL$B$, @ _Dj$5$l$F$$$J$$>l9g$O!"(B/etc/passwd $B$+$i%7%'%k$N>pJs$rF@$k(B
-          $B$h$&$K$7$?!#(B
-
-v1.06_08 2006/08/30 (by maya)
-        * cygterm.cfg $B$r @ _Dj%U%!%$%k$NCf$G:GM%@h$5$l$k$h$&$K$7$?!#(B
-
-v1.06_07 2006/08/19 (by maya)
-        * Windows $B$N(B $B4D6-JQ?t(B HOME $B$, @ _Dj$5$l$F$$$l$P;H$&$h$&$K$7$?!#(B
-
-v1.06_06 2006/08/18 (by doda)
-        * -s$B$H(B-t$B%*%W%7%g%s$N%Q%i%a!<%?$ND9$5$r@)8B$7$?!#(B
-
-v1.06_05 2006/08/18 (by maya)
-        * $B%$%s%9%H!<%i$+$i5/F0%A%'%C%/$r$9$k$?$a!"(Bmutex $B$r:n @ .$7$?!#(B
-
-v1.06_04 2006/08/15 (by doda)
-        * $B%7%'%k$r%m%0%$%s%7%'%k$H$7$F8F$S=P$9%*%W%7%g%s(B LOGIN_SHELL $B$r(B
-          $BDI2C$7$?!#(B
-
-          LOGIN_SHELL: yes | no
-
-v1.06_03 2006/08/15 (by doda)
-        * $B%[!<%`%G%#%l%/%H%j$G5/F0$9$k$N$rA*Br$9$k%*%W%7%g%s(B HOME_CHDIR $B$r(B
-          $BDI2C$7$?!#(B
-
-          HOME_CHDIR: yes | no
-
-v1.06_02 2006/02/09 (by babyd****@yahoo*****)
-        * CygTerm$B$N%"%$%3%s$,:n @ .$5$l$^$7$?!#!J(B"DotWork 2.50"$B$K$F:n @ .!K(B
-          "DotWork 2.50" $B$O1&5-$N(BURL$B$h$jF~<j2DG=$G$9!#(B
-          http://www5a.biglobe.ne.jp/~suuta/
-          $B$9$P$i$7$$%=%U%H%&%'%"$r8x3+$7$F$$$?$@$-!"(B
-          "suuta at hamal dot freemal dot ne dot jp"$B$K46<UCW$7$^$9!#(B
-
-        * Makefile $B$,=$@5$5$l$^$7$?!#(B"clean" $B%?!<%2%C%H$G(B cygterm.ico $B$r:o=|(B
-          $B$7$J$$$h$&$K!#(B
-
-v1.06_01 2006/02/08 (by babyd****@yahoo*****)
-        * $B0J2<$N @ _Dj%U%!%$%k$NFI$_9~$_$r%5%]!<%H(B:
-            + /etc/cygterm.conf
-            + ~/.cygtermrc
-
-        * $B%7%'%k$,%f!<%6$N%[!<%`%G%#%l%/%H%j$G5/F0$5$l$k$h$&$K!#(B
-
-        * $B%"%+%&%s%H$N @ _Dj>pJs$r(B /etc/passwd $B$+$i(B getpwnam(3) $B$GFI$_9~$`$h$&$K!#(B
-          $B%"%+%&%s%HL>$O4D6-JQ?t(B USERNAME $B$+$i(Bgetenv(3) $B$G<hF@$7$F$^$9!#(B
-
-        * Makefile $B=$@5!'%G%#%U%)%k%H$G%"%$%3%s$D$-$N(B .exe $B$r%S%k%I$7$^$9!#(B
-
-v1.06 2004/01/24
-        * $B%3%^%s%I%i%$%s!&%*%W%7%g%s$rDI2C!#(B
-            -t 'terminal-emulator' ($B%?!<%_%J%k!&%(%_%e%l!<%?;XDj(B)
-            -p port-number ($B@\B3 @ h%]!<%HHV9f;XDj(B)
-            -dumb ($B%@%`%?!<%_%J%k;XDj(B)
-            -s 'shell' ($B%7%'%k;XDj(B)
-            -v 'env-var' ($B4D6-JQ?t;XDj(B)
-
-        * Makefile$B=$@5(B
-          make install $B$G(B BINDIR $B$,B8:_$7$J$1$l$P%(%i!<$K$J$k$h$&$K!#(B
-
-        * $B%=!<%9%U%!%$%k1QJ82=(B (cygterm.cc, README.txt)
-
-v1.05 2003/01/14
-        * Ctrl+SPACE(NUL)$B$,Aw?.$G$-$k$h$&$K=$@5!#(B
-          $B2~9T%3!<%I(B CR+NUL $B$r=hM}$9$kJ}K!$H$7$FC1=c$K(B NUL$BJ8;z$rL5;k$7$F$$$?(B
-          $B$?$a!"(BCtrl+SPACE $B2!2<;~$G$b(B NUL $B$,Aw?.$5$l$J$+$C$?!#(B
-
-v1.04 2002/12/08
-        * $B%?!<%_%J%k!&%(%_%e%l!<%?$*$h$S%7%'%k$N5/F0$K<:GT$7$?$H$-$K(B
-          $B%(%i!<%a%C%;!<%8$rI=<($9$k$h$&$K$7$?!#(B
-
-        * Makefile$B=$@5(B
-          make install $B$G(B cygterm.cfg $B$r>e=q$-$7$J$$$h$&$K!#(B
-          gcc$B%*%W%7%g%s$K(B -fno-exceptions $B$rDI2C!"(BGCC-3$B$N%j%s%/%(%i!<2sHr!#(B
-
-v1.03 2002/07/24
-        * $B%?!<%_%J%k!&%(%_%e%l!<%?$,DLCN$7$F$/$k%?!<%_%J%k%?%$%W$K!"BgJ8;z$,(B
-          $B4^$^$l$F$$$l$P!"$=$l$r>.J8;z$KJQ49$9$k$h$&$K=$@5!#(B
-          $B%?!<%_%J%k!&%(%_%e%l!<%?$K$h$C$F$O4D6-JQ?t(B TERM $B$NCM$,(B 'ANSI' 'VT100'
-          $B$N$h$&$KBgJ8;z$K$j(B terminfo $B$K%^%C%A$7$J$$$?$a!#(B
-          (Windows 2000 telnet.exe $BEy(B)
-
-v1.02 2002/07/22
-        * $B%?!<%_%J%k!&%(%_%e%l!<%?$,%3%s%=!<%k!&%"%W%j%1!<%7%g%s$N$H$-$K5/F0(B
-          $B$G$-$J$+$C$?$N$r=$@5!#(B(Windows 2000 telnet.exe $BEy(B)
-          CreateProcess()$B8F=P$7%_%9!#(B
-
-        * $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i(B CR+LF $B$,Aw$i$l$F$-$?$i(B LF $B$OE>Aw$7$J$$(B
-          $B$h$&$K$7!"2~9T$,#22sH/@8$9$k$N$r=$@5!#(B(Windows 98 telnet.exe $BEy(B)
-
-        * $B%P!<%8%g%sHV9f$r(B cygterm.exe $B$KKd$a9~$`$h$&$K$7$?!#(B
-          $B3NG'J}K!$O(B $ strings cygterm.exe | grep version
-
-v1.01 2002/07/19
-        * zsh, tcsh $B$GF0:n$7$J$+$C$?$N$r=$@5!#5<;wC<Kv$N%*!<%W%sJ}K!$,0-$/!"(B
-          zsh, tcsh $B$G$O5/F0$H$H$b$KF~NO$,%V%m%C%/$5$l$?!#(B
-
-v1.00 2000/12/17
-        * $B=i4|%P!<%8%g%s40 @ .(B
-

Deleted: trunk/cygterm/cyglaunch.c
===================================================================
--- trunk/cygterm/cyglaunch.c	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/cygterm/cyglaunch.c	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,145 +0,0 @@
-//
-// Cygterm launcher
-//
-// (C) 2007- TeraTerm Project
-//   https://ttssh2.osdn.jp/
-//
-// [How to compile]
-// Cygwin:
-//  # cc -mno-cygwin -mwindows -o cyglaunch cyglaunch.c
-//
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <direct.h>
-
-#define Section "Tera Term"
-char *FName = "TERATERM.INI";
-
-
-//
-// Connect to local cygwin
-//
-void OnCygwinConnection(char *CygwinDirectory, char *cmdline)
-{
-	char file[MAX_PATH], *filename;
-	char c, *envptr, *envbuff;
-	int envbufflen;
-	char *exename = "cygterm.exe";
-	char cmd[1024];
-	STARTUPINFO si;
-	PROCESS_INFORMATION pi;
-
-	if (strlen(CygwinDirectory) > 0) {
-		if (SearchPath(CygwinDirectory, "bin\\cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
-			goto found_dll;
-		}
-	}
-
-	if (SearchPath(NULL, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
-		goto found_path;
-	}
-
-	for (c = 'C' ; c <= 'Z' ; c++) {
-		char tmp[MAX_PATH];
-		sprintf(tmp, "%c:\\cygwin\\bin;%c:\\cygwin64\\bin", c, c);
-		if (SearchPath(tmp, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
-			goto found_dll;
-		}
-	}
-
-	MessageBox(NULL, "Can't find Cygwin directory.", "ERROR", MB_OK | MB_ICONWARNING);
-	return;
-
-found_dll:;
-	envptr = getenv("PATH");
-	file[strlen(file)-12] = '\0'; // delete "\\cygwin1.dll"
-	if (envptr != NULL) {
-		envbufflen = strlen(file) + strlen(envptr) + 7; // "PATH="(5) + ";"(1) + NUL(1)
-		if ((envbuff=malloc(envbufflen)) == NULL) {
-			MessageBox(NULL, "Can't allocate memory.", "ERROR", MB_OK | MB_ICONWARNING);
-			return;
-		}
-		_snprintf(envbuff, envbufflen, "PATH=%s;%s", file, envptr);
-	} else {
-		envbufflen = strlen(file) + strlen(envptr) + 6; // "PATH="(5) + NUL(1)
-		if ((envbuff=malloc(envbufflen)) == NULL) {
-			MessageBox(NULL, "Can't allocate memory.", "ERROR", MB_OK | MB_ICONWARNING);
-			return;
-		}
-		_snprintf(envbuff, envbufflen, "PATH=%s", file);
-	}
-	_putenv(envbuff);
-	if (envbuff) {
-		free(envbuff);
-		envbuff = NULL;
-	}
-
-found_path:;
-	memset(&si, 0, sizeof(si));
-	GetStartupInfo(&si);
-	memset(&pi, 0, sizeof(pi));
-
-	strcpy(cmd, exename);
-	strcat(cmd, " ");
-	strncat(cmd, cmdline, sizeof(cmd)-strlen(cmd)-1);
-//printf("%s", cmd);
-//MessageBox(NULL, cmd, "", MB_OK);
-	if (CreateProcess(
-			NULL,
-			cmd,
-			NULL, NULL, FALSE, 0,
-			NULL, NULL,
-			&si, &pi) == 0) {
-		MessageBox(NULL, "Can't execute Cygterm.", "ERROR", MB_OK | MB_ICONWARNING);
-	}
-}
-
-
-int main(int argc, char** argv)
-{
-	char Temp[256], CygwinDir[256], Cmdline[256];
-	char *bs;
-	int i;
-	BOOL d_opt=FALSE;
-
-	if (GetModuleFileName(NULL, Temp, sizeof(Temp)) > 0 &&
-	   (bs = strrchr(Temp, '\\')) != NULL) {
-		*bs = 0;
-		_chdir(Temp);
-		_snprintf(bs, sizeof(Temp) + Temp - bs, "\\%s", FName);
-	}
-	else {
-		_snprintf(Temp, sizeof(Temp), ".\\", FName);
-	}
-
-	// Cygwin install path
- 	GetPrivateProfileString(Section, "CygwinDirectory", "c:\\cygwin",
-			  CygwinDir, sizeof(CygwinDir), Temp);
-
-	//printf("%s %d\n", CygwinDir, GetLastError());
-
-	Cmdline[0] = 0;
-	for (i=1; i<argc; i++) {
-		if (i != 1) {
-			strncat(Cmdline, " ", sizeof(Cmdline)-strlen(Cmdline)-1);
-		}
-		if (d_opt && strncmp("\"\\\\", argv[i], 3) == 0) {
-			argv[i][1] = '/';
-			argv[i][2] = '/';
-		}
-		strncat(Cmdline, argv[i], sizeof(Cmdline)-strlen(Cmdline)-1);
-		if (strcmp(argv[i], "-d") == 0) {
-			d_opt = TRUE;
-		}
-		else {
-			d_opt = FALSE;
-		}
-	}
-	//printf("%s\n", Cmdline);
-
-	OnCygwinConnection(CygwinDir, Cmdline);
-
-	return 0;
-}

Deleted: trunk/cygterm/cygterm+-x86_64/cygterm.exe
===================================================================
(Binary files differ)

Deleted: trunk/cygterm/cygterm.bmp
===================================================================
(Binary files differ)

Deleted: trunk/cygterm/cygterm.cc
===================================================================
--- trunk/cygterm/cygterm.cc	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/cygterm/cygterm.cc	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,1449 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// CygTerm+ - yet another Cygwin console
-// Copyright (C) 2000-2006 NSym.
-// (C) 2006-2016 TeraTerm Project
-//---------------------------------------------------------------------------
-// This program is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License (GPL) as published by
-// the Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-//---------------------------------------------------------------------------
-
-/////////////////////////////////////////////////////////////////////////////
-// CygTerm+ - yet another Cygwin console
-//
-//   Using Cygwin with a terminal emulator.
-//   
-//   Writtern by TeraTerm Project.
-//            https://ttssh2.osdn.jp/
-//   
-//   Original written by NSym.
-//                         *** Web Pages ***
-//  (English) http://www.dd.iij4u.or.jp/~nsym/cygwin/cygterm/index-e.html
-// (Japanese) http://www.dd.iij4u.or.jp/~nsym/cygwin/cygterm/index.html
-//
-
-static char Program[] = "CygTerm+";
-static char Version[] = "version 1.07_28 (2016/02/17)";
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <signal.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <termios.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sys/wait.h>
-#include <arpa/inet.h>
-#include <windows.h>
-#include <pwd.h>
-#include <sys/select.h>
-
-// pageant support (ssh-agent proxy)
-//----------------------------------
-#define AGENT_COPYDATA_ID 0x804e50ba
-#define AGENT_MAX_MSGLEN 8192
-char sockdir[] = "/tmp/ssh-XXXXXXXXXX";
-char sockname[256];
-
-// PTY device name
-//----------------
-#define  DEVPTY  "/dev/ptmx"
-
-// TCP port for TELNET
-//--------------------
-int port_start = 20000;  // default lowest port number
-int port_range = 40;     // default number of ports
-
-// command lines of a terminal-emulator and a shell
-//-------------------------------------------------
-char cmd_term[256] = "";
-char cmd_termopt[256] = "";
-char cmd_shell[128] = "";
-char pw_shell[128] = "";
-char change_dir[256] = "";
-
-// TCP port for connection to another terminal application
-//--------------------------------------------------------
-int cl_port = 0;
-
-// telnet socket timeout
-//----------------------
-int telsock_timeout = 5;    // timeout 5 sec
-
-// dumb terminal flag
-//-------------------
-bool dumb = false;
-
-// chdir to HOME
-//--------------
-bool home_chdir = false;
-
-// login shell flag
-//-----------------
-bool enable_loginshell = false;
-
-// ssh agent proxy
-//----------------
-bool enable_agent_proxy = false;
-
-// terminal type & size
-//---------------------
-char term_type[41] = "";
-struct winsize win_size = {0,0,0,0};
-
-// debug mode
-//-----------
-bool debug_flag = false;
-
-// additional env vars given to a shell
-//-------------------------------------
-struct sh_env_t {
-    struct sh_env_t* next;
-    char env[1];
-} sh_env = {NULL, ""};
-
-sh_env_t* sh_envp = &sh_env;
-
-int add_env(sh_env_t** envp, const char* str, const char* str2)
-{
-	int len;
-	sh_env_t* e;
-
-	len = strlen(str);
-	if (str2) {
-		len += strlen(str2) + 1;
-	}
-
-	e = (sh_env_t*)malloc(sizeof(sh_env_t) + len);
-	if (e) {
-		if (str2) {
-			snprintf(e->env, len + 1, "%s=%s", str, str2);
-		}
-		else {
-			strcpy(e->env, str);
-		}
-		e->next = NULL;
-		*envp = ((*envp)->next = e);
-		return 1;
-	}
-	else {
-		return 0;
-	}
-}
-
-//================//
-// message output //
-//----------------//
-void msg_print(const char* msg)
-{
-    MessageBox(NULL, msg, Program, MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
-}
-
-//=========================//
-// Win32-API error message //
-//-------------------------//
-void api_error(const char* string = NULL)
-{
-    char msg[1024];
-    char *ptr = msg;
-    if (string != NULL)
-        ptr += snprintf(ptr, sizeof(msg), "%s\n\n", string);
-    FormatMessage(
-        FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
-        NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-        ptr, sizeof(msg)-(ptr-msg), NULL
-    );
-    msg_print(msg);
-}
-
-//=========================//
-// C-runtime error message //
-//-------------------------//
-void c_error(const char* string = NULL)
-{
-    char msg[1024];
-    char *ptr = msg;
-    if (string != NULL)
-        ptr += snprintf(ptr, sizeof(msg), "%s\n\n", string);
-    snprintf(ptr, sizeof(msg)-(ptr-msg), "%s\n", strerror(errno));
-    msg_print(msg);
-}
-
-//======================//
-// debug message output //
-//======================//
-void debug_msg_print(const char* msg)
-{
-    if (debug_flag) {
-        msg_print(msg);
-    }
-}
-
-//==================================//
-// parse line in configuration file //
-//----------------------------------//
-void parse_cfg_line(char *buf)
-{
-    // "KEY = VALUE" format in each line.
-    // skip leading/trailing blanks. KEY is not case-sensitive.
-    char* p1;
-    for (p1 = buf; isspace(*p1); ++p1);
-    if (!isalpha(*p1)) {
-        return; // comment line with non-alphabet 1st char
-    }
-    char* name = p1;
-    for (++p1; isalnum(*p1) || *p1 == '_'; ++p1);
-    char* p2;
-    for (p2 = p1; isspace(*p2); ++p2);
-    if (*p2 != '=') {
-        return; // igonore line without '='
-    }
-    for (++p2; isspace(*p2); ++p2);
-    char* val = p2;
-    for (p2 += strlen(p2); isspace(*(p2-1)); --p2);
-    *p1 = *p2 = 0;
-
-    if (!strcasecmp(name, "TERM")) {
-        // terminal emulator command line (host:%s, port#:%d)
-        strncpy(cmd_term, val, sizeof(cmd_term)-1);
-        cmd_term[sizeof(cmd_term)-1] = 0;
-    }
-    else if (!strcasecmp(name, "SHELL")) {
-        // shell command line
-        if (strcasecmp(val, "AUTO") != 0) {
-            strncpy(cmd_shell, val, sizeof(cmd_shell)-1);
-        }
-	else {
-	    strncpy(cmd_shell, pw_shell, sizeof(cmd_shell)-1);
-	}
-	cmd_shell[sizeof(cmd_shell)-1] = 0;
-    }
-    else if (!strcasecmp(name, "PORT_START")) {
-        // minimum port# for TELNET
-        port_start = atoi(val);
-    }
-    else if (!strcasecmp(name, "PORT_RANGE")) {
-        // number of ports for TELNET
-        port_range = atoi(val);
-    }
-    else if (!strcasecmp(name, "TERM_TYPE")) {
-        // terminal type name (maybe overridden by TELNET negotiation.)
-        strncpy(term_type, val, sizeof(term_type)-1);
-        term_type[sizeof(term_type)-1] = 0;
-    }
-    else if (!strncasecmp(name, "ENV_", 4)) {
-        // additional env vars given to a shell
-	add_env(&sh_envp, val, NULL);
-    }
-    else if (!strcasecmp(name, "HOME_CHDIR")) {
-        // change directory to home
-        if (strchr("YyTt", *val) != NULL || atoi(val) > 0) {
-            home_chdir = true;
-        }
-    }
-    else if (!strcasecmp(name, "LOGIN_SHELL")) {
-        // execute a shell as a login shell
-        if (strchr("YyTt", *val) != NULL || atoi(val) > 0) {
-            enable_loginshell = true;
-        }
-    }
-    else if (!strcasecmp(name, "SOCKET_TIMEOUT")) {
-        // telnet socket timeout
-        telsock_timeout = atoi(val);
-    }
-    else if (!strcasecmp(name, "SSH_AGENT_PROXY")) {
-        // ssh-agent proxy
-        if (strchr("YyTt", *val) != NULL || atoi(val) > 0) {
-            enable_agent_proxy = true;
-        }
-    }
-    else if (!strcasecmp(name, "DEBUG")) {
-        // debug mode
-        if (strchr("YyTt", *val) != NULL || atoi(val) > 0) {
-            debug_flag = true;
-        }
-    }
-
-    return;
-}
-
-//====================//
-// load configuration //
-//--------------------//
-void load_cfg()
-{
-    // Windows system configuration file (.cfg) path
-    char win_conf[MAX_PATH];
-
-    // get cfg path from exe path
-    if (GetModuleFileName(NULL, win_conf, MAX_PATH) <= 0) {
-        return;
-    }
-    char* bs = strrchr(win_conf, '\\');
-    if (bs == NULL) {
-        return;
-    }
-    char* dot = strrchr(bs, '.');
-    if (dot == NULL) {
-        strcat(bs, ".cfg");
-    } else {
-        strcpy(dot, ".cfg");
-    }
-
-    char sys_conf[] = "/etc/cygterm.conf";
-
-    // user configuration file (~/.*rc) path
-    char usr_conf[MAX_PATH] = "";
-
-    // auto generated configuration file path
-    char tmp_conf[MAX_PATH] = "/tmp/cygtermrc.XXXXXX";
-
-    // get user name from getlogin().  if it fails, use $USERNAME instead.
-    // and get /etc/passwd information by getpwnam(3) with user name,
-    // and generate temporary configuration file by mktemp(3).
-    const char* username = getlogin();
-    if (username == NULL)
-        username = getenv("USERNAME");
-    if (username != NULL) {
-        struct passwd* pw_ent = getpwnam(username);
-        if (pw_ent != NULL) {
-	    strncpy(pw_shell, pw_ent->pw_shell, sizeof(pw_shell)-1);
-	    pw_shell[sizeof(pw_shell)-1] = 0;
-
-            strcpy(usr_conf, pw_ent->pw_dir);
-            strcat(usr_conf, "/.");
-            strcat(usr_conf, bs + 1);
-            char* dot = strrchr(usr_conf, '.');
-            if (dot == NULL) {
-                strcat(bs, "rc");
-            } else {
-                strcpy(dot, "rc");
-            }
-        }
-        int fd = mkstemp(tmp_conf);
-        FILE* fp = fdopen(fd, "w");
-        if (fp != NULL) {
-            if (pw_ent != NULL) {
-                fprintf(fp, "ENV_1=USER=%s\n",  pw_ent->pw_name);
-                fprintf(fp, "ENV_2=SHELL=%s\n", pw_ent->pw_shell);
-                fprintf(fp, "SHELL=%s\n", pw_ent->pw_shell);
-            } else {
-                fprintf(fp, "ENV_1=USER=%s\n",       username);
-            }
-            fclose(fp);
-        }
-    }
-
-    if (strcmp(usr_conf, "") == 0) {
-        strcpy(usr_conf, "");
-        strcpy(tmp_conf, "");
-    }
-
-    char *conf_path[] = { tmp_conf, win_conf, sys_conf, usr_conf };
-    for (int i = 0; i < 4; i++) {
-        // ignore empty configuration file path
-        if (strcmp(conf_path[i], "") == 0) {
-            continue;
-        }
-        // read each setting parameter
-        FILE* fp;
-        if ((fp = fopen(conf_path[i], "r")) == NULL) {
-            continue;
-        }
-        char buf[BUFSIZ];
-        while (fgets(buf, sizeof(buf), fp) != NULL) {
-            parse_cfg_line(buf);
-        }
-        fclose(fp);
-    }
-
-    // remove temporary configuration file, if it was generated.
-    if (strcmp(tmp_conf, "") != 0) {
-        unlink(tmp_conf);
-    }
-}
-
-void quote_cut(char *dst, size_t len, char *src) {
-	while (*src && len > 1) {
-		if (*src != '"') {
-			*dst++ = *src;
-		}
-		src++;
-	}
-	*dst = 0;
-}
-
-//=======================//
-// commandline arguments //
-//-----------------------//
-void get_args(int argc, char** argv)
-{
-    char tmp[sizeof(cmd_termopt)];
-
-    for (++argv; *argv != NULL; ++argv) {
-        if (!strcmp(*argv, "-t")) {             // -t <terminal emulator>
-            if (*++argv == NULL)
-                break;
-            strncpy(cmd_term, *argv, sizeof(cmd_term)-1);
-            cmd_term[sizeof(cmd_term)-1] = '\0';
-        }
-        else if (!strcmp(*argv, "-p")) {        // -p <port#>
-            if (*(argv+1) != NULL) {
-                ++argv, cl_port = atoi(*argv);
-            }
-        }
-        else if (!strcmp(*argv, "-dumb")) {     // -dumb
-            dumb = true;
-            strcpy(term_type, "dumb");
-        }
-        else if (!strcmp(*argv, "-s")) {        // -s <shell>
-            if (*++argv == NULL)
-                break;
-	    if (strcasecmp(*argv, "AUTO") != 0) {
-		strncpy(cmd_shell, *argv, sizeof(cmd_shell)-1);
-	    }
-	    else {
-		strncpy(cmd_shell, pw_shell, sizeof(cmd_shell)-1);
-	    }
-            cmd_shell[sizeof(cmd_shell)-1] = '\0';
-        }
-        else if (!strcmp(*argv, "-cd")) {       // -cd
-            home_chdir = true;
-        }
-        else if (!strcmp(*argv, "-nocd")) {     // -nocd
-            home_chdir = false;
-        }
-        else if (!strcmp(*argv, "+cd")) {       // +cd
-            home_chdir = false;
-        }
-        else if (!strcmp(*argv, "-ls")) {       // -ls
-            enable_loginshell = true;
-        }
-        else if (!strcmp(*argv, "-nols")) {     // -nols
-            enable_loginshell = false;
-        }
-        else if (!strcmp(*argv, "+ls")) {       // +ls
-            enable_loginshell = false;
-        }
-        else if (!strcmp(*argv, "-A")) {       // -A
-            enable_agent_proxy = true;
-        }
-        else if (!strcmp(*argv, "-a")) {       // -a
-            enable_agent_proxy = false;
-        }
-        else if (!strcmp(*argv, "-v")) {        // -v <additional env var>
-            if (*(argv+1) != NULL) {
-                ++argv;
-		add_env(&sh_envp, *argv, NULL);
-            }
-        }
-        else if (!strcmp(*argv, "-d")) {        // -d <exec directory>
-            if (*++argv == NULL)
-                break;
-            quote_cut(change_dir, sizeof(change_dir), *argv);
-        }
-        else if (!strcmp(*argv, "-o")) {        // -o <additional option for terminal>
-            if (*++argv == NULL)
-                break;
-            if (cmd_termopt[0] == '\0') {
-                strncpy(cmd_termopt, *argv, sizeof(cmd_termopt)-1);
-                cmd_termopt[sizeof(cmd_termopt)-1] = '\0';
-            }
-            else {
-                snprintf(tmp, sizeof(tmp), "%s %s", cmd_termopt, *argv);
-                strncpy(cmd_termopt, tmp, sizeof(cmd_termopt)-1);
-                cmd_termopt[sizeof(cmd_termopt)-1] = '\0';
-            }
-        }
-        else if (!strcmp(*argv, "-debug")) {    // -debug
-            debug_flag = true;
-        }
-    }
-}
-
-//===================================//
-// pageant support (ssh-agent proxy) //
-//-----------------------------------//
-unsigned long get_uint32(unsigned char *buff)
-{
-	return ((unsigned long)buff[0] << 24) +
-	       ((unsigned long)buff[1] << 16) +
-	       ((unsigned long)buff[2] <<  8) +
-	       ((unsigned long)buff[3]);
-}
-
-void set_uint32(unsigned char *buff, unsigned long v)
-{
-	buff[0] = (unsigned char)(v >> 24);
-	buff[1] = (unsigned char)(v >> 16);
-	buff[2] = (unsigned char)(v >>  8);
-	buff[3] = (unsigned char)v;
-	return;
-}
-
-unsigned long agent_request(unsigned char *out, unsigned long out_size, unsigned char *in)
-{
-	HWND hwnd;
-	char mapname[25];
-	HANDLE fmap = NULL;
-	unsigned char *p = NULL;
-	COPYDATASTRUCT cds;
-	unsigned long len;
-	unsigned long ret = 0;
-
-	if (out_size < 5) {
-		return 0;
-	}
-	if ((len = get_uint32(in)) > AGENT_MAX_MSGLEN) {
-		goto agent_error;
-	}
-
-	hwnd = FindWindow("Pageant", "Pageant");
-	if (!hwnd) {
-		goto agent_error;
-	}
-
-	sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId());
-	fmap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
-	                         0, AGENT_MAX_MSGLEN, mapname);
-	if (!fmap) {
-		goto agent_error;
-	}
-
-	if ((p = (unsigned char *)MapViewOfFile(fmap, FILE_MAP_WRITE, 0, 0, 0)) == NULL) {
-		goto agent_error;
-	}
-
-	cds.dwData = AGENT_COPYDATA_ID;
-	cds.cbData = strlen(mapname) + 1;
-	cds.lpData = mapname;
-
-	memcpy(p, in, len + 4);
-	if (SendMessage(hwnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cds) > 0) {
-		len = get_uint32(p);
-		if (out_size >= len + 4) {
-			memcpy(out, p, len + 4);
-			ret = len + 4;
-		}
-	}
-
-agent_error:
-	if (p) {
-		UnmapViewOfFile(p);
-	}
-	if (fmap) {
-		CloseHandle(fmap);
-	}
-	if (ret == 0) {
-		set_uint32(out, 1);
-		out[4] = 5; // SSH_AGENT_FAILURE
-	}
-
-	return ret;
-}
-
-void sighandler(int sig) {
-	unlink(sockname);
-	rmdir(sockdir);
-	exit(0);
-};
-
-struct connList {
-	int sock;
-	int recvlen;
-	int sendlen;
-	struct connList *next;
-	unsigned char ibuff[AGENT_MAX_MSGLEN];
-	unsigned char obuff[AGENT_MAX_MSGLEN];
-};
-
-int proc_recvd(struct connList *conn)
-{
-	int reqlen, len;
-
-	if (conn->sendlen > 0) {
-		return 0;
-	}
-
-	if (conn->recvlen < 4) {
-		return 0;
-	}
-
-	reqlen = get_uint32(conn->ibuff) + 4;
-	if (conn->recvlen < reqlen) {
-		return 0;
-	}
-
-	len = agent_request(conn->obuff, sizeof(conn->obuff), conn->ibuff);
-
-	if (len > 0) {
-		conn->sendlen = len;
-	}
-	else {
-		set_uint32(conn->obuff, 1);
-		conn->obuff[4] = 5; // SSH_AGENT_FAILURE
-		conn->sendlen = 1;
-	}
-
-	if (conn->recvlen == reqlen) {
-		conn->recvlen = 0;
-	}
-	else {
-		conn->recvlen -= reqlen;
-		memmove(conn->ibuff, conn->ibuff + reqlen, conn->recvlen);
-	}
-
-	return 1;
-}
-
-void agent_proxy()
-{
-	int sock, asock, ret;
-	long len;
-	unsigned long reqlen;
-	struct sockaddr_un addr;
-	unsigned char tmpbuff[AGENT_MAX_MSGLEN];
-	struct connList connections, *new_conn, *prev, *cur;
-	fd_set readfds, writefds, rfds, wfds;
-	struct sigaction act;
-	sigset_t blk;
-
-	connections.next = NULL;
-
-	if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
-		c_error("agent_proxy: socket failed.");
-		exit(0);
-	}
-	memset(&addr, 0, sizeof(addr));
-	addr.sun_family = AF_UNIX;
-	strlcpy(addr.sun_path, sockname, sizeof(addr.sun_path));
-
-	if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-		goto agent_thread_cleanup;
-	}
-	if (listen(sock, -1) < 0) {
-		goto agent_thread_cleanup;
-	}
-
-	sigfillset(&blk);
-	sigdelset(&blk, SIGKILL);
-	sigdelset(&blk, SIGSTOP);
-
-	memset(&act, 0, sizeof(act));
-	act.sa_handler = sighandler;
-	act.sa_mask = blk;
-	sigaction(SIGINT, &act, NULL);
-	sigaction(SIGTERM, &act, NULL);
-	sigaction(SIGHUP, &act, NULL);
-	sigaction(SIGQUIT, &act, NULL);
-
-	FD_ZERO(&readfds);
-	FD_ZERO(&writefds);
-	FD_SET(sock, &readfds);
-
-	while (1) {
-		memcpy(&rfds, &readfds, sizeof(fd_set));
-		memcpy(&wfds, &writefds, sizeof(fd_set));
-
-		select(FD_SETSIZE, &rfds, &wfds, NULL, NULL);
-
-		if (FD_ISSET(sock, &rfds)) {
-			asock = accept(sock, NULL, NULL);
-			if (asock < 0) {
-				if (!(errno == EINTR || errno == ECONNABORTED)) {
-					break;
-				}
-			}
-			else {
-				new_conn = (struct connList *)malloc(sizeof(struct connList));
-				if (new_conn == NULL) {
-					// no memory
-					close(sock);
-				}
-				else {
-					new_conn->sock = asock;
-					new_conn->recvlen = 0;
-					new_conn->sendlen = 0;
-					new_conn->next = connections.next;
-					connections.next = new_conn;
-					FD_SET(asock, &readfds);
-				}
-			}
-		}
-
-		prev = &connections;
-		for (cur=connections.next; cur != NULL; cur = cur->next) {
-			if (FD_ISSET(cur->sock, &wfds)) {
-				if (cur->sendlen > 0) {
-					len = send(cur->sock, cur->obuff, cur->sendlen, 0);
-					if (len < 0) {
-						// write error
-						prev->next = cur->next;
-						shutdown(cur->sock, SHUT_RDWR);
-						close(cur->sock);
-						FD_CLR(cur->sock, &writefds);
-						FD_CLR(cur->sock, &readfds);
-						free(cur);
-						cur = prev;
-						continue;
-					}
-					else if (len >= cur->sendlen) {
-						cur->sendlen = 0;
-
-						sigprocmask(SIG_BLOCK, &blk, NULL);
-						ret = proc_recvd(cur);
-						sigprocmask(SIG_UNBLOCK, &blk, NULL);
-
-						if (ret) {
-							FD_SET(cur->sock, &writefds);
-							FD_CLR(cur->sock, &readfds);
-						}
-						else {
-							FD_CLR(cur->sock, &writefds);
-							FD_SET(cur->sock, &readfds);
-						}
-					}
-					else if (len > 0) {
-						cur->sendlen -= len;
-						memmove(cur->obuff, cur->obuff+len, cur->sendlen);
-					}
-				}
-				else {
-					FD_CLR(cur->sock, &writefds);
-				}
-			}
-
-			if (FD_ISSET(cur->sock, &rfds)) {
-				len = recv(cur->sock, cur->ibuff + cur->recvlen, sizeof(cur->ibuff) - cur->recvlen, 0);
-				if (len > 0) {
-					cur->recvlen += len;
-
-					sigprocmask(SIG_BLOCK, &blk, NULL);
-					ret = proc_recvd(cur);
-					sigprocmask(SIG_UNBLOCK, &blk, NULL);
-
-					if (ret) {
-						FD_SET(cur->sock, &writefds);
-						FD_CLR(cur->sock, &readfds);
-					}
-					else {
-						FD_CLR(cur->sock, &writefds);
-						FD_SET(cur->sock, &readfds);
-					}
-				}
-				else if (len <= 0) {
-					// read error
-					prev->next = cur->next;
-					shutdown(cur->sock, SHUT_RDWR);
-					close(cur->sock);
-					FD_CLR(cur->sock, &readfds);
-					FD_CLR(cur->sock, &writefds);
-					free(cur);
-					cur = prev;
-					continue;
-				}
-			}
-		}
-	}
-
-agent_thread_cleanup:
-	shutdown(sock, SHUT_RDWR);
-	close(sock);
-
-	unlink(sockname);
-	rmdir(sockdir);
-
-	exit(0);
-}
-
-int exec_agent_proxy()
-{
-	int pid;
-	int malloc_size;
-
-	if (mkdtemp(sockdir) == NULL) {
-		return -1;
-	}
-	snprintf(sockname, sizeof(sockname), "%s/agent.%ld", sockdir, getpid());
-
-	if (!add_env(&sh_envp, "SSH_AUTH_SOCK", sockname)) {
-		return -1;
-	}
-
-	if ((pid = fork()) < 0) {
-		return -1;
-	}
-	if (pid == 0) {
-		setsid();
-		agent_proxy();
-	}
-	return pid;
-}
-
-//=============================//
-// terminal emulator execution //
-//-----------------------------//
-DWORD WINAPI term_thread(LPVOID)
-{
-    STARTUPINFO si;
-    PROCESS_INFORMATION pi;
-    FillMemory(&si, sizeof(si), 0);
-    si.cb = sizeof(si);
-    si.dwFlags = STARTF_USESHOWWINDOW;
-    si.wShowWindow = SW_SHOW;
-    DWORD flag = 0;
-    if (!CreateProcess(
-         NULL, cmd_term, NULL, NULL, FALSE, flag, NULL, NULL, &si, &pi))
-    {
-        api_error(cmd_term);
-        return 0;
-    }
-    WaitForSingleObject(pi.hProcess, INFINITE);
-    CloseHandle(pi.hProcess);
-    CloseHandle(pi.hThread);
-    return 0;
-}
-
-//============================-==========//
-// thread creation for terminal emulator //
-//---------------------------------------//
-HANDLE exec_term()
-{
-    DWORD id;
-    return CreateThread(NULL, 0, term_thread, NULL, 0, &id);
-}
-
-//=======================================//
-// listener socket for TELNET connection //
-//---------------------------------------//
-int listen_telnet(u_short* port)
-{
-    int lsock;
-    if ((lsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-        return -1;
-    }
-    struct sockaddr_in addr;
-    addr.sin_family = AF_INET;
-    addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-    int i;
-    for (i = 0; i < port_range; ++i) { // find an unused port#
-        addr.sin_port = htons(port_start + i);
-        if (bind(lsock, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
-            break;
-        }
-    }
-    if (i == port_range) {
-        shutdown(lsock, 2);
-        close(lsock);
-        return -1;
-    }
-    if (listen(lsock, 1) != 0) {
-        shutdown(lsock, 2);
-        close(lsock);
-        return -1;
-    }
-    *port = addr.sin_port;
-    return lsock;
-}
-
-//=============================//
-// accept of TELNET connection //
-//-----------------------------//
-int accept_telnet(int lsock)
-{
-    fd_set rbits;
-    FD_ZERO(&rbits);
-    FD_SET(lsock, &rbits);
-    struct timeval tm;
-    tm.tv_sec = telsock_timeout;
-    tm.tv_usec = 0;
-    if (select(FD_SETSIZE, &rbits, 0, 0, &tm) <= 0) {
-        c_error("accept_telnet: select failed");
-        return -1;
-    }
-    if (!FD_ISSET(lsock, &rbits)) {
-        c_error("accept_telnet: FD_ISSET failed");
-        return -1;
-    }
-    int asock;
-    struct sockaddr_in addr;
-    int len = sizeof(addr);
-    if ((asock = accept(lsock, (struct sockaddr *)&addr, &len)) < 0) {
-        c_error("accept_telnet: accept failed");
-        return -1;
-    }
-    if (getpeername(asock, (struct sockaddr *)&addr, &len) != 0) {
-        c_error("accept_telnet: getpeername failed");
-        shutdown(asock, 2);
-        close(asock);
-        return -1;
-    }
-    if (addr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) {
-        // reject it except local connection
-        msg_print("not local connection");
-        shutdown(asock, 2);
-        close(asock);
-        return -1;
-    }
-    return asock;
-}
-
-//============================//
-// connect to specified port# //
-//----------------------------//
-int connect_client()
-{
-    int csock;
-    if ((csock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
-        return -1;
-    }
-    struct sockaddr_in addr;
-    addr.sin_family = AF_INET;
-    addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
-    addr.sin_port = htons(cl_port);
-    if (connect(csock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
-        close(csock);
-        return -1;
-    }
-    return csock;
-}
-
-//========================================//
-// setup *argv[] from a string for exec() //
-//----------------------------------------//
-void get_argv(char **argv, int maxc, char *s)
-{
-    int esc, sq, dq;  // recognize (\) (') (") and tokenize
-    int c, argc;
-    char *p;
-    esc = sq = dq = 0;
-    for (argc = 0; argc < maxc-1; ++argc) {
-        for ( ; isascii(*s) && isspace(*s); ++s);
-        if (*s == 0) {
-            break;
-        }
-        argv[argc] = p = s;
-        while ((c = *s) != 0) {
-            ++s;
-            if (isspace(c) && !esc && !sq && !dq) {
-                break;
-            }
-            if (c == '\'' && !esc && !dq) {
-                sq ^= 1;
-            } else if (c == '"' && !esc && !sq) {
-                dq ^= 1;
-            } else if (c == '\\' && !esc) {
-                esc = 1;
-            } else {
-                esc = 0;
-                *p++ = c;
-            }
-        }
-        *p = 0;
-    }
-    // not to judge syntax errors
-    // if (dq || sq || esc) { syntax error }
-    // if (argc == maxc) { overflow }
-    argv[argc] = NULL;
-}
-
-//=================//
-// shell execution //
-//-----------------//
-int exec_shell(int* sh_pid)
-{
-    char env_term[64];
-    // open pty master
-    int master;
-    if ((master = open(DEVPTY, O_RDWR)) < 0) {
-        c_error("exec_shell: master pty open error");
-        return -1;
-    }
-    int pid;
-    if ((pid = fork()) < 0) {
-        c_error("exec_shell: fork failed");
-        return -1;
-    }
-    if (pid == 0) {
-        // detach from control tty
-        setsid();
-        // open pty slave
-        int slave;
-        if ((slave = open(ptsname(master), O_RDWR)) < 0) {
-            c_error("exec_shell: slave pty open error");
-            exit(0);
-        }
-        // stdio redirection
-        while (slave <= 2) {
-            if ((slave = dup(slave)) < 0) {
-                exit(0);
-            }
-        }
-        int fd;
-        for (fd = 0; fd < 3; ++fd) {
-            close(fd);
-            dup(slave);
-            fcntl(fd, F_SETFD, 0);
-        }
-        for (fd = 3; fd < getdtablesize(); ++fd) {
-            if (fcntl(fd, F_GETFD) == 0) {
-                close(fd);
-            }
-        }
-        // set env vars
-        if (*term_type != 0) {
-            // set terminal type to $TERM
-            sprintf(env_term, "TERM=%s", term_type);
-            putenv(env_term);
-        }
-        // set other additional env vars
-        sh_env_t* e;
-        for (e = sh_env.next; e != NULL; e = e->next) {
-            putenv(e->env);
-        }
-	// change directory
-        if (change_dir[0] != 0) {
-	    if (chdir(change_dir) < 0) {
-		char tmp[256];
-		snprintf(tmp, 256, "exec_shell: Can't chdir to \"%s\".", change_dir);
-		tmp[255] = 0;
-		c_error(tmp);
-	    }
-        }
-        else if (home_chdir) {
-            // chdir to home directory
-            const char *home_dir = getenv("HOME");
-            // ignore chdir(2) system-call error.
-            chdir(home_dir);
-        }
-        // execute a shell
-        char *argv[32];
-        get_argv(argv, 32, cmd_shell);
-        if (enable_loginshell) {
-                char shell_path[128];
-                char *pos;
-                strcpy(shell_path, argv[0]);
-                if ((pos = strrchr(argv[0], '/')) != NULL) {
-                        *pos = '-';
-                        argv[0] = pos;
-                }
-                debug_msg_print(shell_path);
-                execv(shell_path, argv);
-        }
-        else {
-                debug_msg_print(argv[0]);
-                execv(argv[0], argv);
-        }
-        // no error, exec() doesn't return
-        c_error(argv[0]);
-        exit(0);
-    }
-    *sh_pid = pid;
-    return master;
-}
-
-//==================//
-// i/o buffer class //
-//------------------//
-class IOBuf
-{
-private:
-    int fd;
-    u_char i_buf[4096];
-    u_char o_buf[4096];
-    int i_pos, i_len, o_pos;
-public:
-    IOBuf(int channel) : fd(channel), i_pos(0), i_len(0), o_pos(0) {}
-    operator int() { return fd; }
-    void ungetc() { --i_pos; }
-    bool flush_in();
-    bool getc(u_char*);
-    bool nextc(u_char*);
-    bool putc(u_char);
-    bool flush_out();
-};
-
-// read bytes into input buffer
-//-----------------------------
-bool IOBuf::flush_in()
-{
-    if ((i_len = read(fd, i_buf, sizeof(i_buf))) <= 0)
-        return false;
-    i_pos = 0;
-    return true;
-}
-
-// get 1 char from input buffer
-//-----------------------------
-inline bool IOBuf::getc(u_char* c)
-{
-    if (i_pos == i_len) return false;
-    *c = i_buf[i_pos++];
-    return true;
-}
-
-// get next 1 char from input buffer
-//----------------------------------
-inline bool IOBuf::nextc(u_char* c)
-{
-    if (i_pos == i_len)
-        if (!flush_in()) return false;
-    *c = i_buf[i_pos++];
-    return true;
-}
-
-// put 1 char to output buffer
-//----------------------------
-inline bool IOBuf::putc(u_char c)
-{
-    if (o_pos == sizeof(o_buf))
-        if (!flush_out()) return false;
-    o_buf[o_pos++] = c;
-    return true;
-}
-
-// write bytes from output buffer
-//-------------------------------
-bool IOBuf::flush_out()
-{
-    int n;
-    for (int i = 0; i < o_pos; i += n) {
-        if ((n = write(fd, o_buf+i, o_pos-i)) <= 0) return false;
-    }
-    o_pos = 0;
-    return true;
-}
-
-//=========================//
-// TELNET command handling //  (see RFC854 TELNET PROTOCOL SPECIFICATION)
-//-------------------------//
-enum { nIAC=255, nWILL=251, nWONT=252, nDO=253, nDONT=254 };
-enum { sSEND=1, sIS=0, sSB=250, sSE=240 };
-enum { oECHO=1, oSGA=3, oTERM=24, oNAWS=31 };
-
-bool c_will_term = false;
-bool c_will_naws = false;
-
-u_char telnet_cmd(IOBuf* te)
-{
-    u_char cmd, c;
-    te->nextc(&cmd);
-    if (cmd == sSB) {
-        te->nextc(&c);
-        // accept terminal type request
-        if (c == oTERM) {                      // "SB TERM
-            te->nextc(&c);                     //     IS
-            u_char* p = (u_char*)term_type;
-            te->nextc(p);                      //     TERMINAL-TYPE
-            while (*p != nIAC) {
-                if (isupper(*p)) *p = _tolower(*p);
-                ++p; te->nextc(p);
-            }
-            *p = 0;
-            te->nextc(&c);                     //     IAC SE"
-            return (u_char)oTERM;
-        }
-        // accept terminal size request
-        if (c == oNAWS) {                      // "SB NAWS
-            u_short col, row;
-            te->nextc((u_char*)&col);
-            te->nextc((u_char*)&col+1);        //     00 00 (cols)
-            te->nextc((u_char*)&row);
-            te->nextc((u_char*)&row+1);        //     00 00 (rows)
-            te->nextc(&c);
-            te->nextc(&c);                     //     TAC SE"
-            win_size.ws_col = ntohs(col);
-            win_size.ws_row = ntohs(row);
-            return (u_char)oNAWS;
-        }
-        while (c != nIAC) te->nextc(&c);       // "... IAC SE"
-        te->nextc(&c);
-    }
-    else if (cmd == nWILL || cmd == nWONT || cmd == nDO || cmd == nDONT) {
-        u_char c;
-        te->nextc(&c);
-        if (cmd == nWILL && c == oTERM)        // "WILL TERM"
-            c_will_term = true;
-        else if (cmd == nWILL && c == oNAWS)   // "WILL NAWS"
-            c_will_naws = true;
-    }
-    return cmd;
-}
-
-//============================//
-// TELNET initial negotiation //
-//----------------------------//
-void telnet_nego(int te_sock)
-{
-    IOBuf te = te_sock;
-    u_char c;
-
-    // start terminal type negotiation
-    // IAC DO TERMINAL-TYPE
-    te.putc(nIAC); te.putc(nDO); te.putc(oTERM);
-    te.flush_out();
-    te.nextc(&c);
-    if (c != nIAC) {
-        te.ungetc();
-        return;
-    }
-    (void)telnet_cmd(&te);
-    if (c_will_term) {
-        // terminal type sub-negotiation
-        // IAC SB TERMINAL-TYPE SEND IAC SE
-        te.putc(nIAC); te.putc(sSB); te.putc(oTERM);
-        te.putc(sSEND); te.putc(nIAC); te.putc(sSE);
-        te.flush_out();
-        // accept terminal type response
-        te.nextc(&c);
-        if (c != nIAC) {
-            te.ungetc();
-            return;
-        }
-        (void)telnet_cmd(&te);
-    }
-
-    // start terminal size negotiation
-    // IAC DO WINDOW-SIZE
-    te.putc(nIAC); te.putc(nDO); te.putc(oNAWS);
-    te.flush_out();
-    te.nextc(&c);
-    if (c != nIAC) {
-        te.ungetc();
-        return;
-    }
-    (void)telnet_cmd(&te);
-    if (c_will_naws) {
-        // accept terminal size response
-        te.nextc(&c);
-        if (c != nIAC) {
-            te.ungetc();
-            return;
-        }
-        (void)telnet_cmd(&te);
-    }
-
-    // SGA/ECHO
-    te.putc(nIAC); te.putc(nWILL); te.putc(oSGA);
-    te.putc(nIAC); te.putc(nDO); te.putc(oSGA);
-    te.putc(nIAC); te.putc(nWILL); te.putc(oECHO);
-    te.flush_out();
-}
-
-//=============================================//
-// relaying of a terminal emulator and a shell //
-//---------------------------------------------//
-void telnet_session(int te_sock, int sh_pty)
-{
-    IOBuf te = te_sock;
-    IOBuf sh = sh_pty;
-    fd_set rtmp, rbits;
-    FD_ZERO(&rtmp);
-    FD_SET(te, &rtmp);
-    FD_SET(sh, &rtmp);
-    u_char c;
-    int cr = 0;
-    int cnt = 0;
-    for (;;) {
-        rbits = rtmp;
-        if (select(FD_SETSIZE, &rbits, 0, 0, 0) <= 0) {
-            break;
-        }
-        if (FD_ISSET(sh, &rbits)) {
-            // send data from a shell to a terminal
-            if (sh.flush_in() == false) {
-                break;
-            }
-            while (sh.getc(&c) == true) {
-                if (c == nIAC) {
-                    // escape a TELNET IAC char
-                    te.putc(c);
-                }
-                te.putc(c);
-            }
-            if (te.flush_out() == false) {
-                break;
-            }
-            if (cnt++ < 20) {
-                continue;  // give priority to data from a shell
-            }
-            cnt = 0;
-        }
-        if (FD_ISSET(te, &rbits)) {
-            // send data from a terminal to a shell
-            if (te.flush_in() == false) {
-                break;
-            }
-            while (te.getc(&c) == true) {
-                if (c == nIAC && !dumb) {
-                    u_char cmd = telnet_cmd(&te) ;
-                    if (cmd == oNAWS) {
-                        // resize pty by terminal size change notice
-                        ioctl(sh_pty, TIOCSWINSZ, &win_size);
-                        continue;
-                    }
-                    if (cmd != nIAC) {
-                        continue;
-                    }
-                } else if (c == '\r') {
-                    cr = 1;
-                } else if (c == '\n' || c == '\0') {
-                    if (cr) {  // do not send LF or NUL just after CR
-                        cr = 0;
-                        continue;
-                    }
-                } else {
-                    cr = 0;
-                }
-                sh.putc(c);
-            }
-            if (sh.flush_out() == false) {
-                break;
-            }
-        }
-    }
-}
-
-//=========================================================//
-// connection of TELNET terminal emulator and Cygwin shell //
-//---------------------------------------------------------//
-int main(int argc, char** argv)
-{
-    int listen_sock = -1;
-    u_short listen_port;
-    int te_sock = -1;
-    int sh_pty = -1;
-    HANDLE hTerm = NULL;
-    int sh_pid, agent_pid = 0;
-
-    // load configuration
-    load_cfg();
-
-    // read commandline arguments
-    get_args(argc, argv);
-
-    if (cmd_shell[0] == 0) {
-        msg_print("missing shell");
-        return 0;
-    }
-    if (cmd_term[0] == 0 && cl_port <= 0) {
-        msg_print("missing terminal");
-        return 0;
-    }
-
-    if (change_dir[0] != 0) {
-	home_chdir = false;
-	if (enable_loginshell) {
-	    add_env(&sh_envp, "CHERE_INVOKING=y", NULL);
-	}
-    }
-
-    // terminal side connection
-    if (cl_port > 0) {
-        // connect to the specified TCP port
-        if ((te_sock = connect_client()) < 0) {
-            goto cleanup;
-        }
-    } else {
-        // prepare a TELNET listener socket
-        if ((listen_sock = listen_telnet(&listen_port)) < 0) {
-            goto cleanup;
-        }
-        in_addr addr;
-        addr.s_addr = htonl(INADDR_LOOPBACK);
-        char tmp[256];
-        debug_msg_print("execute terminal");
-        snprintf(tmp, sizeof(tmp), cmd_term, inet_ntoa(addr), (int)ntohs(listen_port));
-        snprintf(cmd_term, sizeof(cmd_term), "%s %s", tmp, cmd_termopt);
-
-        // execute a terminal emulator
-        if ((hTerm = exec_term()) == NULL) {
-            api_error("exec_term failed");
-            goto cleanup;
-        }
-        // accept connection from the terminal emulator
-        if ((te_sock = accept_telnet(listen_sock)) < 0) {
-            goto cleanup;
-        }
-        shutdown(listen_sock, 2);
-        close(listen_sock);
-        listen_sock = -1;
-    }
-    // TELNET negotiation
-    if (!dumb) {
-        telnet_nego(te_sock);
-    }
-
-    // execute ssh-agent proxy
-    if (enable_agent_proxy) {
-        agent_pid = exec_agent_proxy();
-    }
-
-    // execute a shell
-    debug_msg_print("execute shell");
-    if ((sh_pty = exec_shell(&sh_pid)) < 0) {
-        debug_msg_print("exec_shell failed");
-        goto cleanup;
-    }
-    // set initial pty window size
-    if (!dumb && c_will_naws && win_size.ws_col != 0) {
-        ioctl(sh_pty, TIOCSWINSZ, &win_size);
-    }
-
-    debug_msg_print("entering telnet session");
-    // relay the terminal emulator and the shell
-    telnet_session(te_sock, sh_pty);
-
-  cleanup:
-    if (agent_pid > 0) {
-        kill(agent_pid, SIGTERM);
-    }
-    if (sh_pty >= 0) {
-        close(sh_pty);
-        kill(sh_pid, SIGKILL);
-    }
-    if (agent_pid > 0 || sh_pty >= 0) {
-        wait((int*)NULL);
-    }
-    if (listen_sock >= 0) {
-        shutdown(listen_sock, 2);
-        close(listen_sock);
-    }
-    if (te_sock >= 0) {
-        shutdown(te_sock, 2);
-        close(te_sock);
-    }
-    if (hTerm != NULL) {
-        WaitForSingleObject(hTerm, INFINITE);
-        CloseHandle(hTerm);
-    }
-    return 0;
-}
-
-#ifdef NO_WIN_MAIN
-// This program is an Win32 application but, start as Cygwin main().
-//------------------------------------------------------------------
-extern "C" {
-    void mainCRTStartup(void);
-    void WinMainCRTStartup(void) { mainCRTStartup(); }
-};
-#endif
-
-//EOF

Deleted: trunk/cygterm/cygterm.cfg
===================================================================
--- trunk/cygterm/cygterm.cfg	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/cygterm/cygterm.cfg	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,15 +0,0 @@
-# CygTerm setting
-
-TERM = ttermpro.exe %s %d /E /KR=UTF8 /KT=UTF8 /VTICON=CygTerm /nossh
-# SJIS for Cygwin 1.5
-# TERM = ttermpro.exe %s %d /E /KR=SJIS /KT=SJIS /VTICON=CygTerm /nossh
-TERM_TYPE = vt100
-PORT_START = 20000
-PORT_RANGE = 40
-SHELL = auto
-ENV_1 = MAKE_MODE=unix
-ENV_2 = 
-LOGIN_SHELL = Yes
-# HOME_CHDIR = No
-SSH_AGENT_PROXY = No
-DEBUG = No

Deleted: trunk/cygterm/cygterm.ico
===================================================================
(Binary files differ)

Added: trunk/cygwin/CMakeLists.txt
===================================================================
--- trunk/cygwin/CMakeLists.txt	                        (rev 0)
+++ trunk/cygwin/CMakeLists.txt	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,9 @@
+add_subdirectory(cyglaunch)
+set_target_properties(
+  cyglaunch
+  PROPERTIES FOLDER cygwin)
+
+add_subdirectory(cygtool)
+set_target_properties(
+  cygtool_dll
+  PROPERTIES FOLDER cygwin)

Added: trunk/cygwin/README.md
===================================================================
--- trunk/cygwin/README.md	                        (rev 0)
+++ trunk/cygwin/README.md	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,10 @@
+# cygwin に関連するプログラムなど
+
+- cyglaunch
+  - cygterm を実行するプログラム
+- cygterm
+  - cygwin を起動するプログラム
+- cygtool
+  - インストーラから使用するdll
+- cyglib
+  - ttermpro, cyglaunch, cygtool から使用するライブラリ

Added: trunk/cygwin/cyglaunch/CMakeLists.txt
===================================================================
--- trunk/cygwin/cyglaunch/CMakeLists.txt	                        (rev 0)
+++ trunk/cygwin/cyglaunch/CMakeLists.txt	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,33 @@
+set(PACKAGE_NAME "cyglaunch")
+
+project(${PACKAGE_NAME})
+
+add_executable(
+  ${PACKAGE_NAME} WIN32
+  cyglaunch.c
+  cyglaunch.rc
+  )
+
+target_include_directories(
+  ${PACKAGE_NAME}
+  PRIVATE
+  .
+  )
+
+install(
+  TARGETS ${PACKAGE_NAME}
+  DESTINATION .
+  )
+
+if(MSVC)
+  # subsystem:windows, but start form main()
+  if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup")
+  else()
+    target_link_options(
+      ${PACKAGE_NAME}
+      PRIVATE
+      /ENTRY:wmainCRTStartup
+      )
+  endif()
+endif(MSVC)

Added: trunk/cygwin/cyglaunch/README.md
===================================================================
--- trunk/cygwin/cyglaunch/README.md	                        (rev 0)
+++ trunk/cygwin/cyglaunch/README.md	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,6 @@
+# cyglaunch
+
+- cygterm を起動するプログラム
+- cyglaunch は普通のexeファイル
+  - cygwin上で動作する必要はない
+  - Visual Studio で普通にビルドできる

Copied: trunk/cygwin/cyglaunch/cyglaunch.c (from rev 9515, trunk/cygterm/cyglaunch.c)
===================================================================
--- trunk/cygwin/cyglaunch/cyglaunch.c	                        (rev 0)
+++ trunk/cygwin/cyglaunch/cyglaunch.c	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,145 @@
+//
+// Cygterm launcher
+//
+// (C) 2007- TeraTerm Project
+//   https://ttssh2.osdn.jp/
+//
+// [How to compile]
+// Cygwin:
+//  # cc -mno-cygwin -mwindows -o cyglaunch cyglaunch.c
+//
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <direct.h>
+
+#define Section "Tera Term"
+char *FName = "TERATERM.INI";
+
+
+//
+// Connect to local cygwin
+//
+void OnCygwinConnection(char *CygwinDirectory, char *cmdline)
+{
+	char file[MAX_PATH], *filename;
+	char c, *envptr, *envbuff;
+	int envbufflen;
+	char *exename = "cygterm.exe";
+	char cmd[1024];
+	STARTUPINFO si;
+	PROCESS_INFORMATION pi;
+
+	if (strlen(CygwinDirectory) > 0) {
+		if (SearchPath(CygwinDirectory, "bin\\cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+			goto found_dll;
+		}
+	}
+
+	if (SearchPath(NULL, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+		goto found_path;
+	}
+
+	for (c = 'C' ; c <= 'Z' ; c++) {
+		char tmp[MAX_PATH];
+		sprintf(tmp, "%c:\\cygwin\\bin;%c:\\cygwin64\\bin", c, c);
+		if (SearchPath(tmp, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+			goto found_dll;
+		}
+	}
+
+	MessageBox(NULL, "Can't find Cygwin directory.", "ERROR", MB_OK | MB_ICONWARNING);
+	return;
+
+found_dll:;
+	envptr = getenv("PATH");
+	file[strlen(file)-12] = '\0'; // delete "\\cygwin1.dll"
+	if (envptr != NULL) {
+		envbufflen = strlen(file) + strlen(envptr) + 7; // "PATH="(5) + ";"(1) + NUL(1)
+		if ((envbuff=malloc(envbufflen)) == NULL) {
+			MessageBox(NULL, "Can't allocate memory.", "ERROR", MB_OK | MB_ICONWARNING);
+			return;
+		}
+		_snprintf(envbuff, envbufflen, "PATH=%s;%s", file, envptr);
+	} else {
+		envbufflen = strlen(file) + strlen(envptr) + 6; // "PATH="(5) + NUL(1)
+		if ((envbuff=malloc(envbufflen)) == NULL) {
+			MessageBox(NULL, "Can't allocate memory.", "ERROR", MB_OK | MB_ICONWARNING);
+			return;
+		}
+		_snprintf(envbuff, envbufflen, "PATH=%s", file);
+	}
+	_putenv(envbuff);
+	if (envbuff) {
+		free(envbuff);
+		envbuff = NULL;
+	}
+
+found_path:;
+	memset(&si, 0, sizeof(si));
+	GetStartupInfo(&si);
+	memset(&pi, 0, sizeof(pi));
+
+	strcpy(cmd, exename);
+	strcat(cmd, " ");
+	strncat(cmd, cmdline, sizeof(cmd)-strlen(cmd)-1);
+//printf("%s", cmd);
+//MessageBox(NULL, cmd, "", MB_OK);
+	if (CreateProcess(
+			NULL,
+			cmd,
+			NULL, NULL, FALSE, 0,
+			NULL, NULL,
+			&si, &pi) == 0) {
+		MessageBox(NULL, "Can't execute Cygterm.", "ERROR", MB_OK | MB_ICONWARNING);
+	}
+}
+
+
+int main(int argc, char** argv)
+{
+	char Temp[256], CygwinDir[256], Cmdline[256];
+	char *bs;
+	int i;
+	BOOL d_opt=FALSE;
+
+	if (GetModuleFileName(NULL, Temp, sizeof(Temp)) > 0 &&
+	   (bs = strrchr(Temp, '\\')) != NULL) {
+		*bs = 0;
+		_chdir(Temp);
+		_snprintf(bs, sizeof(Temp) + Temp - bs, "\\%s", FName);
+	}
+	else {
+		_snprintf(Temp, sizeof(Temp), ".\\", FName);
+	}
+
+	// Cygwin install path
+ 	GetPrivateProfileString(Section, "CygwinDirectory", "c:\\cygwin",
+			  CygwinDir, sizeof(CygwinDir), Temp);
+
+	//printf("%s %d\n", CygwinDir, GetLastError());
+
+	Cmdline[0] = 0;
+	for (i=1; i<argc; i++) {
+		if (i != 1) {
+			strncat(Cmdline, " ", sizeof(Cmdline)-strlen(Cmdline)-1);
+		}
+		if (d_opt && strncmp("\"\\\\", argv[i], 3) == 0) {
+			argv[i][1] = '/';
+			argv[i][2] = '/';
+		}
+		strncat(Cmdline, argv[i], sizeof(Cmdline)-strlen(Cmdline)-1);
+		if (strcmp(argv[i], "-d") == 0) {
+			d_opt = TRUE;
+		}
+		else {
+			d_opt = FALSE;
+		}
+	}
+	//printf("%s\n", Cmdline);
+
+	OnCygwinConnection(CygwinDir, Cmdline);
+
+	return 0;
+}

Added: trunk/cygwin/cyglaunch/cyglaunch.rc
===================================================================
--- trunk/cygwin/cyglaunch/cyglaunch.rc	                        (rev 0)
+++ trunk/cygwin/cyglaunch/cyglaunch.rc	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1 @@
+icon ICON "../cygterm/cygterm.ico"

Added: trunk/cygwin/cyglaunch/cyglaunch.v16.vcxproj
===================================================================
--- trunk/cygwin/cyglaunch/cyglaunch.v16.vcxproj	                        (rev 0)
+++ trunk/cygwin/cyglaunch/cyglaunch.v16.vcxproj	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{11b49891-80f0-4dd3-b6e9-70bbe64a4bbf}</ProjectGuid>
+    <RootNamespace>cyglaunch</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+    <ProjectName>cyglaunch</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level4</WarningLevel>
+      <SDLCheck>false</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level4</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>false</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ResourceCompile Include="cyglaunch.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="cyglaunch.c" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

Added: trunk/cygwin/cyglaunch/cyglaunch.v8.vcproj
===================================================================
--- trunk/cygwin/cyglaunch/cyglaunch.v8.vcproj	                        (rev 0)
+++ trunk/cygwin/cyglaunch/cyglaunch.v8.vcproj	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="cyglaunch"
+	ProjectGUID="{1A41E0B4-7FBC-44C6-83A4-7881F60CE8C8}"
+	RootNamespace="cyglaunch"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="1"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ole32.lib shell32.lib user32.lib kernel32.lib $(NOINHERIT)"
+				LinkIncremental="2"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				EntryPointSymbol="mainCRTStartup"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="1"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+				RuntimeLibrary="0"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="ole32.lib shell32.lib user32.lib kernel32.lib $(NOINHERIT)"
+				LinkIncremental="1"
+				GenerateDebugInformation="true"
+				SubSystem="2"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				EntryPointSymbol="mainCRTStartup"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\cyglaunch.c"
+			>
+		</File>
+		<File
+			RelativePath=".\cyglaunch.rc"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: trunk/cygwin/cygterm/.gitignore (from rev 9515, trunk/cygterm/.gitignore)
===================================================================
--- trunk/cygwin/cygterm/.gitignore	                        (rev 0)
+++ trunk/cygwin/cygterm/.gitignore	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,4 @@
+cygterm+.tar.gz
+cygterm.exe
+cygterm.rc
+cygterm.res

Added: trunk/cygwin/cygterm/CMakeLists.txt
===================================================================
--- trunk/cygwin/cygterm/CMakeLists.txt	                        (rev 0)
+++ trunk/cygwin/cygterm/CMakeLists.txt	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,20 @@
+option(MSYS2TERM "msys2term" OFF)
+
+if (MSYS2TERM)
+  set(PACKAGE_NAME "msys2term")
+else()
+  set(PACKAGE_NAME "cygterm")
+endif()
+ENABLE_LANGUAGE(RC)
+project(${PACKAGE_NAME})
+
+add_executable(
+  ${PACKAGE_NAME}
+  cygterm.cc
+  cygterm.rc
+  )
+
+set_source_files_properties(
+  cygterm.cc
+  PROPERTIES COMPILE_FLAGS "-D_GNU_SOURCE -fno-exceptions"
+)

Copied: trunk/cygwin/cygterm/COPYING (from rev 9515, trunk/cygterm/COPYING)
===================================================================
--- trunk/cygwin/cygterm/COPYING	                        (rev 0)
+++ trunk/cygwin/cygterm/COPYING	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,339 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.

Copied: trunk/cygwin/cygterm/Makefile (from rev 9515, trunk/cygterm/Makefile)
===================================================================
--- trunk/cygwin/cygterm/Makefile	                        (rev 0)
+++ trunk/cygwin/cygterm/Makefile	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,71 @@
+# Makefile for CygTerm
+
+BINDIR = $(HOME)/bin
+
+CC = gcc
+CFLAGS = -D_GNU_SOURCE -O2 -fno-exceptions
+#CFLAGS = -g -fno-exceptions
+LDFLAGS = -mwindows
+
+LAUNCH = cyglaunch.exe
+LAUNCH_SRC = cyglaunch.c
+EXE = cygterm.exe
+SRC = $(EXE:.exe=.cc)
+CFG = $(EXE:.exe=.cfg)
+RES = $(EXE:.exe=.res)
+ICO = $(EXE:.exe=.ico)
+RC  = $(EXE:.exe=.rc)
+ARCHIVE = cygterm+.tar.gz
+
+.PHONY: all clean install uninstall
+
+all : $(EXE) $(LAUNCH) $(ARCHIVE)
+
+$(EXE) : $(SRC) $(ICO) $(RC)
+	windres -O coff -o $(RES) $(RC)
+  ifeq (0, $(shell nm /usr/lib/crt0.o | grep -c WinMainCRTStartup))
+	$(CC) $(CFLAGS) $(LDFLAGS) -DNO_WIN_MAIN -o $(EXE) $(SRC) $(RES)
+  else
+	$(CC) $(CFLAGS) $(LDFLAGS) -o $(EXE) $(SRC) $(RES)
+  endif
+	strip $(EXE)
+
+$(LAUNCH) : $(LAUNCH_SRC) $(ICO) $(RC)
+	@# gcc 4.3.2? or later doesn't support "-mno-cygwin" flag.
+	@#
+	@# $(CC)                   gcc less than 4.3.2 (supports "-mno-cygwin")
+	@# gcc-3                   gcc3 (supports "-mno-cygwin")
+	@# i686-pc-mingw32-gcc     mingw-gcc-core
+	@# i686-w64-mingw32-gcc    mingw64-i686-gcc-core
+	@# x86_64-w64-mingw32-gcc  mingw64-x86_64-gcc-core
+  ifeq (i686, $(shell uname -m))
+	windres -O coff -o $(RES) $(RC)
+	( i686-pc-mingw32-gcc $(CFLAGS) $(LDFLAGS) -o $(LAUNCH) $(LAUNCH_SRC) $(RES) ) || \
+	( i686-w64-mingw32-gcc $(CFLAGS) $(LDFLAGS) -o $(LAUNCH) $(LAUNCH_SRC) $(RES) ) || \
+	( $(CC) $(CFLAGS) $(LDFLAGS) -mno-cygwin -o $(LAUNCH) $(LAUNCH_SRC) $(RES) ) || \
+	( gcc-3 $(CFLAGS) $(LDFLAGS) -mno-cygwin -o $(LAUNCH) $(LAUNCH_SRC) $(RES) )
+	strip $(LAUNCH)
+  else
+	x86_64-w64-mingw32-windres -O coff -o $(RES) $(RC)
+	x86_64-w64-mingw32-gcc $(CFLAGS) $(LDFLAGS) -o $(LAUNCH) $(LAUNCH_SRC) $(RES)
+	x86_64-w64-mingw32-strip $(LAUNCH)
+  endif
+
+$(RC):
+	echo 'icon ICON $(ICO)' > $(RC)
+
+clean :
+	rm -f $(EXE) $(RC) $(RES) $(LAUNCH) $(ARCHIVE)
+
+install : $(EXE)
+	@ install -v $(EXE) $(BINDIR)/$(EXE)
+	@ if [ ! -f $(BINDIR)/$(CFG) ]; then \
+	    install -v $(CFG) $(BINDIR)/$(CFG) \
+	; fi
+
+uninstall :
+	rm -f $(BINDIR)/$(EXE)
+	rm -f $(BINDIR)/$(CFG)
+
+$(ARCHIVE) : $(SRC) $(ICO) $(CFG) $(LAUNCH_SRC) README README-j Makefile
+	tar cf - $(SRC) $(ICO) $(CFG) $(LAUNCH_SRC) COPYING README README-j Makefile | gzip > $(ARCHIVE)

Copied: trunk/cygwin/cygterm/README (from rev 9515, trunk/cygterm/README)
===================================================================
--- trunk/cygwin/cygterm/README	                        (rev 0)
+++ trunk/cygwin/cygterm/README	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,447 @@
+
+                CygTerm+ - yet another Cygwin console
+
+                Using Cygwin with a terminal emulator.
+
+                (C) 2006-2016 TeraTerm Project
+                https://ttssh2.osdn.jp/
+
+                Based on CygTerm by Original developer:
+                Copyright (C) 2000-2006 NSym
+
+                nsym****@dd*****
+
+      (English) https://googledrive.com/host/0B1s-dM6d6yC4fmhEZ3c0VTNFWEFtV3daUlRGQmFHVnBmVHRybUNnUVliNWktNDRlZ2NnZTQ/index-e.html
+
+     (Japanese) https://googledrive.com/host/0B1s-dM6d6yC4fmhEZ3c0VTNFWEFtV3daUlRGQmFHVnBmVHRybUNnUVliNWktNDRlZ2NnZTQ/index.html
+
+
+// P R E F A C E //
+
+    This is an experiment trying to substitute a terminal emulator for the
+    DOS window as Cygwin console.  However, assume that it is carried out
+    without the mechanism of remote login.  In other words, it doesn't use
+    `inetd', `in.telnetd' or `login'.
+
+// I D E A //
+
+    Invoking a terminal emulator and Cygwin shell, and relaying their I/O.
+    One simple solution is just to implement a program to do this.
+
+// S P E C I F I C A T I O N //
+
+    1. When this program is run, a terminal emulator starts, and a shell
+       prompt appears there, it can be used for Cygwin console.
+
+    2. The terminal emulator and the shell have to be selectable.
+
+    3. Screen control of the shell side has to work correctly and follow
+       window resizing of the terminal emulator.
+
+// D E S I G N //
+
+    Details of cygterm.exe
+
+      [1] Prepare a listener socket to wait for a TELNET connection.
+          Find out an unused TCP port number to assign to the socket from a
+          specified range.
+
+      [2] Invoke a terminal emulator in another thread.
+          Then specify IP address `127.0.0.1' and the port number [1] in the
+          command line arguments.
+
+      [3] Accept the connection from the terminal emulator.
+          Refuse it except a connection from `127.0.0.1' in security.
+
+      [4] Do fork(), and in the child process, invoke a shell under PTY
+          (pseudo terminal) slave side.
+
+      [5] Relay I/O between the TELNET connection socket [3] and the PTY
+          master side of [4].
+
+    Support for TELNET protocol (options negotiation)
+
+        Receive the notification of terminal-type from a terminal emulator,
+        and apply it to the environment variable TERM on a shell.
+
+        Receive the notification of terminal-size from a terminal emulator,
+        and apply it to window size of PTY.
+
+        [Ref. RFC854 TELNET PROTOCOL SPECIFICATION]
+
+    cygterm.exe is implemented as an window-less Win32 application.
+
+// S O U R C E //
+
+    README       -  this file
+    README-j     -  original README in Japanese
+    COPYING      -  GNU General Pulic License (GPL) Version 2
+    Makefile     -  MAKEFILE for installation
+    cygterm.cc   -  program source code
+    cygterm.cfg  -  configuration file
+
+    * CygTerm is a free software distributed under the terms of the GNU
+      General Public License (GPL) published by Free Software Foundation.
+      See COPYING. (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+
+      Note: Any program including non-GPL program can invoke the CygTerm
+            executable (cygterm.exe) and communicate with it.
+
+// I N S T A L L //
+
+    Do `make install' under Cygwin.
+
+    * Be sure to specify the install directory by BINDIR in Makefile
+      in advance.  cygterm.exe and cygterm.cfg are installed in BINDIR.
+      cygterm.cfg is not overwritten.
+
+// C O N F I G U R A T I O N //
+
+    cygterm.cfg is a configuration file.  This includes definitions for the
+    command lines of a terminal emulator and a shell, and several parameters.
+    cygterm.cfg is loaded from the same directory cygterm.exe exists in.
+
+      An example of cygterm.cfg
+      +-----------------------------------------------------------------------
+      | TERM = C:\program files\ttermpro\ttermpro.exe %s %d /KR=SJIS /KT=SJIS
+      | TERM_TYPE = vt100
+      | PORT_START = 20000
+      | PORT_RANGE = 40
+      | SHELL = /bin/bash
+      | ENV_1 = MAKE_MODE=unix
+      | ENV_2 = HOME=/home
+      |   :         :
+
+    TERM
+    ----
+        This is the command line to execute a terminal emulaitor.
+        Specify the full path to the command if it isn't in Windows search path.
+        This needs to be described `%s' and `%d' for the host and port number.
+
+    TERM_TYPE
+    ---------
+        This terminal type is adopted when the terminal emulator did not give
+        a terminal type. (default: vt100)  Then this value is set to the
+        environment variable TERM on a shell.
+
+    PORT_START
+    ----------
+        This is the minimum TCP port number allowed for use. (default: 20000)
+
+    PORT_RANGE
+    ----------
+        This is the maximum number of TCP ports allowed for use. (default: 40)
+
+        cygterm.exe looks for an unused port number between PORT_START and
+        PORT_START+PORT_RANGE, and therefore can be run concurrently as many
+        as this number.
+
+    SHELL
+    -----
+        This is the command line to execute a shell in Cygwin side (normally
+        /bin/bash). (default: get from /etc/passwd)
+        Specify the full path to the shell or keyword "AUTO".
+
+    LOGIN_SHELL
+    -----------
+        If this parameter is set to yes, shell is invoked as a login shell.
+        (default: no)
+
+    HOME_CHDIR
+    ----------
+        If this parameter is set to yes, current directory is changed to home
+        directory before invoke a shell. (default: no)
+
+    SOCKET_TIMEOUT
+    --------------
+        Specify the timeout of socket for waiting telnet connection from
+        terminal emulator. (default: 5secs)
+
+    SSH_AGENT_PROXY
+    ---------------
+        If this parameter is set to yes, cygterm provides ssh-agent proxy.
+        (default: no)
+
+    ENV_X
+    -----
+        This is the environment variable to be set when starting the shell.
+        It should be of the form `name=value' (like putenv).  It is possible to
+        give as many environment variables as needed by beginning with "ENV_".
+
+// U S A G E //
+
+    Command Line Options
+
+        cygterm.exe [-t 'terminal-emulator'] [-p port-number] [-dumb]
+                    [-s 'shell'] [-ls | -nols] [-cd | -nocd] [-a | -A]
+                    [-v 'env-var' ...] [-d 'directory] [-o 'option']
+
+    -t 'terminal-emulator'
+            Specify the command line of a terminal emulator to execute.
+            This format is the same as TERM in the configuration file.
+            The command line should be enclosed in quotes to include spaces.
+
+    -p port-number
+            Instead of executing a terminal emulator, try connection to this
+            port number of localhost.  It is considered another program uses
+            `-p' option to use Cygwin via cygterm.exe
+
+    -dumb
+            Suppress the TELNET options negotiation.  And ignore any TELNET
+            commands sent from terminal side.  The environment variable
+            TERM is set to `dumb' on the shell side.
+
+    -s 'shell'
+            Specify the command line of a shell on Cygwin to execute.
+            This format is the same as SHELL in the configuration file.
+            The command line should be enclosed in quotes to include spaces.
+            Any command can be spedicied even if a non-shell command.
+
+    -ls
+            Execute a shell as a login shell.
+
+    -nols
+            Execute a shell as a normal (not login) shell.
+
+    -cd
+            The current directory is moved to the user home directory and
+            the shell is invoked.
+
+    -nocd
+            The shell is invoked without changing the current directory.
+
+    -A
+            Enable ssh-agent forwarding support.
+
+    -a
+            Disable ssh-agent forwarding support.
+
+    -v 'env-var'
+            Specify the environment variable to be set when starting the shell.
+            This format is the same as ENV_X in the configuration file.
+            The expression should be enclosed in quotes to include spaces.
+            One or more `-v' options are available.
+
+    -d 'directory'
+            The current directory is moved to the specified directory and
+            the shell is invoked.
+
+    -o 'parameter'
+            Additional parameter for terminal-emulator.
+
+    The terminal emulator or connection port number, and the shell on Cygwin,
+    these need to be specified at least.  If these are given on the command
+    line, cygterm.exe can be run without configuration file cygterm.cfg.
+
+    cygterm.exe is an Win32 application which uses cygwin1.dll.  It can be run
+    from Cygwin command line or a shortcut on Windows.
+
+    * It is necessary the Windows environment variable PATH includes a
+      directory path of cygwin1.dll (normally Cygwin-root\bin) to be run
+      from Windows.
+
+// N O T E S //
+
+    * Attention in Tera Term
+
+        If your terminal emulator is Tera Term be careful not to save [Setup]
+        [Save setup] in the situation that it was started by cygterm.exe.
+        Otherwise telnet port number of TCP/IP is saved but 23 you will be
+        confused by connection failure when you normally run Tera Term to do
+        telnet.  In that case it will be recovered by saving the setting
+        with specifying TCP/IP Port# 23.
+
+// T E S T E D  O N //
+
+    As of 2010-Oct, CygTerm+ has been tested in the following environments.
+
+        WindowsXP SP3 + Cygwin 1.5.25-15
+        WindowsXP SP3 + Cygwin 1.7.7
+
+        Terminal emulator:
+                Tera Term Pro 2.3
+                Tera Term 4.67
+                PuTTY 0.60
+        Shell:
+                bash 3.2.51
+                zsh 4.3.10
+
+// C H A N G E S //
+v1.07_28 2016/11/26 (by maya)
+        * Changed the icon image.
+
+v1.07_28 2016/02/17 (by doda)
+        * Add debug mode.
+
+v1.07_27 2016/02/09 (by doda)
+        * The directory selection by -d option is prior to -cd option
+          (HOME_CHDIR=y).
+        * When -d option is specified by using -ls option(LOGIN_SHELL=y),
+           CHERE_INVOKING=y is set.
+
+v1.07_26 2015/12/14 (by doda)
+        * Add multiple connections support for the ssh-agent proxy.
+
+v1.07_25 2015/02/21 (by doda)
+        * Bug fix: The TERM environment variable can not be configured.
+
+v1.07_24 2013/08/15 (by maya)
+        * Support for 64bit Cygwin. (cyglaunch)
+
+v1.07_23 2011/04/18 (by doda)
+        * Display error message when chdir() was failed.
+
+v1.07_22 2011/03/03 (by maya)
+        * Delete mutex object for running check by installer.
+
+v1.07_21 2011/02/28 (by maya)
+        * Add mutex object for running check by installer.
+
+v1.07_20 2010/10/20 (by doda)
+        * Directory change timing with '-d' option is delayed. (security fix)
+
+v1.07_19 2010/01/28 (by doda)
+        * Accept keyword "AUTO" with '-s' option.
+
+v1.07_18 2010/01/19 (by doda)
+        * Delete doubule quote character from '-d' option's parameter.
+
+v1.07_17 2009/06/16 (by doda)
+        * Added TELNET SGA/ECHO negotiation.
+
+v1.07_16 2008/11/21 (by doda)
+        * The option that enables ssh-agent proxy support is changed from '-a'
+          to '-A'.
+        * Added '-a' option that disables ssh-agent proxy support.
+
+v1.07_15 2008/11/01 (by doda)
+        * Added ssh-agent proxy support.
+
+v1.07_14 2007/12/17 (by doda)
+        * Added '-o' option that is specifies the additional parameters for
+          terminal-emulator.
+
+v1.07_13 2007/08/03 (by maya)
+        * Added '-d' option that is specifies the start directory.
+
+v1.07_12 2007/06/10 (by doda)
+        * Add 'SOCKET_TIMEOUT' entry which the timeout value of socket for
+          waiting telnet connection in cygterm.cfg file.
+
+v1.07_11 2007/01/31 (import from cygterm v1.07)
+        * Avoid WinMainCRTStartup() redefinition error with gcc 3.4.
+        * Give an output gap for keyboard interrupt.
+
+v1.06_11 2006/09/29 (by maya)
+        * Stopped using HOME from environment variable and /etc/passwd.
+          CygTerm passes HOME which is set by Cygwin. See also /etc/profile
+        * Changed the priority of config files.
+          command line arguments > ~/.cygtermrc > /etc/cygterm.conf
+          > cygterm.cfg > /etc/passwd
+
+v1.06_10 2006/09/28 (by doda)
+        * Use getlogin() instead of environment variable USERNAME to get
+          user name.
+
+v1.06_09 2006/09/25 (by doda)
+        * Get shell information from /etc/passwd if SHELL parameter is not
+          specified.
+
+v1.06_08 2006/08/30 (by maya)
+        * Changed the priority of config files. cygterm.cfg is top priority
+          config file.
+
+v1.06_07 2006/08/19 (by maya)
+        * Use `HOME' environment variable for changing home directory if the
+          variable will be set.
+
+v1.06_06 2006/08/18 (by doda)
+        * Limit a parameter length of both '-s' and '-t' option.
+
+v1.06_05 2006/08/18 (by maya)
+        * Create mutex object for running check by installer.
+
+v1.06_04 2006/08/15 (by doda)
+        * Add 'LOGIN_SHELL' entry which the shell is invoked as the login shell
+          in cygterm.cfg file.
+
+          LOGIN_SHELL: yes | no
+
+v1.06_03 2006/08/15 (by doda)
+        * Add 'HOME_CHDIR' entry which home directory is changed in cygterm.cfg
+          file.
+
+          HOME_CHDIR: yes | no
+
+v1.06_02 2006/02/09 (by babyd****@yahoo*****)
+        * Generated CygTerm's ICON by "DotWork 2.50".
+          "DotWork 2.50" is available at http://www5a.biglobe.ne.jp/~suuta/.
+          Special Thanks to "suuta at hamal dot freemal dot ne dot jp"
+
+        * Makefile was changed, "clean" target was changed to don't remove
+          cygterm.ico.
+
+v1.06_01 2006/02/08 (by babyd****@yahoo*****)
+        * The following configuration file reading was supported:
+            + /etc/cygterm.conf
+            + ~/.cygtermrc
+
+        * Shell is invoked with user's home-directory.
+
+        * Get account configuration from /etc/passwd by getpwnam(3),
+          getting account name from USERNAME environment by getenv(3).
+
+        * Makefile was changed, default build is with icon executable.
+
+v1.06 2004/01/24
+        * The following command line options were added:
+            -t 'terminal-emulator' (specifies the terminal emulator)
+            -p port-number (specifies the port# to connect)
+            -dumb (specifies dumb terminal mode)
+            -s 'shell' (specifies the shell)
+            -v 'env-var' (specifies environment variables)
+
+        * Fixed to fail in `make install' if BINDIR was not found.
+
+        * cygterm.cc and README.txt were changed to English version.
+
+v1.05 2003/01/14
+        * Fixed to transmit Ctrl+SPACE (NUL).
+          The NUL character was not able to be transmitted even if Ctrl+SPACE
+          was typed, because it was ignored simply as an way to handle the
+          newline CR+NUL.
+
+v1.04 2002/12/08
+        * Changed to display error messages for failure to execute a terminal
+          emulator or a shell.
+
+        * Makefile was changed.
+          + do not overwrite cygterm.cfg when `make install'.
+          + add the gcc option -fno-exceptions against the GCC-3 link error.
+
+v1.03 2002/07/24
+        * Fixed to convert terminal type into lower-case when cygterm received
+          it from a terminal emulator.  Because some upper-case values such as
+          `ANSI' `VT100' of the environment variable TERM might not be found
+          in terminfo depending on the kind of terminal emulator.
+          (Windows 2000 telnet.exe, etc)
+
+v1.02 2002/07/22
+        * Fix to be able to start a terminal emulator even if it was a console
+          application.  (Windows 2000 telnet.exe, etc)
+          There was a mistake in calling CreateProcess().
+
+        * Fixed to suppress duplicate newline on a shell by canceling LF when
+          a terminal emulator sent CR+LF.  (Windows 98 telnet.exe, etc)
+
+        * Embedded the version number in cygterm.exe executable code.
+          How to check: $ strings cygterm.exe | grep version
+
+v1.01 2002/07/19
+        * Fixed that cygterm did not work with zsh or tcsh.
+          Input was blocked when zsh or tcsh started, because the approach to
+          open the pseudo terminal was not good.
+
+v1.00 2000/12/17
+        * The initial version was released.
+

Copied: trunk/cygwin/cygterm/README-j (from rev 9515, trunk/cygterm/README-j)
===================================================================
--- trunk/cygwin/cygterm/README-j	                        (rev 0)
+++ trunk/cygwin/cygterm/README-j	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,462 @@
+
+                CygTerm+  -  yet another Cygwin console
+
+                $B%?!<%_%J%k!&%(%_%e%l!<%?$G(B Cygwin $B$r;H$&!#(B
+
+                (C) 2006-2016 TeraTerm Project
+                https://ttssh2.osdn.jp/
+
+                Based on CygTerm by Original developer:
+                Copyright (C) 2000-2006 NSym
+                nsym****@dd*****
+      (English) https://googledrive.com/host/0B1s-dM6d6yC4fmhEZ3c0VTNFWEFtV3daUlRGQmFHVnBmVHRybUNnUVliNWktNDRlZ2NnZTQ/index-e.html
+     (Japanese) https://googledrive.com/host/0B1s-dM6d6yC4fmhEZ3c0VTNFWEFtV3daUlRGQmFHVnBmVHRybUNnUVliNWktNDRlZ2NnZTQ/index.html
+
+
+// $B$O(B $B$8(B $B$a(B $B$K(B //
+
+    Cygwin$B%3%s%=!<%k$G$"$k(BDOS$BAk$r%?!<%_%J%k!&%(%_%e%l!<%?$GCV$-BX$($F$_$h$&!"(B
+    $B$H$$$&;n$_$G$9!#(B $B$?$@$7!X%j%b!<%H%m%0%$%s$N$7$/$_$rMxMQ$;$:$K!Y$H$$$&(B
+    $BA0Ds$G$9!#(B $B$7$?$,$C$F(B inetd $B$H$+(B in.telnetd $B$H$+(B login $BEy$O;HMQ$7$^$;$s!#(B
+
+// $B9M(B $B$((B $BJ}(B //
+
+    $B%?!<%_%J%k!&%(%_%e%l!<%?$H(BCygwin$B>e$N%7%'%k$r5/F0$7!"N><T$rCf7Q$9$k!#(B
+    $B$3$l$r9T$&%W%m%0%i%`$r:n$l$P$h$$!#(B
+
+// $B;E(B $BMM(B //
+
+    1. $B$3$N%W%m%0%i%`$r<B9T$9$k$H!"%?!<%_%J%k!&%(%_%e%l!<%?$,N)$A>e$,$j!"(B
+       $B$=$3$K%7%'%k$N%W%m%s%W%H$,8=$l!"(BCygwin$B%3%s%=!<%k$H$7$F;H$($k$3$H!#(B
+
+    2. $B5/F0$9$k%?!<%_%J%k!&%(%_%e%l!<%?$H%7%'%k$OA*Br2DG=$G$"$k$3$H!#(B
+
+    3. $B%7%'%kB&$N2hLL@)8f$, @ 5>o$KF0:n$7!"%?!<%_%J%k!&%(%_%e%l!<%?B&$N(B
+       $B2hLL%5%$%:JQ99$K$bDI?o$9$k$3$H!#(B
+
+// $B @ _(B $B7W(B //
+
+    cygterm.exe $B=hM}>\:Y(B
+
+      [1] TELNET$B@\B3$rBT$A<u$1$k%j%9%J!<%=%1%C%H$rMQ0U$9$k!#(B
+          $B%=%1%C%H$K3d$jEv$F$kL$;HMQ%]!<%HHV9f$O;XDjHO0OFb$+$iC5$7=P$9!#(B
+
+      [2] $BJL%9%l%C%I$G%?!<%_%J%k!&%(%_%e%l!<%?$r5/F0$9$k!#(B
+          $B$3$N$H$-5/F00z?t$K(B IP$B%"%I%l%9(B 127.0.0.1 $B$H(B [1]$B$N%]!<%HHV9f$r;XDj$9$k!#(B
+
+      [3] $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i$N@\B3$r<u$1F~$l$k!#(B
+          $B%;%-%e%j%F%#!<>e(B 127.0.0.1 $B0J30$+$i$N@\B3$O5Q2<$9$k!#(B
+
+      [4] fork()$B$7$?;R%W%m%;%9>e!"(BPTY($B5<;wC<Kv(B)$B%9%l!<%VB&$G%7%'%k$r5/F0$9$k!#(B
+
+      [5] [3]$B$N(B TELNET$B@\B3%=%1%C%H$H(B [4]$B$N(B PTY$B%^%9%?!<B&$NF~=PNO$r66EO$7$9$k!#(B
+
+    TELNET$B%W%m%H%3%k$X$NBP1~(B (option negotiation)
+
+        $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i%?!<%_%J%k%?%$%W$NDLCN$r<u$1!"(B
+        $B%7%'%k>e(B TERM $B4D6-JQ?t$K%;%C%H$9$k!#(B
+
+        $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i%?!<%_%J%k%5%$%:$NDLCN$r<u$1!"(B
+        PTY$B$N%&%#%s%I%&%5%$%:$rF1%5%$%:$KJQ99$9$k!#(B
+
+        $B<+J,$,(B Go Ahead $B$r;H$o$J$$;v$N5v2D$r%?!<%_%J%k%(%_%e%l!<%?$KMW5a$9$k!#(B
+
+        $B%?!<%_%J%k%(%_%e%l!<%?$,(B Go Ahead $B$r;HMQ$7$J$$$h$&$KMW5a$9$k!#(B
+
+        $B%?!<%_%J%k%(%_%e%l!<%?$NAw?.FbMF$r%(%3!<%P%C%/$9$k5v2D$rMW5a$9$k!#(B
+
+        [$B;2>H(B: RFC854 TELNET PROTOCOL SPECIFICATION]
+
+    cygterm.exe $B$O%&%#%s%I%&$r;}$?$J$$(B Win32$B%"%W%j$H$7$F<BAu$9$k!#(B
+
+// $B%=(B $B!<(B $B%9(B //
+
+    README-j     -  $B$3$N%U%!%$%k(B
+    README       -  README-j$B1QLu(B
+    COPYING      -  GNU General Public License (GPL) Version 2
+    Makefile     -  $B%a%$%/%U%!%$%k(B
+    cygterm.cc   -  $B%=!<%9%3!<%I(B
+    cygterm.cfg  -  $B @ _Dj%U%!%$%k(B
+
+    $B"((B Free Software Foundation $BH/9T(B GNU General Public License (GPL)
+       $B$K=`5r$9$k%U%j!<%=%U%H%&%'%"$H$7$FG[I[$7$^$9!#(B
+       COPYING $B;2>H!#(B(https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
+
+       $BJdB-(B: $BB>%W%m%0%i%`$,(B CygTerm$B<B9T7A<0(B(cygterm.exe)$B$r5/F0$7DL?.$7$F(B
+             $B;HMQ$9$k$3$H$O!"$=$l$,Hs(BGPL$B%W%m%0%i%`$N>l9g$G$b5v2D$5$l$^$9!#(B
+
+// $B%$(B $B%s(B $B%9(B $B%H(B $B!<(B $B%k(B //
+
+    Cygwin$B4D6-2<$G(B make install $B$r<B9T$7$^$9!#(B
+
+    $B"((B $B%$%s%9%H!<%k @ h%G%#%l%/%H%j$O(B Makefile $BCf(B BINDIR $B$G @ _Dj$7$F$*$-$^$9!#(B
+       BINDIR $B$K(B cygterm.exe $B$H(B cygterm.cfg $B$,%$%s%9%H!<%k$5$l$^$9!#(B
+       cygterm.cfg $B$O>e=q$-$5$l$^$;$s!#(B
+
+// $B @ _(B $BDj(B $B%U(B $B%!(B $B%$(B $B%k(B //
+
+    cygterm.cfg $B$O @ _Dj%U%!%$%k$G$9!#(B $B;HMQ$9$kC<Kv%(%_%e%l!<%?$N%3%^%s%I%i%$%s(B
+    $B$d5/F0$9$k%7%'%k$N%3%^%s%I%i%$%sEy$r @ _Dj$7$^$9!#(B
+    cygterm.cfg $B$O(B cygterm.exe $B$HF1$8%G%#%l%/%H%j$K$J$$$H$$$1$^$;$s!#(B
+
+      cygterm.cfg $B$NNc(B
+      +-----------------------------------------------------------------------
+      | TERM = C:\program files\ttermpro\ttermpro.exe %s %d /KR=SJIS /KT=SJIS
+      | TERM_TYPE = vt100
+      | PORT_START = 20000
+      | PORT_RANGE = 40
+      | SHELL = /bin/bash
+      | ENV_1 = MAKE_MODE=unix
+      | ENV_2 = HOME=/home
+      |   :         :
+
+    TERM
+    ----
+        $B%?!<%_%J%k!&%(%_%e%l!<%?$N5/F0%3%^%s%I%i%$%s$G$9!#(B
+        $B%3%^%s%IL>$O(B Windows$B4D6-$G%Q%9$,DL$C$F$J$1$l$P%U%k%Q%9$G=q$-$^$9!#(B
+        $B%[%9%H;XDj$N$H$3$m$O(B %s $B$H$7!"%]!<%H;XDj$N$H$3$m$O(B %d $B$H$7$^$9!#(B
+
+    TERM_TYPE
+    ---------
+        $B%?!<%_%J%k!&%(%_%e%l!<%?$,%?!<%_%J%k%?%$%W$rM?$($F$/$l$J$+$C$?(B
+        $B>l9g$K:NMQ$9$k%?!<%_%J%k%?%$%W$G$9!#(B ($B%G%U%)%k%H(B:vt100)
+        $B%7%'%k>e!"4D6-JQ?t(B TERM $B$K%;%C%H$5$l$^$9!#(B
+
+    PORT_START
+    ----------
+        $B;H$$;O$a$k(B ($B;H$C$F$h$$:G>.$N(B) $B%]!<%HHV9f$G$9!#(B ($B%G%U%)%k%H(B:20000)
+
+    PORT_RANGE
+    ----------
+        $B;H$C$F$h$$%]!<%HHV9f$N8D?t$G$9!#(B ($B%G%U%)%k%H(B:40)
+
+        PORT_START $B!A(B PORT_START+PORT_RANGE $B$NHO0O$G6u$-%]!<%H$rC5$7$^$9!#(B
+        $B$3$N?t$@$1F1;~<B9T$G$-$k$3$H$K$J$j$^$9!#(B
+
+    SHELL
+    -----
+        Cygwin$BB&%7%'%k(B ($BDL>o(B /bin/bash) $B$N5/F0%3%^%s%I%i%$%s$G$9!#(B
+        ($B%G%U%)%k%H(B: /etc/passwd$B$N>pJs$r;HMQ(B)
+        $B%3%^%s%IL>$N%U%k%Q%9$+!"(B"AUTO"$B$r;XDj$7$^$9!#(B
+
+    LOGIN_SHELL
+    -----------
+        $B%7%'%k$r%m%0%$%s%7%'%k$H$7$F5/F0$9$k$+$I$&$+$r;XDj$7$^$9!#(B
+        $B%G%U%)%k%H$OL58z$G$9!#(B
+
+        $B0lHLE*$J%7%'%k$G$O%m%0%$%s%7%'%k$H$7$F5/F0$5$l$k$H!"(B.profile$B$d(B
+        .login$B$J$I$N%m%0%$%s;~$N$_FI$_9~$`%9%?!<%H%"%C%W%U%!%$%k$r<B9T(B
+        $B$7$^$9!#(B
+        $B$3$l$i$N%U%!%$%k$G$O!"DL>o!"0J2<$N$h$&$J;v$,9T$o$l$^$9!#(B
+        $B!&(BPATH$B$d(BUSER$BEy$N3F<o4D6-JQ?t$N @ _Dj$r9T$&(B
+        $B!&C<Kv$N @ _Dj$rE, @ Z$K9T$&(B
+        $B!&%+%l%s%H%G%#%l%/%H%j$r%f!<%6$N%[!<%`%G%#%l%/%H%j$KJQ99$9$k!#(B
+
+        $B0lIt$N%7%'%k(B(tclsh$B$J$I(B)$B$d%7%'%k0J30$N%W%m%0%i%`$r5/F0$9$k>l9g$O(B
+        $B8z2L$,$"$j$^$;$s!#(B
+
+    HOME_CHDIR
+    ----------
+        patch level 01 $B$K4^$^$l$k(B"$B%[!<%`%G%#%l%/%H%j$X$N0\F0(B"$B$r5!G=$5$;$k$+(B
+        $B$I$&$+$r;XDj$7$^$9!#%G%U%)%k%H$OL58z$G$9!#(B
+
+    SOCKET_TIMEOUT
+    --------------
+        $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i$N(Btelnet$B@\B3$rBT$A<u$1$k%=%1%C%H$,(B
+        $B%?%$%`%"%&%H$9$k$^$G$N;~4V$r;XDj$7$^$9!#(B ($B%G%U%)%k%H(B: 5$BIC(B)
+
+    SSH_AGENT_PROXY
+    ---------------
+        ssh$BG'>Z%(!<%8%'%s%HE>Aw5!G=$rDs6!$9$k$+$r;XDj$7$^$9!#(B
+        $BM-8z$K$9$k$H!"(BOpenSSH$B$N(Bssh$BG'>Z%(!<%8%'%s%H$KBP1~$7$?%W%m%0%i%`$,!"(B
+        CygTerm+$B$rDL$7$F(BPageant$B$K%"%/%;%9$G$-$k$h$&$K$J$j$^$9!#(B
+        $B%G%U%)%k%H$OL58z$G$9!#(B
+
+    ENV_X
+    -----
+        $B%7%'%k5/F0;~$K @ _Dj$7$F$*$-$?$$4D6-JQ?t$G$9!#!VJQ?tL>(B=$BCM!W$N7A<0(B
+        (putenv$B7A<0(B) $B$G5-=R$7$^$9!#(B ENV_ $B$G;O$a$l$P$$$/$D$G$b5-=R$G$-$^$9!#(B
+
+
+// $B5/(B $BF0(B $BJ}(B $BK!(B //
+
+    $B%3%^%s%I%i%$%s!&%*%W%7%g%s(B
+
+        cygterm.exe [-t 'terminal-emulator'] [-p port-number] [-dumb]
+                    [-s 'shell'] [-ls | -nols] [-cd | -nocd] [-a | -A]
+                    [-v 'env-var' ...] [-d 'directory'] [-o 'parameter']
+
+        -t 'terminal-emulator'
+                $B%?!<%_%J%k!&%(%_%e%l!<%?$r;XDj$7$^$9!#(B
+                $B;XDj7A<0$O @ _Dj%U%!%$%k$N(B TERM $B$HF1$8$G$9!#(B
+                $B6uGrJ8;z$r4^$`>l9g$OI,$:%/%)!<%H$G0O$_$^$9!#(B
+
+        -p port-number
+                $B%?!<%_%J%k!&%(%_%e%l!<%?$r5/F0$9$k$N$G$O$J$/!"(B
+                $B%m!<%+%k%[%9%H$N$3$N%]!<%HHV9f$X$N@\B3$r;n$_$^$9!#(B
+                $BB>$N%"%W%j%1!<%7%g%s!&%W%m%0%i%`$,(B -p $B%*%W%7%g%s$r;H$C$F!"(B
+                cygterm.exe $B7PM3$G(B Cygwin$B$rMxMQ$9$k!"Ey$,9M$($i$l$^$9!#(B
+
+        -dumb
+                TELNET$B%*%W%7%g%s!&%M%4%7%(!<%7%g%s$r9T$$$^$;$s!#(B
+                $B$5$i$K(B TELNET$B%3%^%s%I$,Aw?.$5$l$F$-$F$bL5;k$7$^$9!#(B
+                $B%7%'%kB&$N4D6-JQ?t(B TERM $B$O(B 'dumb' $B$H$J$j$^$9!#(B
+
+        -s 'shell'
+                Cygwin$B>e$N%7%'%k$r;XDj$7$^$9!#(B
+                $B;XDj7A<0$O @ _Dj%U%!%$%k$N(B SHELL $B$HF1$8$G$9!#(B
+                $B6uGrJ8;z$r4^$`>l9g$OI,$:%/%)!<%H$G0O$_$^$9!#(B
+                $BI,$:$7$b%7%'%k%3%^%s%I$G$"$kI,MW$O$"$j$^$;$s!#(B
+
+        -ls
+                $B%7%'%k$r%m%0%$%s%7%'%k$H$7$F5/F0$7$^$9!#(B
+
+        -nols
+                $B%7%'%k$r(B($B%m%0%$%s%7%'%k$G$O$J$/(B)$BDL>o$N%7%'%k$H$7$F5/F0$7$^$9!#(B
+
+        -cd
+                $B%+%l%s%H%G%#%l%/%H%j$r%[!<%`%G%#%l%/%H%j$K0\F0$7$F$+$i(B
+                $B%7%'%k$r5/F0$7$^$9!#(B
+
+        -nocd
+                $B%+%l%s%H%G%#%l%/%H%j$r0\F0$;$:$K%7%'%k$r5/F0$7$^$9!#(B
+
+        -A
+                ssh$BG'>Z%(!<%8%'%s%HE>Aw5!G=$rM-8z$K$7$^$9!#(B
+
+        -a
+                ssh$BG'>Z%(!<%8%'%s%HE>Aw5!G=$rL58z$K$7$^$9!#(B
+
+        -v 'env-var'
+                $B%7%'%k5/F0;~$K @ _Dj$7$F$*$-$?$$4D6-JQ?t$r;XDj$7$^$9!#(B
+                $B;XDj7A<0$O @ _Dj%U%!%$%k$N(B ENV_X $B$HF1$8$G$9!#(B
+                $B6uGrJ8;z$r4^$`>l9g$OI,$:%/%)!<%H$G0O$_$^$9!#(B
+                -v $B%*%W%7%g%s$O$$$/$D$G$b;XDj$G$-$^$9!#(B
+
+        -d 'directory'
+                $B%+%l%s%H%G%#%l%/%H%j$r;XDj$5$l$?%G%#%l%/%H%j$K0\F0$7$F$+$i(B
+                $B%7%'%k$r5/F0$7$^$9!#(B
+
+        -o 'parameter'
+                $B%?!<%_%J%k!&%(%_%e%l!<%?$X$NDI2C$N%Q%i%a!<%?$r;XDj$7$^$9!#(B
+                TERM$B$rJQ$($:$KDI2C$N%Q%i%a!<%?$r;XDj$7$?$$;~$K;H$$$^$9!#(B
+
+    $B%?!<%_%J%k!&%(%_%e%l!<%?$b$7$/$O@\B3 @ h%]!<%HHV9f!"$H(B Cygwin$BB&%7%'%k$N(B
+    $B;XDj$,:GDcI,MW$H$J$j$^$9!#(B $B$3$l$i$,%3%^%s%I%i%$%s!&%*%W%7%g%s$K$h$C$F(B
+    $BM?$($i$l$k$J$i$P!"@_Dj%U%!%$%k(B cygterm.cfg $B$,L5$/$F$b<B9T$G$-$^$9!#(B
+
+    cygterm.exe $B$O(B cygwin1.dll $B$rMxMQ$9$k(B Win32$B%"%W%j%1!<%7%g%s$G$9!#(B
+    Cygwin$B>e$+$i<B9T$9$k$3$H$b!"(BWindows$B>e$N%7%g!<%H%+%C%H$+$i<B9T$9$k$3$H$b(B
+    $B$G$-$^$9!#(B
+
+    $B"((B Windows$B>e$+$i<B9T$9$k$K$O(B cygwin1.dll $B$N%G%#%l%/%H%j%Q%9$,(B
+       Windows$B4D6-JQ?t(B PATH $B$KDI2C$5$l$F$$$kI,MW$,$"$j$^$9!#(B
+       ($BDL>o(B Cygwin$B%k!<%H%G%#%l%/%H%j(B\bin)
+
+// $BCm(B $B0U(B $B;v(B $B9`(B //
+
+    * Tera Term$B;HMQ;~$NCm0U(B
+
+    $B%?!<%_%J%k!&%(%_%e%l!<%?$,(B Tera Term $B$N>l9g!"(Bcygterm.exe $B$+$i5/F0$5$l$?(B
+    $B>uBV$G @ _DjJ]B8(B [Setup][Save setup] $B$r9T$o$J$$$h$&Cm0U$7$F$/$@$5$$!#(B
+    TCP/IP$B @ _Dj$N(B Telnet$B%]!<%HHV9f$,(B 23 $B0J30$GJ]B8$5$l!"DL>o$N(B Telnet$BL\E*$N(B
+    $B<B9T;~$K@\B3$G$-$:!"92$F$k$3$H$K$J$C$F$7$^$$$^$9!#(B
+    TCP/IP Port# $B$K(B 23 $B$r;XDj$7$F @ _DjJ]B8$7D>$;$P85$KLa$j$^$9!#(B
+
+// $BF0(B $B:n(B $B3N(B $BG'(B //
+
+    2010$BG/(B 10$B7n8=:_!"0J2<$N4D6-$GF0:n$,3NG'$G$-$F$$$^$9!#(B
+
+        WindowsXP SP3 + Cygwin 1.5.25-15
+        WindowsXP SP3 + Cygwin 1.7.7
+
+        $B%?!<%_%J%k%(%_%e%l!<%?(B
+                Tera Term Pro 2.3
+                Tera Term 4.67
+                PuTTY 0.60
+        $B%7%'%k(B
+                bash 3.2.51
+                zsh 4.3.10
+
+// $BJQ(B $B99(B $BMz(B $BNr(B //
+v1.07_29 2016/11/26 (by maya)
+        * $B%"%$%3%s$rJQ99$7$?!#(B
+
+v1.07_28 2016/02/17 (by doda)
+        * $B%G%P%C%0%b!<%I$rDI2C$7$?!#(B
+
+v1.07_27 2016/02/09 (by doda)
+        * -cd $B%*%W%7%g%s(B(HOME_CHDIR=y) $B$h$j(B -d $B%*%W%7%g%s$G$N%G%#%l%/(B
+          $B%H%j;XDj$rM%@h$9$k$h$&$K$7$?!#(B
+        * -ls $B%*%W%7%g%s(B(LOGIN_SHELL=y) $B$N;XDj;~$K(B -d $B%*%W%7%g%s$r;XDj(B
+          $B$7$?>l9g!"(BCHERE_INVOKING=y $B$r%;%C%H$9$k$h$&$K$7$?!#(B
+
+v1.07_26 2015/12/14 (by doda)
+        * ssh $BG'>Z%(!<%8%'%s%HE>Aw$GJ#?t%3%M%/%7%g%s$KBP1~$7$?!#(B
+
+v1.07_25 2015/02/21 (by doda)
+        * TERM $B4D6-JQ?t$, @ 5$7$/@_Dj$5$l$k$h$&$K$7$?!#(B
+
+v1.07_24 2013/08/15 (by maya)
+        * 64bit Cygwin $B$G$bF0:n$9$k$h$&$K$7$?!#(B (cyglaunch)
+
+v1.07_23 2011/04/18 (by doda)
+        * -d $B%*%W%7%g%s$G;XDj$5$l$?%G%#%l%/%H%j$X$N0\F0$,<:GT$7$?;~!"(B
+	  $B%(%i!<%a%C%;!<%8$rI=<($9$k$h$&$K$7$?!#(B
+
+v1.07_22 2011/03/03 (by maya)
+        * $B%$%s%9%H!<%i$+$i5/F0%A%'%C%/$r$9$k$?$a$N(B mutex $B$r:o=|$7$?!#(B
+
+v1.07_21 2011/02/28 (by maya)
+        * $B%$%s%9%H!<%i$+$i5/F0%A%'%C%/$r$9$k$?$a$N(B mutex $B$rDI2C$7$?!#(B
+
+v1.07_20 2010/10/20 (by doda)
+        * '-d' $B%*%W%7%g%s$G$N%G%#%l%/%H%jJQ99$N%?%$%_%s%0$rCY$i$;$?!#(B
+	  (security fix)
+
+v1.07_19 2010/01/28 (by doda)
+        * '-s' $B%*%W%7%g%s$N0z?t$K(B 'AUTO' $B$r<u$1IU$1$k$h$&$K$7$?!#(B
+
+v1.07_18 2010/01/19 (by doda)
+        * '-d' $B%*%W%7%g%s$N0z?t$+$iFs=E0zMQId$r:o=|$9$k$h$&$K$7$?!#(B
+
+v1.07_17 2009/06/16 (by doda)
+        * TELNET SGA/ECHO$B%*%W%7%g%s$N%M%4%7%(!<%7%g%s$r9T$&$h$&$K$7$?!#(B
+
+v1.07_16 2008/11/21 (by doda)
+        * ssh $BG'>Z%(!<%8%'%s%HE>Aw5!G=$rM-8z$K$9$k%*%W%7%g%s$r(B '-a' $B$+$i(B
+          '-A' $B$KJQ99$7$?!#(B
+        * ssh $BG'>Z%(!<%8%'%s%HE>Aw5!G=$rL58z$K$9$k%*%W%7%g%s(B '-a' $B$rDI2C$7$?!#(B
+
+v1.07_15 2008/11/01 (by doda)
+        * ssh $BG'>Z%(!<%8%'%s%HE>Aw5!G=$r%5%]!<%H$7$?!#(B
+
+v1.07_14 2007/12/17 (by doda)
+        * $B%?!<%_%J%k!&%(%_%e%l!<%?$NDI2C$N%Q%i%a!<%?$r;XDj$9$k%*%W%7%g%s(B
+          '-o' $B$rDI2C$7$?!#(B
+
+v1.07_13 2007/08/03 (by maya)
+        * $B3+;O%G%#%l%/%H%j$r;XDj$9$k(B '-d' $B%*%W%7%g%s$rDI2C$7$?!#(B
+
+v1.07_12 2007/06/10 (by doda)
+        * telnet $B$NBT$A<u$1%=%1%C%H$N%?%$%`%"%&%H$r @ _Dj$9$k%*%W%7%g%s(B
+          SOCKET_TIMEOUT $B$rDI2C$7$?!#(B
+
+          SOCKET_TIMEOUT = $BIC?t(B
+
+v1.07_11 2007/01/31 (import from cygterm v1.07)
+        * gcc 3.4 $B$G$N(B WinMainCRTStartup() $B:FDj5A%(%i!<2sHr(B
+        * $BO"B3=PNO;~$G$b%-!<%\!<%I3d$j9~$_$,F~$k$h$&$K!#(B
+
+v1.06_11 2006/09/29 (by maya)
+        * $B4D6-JQ?t$H(B /etc/passwd $B$N(B HOME $B$r;H$o$J$$$h$&$K$7$?!#(B
+          Cygwin $B$K$h$C$F%;%C%H$5$l$?(B HOME $B$,MxMQ$5$l$k!#4XO"9`L\(B /etc/profile
+        * $B @ _Dj%U%!%$%k$NM%@h=g0L$rJQ99$7$?!#(B
+          $B%3%^%s%I%i%$%s0z?t(B > ~/.cygtermrc > /etc/cygterm.conf > cygterm.cfg
+          > /etc/passwd
+
+v1.06_10 2006/09/28 (by doda)
+        * $B%f!<%6L>$rF@$k$N$K!"4D6-JQ?t(B USERNAME $B$NBe$o$j$K(B getlogin() $B$r;H$&(B
+          $B$h$&$K$7$?!#(B
+
+v1.06_09 2006/09/25 (by doda)
+        * SHELL$B$, @ _Dj$5$l$F$$$J$$>l9g$O!"(B/etc/passwd $B$+$i%7%'%k$N>pJs$rF@$k(B
+          $B$h$&$K$7$?!#(B
+
+v1.06_08 2006/08/30 (by maya)
+        * cygterm.cfg $B$r @ _Dj%U%!%$%k$NCf$G:GM%@h$5$l$k$h$&$K$7$?!#(B
+
+v1.06_07 2006/08/19 (by maya)
+        * Windows $B$N(B $B4D6-JQ?t(B HOME $B$, @ _Dj$5$l$F$$$l$P;H$&$h$&$K$7$?!#(B
+
+v1.06_06 2006/08/18 (by doda)
+        * -s$B$H(B-t$B%*%W%7%g%s$N%Q%i%a!<%?$ND9$5$r@)8B$7$?!#(B
+
+v1.06_05 2006/08/18 (by maya)
+        * $B%$%s%9%H!<%i$+$i5/F0%A%'%C%/$r$9$k$?$a!"(Bmutex $B$r:n @ .$7$?!#(B
+
+v1.06_04 2006/08/15 (by doda)
+        * $B%7%'%k$r%m%0%$%s%7%'%k$H$7$F8F$S=P$9%*%W%7%g%s(B LOGIN_SHELL $B$r(B
+          $BDI2C$7$?!#(B
+
+          LOGIN_SHELL: yes | no
+
+v1.06_03 2006/08/15 (by doda)
+        * $B%[!<%`%G%#%l%/%H%j$G5/F0$9$k$N$rA*Br$9$k%*%W%7%g%s(B HOME_CHDIR $B$r(B
+          $BDI2C$7$?!#(B
+
+          HOME_CHDIR: yes | no
+
+v1.06_02 2006/02/09 (by babyd****@yahoo*****)
+        * CygTerm$B$N%"%$%3%s$,:n @ .$5$l$^$7$?!#!J(B"DotWork 2.50"$B$K$F:n @ .!K(B
+          "DotWork 2.50" $B$O1&5-$N(BURL$B$h$jF~<j2DG=$G$9!#(B
+          http://www5a.biglobe.ne.jp/~suuta/
+          $B$9$P$i$7$$%=%U%H%&%'%"$r8x3+$7$F$$$?$@$-!"(B
+          "suuta at hamal dot freemal dot ne dot jp"$B$K46<UCW$7$^$9!#(B
+
+        * Makefile $B$,=$@5$5$l$^$7$?!#(B"clean" $B%?!<%2%C%H$G(B cygterm.ico $B$r:o=|(B
+          $B$7$J$$$h$&$K!#(B
+
+v1.06_01 2006/02/08 (by babyd****@yahoo*****)
+        * $B0J2<$N @ _Dj%U%!%$%k$NFI$_9~$_$r%5%]!<%H(B:
+            + /etc/cygterm.conf
+            + ~/.cygtermrc
+
+        * $B%7%'%k$,%f!<%6$N%[!<%`%G%#%l%/%H%j$G5/F0$5$l$k$h$&$K!#(B
+
+        * $B%"%+%&%s%H$N @ _Dj>pJs$r(B /etc/passwd $B$+$i(B getpwnam(3) $B$GFI$_9~$`$h$&$K!#(B
+          $B%"%+%&%s%HL>$O4D6-JQ?t(B USERNAME $B$+$i(Bgetenv(3) $B$G<hF@$7$F$^$9!#(B
+
+        * Makefile $B=$@5!'%G%#%U%)%k%H$G%"%$%3%s$D$-$N(B .exe $B$r%S%k%I$7$^$9!#(B
+
+v1.06 2004/01/24
+        * $B%3%^%s%I%i%$%s!&%*%W%7%g%s$rDI2C!#(B
+            -t 'terminal-emulator' ($B%?!<%_%J%k!&%(%_%e%l!<%?;XDj(B)
+            -p port-number ($B@\B3 @ h%]!<%HHV9f;XDj(B)
+            -dumb ($B%@%`%?!<%_%J%k;XDj(B)
+            -s 'shell' ($B%7%'%k;XDj(B)
+            -v 'env-var' ($B4D6-JQ?t;XDj(B)
+
+        * Makefile$B=$@5(B
+          make install $B$G(B BINDIR $B$,B8:_$7$J$1$l$P%(%i!<$K$J$k$h$&$K!#(B
+
+        * $B%=!<%9%U%!%$%k1QJ82=(B (cygterm.cc, README.txt)
+
+v1.05 2003/01/14
+        * Ctrl+SPACE(NUL)$B$,Aw?.$G$-$k$h$&$K=$@5!#(B
+          $B2~9T%3!<%I(B CR+NUL $B$r=hM}$9$kJ}K!$H$7$FC1=c$K(B NUL$BJ8;z$rL5;k$7$F$$$?(B
+          $B$?$a!"(BCtrl+SPACE $B2!2<;~$G$b(B NUL $B$,Aw?.$5$l$J$+$C$?!#(B
+
+v1.04 2002/12/08
+        * $B%?!<%_%J%k!&%(%_%e%l!<%?$*$h$S%7%'%k$N5/F0$K<:GT$7$?$H$-$K(B
+          $B%(%i!<%a%C%;!<%8$rI=<($9$k$h$&$K$7$?!#(B
+
+        * Makefile$B=$@5(B
+          make install $B$G(B cygterm.cfg $B$r>e=q$-$7$J$$$h$&$K!#(B
+          gcc$B%*%W%7%g%s$K(B -fno-exceptions $B$rDI2C!"(BGCC-3$B$N%j%s%/%(%i!<2sHr!#(B
+
+v1.03 2002/07/24
+        * $B%?!<%_%J%k!&%(%_%e%l!<%?$,DLCN$7$F$/$k%?!<%_%J%k%?%$%W$K!"BgJ8;z$,(B
+          $B4^$^$l$F$$$l$P!"$=$l$r>.J8;z$KJQ49$9$k$h$&$K=$@5!#(B
+          $B%?!<%_%J%k!&%(%_%e%l!<%?$K$h$C$F$O4D6-JQ?t(B TERM $B$NCM$,(B 'ANSI' 'VT100'
+          $B$N$h$&$KBgJ8;z$K$j(B terminfo $B$K%^%C%A$7$J$$$?$a!#(B
+          (Windows 2000 telnet.exe $BEy(B)
+
+v1.02 2002/07/22
+        * $B%?!<%_%J%k!&%(%_%e%l!<%?$,%3%s%=!<%k!&%"%W%j%1!<%7%g%s$N$H$-$K5/F0(B
+          $B$G$-$J$+$C$?$N$r=$@5!#(B(Windows 2000 telnet.exe $BEy(B)
+          CreateProcess()$B8F=P$7%_%9!#(B
+
+        * $B%?!<%_%J%k!&%(%_%e%l!<%?$+$i(B CR+LF $B$,Aw$i$l$F$-$?$i(B LF $B$OE>Aw$7$J$$(B
+          $B$h$&$K$7!"2~9T$,#22sH/@8$9$k$N$r=$@5!#(B(Windows 98 telnet.exe $BEy(B)
+
+        * $B%P!<%8%g%sHV9f$r(B cygterm.exe $B$KKd$a9~$`$h$&$K$7$?!#(B
+          $B3NG'J}K!$O(B $ strings cygterm.exe | grep version
+
+v1.01 2002/07/19
+        * zsh, tcsh $B$GF0:n$7$J$+$C$?$N$r=$@5!#5<;wC<Kv$N%*!<%W%sJ}K!$,0-$/!"(B
+          zsh, tcsh $B$G$O5/F0$H$H$b$KF~NO$,%V%m%C%/$5$l$?!#(B
+
+v1.00 2000/12/17
+        * $B=i4|%P!<%8%g%s40 @ .(B
+

Added: trunk/cygwin/cygterm/build_cygterm.cmake
===================================================================
--- trunk/cygwin/cygterm/build_cygterm.cmake	                        (rev 0)
+++ trunk/cygwin/cygterm/build_cygterm.cmake	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,36 @@
+
+if(NOT DEFINED CYGWIN_PATH)
+  set(CYGWIN_PATH "C:/cygwin64/bin")
+  if (NOT EXISTS ${CYGWIN_PATH})
+    set(CYGWIN_PATH "C:/cygwin/bin")
+    if (NOT EXISTS ${CYGWIN_PATH})
+      message(FATAL_ERROR "Not found cygwin")
+    endif()
+  endif()
+endif()
+if (NOT EXISTS ${CYGWIN_PATH}/gcc.exe)
+  # package gcc-core
+  message("CYGWIN_PATH=${CYGWIN_PATH}")
+  message(FATAL_ERROR "Not found cygwin gcc")
+endif()
+if (NOT EXISTS ${CYGWIN_PATH}/g++.exe)
+  # package gpp
+  message(FATAL_ERROR "Not found cygwin g++")
+endif()
+
+# package mingw64-x86_64-gcc-core
+
+message("build_cygterm.cmake")
+message("CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
+message("CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}")
+message("CMAKE_CURRENT_LIST_DIR=${CMAKE_CURRENT_LIST_DIR}")
+message("CYGWIN_PATH=${CYGWIN_PATH}")
+set(ENV{PATH} ${CYGWIN_PATH})
+execute_process(
+  COMMAND make all
+  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
+  RESULT_VARIABLE rv
+  )
+if(NOT rv STREQUAL "0")
+  message(FATAL_ERROR "cygterm build error")
+endif()

Copied: trunk/cygwin/cygterm/cyglaunch.c (from rev 9515, trunk/cygterm/cyglaunch.c)
===================================================================
--- trunk/cygwin/cygterm/cyglaunch.c	                        (rev 0)
+++ trunk/cygwin/cygterm/cyglaunch.c	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,145 @@
+//
+// Cygterm launcher
+//
+// (C) 2007- TeraTerm Project
+//   https://ttssh2.osdn.jp/
+//
+// [How to compile]
+// Cygwin:
+//  # cc -mno-cygwin -mwindows -o cyglaunch cyglaunch.c
+//
+
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <direct.h>
+
+#define Section "Tera Term"
+char *FName = "TERATERM.INI";
+
+
+//
+// Connect to local cygwin
+//
+void OnCygwinConnection(char *CygwinDirectory, char *cmdline)
+{
+	char file[MAX_PATH], *filename;
+	char c, *envptr, *envbuff;
+	int envbufflen;
+	char *exename = "cygterm.exe";
+	char cmd[1024];
+	STARTUPINFO si;
+	PROCESS_INFORMATION pi;
+
+	if (strlen(CygwinDirectory) > 0) {
+		if (SearchPath(CygwinDirectory, "bin\\cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+			goto found_dll;
+		}
+	}
+
+	if (SearchPath(NULL, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+		goto found_path;
+	}
+
+	for (c = 'C' ; c <= 'Z' ; c++) {
+		char tmp[MAX_PATH];
+		sprintf(tmp, "%c:\\cygwin\\bin;%c:\\cygwin64\\bin", c, c);
+		if (SearchPath(tmp, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+			goto found_dll;
+		}
+	}
+
+	MessageBox(NULL, "Can't find Cygwin directory.", "ERROR", MB_OK | MB_ICONWARNING);
+	return;
+
+found_dll:;
+	envptr = getenv("PATH");
+	file[strlen(file)-12] = '\0'; // delete "\\cygwin1.dll"
+	if (envptr != NULL) {
+		envbufflen = strlen(file) + strlen(envptr) + 7; // "PATH="(5) + ";"(1) + NUL(1)
+		if ((envbuff=malloc(envbufflen)) == NULL) {
+			MessageBox(NULL, "Can't allocate memory.", "ERROR", MB_OK | MB_ICONWARNING);
+			return;
+		}
+		_snprintf(envbuff, envbufflen, "PATH=%s;%s", file, envptr);
+	} else {
+		envbufflen = strlen(file) + strlen(envptr) + 6; // "PATH="(5) + NUL(1)
+		if ((envbuff=malloc(envbufflen)) == NULL) {
+			MessageBox(NULL, "Can't allocate memory.", "ERROR", MB_OK | MB_ICONWARNING);
+			return;
+		}
+		_snprintf(envbuff, envbufflen, "PATH=%s", file);
+	}
+	_putenv(envbuff);
+	if (envbuff) {
+		free(envbuff);
+		envbuff = NULL;
+	}
+
+found_path:;
+	memset(&si, 0, sizeof(si));
+	GetStartupInfo(&si);
+	memset(&pi, 0, sizeof(pi));
+
+	strcpy(cmd, exename);
+	strcat(cmd, " ");
+	strncat(cmd, cmdline, sizeof(cmd)-strlen(cmd)-1);
+//printf("%s", cmd);
+//MessageBox(NULL, cmd, "", MB_OK);
+	if (CreateProcess(
+			NULL,
+			cmd,
+			NULL, NULL, FALSE, 0,
+			NULL, NULL,
+			&si, &pi) == 0) {
+		MessageBox(NULL, "Can't execute Cygterm.", "ERROR", MB_OK | MB_ICONWARNING);
+	}
+}
+
+
+int main(int argc, char** argv)
+{
+	char Temp[256], CygwinDir[256], Cmdline[256];
+	char *bs;
+	int i;
+	BOOL d_opt=FALSE;
+
+	if (GetModuleFileName(NULL, Temp, sizeof(Temp)) > 0 &&
+	   (bs = strrchr(Temp, '\\')) != NULL) {
+		*bs = 0;
+		_chdir(Temp);
+		_snprintf(bs, sizeof(Temp) + Temp - bs, "\\%s", FName);
+	}
+	else {
+		_snprintf(Temp, sizeof(Temp), ".\\", FName);
+	}
+
+	// Cygwin install path
+ 	GetPrivateProfileString(Section, "CygwinDirectory", "c:\\cygwin",
+			  CygwinDir, sizeof(CygwinDir), Temp);
+
+	//printf("%s %d\n", CygwinDir, GetLastError());
+
+	Cmdline[0] = 0;
+	for (i=1; i<argc; i++) {
+		if (i != 1) {
+			strncat(Cmdline, " ", sizeof(Cmdline)-strlen(Cmdline)-1);
+		}
+		if (d_opt && strncmp("\"\\\\", argv[i], 3) == 0) {
+			argv[i][1] = '/';
+			argv[i][2] = '/';
+		}
+		strncat(Cmdline, argv[i], sizeof(Cmdline)-strlen(Cmdline)-1);
+		if (strcmp(argv[i], "-d") == 0) {
+			d_opt = TRUE;
+		}
+		else {
+			d_opt = FALSE;
+		}
+	}
+	//printf("%s\n", Cmdline);
+
+	OnCygwinConnection(CygwinDir, Cmdline);
+
+	return 0;
+}

Copied: trunk/cygwin/cygterm/cygterm+-x86_64/cygterm.exe (from rev 9515, trunk/cygterm/cygterm+-x86_64/cygterm.exe)
===================================================================
(Binary files differ)

Copied: trunk/cygwin/cygterm/cygterm.bmp (from rev 9515, trunk/cygterm/cygterm.bmp)
===================================================================
(Binary files differ)

Copied: trunk/cygwin/cygterm/cygterm.cc (from rev 9515, trunk/cygterm/cygterm.cc)
===================================================================
--- trunk/cygwin/cygterm/cygterm.cc	                        (rev 0)
+++ trunk/cygwin/cygterm/cygterm.cc	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,1449 @@
+/////////////////////////////////////////////////////////////////////////////
+// CygTerm+ - yet another Cygwin console
+// Copyright (C) 2000-2006 NSym.
+// (C) 2006-2016 TeraTerm Project
+//---------------------------------------------------------------------------
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License (GPL) as published by
+// the Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+//---------------------------------------------------------------------------
+
+/////////////////////////////////////////////////////////////////////////////
+// CygTerm+ - yet another Cygwin console
+//
+//   Using Cygwin with a terminal emulator.
+//   
+//   Writtern by TeraTerm Project.
+//            https://ttssh2.osdn.jp/
+//   
+//   Original written by NSym.
+//                         *** Web Pages ***
+//  (English) http://www.dd.iij4u.or.jp/~nsym/cygwin/cygterm/index-e.html
+// (Japanese) http://www.dd.iij4u.or.jp/~nsym/cygwin/cygterm/index.html
+//
+
+static char Program[] = "CygTerm+";
+static char Version[] = "version 1.07_28 (2016/02/17)";
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <signal.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <termios.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <sys/wait.h>
+#include <arpa/inet.h>
+#include <windows.h>
+#include <pwd.h>
+#include <sys/select.h>
+
+// pageant support (ssh-agent proxy)
+//----------------------------------
+#define AGENT_COPYDATA_ID 0x804e50ba
+#define AGENT_MAX_MSGLEN 8192
+char sockdir[] = "/tmp/ssh-XXXXXXXXXX";
+char sockname[256];
+
+// PTY device name
+//----------------
+#define  DEVPTY  "/dev/ptmx"
+
+// TCP port for TELNET
+//--------------------
+int port_start = 20000;  // default lowest port number
+int port_range = 40;     // default number of ports
+
+// command lines of a terminal-emulator and a shell
+//-------------------------------------------------
+char cmd_term[256] = "";
+char cmd_termopt[256] = "";
+char cmd_shell[128] = "";
+char pw_shell[128] = "";
+char change_dir[256] = "";
+
+// TCP port for connection to another terminal application
+//--------------------------------------------------------
+int cl_port = 0;
+
+// telnet socket timeout
+//----------------------
+int telsock_timeout = 5;    // timeout 5 sec
+
+// dumb terminal flag
+//-------------------
+bool dumb = false;
+
+// chdir to HOME
+//--------------
+bool home_chdir = false;
+
+// login shell flag
+//-----------------
+bool enable_loginshell = false;
+
+// ssh agent proxy
+//----------------
+bool enable_agent_proxy = false;
+
+// terminal type & size
+//---------------------
+char term_type[41] = "";
+struct winsize win_size = {0,0,0,0};
+
+// debug mode
+//-----------
+bool debug_flag = false;
+
+// additional env vars given to a shell
+//-------------------------------------
+struct sh_env_t {
+    struct sh_env_t* next;
+    char env[1];
+} sh_env = {NULL, ""};
+
+sh_env_t* sh_envp = &sh_env;
+
+int add_env(sh_env_t** envp, const char* str, const char* str2)
+{
+	int len;
+	sh_env_t* e;
+
+	len = strlen(str);
+	if (str2) {
+		len += strlen(str2) + 1;
+	}
+
+	e = (sh_env_t*)malloc(sizeof(sh_env_t) + len);
+	if (e) {
+		if (str2) {
+			snprintf(e->env, len + 1, "%s=%s", str, str2);
+		}
+		else {
+			strcpy(e->env, str);
+		}
+		e->next = NULL;
+		*envp = ((*envp)->next = e);
+		return 1;
+	}
+	else {
+		return 0;
+	}
+}
+
+//================//
+// message output //
+//----------------//
+void msg_print(const char* msg)
+{
+    MessageBox(NULL, msg, Program, MB_OK | MB_ICONINFORMATION | MB_TOPMOST);
+}
+
+//=========================//
+// Win32-API error message //
+//-------------------------//
+void api_error(const char* string = NULL)
+{
+    char msg[1024];
+    char *ptr = msg;
+    if (string != NULL)
+        ptr += snprintf(ptr, sizeof(msg), "%s\n\n", string);
+    FormatMessage(
+        FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+        NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
+        ptr, sizeof(msg)-(ptr-msg), NULL
+    );
+    msg_print(msg);
+}
+
+//=========================//
+// C-runtime error message //
+//-------------------------//
+void c_error(const char* string = NULL)
+{
+    char msg[1024];
+    char *ptr = msg;
+    if (string != NULL)
+        ptr += snprintf(ptr, sizeof(msg), "%s\n\n", string);
+    snprintf(ptr, sizeof(msg)-(ptr-msg), "%s\n", strerror(errno));
+    msg_print(msg);
+}
+
+//======================//
+// debug message output //
+//======================//
+void debug_msg_print(const char* msg)
+{
+    if (debug_flag) {
+        msg_print(msg);
+    }
+}
+
+//==================================//
+// parse line in configuration file //
+//----------------------------------//
+void parse_cfg_line(char *buf)
+{
+    // "KEY = VALUE" format in each line.
+    // skip leading/trailing blanks. KEY is not case-sensitive.
+    char* p1;
+    for (p1 = buf; isspace(*p1); ++p1);
+    if (!isalpha(*p1)) {
+        return; // comment line with non-alphabet 1st char
+    }
+    char* name = p1;
+    for (++p1; isalnum(*p1) || *p1 == '_'; ++p1);
+    char* p2;
+    for (p2 = p1; isspace(*p2); ++p2);
+    if (*p2 != '=') {
+        return; // igonore line without '='
+    }
+    for (++p2; isspace(*p2); ++p2);
+    char* val = p2;
+    for (p2 += strlen(p2); isspace(*(p2-1)); --p2);
+    *p1 = *p2 = 0;
+
+    if (!strcasecmp(name, "TERM")) {
+        // terminal emulator command line (host:%s, port#:%d)
+        strncpy(cmd_term, val, sizeof(cmd_term)-1);
+        cmd_term[sizeof(cmd_term)-1] = 0;
+    }
+    else if (!strcasecmp(name, "SHELL")) {
+        // shell command line
+        if (strcasecmp(val, "AUTO") != 0) {
+            strncpy(cmd_shell, val, sizeof(cmd_shell)-1);
+        }
+	else {
+	    strncpy(cmd_shell, pw_shell, sizeof(cmd_shell)-1);
+	}
+	cmd_shell[sizeof(cmd_shell)-1] = 0;
+    }
+    else if (!strcasecmp(name, "PORT_START")) {
+        // minimum port# for TELNET
+        port_start = atoi(val);
+    }
+    else if (!strcasecmp(name, "PORT_RANGE")) {
+        // number of ports for TELNET
+        port_range = atoi(val);
+    }
+    else if (!strcasecmp(name, "TERM_TYPE")) {
+        // terminal type name (maybe overridden by TELNET negotiation.)
+        strncpy(term_type, val, sizeof(term_type)-1);
+        term_type[sizeof(term_type)-1] = 0;
+    }
+    else if (!strncasecmp(name, "ENV_", 4)) {
+        // additional env vars given to a shell
+	add_env(&sh_envp, val, NULL);
+    }
+    else if (!strcasecmp(name, "HOME_CHDIR")) {
+        // change directory to home
+        if (strchr("YyTt", *val) != NULL || atoi(val) > 0) {
+            home_chdir = true;
+        }
+    }
+    else if (!strcasecmp(name, "LOGIN_SHELL")) {
+        // execute a shell as a login shell
+        if (strchr("YyTt", *val) != NULL || atoi(val) > 0) {
+            enable_loginshell = true;
+        }
+    }
+    else if (!strcasecmp(name, "SOCKET_TIMEOUT")) {
+        // telnet socket timeout
+        telsock_timeout = atoi(val);
+    }
+    else if (!strcasecmp(name, "SSH_AGENT_PROXY")) {
+        // ssh-agent proxy
+        if (strchr("YyTt", *val) != NULL || atoi(val) > 0) {
+            enable_agent_proxy = true;
+        }
+    }
+    else if (!strcasecmp(name, "DEBUG")) {
+        // debug mode
+        if (strchr("YyTt", *val) != NULL || atoi(val) > 0) {
+            debug_flag = true;
+        }
+    }
+
+    return;
+}
+
+//====================//
+// load configuration //
+//--------------------//
+void load_cfg()
+{
+    // Windows system configuration file (.cfg) path
+    char win_conf[MAX_PATH];
+
+    // get cfg path from exe path
+    if (GetModuleFileName(NULL, win_conf, MAX_PATH) <= 0) {
+        return;
+    }
+    char* bs = strrchr(win_conf, '\\');
+    if (bs == NULL) {
+        return;
+    }
+    char* dot = strrchr(bs, '.');
+    if (dot == NULL) {
+        strcat(bs, ".cfg");
+    } else {
+        strcpy(dot, ".cfg");
+    }
+
+    char sys_conf[] = "/etc/cygterm.conf";
+
+    // user configuration file (~/.*rc) path
+    char usr_conf[MAX_PATH] = "";
+
+    // auto generated configuration file path
+    char tmp_conf[MAX_PATH] = "/tmp/cygtermrc.XXXXXX";
+
+    // get user name from getlogin().  if it fails, use $USERNAME instead.
+    // and get /etc/passwd information by getpwnam(3) with user name,
+    // and generate temporary configuration file by mktemp(3).
+    const char* username = getlogin();
+    if (username == NULL)
+        username = getenv("USERNAME");
+    if (username != NULL) {
+        struct passwd* pw_ent = getpwnam(username);
+        if (pw_ent != NULL) {
+	    strncpy(pw_shell, pw_ent->pw_shell, sizeof(pw_shell)-1);
+	    pw_shell[sizeof(pw_shell)-1] = 0;
+
+            strcpy(usr_conf, pw_ent->pw_dir);
+            strcat(usr_conf, "/.");
+            strcat(usr_conf, bs + 1);
+            char* dot = strrchr(usr_conf, '.');
+            if (dot == NULL) {
+                strcat(bs, "rc");
+            } else {
+                strcpy(dot, "rc");
+            }
+        }
+        int fd = mkstemp(tmp_conf);
+        FILE* fp = fdopen(fd, "w");
+        if (fp != NULL) {
+            if (pw_ent != NULL) {
+                fprintf(fp, "ENV_1=USER=%s\n",  pw_ent->pw_name);
+                fprintf(fp, "ENV_2=SHELL=%s\n", pw_ent->pw_shell);
+                fprintf(fp, "SHELL=%s\n", pw_ent->pw_shell);
+            } else {
+                fprintf(fp, "ENV_1=USER=%s\n",       username);
+            }
+            fclose(fp);
+        }
+    }
+
+    if (strcmp(usr_conf, "") == 0) {
+        strcpy(usr_conf, "");
+        strcpy(tmp_conf, "");
+    }
+
+    char *conf_path[] = { tmp_conf, win_conf, sys_conf, usr_conf };
+    for (int i = 0; i < 4; i++) {
+        // ignore empty configuration file path
+        if (strcmp(conf_path[i], "") == 0) {
+            continue;
+        }
+        // read each setting parameter
+        FILE* fp;
+        if ((fp = fopen(conf_path[i], "r")) == NULL) {
+            continue;
+        }
+        char buf[BUFSIZ];
+        while (fgets(buf, sizeof(buf), fp) != NULL) {
+            parse_cfg_line(buf);
+        }
+        fclose(fp);
+    }
+
+    // remove temporary configuration file, if it was generated.
+    if (strcmp(tmp_conf, "") != 0) {
+        unlink(tmp_conf);
+    }
+}
+
+void quote_cut(char *dst, size_t len, char *src) {
+	while (*src && len > 1) {
+		if (*src != '"') {
+			*dst++ = *src;
+		}
+		src++;
+	}
+	*dst = 0;
+}
+
+//=======================//
+// commandline arguments //
+//-----------------------//
+void get_args(int argc, char** argv)
+{
+    char tmp[sizeof(cmd_termopt)];
+
+    for (++argv; *argv != NULL; ++argv) {
+        if (!strcmp(*argv, "-t")) {             // -t <terminal emulator>
+            if (*++argv == NULL)
+                break;
+            strncpy(cmd_term, *argv, sizeof(cmd_term)-1);
+            cmd_term[sizeof(cmd_term)-1] = '\0';
+        }
+        else if (!strcmp(*argv, "-p")) {        // -p <port#>
+            if (*(argv+1) != NULL) {
+                ++argv, cl_port = atoi(*argv);
+            }
+        }
+        else if (!strcmp(*argv, "-dumb")) {     // -dumb
+            dumb = true;
+            strcpy(term_type, "dumb");
+        }
+        else if (!strcmp(*argv, "-s")) {        // -s <shell>
+            if (*++argv == NULL)
+                break;
+	    if (strcasecmp(*argv, "AUTO") != 0) {
+		strncpy(cmd_shell, *argv, sizeof(cmd_shell)-1);
+	    }
+	    else {
+		strncpy(cmd_shell, pw_shell, sizeof(cmd_shell)-1);
+	    }
+            cmd_shell[sizeof(cmd_shell)-1] = '\0';
+        }
+        else if (!strcmp(*argv, "-cd")) {       // -cd
+            home_chdir = true;
+        }
+        else if (!strcmp(*argv, "-nocd")) {     // -nocd
+            home_chdir = false;
+        }
+        else if (!strcmp(*argv, "+cd")) {       // +cd
+            home_chdir = false;
+        }
+        else if (!strcmp(*argv, "-ls")) {       // -ls
+            enable_loginshell = true;
+        }
+        else if (!strcmp(*argv, "-nols")) {     // -nols
+            enable_loginshell = false;
+        }
+        else if (!strcmp(*argv, "+ls")) {       // +ls
+            enable_loginshell = false;
+        }
+        else if (!strcmp(*argv, "-A")) {       // -A
+            enable_agent_proxy = true;
+        }
+        else if (!strcmp(*argv, "-a")) {       // -a
+            enable_agent_proxy = false;
+        }
+        else if (!strcmp(*argv, "-v")) {        // -v <additional env var>
+            if (*(argv+1) != NULL) {
+                ++argv;
+		add_env(&sh_envp, *argv, NULL);
+            }
+        }
+        else if (!strcmp(*argv, "-d")) {        // -d <exec directory>
+            if (*++argv == NULL)
+                break;
+            quote_cut(change_dir, sizeof(change_dir), *argv);
+        }
+        else if (!strcmp(*argv, "-o")) {        // -o <additional option for terminal>
+            if (*++argv == NULL)
+                break;
+            if (cmd_termopt[0] == '\0') {
+                strncpy(cmd_termopt, *argv, sizeof(cmd_termopt)-1);
+                cmd_termopt[sizeof(cmd_termopt)-1] = '\0';
+            }
+            else {
+                snprintf(tmp, sizeof(tmp), "%s %s", cmd_termopt, *argv);
+                strncpy(cmd_termopt, tmp, sizeof(cmd_termopt)-1);
+                cmd_termopt[sizeof(cmd_termopt)-1] = '\0';
+            }
+        }
+        else if (!strcmp(*argv, "-debug")) {    // -debug
+            debug_flag = true;
+        }
+    }
+}
+
+//===================================//
+// pageant support (ssh-agent proxy) //
+//-----------------------------------//
+unsigned long get_uint32(unsigned char *buff)
+{
+	return ((unsigned long)buff[0] << 24) +
+	       ((unsigned long)buff[1] << 16) +
+	       ((unsigned long)buff[2] <<  8) +
+	       ((unsigned long)buff[3]);
+}
+
+void set_uint32(unsigned char *buff, unsigned long v)
+{
+	buff[0] = (unsigned char)(v >> 24);
+	buff[1] = (unsigned char)(v >> 16);
+	buff[2] = (unsigned char)(v >>  8);
+	buff[3] = (unsigned char)v;
+	return;
+}
+
+unsigned long agent_request(unsigned char *out, unsigned long out_size, unsigned char *in)
+{
+	HWND hwnd;
+	char mapname[25];
+	HANDLE fmap = NULL;
+	unsigned char *p = NULL;
+	COPYDATASTRUCT cds;
+	unsigned long len;
+	unsigned long ret = 0;
+
+	if (out_size < 5) {
+		return 0;
+	}
+	if ((len = get_uint32(in)) > AGENT_MAX_MSGLEN) {
+		goto agent_error;
+	}
+
+	hwnd = FindWindow("Pageant", "Pageant");
+	if (!hwnd) {
+		goto agent_error;
+	}
+
+	sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId());
+	fmap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
+	                         0, AGENT_MAX_MSGLEN, mapname);
+	if (!fmap) {
+		goto agent_error;
+	}
+
+	if ((p = (unsigned char *)MapViewOfFile(fmap, FILE_MAP_WRITE, 0, 0, 0)) == NULL) {
+		goto agent_error;
+	}
+
+	cds.dwData = AGENT_COPYDATA_ID;
+	cds.cbData = strlen(mapname) + 1;
+	cds.lpData = mapname;
+
+	memcpy(p, in, len + 4);
+	if (SendMessage(hwnd, WM_COPYDATA, (WPARAM)NULL, (LPARAM)&cds) > 0) {
+		len = get_uint32(p);
+		if (out_size >= len + 4) {
+			memcpy(out, p, len + 4);
+			ret = len + 4;
+		}
+	}
+
+agent_error:
+	if (p) {
+		UnmapViewOfFile(p);
+	}
+	if (fmap) {
+		CloseHandle(fmap);
+	}
+	if (ret == 0) {
+		set_uint32(out, 1);
+		out[4] = 5; // SSH_AGENT_FAILURE
+	}
+
+	return ret;
+}
+
+void sighandler(int sig) {
+	unlink(sockname);
+	rmdir(sockdir);
+	exit(0);
+};
+
+struct connList {
+	int sock;
+	int recvlen;
+	int sendlen;
+	struct connList *next;
+	unsigned char ibuff[AGENT_MAX_MSGLEN];
+	unsigned char obuff[AGENT_MAX_MSGLEN];
+};
+
+int proc_recvd(struct connList *conn)
+{
+	int reqlen, len;
+
+	if (conn->sendlen > 0) {
+		return 0;
+	}
+
+	if (conn->recvlen < 4) {
+		return 0;
+	}
+
+	reqlen = get_uint32(conn->ibuff) + 4;
+	if (conn->recvlen < reqlen) {
+		return 0;
+	}
+
+	len = agent_request(conn->obuff, sizeof(conn->obuff), conn->ibuff);
+
+	if (len > 0) {
+		conn->sendlen = len;
+	}
+	else {
+		set_uint32(conn->obuff, 1);
+		conn->obuff[4] = 5; // SSH_AGENT_FAILURE
+		conn->sendlen = 1;
+	}
+
+	if (conn->recvlen == reqlen) {
+		conn->recvlen = 0;
+	}
+	else {
+		conn->recvlen -= reqlen;
+		memmove(conn->ibuff, conn->ibuff + reqlen, conn->recvlen);
+	}
+
+	return 1;
+}
+
+void agent_proxy()
+{
+	int sock, asock, ret;
+	long len;
+	unsigned long reqlen;
+	struct sockaddr_un addr;
+	unsigned char tmpbuff[AGENT_MAX_MSGLEN];
+	struct connList connections, *new_conn, *prev, *cur;
+	fd_set readfds, writefds, rfds, wfds;
+	struct sigaction act;
+	sigset_t blk;
+
+	connections.next = NULL;
+
+	if ((sock = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
+		c_error("agent_proxy: socket failed.");
+		exit(0);
+	}
+	memset(&addr, 0, sizeof(addr));
+	addr.sun_family = AF_UNIX;
+	strlcpy(addr.sun_path, sockname, sizeof(addr.sun_path));
+
+	if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+		goto agent_thread_cleanup;
+	}
+	if (listen(sock, -1) < 0) {
+		goto agent_thread_cleanup;
+	}
+
+	sigfillset(&blk);
+	sigdelset(&blk, SIGKILL);
+	sigdelset(&blk, SIGSTOP);
+
+	memset(&act, 0, sizeof(act));
+	act.sa_handler = sighandler;
+	act.sa_mask = blk;
+	sigaction(SIGINT, &act, NULL);
+	sigaction(SIGTERM, &act, NULL);
+	sigaction(SIGHUP, &act, NULL);
+	sigaction(SIGQUIT, &act, NULL);
+
+	FD_ZERO(&readfds);
+	FD_ZERO(&writefds);
+	FD_SET(sock, &readfds);
+
+	while (1) {
+		memcpy(&rfds, &readfds, sizeof(fd_set));
+		memcpy(&wfds, &writefds, sizeof(fd_set));
+
+		select(FD_SETSIZE, &rfds, &wfds, NULL, NULL);
+
+		if (FD_ISSET(sock, &rfds)) {
+			asock = accept(sock, NULL, NULL);
+			if (asock < 0) {
+				if (!(errno == EINTR || errno == ECONNABORTED)) {
+					break;
+				}
+			}
+			else {
+				new_conn = (struct connList *)malloc(sizeof(struct connList));
+				if (new_conn == NULL) {
+					// no memory
+					close(sock);
+				}
+				else {
+					new_conn->sock = asock;
+					new_conn->recvlen = 0;
+					new_conn->sendlen = 0;
+					new_conn->next = connections.next;
+					connections.next = new_conn;
+					FD_SET(asock, &readfds);
+				}
+			}
+		}
+
+		prev = &connections;
+		for (cur=connections.next; cur != NULL; cur = cur->next) {
+			if (FD_ISSET(cur->sock, &wfds)) {
+				if (cur->sendlen > 0) {
+					len = send(cur->sock, cur->obuff, cur->sendlen, 0);
+					if (len < 0) {
+						// write error
+						prev->next = cur->next;
+						shutdown(cur->sock, SHUT_RDWR);
+						close(cur->sock);
+						FD_CLR(cur->sock, &writefds);
+						FD_CLR(cur->sock, &readfds);
+						free(cur);
+						cur = prev;
+						continue;
+					}
+					else if (len >= cur->sendlen) {
+						cur->sendlen = 0;
+
+						sigprocmask(SIG_BLOCK, &blk, NULL);
+						ret = proc_recvd(cur);
+						sigprocmask(SIG_UNBLOCK, &blk, NULL);
+
+						if (ret) {
+							FD_SET(cur->sock, &writefds);
+							FD_CLR(cur->sock, &readfds);
+						}
+						else {
+							FD_CLR(cur->sock, &writefds);
+							FD_SET(cur->sock, &readfds);
+						}
+					}
+					else if (len > 0) {
+						cur->sendlen -= len;
+						memmove(cur->obuff, cur->obuff+len, cur->sendlen);
+					}
+				}
+				else {
+					FD_CLR(cur->sock, &writefds);
+				}
+			}
+
+			if (FD_ISSET(cur->sock, &rfds)) {
+				len = recv(cur->sock, cur->ibuff + cur->recvlen, sizeof(cur->ibuff) - cur->recvlen, 0);
+				if (len > 0) {
+					cur->recvlen += len;
+
+					sigprocmask(SIG_BLOCK, &blk, NULL);
+					ret = proc_recvd(cur);
+					sigprocmask(SIG_UNBLOCK, &blk, NULL);
+
+					if (ret) {
+						FD_SET(cur->sock, &writefds);
+						FD_CLR(cur->sock, &readfds);
+					}
+					else {
+						FD_CLR(cur->sock, &writefds);
+						FD_SET(cur->sock, &readfds);
+					}
+				}
+				else if (len <= 0) {
+					// read error
+					prev->next = cur->next;
+					shutdown(cur->sock, SHUT_RDWR);
+					close(cur->sock);
+					FD_CLR(cur->sock, &readfds);
+					FD_CLR(cur->sock, &writefds);
+					free(cur);
+					cur = prev;
+					continue;
+				}
+			}
+		}
+	}
+
+agent_thread_cleanup:
+	shutdown(sock, SHUT_RDWR);
+	close(sock);
+
+	unlink(sockname);
+	rmdir(sockdir);
+
+	exit(0);
+}
+
+int exec_agent_proxy()
+{
+	int pid;
+	int malloc_size;
+
+	if (mkdtemp(sockdir) == NULL) {
+		return -1;
+	}
+	snprintf(sockname, sizeof(sockname), "%s/agent.%ld", sockdir, getpid());
+
+	if (!add_env(&sh_envp, "SSH_AUTH_SOCK", sockname)) {
+		return -1;
+	}
+
+	if ((pid = fork()) < 0) {
+		return -1;
+	}
+	if (pid == 0) {
+		setsid();
+		agent_proxy();
+	}
+	return pid;
+}
+
+//=============================//
+// terminal emulator execution //
+//-----------------------------//
+DWORD WINAPI term_thread(LPVOID)
+{
+    STARTUPINFO si;
+    PROCESS_INFORMATION pi;
+    FillMemory(&si, sizeof(si), 0);
+    si.cb = sizeof(si);
+    si.dwFlags = STARTF_USESHOWWINDOW;
+    si.wShowWindow = SW_SHOW;
+    DWORD flag = 0;
+    if (!CreateProcess(
+         NULL, cmd_term, NULL, NULL, FALSE, flag, NULL, NULL, &si, &pi))
+    {
+        api_error(cmd_term);
+        return 0;
+    }
+    WaitForSingleObject(pi.hProcess, INFINITE);
+    CloseHandle(pi.hProcess);
+    CloseHandle(pi.hThread);
+    return 0;
+}
+
+//============================-==========//
+// thread creation for terminal emulator //
+//---------------------------------------//
+HANDLE exec_term()
+{
+    DWORD id;
+    return CreateThread(NULL, 0, term_thread, NULL, 0, &id);
+}
+
+//=======================================//
+// listener socket for TELNET connection //
+//---------------------------------------//
+int listen_telnet(u_short* port)
+{
+    int lsock;
+    if ((lsock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+        return -1;
+    }
+    struct sockaddr_in addr;
+    addr.sin_family = AF_INET;
+    addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+    int i;
+    for (i = 0; i < port_range; ++i) { // find an unused port#
+        addr.sin_port = htons(port_start + i);
+        if (bind(lsock, (struct sockaddr *)&addr, sizeof(addr)) == 0) {
+            break;
+        }
+    }
+    if (i == port_range) {
+        shutdown(lsock, 2);
+        close(lsock);
+        return -1;
+    }
+    if (listen(lsock, 1) != 0) {
+        shutdown(lsock, 2);
+        close(lsock);
+        return -1;
+    }
+    *port = addr.sin_port;
+    return lsock;
+}
+
+//=============================//
+// accept of TELNET connection //
+//-----------------------------//
+int accept_telnet(int lsock)
+{
+    fd_set rbits;
+    FD_ZERO(&rbits);
+    FD_SET(lsock, &rbits);
+    struct timeval tm;
+    tm.tv_sec = telsock_timeout;
+    tm.tv_usec = 0;
+    if (select(FD_SETSIZE, &rbits, 0, 0, &tm) <= 0) {
+        c_error("accept_telnet: select failed");
+        return -1;
+    }
+    if (!FD_ISSET(lsock, &rbits)) {
+        c_error("accept_telnet: FD_ISSET failed");
+        return -1;
+    }
+    int asock;
+    struct sockaddr_in addr;
+    int len = sizeof(addr);
+    if ((asock = accept(lsock, (struct sockaddr *)&addr, &len)) < 0) {
+        c_error("accept_telnet: accept failed");
+        return -1;
+    }
+    if (getpeername(asock, (struct sockaddr *)&addr, &len) != 0) {
+        c_error("accept_telnet: getpeername failed");
+        shutdown(asock, 2);
+        close(asock);
+        return -1;
+    }
+    if (addr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)) {
+        // reject it except local connection
+        msg_print("not local connection");
+        shutdown(asock, 2);
+        close(asock);
+        return -1;
+    }
+    return asock;
+}
+
+//============================//
+// connect to specified port# //
+//----------------------------//
+int connect_client()
+{
+    int csock;
+    if ((csock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
+        return -1;
+    }
+    struct sockaddr_in addr;
+    addr.sin_family = AF_INET;
+    addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+    addr.sin_port = htons(cl_port);
+    if (connect(csock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+        close(csock);
+        return -1;
+    }
+    return csock;
+}
+
+//========================================//
+// setup *argv[] from a string for exec() //
+//----------------------------------------//
+void get_argv(char **argv, int maxc, char *s)
+{
+    int esc, sq, dq;  // recognize (\) (') (") and tokenize
+    int c, argc;
+    char *p;
+    esc = sq = dq = 0;
+    for (argc = 0; argc < maxc-1; ++argc) {
+        for ( ; isascii(*s) && isspace(*s); ++s);
+        if (*s == 0) {
+            break;
+        }
+        argv[argc] = p = s;
+        while ((c = *s) != 0) {
+            ++s;
+            if (isspace(c) && !esc && !sq && !dq) {
+                break;
+            }
+            if (c == '\'' && !esc && !dq) {
+                sq ^= 1;
+            } else if (c == '"' && !esc && !sq) {
+                dq ^= 1;
+            } else if (c == '\\' && !esc) {
+                esc = 1;
+            } else {
+                esc = 0;
+                *p++ = c;
+            }
+        }
+        *p = 0;
+    }
+    // not to judge syntax errors
+    // if (dq || sq || esc) { syntax error }
+    // if (argc == maxc) { overflow }
+    argv[argc] = NULL;
+}
+
+//=================//
+// shell execution //
+//-----------------//
+int exec_shell(int* sh_pid)
+{
+    char env_term[64];
+    // open pty master
+    int master;
+    if ((master = open(DEVPTY, O_RDWR)) < 0) {
+        c_error("exec_shell: master pty open error");
+        return -1;
+    }
+    int pid;
+    if ((pid = fork()) < 0) {
+        c_error("exec_shell: fork failed");
+        return -1;
+    }
+    if (pid == 0) {
+        // detach from control tty
+        setsid();
+        // open pty slave
+        int slave;
+        if ((slave = open(ptsname(master), O_RDWR)) < 0) {
+            c_error("exec_shell: slave pty open error");
+            exit(0);
+        }
+        // stdio redirection
+        while (slave <= 2) {
+            if ((slave = dup(slave)) < 0) {
+                exit(0);
+            }
+        }
+        int fd;
+        for (fd = 0; fd < 3; ++fd) {
+            close(fd);
+            dup(slave);
+            fcntl(fd, F_SETFD, 0);
+        }
+        for (fd = 3; fd < getdtablesize(); ++fd) {
+            if (fcntl(fd, F_GETFD) == 0) {
+                close(fd);
+            }
+        }
+        // set env vars
+        if (*term_type != 0) {
+            // set terminal type to $TERM
+            sprintf(env_term, "TERM=%s", term_type);
+            putenv(env_term);
+        }
+        // set other additional env vars
+        sh_env_t* e;
+        for (e = sh_env.next; e != NULL; e = e->next) {
+            putenv(e->env);
+        }
+	// change directory
+        if (change_dir[0] != 0) {
+	    if (chdir(change_dir) < 0) {
+		char tmp[256];
+		snprintf(tmp, 256, "exec_shell: Can't chdir to \"%s\".", change_dir);
+		tmp[255] = 0;
+		c_error(tmp);
+	    }
+        }
+        else if (home_chdir) {
+            // chdir to home directory
+            const char *home_dir = getenv("HOME");
+            // ignore chdir(2) system-call error.
+            chdir(home_dir);
+        }
+        // execute a shell
+        char *argv[32];
+        get_argv(argv, 32, cmd_shell);
+        if (enable_loginshell) {
+                char shell_path[128];
+                char *pos;
+                strcpy(shell_path, argv[0]);
+                if ((pos = strrchr(argv[0], '/')) != NULL) {
+                        *pos = '-';
+                        argv[0] = pos;
+                }
+                debug_msg_print(shell_path);
+                execv(shell_path, argv);
+        }
+        else {
+                debug_msg_print(argv[0]);
+                execv(argv[0], argv);
+        }
+        // no error, exec() doesn't return
+        c_error(argv[0]);
+        exit(0);
+    }
+    *sh_pid = pid;
+    return master;
+}
+
+//==================//
+// i/o buffer class //
+//------------------//
+class IOBuf
+{
+private:
+    int fd;
+    u_char i_buf[4096];
+    u_char o_buf[4096];
+    int i_pos, i_len, o_pos;
+public:
+    IOBuf(int channel) : fd(channel), i_pos(0), i_len(0), o_pos(0) {}
+    operator int() { return fd; }
+    void ungetc() { --i_pos; }
+    bool flush_in();
+    bool getc(u_char*);
+    bool nextc(u_char*);
+    bool putc(u_char);
+    bool flush_out();
+};
+
+// read bytes into input buffer
+//-----------------------------
+bool IOBuf::flush_in()
+{
+    if ((i_len = read(fd, i_buf, sizeof(i_buf))) <= 0)
+        return false;
+    i_pos = 0;
+    return true;
+}
+
+// get 1 char from input buffer
+//-----------------------------
+inline bool IOBuf::getc(u_char* c)
+{
+    if (i_pos == i_len) return false;
+    *c = i_buf[i_pos++];
+    return true;
+}
+
+// get next 1 char from input buffer
+//----------------------------------
+inline bool IOBuf::nextc(u_char* c)
+{
+    if (i_pos == i_len)
+        if (!flush_in()) return false;
+    *c = i_buf[i_pos++];
+    return true;
+}
+
+// put 1 char to output buffer
+//----------------------------
+inline bool IOBuf::putc(u_char c)
+{
+    if (o_pos == sizeof(o_buf))
+        if (!flush_out()) return false;
+    o_buf[o_pos++] = c;
+    return true;
+}
+
+// write bytes from output buffer
+//-------------------------------
+bool IOBuf::flush_out()
+{
+    int n;
+    for (int i = 0; i < o_pos; i += n) {
+        if ((n = write(fd, o_buf+i, o_pos-i)) <= 0) return false;
+    }
+    o_pos = 0;
+    return true;
+}
+
+//=========================//
+// TELNET command handling //  (see RFC854 TELNET PROTOCOL SPECIFICATION)
+//-------------------------//
+enum { nIAC=255, nWILL=251, nWONT=252, nDO=253, nDONT=254 };
+enum { sSEND=1, sIS=0, sSB=250, sSE=240 };
+enum { oECHO=1, oSGA=3, oTERM=24, oNAWS=31 };
+
+bool c_will_term = false;
+bool c_will_naws = false;
+
+u_char telnet_cmd(IOBuf* te)
+{
+    u_char cmd, c;
+    te->nextc(&cmd);
+    if (cmd == sSB) {
+        te->nextc(&c);
+        // accept terminal type request
+        if (c == oTERM) {                      // "SB TERM
+            te->nextc(&c);                     //     IS
+            u_char* p = (u_char*)term_type;
+            te->nextc(p);                      //     TERMINAL-TYPE
+            while (*p != nIAC) {
+                if (isupper(*p)) *p = _tolower(*p);
+                ++p; te->nextc(p);
+            }
+            *p = 0;
+            te->nextc(&c);                     //     IAC SE"
+            return (u_char)oTERM;
+        }
+        // accept terminal size request
+        if (c == oNAWS) {                      // "SB NAWS
+            u_short col, row;
+            te->nextc((u_char*)&col);
+            te->nextc((u_char*)&col+1);        //     00 00 (cols)
+            te->nextc((u_char*)&row);
+            te->nextc((u_char*)&row+1);        //     00 00 (rows)
+            te->nextc(&c);
+            te->nextc(&c);                     //     TAC SE"
+            win_size.ws_col = ntohs(col);
+            win_size.ws_row = ntohs(row);
+            return (u_char)oNAWS;
+        }
+        while (c != nIAC) te->nextc(&c);       // "... IAC SE"
+        te->nextc(&c);
+    }
+    else if (cmd == nWILL || cmd == nWONT || cmd == nDO || cmd == nDONT) {
+        u_char c;
+        te->nextc(&c);
+        if (cmd == nWILL && c == oTERM)        // "WILL TERM"
+            c_will_term = true;
+        else if (cmd == nWILL && c == oNAWS)   // "WILL NAWS"
+            c_will_naws = true;
+    }
+    return cmd;
+}
+
+//============================//
+// TELNET initial negotiation //
+//----------------------------//
+void telnet_nego(int te_sock)
+{
+    IOBuf te = te_sock;
+    u_char c;
+
+    // start terminal type negotiation
+    // IAC DO TERMINAL-TYPE
+    te.putc(nIAC); te.putc(nDO); te.putc(oTERM);
+    te.flush_out();
+    te.nextc(&c);
+    if (c != nIAC) {
+        te.ungetc();
+        return;
+    }
+    (void)telnet_cmd(&te);
+    if (c_will_term) {
+        // terminal type sub-negotiation
+        // IAC SB TERMINAL-TYPE SEND IAC SE
+        te.putc(nIAC); te.putc(sSB); te.putc(oTERM);
+        te.putc(sSEND); te.putc(nIAC); te.putc(sSE);
+        te.flush_out();
+        // accept terminal type response
+        te.nextc(&c);
+        if (c != nIAC) {
+            te.ungetc();
+            return;
+        }
+        (void)telnet_cmd(&te);
+    }
+
+    // start terminal size negotiation
+    // IAC DO WINDOW-SIZE
+    te.putc(nIAC); te.putc(nDO); te.putc(oNAWS);
+    te.flush_out();
+    te.nextc(&c);
+    if (c != nIAC) {
+        te.ungetc();
+        return;
+    }
+    (void)telnet_cmd(&te);
+    if (c_will_naws) {
+        // accept terminal size response
+        te.nextc(&c);
+        if (c != nIAC) {
+            te.ungetc();
+            return;
+        }
+        (void)telnet_cmd(&te);
+    }
+
+    // SGA/ECHO
+    te.putc(nIAC); te.putc(nWILL); te.putc(oSGA);
+    te.putc(nIAC); te.putc(nDO); te.putc(oSGA);
+    te.putc(nIAC); te.putc(nWILL); te.putc(oECHO);
+    te.flush_out();
+}
+
+//=============================================//
+// relaying of a terminal emulator and a shell //
+//---------------------------------------------//
+void telnet_session(int te_sock, int sh_pty)
+{
+    IOBuf te = te_sock;
+    IOBuf sh = sh_pty;
+    fd_set rtmp, rbits;
+    FD_ZERO(&rtmp);
+    FD_SET(te, &rtmp);
+    FD_SET(sh, &rtmp);
+    u_char c;
+    int cr = 0;
+    int cnt = 0;
+    for (;;) {
+        rbits = rtmp;
+        if (select(FD_SETSIZE, &rbits, 0, 0, 0) <= 0) {
+            break;
+        }
+        if (FD_ISSET(sh, &rbits)) {
+            // send data from a shell to a terminal
+            if (sh.flush_in() == false) {
+                break;
+            }
+            while (sh.getc(&c) == true) {
+                if (c == nIAC) {
+                    // escape a TELNET IAC char
+                    te.putc(c);
+                }
+                te.putc(c);
+            }
+            if (te.flush_out() == false) {
+                break;
+            }
+            if (cnt++ < 20) {
+                continue;  // give priority to data from a shell
+            }
+            cnt = 0;
+        }
+        if (FD_ISSET(te, &rbits)) {
+            // send data from a terminal to a shell
+            if (te.flush_in() == false) {
+                break;
+            }
+            while (te.getc(&c) == true) {
+                if (c == nIAC && !dumb) {
+                    u_char cmd = telnet_cmd(&te) ;
+                    if (cmd == oNAWS) {
+                        // resize pty by terminal size change notice
+                        ioctl(sh_pty, TIOCSWINSZ, &win_size);
+                        continue;
+                    }
+                    if (cmd != nIAC) {
+                        continue;
+                    }
+                } else if (c == '\r') {
+                    cr = 1;
+                } else if (c == '\n' || c == '\0') {
+                    if (cr) {  // do not send LF or NUL just after CR
+                        cr = 0;
+                        continue;
+                    }
+                } else {
+                    cr = 0;
+                }
+                sh.putc(c);
+            }
+            if (sh.flush_out() == false) {
+                break;
+            }
+        }
+    }
+}
+
+//=========================================================//
+// connection of TELNET terminal emulator and Cygwin shell //
+//---------------------------------------------------------//
+int main(int argc, char** argv)
+{
+    int listen_sock = -1;
+    u_short listen_port;
+    int te_sock = -1;
+    int sh_pty = -1;
+    HANDLE hTerm = NULL;
+    int sh_pid, agent_pid = 0;
+
+    // load configuration
+    load_cfg();
+
+    // read commandline arguments
+    get_args(argc, argv);
+
+    if (cmd_shell[0] == 0) {
+        msg_print("missing shell");
+        return 0;
+    }
+    if (cmd_term[0] == 0 && cl_port <= 0) {
+        msg_print("missing terminal");
+        return 0;
+    }
+
+    if (change_dir[0] != 0) {
+	home_chdir = false;
+	if (enable_loginshell) {
+	    add_env(&sh_envp, "CHERE_INVOKING=y", NULL);
+	}
+    }
+
+    // terminal side connection
+    if (cl_port > 0) {
+        // connect to the specified TCP port
+        if ((te_sock = connect_client()) < 0) {
+            goto cleanup;
+        }
+    } else {
+        // prepare a TELNET listener socket
+        if ((listen_sock = listen_telnet(&listen_port)) < 0) {
+            goto cleanup;
+        }
+        in_addr addr;
+        addr.s_addr = htonl(INADDR_LOOPBACK);
+        char tmp[256];
+        debug_msg_print("execute terminal");
+        snprintf(tmp, sizeof(tmp), cmd_term, inet_ntoa(addr), (int)ntohs(listen_port));
+        snprintf(cmd_term, sizeof(cmd_term), "%s %s", tmp, cmd_termopt);
+
+        // execute a terminal emulator
+        if ((hTerm = exec_term()) == NULL) {
+            api_error("exec_term failed");
+            goto cleanup;
+        }
+        // accept connection from the terminal emulator
+        if ((te_sock = accept_telnet(listen_sock)) < 0) {
+            goto cleanup;
+        }
+        shutdown(listen_sock, 2);
+        close(listen_sock);
+        listen_sock = -1;
+    }
+    // TELNET negotiation
+    if (!dumb) {
+        telnet_nego(te_sock);
+    }
+
+    // execute ssh-agent proxy
+    if (enable_agent_proxy) {
+        agent_pid = exec_agent_proxy();
+    }
+
+    // execute a shell
+    debug_msg_print("execute shell");
+    if ((sh_pty = exec_shell(&sh_pid)) < 0) {
+        debug_msg_print("exec_shell failed");
+        goto cleanup;
+    }
+    // set initial pty window size
+    if (!dumb && c_will_naws && win_size.ws_col != 0) {
+        ioctl(sh_pty, TIOCSWINSZ, &win_size);
+    }
+
+    debug_msg_print("entering telnet session");
+    // relay the terminal emulator and the shell
+    telnet_session(te_sock, sh_pty);
+
+  cleanup:
+    if (agent_pid > 0) {
+        kill(agent_pid, SIGTERM);
+    }
+    if (sh_pty >= 0) {
+        close(sh_pty);
+        kill(sh_pid, SIGKILL);
+    }
+    if (agent_pid > 0 || sh_pty >= 0) {
+        wait((int*)NULL);
+    }
+    if (listen_sock >= 0) {
+        shutdown(listen_sock, 2);
+        close(listen_sock);
+    }
+    if (te_sock >= 0) {
+        shutdown(te_sock, 2);
+        close(te_sock);
+    }
+    if (hTerm != NULL) {
+        WaitForSingleObject(hTerm, INFINITE);
+        CloseHandle(hTerm);
+    }
+    return 0;
+}
+
+#ifdef NO_WIN_MAIN
+// This program is an Win32 application but, start as Cygwin main().
+//------------------------------------------------------------------
+extern "C" {
+    void mainCRTStartup(void);
+    void WinMainCRTStartup(void) { mainCRTStartup(); }
+};
+#endif
+
+//EOF

Copied: trunk/cygwin/cygterm/cygterm.cfg (from rev 9515, trunk/cygterm/cygterm.cfg)
===================================================================
--- trunk/cygwin/cygterm/cygterm.cfg	                        (rev 0)
+++ trunk/cygwin/cygterm/cygterm.cfg	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,15 @@
+# CygTerm setting
+
+TERM = ttermpro.exe %s %d /E /KR=UTF8 /KT=UTF8 /VTICON=CygTerm /nossh
+# SJIS for Cygwin 1.5
+# TERM = ttermpro.exe %s %d /E /KR=SJIS /KT=SJIS /VTICON=CygTerm /nossh
+TERM_TYPE = vt100
+PORT_START = 20000
+PORT_RANGE = 40
+SHELL = auto
+ENV_1 = MAKE_MODE=unix
+ENV_2 = 
+LOGIN_SHELL = Yes
+# HOME_CHDIR = No
+SSH_AGENT_PROXY = No
+DEBUG = No

Copied: trunk/cygwin/cygterm/cygterm.ico (from rev 9515, trunk/cygterm/cygterm.ico)
===================================================================
(Binary files differ)

Copied: trunk/cygwin/cygtool/CMakeLists.txt (from rev 9515, trunk/installer/cygtool/CMakeLists.txt)
===================================================================
--- trunk/cygwin/cygtool/CMakeLists.txt	                        (rev 0)
+++ trunk/cygwin/cygtool/CMakeLists.txt	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,133 @@
+cmake_minimum_required(VERSION 3.11)
+
+set(PACKAGE_NAME "cygtool_dll")
+
+project(${PACKAGE_NAME})
+
+add_library(
+  ${PACKAGE_NAME} SHARED
+  cygtool.c
+  cygtool.def
+  )
+
+if(MSVC)
+  target_compile_options(
+    ${PACKAGE_NAME}
+    PRIVATE
+    -MT
+    )
+endif()
+
+if(MINGW)
+  # libgcc_s_dw2-1.dll に依存しないため
+  if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
+    target_link_options(
+      ${PACKAGE_NAME}
+      PRIVATE
+      -static-libgcc
+      )
+  else()
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc")
+  endif()
+endif()
+
+if(SUPPORT_OLD_WINDOWS)
+  if(MSVC)
+    target_sources(
+      ${PACKAGE_NAME}
+      PRIVATE
+      ../../teraterm/common/compat_w95_vs2005.c
+      )
+  endif()
+  if(MINGW)
+    target_sources(
+      ${PACKAGE_NAME}
+      PRIVATE
+      ../../teraterm/libmingw/tlssup.c
+      )
+  endif()
+endif(SUPPORT_OLD_WINDOWS)
+
+target_link_libraries(
+  ${PACKAGE_NAME}
+  PRIVATE
+  version
+  )
+
+set_target_properties(
+  ${PACKAGE_NAME}
+  PROPERTIES
+  PREFIX ""
+  OUTPUT_NAME "cygtool"
+  )
+
+set_target_properties(
+  ${PACKAGE_NAME}
+  PROPERTIES
+  FOLDER installer
+  )
+
+target_include_directories(
+  ${PACKAGE_NAME}
+  PRIVATE
+  ${CMAKE_CURRENT_LIST_DIR}/../../teraterm/common
+  )
+
+install(
+  TARGETS ${PACKAGE_NAME}
+  DESTINATION .
+  )
+
+if(false)
+  add_executable(
+    cygtool_exe
+    cygtool.c
+    )
+
+  target_compile_options(
+    cygtool_exe
+    PRIVATE
+    -D EXE
+    -I ${CMAKE_CURRENT_LIST_DIR}/../../teraterm/common
+    )
+
+  target_link_libraries(
+    cygtool_exe
+    PRIVATE
+    version
+    )
+
+  set_target_properties(
+    cygtool_exe
+    PROPERTIES
+    OUTPUT_NAME "cygtool"
+    )
+
+  set_target_properties(
+    cygtool_exe
+    PROPERTIES
+    FOLDER installer
+    )
+endif()
+
+if(false)
+  add_custom_target(
+    cygtool ALL
+    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll
+    )
+
+  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cygtool_build)
+
+  add_custom_command(
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll
+    COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -P ${CMAKE_CURRENT_LIST_DIR}/cygtool/build_cygtool.cmake
+    COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_GENERATOR}
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cygtool_build
+    COMMENT Generate "${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll"
+    )
+endif()
+
+install(
+  TARGETS ${PACKAGE_NAME}
+  DESTINATION .
+  )

Copied: trunk/cygwin/cygtool/build_cygtool.cmake (from rev 9515, trunk/installer/cygtool/build_cygtool.cmake)
===================================================================
--- trunk/cygwin/cygtool/build_cygtool.cmake	                        (rev 0)
+++ trunk/cygwin/cygtool/build_cygtool.cmake	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,38 @@
+#
+if(NOT DEFINED CMAKE_GENERATOR)
+  if(${CMAKE_COMMAND} MATCHES "mingw")
+    # meybe mingw
+    set(CMAKE_GENERATOR "Unix Makefiles")
+  elseif(CMAKE_HOST_WIN32)
+    set(CMAKE_GENERATOR "Visual Studio 16 2019")
+  else()
+    set(CMAKE_GENERATOR "Unix Makefiles")
+  endif()
+endif()
+if((${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") OR
+    (${CMAKE_GENERATOR} MATCHES "Visual Studio 17 2022"))
+  # 32bit build for inno setup
+  set(GENERATE_OPTION "-A;Win32")
+elseif(${CMAKE_COMMAND} MATCHES "msys64/mingw64/bin")
+  message("switch msys 32bit env")
+  set(ENV{PATH} "c:\\msys64\\mingw32\\bin;c:\\msys64\\usr\\bin")
+  set(CMAKE_COMMAND "C:/msys64/mingw32/bin/cmake.exe")
+endif()
+
+message("CMAKE_GENERATOR=${CMAKE_GENERATOR}")
+message("CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
+message("CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
+
+execute_process(
+  COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} -G ${CMAKE_GENERATOR} ${GENERATE_OPTION} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
+  )
+
+execute_process(
+  COMMAND ${CMAKE_COMMAND} --build . --config release
+  )
+
+if(DEFINED CMAKE_INSTALL_PREFIX)
+  execute_process(
+    COMMAND ${CMAKE_COMMAND} --build . --config release --target install
+    )
+endif()

Copied: trunk/cygwin/cygtool/cygtool.c (from rev 9515, trunk/installer/cygtool/cygtool.c)
===================================================================
--- trunk/cygwin/cygtool/cygtool.c	                        (rev 0)
+++ trunk/cygwin/cygtool/cygtool.c	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,203 @@
+
+#define _CRT_SECURE_NO_WARNINGS
+#include <windows.h>
+#include <stdio.h>
+
+int __stdcall FindCygwinPath(char *CygwinDirectory, char *Dir, int Dirlen)
+{
+	char file[MAX_PATH], *filename;
+	char c;
+
+	/* zero-length string from Inno Setup is NULL */
+	if (CygwinDirectory == NULL) {
+		goto search_path;
+	}
+
+	if (strlen(CygwinDirectory) > 0) {
+		if (SearchPath(CygwinDirectory, "bin\\cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+#ifdef EXE
+			printf("  %s from CygwinDirectory\n", file);
+#endif
+			goto found_dll;
+		}
+	}
+
+search_path:;
+	if (SearchPath(NULL, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+#ifdef EXE
+		printf("  %s from PATH\n", file);
+		goto found_dll;
+#endif
+	}
+
+	for (c = 'C' ; c <= 'Z' ; c++) {
+		char tmp[MAX_PATH];
+		sprintf(tmp, "%c:\\cygwin\\bin;%c:\\cygwin64\\bin", c, c);
+		if (SearchPath(tmp, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
+#ifdef EXE
+			printf("  %s from %c:\\\n", file, c);
+#endif
+			goto found_dll;
+		}
+	}
+
+	return 0;
+
+found_dll:;
+	memset(Dir, '\0', Dirlen);
+	if (Dirlen <= strlen(file) - 16) {
+		return 0;
+	}
+	memcpy(Dir, file, strlen(file) - 16); // delete "\\bin\\cygwin1.dll"
+	return 1;
+}
+
+int __stdcall PortableExecutableMachine(char *file)
+{
+	FILE *fp;
+	unsigned char buf[4];
+	long e_lfanew;
+	WORD Machine;
+
+	if ((fp = fopen(file, "rb")) == NULL) {
+		return IMAGE_FILE_MACHINE_UNKNOWN;
+	}
+
+	// IMAGE_DOS_HEADER
+	if (fseek(fp, 0x3c, SEEK_SET) != 0) {
+		fclose(fp);
+		return IMAGE_FILE_MACHINE_UNKNOWN;
+	}
+	if (fread(buf, sizeof(char), 4, fp) < 4) {
+		fclose(fp);
+		return IMAGE_FILE_MACHINE_UNKNOWN;
+	}
+	e_lfanew = buf[0] + (buf[1] << 8) + (buf[1] << 16) + (buf[1] << 24);
+#ifdef EXE
+	printf("  e_lfanew => x%08x\n", e_lfanew);
+#endif
+
+	// IMAGE_NT_HEADERS32
+	//   DWORD Signature;
+	//   IMAGE_FILE_HEADER FileHeader;
+	if (fseek(fp, e_lfanew + 4, SEEK_SET) != 0) {
+		fclose(fp);
+		return IMAGE_FILE_MACHINE_UNKNOWN;
+	}
+	if (fread(buf, sizeof(char), 2, fp) < 2) {
+		fclose(fp);
+		return IMAGE_FILE_MACHINE_UNKNOWN;
+	}
+	Machine = buf[0] + (buf[1] << 8);
+
+	fclose(fp);
+
+	return Machine;
+}
+
+int __stdcall CygwinVersion(char *dll, int *major, int *minor)
+{
+	DWORD dwSize;
+	DWORD dwHandle;
+	LPVOID lpBuf;
+	UINT uLen;
+	VS_FIXEDFILEINFO *pFileInfo;
+
+	dwSize = GetFileVersionInfoSize(dll, &dwHandle);
+	if (dwSize == 0) {
+		return 0;
+	}
+
+	lpBuf = malloc(dwSize);
+	if (!GetFileVersionInfo(dll, dwHandle, dwSize, lpBuf)) {
+		free(lpBuf);
+		return 0;
+	}
+
+	if (!VerQueryValue(lpBuf, "\\", (LPVOID*)&pFileInfo, &uLen)) {
+		free(lpBuf);
+		return 0;
+	}
+
+	*major = HIWORD(pFileInfo->dwFileVersionMS);
+	*minor = LOWORD(pFileInfo->dwFileVersionMS);
+
+	free(lpBuf);
+
+	return 1;
+}
+
+#ifdef EXE
+int main(void)
+{
+	char file[MAX_PATH];
+	char version[MAX_PATH];
+	int file_len = sizeof(file);
+	int version_major, version_minor;
+	int res;
+
+	printf("FindCygwinPath()\n");
+	res = FindCygwinPath("", file, file_len);
+	printf("  result => %d\n", res);
+	if (!res) {
+		printf("\n");
+		return -1;
+	}
+	printf("  Cygwin directory => %s\n", file);
+	printf("\n");
+
+	printf("PortableExecutableMachine()\n");
+	strncat_s(file, sizeof(file), "\\bin\\cygwin1.dll", _TRUNCATE);
+	printf("  Cygwin DLL => %s\n", file);
+	res = PortableExecutableMachine(file);
+	printf("  Machine => x%04x", res);
+	switch (res) {
+		case IMAGE_FILE_MACHINE_I386:
+			printf(" = %s\n", "IMAGE_FILE_MACHINE_I386");
+			break;
+		case IMAGE_FILE_MACHINE_AMD64:
+			printf(" = %s\n", "IMAGE_FILE_MACHINE_AMD64");
+			break;
+		default:
+			printf("\n");
+			return -1;
+			break;
+	}
+	printf("\n");
+
+	printf("CygwinVersion()\n");
+	printf("  Cygwin DLL => %s\n", file);
+	res = CygwinVersion(file, &version_major, &version_minor);
+	printf("  result => %d\n", res);
+	if (!res) {
+	printf("\n");
+		return -1;
+	}
+	printf("  version_major => %d\n", version_major);
+	printf("  version_minor => %d\n", version_minor);
+	printf("\n");
+
+	return 0;
+}
+#else
+BOOL WINAPI DllMain(HANDLE hInstance,
+		    ULONG ul_reason_for_call,
+		    LPVOID lpReserved)
+{
+  switch( ul_reason_for_call ) {
+    case DLL_THREAD_ATTACH:
+      /* do thread initialization */
+      break;
+    case DLL_THREAD_DETACH:
+      /* do thread cleanup */
+      break;
+    case DLL_PROCESS_ATTACH:
+      /* do process initialization */
+      break;
+    case DLL_PROCESS_DETACH:
+      /* do process cleanup */
+      break;
+  }
+  return TRUE;
+}
+#endif

Copied: trunk/cygwin/cygtool/cygtool.def (from rev 9515, trunk/installer/cygtool/cygtool.def)
===================================================================
--- trunk/cygwin/cygtool/cygtool.def	                        (rev 0)
+++ trunk/cygwin/cygtool/cygtool.def	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,4 @@
+EXPORTS
+  FindCygwinPath
+  PortableExecutableMachine
+  CygwinVersion

Copied: trunk/cygwin/cygtool/cygtool.mak (from rev 9515, trunk/installer/cygtool/cygtool.mak)
===================================================================
--- trunk/cygwin/cygtool/cygtool.mak	                        (rev 0)
+++ trunk/cygwin/cygtool/cygtool.mak	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,17 @@
+CPP=cl.exe
+LINK32=link.exe
+
+CFLAG=/nologo /I "..\..\teraterm\common" /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /W2
+LDFLAG=/nologo /SUBSYSTEM:WINDOWS /DLL
+
+all: cygtool.dll cygtool.exe
+
+cygtool.dll: cygtool.c
+	$(CPP) $(CFLAG) /MT /c cygtool.c
+	$(LINK32) $(LDFLAG) /DEF:cygtool.def cygtool.obj version.lib
+
+cygtool.exe: cygtool.c
+	$(CPP) $(CFLAG) /D "EXE" cygtool.c version.lib
+
+clean:
+	del *.exe *.dll *.obj *.exp *.lib

Added: trunk/cygwin/cygtool/cygtool.v16.vcxproj
===================================================================
--- trunk/cygwin/cygtool/cygtool.v16.vcxproj	                        (rev 0)
+++ trunk/cygwin/cygtool/cygtool.v16.vcxproj	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>16.0</VCProjectVersion>
+    <Keyword>Win32Proj</Keyword>
+    <ProjectGuid>{e8955970-1031-42b4-9419-f82d9dd80c66}</ProjectGuid>
+    <RootNamespace>cygtool</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
+    <ProjectName>cygtool</ProjectName>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v142</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <WarningLevel>Level2</WarningLevel>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ModuleDefinitionFile>cygtool.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <WarningLevel>Level4</WarningLevel>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ConformanceMode>true</ConformanceMode>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+    </ClCompile>
+    <Link>
+      <SubSystem>Console</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <AdditionalDependencies>version.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <ModuleDefinitionFile>cygtool.def</ModuleDefinitionFile>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <None Include="cygtool.def" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="cygtool.c" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file

Added: trunk/cygwin/cygtool/cygtool.v8.vcproj
===================================================================
--- trunk/cygwin/cygtool/cygtool.v8.vcproj	                        (rev 0)
+++ trunk/cygwin/cygtool/cygtool.v8.vcproj	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="cygtool"
+	ProjectGUID="{4F0887EE-225F-407A-A403-5A723A4C7B2B}"
+	RootNamespace="cygtool"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="version.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				Detect64BitPortabilityProblems="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="version.lib"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\cygtool.c"
+			>
+		</File>
+		<File
+			RelativePath=".\cygtool.def"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Added: trunk/cygwin/cygwin.v16.sln
===================================================================
--- trunk/cygwin/cygwin.v16.sln	                        (rev 0)
+++ trunk/cygwin/cygwin.v16.sln	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.31729.503
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cyglaunch", "cyglaunch\cyglaunch.v16.vcxproj", "{11B49891-80F0-4DD3-B6E9-70BBE64A4BBF}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cygtool", "cygtool\cygtool.v16.vcxproj", "{E8955970-1031-42B4-9419-F82D9DD80C66}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|x86 = Debug|x86
+		Release|x86 = Release|x86
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{11B49891-80F0-4DD3-B6E9-70BBE64A4BBF}.Debug|x86.ActiveCfg = Debug|Win32
+		{11B49891-80F0-4DD3-B6E9-70BBE64A4BBF}.Debug|x86.Build.0 = Debug|Win32
+		{11B49891-80F0-4DD3-B6E9-70BBE64A4BBF}.Release|x86.ActiveCfg = Release|Win32
+		{11B49891-80F0-4DD3-B6E9-70BBE64A4BBF}.Release|x86.Build.0 = Release|Win32
+		{E8955970-1031-42B4-9419-F82D9DD80C66}.Debug|x86.ActiveCfg = Debug|Win32
+		{E8955970-1031-42B4-9419-F82D9DD80C66}.Debug|x86.Build.0 = Debug|Win32
+		{E8955970-1031-42B4-9419-F82D9DD80C66}.Release|x86.ActiveCfg = Release|Win32
+		{E8955970-1031-42B4-9419-F82D9DD80C66}.Release|x86.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {89725780-D46B-40E3-8811-B5F8FAB57C1C}
+	EndGlobalSection
+EndGlobal

Added: trunk/cygwin/cygwin.v8.sln
===================================================================
--- trunk/cygwin/cygwin.v8.sln	                        (rev 0)
+++ trunk/cygwin/cygwin.v8.sln	2021-11-10 13:01:23 UTC (rev 9516)
@@ -0,0 +1,26 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual C++ Express 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cyglaunch", "cyglaunch\cyglaunch.v8.vcproj", "{1A41E0B4-7FBC-44C6-83A4-7881F60CE8C8}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cygtool", "cygtool\cygtool.v8.vcproj", "{4F0887EE-225F-407A-A403-5A723A4C7B2B}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{1A41E0B4-7FBC-44C6-83A4-7881F60CE8C8}.Debug|Win32.ActiveCfg = Debug|Win32
+		{1A41E0B4-7FBC-44C6-83A4-7881F60CE8C8}.Debug|Win32.Build.0 = Debug|Win32
+		{1A41E0B4-7FBC-44C6-83A4-7881F60CE8C8}.Release|Win32.ActiveCfg = Release|Win32
+		{1A41E0B4-7FBC-44C6-83A4-7881F60CE8C8}.Release|Win32.Build.0 = Release|Win32
+		{4F0887EE-225F-407A-A403-5A723A4C7B2B}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4F0887EE-225F-407A-A403-5A723A4C7B2B}.Debug|Win32.Build.0 = Debug|Win32
+		{4F0887EE-225F-407A-A403-5A723A4C7B2B}.Release|Win32.ActiveCfg = Release|Win32
+		{4F0887EE-225F-407A-A403-5A723A4C7B2B}.Release|Win32.Build.0 = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Modified: trunk/doc/CMakeLists.txt
===================================================================
--- trunk/doc/CMakeLists.txt	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/doc/CMakeLists.txt	2021-11-10 13:01:23 UTC (rev 9516)
@@ -58,7 +58,7 @@
     COMMAND ${PERL} ../installer/2sjis.pl -i ../libs/doc_help/SFMT-LICENSE.txt      -o en/html/reference/SFMT-LICENSE.txt      -l unix
     COMMAND ${PERL} ../installer/2sjis.pl -i ../libs/doc_help/cJSON-LICENSE.txt     -o en/html/reference/cJSON-LICENSE.txt     -l unix
     COMMAND ${PERL} ../installer/2sjis.pl -i ../libs/doc_help/argon2-LICENSE.txt    -o en/html/reference/argon2-LICENSE.txt    -l unix
-    COMMAND ${PERL} ../installer/2sjis.pl -i ../cygterm/COPYING                     -o en/html/reference/CygTerm+-LICENSE.txt  -l unix
+    COMMAND ${PERL} ../installer/2sjis.pl -i ../cygwin/cygterm/COPYING              -o en/html/reference/CygTerm+-LICENSE.txt  -l unix
     COMMAND ${PERL} ../installer/copy-zliblicense.pl -i ../libs/doc_help/zlib-LICENSE.txt -o en/html/reference/zlib-LICENSE.txt -l unix
     COMMAND ${PERL} -C0 -pe "s/^\\xef\\xbb\\xbf//" en/html/reference/build_with_cmake.md > en/html/reference/build_with_cmake_no_bom.md
     COMMAND ${PERL} Markdown_1.0.1/Markdown.pl en/html/reference/build_with_cmake_no_bom.md > en/html/reference/build_with_cmake_utf8.html
@@ -87,7 +87,7 @@
     COMMAND ${PERL} ../installer/2sjis.pl -i ../libs/doc_help/SFMT-LICENSE.txt      -o ja/html/reference/SFMT-LICENSE.txt      -l unix
     COMMAND ${PERL} ../installer/2sjis.pl -i ../libs/doc_help/cJSON-LICENSE.txt     -o ja/html/reference/cJSON-LICENSE.txt     -l unix
     COMMAND ${PERL} ../installer/2sjis.pl -i ../libs/doc_help/argon2-LICENSE.txt    -o ja/html/reference/argon2-LICENSE.txt    -l unix
-    COMMAND ${PERL} ../installer/2sjis.pl -i ../cygterm/COPYING          -o ja/html/reference/CygTerm+-LICENSE.txt  -l unix
+    COMMAND ${PERL} ../installer/2sjis.pl -i ../cygwin/cygterm/COPYING              -o ja/html/reference/CygTerm+-LICENSE.txt  -l unix
     COMMAND ${PERL} ../installer/copy-zliblicense.pl -i ../libs/doc_help/zlib-LICENSE.txt -o ja/html/reference/zlib-LICENSE.txt -l unix
     COMMAND ${PERL} -C0 -pe "s/^\\xef\\xbb\\xbf//" ja/html/reference/build_with_cmake.md > ja/html/reference/build_with_cmake_no_bom.md
     COMMAND ${PERL} Markdown_1.0.1/Markdown.pl ja/html/reference/build_with_cmake_no_bom.md > ja/html/reference/build_with_cmake_utf8.html

Modified: trunk/installer/CMakeLists.txt
===================================================================
--- trunk/installer/CMakeLists.txt	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/CMakeLists.txt	2021-11-10 13:01:23 UTC (rev 9516)
@@ -267,30 +267,6 @@
   RENAME KEYBOARD.CNF
   )
 
-# cygterm
-if ((EXISTS "C:/cygwin64/bin") OR (EXISTS "C:/cygwin/bin"))
-  install(CODE "execute_process(COMMAND \"${CMAKE_COMMAND}\" -P ${CMAKE_CURRENT_SOURCE_DIR}/build_cygterm.cmake)")
-
-  install(
-    FILES
-    ${CMAKE_CURRENT_SOURCE_DIR}/../cygterm/cygterm.exe
-    ${CMAKE_CURRENT_SOURCE_DIR}/../cygterm/cygterm.cfg
-    ${CMAKE_CURRENT_SOURCE_DIR}/../cygterm/cyglaunch.exe
-    ${CMAKE_CURRENT_SOURCE_DIR}/../cygterm/cygterm+.tar.gz
-    DESTINATION .
-    )
-  install(
-    FILES
-    ${CMAKE_CURRENT_SOURCE_DIR}/../cygterm/cygterm.exe
-    DESTINATION ./cygterm+-i686
-    )
-  install(
-    FILES
-    ${CMAKE_CURRENT_SOURCE_DIR}/../cygterm/cygterm+-x86_64/cygterm.exe
-    DESTINATION ./cygterm+-x86_64
-    )
-endif()
-
 # Inno Setup
 #  Create setup.exe
 find_program(
@@ -311,26 +287,6 @@
     COMMAND "${CMAKE_COMMAND}" -E echo "inno setup not found"
     )
 else()
-  add_custom_target(
-    cygtool ALL
-    DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll
-    )
-
-  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cygtool_build)
-
-  add_custom_command(
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll
-    COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -P ${CMAKE_CURRENT_LIST_DIR}/cygtool/build_cygtool.cmake
-    COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_GENERATOR}
-    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cygtool_build
-    COMMENT Generate "${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll"
-    )
-
-  install(
-    FILES ${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll
-    DESTINATION .
-    )
-
   configure_file(
     teraterm_cmake.iss.in teraterm_cmake.iss
     NEWLINE_STYLE CRLF
@@ -362,11 +318,6 @@
       WORKING_DIRECTORY ${CMAKE_CURRENT_BUILD_DIR}
       )
   endif()
-
-  set_target_properties(
-    cygtool
-    PROPERTIES FOLDER installer
-    )
 endif()
 set_target_properties(
   inno_setup

Modified: trunk/installer/build.bat
===================================================================
--- trunk/installer/build.bat	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/build.bat	2021-11-10 13:01:23 UTC (rev 9516)
@@ -89,6 +89,7 @@
 set TTXKANJISLN=..\TTXKanjiMenu\ttxkanjimenu.v8.sln
 set TTPMENUSLN=..\ttpmenu\ttpmenu.v8.sln
 set TTXSAMPLESLN=..\TTXSamples\TTXSamples.v8.sln
+set CYGWINSLN=..\CYGWIN\cygwin.v8.sln
 
 rem VS2005\x82\xC9SP1\x82\xAA\x93K\x97p\x82\xB3\x82\xEA\x82Ă\xA2\x82邩\x82\xF0\x83`\x83F\x83b\x83N\x82\xB7\x82\xE9
 cl /? 2>&1 | findstr /C:"14.00.50727.762"
@@ -115,6 +116,7 @@
 set TTXKANJISLN=..\TTXKanjiMenu\ttxkanjimenu.v9.sln
 set TTPMENUSLN=..\ttpmenu\ttpmenu.v9.sln
 set TTXSAMPLESLN=..\TTXSamples\TTXSamples.v9.sln
+set CYGWINSLN=..\CYGWIN\cygwin.v9.sln
 goto vsend
 
 :vs2010
@@ -124,6 +126,7 @@
 set TTXKANJISLN=..\TTXKanjiMenu\ttxkanjimenu.v10.sln
 set TTPMENUSLN=..\ttpmenu\ttpmenu.v10.sln
 set TTXSAMPLESLN=..\TTXSamples\TTXSamples.v10.sln
+set CYGWINSLN=..\CYGWIN\cygwin.v10.sln
 goto vsend
 
 :vs2012
@@ -133,6 +136,7 @@
 set TTXKANJISLN=..\TTXKanjiMenu\ttxkanjimenu.v11.sln
 set TTPMENUSLN=..\ttpmenu\ttpmenu.v11.sln
 set TTXSAMPLESLN=..\TTXSamples\TTXSamples.v11.sln
+set CYGWINSLN=..\CYGWIN\cygwin.v11.sln
 goto vsend
 
 :vs2013
@@ -142,6 +146,7 @@
 set TTXKANJISLN=..\TTXKanjiMenu\ttxkanjimenu.v12.sln
 set TTPMENUSLN=..\ttpmenu\ttpmenu.v12.sln
 set TTXSAMPLESLN=..\TTXSamples\TTXSamples.v12.sln
+set CYGWINSLN=..\CYGWIN\cygwin.v12.sln
 goto vsend
 
 :vs2015
@@ -151,6 +156,7 @@
 set TTXKANJISLN=..\TTXKanjiMenu\ttxkanjimenu.v14.sln
 set TTPMENUSLN=..\ttpmenu\ttpmenu.v14.sln
 set TTXSAMPLESLN=..\TTXSamples\TTXSamples.v14.sln
+set CYGWINSLN=..\CYGWIN\cygwin.v14.sln
 goto vsend
 
 :vs2017
@@ -160,6 +166,7 @@
 set TTXKANJISLN=..\TTXKanjiMenu\ttxkanjimenu.v15.sln
 set TTPMENUSLN=..\ttpmenu\ttpmenu.v15.sln
 set TTXSAMPLESLN=..\TTXSamples\TTXSamples.v15.sln
+set CYGWINSLN=..\CYGWIN\cygwin.v15.sln
 goto vsend
 
 :vs2019
@@ -169,6 +176,7 @@
 set TTXKANJISLN=..\TTXKanjiMenu\ttxkanjimenu.v16.sln
 set TTPMENUSLN=..\ttpmenu\ttpmenu.v16.sln
 set TTXSAMPLESLN=..\TTXSamples\TTXSamples.v16.sln
+set CYGWINSLN=..\CYGWIN\cygwin.v16.sln
 goto vsend
 
 :vsend
@@ -208,18 +216,15 @@
 if ERRORLEVEL 1 goto fail
 devenv /%BUILD% release %TTXSAMPLESLN%
 if ERRORLEVEL 1 goto fail
+devenv /%BUILD% release %CYGWINSLN%
+if ERRORLEVEL 1 goto fail
 
 rem cygterm \x82\xF0\x83R\x83\x93\x83p\x83C\x83\x8B
-pushd ..\cygterm
+pushd ..\cygwin\cygterm
 if "%BUILD%" == "rebuild" make clean
 make
 popd
 
-rem cygtool \x82\xF0\x83R\x83\x93\x83p\x83C\x83\x8B
-pushd cygtool
-nmake -f cygtool.mak
-popd
-
 rem lng \x83t\x83@\x83C\x83\x8B\x82\xF0\x8D쐬
 call makelang.bat
 

Deleted: trunk/installer/cygtool/CMakeLists.txt
===================================================================
--- trunk/installer/cygtool/CMakeLists.txt	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/cygtool/CMakeLists.txt	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,103 +0,0 @@
-cmake_minimum_required(VERSION 3.11)
-
-set(PACKAGE_NAME "cygtool_dll")
-
-project(${PACKAGE_NAME})
-
-add_library(
-  ${PACKAGE_NAME} SHARED
-  cygtool.c
-  cygtool.def
-  )
-
-if(MINGW)
-  # libgcc_s_dw2-1.dll に依存しないため
-  if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13.0")
-    target_link_options(
-      ${PACKAGE_NAME}
-      PRIVATE
-      -static-libgcc
-      )
-  else()
-    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static-libgcc")
-  endif()
-endif()
-
-if(SUPPORT_OLD_WINDOWS)
-  if(MSVC)
-    target_sources(
-      ${PACKAGE_NAME}
-      PRIVATE
-      ../../teraterm/common/compat_w95_vs2005.c
-      )
-  endif()
-  if(MINGW)
-    target_sources(
-      ${PACKAGE_NAME}
-      PRIVATE
-      ../../teraterm/libmingw/tlssup.c
-      )
-  endif()
-endif(SUPPORT_OLD_WINDOWS)
-
-target_link_libraries(
-  ${PACKAGE_NAME}
-  PRIVATE
-  version
-  )
-
-set_target_properties(
-  ${PACKAGE_NAME}
-  PROPERTIES
-  PREFIX ""
-  OUTPUT_NAME "cygtool"
-  )
-
-set_target_properties(
-  ${PACKAGE_NAME}
-  PROPERTIES
-  FOLDER installer
-  )
-
-target_include_directories(
-  ${PACKAGE_NAME}
-  PRIVATE
-  ${CMAKE_CURRENT_LIST_DIR}/../../teraterm/common
-  )
-
-install(
-  TARGETS ${PACKAGE_NAME}
-  DESTINATION .
-  )
-
-if(false)
-  add_executable(
-    cygtool_exe
-    cygtool.c
-    )
-
-  target_compile_options(
-    cygtool_exe
-    PRIVATE
-    -D EXE
-    -I ${CMAKE_CURRENT_LIST_DIR}/../../teraterm/common
-    )
-
-  target_link_libraries(
-    cygtool_exe
-    PRIVATE
-    version
-    )
-
-  set_target_properties(
-    cygtool_exe
-    PROPERTIES
-    OUTPUT_NAME "cygtool"
-    )
-
-  set_target_properties(
-    cygtool_exe
-    PROPERTIES
-    FOLDER installer
-    )
-endif()

Deleted: trunk/installer/cygtool/build_cygtool.cmake
===================================================================
--- trunk/installer/cygtool/build_cygtool.cmake	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/cygtool/build_cygtool.cmake	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,38 +0,0 @@
-#
-if(NOT DEFINED CMAKE_GENERATOR)
-  if(${CMAKE_COMMAND} MATCHES "mingw")
-    # meybe mingw
-    set(CMAKE_GENERATOR "Unix Makefiles")
-  elseif(CMAKE_HOST_WIN32)
-    set(CMAKE_GENERATOR "Visual Studio 16 2019")
-  else()
-    set(CMAKE_GENERATOR "Unix Makefiles")
-  endif()
-endif()
-if((${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") OR
-    (${CMAKE_GENERATOR} MATCHES "Visual Studio 17 2022"))
-  # 32bit build for inno setup
-  set(GENERATE_OPTION "-A;Win32")
-elseif(${CMAKE_COMMAND} MATCHES "msys64/mingw64/bin")
-  message("switch msys 32bit env")
-  set(ENV{PATH} "c:\\msys64\\mingw32\\bin;c:\\msys64\\usr\\bin")
-  set(CMAKE_COMMAND "C:/msys64/mingw32/bin/cmake.exe")
-endif()
-
-message("CMAKE_GENERATOR=${CMAKE_GENERATOR}")
-message("CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
-message("CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
-
-execute_process(
-  COMMAND ${CMAKE_COMMAND} ${CMAKE_CURRENT_LIST_DIR} -G ${CMAKE_GENERATOR} ${GENERATE_OPTION} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-  )
-
-execute_process(
-  COMMAND ${CMAKE_COMMAND} --build . --config release
-  )
-
-if(DEFINED CMAKE_INSTALL_PREFIX)
-  execute_process(
-    COMMAND ${CMAKE_COMMAND} --build . --config release --target install
-    )
-endif()

Deleted: trunk/installer/cygtool/cygtool.c
===================================================================
--- trunk/installer/cygtool/cygtool.c	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/cygtool/cygtool.c	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,202 +0,0 @@
-
-#include <windows.h>
-#include <stdio.h>
-
-int __stdcall FindCygwinPath(char *CygwinDirectory, char *Dir, int Dirlen)
-{
-	char file[MAX_PATH], *filename;
-	char c;
-
-	/* zero-length string from Inno Setup is NULL */
-	if (CygwinDirectory == NULL) {
-		goto search_path;
-	}
-
-	if (strlen(CygwinDirectory) > 0) {
-		if (SearchPath(CygwinDirectory, "bin\\cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
-#ifdef EXE
-			printf("  %s from CygwinDirectory\n", file);
-#endif
-			goto found_dll;
-		}
-	}
-
-search_path:;
-	if (SearchPath(NULL, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
-#ifdef EXE
-		printf("  %s from PATH\n", file);
-		goto found_dll;
-#endif
-	}
-
-	for (c = 'C' ; c <= 'Z' ; c++) {
-		char tmp[MAX_PATH];
-		sprintf(tmp, "%c:\\cygwin\\bin;%c:\\cygwin64\\bin", c, c);
-		if (SearchPath(tmp, "cygwin1", ".dll", sizeof(file), file, &filename) > 0) {
-#ifdef EXE
-			printf("  %s from %c:\\\n", file, c);
-#endif
-			goto found_dll;
-		}
-	}
-
-	return 0;
-
-found_dll:;
-	memset(Dir, '\0', Dirlen);
-	if (Dirlen <= strlen(file) - 16) {
-		return 0;
-	}
-	memcpy(Dir, file, strlen(file) - 16); // delete "\\bin\\cygwin1.dll"
-	return 1;
-}
-
-int __stdcall PortableExecutableMachine(char *file)
-{
-	FILE *fp;
-	unsigned char buf[4];
-	long e_lfanew;
-	WORD Machine;
-
-	if ((fp = fopen(file, "rb")) == NULL) {
-		return IMAGE_FILE_MACHINE_UNKNOWN;
-	}
-
-	// IMAGE_DOS_HEADER
-	if (fseek(fp, 0x3c, SEEK_SET) != 0) {
-		fclose(fp);
-		return IMAGE_FILE_MACHINE_UNKNOWN;
-	}
-	if (fread(buf, sizeof(char), 4, fp) < 4) {
-		fclose(fp);
-		return IMAGE_FILE_MACHINE_UNKNOWN;
-	}
-	e_lfanew = buf[0] + (buf[1] << 8) + (buf[1] << 16) + (buf[1] << 24);
-#ifdef EXE
-	printf("  e_lfanew => x%08x\n", e_lfanew);
-#endif
-
-	// IMAGE_NT_HEADERS32
-	//   DWORD Signature;
-	//   IMAGE_FILE_HEADER FileHeader;
-	if (fseek(fp, e_lfanew + 4, SEEK_SET) != 0) {
-		fclose(fp);
-		return IMAGE_FILE_MACHINE_UNKNOWN;
-	}
-	if (fread(buf, sizeof(char), 2, fp) < 2) {
-		fclose(fp);
-		return IMAGE_FILE_MACHINE_UNKNOWN;
-	}
-	Machine = buf[0] + (buf[1] << 8);
-
-	fclose(fp);
-
-	return Machine;
-}
-
-int __stdcall CygwinVersion(char *dll, int *major, int *minor)
-{
-	DWORD dwSize;
-	DWORD dwHandle;
-	LPVOID lpBuf;
-	UINT uLen;
-	VS_FIXEDFILEINFO *pFileInfo;
-
-	dwSize = GetFileVersionInfoSize(dll, &dwHandle);
-	if (dwSize == 0) {
-		return 0;
-	}
-
-	lpBuf = malloc(dwSize);
-	if (!GetFileVersionInfo(dll, dwHandle, dwSize, lpBuf)) {
-		free(lpBuf);
-		return 0;
-	}
-
-	if (!VerQueryValue(lpBuf, "\\", (LPVOID*)&pFileInfo, &uLen)) {
-		free(lpBuf);
-		return 0;
-	}
-
-	*major = HIWORD(pFileInfo->dwFileVersionMS);
-	*minor = LOWORD(pFileInfo->dwFileVersionMS);
-
-	free(lpBuf);
-
-	return 1;
-}
-
-#ifdef EXE
-int main(void)
-{
-	char file[MAX_PATH];
-	char version[MAX_PATH];
-	int file_len = sizeof(file);
-	int version_major, version_minor;
-	int res;
-
-	printf("FindCygwinPath()\n");
-	res = FindCygwinPath("", file, file_len);
-	printf("  result => %d\n", res);
-	if (!res) {
-		printf("\n");
-		return -1;
-	}
-	printf("  Cygwin directory => %s\n", file);
-	printf("\n");
-
-	printf("PortableExecutableMachine()\n");
-	strncat_s(file, sizeof(file), "\\bin\\cygwin1.dll", _TRUNCATE);
-	printf("  Cygwin DLL => %s\n", file);
-	res = PortableExecutableMachine(file);
-	printf("  Machine => x%04x", res);
-	switch (res) {
-		case IMAGE_FILE_MACHINE_I386:
-			printf(" = %s\n", "IMAGE_FILE_MACHINE_I386");
-			break;
-		case IMAGE_FILE_MACHINE_AMD64:
-			printf(" = %s\n", "IMAGE_FILE_MACHINE_AMD64");
-			break;
-		default:
-			printf("\n");
-			return -1;
-			break;
-	}
-	printf("\n");
-
-	printf("CygwinVersion()\n");
-	printf("  Cygwin DLL => %s\n", file);
-	res = CygwinVersion(file, &version_major, &version_minor);
-	printf("  result => %d\n", res);
-	if (!res) {
-	printf("\n");
-		return -1;
-	}
-	printf("  version_major => %d\n", version_major);
-	printf("  version_minor => %d\n", version_minor);
-	printf("\n");
-
-	return 0;
-}
-#else
-BOOL WINAPI DllMain(HANDLE hInstance,
-		    ULONG ul_reason_for_call,
-		    LPVOID lpReserved)
-{
-  switch( ul_reason_for_call ) {
-    case DLL_THREAD_ATTACH:
-      /* do thread initialization */
-      break;
-    case DLL_THREAD_DETACH:
-      /* do thread cleanup */
-      break;
-    case DLL_PROCESS_ATTACH:
-      /* do process initialization */
-      break;
-    case DLL_PROCESS_DETACH:
-      /* do process cleanup */
-      break;
-  }
-  return TRUE;
-}
-#endif

Deleted: trunk/installer/cygtool/cygtool.def
===================================================================
--- trunk/installer/cygtool/cygtool.def	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/cygtool/cygtool.def	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,4 +0,0 @@
-EXPORTS
-  FindCygwinPath
-  PortableExecutableMachine
-  CygwinVersion

Deleted: trunk/installer/cygtool/cygtool.mak
===================================================================
--- trunk/installer/cygtool/cygtool.mak	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/cygtool/cygtool.mak	2021-11-10 13:01:23 UTC (rev 9516)
@@ -1,17 +0,0 @@
-CPP=cl.exe
-LINK32=link.exe
-
-CFLAG=/nologo /I "..\..\teraterm\common" /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /W2
-LDFLAG=/nologo /SUBSYSTEM:WINDOWS /DLL
-
-all: cygtool.dll cygtool.exe
-
-cygtool.dll: cygtool.c
-	$(CPP) $(CFLAG) /MT /c cygtool.c
-	$(LINK32) $(LDFLAG) /DEF:cygtool.def cygtool.obj version.lib
-
-cygtool.exe: cygtool.c
-	$(CPP) $(CFLAG) /D "EXE" cygtool.c version.lib
-
-clean:
-	del *.exe *.dll *.obj *.exp *.lib

Modified: trunk/installer/makearchive.bat
===================================================================
--- trunk/installer/makearchive.bat	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/makearchive.bat	2021-11-10 13:01:23 UTC (rev 9516)
@@ -44,15 +44,15 @@
 copy /y ..\teraterm\release\*.exe %dst%
 copy /y ..\teraterm\release\*.dll %dst%
 copy /y ..\ttssh2\ttxssh\Release\ttxssh.dll %dst%
-copy /y ..\cygterm\cygterm.exe %dst%
-copy /y ..\cygterm\cygterm.cfg %dst%
-copy /y ..\cygterm\cyglaunch.exe %dst%
-copy /y "..\cygterm\cygterm+.tar.gz" %dst%
-copy /y "..\cygterm\cygterm.exe" %dst%
+copy /y ..\cygwin\cygterm\cygterm.exe %dst%
+copy /y ..\cygwin\cygterm\cygterm.cfg %dst%
+copy /y "..\cygwin\cygterm\cygterm+.tar.gz" %dst%
+copy /y "..\cygwin\cygterm\cygterm.exe" %dst%
 mkdir "%dst%\cygterm+-i686"
-copy /y "..\cygterm\cygterm.exe" "%dst%\cygterm+-i686"
+copy /y "..\cygwin\cygterm\cygterm.exe" "%dst%\cygterm+-i686"
 mkdir "%dst%\cygterm+-x86_64"
-copy /y "..\cygterm\cygterm+-x86_64\cygterm.exe" "%dst%\cygterm+-x86_64"
+copy /y "..\cygwin\cygterm\cygterm+-x86_64\cygterm.exe" "%dst%\cygterm+-x86_64"
+copy /y ..\cygwin\Release\cyglaunch.exe %dst%
 copy /y ..\ttpmenu\Release\ttpmenu.exe %dst%
 copy /y ..\TTProxy\Release\TTXProxy.dll %dst%
 copy /y ..\TTXKanjiMenu\Release\ttxkanjimenu.dll %dst%

Modified: trunk/installer/teraterm.iss
===================================================================
--- trunk/installer/teraterm.iss	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/teraterm.iss	2021-11-10 13:01:23 UTC (rev 9516)
@@ -112,14 +112,14 @@
 Source: release\lang_utf16le\Traditional Chinese.lng; DestDir: {app}\lang_utf16le; Components: TeraTerm; Attribs: readonly; Flags: uninsremovereadonly overwritereadonly
 Source: ..\ttssh2\ttxssh\Release\ttxssh.dll; DestDir: {app}; Components: TTSSH; Flags: ignoreversion
 Source: release\ssh_known_hosts; DestDir: {app}; Components: TTSSH; Flags: onlyifdoesntexist uninsneveruninstall; Permissions: authusers-modify
-Source: ..\cygterm\cygterm.exe; DestDir: {app}\cygterm+-i686; Components: cygterm
-Source: ..\cygterm\cygterm.cfg; DestDir: {app}; Components: cygterm; Flags: onlyifdoesntexist uninsneveruninstall; Permissions: authusers-modify
-Source: ..\cygterm\cyglaunch.exe; DestDir: {app}; Components: cygterm
-Source: ..\cygterm\cygterm+.tar.gz; DestDir: {app}; Components: cygterm
-Source: ..\cygterm\cygterm+-x86_64\cygterm.exe; DestDir: {app}\cygterm+-x86_64; Components: cygterm
-Source: cygtool\cygtool.dll; Components: cygterm; Flags: dontcopy
-Source: ..\libs\logmett\Setup_LogMeTT_2_12_1.exe; DestDir: {tmp}; Components: LogMeTT; Flags: deleteafterinstall
-Source: ..\libs\logmett\Setup_TTLEditor_1_5_1.exe; DestDir: {tmp}; Components: TTLEdit; Flags: deleteafterinstall
+Source: ..\cygwin\cygterm\cygterm.exe; DestDir: {app}\cygterm+-i686; Components: cygterm
+Source: ..\cygwin\cygterm\cygterm.cfg; DestDir: {app}; Components: cygterm; Flags: onlyifdoesntexist uninsneveruninstall; Permissions: authusers-modify
+Source: ..\cygwin\cygterm\cygterm+.tar.gz; DestDir: {app}; Components: cygterm
+Source: ..\cygwin\cygterm\cygterm+-x86_64\cygterm.exe; DestDir: {app}\cygterm+-x86_64; Components: cygterm
+Source: ..\cygwin\Release\cyglaunch.exe; DestDir: {app}; Components: cygterm
+Source: ..\cygwin\Release\cygtool.dll; Components: cygterm; Flags: dontcopy
+;Source: ..\libs\logmett\Setup_LogMeTT_2_12_1.exe; DestDir: {tmp}; Components: LogMeTT; Flags: deleteafterinstall
+;Source: ..\libs\logmett\Setup_TTLEditor_1_5_1.exe; DestDir: {tmp}; Components: TTLEdit; Flags: deleteafterinstall
 Source: ..\ttpmenu\Release\ttpmenu.exe; DestDir: {app}; Components: TeraTerm_Menu; Flags: ignoreversion
 Source: release\ttmenu_readme-j.txt; DestDir: {app}; Components: TeraTerm_Menu
 Source: ..\TTProxy\Release\TTXProxy.dll; DestDir: {app}; Components: TTProxy; Flags: ignoreversion

Modified: trunk/installer/teraterm_cmake.iss.in
===================================================================
--- trunk/installer/teraterm_cmake.iss.in	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/installer/teraterm_cmake.iss.in	2021-11-10 13:01:23 UTC (rev 9516)
@@ -110,11 +110,11 @@
 Source: @PROJECT_SOURCE_DIR@/installer\release\lang_utf16le\Traditional Chinese.lng; DestDir: {app}\lang_utf16le; Components: TeraTerm; Attribs: readonly; Flags: uninsremovereadonly overwritereadonly
 Source: @CMAKE_INSTALL_PREFIX@/ttxssh.dll; DestDir: {app}; Components: TTSSH; Flags: ignoreversion
 Source: @PROJECT_SOURCE_DIR@/installer\release\ssh_known_hosts; DestDir: {app}; Components: TTSSH; Flags: onlyifdoesntexist uninsneveruninstall; Permissions: authusers-modify
-Source: @PROJECT_SOURCE_DIR@/cygterm\cygterm.exe; DestDir: {app}\cygterm+-i686; Components: cygterm
-Source: @PROJECT_SOURCE_DIR@/cygterm\cygterm.cfg; DestDir: {app}; Components: cygterm; Flags: onlyifdoesntexist uninsneveruninstall; Permissions: authusers-modify
-Source: @PROJECT_SOURCE_DIR@/cygterm\cyglaunch.exe; DestDir: {app}; Components: cygterm
-Source: @PROJECT_SOURCE_DIR@/cygterm\cygterm+.tar.gz; DestDir: {app}; Components: cygterm
-Source: @PROJECT_SOURCE_DIR@/cygterm\cygterm+-x86_64\cygterm.exe; DestDir: {app}\cygterm+-x86_64; Components: cygterm
+Source: @PROJECT_SOURCE_DIR@/cygwin/cygterm\cygterm.exe; DestDir: {app}\cygterm+-i686; Components: cygterm
+Source: @PROJECT_SOURCE_DIR@/cygwin/cygterm\cygterm.cfg; DestDir: {app}; Components: cygterm; Flags: onlyifdoesntexist uninsneveruninstall; Permissions: authusers-modify
+Source: @PROJECT_SOURCE_DIR@/cygwin/cygterm\cygterm+.tar.gz; DestDir: {app}; Components: cygterm
+Source: @PROJECT_SOURCE_DIR@/cygwin/cygterm\cygterm+-x86_64\cygterm.exe; DestDir: {app}\cygterm+-x86_64; Components: cygterm
+Source: @CMAKE_INSTALL_PREFIX@/cyglaunch.exe; DestDir: {app}; Components: cygterm
 Source: @CMAKE_INSTALL_PREFIX@/cygtool.dll; Components: cygterm; Flags: dontcopy
 ;Source: @PROJECT_SOURCE_DIR@/build_vs2019_x64\..\libs\logmett\Setup_LogMeTT_2_12_1.exe; DestDir: {tmp}; Components: LogMeTT; Flags: deleteafterinstall
 ;Source: @PROJECT_SOURCE_DIR@/build_vs2019_x64\..\libs\logmett\Setup_TTLEditor_1_5_1.exe; DestDir: {tmp}; Components: TTLEdit; Flags: deleteafterinstall

Modified: trunk/teraterm/teraterm/ttermpro.rc
===================================================================
--- trunk/teraterm/teraterm/ttermpro.rc	2021-11-10 13:01:10 UTC (rev 9515)
+++ trunk/teraterm/teraterm/ttermpro.rc	2021-11-10 13:01:23 UTC (rev 9516)
@@ -523,7 +523,7 @@
 
 IDI_VT_3D               ICON                    "../common/vt_3d.ico"
 
-IDI_CYGTERM             ICON                    "../../cygterm/cygterm.ico"
+IDI_CYGTERM             ICON                    "../../cygwin/cygterm/cygterm.ico"
 
 
 /////////////////////////////////////////////////////////////////////////////


ttssh2-commit メーリングリストの案内
Back to archive index