Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/COPYING.dumper340
-rw-r--r--winsup/utils/ChangeLog2643
-rw-r--r--winsup/utils/ChangeLog-2000347
-rw-r--r--winsup/utils/Makefile.in179
-rw-r--r--winsup/utils/aclocal.m4875
-rw-r--r--winsup/utils/bloda.cc409
-rwxr-xr-xwinsup/utils/configure4813
-rw-r--r--winsup/utils/configure.in31
-rw-r--r--winsup/utils/cygcheck.cc2182
-rw-r--r--winsup/utils/cygpath.cc1010
-rw-r--r--winsup/utils/dump_setup.cc510
-rw-r--r--winsup/utils/dumper.cc950
-rw-r--r--winsup/utils/dumper.h142
-rw-r--r--winsup/utils/getfacl.c256
-rw-r--r--winsup/utils/kill.cc302
-rwxr-xr-xwinsup/utils/mingw94
-rw-r--r--winsup/utils/mkgroup.c907
-rw-r--r--winsup/utils/mkpasswd.c887
-rw-r--r--winsup/utils/module_info.cc114
-rw-r--r--winsup/utils/mount.cc499
-rw-r--r--winsup/utils/parse_pe.cc104
-rw-r--r--winsup/utils/passwd.c609
-rw-r--r--winsup/utils/path.cc859
-rw-r--r--winsup/utils/path.h19
-rw-r--r--winsup/utils/ps.cc432
-rw-r--r--winsup/utils/regtool.cc980
-rw-r--r--winsup/utils/setfacl.c573
-rw-r--r--winsup/utils/setmetamode.c82
-rw-r--r--winsup/utils/ssp.c953
-rw-r--r--winsup/utils/ssp.txt125
-rw-r--r--winsup/utils/strace.cc1061
-rw-r--r--winsup/utils/testsuite.cc89
-rw-r--r--winsup/utils/testsuite.h131
-rw-r--r--winsup/utils/umount.cc158
-rw-r--r--winsup/utils/utils.sgml1673
35 files changed, 0 insertions, 25338 deletions
diff --git a/winsup/utils/COPYING.dumper b/winsup/utils/COPYING.dumper
deleted file mode 100644
index 623b6258a..000000000
--- a/winsup/utils/COPYING.dumper
+++ /dev/null
@@ -1,340 +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 Library 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 Library General
-Public License instead of this License.
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
deleted file mode 100644
index 2968e3b3a..000000000
--- a/winsup/utils/ChangeLog
+++ /dev/null
@@ -1,2643 +0,0 @@
-2008-12-16 Corinna Vinschen <corinna@vinschen.de>
-
- * utils.sgml: Fix typo in passwd screen text.
-
-2008-12-15 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.c (main): Put how to delete the registry password on its own
- line in passwd -R output.
-
-2008-12-13 Christopher Faylor <me+cygwin@cgf.cx>
-
- * utils.sgml: Convert some backslashes to slashes.
-
-2008-11-26 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.c (longopts): Add --reg-store-pwd option.
- (opts): Add -R option.
- (usage): Add text for -R/--reg-store-pwd option.
- (main): Fix size of local user and password string arrays.
- Handle -R option.
- * utils.sgml: Add text for passwd -R/--reg-store-pwd option.
-
-2008-10-29 Christopher Faylor <me+cygwin@cgf.cx>
-
- * Makefile.in (ALL_LDFLAGS): Link libgcc statically for everything
- here.
-
-2008-10-12 Christopher Faylor <me+cygwin@cgf.cx>
-
- * mingw: Set sawcfile when -xc* is detected. Extend list of detected
- source files.
-
-2008-10-12 Christopher Faylor <me+cygwin@cgf.cx>
-
- * mingw: Add more checks to allow more varied use.
-
-2008-10-11 Christopher Faylor <me+cygwin@cgf.cx>
-
- * mingw: Use a better method to find where mingw directory lives.
-
-2008-10-11 Christopher Faylor <me+cygwin@cgf.cx>
-
- * mingw: New front-end script to control building of MinGW files
- without using the deprecated -mno-cygwin option.
- * Makefile.in: Use mingw front-end.
-
-2008-09-12 Christopher Faylor <me+cygwin@cgf.cx>
-
- * cygcheck.cc (pathlike::check_existence): Remove class name from
- declaration.
- (display_internet_error): Use proper format specifier for DWORD.
- (environ): Remove unneeded declaration.
- (main): Use brace around nested if to avoid an overly-helpful compiler
- warning.
- * dump_setup.cc (parse_filename): Reorganize nested if to avoid an
- overly-helpful compiler warning.
- * path.cc (GUID_shortcut): Use braces around part of initializer which
- needs them.
- (conv_fstab_spaces): Parenthesize assignment in while loop to avoid a
- compiler warning.
- (struct opt): Make static.
- * ps.cc (main): Reorganize nested if to avoid an overly-helpful
- compiler warning.
- * regtool.cc: Make some anonymous structs static to avoid a compiler
- warning.
- * ssp.c (lookup_thread_id): Initialize *tix to zero to avoid potential
- uninitialized use.
- * strace.cc (add_child): Use proper format specifier for DWORD.
- (remove_child): Ditto.
- (proc_child): Ditto.
-
-2008-08-27 Christopher Faylor <me+cygwin@cgf.cx>
-
- * cygcheck.cc (nuke): Use malloc rather than alloca for environment
- variables.
- (load_cygwin): Ditto.
- * dump_setup.cc (parse_filename): Cosmetic changes.
- (get_packages): Ditto.
-
-2008-08-25 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (enum_local_groups): Don't skip printing groups when
- print_current is set and group SID is not curr_pgrp.
- (enum_groups): Ditto.
- (main): Fix condition when SYSTEM group gets printed.
- * mkpasswd.c (enum_users): Don't skip printing users when print_current
- is set and user SID is not curr_user.
- (main): Allow printing standard accounts even when print_current is set.
-
-2008-08-18 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (enum_local_groups): Use NetLocalGroupGetInfo to find out
- if a group exists, rather than just allocating a buffer and going ahead.
-
-2008-08-18 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (enum_local_groups): Call print_win_error with GetLastError
- as argument when LookupAccountXXX failed.
- (enum_groups): Ditto.
-
-2008-08-18 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (enum_local_groups): Return failure if looking for a single
- group succeeded. Add comment.
-
-2008-08-18 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): Keep correctly track of optional arguments.
- * mkpasswd.c (main): Ditto.
-
-2008-08-18 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): Always unset environment variable POSIXLY_CORRECT.
- Keep track of optional argumnts and fix up optind afterwards.
- * mkpasswd.c (main): Ditto.
-
-2008-08-17 Christopher Faylor <me+cygwin@cgf.cx>
-
- * cygcheck.cc (print_version): Update copyright dates.
-
-2008-08-17 Christopher Faylor <me+cygwin@cgf.cx>
-
- * mkpasswd.c (main): Avoid printing system accounts when a single user
- name has been requested.
-
-2008-08-17 Christopher Faylor <me+cygwin@cgf.cx>
-
- * Makefile.in (ALL_LDFLAGS): Add --enable-auto-import option to quiet
- ld warnings.
- * mkgroup.c: Change all global variables and most functions to static.
- (enum_local_groups): Add a print_current parameter to control whether
- entries for everything should be printed or just the current user.
- (enum_groups): Ditto.
- (main): Move call fetch_current_pgrp_sid earlier to avoid a NULL
- deference when no command line arguments are specified. Accommodate
- argument changes to above functions. Avoid printing SYSTEM account
- when print_current is specified. Issue error when extra stuff is found
- on the command line.
- * mkpasswd.c: Change all global variables and most functions to static.
- (enum_users): Add a print_current parameter to control whether entries
- for everything should be printed or just the current user.
- (main): Move call fetch_current_user_sid earlier to avoid a NULL
- deference when no command line arguments are specified. Accommodate
- argument change to above function. Avoid printing standard accounts
- when print_current is specified. Issue error when extra stuff is found
- on the command line.
-
-2008-08-15 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (fetch_current_pgrp_sid): New function to fetch primary
- group SID from user token.
- (current_group): Move up in file. Move fetching primary group SID to
- fetch_current_pgrp_sid.
- (enum_local_groups): Check if current SID is the same as current user's
- primary group SID.
- (enum_groups): Ditto.
- (main): Call fetch_current_pgrp_sid before enumerating groups. Call
- current_group only if current group hasn't been enumerated already.
- * mkpasswd.c (fetch_current_user_sid): New function to fetch current
- user SID from user token.
- (current_user): Move fetching current user SID to
- fetch_current_user_sid.
- (enum_users): Check if current SID is the same as current user's SID.
- (main): Call fetch_current_user_sid before enumerating users. Call
- current_user only if current user hasn't been enumerated already.
-
-2008-08-13 Corinna Vinschen <corinna@vinschen.de>
-
- * mount.cc (NT_MAX_PATH): Define.
- (longopts): Rename mount-commands option to mount-entries.
- (opts): Remove removed options.
- (struct opt): Move up in file to allow using it in usage.
- (usage): Change text for --mount-entries option. Remove
- -X option. Add valid options output.
- (main): Remove handling -b option.
- (convert_spaces): New static function to convert spaces to "\040"
- string.
- (mount_entries): Renamed from mount_commands. Rewrite to emit
- /etc/fstab compatible output.
- (show_cygdrive_info): Print "nouser" rather than "system".
- * umount.cc (longopts): Remove remove-all-mounts,
- remove-cygdrive-prefix, remove-system-mounts, system and user options.
- (opts): Remove A, c, s, S, u options.
- (usage): Remove text for all removed options.
- (main): Remove handling for all removed options.
- (remove_all_mounts): Remove.
- (remove_all_system_mounts): Remove.
- (remove_cygdrive_prefix): Remove.
- * utils.sgml: Fix mount and umount documentation. Move description
- of (cyg,not)exec options to mount table section.
-
-2008-08-04 Christopher Faylor <me+cygwin@cgf.cx>
-
- * cygcheck.cc (load_cygwin): Duplicate argv list since it disappears
- when cygwin1.dll is unloaded.
-
-2008-07-30 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
-
- * Makefile.in: Link cygcheck with -lntdll even without mingw-zlib.
-
-2008-07-27 Christopher Faylor <me+cygwin@cgf.cx>
-
- * cygcheck.cc (load_cygwin): Free the cygwin dll after we're done with
- it.
-
-2008-07-25 Christopher Faylor <me+cygwin@cgf.cx>
-
- * mount.cc: Remove non-unix-like options (-x,-t,b) throughout.
- (oopts): Use boolean constants for slightly increased clarity.
-
- * configure.in: Remove apparently unneeded program_transfer_name code.
- * configure: Regenerate.
-
-2008-07-24 Corinna Vinschen <corinna@vinschen.de>
-
- * utils.sgml: Remove useless text.
-
-2008-07-23 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): Fix test for duplicate domain/machine request.
- * mkpasswd.c (main): Ditto.
-
-2008-07-23 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c: Rework to allow per-domain/per-machine id_offset.
- Add -b option to skip builtin groups.
- (main): Simplify code.
- * mkpasswd.c: Rework to allow per-domain/per-machine id_offset.
- (main): Simplify code.
- * utils.sgml: Explain changed mkgroup/mkpasswd -d/-D/-l/-L options.
- Add mkgroup -b option.
-
-2008-07-23 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c: Consolidate variable names.
- (enum_unix_groups): New function.
- (print_special): Use LookupAccountSidW instead of LookupAccountSidA.
- (current_group): Ditto.
- (usage): Add -U option.
- (longopts): Add --unix option.
- (opts): Add -U option.
- (main): Handle -U option. Call enum_unix_groups if set.
- * mkpasswd.c: Consolidate variable names.
- (current_user): Use LookupAccountSidW instead of LookupAccountSidA.
- (enum_unix_users): New function.
- (usage): Add -U option.
- (longopts): Add --unix option.
- (opts): Add -U option.
- (main): Handle -U option. Call enum_unix_groups if set.
- * utils.sgml: Add -U option text to mkgroup and mkpasswd description.
-
-2008-07-22 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (enum_groups): Create full qualified groupname using
- domain or servername, depending on printing domain or machine accounts.
- * mkpasswd.c (enum_users): Ditto for users.
-
-2008-07-22 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): Remove special root group code. Only print
- SYSTEM group in case of printing local machine or local domain groups.
-
-2008-07-22 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in (cygcheck.exe): Link against ntdll.
- * bloda.cc: Use statically linked functions throughout.
- * cygpath.cc: Drop 9x considerations.
- * mkgroup.c: Revamp. Redefine -l and -d options to take optional
- machine and domain parameters. Redefine -c to work always, using
- token information. Add -L, -D, -C to create unique groupnames in
- domain\group syntax. Add -S option to define domain\group separator
- char. Ignore -u and -s options.
- * mkpasswd.c: Revamp. Redefine -l and -d options to take optional
- machine and domain parameters. Redefine -c to work always, using
- token information. Add -L, -D, -C to create unique usernames in
- domain\user syntax. Add -S option to define domain\user separator
- char. Ignore -g and -s options. Prefer to take homedir from $HOME
- over $HOMEDRIVE/$HOMEPATH.
- * path.cc (oopts): Add "acl", "noacl", "posix=0" and "posix=1" options.
- (getmntent): Accomodate throughout.
- * ps.cc: Fix copyright dates.
- * utils.sgml: Fix text for mkgroup and mkpasswd.
-
-2008-07-17 Corinna Vinschen <corinna@vinschen.de>
-
- * mount.cc (do_mount): Remove MOUNT_ENC code.
- (oopts): Remove "managed" option.
- (mount_commands): Drop "managed" handling.
- * path.cc (oopts): Remove "managed" option.
- (getmntent): Remove MOUNT_ENC code.
-
-2008-07-17 Corinna Vinschen <corinna@vinschen.de>
-
- * utils.sgml: Add id's to all examples.
-
-2008-07-09 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c: Use statically linked functions throughout, except for
- DsGetDcNameW. Reformat. Convert to use WCHAR for names throughout.
- Use defines instead of constants throughout.
- (MAX_SID_LEN): Define.
- (load_netapi): Just load DsGetDcNameW pointer.
- (psx_dir): Remove.
- (uni2ansi): Remove.
- (enum_local_users): Take server name and use in Net... call.
- (DBGSID): Define datastructure.
- (MAX_BUILTIN_SIDS): Define.
- (builtin_sid_list): Define global sid list.
- (builtin_sid_cnt): Define counter for global sid list.
- (enum_local_groups): Take server name and use in Net... and Lookup...
- calls. Take offset argument. Use MAX_PREFERRED_LENGTH in call to
- NetLocalGroupEnum. Check for duplicate builtin groups.
- (enum_users): Take server name and use in Net... call.
- (usage): Change text slightly.
- (print_version): Fix copyright.
- (main): Call enum_local_groups for domains as well.
- * mkpasswd.c: Use statically linked functions throughout, except for
- DsGetDcNameW. Reformat. Convert to use WCHAR for names throughout.
- Use defines instead of constants throughout.
- (MAX_SID_LEN): Define.
- (load_netapi): Just load DsGetDcNameW pointer.
- (uni2ansi): Use wcstombs.
- (current_user): Replace "unused_by_nt/2000/xp" by
- just "unused".
- (enum_users): Ditto.
- (print_version): Fix copyright.
-
-2008-05-22 Corinna Vinschen <corinna@vinschen.de>
-
- * setfacl.c (setfacl): Change from void to int. Return 2 in case of
- error.
- (main): Return with error code from setfacl.
-
-2008-05-15 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in (CYGWIN_BINS): Remove ipcrm and ipcs.
- * ipcrm.c: Remove.
- * ipcs.c: Remove.
-
-2008-03-23 Corinna Vinschen <corinna@vinschen.de>
-
- * mount.cc (usage): Mark -s and -u as ignored.
- (print_version): Simplify printing copyright dates.
- (main): Remove default_flag. Dont set flags on -s and -u options.
- (mount_commands): Drop handling -s and -u options.
-
-2008-03-22 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Fix multiple Cygwin DLL test.
- * path.cc: Fetch mount points from fstab files instead of from
- registry. Use adapted functions copied from Cygwin DLL.
- (mnt_t): Drop issys member. Define as "mnt_t" instead of "struct mnt_t"
- subsequently.
- (max_mount_entry): New variable.
- (unconvert_slashes): Move to earlier location in file. Make inline.
- (find2): Remove.
- (get_cygdrive0): Remove.
- (get_cygdrive): Remove.
- (skip_ws): New function.
- (find_ws): Ditto.
- (conv_fstab_spaces): Ditto.
- (read_flags): Ditto.
- (from_fstab_line): Ditto.
- (get_user): Ditto.
- (from_fstab): Ditto.
- (mnt_sort): Ditto.
- (read_mounts): Drop old registry code. Fetch
- "Software\Cygwin\Setup\rootdir" value from HKCU or HKLM key. Use
- rootdir extracted from module path as fallback. Call from_fstab for
- nouser and user mount points.
- (setmntent): Check max_mount_entry to test if read_mounts must be
- called.
- (getmntent): Use MOUNT_SYSTEM flag instead of mnt_t's issys member.
-
-2008-03-16 Brian Dessent <brian@dessent.net>
-
- * path.cc: Include malloc.h for alloca.
- (is_symlink): Rewrite. Just read the whole file in memory rather
- than by parts. Account for an ITEMIDLIST if present, as well as
- the new style of Cygwin shortcut supporting targets > MAX_PATH.
-
-2008-03-12 Corinna Vinschen <corinna@vinschen.de>
-
- * cygpath.cc (do_sysfolders): Use cygwin_conv_path.
- (do_pathconv): Use cygwin_conv_path and cygwin_conv_path_list.
- * dumper.cc (main): Use cygwin_conv_path. Allocate target path
- dynamically.
- * mkpasswd.c (current_user): Use cygwin_conv_path.
- (enum_users): Ditto.
- * ps.cc (NT_MAX_PATH): Define.
- (main): Use cygwin_conv_path.
- * regtool.cc (find_key): Ditto. Allocate target path dynamically.
- (cmd_save): Ditto.
-
-2008-03-11 Brian Dessent <brian@dessent.net>
-
- * cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1
- chars.
-
-2008-03-11 Brian Dessent <brian@dessent.net>
-
- * cygcheck.cc (dirname): New static function.
- (find_app_on_path): Use SYMLINK_MAX. Resolve symlink relative
- to link's location. Adjust to the fact that cygpath already
- normalizes its return value.
- * path.cc (rel_vconcat): Add cwd parameter, and use it instead
- of calling GetCurrentDirectory() if possible. Rename throughout.
- (vcygpath): Rename from cygpath and accept cwd and va_list. Pass
- cwd on to rel_vconcat().
- (cygpath_rel): New front end for vcygpath.
- (cygpath): Ditto.
- * path.h (cygpath_rel): Declare.
- (SYMLINK_MAX): Define to 4095.
-
-2008-03-09 Brian Dessent <brian@dessent.net>
-
- * Makefile.in (install): Don't install the testsuite.
-
-2008-03-08 Brian Dessent <brian@dessent.net>
-
- * Makefile.in: Add a 'check' target that builds and runs
- testsuite.exe from path-testsuite.o and testsuite.o.
- * path.cc: Include testsuite.h.
- (struct mnt): Change to a mnt_t typedef and don't define
- mount_table when TESTSUITE is defined.
- (find2): Don't include when TESTSUITE is defined to avoid warning.
- (get_cygdrive0): Ditto.
- (get_cygdrive): Ditto.
- (read_mounts): Provide empty implementation when TESTSUITE is
- defined.
- (vconcat): Use the isslash macro.
- (unconvert_slashes): New helper to convert to backslashses.
- (rel_vconcat): Handle relative paths more gracefully.
- (cygpath): Skip a leading "./" sequence. Avoid double-slashes.
- Normalize final output to backslashes and remove redundant path
- sequences.
- * testsuite.cc: New file implementing testsuite driver.
- * testsuite.h: New header implementing harness mount table and
- series of tests.
-
-2008-03-08 Brian Dessent <brian@dessent.net>
-
- * Makefile.in: Reorganize considerably, using GNU make's
- static pattern rules and target-specific variables.
-
-2008-02-28 Corinna Vinschen <corinna@vinschen.de>
-
- * mkpasswd.c (main): Simplify generating SYSTEM entry. Add entries
- for LocalService and NetworkService accounts. Change comments.
-
-2008-01-13 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Always try to get a OSVERSIONINFOEX
- first. Load kernel32.dll earlier. Make osname a buffer. Simplify
- Non-NT code. Use GetProductInfo in Vista/2008 case. Clean up
- non-Vista version info. Exit early if not on NT.
-
-2007-12-29 Dave Korn <dave.korn@artimi.com>
-
- * bloda.cc (enum bad_app): Add BYTEMOBILE.
- (dodgy_app_detects[]): Add FILENAME entry to detect bmnet.dll.
- (big_list_of_dodgy_apps[]): Add description for BYTEMOBILE.
-
-2007-12-20 Brian Dessent <brian@dessent.net>
-
- * Makefile.in (cygcheck.exe): Don't link to ntdll.
- * bloda.cc (pNtQuerySystemInformation): Add.
- (pRtlAnsiStringToUnicodeString): Add.
- (get_process_list): Use function pointers for NT functions.
- (dump_dodgy_apps): Skip dodgy app check on non-NT platforms.
- Use GetProcAddress for NT-specific functions.
-
-2007-12-07 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc (opts): Add missing 'W'.
-
-2007-12-06 Corinna Vinschen <corinna@vinschen.de>
-
- * ps.cc: Include limits.h.
- (main): Set file name buffer size to PATH_MAX. Use progname or
- progname_long member of struct external_pinfo dependent of the value of
- the struct's version member.
-
-2007-08-31 Dave Korn <dave.korn@artimi.com>
-
- * mkgroup.c (enum_groups): Use MAX_PREFERRED_LENGTH in netgroupenum
- call so that it will automatically size returned buffer sufficiently.
-
-2007-08-03 Dave Korn <dave.korn@artimi.com>
-
- * Makefile.in (cygcheck.exe): Add bloda.o as prerequisite, adjusting
- dependency-filtering $(wordlist ...) call appropriately. Link ntdll.
- (bloda.o): New rule to build bloda.o
- * cygcheck.cc (dump_sysinfo): Call bloda function dump_dodgy_apps().
- * bloda.cc: New file implements detection of applications from the
- Big List Of Dodgy Apps.
-
-2007-07-24 Corinna Vinschen <corinna@vinschen.de>
-
- * COPYING.dumper: New file.
- * dumper.cc: Change license to plain GPLv2 + later.
- * dumper.h: Ditto.
- * parse_pe.cc: Ditto.
-
-2007-07-23 Christopher Faylor <me+cygwin@cgf.cx>
-
- * strace.cc (create_child): Don't convert a path from cygwin format
- unless it has a slash.
-
-2007-07-09 Christopher Faylor <me+cygwin@cgf.cx>
-
- * strace.cc (usage): Add missing description for -q.
-
-2007-07-09 Christopher Faylor <me+cygwin@cgf.cx>
-
- * Makefile.in (kill.exe): Remove reliance on libiberty.
- * kill.cc (strsigno): New function patterned after libiberty but using
- newly exported cygwin array.
-
-2007-06-03 Christopher Faylor <me+cygwin@cgf.cx>
-
- * cygcheck.cc (pathlike): New class.
- (paths): Redefine as type pathlike.
- (display_error): Declare a few different ways to allow more flexible
- usage throughout.
- (display_error_fmt): New function for those cases where C++ just isn't
- enough.
- (add_path): Rewrite to allocate pathlike paths. Always tack on a
- trailing slash since that's what everyone who uses it wants. NULL
- terminate the path list. Register "it's a system path" field.
- (init_path): Call add_path with info regarding whether path is a system
- path or not.
- (pathlike::check_existence): Move into pathlike class. Accept file and
- extension arguments to build up path on the fly. Modify other
- arguments.
- (find_on_path): Constify return value and appropriate arguments.
- Eliminate short-circuit for fully-qualified paths. Simplify loop which
- iterates over path.
- (already_did): Constify argument.
- (track_down): Ditto. Regularize some error messages.
- (find_app_on_path): Ditto.
- (cygcheck): Constify argument. Use 20th century string handling
- functions.
- (dump_sysinfo): Remove odd inclusion of '\\bin' "Just in case".
- Accommodate change of paths to pathlike.
- * path.cc (isslash): Rename from SLASH_P and use throughout.
- (rel_vconcat): Front-end to vconcat which prepends cwd to path before
- passing along for conversion to native windows.
- (cygpath): Remove "./" test. Call rel_vconcat if filename appears to
- be relative.
-
-2007-05-29 Pedro Alves <pedro_alves@portugalmail.pt>
-
- * dumper.cc (dumper::prepare_core_dump): Record a phdr for each section.
-
-2007-05-29 Corinna Vinschen <corinna@vinschen.de>
-
- * cygpath.cc (do_options): Allow outputflag combined with other
- basic flags. Only check options_from_file_flag if reading options
- from command line.
- (main): Check for NULL argz vector. Don't free argz vector prematurely.
- Don't force flag combination in !options_from_file_flag case.
-
-2007-05-23 Corinna Vinschen <corinna@vinschen.de>
-
- * cygpath.cc: Include argz.h.
- (options_from_file_flag): Move from main to global static variable.
- (mode_flag): Ditto.
- (do_sysfolders): Rename from dowin and accommodate throughout.
- Don't exit from here.
- (do_pathconv): Rename from doit and accommodate throughout.
- (print_version): Change copyright.
- (do_options): New function, centralizing option processing.
- Rework checking options for correctness.
- (action): New function, centralizing calling worker functions.
- (main): Simplify. Move option processing to do_options. Move calling
- worker functions to action. Rework getting arguments from files.
-
-2007-03-30 Mark Mitchell <mark@codesourcery.com>
-
- * utils/cygpath.cc (get_long_path_name_w32impl): Close handles returned
- by FindFirstFile.
-
-2007-03-30 Christopher Faylor <me@cgf.cx>
-
- * mount.cc (main): Turn dos file warnings off since we know what we're
- doing.
-
-2007-02-22 Corinna Vinschen <corinna@vinschen.de>
-
- * ipcs.c (_POSIX2_LINE_MAX): Drop definition.
-
-2007-02-20 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Add "not supported" to osname on 9x
- machines. Drop "not supported" for Vista. Drop "Longhorn" text
- for now.
-
-2007-01-09 Christian Franke <franke@computer.org>
-
- * cygpath.cc (usage): Add -O and -F, remove tabs.
- (get_special_folder): New function.
- (get_user_folder): New function.
- (dowin): Add -O and -F, better -D, -P error handling.
- (main): Add -O and -F.
- * utils.sgml (cygpath): Document -O and -F.
-
-2006-12-21 Corinna Vinschen <corinna@vinschen.de>
-
- * dumper.cc: Include ansidecl.h before including bfd.h to woraround
- a problem with the order in which system include files are included.
-
-2006-12-11 Christopher Faylor <me@cgf.cx>
-
- * dumper.cc: Add an include to accommodate new include/elf usage.
-
-2006-12-10 Christopher Faylor <me+cygwin@cgf.cx>
-
- * mount.cc (do_mount): Avoid unnecessary cygwin_conv_to_win32_path and
- pass POSIX path directly - this avoids a cygwin DLL warning.
-
-2006-10-21 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc (key_type): Drop.
- (REG_AUTO): Define.
- (value_type): Replace key_type. Use REG_xxx values directly.
- Accomodate change throughout.
- (longopts): Add --dword, --dword-le, --none, --qword and --hex options.
- (opts): Add -d, -D, -n, -Q and -x options.
- (types): Array to convert REG_xxx into strings.
- (hex): New variable to keep value of --hex option.
- (usage): Accomodate new options. Print only the necessary by default.
- Only be verbose in case of -h/--help option.
- (cmd_list): Use key separator from -K option when printing.
- Print value type when verbose option is given. Handle so far not
- handled REG_xxx types.
- (cmd_set): Avoid SEGV due to missing argument. Handle so far not
- handled REG_xxx types.
- (cmd_get): Handle --binary option type agnostic. Handle so far not
- handled REG_xxx types.
- (main): Handle new options.
-
-2006-10-19 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc (longopts): Add --wow32 option.
- (opts): Add -W option.
- (usage): Add text for --wow32/-W option.
- (main): Handle --wow32/-W option.
- * utils.sgml: Document the new -W option.
-
-2006-10-16 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc (KEY_WOW64_64KEY): Drop definition. Instead define
- WINVER to 0x0502 before including windows.h.
-
-2006-10-16 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc (KEY_WOW64_64KEY): Define.
- (longopts): Add --wow64 option.
- (opts): Add -w option.
- (wow64): New variable to control usage of KEY_WOW64_64KEY access flag.
- (usage): Add text for --wow64/-w option.
- (print_version): Fix copyright.
- (find_key): Use wow64 value in calls to RegOpenKeyEx and RegCreateKeyEx.
- (cmd_add): Use wow64 value in call to RegCreateKeyEx.
- (regDeleteKeyEx): New function pointer to load RegDeleteKeyEx function
- dynamically.
- (cmd_remove): Load and use regDeleteKeyEx when wow64 is set.
- (main): Handle --wow64/-w option.
- * utils.sgml: Document the new -w option.
-
-2006-10-05 Igor Peshansky <pechtcha@cs.nyu.edu>
-
- * cygcheck.cc (get_word, get_dword): Move to path.cc.
- (LINK_EXTENSION): New macro.
- (check_existence): New static function.
- (find_on_path): Check for symbolic links if asked.
- (dll_info): New error handling.
- (track_down): Only call dll_info() for executables, display
- an error for symlinks, and print magic number for others.
- (find_app_on_path): New static function.
- (cygcheck, dump_sysinfo): Call find_app_on_path() instead of
- find_on_path().
- * path.cc (cmp_shortcut_header): New static function.
- (get_word, get_dword): Moved from cygcheck.cc.
- (EXE_MAGIC, SHORTCUT_MAGIC, SYMLINK_COOKIE, SYMLINK_MAGIC): New
- macros.
- (is_exe, is_symlink, readlink): New functions.
- * path.h (is_exe, is_symlink, readlink): Declare.
- (get_word, get_dword): Ditto.
-
-2006-09-12 Christopher Faylor <cgf@timesys.com>
-
- * Makefile.in: Fix -ntdll typo.
-
-2006-09-11 Eric Blake <ebb9@byu.net>
-
- * cygcheck.cc (main): Restore POSIXLY_CORRECT before displaying user's
- environment.
-
-2006-08-03 Corinna Vinschen <corinna@vinschen.de>
-
- * path.cc (vconcat): Don't convert backslahes to slashes.
- (cygpath): Return native path with all backslashes.
-
-2006-08-02 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in (cygpath.exe): Add rule to link cygpath against ntdll.dll.
- * cygpath.cc: Include DDK headers.
- (RtlAllocateUnicodeString): New static inline function.
- (get_device_name): New static function to evaluate DOS path from
- native NT path.
- (get_device_paths): New function to do the same for path lists.
- (doit): Call get_device_paths/get_device_name where appropriate.
-
-2006-07-30 Ilya Bobir <ilya@po4ta.com>
-
- * cygpath.cc (get_long_name): Fallback to get_long_path_name_w32impl.
-
-2006-07-27 Corinna Vinschen <corinna@vinschen.de>
-
- * cygpath.c (get_long_name): Cover the case that GetLongPathName
- doesn't return valid information for non-existant files. Just return
- incoming filename in that case.
-
-2006-07-03 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * Makefile.in: Build setmetamode.exe.
- * setmetamode.c: New file.
-
-2006-05-24 Christopher Faylor <cgf@timesys.com>
-
- * configure.in: Update to newer autoconf.
- (thanks to Steve Ellcey)
- * configure: Regenerate.
- * aclocal.m4: New file.
-
-2006-05-24 Christopher Faylor <cgf@timesys.com>
-
- * strace.cc (proc_child): Propagate return code from child process.
- (dostrace): Ditto.
- (main): Ditto.
-
-2006-03-03 Christian Franke <franke@computer.org>
-
- * regtool.cc (options): Add 'binary'.
- (usage): Document 'load|unload|save' and '-b'.
- (find_key): Add 'options' parameter, add load/unload.
- (cmd_set): Add KT_BINARY case.
- (cmd_get): Add hex output in KT_BINARY case.
- (cmd_load): New function.
- (cmd_unload): New function.
- (set_privilege): New function.
- (cmd_save): New function.
- (commands): Add load, unload and save.
- (main): Add '-b'
- * utils.sgml (regtool): Document it.
-
-2006-02-17 Corinna Vinschen <corinna@vinschen.de>
-
- * cygpath.cc (get_long_name): Load GetLongPathNameA instead of incorrect
- GetLongPathName.
- (doit): Create mixed filename after converting to short or long pathname
- respectively.
-
-2006-02-17 Jerry D. Hedden <jerry@hedden.us>
-
- * ps.cc (main): Set aflag if -p option is given.
-
-2006-02-16 Jerry D. Hedden <jerry@hedden.us>
-
- * ps.cc (longopts): Add --process option.
- (opts): Add -p option.
- (usage): Mention -p/--process option.
- (main): Handle -p option.
- * utils.sgml: Describe -p/--process option.
-
-2006-02-15 Igor Peshansky <pechtcha@cs.nyu.edu>
-
- * regtool.cc (usage): Clarify help for "-K".
-
-2006-02-08 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (find_on_path): Update copyright text.
-
-2006-02-08 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (find_on_path): Create copy of rv on successful access
- check, since rv can be reused in subsequent calls.
-
-2006-01-19 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (common_paths): Add "patch".
-
-2006-01-19 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (init_paths): Record first_nonsys_path.
- (find_on_path): Start on first nonsys path when !search_sysdirs.
-
-2006-01-18 Christopher Faylor <cgf@timesys.com>
-
- * Makefile.in (sysconfdir): Remove unneeded variable.
-
- * mkgroup.c: Replace ` with ' throughout.
- * mkpasswd.c: Ditto.
- * setfacl.c: Ditto.
- * ssp.c: Ditto.
-
-2006-01-18 Dave Korn <dave.korn@artimi.com>
-
- * cygpath.cc (dowin): Remove stray debugging printf statement.
-
-2006-01-17 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Replace etcdir with sysconfdir.
-
-2006-01-13 Brian Dessent <brian@dessent.net>
-
- * Makefile.in (cygcheck.exe): Do not link against libwininet.a.
- * cygcheck.cc (pInternetCloseHandle): Define global function pointer.
- (display_internet_error): Use it.
- (package_grep): Attempt to load wininet.dll at runtime. Call WinInet
- API through function pointers throughout.
-
-2006-01-13 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Convert k32 to HMODULE.
-
-2006-01-13 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Convert osname to const and remove casts
- in subsequent assignments. Recognize Longhorn/Vista and report as not
- yet supported. Recognize when running under WOW64 and report native
- CPU type. Slightly rearrange \n printing.
-
-2006-01-12 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc: Replace ` with ' throughout.
-
-2006-01-05 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (dump_sysinfo): Report the failing drive to prevent
- having to guess.
-
-2005-12-29 Christopher Faylor <cgf@timesys.com>
-
- * strace.cc (nprocesses): Make static global.
- (quiet): New variable.
- (strace_active): Ditto.
- (add_child): Increment nprocesses here. Don't add a child if it is
- already added (windows bug?). Report on child if not quiet.
- (get_child): Just return NULL if child not found.
- (remove_child): Report on child if not quiet.
- (attach_process): Don't complain if given a windows process. Use
- windows pid in error.
- (handle_output_debug_string): Issue error if trying to manipulate a process that we don't know about.
- Handle _STRACE_CHILD_PID - attach to reported child when we get this.
- (proc_child): Move nprocesses to file scope.
- Report on exceptions.
- (longopts): Implement "--quiet".
- (opts): Implement "-q".
- (main): Manipulate quiet flag.
- * utils.sgml (strace): Add words describing '-q'.
-
-2005-12-29 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (common_apps): Add crontab, vi, vim.
-
-2005-12-19 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * dump_setup.cc (package_find): Fix is_alias computation for "/usr/lib".
-
-2005-12-14 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (common_apps): Add a few more binaries to look for.
-
-2005-12-05 Christopher Faylor <cgf@timesys.com>
-
- * strace.cc (show_usecs): Renamed from 'usecs'.
- (main): Use show_usecs rather than usecs. Toggle delta if '-u' is
- specified.
- (handle_output_debug_string): Avoid printing microsecond timestamp if
- show_usecs == 0.
- * utils.sgml (strace): Add words to describe '-u'.
-
-2005-11-22 Brian Dessent <brian@dessent.net>
-
- * Makefile.in: Link cygcheck with libwininet.a.
- * cygcheck.cc: Add includes.
- (grep_packages): New global variable.
- (display_internet_error): New function.
- (safe_chars): New global variable.
- (base_url): Ditto.
- (package_grep): New function.
- (usage): Reword --help output for clarity. Document new argument.
- (longopts): Add 'package-query' option.
- (opts): Add 'p' option, reorder to be consistent with 'longopts'.
- (main): Accommodate new option.
- * utils.sgml (cygcheck): Update --help output. Document new -p option.
-
-2005-09-22 Corinna Vinschen <corinna@vinschen.de>
-
- Align error message handling to mkpasswd's error messages throughout.
- * mkgroup.c (print_win_error): Create macro calling ...
- (_print_win_error): ... this function created from former
- print_win_error. Move up in source.
- (PDOMAIN_CONTROLLER_INFOW): Define return type of DsGetDcNameW.
- (dsgetdcname): New function pointer for DsGetDcNameW.
- (load_netapi): Get DsGetDcNameW address.
- (main): If DsGetDcNameW is available, use it.
- * mkpasswd.c (PDOMAIN_CONTROLLER_INFOW): Define return type of
- DsGetDcNameW.
- (dsgetdcname): New function pointer for DsGetDcNameW.
- (load_netapi): Get DsGetDcNameW address.
- (main): If DsGetDcNameW is available, use it. Rename local variable
- domain_name_specified to domain_specified as in mkgroup.c.
-
-2005-09-08 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * regtool.cc: Extend copyright-years.
- (print_version): Ditto.
- (cmd_list): Don't depend on terminating '\0' being present on
- string-values.
- (cmd_get): Don't attempt to read more than present, but keep
- extra space for terminating '\0'. Really output REG_BINARY.
- Don't leak memory.
- (cmd_set): Include trailing '\0' in string's length.
-
-2005-08-18 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.c (longopts): Add --logonserver option.
- (opts): Add -d option.
- (GetPW): Add server parameter which is given to Net functions.
- (ChangePW): Ditto.
- (PrintPW): Ditto.
- (SetModals): Ditto.
- (usage): Add description for -d/--logonserver option.
- (main): Add option handling for -d/--logonserver. Use LOGONSERVER
- environment variable content for server to contact, unless
- -d/--logonserver option is given. If both is missing, use NULL.
-
-2005-08-16 Brian Dessent <brian@dessent.net>
-
- * cygcheck.cc (dump_sysinfo_services): Properly null-terminate 'buf'.
- Avoid extraneous cygrunsrv invocation if 'verbose' is true.
-
-2005-08-03 Corinna Vinschen <corinna@vinschen.de>
-
- * mount.cc (longopts): Fix typo which disallows --options option.
-
-2005-07-19 Christopher Faylor <cgf@timesys.com>
- Eric Blake <ebb9@byu.net>
-
- * cygcheck.cc (find_on_path): Perform .exe magic on non-PATH search.
-
-2005-07-05 Eric Blake <ebb9@byu.net>
-
- * cygcheck.cc (track_down, cygcheck): Return true on success.
- (main): Reflect cygcheck failures in exit status.
-
-2005-06-14 Corinna Vinschen <corinna@vinschen.de>
-
- * parse_pe.c (exclusion::sort_and_check): Remove crude cast.
-
-2005-05-30 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Recognize XP Media Center and Tablet PC
- Editions. Change .NET to 2003 throughout. Recognize 2003 Web Server
- and Datacenter Server. Report when running in terminal server session.
-
-2005-05-27 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (load_cygwin): Make half-hearted attempt to work with
- older DLLs.
- * strace.cc (load_cygwin): Ditto.
-
-2005-05-22 Brian Dessent <brian@dessent.net>
-
- * cygcheck.cc (dump_sysinfo_services): Add new function that uses
- new cygrunsrv options to dump service info.
- (dump_sysinfo): Call dump_sysinfo_services if running under NT.
- Change 'Cygnus' to 'Cygwin' in output.
-
-2005-05-20 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (load_cygwin): Remove debugging statement.
-
-2005-05-20 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (dump_sysinfo): Don't attempt to use path if it is not
- set.
- (nuke): Fix off by one error in allocation of environment variable.
- (load_cygwin): Always set PATH even if cygwin environment is empty.
-
-2005-05-16 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (cygwin_internal): Define as a "C" function.
- * strace.cc (cygwin_internal): Ditto.
-
- * cygpath.cc (print_version): Update copyright.
-
-2005-05-15 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (load_cygwin): Avoid calling putenv with a NULL path.
-
-2005-05-15 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (load_cygwin): Don't touch $PATH for now.
- (print_version): Fix copyright.
- * strace.cc (print_version): Ditto.
-
-2005-05-13 Christopher Faylor <cgf@timesys.com>
-
- * mount.cc (mount_commands): Display "-X" option when appropriate.
-
-2005-05-08 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (nuke): New function.
- (load_cygwin): New function.
- (main): Use load_cygwin to load argv/envp from cygwin environment, if
- appropriate.
-
-2005-05-08 Christopher Faylor <cgf@timesys.com>
-
- * strace.cc (attach_process): Don't call load_cygwin(). Assume that
- it's already happened.
- (dotoggle): Ditto.
- (main): Set argv from cygwin environment, if it exists.
-
-2005-05-01 Christopher Faylor <cgf@timesys.com>
-
- * mount.cc (usage): Clarify action of -m option.
-
-2005-04-29 Dave Korn <dave.korn@artimi.com>
-
- * path.cc (getmntent): Add previously-omitted 'noexec' and 'managed'
- flags to mnt_opts string if present in mount flags.
-
-2005-04-20 Brian Dessent <brian@dessent.net>
-
- * utils.sgml (mount): Clarify setting cygdrive prefix for user
- and system-wide.
-
-2005-03-24 Brian Dessent <brian@dessent.net>
-
- * cygcheck.cc (init_paths): Use full path instead of "." for the
- current directory. Do not add "." if present in $PATH.
- (dump_sysinfo): Skip placeholder first value of paths[].
-
-2005-03-07 Christopher Faylor <cgf@timesys.com>
-
- * kill.cc (getsig): Rectify bug introduced by 2005-02-26 change. Don't
- pad signal name with spaces.
-
-2005-03-07 Corinna Vinschen <corinna@vinschen.de>
-
- * strace.cc (handle_output_debug_string): Fix compiler warning.
-
-2005-03-06 Christopher Faylor <cgf@timesys.com>
-
- * cygpath.cc (usage): Pass in one more copy of program_name to printf
- to avoid a SEGV.
-
-2005-02-27 Christopher Faylor <cgf@timesys.com>
-
- * regtool.cc (opts): The argument to 'K' is not optional.
- (main): Revert previous change. Just let getopt deal with missing
- argument.
-
-2005-02-27 Christopher Faylor <cgf@timesys.com>
-
- * regtool.cc (main): Avoid a SEGV when nothing follows -K.
-
-2005-02-26 Christopher Faylor <cgf@timesys.com>
-
- * kill.cc (getsig): Avoid buffer overflow when generating a signal name.
-
- * strace.cc (handle_output_debug_string): Make error a little more specific.
-
-2005-02-23 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * cygpath.cc (usage): Clarify help output to indicate acceptance
- of multiple file names as arguments.
-
-2005-01-16 Christopher Faylor <cgf@timesys.com>
-
- * ps.cc (main): Eliminate use of PID_ZOMBIE.
- * strace.cc (main): Recognize new option for displaying hex value of
- strace type.
- (handle_output_debug_string): Prepend output with hex value of strace
- message if -H is specified.
-
-2005-01-11 Pierre Humblet <pierre.humblet@ieee.org>
-
- * mkpasswd.c (print_win_error): Transform into macro.
- (_print_win_error): Upgrade former print_win_error by
- printing the line.
- (current_user): Call _print_win_error.
- (enum_users): Print name in case of lookup failure.
- (enum_local_groups): Ditto.
-
-2004-11-18 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (eprintf): New function.
-
-2004-11-16 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (find_on_path): Clear show_error and/or print_failed
- parameters to display_error.
- (rva_to_offset): Ditto.
- (dll_info): Ditto.
- (track_down): Ditto.
-
-2004-11-13 Pierre Humblet <pierre.humblet@ieee.org>
-
- * kill.cc (forcekill): Do not pass negative pids to
- cygwin_internal. Check if sig == 0. Improve error messages.
- (main): Make pid a long long and distinguish between pids, gpids
- (i.e. negative pids) and Win9x pids.
-
-2004-11-11 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc: Change "keyeprint" to "display_error" throughout.
-
-2004-11-11 Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (main): Allow a '-l' without an additional argument.
-
-2004-11-11 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (keyeprint): New optional parameters: show_error and
- print_failed.
-
-2004-10-31 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (get_dword): Fix errormessage.
- (cygwin_info): Ditto.
- (track_down): Ditto.
- (check_keys): Ditto.
-
-2004-10-27 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (dump_sysinfo): Warn about missing or multiple cygwin1
- dlls.
-
-2004-10-25 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (dump_sysinfo): Add leading newline before legend for
- drive-list.
-
-2004-10-22 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (dump_sysinfo): In legend for drive-list: Add ``ram'' and
- ``unk''. Use single puts. Add leading newline. Line up equal-signs.
-
-2004-10-20 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (dump_sysinfo): Allow for larger drives in drive-list.
- Change ``Used'' to ``Free'' in helptext-title for drive-list.
-
-2004-10-18 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (pretty_id): Don't let i become negative. Fix
- printf-format.
-
-2004-10-17 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (pretty_id): Allocate space for ')' in uid and guid.
-
-2004-10-17 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
- Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (pretty_id): Allocate space for trailing '\0' in uid and
- guid.
-
-2004-10-15 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
- Christopher Faylor <cgf@timesys.com>
-
- * cygcheck.cc (pretty_id): Don't exit on id error. Fix size
- calculations.
-
-2004-10-14 Christopher Faylor <cgf@timesys.com>
- Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (pretty_id): Correct column calculations. Abort if id is
- acting funny.
-
-2004-10-10 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (add_path): Don't leak memory when path is already in
- ``paths''.
-
-2004-10-10 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (dump_sysinfo): Warn about trailing (back)slash on mount
- entries.
-
-2004-10-10 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (dump_sysinfo): Don't warn about empty path components,
- just display ``.''.
-
-2004-10-06 Corinna Vinschen <corinna@vinschen.de>
-
- * strace.cc (_impure_ptr): Remove.
-
-2004-10-06 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (dump_sysinfo): Warn about empty path components.
-
-2004-10-04 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * cygcheck.cc (pretty_id): Close pipe.
-
-2004-09-23 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * dump_setup.cc (dump_setup): Remove unneeded strlen when check_files
- is not set.
-
-2004-09-22 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
- Corinna Vinschen <corinna@vinschen.de>
-
- * dump_setup.cc (dump_setup): Avoid trailing spaces on package-list.
-
-2004-09-15 Bas van Gompel <cygwin-patch.buzz@bavag.tmfweb.nl>
-
- * getfacl.c (main): Correct layout when nopt is set.
-
-2004-07-12 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * mkgroup.cc (netapibufferallocate,netgroupgetinfo): New function
- pointers.
- (load_netapi): Load NetApiBufferAllocate and NetGroupGetInfo.
- (enum_local_groups,enum_groups): Add disp_groupname parameter.
- Load info for disp_groupname if specified.
- (usage): Add description of "-g/--group" option.
- (longopts,opts): Add "-g/--group" option.
- (main): Process "-g/--group" option.
- * utils.sgml (mkgroup): Add description of "-g/--group" option
-
-2004-06-15 Alan Modra <amodra@bigpond.net.au>
-
- * dumper.cc (dumper::prepare_core_dump): Use bfd_get_section_size
- instead of _raw_size.
- (dumper::write_core_dump): Likewise.
- * parse_pe.cc (select_data_section): Likewise.
-
-2004-05-29 John Paul Wallington <jpw@gnu.org>
-
- * ssp.c (usage): Add missing linefeed.
-
-2004-05-27 Christopher Faylor <cgf@alum.bu.edu>
-
- * kill.cc (listsig): Fix "kill -l" segv. NSIG includes Signal 0, so we
- need to avoid calling strtosigno with NSIG - 1.
-
-2004-03-21 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (dump_sysinfo): Remove "Win95/NT" from output.
-
-2004-03-15 Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc (usage): Don't issue helpful message if -i is used.
- (from Igor Pechtchanski)
-
-2004-03-13 Rob Siklos <rob2@siklos.ca>
-
- * kill.cc (get_debug_priv): New function.
- (forcekill): Call get_debug_priv before trying to kill process.
-
-2004-02-24 Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc (long_options): Add "mode" option.
- (options): Ditto.
- (usage): Report on new option.
- (report_mode): New function.
- (main): Implement -M option.
-
-2004-02-20 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (build_dumper): Detect missing iconv library.
-
- * cygpath.cc (dowin): Report on filename conversion errors.
- (doit): Ditto.
-
- * strace.cc (main): Use symbolic constant for _STRACE_ALL when setting
- mask.
-
-2004-02-14 Corinna Vinschen <corinna@vinschen.de>
-
- * ssp.c (opts): Add leading '+' to force posixly correct behaviour.
-
-2004-02-11 Corinna Vinschen <corinna@vinschen.de>
-
- * strace.cc (opts): Add leading '+' to force posixly correct
- behaviour.
- (main): Revert POSIXLY_CORRECT manipulations.
-
-2004-02-10 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (main): Guard against previous setting of POSIXLY_CORRECT.
-
-2004-02-10 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc: Update copyrights.
- * cygcheck.cc: Update copyrights.
-
-2004-02-10 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (main): Ensure POSIXLY_CORRECT argument ordering.
- * cygcheck.cc (main): Ditto.
-
-2004-01-23 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (pretty_id): Make more robust in absence of id.exe.
-
-2004-01-22 Corinna Vinschen <corinna@vinschen.de>
-
- * cygpath.cc (dowin): Revert accidental checkin from November.
-
-2003-11-26 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): Print "root" group with local admins group sid
- and gid 0.
-
-2003-11-19 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in: Add rules to build ipcrm and ipcs.
- * ipcrm.c: New file.
- * ipcs.c: New file.
-
-2003-11-14 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c: Avoid compiler warnings throughout.
- * mkpasswd.c: Ditto.
- * passwd.c: Ditto.
-
-2003-11-07 Mark Blackburn <marklist@fangorn.ca>
-
- * cygpath.cc (main): Allow multiple pathnames on command line.
-
-2003-11-04 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.c (PrintPW): Turn around meaning printed for "Password not
- required" option to be in line with Windows meaning.
- (main): Use more appropriate 1008 option when calling
- NetUserSetInfo to change flag values.
-
-2003-11-04 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.c (UF_LOCKOUT): Remove (defined in lmaccess.h).
- (version): Bump version number to 1.5.
- (longopts): Add -c, -C, -e, -E, -p, -P options.
- (opts): Ditto.
- (PrintPW): Print values of UF_PASSWD_CANT_CHANGE and
- UF_DONT_EXPIRE_PASSWD flags. Slightly reformat output. Don't suppress
- correct system password settings just because the account has admin
- privileges.
- (usage): Define as "noreturn" function. Restructure and rephrase
- output. Accommodate new options.
- (print_version): Fix copyright dates.
- (main): Accommodate new options for setting UF_PASSWD_CANT_CHANGE,
- UF_DONT_EXPIRE_PASSWD and UF_PASSWD_NOTREQD settings.
-
-2003-10-17 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (pretty_id): Don't exec if `id' program is not found.
-
-2003-09-20 Christopher Faylor <cgf@redhat.com>
-
- * kill.cc (main): Allow negative pids (indicates process groups).
-
-2003-09-17 Christopher Faylor <cgf@redhat.com>
-
- * parse_pe.cc (exclusion::sort_and_check): Make error message a little
- more explicit and ignore (hopefully) harmless region overlap.
-
-2003-09-13 Christopher Faylor <cgf@redhat.com>
-
- * kill.c (forcekill): Wait for process to terminate even if
- TerminateProcess says it failed.
-
-2003-09-11 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Tweak mingw libz.a detection to make it more reliably
- detect when libz.a is not available.
-
-2003-09-11 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * cygcheck.cc (dump_only): New global variable.
- (usage): Add "--dump-only" option, fix "--verbose" line.
- (longopts, opts): Add "--dump-only" option.
- (main): Process the "--dump-only" flag. Add new semantic check.
- Pass dump_only information to dump_setup().
-
-2003-09-11 Corinna Vinschen <corinna@vinschen.de>
-
- * getfacl (main): Remove extern declaration of optind.
- * setfacl (main): Remove extern declaration of optarg and optind.
-
-2003-09-10 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (cygcheck.o): Use MINGW_CXX for compilation.
- * cygcheck.cc: Just include <getopt.h> rather than cygwin version.
- (pretty_id): Avoid compiler warnings.
- * cygpath.cc (usage): Ditto.
-
-2003-09-10 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (MINGW_CXX): Define and use for mingw-compiled files.
- * path.cc: Include more path info in cygwin-specific includes since the
- cygwin directory is no longer included by default.
-
-2003-09-10 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: More fixups to adjust for the fact that mingw_getopt.o
- is no longer built.
-
-2003-09-10 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Remove references to getopt since it is now part of
- mingwex.
-
-2003-09-08 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Rename libz.h -> zlib.h.
-
-2003-09-07 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Detect existence of mingw zlib headers and libraries.
- Build cygcheck without package checking if they are unavailable.
- * dump_setup.cc: Generate dummy zlib macros when zlib is not available.
- (open_package_list): Use zlib functions to uncompress package lists.
- Return gzFile rather than FILE *.
- (check_package_files): Change fp to gzFile to accommodate zlib
- functions. Use gzgets to read from package file. Use gzclose to close
- the handle.
- (package_list): Ditto.
- (package_find): Ditto.
-
-2003-09-05 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * dump_setup.cc (check_package_files): Don't fail on empty package.
-
-2003-09-01 AJ Reins <reinsaj@yahoo.com>
-
- * mount.cc (mount_commands): Ensure user mode is actually user mode and
- not the default system mode.
-
-2003-08-31 Christopher Faylor <cgf@redhat.com>
-
- * kill.cc (forcekill): Silence some compiler warnings.
-
-2003-08-31 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Oops. Put the '...' in the right place.
-
-2003-08-31 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Display "..." when not-verbose.
-
- * kill.cc (forcekill): Default to entered pid when pinfo fails. Issue
- some warnings when things don't work.
-
-2003-08-17 David Rothenberger <daveroth@acm.org>
-
- * dump_setup.cc (check_package_files): Strip leading / and ./ from
- package file names.
-
-2003-08-16 David Rothenberger <daveroth@acm.org>
-
- * dump_setup.cc (package_find): Don't stop searching on missing
- file list.
- (package_list): Ditto.
-
-2003-08-16 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * dump_setup.cc: (package_list): Make output terse unless
- verbose requested. Fix formatting.
- (package_find): Ditto.
-
-2003-08-15 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (main): Fix some formatting and help text printing.
-
-2003-08-15 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * cygcheck.cc (find_package,list_package): New global
- variables.
- (usage): Add "--find-package" and "--list-package" options,
- reformat output.
- (longopts, opts): Add "--find-package" and "--list-package"
- options.
- (main): Process the "--find-package" and "--list-package"
- flags. Add new semantic checks. Add calls to find_package()
- and list_package().
- * dump_setup.cc: Fix header comment.
- (match_argv): Change return type to int to distinguish
- between real matches and default ones.
- (open_package_list): New static function.
- (check_package_files): Factor out opening the package list
- file into open_package_list().
- (get_packages): New static function.
- (dump_setup): Factor out getting a list of packages into
- get_packages().
- (package_list, package_find): New global functions.
-
-2003-08-15 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc (usage): Add missing linefeed. Move example to --help
- text. Fix forward slash description.
-
-2003-08-13 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * dump_setup.cc (check_package_files): Fix extra '/' in filename.
- Resize command buffer. Fix buffer overflow bug.
-
-2003-08-09 Igor Pechtchanski <pechtcha@cs.nyu.edu>
- Christopher Faylor <cgf@redhat.com>
-
- * dump_setup.cc (dump_setup): Check for the existence of the package
- list file. Rework slightly to use static buffer for popen commands.
-
-2003-08-07 Igor Pechtchanski <pechtcha@cs.nyu.edu>
- Christopher Faylor <cgf@redhat.com>
-
- * dump_setup.cc (version_len): New static variable.
- (could_not_access,directory_exists): New static function.
- (file_exists): Ditto.
- (check_package_files): Ditto.
- (dump_setup): Check the contents of each package if check_files is true
- and output the result in the "Status" column. Flush output after each
- package.
-
-2003-08-07 Igor Pechtchanski <pechtcha@cs.nyu.edu>
- Christopher Faylor <cgf@redhat.com>
-
- * dump_setup.cc (dump_setup): Remove redundant null check. Add
- informative message if package info not found.
-
-2003-07-26 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (do_mount): Issue warning when using managed mount option on
- non-empty directory.
-
-2003-07-25 Christopher Faylor <cgf@redhat.com>
-
- * configure.in: Use 'install-sh -c'.
- * configure: Regenerate.
-
-2003-07-25 Christopher Faylor <cgf@redhat.com>
-
- * configure.in: Always use install-sh.
- * configure: Regenerate.
-
-2003-07-03 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (struct opt): Remove posix option.
-
-2003-07-03 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (longopts): Add long "options" keyword.
- (opts): Add -o option.
- (usage): Display -o option.
- (struct opt): New.
- (concat3): New function.
- (main): Handle -o flag.
-
-2003-06-12 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (pretty_id): Rework slightly to not rely on spaces.
-
-2003-06-12 Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc: Throughout, always return error when GetShortPathName
- returns 0.
-
-2003-04-26 Joshua Daniel Franklin <joshuadfranklin at yahoo dot com>
-
- * mkpasswd.c (usage) Remove extra newline from description output.
-
-2003-04-26 Joshua Daniel Franklin <joshuadfranklin at yahoo dot com>
-
- * cygcheck.cc (usage) Add description output.
- * cygpath.cc (usage) Add description output.
- * dumper.cc (usage) Add newline to description output.
- * kill.cc (usage) Add description output.
- * mkgroup.c (usage) Grammatical change to description output.
- * mkpasswd.c (usage) Grammatical change to description output.
- * mount.cc (usage) Add description output.
- * passwd.c (usage) Add description output.
- * ps.cc (usage) Add description output.
- * regtool.cc (usage) Add description output.
- * setfacl.c (usage) Remove extra newline from description output.
- * ssp.c (usage) Add description output.
- * strace.cc (usage) Add description output.
- * umount.cc (usage) Add description output.
-
-2003-04-10 Pierre Humblet <pierre.humblet@ieee.org>
-
- * mkpasswd.c (current_user): print uid and gid as unsigned.
- (enum_users): Ditto. Do not free servername.
- (usage): Update to allow several domains and improve -p.
- (main): On Win9x limit uids to 1000. Only print specials
- when -l is specified. Add a loop to allow several domains
- and free servername in the loop.
- * mkgroup.c (enum_groups): Do not free servername.
- (usage): Update to allow several domains. Change uid to gid.
- (main): Only print specials when -l is specified. Add a
- loop to allow several domains and free servername in the loop.
-
-2003-03-24 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (dump_sysinfo): Ensure that CYGWIN environment variable
- is correctly set.
-
-2003-03-09 Corinna Vinschen <corinna@vinschen.de>
-
- * getfacl.c (username): Fix ambiguous printf calls.
- (groupname): Ditto.
- (main): Ditto.
-
-2003-03-04 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (strace.exe): Include mingw_getopt.o in link line.
- * cygcheck.cc (print_version): Update copyright.
- * strace.cc (print_version): Ditto.
- (main): Allow cygwin paths for -o option.
- (create_child): Allow cygwin path as argv[0].
- * path.cc (path.cc): Allow UNC paths.
-
-2003-03-01 Pierre Humblet <pierre.humblet@ieee.org>
-
- * mkpasswd.cc (main): On Win95, output both a default line and a
- line for the current user (if known) with a pseudorandom uid. If
- the -u switch is given, produce a line for the specified user.
- * mkgroup.cc (main): On Win95 change the group name from "unknown" to
- "all".
-
-2003-02-28 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (cygcheck.o): Fix so that actual mingw include files are
- used.
- * cygcheck.cc (find_on_path): Translate from cygwin path when qualified
- path name found.
- (pretty_id): New function. Dump output of id command.
- (dump_sysinfo): Call pretty_id for CYGWIN=ntsec and CYGWIN=nontsec cases.
-
-2003-02-12 Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc (doit): Allocate more space for non-path filename.
-
-2003-02-07 Christopher Faylor <cgf@redhat.com>
-
- * dump_setup.cc (compar): Use case insensitive comparisons.
- (dump_setup): Calculate package_len based on already used "len". Don't
- bother with version_len.
-
-2003-02-07 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * dump_setup.cc (dump_setup): Compute the longest package name
- and align columns properly.
-
-2003-02-06 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (common_apps): Add some more apps.
- * path.cc (get_cygdrive): Correctly set system flag.
-
-2003-01-22 Corinna Vinschen <corinna@vinschen.de>
-
- * Makefile.in (ALL_LDFLAGS): Remove newlib/libm from tools paths.
- (MINGW_LDFLAGS): Remove in favor of definition from Makefile.common.
-
-2003-01-15 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c: Fix copyright date.
- * mkpasswd.c: Ditto.
- * setfacl.c: Ditto.
-
-2003-01-09 Pierre Humblet <pierre.humblet@ieee.org>
-
- * setfacl.c (usage): Remove double ":" for mask and other.
-
-2003-01-07 Pierre Humblet <pierre.humblet@ieee.org>
-
- * mkpasswd.c (current_user): Create.
- (usage): Reorganize to support Win95/98/ME.
- (main): Add option for -c. Reorganize to parse options for
- Win95/98/ME and to call current_user. Add username in gecos field
- on Win95/98/ME.
- * mkgroup.c (enum_groups): Print gid with %u.
- (print_win_error): Create from passwd.cc.
- (current_group): Create.
- (usage): Reorganize to support Win95/98/ME.
- (main): Add option for -c. Reorganize to parse options for
- Win95/98/ME and to call current_group.
-
-2002-12-14 Pierre Humblet <pierre.humblet@ieee.org>
-
- * setfacl.c (main): Place a single : after other and mask.
- * getfacl.c (getaclentry): Allow both : and :: for other and mask.
- (main): Remove extraneous break.
-
-2002-11-25 Corinna Vinschen <corinna@vinschen.de>
-
- * mkpasswd.c (main): Set pw_passwd field to '*' on 9x/Me.
-
-2002-11-24 Corinna Vinschen <corinna@vinschen.de>
-
- * setfacl.c (getperm): Set only `other' permission bits.
- (getaclentry): Set a_id to -1 by default.
-
-2002-11-24 Corinna Vinschen <corinna@vinschen.de>
-
- * getfacl.c (permstr): Use `other' permission bits for requesting
- ace permissions.
-
-2002-11-08 Corinna Vinschen <corinna@vinschen.de>
-
- * setfacl.c (usage): Add missing LF.
-
-2002-10-30 Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc (get_long_path_name_w32impl): Define similarly to
- GetLongPathName.
- (get_long_name): Correctly prototype GetLongPathName.
- (get_long_paths): Implement using get_long_name to cut down on code
- duplication.
- (doit): Do various things to make path output work predictably.
-
-2002-10-19 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (usage): Correctly report default mode.
- * strace.cc (main): Use strtoul as appropriate.
-
-2002-09-29 Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc (close_arg): Remove unused static.
- * mkgroup.c (enum_local_users): Avoid compiler warning.
- (enum_users): Ditto.
- * mkpasswd.c: Ditto throughout.
- * ssp.c: Ditto throughout.
-
-2002-09-18 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc: Include sys/time.h rather than time.h to avoid a
- compiler error.
-
-2002-09-17 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc: Reorder includes to avoid compiler error.
-
-2002-09-15 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * cygcheck.cc (print_version) Add final newline.
- * getfacl.c (print_version) Add final newline.
- * kill.cc (print_version) Add final newline.
- * mkgroup.c (print_version) Add final newline.
- * mkpasswd.c (print_version) Add final newline.
- * mount.cc (print_version) Add final newline.
- * passwd.c (print_version) Add final newline.
- * ps.cc (print_version) Add final newline.
- * regtool.cc (print_version) Add final newline.
- * setfacl.c (print_version) Add final newline.
- * ssp.c (print_version) Add final newline.
- * strace.cc (print_version) Add final newline.
- * umount.cc (print_version) Add final newline.
-
-2002-09-12 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * cygpath.cc (options) New global variable.
- (main) Make short options global for easier change.
- (print_version) Add a missing newline.
-
-2002-08-07 Igor Pechtchanski <pechtcha@cs.nyu.edu>
-
- * regtool.cc (find_key): Add support for custom key separator.
- (usage): Document it.
-
-2002-08-02 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): Don't print an entry for "Everyone".
- * mkpasswd.c (print_special): Set pw_gid to 544 for SYSTEM user.
- (main): Don't print an entry for "Everyone".
-
-2002-07-06 Christopher Faylor <cgf@redhat.com>
-
- * configure.in: Check for libiconv.a.
- * configure: Regenerate.
- * Makefile.in: Add libiconv.a to libraries required for dumper.exe.
-
-2002-07-06 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Use MINGW stuff from Makefile.common.
-
-2002-07-01 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c: Add function pointers for functions from advapi32.dll.
- (load_netapi): Load used functions from advapi32.dll.
- (main): Use function pointers instead of statically linked functions
- from advapi32.dll.
-
-2002-07-01 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (main): Ensure that mount_already_exists() also gets default
- flag that is passed to do_mount.
-
-2002-06-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * cygpath.cc (long_options): Add "dos" and "mixed", correct "close",
- "file" and "type" to use NULL flag.
- (usage): Clean up usage output (more), accomodate new options.
- (main): Add --dos and --mixed options; accomodate all output forms in
- --type. Make UNIXy output default.
-
-2002-06-18 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * cygpath.cc (usage): Clean up usage output.
- (dowin): Correct output of -t mixed for -ADHPSW options.
-
-2002-06-14 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.c: Rearrange includes to avoid unnecessary warnings.
- (GetPW): Add parameter to (dis)allow printing of Windows username.
- Use defines instead of numerical constants where possible.
- Try avoiding impersonation problem. Rearrange to print Windows
- username only if it's different from Cygwin username.
- (ChangePW): Use defines instead of numerical constants where possible.
- (main): Call GetPW with additional parameter. Change error text.
-
-2002-06-14 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * passwd.c (GetPW): Handle case of user-edited /etc/passwd
- with cygwin_internal (CW_EXTRACT_DOMAIN_AND_USER, ...).
-
-2002-06-09 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (cygpath): Change MOUNT_AUTO to MOUNT_CYGDRIVE.
- (getmntent): Ditto.
-
-2002-06-09 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (main): Use default system/user flag for cygdrive stuff,
- too.
- (change_cygdrive_prefix): Change MOUNT_AUTO to MOUNT_CYGDRIVE.
- * umount.cc (remove_cygdrive_prefix): Ditto.
- (main): Use default system/user flag for cygdrive stuff, too.
-
-2002-06-08 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (opts): Remove '-i' option.
- (usage): Ditto.
- (main): Ditto.
- (longopts): Remove --import-old-mounts option.
-
-2002-06-07 David Peterson <chief@mail.idrive.com>
- Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc: Add option to output windows paths in different formats:
- "dos" and "mixed".
- (main): Process options.
- (doit): Check new options flags.
-
-2002-06-06 Egor Duda <deo@logos-m.ru>
-
- * regtool.cc (Fail): Be more verbose.
- (find_key): Add support for remote registry access.
- (usage): Document it.
- * utils.sgml: Document it.
-
-2002-06-06 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (main): Make toggle a local variable.
-
-2002-06-07 Conrad Scott <conrad.scott@dsl.pipex.com>
-
- * strace.cc (toggle): New global variable.
- (error): Use exit instead of ExitProcess so that stdio buffers get
- flushed.
- (create_child): Remove command line error checking.
- (dostrace): Ditto.
- (dotoggle): New function.
- (usage): Add entry for new option -T|--toggle. Alphabetize.
- (longopts): Add new option -T|--toggle.
- (opts): Ditto.
- (main): Handle new -T|--toggle option. Move all command line checking
- here from other functions.
- * utils.sgml: Update section for strace.
-
-2002-06-05 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * strace.cc (version): New global variable.
- (usage): Accommodate stdout output.
- (print_version): New function.
-
-2002-06-03 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * ssp.c (version): New global variable.
- (longopts): Ditto.
- (opts): Ditto.
- (run_program): Correct cmd_line typos to cmdline.
- (usage): New function. Standardize usage output. Add ssp.txt to
- --help output.
- (print_version): New function.
- (main): Accommodate getopt.
-
-2002-06-03 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * umount.cc (version): New global variable.
- (longopts): Accommodate new --version option.
- (opts): Ditto.
- (usage): Standardize usage output.
- (print_version): New function.
- (main): Accommodate --help, --version options.
-
-2002-06-02 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * regtool.cc (prog_name): New global variable.
- (longopts): Ditto.
- (opts): Ditto.
- (usage): Standardize usage output. Rearrange/add descriptions.
- (print_version): New function.
- (main): Accommodate longopts and new --help, --version options. Add
- check for (_argv[optind+1] == NULL).
-
-2002-06-02 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (forkdebug): Make true by default.
- (attach_process): Use window pid if cygwin pid isn't available (yet).
- (create_child): Use either DEBUG_ONLY_THIS_PROCESS or DEBUG_PROCESS,
- exclusively. (Suggested by Conrad.Scott@dsl.pipex.com)
-
-2002-05-30 Christopher Faylor <cgf@redhat.com>
-
- * mkpasswd.cc (main): Don't reset to binmode if stdout is a terminal.
-
-2002-05-29 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (main): Make -b the default.
-
-2002-05-29 Corinna Vinschen <corinna@vinschen.de>
-
- * ps.cc (main): Use uid or uid32 member of struct external_pinfo
- dependent of the value of the struct's version member.
-
-2002-05-29 Corinna Vinschen <corinna@vinschen.de>
-
- * ps.cc (main): Change print format for uid to unsigned. Use uid32
- member of struct external_pinfo instead of uid.
-
-2002-05-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * passwd.c (prog_name): New global variable.
- (longopts): Ditto.
- (opts): Ditto.
- (usage): Standardize output. Accommodate new options.
- (print_version): New function.
- (main): Accommodate longopts and new --help, --version options.
-
-2002-05-28 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * ps.cc (usage): Fix typo.
-
-2002-05-27 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * ps.cc (prog_name): New global variable.
- (longopts): Ditto.
- (opts): Ditto.
- (usage): New function.
- (print_version): New function.
- (main): Accommodate longopts and new --help, --version options.
-
-2002-05-26 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (attach_process): Don't tell process to start stracing
- here.
- (proc_child): Do it here, instead, after first debug event. This
- should work around inexplicable races with DebugActiveProcess.
- (dostrace): Pass any pid argument to proc_child.
-
-2002-05-23 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * getfacl.c (usage): Standardize usage output. Change return type to
- static void.
- (print_version): New function.
- (longopts): Added longopts for all options.
- (main): Accommodate new help and version options.
-
-2002-05-22 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * mount.cc (version): New global variable.
- (usage): Standardize usage output. Accommodate new version option.
- (print_version): New function.
- (longopts): Accommodate new version option.
- (opts): Ditto.
- (main): Ditto.
-
-2002-05-22 Corinna Vinschen <corinna@vinschen.de>
-
- * cygpath.cc (usage): Change usage output slightly.
-
-2002-05-20 Joerg Schaible <joerg.schaible@gmx.de>
-
- * cygpath.cc (main): Add option l to support conversion to
- Windows long file names. Refactured code for capital options.
- Support of options from file for capital options.
- (dowin): New function. Refactured from main.
- (doit): Call long path conversion.
- (get_long_name): New function.
- (get_long_paths): New function.
- (get_long_path_name_w32impl): New function. Reimplementation
- of Windows API function GetLongPathName (only 98/Me/2000/XP or
- higher).
- (get_short_name): Call GetShortPathName only once.
- (get_short_paths): Fix calculating buffer size.
- * utils.sgml: Update cygpath section for l option.
-
-2002-05-18 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (add_child): Use calloc since new requires working
- libstdc++.a.
- (remove_child): Ditto for delete/free.
-
-2002-05-15 Mark Blackburn <marklist@fangorn.ca>
-
- * cygpath.cc (get_short_paths): Fix more error checking.
- (get_short_name): Ditto.
-
-2002-05-14 Joerg Schaible <joerg.schaible@gmx.de>
-
- * cygpath.cc (main): Add option H to show the Windows' profiles
- directory. Support short names for options DPSW. Clean up
- copied code lines.
- * utils.sgml: Update cygpath section for H option and s support.
-
-2002-05-14 Mark Blackburn <marklist@fangorn.ca>
-
- * cygpath.cc (get_short_paths): Fix error checking.
-
-2002-05-13 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * kill.cc (prog_name): New global variable.
- (usage): Standardize usage output. Add descriptions.
- (print_version): New function.
- (longopts): Accommodate new version option.
- (opts): Ditto.
- (main): Ditto.
-
-2002-05-13 Christopher Faylor <cgf@redhat.com>
-
- * kill.cc (listsig): Display numeric id when given symbolic input.
-
-2002-05-13 Christopher Faylor <cgf@redhat.com>
-
- * kill.cc (usage): Show new options. Allow specification of output
- stream.
- (main): Implement 'h' option.
-
-2002-05-13 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (kill.exe): Add as a specific target.
- * kill.cc (longopts): New.
- (opts): Ditto.
- (get_sig): Accept const char * parameter. Return -1 on unknown signal.
- (test_for_unknown_sig): New function.
- (listsig): New function.
- (main): Use getopt_long for option parsing. Implement -l, and -s
- options. Use test_for_unknown_sig() to test for signal validity.
-
- * mount.cc (longopts): Make static.
- (opts): Ditto.
-
-2002-05-12 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (do_mount): Default to non-exec option for remote drives.
- Report warnings before attempting a mount.
- (longopts): Add no-executable option.
- (mount_commands): Ditto.
- (opts): Ditto.
- (usage): Ditto. Indicate that system mount is now the default.
- (main): Accommodate no-executable option. Make system mount the
- default.
- * umount.cc (usage): Indicate that system umount is now the default.
- (main): Make system umount the default.
-
-2002-05-07 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * dumper.cc (usage): Standardize usage output. Generalize to allow use
- for help.
- (longopts): New struct. Added longopts for all options.
- (print_version): New function.
- (main): Change getopt to getopt_long. Accommodate new help and version
- options.
-
-2002-03-29 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): Change call to exit() to a return statement.
- * mkpasswd.c (main): Ditto.
-
-2002-03-27 Joshua Daniel Franklin joshuadfranklin@yahoo.com
-
- * mkpasswd.c (usage): Simplify usage output. Generalize to allow use
- for help. Correct '?' typo to 'h'.
- (longopts): Add version option.
- (opts): Add 'v' version option.
- (print_version): New function.
- (main): Accommodate new version option. Accommodate usage parameter
- changes.
-
-2002-03-19 Christopher Faylor <cgf@redhat.com>
-
- * mkgroup.c (usage): Use one just fprintf + string concatenation for
- output message.
- (print_version): Add void to function type and update copyright.
-
-2002-03-16 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * mkgroup.c (usage): Simplify usage output. Generalize to allow use
- for help. Correct '?' typo to 'h'.
- (longopts): Add version option.
- (opts): Add 'v' version option.
- (print_version): New function.
- (main): Accommodate new version option. Accommodate usage parameter
- changes. Use usage to output help message.
-
-2002-03-15 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): When generating group 513, check for computer's
- primary domain instead of current user's domain.
-
-2002-03-14 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (main): When generating group 513, check for domain SID
- if computer name isn't mapped to a SID.
-
-2001-03-11 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * kill.cc (usage): Move to top of file.
- (getsig): Ditto.
- (forcekill): Ditto.
-
-2002-03-06 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc: Reformat.
-
-2002-03-06 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (longopts): Use correct short option for --version.
-
-2002-03-06 Christopher Faylor <cgf@redhat.com>
-
- * cygpath.cc: Reformat.
-
-2002-02-27 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * cygpath.cc (print_version): New function.
- (main): Accommodate new version function. Initialize 'o' to prevent
- warning.
-
-2002-02-27 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (main): Eliminate non-GNU formatting glitch.
-
-2002-02-27 Christopher Faylor <cgf@redhat.com>
-
- * ssp.c (help_desk): Fix compiler warning.
-
-2002-02-27 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
- Christopher Faylor <cgf@redhat.com>
-
- Change appropriate globals to statics throughout.
- * cygcheck.cc (usage): Simplify usage output. Generalize to allow use
- for help.
- (longopts): Add version option.
- (opts): Add 'V" version option.
- (print_version): New function.
- (main): Accommodate new version option. Accommodate usage parameter
- changes. Use usage to output help message.
-
-002-02-19 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (CXXFLAGS): Add override so that HAVE_DECL_GETOPT is
- defined.
- (libbfd): Use -B rather than -L so that bfd from build directory is
- correctly found.
- (libintl): Ditto.
-
-2002-02-15 Christopher Faylor <cgf@redhat.com>
-
- * mount.cc (usage): Fix typo in output.
-
-2002-02-14 Christopher Faylor <cgf@redhat.com>
-
- * strace.cc (attach_process): Change CW_STRACE_ON to CW_STRACE_TOGGLE.
-
-2002-01-31 Corinna Vinschen <corinna@vinschen.de>
-
- * mkpasswd.c (main): Set default home path for 9x/Me if --path-to-home
- isn't given.
-
-2002-01-30 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.cc (ChangePW): Add parameter to differ between called for
- checking old password and called for changing password. If called
- for checking old password, return non-zero only if password is surely
- incorrect.
- (main): Call ChangePW() with additional parameter.
-
-2002-01-29 Christopher Faylor <cgf@redhat.com>
-
- * dump_setup.cc (parse_filename): Don't consider '_' part of the
- version.
-
-2002-01-28 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc: Fix typo. Remove uid_t kludge. Rely on kludge in
- sys/cygwin.h instead.
- * getfacl.c: Add include to remove warning.
- * mkgroup.c (main): Assign variables outside of parameter passing.
- This seems to eliminate some compiler warnings.
-
-2002-01-28 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc: Use specific cygwin includes, as required.
-
-2002-01-28 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (MINGW_INCLUDES): Change cygwin include.
- * strace.cc: Use specific cygwin includes, as required.
- (load_cygwin): New function. Loads cygwin DLL, if necessary.
- (attach_process): Attaches strace to a running process.
- (dostrace): Accept pid argument. Attach to pid if supplied.
- (usage): Describe -p option. Correct system description.
- (longopts): Alphabetize.
- (opts): Ditto.
- (main): Ditto. Handle -p option.
-
-2002-01-21 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (CXXFLAGS): Ensure that important settings are preserved
- even when overriden by command line.
-
-2002-01-21 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Build intermediate cygcheck.o to force use of MINGW_CXXFLAGS.
- * cygcheck.cc (cygwin_info): Intitialize variable to quiet g++ warning.
- (dump_sysinfo): Make variables unsigned to quiet g++ warnings.
- * strace.cc (version_string): Rename from SCCSid.
- (add_child): Remove unused variable.
- (version): Use version_string. Avoid use of fprintf.
-
-2002-01-21 DJ Delorie <dj@redhat.com>
-
- * Makefile.in: Use CXX instead of CC to compile C++ sources.
-
-2002-01-17 DJ Delorie <dj@redhat.com>
-
- * cygcheck.cc (already_did): Avoid default constructors, which may
- require exception support.
-
-2001-01-16 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
-
- * cygpath.cc (main): Add options to show Desktop and Start
- Menu's Programs directory for current user or all users.
- Move bulk of DPWS options outside the getopt case statement.
- * utils.sgml: Update cygpath section for ADPWS options.
-
-2002-01-15 Joerg Schaible <joerg.schaible@gmx.de>
-
- * cygpath.cc (doit): Empty file ignored using option -i.
-
-2002-01-15 Mark Bradshaw <bradshaw@crosswalk.com>
-
- * mkpasswd.c (print_win_error): Add a new function.
- (enum_users): Use print_win_error.
- (enum_local_groups): Ditto.
- (main): Ditto.
-
-2001-12-26 Jonathan Kamens <jik@curl.com>
-
- * cygpath.cc (doit): Detect and warn about an empty path. Detect and
- warn about errors converting a path.
- (main): Set prog_name correctly -- don't leave an extra slash or
- backslash at the beginning of it.
-
-Fri Dec 14 14:04:37 2001 Jason Tishler <jason@tishler.net>
-
- * mkpasswd.c (enum_users): Change to unconditionally use
- the --path-to-home option, if supplied by the user. Use default
- --path-to-home option value, if appropriate.
- (usage): Change usage statement to reflect new semantics.
- (main): Remove defaulting of the --path-to-home option.
-
-Fri Dec 14 12:10:39 2001 Jason Tishler <jason@tishler.net>
-
- * mkpasswd.c (opts): Add indication that '-p' option requires an
- argument.
-
-2001-12-11 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Add define to CXXFLAGS.
-
-2001-12-03 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (usage): Add -c description.
- * cygpath.cc (usage): Alphabetize options.
- * strace.cc (usage): Ditto.
-
-2001-11-21 Christopher Faylor <cgf@redhat.com>
-
- * path.cc (cygpath): Don't consider cygdrive stuff when trying to derive
- native paths.
-
-2001-11-20 Mark Bradshaw <bradshaw@staff.crosswalk.com>
-
- * mkpasswd.c: include lmerr.h
- (main): New -u option to allow specifying a
- specific user. If specified, groups aren't displayed and
- output is limited to only the specified user.
- (enum_users): If specific user is specified, via -u option,
- display only that user's record. With -u use NetUserGetInfo
- instead of NetUserEnum.
- (load_netapi): Added netusergetinfo.
-
-2001-11-15 Gary R. Van Sickle <g.r.vansickle@worldnet.att.net>
-
- * strace.cc (main): Change getopt() to getopt_long().
- Add support for help and version info.
- Use new parse_mask() function for -m/--mask option.
- (longopts): Add long options structure.
- (opts): Move options string from getopts call to static var.
- (usage): Print usage information.
- (SCCSid): Version info.
- (version): New function for displaying version info.
- (parse_mask): New function supporting parsing of mnemonics,
- hex, and basic expressions in masks.
- (mnemonic2ul): New mnemonic parsing function.
- (tag_mask_mnemonic): New type.
- (mnemonic_table): New table of mnemonics for mnemonic2ul() to
- search through.
-
-2001-11-12 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Redefine output format slightly.
- Print correct build number on 9x/ME systems.
-
-2001-11-12 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (main): Slight formatting tweak.
-
-2001-11-12 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Add some more details.
-
-2001-11-12 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Print more detailed OS information string
- using OSVERSIONINFOEX information.
-
-2001-11-11 Christopher Faylor <cgf@redhat.com>
-
- * path.h: New file.
-
-2001-11-11 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (scan_registry): Open registry with read-only access.
- (main): Reflect argument change for dump_setup.
- * dump_setup.cc (dump_setup): Add preliminary extra argument for future
- use.
- * path.cc (read_mounts): Open registry with read-only access.
-
-2001-11-11 Christopher Faylor <cgf@redhat.com>
-
- * cygcheck.cc (main): Display package info when '-s' is specified.
- * dump_setup.cc (dump_setup): Change header. Remove typo. Always sort
- packages output.
-
-2001-11-11 Christopher Faylor <cgf@redhat.com>
-
- * dump_setup.cc: New file.
- * Makefile.in: Add info for dump_setup.o.
- * cygcheck.cc (main): Recognize '-c' option for checking setup
- installed base.
- * path.cc (cygpath): Read mount table if not loaded.
-
-2001-11-10 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in (cygcheck.exe): Compile as -mno-cygwin executable.
- * path.cc: New file.
- * cygcheck.cc (init_paths): Use MS-DOS path syntax.
- (cygwin_info): Properly display cygwin version numbers. Prettify some
- output.
- (dump_sysinfo): Calculate max names of posix and ms-dos paths for
- prettier output.
-
-2001-11-09 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (dump_sysinfo): Print more detailed OS information string.
-
-2001-11-04 Corinna Vinschen <corinna@vinschen.de>
-
- * getfacl.c (username): New function.
- (groupname): Ditto.
- (usage): Ditto. Add more user friendly help text.
- (main): Add -n and --help option. Print names instead of IDs
- unless -n option is given.
- * setfacl.c (getperm): Tolerate whitespace and comment chars in input.
- (getaclentry): Fix several input string misdetections.
- (getaclentries): Allow - as input file name to read from stdin.
- Tolerate whitespace and comment chars in input.
- (usage): Add more user friendly help text.
- (main): Add --help option.
-
-2001-11-04 Egor Duda <deo@logos-m.ru>
-
- * strace.cc (main): New option '-w'. Start traced process in separate
- window. New option '-S x'. Flush buffered output every x seconds.
- (create_child): Start child process in new window, when requested.
- When requested, periodically flush debugging output.
-
-2001-10-24 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Remove EXEEXT consideration. We always need .exe
- extensions.
-
-2001-10-20 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c: Avoid compiler warnings.
- (print_special): New function.
- (main): Print special accounts by calling print_special().
- * mkpasswd.c: Avoid compiler warnings.
- (enum_users): Print additional U-domain\username info in gecos
- field when SIDs are printed.
- (print_special): New function.
- (main): Print special accounts by calling print_special().
-
-2001-10-15 Christopher Faylor <cgf@redhat.com>
-
- * mkpasswd.cc (enum_users): Shorten "unused" passwd field.
-
-2001-10-13 Christopher Faylor <cgf@redhat.com>
-
- * Makefile.in: Allow stdinc searching for dumper.
-
-Tue Oct 9 21:59:00 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (MINGW_INCLUDES): Accommodate changes in Makefile.common.
-
-Sun Oct 7 23:06:39 2001 Christopher Faylor <cgf@cygnus.com>
-
- * kill.cc (main): Set exit value to 1 on invalid pid. Perform minor
- cleanup.
-
-Fri Sep 21 20:40:30 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (mingw_getopt.o): Ensure that newlib include directories
- are not searched.
-
-Thu Sep 20 21:00:20 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (MINGW_INCLUDES): Still need cygwin/include directory.
-
-Wed Sep 19 12:22:08 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Filter newlib includes from mingw compilation.
-
-2001-09-14 Egor Duda <deo@logos-m.ru>
-
- * dumper.cc (dumper::dumper): Print error code in case of error.
- (dumper::add_thread): Ditto.
- (dumper::collect_memory_sections): Ditto.
- (dumper::dump_memory_region): Ditto.
- (dumper::collect_process_information): Ditto.
- (print_section_name): Fix formatting.
-
-2001-09-13 Egor Duda <deo@logos-m.ru>
-
- * dumper.cc (main): Properly recognize negative pids (used by w9x).
-
-2001-09-09 Egor Duda <deo@logos-m.ru>
-
- * dumper.cc (main): Change command-line arguments format to be
- similar to gdb. Allow adding error_start=x:\path\to\dumper.exe to
- CYGWIN environment variable to perform core dumping in case of
- program crash.
- (usage): Ditto.
-
-Wed Sep 5 22:37:21 2001 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in (dumper): Change logic for libbfd and libintl so that
- they will be found either in the build tree or the installed directory.
- * mkpasswd.c (enum_users): Add a comment as a password for NT.
-
-2001-09-03 Michael A Chase <mchase@ix.netcom.com>
-
- * mount.cc (mount_commands): Don't write /cygdrive/u mount points.
-
-2001-09-03 Michael A Chase <mchase@ix.netcom.com>
-
- * mount.cc (longopts): Add mount-commands to options list.
- (usage): Add mount-commands option.
- (mount_commands): New function. Write commands to recreate current
- mounts.
-
-Sat Sep 1 15:58:11 2001 Christopher Faylor <cgf@cygnus.com>
-
- * mount.cc (main): Eliminate excess arguments in printf.
-
-2001-08-30 Egor Duda <deo@logos-m.ru>
-
- * dumper.h: Update copyright notice.
- * dumper.cc: Ditto.
- * dumper.cc: (dumper::print_core_section_list): New function.
- * dumper.h: (dumper::print_core_section_list): Declare it.
- * dumper.cc (print_section_name): New function.
- (dumper::collect_process_information): Augment debugging output.
- Stop debugee processing if it posts double exception.
- (usage): Fix typo in option name.
-
-Tue Aug 28 14:45:02 2001 Christopher Faylor <cgf@cygnus.com>
-
- * mount.cc (main): Issue correct warning for 'not enough arguments'.
-
-2001-08-14 Joerg Schaible <joerg.schaible@gmx.de>
-
- * cygpath.cc (main): Support -w for Windows (System) directories and
- return physical correct orthography for the Windows System dir.
-
-2001-07-14 Chris Genly <chgenly@alum.mit.edu>
-
- * regtool.cc (find_key): Handle keys with only one subkey.
-
-Wed Jun 27 22:46:10 2001 Christopher Faylor <cgf@cygnus.com>
-
- * regtool.cc (find_key): Revert previous change.
-
-Wed Jun 27 13:37:41 2001 Keith Starsmeare" <keith_starsmeare@yahoo.co.uk>
-
- * regtool.cc (find_key): Allow '/' as a synonym for '\\'.
-
-Fri Jun 15 00:49:21 2001 Christopher Faylor <cgf@cygnus.com>
-
- * mkpasswd.c (main): Output passwd file in binary mode so that there
- are no CRs in the file.
- * umount.cc (remove_all_user_mounts): Don't try to remove /cygdrive
- mounts.
-
-Tue May 1 10:50:48 2001 Christopher Faylor <cgf@cygnus.com>
-
- * mkpasswd.c (enum_users): Use /bin/bash as the default shell.
- (main): Ditto.
-
-Sat Apr 28 22:32:01 2001 Christopher Faylor <cgf@cygnus.com>
-
- * passwd.cc (ttymnam): New function.
- (main): Use ttynam() to report name of tty.
-
-2001-04-19 Egor Duda <deo@logos-m.ru>
-
- * dumper.cc (dumper::init_core_dump): Set architecture field in dump
- header.
-
-Mon Apr 16 15:08:00 2001 Corinna Vinschen <vinschen@redhat.com>
-
- * mkgroup.c: Add function pointers `netlocalgroupgetmembers' and
- `netgroupgetusers'.
- (load_netapi): Load function pointers `netlocalgroupgetmembers'
- and `netgroupgetusers'.
- (enum_local_users): New function.
- (enum_local_groups): Call `enum_local_users' for each group if
- `print_users' is set.
- (enum_users): New function.
- (enum_groups): Call `enum_users' for each group if `print_users' is set.
- (usage): Add usage text for `-u/--users'.
- (longopts): Add option `--users'.
- (opts): Add option character `u'.
- (main): Set `print_users' according to option `-u/--users'.
- Call `enum_local_groups' and `enum_groups' with additional parameter
- `print_users'.
-
-2001-04-15 Michael A Chase <mchase@ix.netcom.com>
-
- * mount.cc (longopts): Add help to options list.
- (opts): Add 'h' to options string.
- * umount.cc (longopts): Add help to options list.
- (opts): Add 'h' to options string and change 'R' to 'A'.
-
-2001-04-13 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * mkgroup.c (enum_groups): Use RID + offset specified an additional
- argument as ID.
- (usage): Add description of -o option.
- (longopts, opts): Add specifications of -o/--id-offset option.
- (main): Add -o option. Invoke enum_groups with specified offset.
- * mkpasswd.c (enum_users): Just like mkgroup.c.
- (usage, longopts, opts): Ditto.
- (main): Add -o option. Invoke enum_users with specified offset only
- against domain accounts.
-
-2001-04-11 Egor Duda <deo@logos-m.ru>
-
- * mkgroup.c (uni2ansi): Use native method to convert from Unicode
- to multi-byte strings.
- * mkpasswd.c (uni2ansi): Ditto.
- (enum_users): Pass buffer size when converting string.
- (enum_local_groups): Ditto.
- * mkgroup.c (enum_groups): Ditto.
- (enum_local_groups): Ditto.
-
-Mon Apr 2 22:41:33 2001 Christopher Faylor <cgf@cygnus.com>
-
- * mount.cc (main): Use getopt_long for parsing arguments.
- (usage): Reformat, show long and short options.
- * umount.cc (main): Ditto, all of the above.
-
-Mon Apr 2 10:58:26 2001 Christopher Faylor <cgf@cygnus.com>
-
- * mount.cc (show_mounts): Change format string to more closely resemble
- UNIX when displaying mount table.
-
-Sat Mar 17 21:46:06 2001 Christopher Faylor <cgf@cygnus.com>
-
- * kill.cc (forcekill): Use dwProcessId when opening a process, not the
- Cygwin pid.
-
-Mon Mar 5 18:50:00 2001 Corinna Vinschen <vinschen@redhat.com>
-
- * getfacl.c: Add copyright hint.
- * setfacl.c: Ditto.
- * strace.cc: Ditto.
-
-Tue Jan 09 10:26:23 2001 Tony Sideris <tonys1110@home.com>
-
- * regtool.cc (cmd_list): Add new registry display options.
- (cmd_list): Add code to implement -p, -k, and -l options.
-
- * regtool.cc (Fail): Add call to LocalFree to free memory allocated by
- FormatMessage.
-
-Wed Jan 10 09:16:57 2001 Christopher Faylor <cgf@cygnus.com>
-
- * regtool.cc (translate): Ensure that 'c' is initialized.
- (cmd_set): Ditto for rv.
diff --git a/winsup/utils/ChangeLog-2000 b/winsup/utils/ChangeLog-2000
deleted file mode 100644
index 7ea5ae186..000000000
--- a/winsup/utils/ChangeLog-2000
+++ /dev/null
@@ -1,347 +0,0 @@
-Fri Dec 15 23:41:48 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygcheck.cc (cygwin_info): Add some more bounds checking.
-
-Fri Dec 15 23:41:34 2000 Christopher Faylor <cgf@cygnus.com>
-
- From Matt Harget <matt@use.net>:
- * utils/cygcheck.cc (keyeprint): Move declaration before other
- functions so it could be used by all functions to report error
- messages. Add comment.
- (add_path): Check for NULL return from malloc.
- (find_on_path): Check initial uses of pointers for NULL.
- (rva_to_offset): Ditto.
- (init_paths): Add checking for return values of Win32 calls.
- (get_dword): Ditto.
- (get_word): Ditto.
- (dll_info): Ditto, also add NULL pointer checks.
- (scan_registry): Ditto.
- (check_keys): Ditto.
- (dump_sysinfo): Ditto. Add default case to switch. Add error
- reporting if GetVolumeInformation fails, except when it
- returns ERROR_NOT_READY.
- (track_down): Add checking for NULL pointers and
- return values of Win32 calls.
- (cygwin_info): Ditto. Correct small memory leak.
-
-Sun Dec 10 19:08:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Compile/link dumper.exe with c++.
-
-Tue Dec 7 11:15:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * mkpasswd.c: Slight formatting changes to the below patch.
- (longopts): Fix typo in `local-groups' option.
- (main): Initialize `passed_home_path' before first usage.
-
-Tue Dec 7 11:15:00 2000 Chris Abbey <cabbey@bresnanlink.net>
-
- * mkpasswd.c: make default home directory /home/$user if one
- can't be found in user registry. Allow user to override
- that with command line arg.
-
-Sun Dec 3 00:40:47 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use CXX to build the DLL.
- * configure.in: Find correct c++ compiler.
- * configure: Regenerate.
-
-Sat Nov 18 23:53:59 2000 Christopher Faylor <cgf@cygnus.com>
-
- * utils.sgml: Document new options for ps and strace.
-
-Wed Nov 8 08:49:27 2000 Jason Tishler <jt@dothill.com>
-
- * mount.cc (main): Call show_cygdrive_info instead of
- show_cygdrive_prefixes.
- * mount.cc (show_cygdrive_prefixes): Remove function.
- * mount.cc (show_cygdrive_info): New function. Actually,
- show_cygdrive_info is really an enhanced version of
- show_cygdrive_prefixes renamed to show_cygdrive_info that also displays
- the user and system flags.
-
-Wed Nov 8 15:52:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * mkgroup.c (load_netapi): New function to load netapi32.dll functions
- dynamically so that mkgroup works on 9x/ME as well.
- Use corresponding function pointers throughout.
- (usage): Change to `int'. Change text to be conformant to mkpasswd.
- (main): Use `getlongopt' to process options.
- Special handling to create a group entry on 9x/ME.
- * mkpasswd.c (load_netapi): New function to load netapi32.dll functions
- dynamically so that mkpasswd works on 9x/ME as well.
- Use corresponding function pointers throughout.
- (usage): Change to `int'. Change text to be conformant to mkgroup.
- (main): Use `getlongopt' to process options.
- Special handling to create a passwd entry on 9x/ME.
- Change conditional to create an entry for the local administrators
- group when appropriate.
-
-Thu Nov 2 2:01:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * kill.cc (main): Return 1 in case of errors.
-
-Sat Oct 28 01:37:55 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Accomodate newer gcc's which require linking of c++
- programs with g++. Fixup output for some compilations.
- * cygcheck.cc: Respond to compiler warnings.
- * dumper.cc (main): Ditto.
- * parse_pe.cc (exclusion::sort_and_check): Ditto.
- * setfacl.cc (getaclentry): Ditto.
-
-Fri Oct 27 20:20:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (main): Add a '-b' option.
-
-2000-10-18 DJ Delorie <dj@redhat.com>
-
- * ssp.c: new
- * ssp.txt: new
- * Makefile.in: build ssp.exe
-
-Wed Oct 18 18:57:46 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Add some extra space to Windows pid output for
- Windows 95.
-
-Tue Oct 17 23:49:04 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Add some extra space to pid output for Windows 95.
-
-Tue Oct 17 1:09:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- Patch suggested by Brad Town <btown@ceddec.com>:
- * cygcheck.cc (main): Fix argument counting.
-
-Sat Oct 14 23:42:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Accomodate new PID_ constant.
-
-Thu Oct 12 02:19:12 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (proc_child): Handle exceptions correctly.
-
-Sun Oct 8 23:11:17 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Change order of reporting slightly so that windows pids
- are more obvious.
- * strace.cc (add_child): Just add child's pid directly.
- (remove_child): No need to close the child process pid since
- ContinueDebugEvent does that automatically.
- (proc_child): Ditto for child thread.
-
-Fri Sep 29 13:12:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * cygcheck.cc (keyeprint): New function.
- (check_keys): New function. Perform checking keycodes.
- (main): Add option `-k' for invoking check_keys.
- Change option processing to use long options and getopt_long.
- * cygkeycheck.cc: Removed. Functionality moved to `cygcheck.cc'.
- * Makefile.in: Remove cygkeycheck from the dependencies.
-
-Wed Sep 27 16:24:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * cygkeycheck.cc: New file. Utility to retrieve keycodes.
- * Makefile.in: Add cygkeycheck to the dependencies.
-
-2000-09-15 Joerg Schaible <joerg.schaible@gmx.de>
-
- * cygpath.cc: Add new options: -s and -i.
- * utils.sgml: Document the new options.
-
-Tue Sep 12 22:45:28 2000 Christopher Faylor <cgf@cygnus.com>
-
- * kill.cc (main): Change behavior of -f so that it will force the
- killing of a cygwin process after waiting 2 tenths of a second for it
- to terminate.
- (forcekill): Add an extra argument determining whether to wait for the
- process to exit.
-
-Sun Sep 10 12:50:02 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Refine dumper.exe message.
-
-Mon Aug 28 21:55:56 2000 Christopher Faylor <cgf@cygnus.com>
-
- * kill.c (main): Avoid skipping next argument when a signal number is
- specified.
- * Makefile.in: Always clean dumper.exe.
-
-Fri Aug 25 12:41:53 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Only build dumper.exe when all of its library and
- include dependencies are available.
-
-Fri Aug 25 11:44:29 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Make failure to build dumper.exe a non-error.
-
-Thu Aug 24 18:02:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * ps.cc (main): Always print a cygwin process using cygwin paths.
-
-2000-08-24 Egor Duda <deo@logos-m.ru>
-
- * Makefile.in: Add dumper.exe target and associated mechanisms for building it.
- * dumper.cc: New file.
- * dumper.h: New file.
- * module_info.cc: New file.
- * parse_pe.cc: New file.
-
-Mon Jul 31 15:12:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * passwd.c (main): Initialize oldpwd before beeing used.
-
-Sat Jul 29 00:44:46 2000 Christopher Faylor <cgf@cygnus.com>
-
- * kill.cc (main): Add '-f' option to force termination of a process.
- (forcekill): New function.
- * ps.cc (main): Add '-W' option to list Windows pids as well as Cygwin
- pids.
- (dummyprocessmodules): New function.
- (GetModuleFileNameEx95): New function.
- (init_win): New function.
- (to_time_t): New function.
-
-Thu Jul 27 22:54:28 2000 Jason Tishler <jt@dothill.com>
-
- * utils/mount.cc (main): Add --show-cygdrive-prefixes option.
- (show_cygdrive_prefixes): New function.
- * utils/umount.cc (main): Add --remove-cygdrive-prefix option.
- (error): Change signature from 'char *' to 'const char *'.
- (remove_cygdrive_prefix): New function.
-
-Thu Jul 13 22:24:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * mount.cc (mount_already_exists): Slightly rearrange.
- Change message texts.
-
-Thu Jul 13 13:02:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * mount.cc (mount_already_exists): Additional warning message
- if mount point exists with another mount type.
-
-Sat Jul 1 00:19:27 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Find getopt.c in cygwin/lib subdirectory.
-
-Sat Jun 24 23:16:33 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygcheck.cc (cygwin_info): New function. Scans DLL for Cygwin
- version info.
- (dll_info): Add path parameter for checking "cygwin1.dll".
- (track_down): Accomodate additional parameter for dll_info.
- (ls): Ditto.
- (dump_sys_info): Always print cygwin1.dll last.
-
-2000-06-07 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
- * mount.cc (error): New function to report an error and exit.
- * umount.cc (error): Ditto.
- (remove_all_automounts): Check return status of cygwin_umount.
- (remove_all_user_mounts): Ditto.
- (remove_all_system_mounts): Ditto.
-
-2000-06-05 DJ Delorie <dj@cygnus.com>
-
- * mount.cc: add stdlib.h for exit
- * umount.cc: ditto
- * strace.cc: add #define for alloca
-
-Fri May 20 0:01:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc (find_key): Add parameter `access'.
- Call `RegOpenKeyEx' with that desired access.
- (cmd_add, cmd_remove, cmd_set, cmd_unset): Call
- `find_key' with KEY_ALL_ACCESS access.
- (cmd_list, cmd_check, cmd_get): Call `find_key'
- with KEY_READ access.
-
-2000-05-19 DJ Delorie <dj@cygnus.com>
-
- * cygpath.cc: add --windir/--sysdir options
- * utils.sgml: and document them
-
-Thu May 18 14:38:26 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Eliminate WINSUP_DEPS.
- * cygpath.cc: Reorganize includes to accomodate sys/cygwin.h changes.
- * mkgroup.c: Ditto.
- * mkpasswd.c: Ditto.
- * mount.cc: Ditto. Eliminate use of cygwin source specific includes.
- * ps.cc: Ditto.
- * cygwin.cc: Eliminate obsolete file.
-
-Wed Apr 26 23:43:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * mount.cc (main): Add "-X" option to specify a "Cygwin executable".
-
-Sat Apr 15 23:34:00 2000 Corinna Vinschen <corinna@vinschen.de>
-
- * mkpasswd.c (main): Use GetDCName instead of GetAnyDCName.
- Don't create extra passwd entry for administrators group
- if local_groups is set.
- (usage): Change usage text slightly.
- (enum_users): Loop while ERROR_MORE_DATA is returned.
- (enum_local_groups): Ditto.
- * mkgroup.c (enum_local_groups): Ditto.
- (enum_groups) Ditto.
- (usage): Change usage text slightly.
-
-Thu Apr 13 01:22:35 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygpath.cc (main): Add -a -o and -c options.
- (doit): Ditto.
-
-Mon Apr 10 22:56:07 2000 Christopher Faylor <cgf@cygnus.com>
-
- * cygpath.cc (main): Add -f option for processing a group of paths from
- a file.
- (doit): New function.
-
-Sat Mar 18 22:52:37 2000 Christopher Faylor <cgf@cygnus.com>
-
- Patch suggested by Mumit Khan <khan@xraylith.wisc.edu>:
- * strace.cc (_impure_ptr): New global variable to make strace build
- under Cygwin gcc.
-
-Sat Mar 18 12:45:10 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Make CXXFLAGS consistent with cygwin.
-
-Wed Mar 15 00:53:58 2000 Christopher Faylor <cgf@cygnus.com>
-
- * Makefile.in: Use MINGW_CXXFLAGS when compiling strace.
-
-Sun Mar 12 21:22:25 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc: Throughout, track information like start_time, etc. on a
- per-process basis.
-
-Sun Feb 27 23:37:32 2000 Christopher Faylor <cgf@cygnus.com>
-
- * strace.cc (handle_output_debug_string): Parse strace output to allow
- various types of time output.
-
-Fri Jan 21 02:10:26 Corinna Vinschen <corinna@vinschen.de>
-
- * utils/regtool.cc (translate): Added unix like backslash
- processing.
-
-2000-01-20 Corinna Vinschen <corinna@vinschen.de>
-
- * regtool.cc: allow forward slashes as key separators
-
-2000-01-19 DJ Delorie <dj@redhat.com>
-
- * regtool.cc: New file.
- * Makefile.in: add regtool
- * utils.sgml: add regtool
-
-Sat Jan 8 17:13:51 2000 Christopher Faylor <cgf@cygnus.com>
-
- * getfacl.c: New file.
- * setfacl.c: New file.
- * Makefile.in: Add getfacl.exe and setfacl.exe to list of PROGS.
- Fix link flags in MINGW case.
diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in
deleted file mode 100644
index 9e3f8efdb..000000000
--- a/winsup/utils/Makefile.in
+++ /dev/null
@@ -1,179 +0,0 @@
-# Makefile for Cygwin utilities
-# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008 Red Hat, Inc.
-
-# This file is part of Cygwin.
-
-# This software is a copyrighted work licensed under the terms of the
-# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-# details.
-
-SHELL:=@SHELL@
-
-srcdir:=@srcdir@
-VPATH:=@srcdir@
-prefix:=@prefix@
-exec_prefix:=@exec_prefix@
-
-bindir:=@bindir@
-program_transform_name:=@program_transform_name@
-
-override INSTALL:=@INSTALL@
-override INSTALL_PROGRAM:=@INSTALL_PROGRAM@
-override INSTALL_DATA:=@INSTALL_DATA@
-
-EXEEXT:=@EXEEXT@
-EXEEXT_FOR_BUILD:=@EXEEXT_FOR_BUILD@
-
-CC:=@CC@
-CC_FOR_TARGET:=$(CC)
-CXX:=@CXX@
-CXX_FOR_TARGET:=$(CXX)
-
-CFLAGS:=@CFLAGS@
-CXXFLAGS:=@CXXFLAGS@
-override CXXFLAGS+=-fno-exceptions -fno-rtti -DHAVE_DECL_GETOPT=0
-
-include $(srcdir)/../Makefile.common
-
-.SUFFIXES:
-.NOEXPORT:
-.PHONY: all install clean realclean warn_dumper warn_cygcheck_zlib
-
-ALL_LDLIBS := -lnetapi32 -ladvapi32
-ALL_LDFLAGS := -static-libgcc -Wl,--enable-auto-import -B$(newlib_build)/libc -B$(w32api_lib) $(LDFLAGS) $(ALL_LDLIBS)
-ALL_DEP_LDLIBS := $(cygwin_build)/libcygwin.a ${patsubst -l%,\
- $(w32api_lib)/lib%.a,$(ALL_LDLIBS) -lkernel32 -luser32}
-
-MINGW_LIB := $(mingw_build)/libmingw32.a
-MINGW_LDLIBS := $(ALL_LDLIBS) $(MINGW_LIB)
-MINGW_DEP_LDLIBS := $(ALL_DEP_LDLIBS) $(MINGW_LIB)
-MINGW_CXX := ${srcdir}/mingw ${CXX} -I${updir}
-
-# List all binaries to be linked in Cygwin mode. Each binary on this list
-# must have a corresponding .o of the same name.
-CYGWIN_BINS := ${addsuffix .exe,cygpath getfacl kill mkgroup \
- mkpasswd mount passwd ps regtool setfacl setmetamode ssp umount}
-
-# List all binaries to be linked in MinGW mode. Each binary on this list
-# must have a corresponding .o of the same name.
-MINGW_BINS := ${addsuffix .exe,strace cygcheck}
-
-# List all objects to be compiled in MinGW mode. Any object not on this
-# list will will be compiled in Cygwin mode implicitly, so there is no
-# need for a CYGWIN_OBJS.
-MINGW_OBJS := bloda.o cygcheck.o dump_setup.o path.o strace.o
-
-# If a binary should link in any objects besides the .o with the same
-# name as the binary, then list those here.
-strace.exe: path.o
-cygcheck.exe: bloda.o path.o dump_setup.o
-
-# Provide any necessary per-target variable overrides.
-cygcheck.exe: MINGW_LDFLAGS += -lntdll
-cygpath.exe: ALL_LDFLAGS += -lntdll
-
-# Check for dumper's requirements and enable it if found.
-LIBICONV := @libiconv@
-libbfd := ${shell $(CC) -B$(bupdir2)/bfd/ --print-file-name=libbfd.a}
-libintl := ${shell $(CC) -B$(bupdir2)/intl/ --print-file-name=libintl.a}
-build_dumper := ${shell test -r $(libbfd) -a -r $(libintl) -a -n "$(LIBICONV)" && echo 1}
-ifdef build_dumper
-CYGWIN_BINS += dumper.exe
-dumper.o module_info.o parse_pe.o: CXXFLAGS += -I$(bupdir2)/bfd -I$(updir1)/include
-dumper.o parse_pe.o: dumper.h
-dumper.exe: module_info.o parse_pe.o
-dumper.exe: ALL_LDFLAGS += ${libbfd} ${libintl} -L$(bupdir1)/libiberty $(LIBICONV) -liberty
-else
-all: warn_dumper
-endif
-
-# Check for availability of a MinGW libz and enable for cygcheck.
-libz:=${shell x=$$(${MINGW_CXX} --print-file-name=libz.a); cd $$(dirname $$x); dir=$$(pwd); case "$$dir" in *mingw*) echo $$dir/libz.a ;; esac}
-ifdef libz
-zlib_h := -include ${patsubst %/lib/mingw/libz.a,%/include/zlib.h,${patsubst %/lib/libz.a,%/include/zlib.h,$(libz)}}
-zconf_h := ${patsubst %/zlib.h,%/zconf.h,$(zlib_h)}
-dump_setup.o: MINGW_CXXFLAGS += $(zconf_h) $(zlib_h)
-cygcheck.exe: MINGW_LDFLAGS += $(libz)
-else
-all: warn_cygcheck_zlib
-endif
-
-all: Makefile $(CYGWIN_BINS) $(MINGW_BINS)
-
-# test harness support (note: the "MINGW_BINS +=" should come after the
-# "all:" above so that the testsuite is not run for "make" but only
-# "make check".)
-MINGW_BINS += testsuite.exe
-MINGW_OBJS += path-testsuite.o testsuite.o
-testsuite.exe: path-testsuite.o
-path-testsuite.cc: path.cc ; @test -L $@ || ln -sf ${filter %.cc,$^} $@
-path-testsuite.o: MINGW_CXXFLAGS += -DTESTSUITE
-# this is necessary because this .c lives in the build dir instead of src
-path-testsuite.o: MINGW_CXX := ${patsubst -I.,-I$(utils_source),$(MINGW_CXX)}
-path-testsuite.cc path.cc testsuite.cc: testsuite.h
-check: testsuite.exe ; $(<D)/$(<F)
-
-# the rest of this file contains generic rules
-
-# how to compile a MinGW object
-$(MINGW_OBJS): %.o: %.cc
-ifdef VERBOSE
- $(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-else
- @echo $(MINGW_CXX) $c $(MINGW_CXXFLAGS) ... $(*F).cc;\
- $(MINGW_CXX) $c -o $(@D)/$(basename $@)$o $(MINGW_CXXFLAGS) $<
-endif
-
-# how to link a MinGW binary
-$(MINGW_BINS): %.exe: %.o
-ifdef VERBOSE
- $(MINGW_CXX) $(MINGW_CXXFLAGS) -o $@ ${filter %.o,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
-else
- @echo $(MINGW_CXX) -o $@ ${filter %.o,$^} ${filter-out -B%, $(MINGW_CXXFLAGS) $(MINGW_LDFLAGS)};\
- $(MINGW_CXX) $(MINGW_CXXFLAGS) -o $@ ${filter %.o,$^} -B$(mingw_build)/ $(MINGW_LDFLAGS)
-endif
-
-# how to link a Cygwin binary
-$(CYGWIN_BINS): %.exe: %.o
-ifdef VERBOSE
- $(CXX) -o $@ ${filter %.o,$^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
-else
- @echo $(CXX) -o $@ ${filter %.o,$^} ... ${filter-out -B%, $(ALL_LDFLAGS)};\
- $(CXX) -o $@ ${filter %.o,$^} -B$(cygwin_build)/ $(ALL_LDFLAGS)
-endif
-
-# note: how to compile a Cygwin object is covered by the pattern rule in Makefile.common
-
-# these dependencies ensure that the required in-tree libs are built first
-$(MINGW_BINS): $(MINGW_DEP_LDLIBS)
-$(CYGWIN_BINS): $(ALL_DEP_LDLIBS)
-
-clean:
- rm -f *.o $(CYGWIN_BINS) $(MINGW_BINS) path-testsuite.cc testsuite.exe
-
-realclean: clean
- rm -f Makefile config.cache
-
-install: all
- $(SHELL) $(updir1)/mkinstalldirs $(bindir)
- for i in $(CYGWIN_BINS) ${filter-out testsuite.exe,$(MINGW_BINS)} ; do \
- n=`echo $$i | sed '$(program_transform_name)'`; \
- $(INSTALL_PROGRAM) $$i $(bindir)/$$n; \
- done
-
-$(cygwin_build)/libcygwin.a: $(cygwin_build)/Makefile
- @$(MAKE) -C $(@D) $(@F)
-
-$(MINGW_LIB): $(mingw_build)/Makefile
- @$(MAKE) -C $(@D) $(@F)
-
-warn_dumper:
- @echo '*** Not building dumper.exe since some required libraries are'
- @echo '*** missing: libbfd.a and libintl.a.'
- @echo '*** If you need this program, check out the naked-bfd and naked-intl'
- @echo '*** sources from sourceware.org. Then, configure and build these'
- @echo '*** libraries. Otherwise, you can safely ignore this warning.'
-
-warn_cygcheck_zlib:
- @echo '*** Building cygcheck without package content checking due to missing mingw libz.a.'
diff --git a/winsup/utils/aclocal.m4 b/winsup/utils/aclocal.m4
deleted file mode 100644
index ecef4244c..000000000
--- a/winsup/utils/aclocal.m4
+++ /dev/null
@@ -1,875 +0,0 @@
-dnl aclocal.m4 generated automatically by aclocal 1.4-p6
-
-dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-dnl PARTICULAR PURPOSE.
-
-# lib-prefix.m4 serial 4 (gettext-0.14.2)
-dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
-dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
-dnl require excessive bracketing.
-ifdef([AC_HELP_STRING],
-[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
-[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
-
-dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
-dnl to access previously installed libraries. The basic assumption is that
-dnl a user will want packages to use other packages he previously installed
-dnl with the same --prefix option.
-dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
-dnl libraries, but is otherwise very convenient.
-AC_DEFUN([AC_LIB_PREFIX],
-[
- AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- AC_LIB_ARG_WITH([lib-prefix],
-[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
- --without-lib-prefix don't search for libraries in includedir and libdir],
-[
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/lib"
- fi
- fi
-])
- if test $use_additional = yes; then
- dnl Potentially add $additional_includedir to $CPPFLAGS.
- dnl But don't add it
- dnl 1. if it's the standard /usr/include,
- dnl 2. if it's already present in $CPPFLAGS,
- dnl 3. if it's /usr/local/include and we are using GCC on Linux,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- for x in $CPPFLAGS; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- dnl Really add $additional_includedir to $CPPFLAGS.
- CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- dnl Potentially add $additional_libdir to $LDFLAGS.
- dnl But don't add it
- dnl 1. if it's the standard /usr/lib,
- dnl 2. if it's already present in $LDFLAGS,
- dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_libdir" != "X/usr/lib"; then
- haveit=
- for x in $LDFLAGS; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test "X$additional_libdir" = "X/usr/local/lib"; then
- if test -n "$GCC"; then
- case $host_os in
- linux*) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LDFLAGS.
- LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
- fi
- fi
- fi
- fi
- fi
-])
-
-dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
-dnl acl_final_exec_prefix, containing the values to which $prefix and
-dnl $exec_prefix will expand at the end of the configure script.
-AC_DEFUN([AC_LIB_PREPARE_PREFIX],
-[
- dnl Unfortunately, prefix and exec_prefix get only finally determined
- dnl at the end of configure.
- if test "X$prefix" = "XNONE"; then
- acl_final_prefix="$ac_default_prefix"
- else
- acl_final_prefix="$prefix"
- fi
- if test "X$exec_prefix" = "XNONE"; then
- acl_final_exec_prefix='${prefix}'
- else
- acl_final_exec_prefix="$exec_prefix"
- fi
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
- prefix="$acl_save_prefix"
-])
-
-dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
-dnl variables prefix and exec_prefix bound to the values they will have
-dnl at the end of the configure script.
-AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
-[
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- $1
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-])
-
-# lib-link.m4 serial 6 (gettext-0.14.3)
-dnl Copyright (C) 2001-2005 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-AC_PREREQ(2.50)
-
-dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
-dnl augments the CPPFLAGS variable.
-AC_DEFUN([AC_LIB_LINKFLAGS],
-[
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
- define([Name],[translit([$1],[./-], [___])])
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
- AC_LIB_LINKFLAGS_BODY([$1], [$2])
- ac_cv_lib[]Name[]_libs="$LIB[]NAME"
- ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
- ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
- ])
- LIB[]NAME="$ac_cv_lib[]Name[]_libs"
- LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
- INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
- dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
- dnl results of this search when this library appears as a dependency.
- HAVE_LIB[]NAME=yes
- undefine([Name])
- undefine([NAME])
-])
-
-dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode)
-dnl searches for libname and the libraries corresponding to explicit and
-dnl implicit dependencies, together with the specified include files and
-dnl the ability to compile and link the specified testcode. If found, it
-dnl sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} and
-dnl LTLIB${NAME} variables and augments the CPPFLAGS variable, and
-dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
-dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
-AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
-[
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
- define([Name],[translit([$1],[./-], [___])])
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-
- dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
- dnl accordingly.
- AC_LIB_LINKFLAGS_BODY([$1], [$2])
-
- dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
- dnl because if the user has installed lib[]Name and not disabled its use
- dnl via --without-lib[]Name-prefix, he wants to use it.
- ac_save_CPPFLAGS="$CPPFLAGS"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
-
- AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
- ac_save_LIBS="$LIBS"
- LIBS="$LIBS $LIB[]NAME"
- AC_TRY_LINK([$3], [$4], [ac_cv_lib[]Name=yes], [ac_cv_lib[]Name=no])
- LIBS="$ac_save_LIBS"
- ])
- if test "$ac_cv_lib[]Name" = yes; then
- HAVE_LIB[]NAME=yes
- AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the $1 library.])
- AC_MSG_CHECKING([how to link with lib[]$1])
- AC_MSG_RESULT([$LIB[]NAME])
- else
- HAVE_LIB[]NAME=no
- dnl If $LIB[]NAME didn't lead to a usable library, we don't need
- dnl $INC[]NAME either.
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIB[]NAME=
- LTLIB[]NAME=
- fi
- AC_SUBST([HAVE_LIB]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
- undefine([Name])
- undefine([NAME])
-])
-
-dnl Determine the platform dependent parameters needed to use rpath:
-dnl libext, shlibext, hardcode_libdir_flag_spec, hardcode_libdir_separator,
-dnl hardcode_direct, hardcode_minus_L.
-AC_DEFUN([AC_LIB_RPATH],
-[
- dnl Tell automake >= 1.10 to complain if config.rpath is missing.
- m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
- AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
- AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
- AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
- AC_CACHE_CHECK([for shared library run path origin], acl_cv_rpath, [
- CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
- ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
- . ./conftest.sh
- rm -f ./conftest.sh
- acl_cv_rpath=done
- ])
- wl="$acl_cv_wl"
- libext="$acl_cv_libext"
- shlibext="$acl_cv_shlibext"
- hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
- hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
- hardcode_direct="$acl_cv_hardcode_direct"
- hardcode_minus_L="$acl_cv_hardcode_minus_L"
- dnl Determine whether the user wants rpath handling at all.
- AC_ARG_ENABLE(rpath,
- [ --disable-rpath do not hardcode runtime library paths],
- :, enable_rpath=yes)
-])
-
-dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
-AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
-[
- define([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- AC_LIB_ARG_WITH([lib$1-prefix],
-[ --with-lib$1-prefix[=DIR] search for lib$1 in DIR/include and DIR/lib
- --without-lib$1-prefix don't search for lib$1 in includedir and libdir],
-[
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/lib"
- fi
- fi
-])
- dnl Search the library and its dependencies in $additional_libdir and
- dnl $LDFLAGS. Using breadth-first-seach.
- LIB[]NAME=
- LTLIB[]NAME=
- INC[]NAME=
- rpathdirs=
- ltrpathdirs=
- names_already_handled=
- names_next_round='$1 $2'
- while test -n "$names_next_round"; do
- names_this_round="$names_next_round"
- names_next_round=
- for name in $names_this_round; do
- already_handled=
- for n in $names_already_handled; do
- if test "$n" = "$name"; then
- already_handled=yes
- break
- fi
- done
- if test -z "$already_handled"; then
- names_already_handled="$names_already_handled $name"
- dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
- dnl or AC_LIB_HAVE_LINKFLAGS call.
- uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
- eval value=\"\$HAVE_LIB$uppername\"
- if test -n "$value"; then
- if test "$value" = yes; then
- eval value=\"\$LIB$uppername\"
- test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
- eval value=\"\$LTLIB$uppername\"
- test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
- else
- dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
- dnl that this library doesn't exist. So just drop it.
- :
- fi
- else
- dnl Search the library lib$name in $additional_libdir and $LDFLAGS
- dnl and the already constructed $LIBNAME/$LTLIBNAME.
- found_dir=
- found_la=
- found_so=
- found_a=
- if test $use_additional = yes; then
- if test -n "$shlibext" && test -f "$additional_libdir/lib$name.$shlibext"; then
- found_dir="$additional_libdir"
- found_so="$additional_libdir/lib$name.$shlibext"
- if test -f "$additional_libdir/lib$name.la"; then
- found_la="$additional_libdir/lib$name.la"
- fi
- else
- if test -f "$additional_libdir/lib$name.$libext"; then
- found_dir="$additional_libdir"
- found_a="$additional_libdir/lib$name.$libext"
- if test -f "$additional_libdir/lib$name.la"; then
- found_la="$additional_libdir/lib$name.la"
- fi
- fi
- fi
- fi
- if test "X$found_dir" = "X"; then
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- case "$x" in
- -L*)
- dir=`echo "X$x" | sed -e 's/^X-L//'`
- if test -n "$shlibext" && test -f "$dir/lib$name.$shlibext"; then
- found_dir="$dir"
- found_so="$dir/lib$name.$shlibext"
- if test -f "$dir/lib$name.la"; then
- found_la="$dir/lib$name.la"
- fi
- else
- if test -f "$dir/lib$name.$libext"; then
- found_dir="$dir"
- found_a="$dir/lib$name.$libext"
- if test -f "$dir/lib$name.la"; then
- found_la="$dir/lib$name.la"
- fi
- fi
- fi
- ;;
- esac
- if test "X$found_dir" != "X"; then
- break
- fi
- done
- fi
- if test "X$found_dir" != "X"; then
- dnl Found the library.
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
- if test "X$found_so" != "X"; then
- dnl Linking with a shared library. We attempt to hardcode its
- dnl directory into the executable's runpath, unless it's the
- dnl standard /usr/lib.
- if test "$enable_rpath" = no || test "X$found_dir" = "X/usr/lib"; then
- dnl No hardcoding is needed.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- dnl Potentially add DIR to ltrpathdirs.
- dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $found_dir"
- fi
- dnl The hardcoding into $LIBNAME is system dependent.
- if test "$hardcode_direct" = yes; then
- dnl Using DIR/libNAME.so during linking hardcodes DIR into the
- dnl resulting binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- if test -n "$hardcode_libdir_flag_spec" && test "$hardcode_minus_L" = no; then
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- dnl Potentially add DIR to rpathdirs.
- dnl The rpathdirs will be appended to $LIBNAME at the end.
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $found_dir"
- fi
- else
- dnl Rely on "-L$found_dir".
- dnl But don't add it if it's already contained in the LDFLAGS
- dnl or the already constructed $LIBNAME
- haveit=
- for x in $LDFLAGS $LIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
- fi
- if test "$hardcode_minus_L" != no; then
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- dnl We cannot use $hardcode_runpath_var and LD_RUN_PATH
- dnl here, because this doesn't fit in flags passed to the
- dnl compiler. So give up. No hardcoding. This affects only
- dnl very old systems.
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
- fi
- fi
- fi
- fi
- else
- if test "X$found_a" != "X"; then
- dnl Linking with a static library.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
- else
- dnl We shouldn't come here, but anyway it's good to have a
- dnl fallback.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
- fi
- fi
- dnl Assume the include files are nearby.
- additional_includedir=
- case "$found_dir" in
- */lib | */lib/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e 's,/lib/*$,,'`
- additional_includedir="$basedir/include"
- ;;
- esac
- if test "X$additional_includedir" != "X"; then
- dnl Potentially add $additional_includedir to $INCNAME.
- dnl But don't add it
- dnl 1. if it's the standard /usr/include,
- dnl 2. if it's /usr/local/include and we are using GCC on Linux,
- dnl 3. if it's already present in $CPPFLAGS or the already
- dnl constructed $INCNAME,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- for x in $CPPFLAGS $INC[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- dnl Really add $additional_includedir to $INCNAME.
- INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- fi
- dnl Look for dependencies.
- if test -n "$found_la"; then
- dnl Read the .la file. It defines the variables
- dnl dlname, library_names, old_library, dependency_libs, current,
- dnl age, revision, installed, dlopen, dlpreopen, libdir.
- save_libdir="$libdir"
- case "$found_la" in
- */* | *\\*) . "$found_la" ;;
- *) . "./$found_la" ;;
- esac
- libdir="$save_libdir"
- dnl We use only dependency_libs.
- for dep in $dependency_libs; do
- case "$dep" in
- -L*)
- additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
- dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
- dnl But don't add it
- dnl 1. if it's the standard /usr/lib,
- dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
- dnl 3. if it's already present in $LDFLAGS or the already
- dnl constructed $LIBNAME,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_libdir" != "X/usr/lib"; then
- haveit=
- if test "X$additional_libdir" = "X/usr/local/lib"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- haveit=
- for x in $LDFLAGS $LIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LIBNAME.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
- fi
- fi
- haveit=
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LTLIBNAME.
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
- fi
- fi
- fi
- fi
- ;;
- -R*)
- dir=`echo "X$dep" | sed -e 's/^X-R//'`
- if test "$enable_rpath" != no; then
- dnl Potentially add DIR to rpathdirs.
- dnl The rpathdirs will be appended to $LIBNAME at the end.
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $dir"
- fi
- dnl Potentially add DIR to ltrpathdirs.
- dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $dir"
- fi
- fi
- ;;
- -l*)
- dnl Handle this in the next round.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
- ;;
- *.la)
- dnl Handle this in the next round. Throw away the .la's
- dnl directory; it is already contained in a preceding -L
- dnl option.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
- ;;
- *)
- dnl Most likely an immediate library name.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
- ;;
- esac
- done
- fi
- else
- dnl Didn't find the library; assume it is in the system directories
- dnl known to the linker and runtime loader. (All the system
- dnl directories known to the linker should also be known to the
- dnl runtime loader, otherwise the system is severely misconfigured.)
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
- fi
- fi
- fi
- done
- done
- if test "X$rpathdirs" != "X"; then
- if test -n "$hardcode_libdir_separator"; then
- dnl Weird platform: only the last -rpath option counts, the user must
- dnl pass all path elements in one option. We can arrange that for a
- dnl single library, but not when more than one $LIBNAMEs are used.
- alldirs=
- for found_dir in $rpathdirs; do
- alldirs="${alldirs}${alldirs:+$hardcode_libdir_separator}$found_dir"
- done
- dnl Note: hardcode_libdir_flag_spec uses $libdir and $wl.
- acl_save_libdir="$libdir"
- libdir="$alldirs"
- eval flag=\"$hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- else
- dnl The -rpath options are cumulative.
- for found_dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$found_dir"
- eval flag=\"$hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- done
- fi
- fi
- if test "X$ltrpathdirs" != "X"; then
- dnl When using libtool, the option that works for both libraries and
- dnl executables is -R. The -R options are cumulative.
- for found_dir in $ltrpathdirs; do
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
- done
- fi
-])
-
-dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
-dnl unless already present in VAR.
-dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
-dnl contains two or three consecutive elements that belong together.
-AC_DEFUN([AC_LIB_APPENDTOVAR],
-[
- for element in [$2]; do
- haveit=
- for x in $[$1]; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X$element"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- [$1]="${[$1]}${[$1]:+ }$element"
- fi
- done
-])
-
-# lib-ld.m4 serial 3 (gettext-0.13)
-dnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Subroutines of libtool.m4,
-dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
-dnl with libtool.m4.
-
-dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
-AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], acl_cv_prog_gnu_ld,
-[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
- acl_cv_prog_gnu_ld=yes ;;
-*)
- acl_cv_prog_gnu_ld=no ;;
-esac])
-with_gnu_ld=$acl_cv_prog_gnu_ld
-])
-
-dnl From libtool-1.4. Sets the variable LD.
-AC_DEFUN([AC_LIB_PROG_LD],
-[AC_ARG_WITH(gnu-ld,
-[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- AC_MSG_CHECKING([for ld used by GCC])
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case $ac_prog in
- # Accept absolute paths.
- [[\\/]* | [A-Za-z]:[\\/]*)]
- [re_direlt='/[^/][^/]*/\.\./']
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- AC_MSG_CHECKING([for GNU ld])
-else
- AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL(acl_cv_path_LD,
-[if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- acl_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break ;;
- *)
- test "$with_gnu_ld" != yes && break ;;
- esac
- fi
- done
- IFS="$ac_save_ifs"
-else
- acl_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$acl_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT($LD)
-else
- AC_MSG_RESULT(no)
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_LIB_PROG_LD_GNU
-])
-
-dnl This provides configure definitions used by all the winsup
-dnl configure.in files.
-
-# FIXME: We temporarily define our own version of AC_PROG_CC. This is
-# copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
-# are probably using a cross compiler, which will not be able to fully
-# link an executable. This should really be fixed in autoconf
-# itself.
-
-AC_DEFUN([LIB_AC_PROG_CC_GNU],
-[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc,
-[dnl The semicolon is to pacify NeXT's syntax-checking cpp.
-cat > conftest.c <<EOF
-#ifdef __GNUC__
- yes;
-#endif
-EOF
-if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi])])
-
-AC_DEFUN([LIB_AC_PROG_CC],
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_TOOL(CC, gcc, gcc)
-: ${CC:=gcc}
-AC_PROG_CC
-test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-])
-
-AC_DEFUN([LIB_AC_PROG_CXX],
-[AC_BEFORE([$0], [AC_PROG_CPP])dnl
-AC_CHECK_TOOL(CXX, g++, g++)
-if test -z "$CXX"; then
- AC_CHECK_TOOL(CXX, g++, c++, , , )
- : ${CXX:=g++}
- AC_PROG_CXX
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
-fi
-
-CXXFLAGS='$(CFLAGS)'
-])
-
diff --git a/winsup/utils/bloda.cc b/winsup/utils/bloda.cc
deleted file mode 100644
index c6443184f..000000000
--- a/winsup/utils/bloda.cc
+++ /dev/null
@@ -1,409 +0,0 @@
-/* bloda.cc
-
- Copyright 2007 Red Hat, Inc.
-
- This file is part of Cygwin.
-
- This software is a copyrighted work licensed under the terms of the
- Cygwin license. Please consult the file "CYGWIN_LICENSE" for
- details. */
-
-#define cygwin_internal cygwin_internal_dontuse
-#include <stdio.h>
-#include <assert.h>
-#include <windows.h>
-#include <ntdef.h>
-#include <ddk/ntstatus.h>
-#include <ddk/ntapi.h>
-#undef cygwin_internal
-
-#undef DEBUGGING
-#ifdef DEBUGGING
-#define dbg_printf(ARGS) printf ARGS ; fflush (NULL)
-#else /* !DEBUGGING */
-#define dbg_printf(ARGS) do { } while (0)
-#endif /* ?DEBUGGING */
-
-/* This module detects applications from the Big List of Dodgy Apps,
- a list of applications that have at some given time been shown to
- interfere with the operation of cygwin. It detects the presence of
- applications on the system by looking for any of four traces an
- installation might leave: 1) registry keys, 2) files on disk
- 3) running executables 4) loaded dlls or drivers.
-
- At the time of writing, the BLODA amounts to:-
-
- Sonic Solutions burning software containing DLA component
- Norton/MacAffee/Symantec antivirus or antispyware
- Logitech webcam software with "Logitech process monitor" service
- Kerio, Agnitum or ZoneAlarm Personal Firewall
- Iolo System Mechanic/AntiVirus/Firewall
- LanDesk
- Windows Defender
- Embassy Trust Suite fingerprint reader software containing wxvault.dll
- ByteMobile laptop optimization client
-
- A live version is now being maintained in the Cygwin FAQ, at
- http://cygwin.com/faq/faq.using.html#faq.using.bloda
-
-*/
-
-enum bad_app
-{
- SONIC, NORTON, MACAFFEE, SYMANTEC,
- LOGITECH, KERIO, AGNITUM, ZONEALARM,
- IOLO, LANDESK, WINDEFENDER, EMBASSYTS,
- BYTEMOBILE
-};
-
-struct bad_app_info
-{
- enum bad_app app_id;
- const char *details;
- char found_it;
-};
-
-enum bad_app_det_method
-{
- HKLMKEY, HKCUKEY, FILENAME, PROCESSNAME, HOOKDLLNAME
-};
-
-struct bad_app_det
-{
- enum bad_app_det_method type;
- const char *param;
- enum bad_app app;
-};
-
-static const struct bad_app_det dodgy_app_detects[] =
-{
- { PROCESSNAME, "dlactrlw.exe", SONIC },
- { HOOKDLLNAME, "wxvault.dll", EMBASSYTS },
- { HKLMKEY, "SYSTEM\\CurrentControlSet\\Services\\vsdatant", ZONEALARM },
- { FILENAME, "%windir%\\System32\\vsdatant.sys", ZONEALARM },
- { HKLMKEY, "SYSTEM\\CurrentControlSet\\Services\\lvprcsrv", LOGITECH },
- { PROCESSNAME, "LVPrcSrv.exe", LOGITECH },
- { FILENAME, "%programfiles%\\common files\\logitech\\lvmvfm\\LVPrcSrv.exe", LOGITECH },
- { FILENAME, "%windir%\\System32\\bmnet.dll", BYTEMOBILE },
-};
-
-static const size_t num_of_detects = sizeof (dodgy_app_detects) / sizeof (dodgy_app_detects[0]);
-
-static struct bad_app_info big_list_of_dodgy_apps[] =
-{
- { SONIC, "Sonic Solutions burning software containing DLA component" },
- { NORTON, "Norton antivirus or antispyware software" },
- { MACAFFEE, "Macaffee antivirus or antispyware software" },
- { SYMANTEC, "Symantec antivirus or antispyware software" },
- { LOGITECH, "Logitech Process Monitor service" },
- { KERIO, "Kerio Personal Firewall" },
- { AGNITUM, "Agnitum Personal Firewall" },
- { ZONEALARM, "ZoneAlarm Personal Firewall" },
- { IOLO, "Iolo System Mechanic/AntiVirus/Firewall software" },
- { LANDESK, "Landesk" },
- { WINDEFENDER, "Windows Defender" },
- { EMBASSYTS, "Embassy Trust Suite fingerprint reader software containing wxvault.dll" },
- { BYTEMOBILE, "ByteMobile laptop optimization client" },
-};
-
-static const size_t num_of_dodgy_apps = sizeof (big_list_of_dodgy_apps) / sizeof (big_list_of_dodgy_apps[0]);
-
-static PSYSTEM_PROCESSES
-get_process_list (void)
-{
- int n_procs = 0x100;
- PSYSTEM_PROCESSES pslist = (PSYSTEM_PROCESSES) malloc (n_procs * sizeof *pslist);
-
- while (NtQuerySystemInformation (SystemProcessesAndThreadsInformation,
- pslist, n_procs * sizeof *pslist, 0) == STATUS_INFO_LENGTH_MISMATCH)
- {
- n_procs *= 2;
- free (pslist);
- pslist = (PSYSTEM_PROCESSES) malloc (n_procs * sizeof *pslist);
- }
- return pslist;
-}
-
-static PSYSTEM_MODULE_INFORMATION
-get_module_list (void)
-{
- int modsize = 0x1000;
- PSYSTEM_MODULE_INFORMATION modlist = (PSYSTEM_MODULE_INFORMATION) malloc (modsize);
-
- while (NtQuerySystemInformation (SystemModuleInformation,
- modlist, modsize, NULL) == STATUS_INFO_LENGTH_MISMATCH)
- {
- modsize *= 2;
- free (modlist);
- modlist = (PSYSTEM_MODULE_INFORMATION) malloc (modsize);
- }
- return modlist;
-}
-
-static bool
-find_process_in_list (PSYSTEM_PROCESSES pslist, PUNICODE_STRING psname)
-{
- while (1)
- {
- if (pslist->ProcessName.Length && pslist->ProcessName.Buffer)
- {
- dbg_printf (("%S\n", pslist->ProcessName.Buffer));
- if (!_wcsicmp (pslist->ProcessName.Buffer, psname->Buffer))
- return true;
- }
- if (!pslist->NextEntryDelta)
- break;
- pslist = (PSYSTEM_PROCESSES)(pslist->NextEntryDelta + (char *)pslist);
- };
- return false;
-}
-
-static bool
-find_module_in_list (PSYSTEM_MODULE_INFORMATION modlist, const char * const modname)
-{
- PSYSTEM_MODULE_INFORMATION_ENTRY modptr = &modlist->Module[0];
- DWORD count = modlist->Count;
- while (count--)
- {
- dbg_printf (("name '%s' offset %d ", &modptr->ImageName[0], modptr->PathLength));
- dbg_printf (("= '%s'\n", &modptr->ImageName[modptr->PathLength]));
- if (!_stricmp (&modptr->ImageName[modptr->PathLength], modname))
- return true;
- modptr++;
- }
- return false;
-}
-
-static bool
-expand_path (const char *path, char *outbuf)
-{
- char *dst = outbuf;
- const char *end, *envval;
- char envvar[MAX_PATH];
- size_t len;
-
- while ((dst - outbuf) < MAX_PATH)
- {
- if (*path != '%')
- {
- if ((*dst++ = *path++) != 0)
- continue;
- break;
- }
- /* Expand an environ var. */
- end = path + 1;
- while (*end != '%')
- {
- /* Watch out for unterminated % */
- if (*end++ == 0)
- {
- end = NULL;
- break;
- }
- }
- /* If we didn't find the end, can't expand it. */
- if ((end == NULL) || (end == (path + 1)))
- {
- /* Unterminated % so copy verbatim. */
- *dst++ = *path++;
- continue;
- }
- /* Expand the environment var into the new path. */
- if ((end - (path + 1)) >= MAX_PATH)
- return -1;
- memcpy (envvar, path + 1, end - (path + 1));
- envvar[end - (path + 1)] = 0;
- envval = getenv (envvar);
- /* If not found, copy env var name verbatim. */
- if (envval == NULL)
- {
- *dst++ = *path++;
- continue;
- }
- /* Check enough room before copying. */
- len = strlen (envval);
- if ((dst + len - outbuf) >= MAX_PATH)
- return false;
- memcpy (dst, envval, len);
- dst += len;
- /* And carry on past the end of env var name. */
- path = end + 1;
- }
- return (dst - outbuf) < MAX_PATH;
-}
-
-static bool
-detect_dodgy_app (const struct bad_app_det *det, PSYSTEM_PROCESSES pslist, PSYSTEM_MODULE_INFORMATION modlist)
-{
- HANDLE fh;
- HKEY hk;
- UNICODE_STRING unicodename;
- ANSI_STRING ansiname;
- NTSTATUS rv;
- bool found;
- char expandedname[MAX_PATH];
-
- switch (det->type)
- {
- case HKLMKEY:
- dbg_printf (("Detect reg key hklm '%s'... ", det->param));
- if (RegOpenKeyEx (HKEY_LOCAL_MACHINE, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS)
- {
- RegCloseKey (hk);
- dbg_printf (("found!\n"));
- return true;
- }
- break;
-
- case HKCUKEY:
- dbg_printf (("Detect reg key hkcu '%s'... ", det->param));
- if (RegOpenKeyEx (HKEY_CURRENT_USER, det->param, 0, STANDARD_RIGHTS_READ, &hk) == ERROR_SUCCESS)
- {
- RegCloseKey (hk);
- dbg_printf (("found!\n"));
- return true;
- }
- break;
-
- case FILENAME:
- dbg_printf (("Detect filename '%s'... ", det->param));
- if (!expand_path (det->param, expandedname))
- {
- printf ("Expansion failure!\n");
- break;
- }
- dbg_printf (("('%s' after expansion)... ", expandedname));
- fh = CreateFile (expandedname, 0, FILE_SHARE_READ | FILE_SHARE_WRITE
- | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, 0, NULL);
- if (fh != INVALID_HANDLE_VALUE)
- {
- CloseHandle (fh);
- dbg_printf (("found!\n"));
- return true;
- }
- break;
-
- case PROCESSNAME:
- dbg_printf (("Detect proc name '%s'... ", det->param));
- /* Equivalent of RtlInitAnsiString. */
- ansiname.Length = ansiname.MaximumLength = strlen (det->param);
- ansiname.Buffer = (CHAR *) det->param;
- rv = RtlAnsiStringToUnicodeString (&unicodename, &ansiname, TRUE);
- if (rv != STATUS_SUCCESS)
- {
- printf ("Ansi to unicode conversion failure $%08x\n", (unsigned int) rv);
- break;
- }
- found = find_process_in_list (pslist, &unicodename);
- RtlFreeUnicodeString (&unicodename);
- if (found)
- {
- dbg_printf (("found!\n"));
- return true;
- }
- break;
-
- case HOOKDLLNAME:
- dbg_printf (("Detect hookdll '%s'... ", det->param));
- if (find_module_in_list (modlist, det->param))
- {
- dbg_printf (("found!\n"));
- return true;
- }
- break;
-
- }
- dbg_printf (("not found.\n"));
- return false;
-}
-
-static struct bad_app_info *
-find_dodgy_app_info (enum bad_app which_app)
-{
- size_t i;
- for (i = 0; i < num_of_dodgy_apps; i++)
- {
- if (big_list_of_dodgy_apps[i].app_id == which_app)
- return &big_list_of_dodgy_apps[i];
- }
- return NULL;
-}
-
-/* External entrypoint called from cygcheck.cc/dump_sysinfo. */
-void
-dump_dodgy_apps (int verbose)
-{
- size_t i, n_det = 0;
- PSYSTEM_PROCESSES pslist;
- PSYSTEM_MODULE_INFORMATION modlist;
-
- /* Read system info for detect testing. */
- pslist = get_process_list ();
- modlist = get_module_list ();
-
- /* Go with builtin list for now; later may enhance to
- read dodgy apps from a file or download from an URL. */
- for (i = 0; i < num_of_dodgy_apps; i++)
- {
- big_list_of_dodgy_apps[i].found_it = false;
- }
-
- for (i = 0; i < num_of_detects; i++)
- {
- const struct bad_app_det *det = &dodgy_app_detects[i];
- struct bad_app_info *found = find_dodgy_app_info (det->app);
- bool detected = detect_dodgy_app (det, pslist, modlist);
-
- /* Not found would mean we coded the lists bad. */
- assert (found);
- if (detected)
- {
- ++n_det;
- found->found_it |= (1 << det->type);
- }
- }
- if (n_det)
- {
- printf ("\nPotential app conflicts:\n\n");
- for (i = 0; i < num_of_dodgy_apps; i++)
- {
- if (big_list_of_dodgy_apps[i].found_it)
- {
- printf ("%s%s", big_list_of_dodgy_apps[i].details,
- verbose ? "\nDetected: " : ".\n");
- if (!verbose)
- continue;
- const char *sep = "";
- if (big_list_of_dodgy_apps[i].found_it & (1 << HKLMKEY))
- {
- printf ("HKLM Registry Key");
- sep = ", ";
- }
- if (big_list_of_dodgy_apps[i].found_it & (1 << HKCUKEY))
- {
- printf ("%sHKCU Registry Key", sep);
- sep = ", ";
- }
- if (big_list_of_dodgy_apps[i].found_it & (1 << FILENAME))
- {
- printf ("%sNamed file", sep);
- sep = ", ";
- }
- if (big_list_of_dodgy_apps[i].found_it & (1 << PROCESSNAME))
- {
- printf ("%sNamed process", sep);
- sep = ", ";
- }
- if (big_list_of_dodgy_apps[i].found_it & (1 << HOOKDLLNAME))
- {
- printf ("%sLoaded hook DLL", sep);
- }
- printf (".\n\n");
- }
- }
- }
- /* Tidy up allocations. */
- free (pslist);
- free (modlist);
-}
-
diff --git a/winsup/utils/configure b/winsup/utils/configure
deleted file mode 100755
index aac51fd51..000000000
--- a/winsup/utils/configure
+++ /dev/null
@@ -1,4813 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.62.
-#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
-fi
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-if test "x$CONFIG_SHELL" = x; then
- if (eval ":") 2>/dev/null; then
- as_have_required=yes
-else
- as_have_required=no
-fi
-
- if test $as_have_required = yes && (eval ":
-(as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=\$LINENO
- as_lineno_2=\$LINENO
- test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
- test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
- :
-else
- as_candidate_shells=
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- case $as_dir in
- /*)
- for as_base in sh bash ksh sh5; do
- as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
- done;;
- esac
-done
-IFS=$as_save_IFS
-
-
- for as_shell in $as_candidate_shells $SHELL; do
- # Try only shells that exist, to save several forks.
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { ("$as_shell") 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-_ASEOF
-}; then
- CONFIG_SHELL=$as_shell
- as_have_required=yes
- if { "$as_shell" 2> /dev/null <<\_ASEOF
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-:
-(as_func_return () {
- (exit $1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
- break
-fi
-
-fi
-
- done
-
- if test "x$CONFIG_SHELL" != x; then
- for as_var in BASH_ENV ENV
- do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- done
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
- if test $as_have_required = no; then
- echo This script requires a shell more modern than all the
- echo shells that I found on your system. Please install a
- echo modern shell, or manually run the script under such a
- echo shell if you do have one.
- { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
-
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
-else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
- echo No shell found that supports shell functions.
- echo Please tell bug-autoconf@gnu.org about your system,
- echo including any error possibly output before this message.
- echo This can help us improve future autoconf versions.
- echo Configuration will now proceed without shell functions.
-}
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
- elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
- else
- as_ln_s='cp -p'
- fi
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-
-exec 7<&0 </dev/null 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_clean_files=
-ac_config_libobj_dir=.
-LIBOBJS=
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-
-ac_unique_file="mount.cc"
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-target
-target_cpu
-target_vendor
-target_os
-CC
-CFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CC
-EXEEXT
-OBJEXT
-CXX
-CXXFLAGS
-ac_ct_CXX
-libiconv
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-LIBOBJS
-LTLIBOBJS'
-ac_subst_files=''
-ac_user_opts='
-enable_option_checking
-'
- ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CXX
-CXXFLAGS
-CCC'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
-
-ac_prev=
-ac_dashdash=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval $ac_prev=\$ac_option
- ac_prev=
- continue
- fi
-
- case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_dashdash$ac_option in
- --)
- ac_dashdash=yes ;;
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=*)
- datadir=$ac_optarg ;;
-
- -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
- | --dataroo | --dataro | --datar)
- ac_prev=datarootdir ;;
- -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
- | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
- datarootdir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=no ;;
-
- -docdir | --docdir | --docdi | --doc | --do)
- ac_prev=docdir ;;
- -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
- docdir=$ac_optarg ;;
-
- -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
- ac_prev=dvidir ;;
- -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
- dvidir=$ac_optarg ;;
-
- -enable-* | --enable-*)
- ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=\$ac_optarg ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
- ac_prev=htmldir ;;
- -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
- | --ht=*)
- htmldir=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localedir | --localedir | --localedi | --localed | --locale)
- ac_prev=localedir ;;
- -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
- localedir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst | --locals)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
- ac_prev=pdfdir ;;
- -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
- pdfdir=$ac_optarg ;;
-
- -psdir | --psdir | --psdi | --psd | --ps)
- ac_prev=psdir ;;
- -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
- psdir=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=\$ac_optarg ;;
-
- -without-* | --without-*)
- ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
- { (exit 1); exit 1; }; }
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=no ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; }
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
- { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
- { (exit 1); exit 1; }; }
- eval $ac_envvar=\$ac_optarg
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- { $as_echo "$as_me: error: missing argument to $ac_option" >&2
- { (exit 1); exit 1; }; }
-fi
-
-if test -n "$ac_unrecognized_opts"; then
- case $enable_option_checking in
- no) ;;
- fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2
- { (exit 1); exit 1; }; } ;;
- *) $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;;
- esac
-fi
-
-# Check all directory arguments for consistency.
-for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
- datadir sysconfdir sharedstatedir localstatedir includedir \
- oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
-do
- eval ac_val=\$$ac_var
- # Remove trailing slashes.
- case $ac_val in
- */ )
- ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
- eval $ac_var=\$ac_val;;
- esac
- # Be sure to have absolute directory names.
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) continue;;
- NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
- esac
- { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; }
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
- If a cross compiler is detected then cross compile mode will be used." >&2
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- { $as_echo "$as_me: error: Working directory cannot be determined" >&2
- { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
- { (exit 1); exit 1; }; }
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then the parent directory.
- ac_confdir=`$as_dirname -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_myself" : 'X\(//\)[^/]' \| \
- X"$as_myself" : 'X\(//\)$' \| \
- X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r "$srcdir/$ac_unique_file"; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r "$srcdir/$ac_unique_file"; then
- test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
- { (exit 1); exit 1; }; }
- pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
- srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
- eval ac_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_env_${ac_var}_value=\$${ac_var}
- eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
-_ACEOF
-
- cat <<\_ACEOF
-
-Program names:
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM run sed PROGRAM on installed program names
-
-System types:
- --build=BUILD configure for building on BUILD [guessed]
- --host=HOST cross-compile to build programs to run on HOST [BUILD]
- --target=TARGET configure for building compilers for TARGET [HOST]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
-
- cat <<\_ACEOF
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
- you have headers in a nonstandard directory <include dir>
- CXX C++ compiler command
- CXXFLAGS C++ compiler flags
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" ||
- { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
- continue
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
- cd "$ac_dir" || { ac_status=$?; continue; }
- # Check for guested configure.
- if test -f "$ac_srcdir/configure.gnu"; then
- echo &&
- $SHELL "$ac_srcdir/configure.gnu" --help=recursive
- elif test -f "$ac_srcdir/configure"; then
- echo &&
- $SHELL "$ac_srcdir/configure" --help=recursive
- else
- $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi || ac_status=$?
- cd "$ac_pwd" || { ac_status=$?; break; }
- done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
- cat <<\_ACEOF
-configure
-generated by GNU Autoconf 2.62
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit
-fi
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by $as_me, which was
-generated by GNU Autoconf 2.62. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- $as_echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *\'*)
- ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
- 2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- ac_configure_args="$ac_configure_args '$ac_arg'"
- ;;
- esac
- done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
- echo
- # The following way of writing the cache mishandles newlines in values,
-(
- for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) $as_unset $ac_var ;;
- esac ;;
- esac
- done
- (set) 2>&1 |
- case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
- sed -n \
- "s/'\''/'\''\\\\'\'''\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
- ;; #(
- *)
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
- ;;
- esac |
- sort
-)
- echo
-
- cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- $as_echo "$ac_var='\''$ac_val'\''"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- $as_echo "$ac_var='\''$ac_val'\''"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
- echo
- cat confdefs.h
- echo
- fi
- test "$ac_signal" != 0 &&
- $as_echo "$as_me: caught signal $ac_signal"
- $as_echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core core.conftest.* &&
- rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
- ac_site_file1=$CONFIG_SITE
-elif test "x$prefix" != xNONE; then
- ac_site_file1=$prefix/share/config.site
- ac_site_file2=$prefix/etc/config.site
-else
- ac_site_file1=$ac_default_prefix/share/config.site
- ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
- test "x$ac_site_file" = xNONE && continue
- if test -r "$ac_site_file"; then
- { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
- { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . "$cache_file";;
- *) . "./$cache_file";;
- esac
- fi
-else
- { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val=\$ac_cv_env_${ac_var}_value
- eval ac_new_val=\$ac_env_${ac_var}_value
- case $ac_old_set,$ac_new_set in
- set,)
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- # differences in whitespace do not lead to failure.
- ac_old_val_w=`echo x $ac_old_val`
- ac_new_val_w=`echo x $ac_new_val`
- if test "$ac_old_val_w" != "$ac_new_val_w"; then
- { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- ac_cache_corrupted=:
- else
- { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
- eval $ac_var=\$ac_old_val
- fi
- { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5
-$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
- { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5
-$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-ac_aux_dir=
-for ac_dir in ../.. "$srcdir"/../..; do
- if test -f "$ac_dir/install-sh"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f "$ac_dir/install.sh"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- elif test -f "$ac_dir/shtool"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/shtool install -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in ../.. \"$srcdir\"/../.." >&5
-$as_echo "$as_me: error: cannot find install-sh or install.sh in ../.. \"$srcdir\"/../.." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
-
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
- { (exit 1); exit 1; }; }
-
-{ $as_echo "$as_me:$LINENO: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if test "${ac_cv_build+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
- ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
- { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
- { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-$as_echo "$as_me: error: invalid value of canonical build" >&2;}
- { (exit 1); exit 1; }; };;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:$LINENO: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if test "${ac_cv_host+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "x$host_alias" = x; then
- ac_cv_host=$ac_cv_build
-else
- ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-$as_echo "$as_me: error: invalid value of canonical host" >&2;}
- { (exit 1); exit 1; }; };;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:$LINENO: checking target system type" >&5
-$as_echo_n "checking target system type... " >&6; }
-if test "${ac_cv_target+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test "x$target_alias" = x; then
- ac_cv_target=$ac_cv_host
-else
- ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
- { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
-$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_target" >&5
-$as_echo "$ac_cv_target" >&6; }
-case $ac_cv_target in
-*-*-*) ;;
-*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
-$as_echo "$as_me: error: invalid value of canonical target" >&2;}
- { (exit 1); exit 1; }; };;
-esac
-target=$ac_cv_target
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_target
-shift
-target_cpu=$1
-target_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-target_os=$*
-IFS=$ac_save_IFS
-case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac
-
-
-# The aliases save the names the user supplied, while $host etc.
-# will get canonicalized.
-test -n "$target_alias" &&
- test "$program_prefix$program_suffix$program_transform_name" = \
- NONENONEs,x,x, &&
- program_prefix=${target_alias}-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_CC="gcc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_CC" = x; then
- CC="gcc"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
-else
- CC="$ac_cv_prog_CC"
-fi
-
-: ${CC:=gcc}
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_CC="gcc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- fi
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl.exe
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:$LINENO: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl.exe
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_CC="$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$ac_ct_CC" && break
-done
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -v >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -V >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- * ) ac_rmfiles="$ac_rmfiles $ac_file";;
- esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link_default") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile. We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
- then :; else
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- fi
- # We set ac_cv_exeext here because the later test for it is not
- # safe: cross compilers may not add the suffix if given an `-o'
- # argument, so we may need to know it at that point already.
- # Even if this section looks crufty: it has the advantage of
- # actually working.
- break;;
- * )
- break;;
- esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
- ac_file=''
-fi
-
-{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-if test -z "$ac_file"; then
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: C compiler cannot create executables
-See \`config.log' for more details." >&2;}
- { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
- fi
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- break;;
- * ) break;;
- esac
-done
-else
- { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
- for ac_file in conftest.o conftest.obj conftest.*; do
- test -f "$ac_file" || continue;
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_compiler_gnu=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
- GCC=yes
-else
- GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_save_c_werror_flag=$ac_c_werror_flag
- ac_c_werror_flag=yes
- ac_cv_prog_cc_g=no
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
- inside strings and character constants. */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cc_c89=$ac_arg
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
- test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
- x)
- { $as_echo "$as_me:$LINENO: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
- xno)
- { $as_echo "$as_me:$LINENO: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
- *)
- CC="$CC $ac_cv_prog_cc_c89"
- { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable cc found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
- { (exit 1); exit 1; }; }
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
-set dummy ${ac_tool_prefix}g++; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CXX="${ac_tool_prefix}g++"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
- { $as_echo "$as_me:$LINENO: result: $CXX" >&5
-$as_echo "$CXX" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CXX"; then
- ac_ct_CXX=$CXX
- # Extract the first word of "g++", so it can be a program name with args.
-set dummy g++; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CXX"; then
- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_CXX="g++"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
-if test -n "$ac_ct_CXX"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-$as_echo "$ac_ct_CXX" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_CXX" = x; then
- CXX="g++"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CXX=$ac_ct_CXX
- fi
-else
- CXX="$ac_cv_prog_CXX"
-fi
-
-if test -z "$CXX"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
-set dummy ${ac_tool_prefix}g++; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CXX="${ac_tool_prefix}g++"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
- { $as_echo "$as_me:$LINENO: result: $CXX" >&5
-$as_echo "$CXX" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CXX"; then
- ac_ct_CXX=$CXX
- # Extract the first word of "g++", so it can be a program name with args.
-set dummy g++; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CXX"; then
- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_CXX="g++"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
-if test -n "$ac_ct_CXX"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-$as_echo "$ac_ct_CXX" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_CXX" = x; then
- CXX="c++"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CXX=$ac_ct_CXX
- fi
-else
- CXX="$ac_cv_prog_CXX"
-fi
-
- : ${CXX:=g++}
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-if test -z "$CXX"; then
- if test -n "$CCC"; then
- CXX=$CCC
- else
- if test -n "$ac_tool_prefix"; then
- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
- { $as_echo "$as_me:$LINENO: result: $CXX" >&5
-$as_echo "$CXX" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$CXX" && break
- done
-fi
-if test -z "$CXX"; then
- ac_ct_CXX=$CXX
- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CXX"; then
- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
- ac_cv_prog_ac_ct_CXX="$ac_prog"
- $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
-if test -n "$ac_ct_CXX"; then
- { $as_echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-$as_echo "$ac_ct_CXX" >&6; }
-else
- { $as_echo "$as_me:$LINENO: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$ac_ct_CXX" && break
-done
-
- if test "x$ac_ct_CXX" = x; then
- CXX="g++"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- CXX=$ac_ct_CXX
- fi
-fi
-
- fi
-fi
-# Provide some information about the compiler.
-$as_echo "$as_me:$LINENO: checking for C++ compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -v >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compiler -V >&5") 2>&5
- ac_status=$?
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-
-{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
-$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_compiler_gnu=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
-$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
- GXX=yes
-else
- GXX=
-fi
-ac_test_CXXFLAGS=${CXXFLAGS+set}
-ac_save_CXXFLAGS=$CXXFLAGS
-{ $as_echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
-$as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if test "${ac_cv_prog_cxx_g+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_save_cxx_werror_flag=$ac_cxx_werror_flag
- ac_cxx_werror_flag=yes
- ac_cv_prog_cxx_g=no
- CXXFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cxx_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CXXFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cxx_werror_flag=$ac_save_cxx_werror_flag
- CXXFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_compile") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cxx_g=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
-$as_echo "$ac_cv_prog_cxx_g" >&6; }
-if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS=$ac_save_CXXFLAGS
-elif test $ac_cv_prog_cxx_g = yes; then
- if test "$GXX" = yes; then
- CXXFLAGS="-g -O2"
- else
- CXXFLAGS="-g"
- fi
-else
- if test "$GXX" = yes; then
- CXXFLAGS="-O2"
- else
- CXXFLAGS=
- fi
-fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
- test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable cc found in \$PATH" >&5
-$as_echo "$as_me: error: no acceptable cc found in \$PATH" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
-CXXFLAGS='$(CFLAGS)'
-
-
-test "$program_prefix" != NONE &&
- program_transform_name="s&^&$program_prefix&;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
- program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.
-# By default was `s,x,x', remove it if useless.
-ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
-program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
-
-
-
-{ $as_echo "$as_me:$LINENO: checking for libiconv in -liconv" >&5
-$as_echo_n "checking for libiconv in -liconv... " >&6; }
-if test "${ac_cv_lib_iconv_libiconv+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-liconv $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char libiconv ();
-int
-main ()
-{
-return libiconv ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
-$as_echo "$ac_try_echo") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- $as_test_x conftest$ac_exeext
- }; then
- ac_cv_lib_iconv_libiconv=yes
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_iconv_libiconv=no
-fi
-
-rm -rf conftest.dSYM
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_iconv_libiconv" >&5
-$as_echo "$ac_cv_lib_iconv_libiconv" >&6; }
-if test $ac_cv_lib_iconv_libiconv = yes; then
- libiconv=-liconv
-fi
-
-
-
-INSTALL="/bin/sh "`cd $srcdir/../..; echo $(pwd)/install-sh -c`
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
- $as_echo_n "(cached) " >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
- ./ | .// | /cC/* | \
- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
- /usr/ucb/* ) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
- if test $ac_prog = install &&
- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- elif test $ac_prog = install &&
- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- rm -rf conftest.one conftest.two conftest.dir
- echo one > conftest.one
- echo two > conftest.two
- mkdir conftest.dir
- if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
- test -s conftest.one && test -s conftest.two &&
- test -s conftest.dir/conftest.one &&
- test -s conftest.dir/conftest.two
- then
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
- fi
- fi
- done
- done
- ;;
-esac
-
-done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
- INSTALL=$ac_install_sh
- fi
-fi
-{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-
-ac_config_files="$ac_config_files Makefile"
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(
- for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) $as_unset $ac_var ;;
- esac ;;
- esac
- done
-
- (set) 2>&1 |
- case $as_nl`(ac_space=' '; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;; #(
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
- ;;
- esac |
- sort
-) |
- sed '
- /^ac_cv_env_/b end
- t clear
- :clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
- if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
- { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
- else
- { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-#
-# If the first sed substitution is executed (which looks for macros that
-# take arguments), then branch to the quote section. Otherwise,
-# look for a macro that doesn't take arguments.
-ac_script='
-:mline
-/\\$/{
- N
- s,\\\n,,
- b mline
-}
-t clear
-:clear
-s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g
-t quote
-s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g
-t quote
-b any
-:quote
-s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g
-s/\[/\\&/g
-s/\]/\\&/g
-s/\$/$$/g
-H
-:any
-${
- g
- s/^\n//
- s/\n/ /g
- p
-}
-'
-DEFS=`sed -n "$ac_script" confdefs.h`
-
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
- ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
- # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
- # will be set to the directory where LIBOBJS objects are built.
- ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-: ${CONFIG_STATUS=./config.status}
-ac_write_fail=0
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
-fi
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
- # uniformly replaced by the line number. The first 'sed' inserts a
- # line-number line after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, and appends
- # trailing '-' during substitution so that $LINENO is not a special
- # case at line end.
- # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
- { (exit 1); exit 1; }; }
-
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
- elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
- else
- as_ln_s='cp -p'
- fi
-else
- as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-exec 6>&1
-
-# Save the log message, to keep $[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by $as_me, which was
-generated by GNU Autoconf 2.62. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-# Files that config.status was made for.
-config_files="$ac_config_files"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
- -h, --help print this help, then exit
- -V, --version print version number and configuration settings, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
-
-Configuration files:
-$config_files
-
-Report bugs to <bug-autoconf@gnu.org>."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_version="\\
-config.status
-configured by $0, generated by GNU Autoconf 2.62,
- with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2008 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
-test -n "\$AWK" || AWK=awk
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# The default lists apply if the user does not specify any file.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=*)
- ac_option=`expr "X$1" : 'X\([^=]*\)='`
- ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- *)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- esac
-
- case $ac_option in
- # Handling of the options.
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- $as_echo "$ac_cs_version"; exit ;;
- --debug | --debu | --deb | --de | --d | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- case $ac_optarg in
- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
- ac_need_defaults=false;;
- --he | --h | --help | --hel | -h )
- $as_echo "$ac_cs_usage"; exit ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { $as_echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; } ;;
-
- *) ac_config_targets="$ac_config_targets $1"
- ac_need_defaults=false ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-if \$ac_cs_recheck; then
- set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
- shift
- \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
- CONFIG_SHELL='$SHELL'
- export CONFIG_SHELL
- exec "\$@"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
- $as_echo "$ac_log"
-} >&5
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
- case $ac_config_target in
- "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-
- *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
- { (exit 1); exit 1; }; };;
- esac
-done
-
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
- tmp=
- trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./conf$$-$RANDOM
- (umask 077 && mkdir "$tmp")
-} ||
-{
- $as_echo "$as_me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-# Set up the scripts for CONFIG_FILES section.
-# No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
-if test -n "$CONFIG_FILES"; then
-
-
-ac_cr=' '
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\\r'
-else
- ac_cs_awk_cr=$ac_cr
-fi
-
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
-_ACEOF
-
-
-{
- echo "cat >conf$$subs.awk <<_ACEOF" &&
- echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
- echo "_ACEOF"
-} >conf$$subs.sh ||
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
- . ./conf$$subs.sh ||
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then
- break
- elif $ac_last_try; then
- { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-rm -f conf$$subs.sh
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
-_ACEOF
-sed -n '
-h
-s/^/S["/; s/!.*/"]=/
-p
-g
-s/^[^!]*!//
-:repl
-t repl
-s/'"$ac_delim"'$//
-t delim
-:nl
-h
-s/\(.\{148\}\).*/\1/
-t more1
-s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
-p
-n
-b repl
-:more1
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t nl
-:delim
-h
-s/\(.\{148\}\).*/\1/
-t more2
-s/["\\]/\\&/g; s/^/"/; s/$/"/
-p
-b
-:more2
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t delim
-' <conf$$subs.awk | sed '
-/^[^""]/{
- N
- s/\n//
-}
-' >>$CONFIG_STATUS || ac_write_fail=1
-rm -f conf$$subs.awk
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
- for (key in S) S_is_set[key] = 1
- FS = ""
-
-}
-{
- line = $ 0
- nfields = split(line, field, "@")
- substed = 0
- len = length(field[1])
- for (i = 2; i < nfields; i++) {
- key = field[i]
- keylen = length(key)
- if (S_is_set[key]) {
- value = S[key]
- line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
- len += length(value) + length(field[++i])
- substed = 1
- } else
- len += 1 + keylen
- }
-
- print line
-}
-
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
- sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
-else
- cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
- || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
-$as_echo "$as_me: error: could not setup config files machinery" >&2;}
- { (exit 1); exit 1; }; }
-_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[ ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-fi # test -n "$CONFIG_FILES"
-
-
-eval set X " :F $CONFIG_FILES "
-shift
-for ac_tag
-do
- case $ac_tag in
- :[FHLC]) ac_mode=$ac_tag; continue;;
- esac
- case $ac_mode$ac_tag in
- :[FHL]*:*);;
- :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;}
- { (exit 1); exit 1; }; };;
- :[FH]-) ac_tag=-:-;;
- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
- esac
- ac_save_IFS=$IFS
- IFS=:
- set x $ac_tag
- IFS=$ac_save_IFS
- shift
- ac_file=$1
- shift
-
- case $ac_mode in
- :L) ac_source=$1;;
- :[FH])
- ac_file_inputs=
- for ac_f
- do
- case $ac_f in
- -) ac_f="$tmp/stdin";;
- *) # Look for the file first in the build tree, then in the source tree
- # (if the path is not absolute). The absolute path cannot be DOS-style,
- # because $ac_f cannot contain `:'.
- test -f "$ac_f" ||
- case $ac_f in
- [\\/$]*) false;;
- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
- esac ||
- { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
- esac
- case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
- ac_file_inputs="$ac_file_inputs '$ac_f'"
- done
-
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- configure_input='Generated from '`
- $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
- `' by configure.'
- if test x"$ac_file" != x-; then
- configure_input="$ac_file. $configure_input"
- { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
- fi
- # Neutralize special characters interpreted by sed in replacement strings.
- case $configure_input in #(
- *\&* | *\|* | *\\* )
- ac_sed_conf_input=`$as_echo "$configure_input" |
- sed 's/[\\\\&|]/\\\\&/g'`;; #(
- *) ac_sed_conf_input=$configure_input;;
- esac
-
- case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; } ;;
- esac
- ;;
- esac
-
- ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
- case $ac_mode in
- :F)
- #
- # CONFIG_FILE
- #
-
- case $INSTALL in
- [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
- esac
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-
-ac_sed_dataroot='
-/datarootdir/ {
- p
- q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-'
-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
- ac_datarootdir_hack='
- s&@datadir@&$datadir&g
- s&@docdir@&$docdir&g
- s&@infodir@&$infodir&g
- s&@localedir@&$localedir&g
- s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
-_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_sed_extra="$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s|@configure_input@|$ac_sed_conf_input|;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@top_build_prefix@&$ac_top_build_prefix&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-$ac_datarootdir_hack
-"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
-
- rm -f "$tmp/stdin"
- case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
- esac \
- || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
-$as_echo "$as_me: error: could not create $ac_file" >&2;}
- { (exit 1); exit 1; }; }
- ;;
-
-
-
- esac
-
-done # for ac_tag
-
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-test $ac_write_fail = 0 ||
- { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || { (exit 1); exit 1; }
-fi
-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
- { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;}
-fi
-
diff --git a/winsup/utils/configure.in b/winsup/utils/configure.in
deleted file mode 100644
index d38a4b11c..000000000
--- a/winsup/utils/configure.in
+++ /dev/null
@@ -1,31 +0,0 @@
-dnl Autoconf configure script for Cygwin utilities.
-dnl Copyright 1996, 1997, 1998, 1999, 2000 Cygnus Solutions.
-dnl
-dnl This file is part of Cygwin.
-dnl
-dnl This software is a copyrighted work licensed under the terms of the
-dnl Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-dnl details.
-
-dnl Process this file with autoconf to produce a configure script.
-
-AC_PREREQ(2.59)
-AC_INIT(mount.cc)
-AC_CONFIG_AUX_DIR(../..)
-
-AC_CANONICAL_SYSTEM
-
-LIB_AC_PROG_CC
-LIB_AC_PROG_CXX
-
-AC_ARG_PROGRAM
-
-AC_CHECK_LIB(iconv, libiconv, libiconv=-liconv)
-AC_SUBST(libiconv)
-
-INSTALL="/bin/sh "`cd $srcdir/../..; echo $(pwd)/install-sh -c`
-
-AC_PROG_INSTALL
-
-AC_EXEEXT
-AC_OUTPUT(Makefile)
diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
deleted file mode 100644
index 9a04cb41b..000000000
--- a/winsup/utils/cygcheck.cc
+++ /dev/null
@@ -1,2182 +0,0 @@
-/* cygcheck.cc
-
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008 Red Hat, Inc.
-
- This file is part of Cygwin.
-
- This software is a copyrighted work licensed under the terms of the
- Cygwin license. Please consult the file "CYGWIN_LICENSE" for
- details. */
-
-#define cygwin_internal cygwin_internal_dontuse
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <sys/time.h>
-#include <ctype.h>
-#include <io.h>
-#include <windows.h>
-#include <wininet.h>
-#include "path.h"
-#include <getopt.h>
-#include "cygwin/include/sys/cygwin.h"
-#include "cygwin/include/mntent.h"
-#undef cygwin_internal
-
-#define alloca __builtin_alloca
-
-int verbose = 0;
-int registry = 0;
-int sysinfo = 0;
-int givehelp = 0;
-int keycheck = 0;
-int check_setup = 0;
-int dump_only = 0;
-int find_package = 0;
-int list_package = 0;
-int grep_packages = 0;
-
-static char emptystr[] = "";
-
-/* This is global because it's used in both internet_display_error as well
- as package_grep. */
-BOOL (WINAPI *pInternetCloseHandle) (HINTERNET);
-
-#ifdef __GNUC__
-typedef long long longlong;
-#else
-typedef __int64 longlong;
-#endif
-
-/* In dump_setup.cc */
-void dump_setup (int, char **, bool);
-void package_find (int, char **);
-void package_list (int, char **);
-/* In bloda.cc */
-void dump_dodgy_apps (int verbose);
-
-
-static const char version[] = "$Revision$";
-
-static const char *known_env_vars[] = {
- "c_include_path",
- "compiler_path",
- "cxx_include_path",
- "cygwin",
- "cygwin32",
- "dejagnu",
- "expect",
- "gcc_default_options",
- "gcc_exec_prefix",
- "home",
- "ld_library_path",
- "library_path",
- "login",
- "lpath",
- "make_mode",
- "makeflags",
- "path",
- "pwd",
- "strace",
- "tcl_library",
- "user",
- 0
-};
-
-struct
-{
- const char *name;
- int missing_is_good;
-}
-static common_apps[] = {
- {"awk", 0},
- {"bash", 0},
- {"cat", 0},
- {"cp", 0},
- {"cpp", 1},
- {"crontab", 0},
- {"find", 0},
- {"gcc", 0},
- {"gdb", 0},
- {"grep", 0},
- {"kill", 0},
- {"ld", 0},
- {"ls", 0},
- {"make", 0},
- {"mv", 0},
- {"patch", 0},
- {"perl", 0},
- {"rm", 0},
- {"sed", 0},
- {"ssh", 0},
- {"sh", 0},
- {"tar", 0},
- {"test", 0},
- {"vi", 0},
- {"vim", 0},
- {0, 0}
-};
-
-static int num_paths, max_paths;
-struct pathlike
-{
- char *dir;
- bool issys;
- void check_existence (const char *fn, int showall, int verbose,
- char* first, const char *ext1 = "",
- const char *ext2 = "");
-};
-
-pathlike *paths;
-int first_nonsys_path;
-
-void
-eprintf (const char *format, ...)
-{
- va_list ap;
- va_start (ap, format);
- vfprintf (stderr, format, ap);
- va_end (ap);
-}
-
-/*
- * display_error() is used to report failure modes
- */
-static int
-display_error (const char *name, bool show_error, bool print_failed)
-{
- fprintf (stderr, "cygcheck: %s", name);
- if (show_error)
- fprintf (stderr, "%s: %lu\n",
- print_failed ? " failed" : "", GetLastError ());
- else
- fprintf (stderr, "%s\n",
- print_failed ? " failed" : "");
- return 1;
-}
-
-static int
-display_error (const char *name)
-{
- return display_error (name, true, true);
-}
-
-static int
-display_error (const char *fmt, const char *x)
-{
- char buf[4000];
- sprintf (buf, fmt, x);
- return display_error (buf, false, false);
-}
-
-static int
-display_error_fmt (const char *fmt, ...)
-{
- char buf[4000];
- va_list va;
-
- va_start (va, fmt);
- vsprintf (buf, fmt, va);
- return display_error (buf, false, false);
-}
-
-/* Display a WinInet error message, and close a variable number of handles.
- (Passed a list of handles terminated by NULL.) */
-static int
-display_internet_error (const char *message, ...)
-{
- DWORD err = GetLastError ();
- TCHAR err_buf[256];
- va_list hptr;
- HINTERNET h;
-
- /* in the case of a successful connection but 404 response, there is no
- win32 error message, but we still get passed a message to display. */
- if (err)
- {
- if (FormatMessage (FORMAT_MESSAGE_FROM_HMODULE,
- GetModuleHandle ("wininet.dll"), err, 0, err_buf,
- sizeof (err_buf), NULL) == 0)
- strcpy (err_buf, "(Unknown error)");
-
- fprintf (stderr, "cygcheck: %s: %s (win32 error %lu)\n", message,
- err_buf, err);
- }
- else
- fprintf (stderr, "cygcheck: %s\n", message);
-
- va_start (hptr, message);
- while ((h = va_arg (hptr, HINTERNET)) != 0)
- pInternetCloseHandle (h);
- va_end (hptr);
-
- return 1;
-}
-
-static void
-add_path (char *s, int maxlen, bool issys)
-{
- if (num_paths >= max_paths)
- {
- max_paths += 10;
- /* Extend path array */
- paths = (pathlike *) realloc (paths, (1 + max_paths) * sizeof (paths[0]));
- }
-
- pathlike *pth = paths + num_paths;
-
- /* Allocate space for directory in path list */
- char *dir = (char *) calloc (maxlen + 2, sizeof (char));
- if (dir == NULL)
- {
- display_error ("add_path: calloc() failed");
- return;
- }
-
- /* Copy input directory to path list */
- memcpy (dir, s, maxlen);
-
- /* Add a trailing slash by default */
- char *e = strchr (dir, '\0');
- if (e != dir && e[-1] != '\\')
- strcpy (e, "\\");
-
- /* Fill out this element */
- pth->dir = dir;
- pth->issys = issys;
- pth[1].dir = NULL;
- num_paths++;
-}
-
-static void
-init_paths ()
-{
- char tmp[4000], *sl;
- add_path ((char *) ".", 1, true); /* to be replaced later */
-
- if (GetCurrentDirectory (4000, tmp))
- add_path (tmp, strlen (tmp), true);
- else
- display_error ("init_paths: GetCurrentDirectory()");
-
- if (GetSystemDirectory (tmp, 4000))
- add_path (tmp, strlen (tmp), true);
- else
- display_error ("init_paths: GetSystemDirectory()");
- sl = strrchr (tmp, '\\');
- if (sl)
- {
- strcpy (sl, "\\SYSTEM");
- add_path (tmp, strlen (tmp), true);
- }
- GetWindowsDirectory (tmp, 4000);
- add_path (tmp, strlen (tmp), true);
-
- char *wpath = getenv ("PATH");
- if (!wpath)
- display_error ("WARNING: PATH is not set\n", "");
- else
- {
- char *b, *e;
- b = wpath;
- while (1)
- {
- for (e = b; *e && *e != ';'; e++)
- continue; /* loop terminates at first ';' or EOS */
- if (strncmp(b, ".\\", 2) != 0)
- add_path (b, e - b, false);
- if (!*e)
- break;
- b = e + 1;
- }
- }
-}
-
-#define LINK_EXTENSION ".lnk"
-
-void
-pathlike::check_existence (const char *fn, int showall, int verbose,
- char* first, const char *ext1, const char *ext2)
-{
- char file[4000];
- strcpy (file, dir);
- strcat (file, fn);
- strcat (file, ext1);
- strcat (file, ext2);
-
- if (GetFileAttributes (file) != (DWORD) - 1)
- {
- char *lastdot = strrchr (file, '.');
- bool is_link = lastdot && !strcmp (lastdot, LINK_EXTENSION);
- // If file is a link, fix up the extension before printing
- if (is_link)
- *lastdot = '\0';
- if (showall)
- printf ("Found: %s\n", file);
- if (verbose && *first != '\0' && strcasecmp (first, file) != 0)
- {
- char *flastdot = strrchr (first, '.');
- bool f_is_link = flastdot && !strcmp (flastdot, LINK_EXTENSION);
- // if first is a link, fix up the extension before printing
- if (f_is_link)
- *flastdot = '\0';
- printf ("Warning: %s hides %s\n", first, file);
- if (f_is_link)
- *flastdot = '.';
- }
- if (is_link)
- *lastdot = '.';
- if (!*first)
- strcpy (first, file);
- }
-}
-
-static const char *
-find_on_path (const char *in_file, const char *ext, bool showall = false,
- bool search_sys = false, bool checklinks = false)
-{
- static char rv[4000];
-
- /* Sort of a kludge but we've already tested this once, so don't try it again */
- if (in_file == rv)
- return in_file;
-
- static pathlike abspath[2] =
- {
- {emptystr, 0},
- {NULL, 0}
- };
-
- *rv = '\0';
- if (!in_file)
- {
- display_error ("internal error find_on_path: NULL pointer for file", false, false);
- return 0;
- }
-
- if (!ext)
- {
- display_error ("internal error find_on_path: NULL pointer for default_extension", false, false);
- return 0;
- }
-
- const char *file;
- pathlike *search_paths;
- if (!strpbrk (in_file, ":/\\"))
- {
- file = in_file;
- search_paths = paths;
- }
- else
- {
- file = cygpath (in_file, NULL);
- search_paths = abspath;
- showall = false;
- }
-
- if (!file)
- {
- display_error ("internal error find_on_path: cygpath conversion failed for %s\n", in_file);
- return 0;
- }
-
- char *hasext = strrchr (file, '.');
- if (hasext && !strpbrk (hasext, "/\\"))
- ext = "";
-
- for (pathlike *pth = search_paths; pth->dir; pth++)
- if (!pth->issys || search_sys)
- {
- pth->check_existence (file, showall, verbose, rv, ext);
-
- if (checklinks)
- pth->check_existence (file, showall, verbose, rv, ext, LINK_EXTENSION);
-
- if (!*ext)
- continue;
-
- pth->check_existence (file, showall, verbose, rv);
- if (checklinks)
- pth->check_existence (file, showall, verbose, rv, LINK_EXTENSION);
- }
-
- return *rv ? rv : NULL;
-}
-
-#define DID_NEW 1
-#define DID_ACTIVE 2
-#define DID_INACTIVE 3
-
-struct Did
-{
- Did *next;
- char *file;
- int state;
-};
-static Did *did = 0;
-
-static Did *
-already_did (const char *file)
-{
- Did *d;
- for (d = did; d; d = d->next)
- if (strcasecmp (d->file, file) == 0)
- return d;
- d = (Did *) malloc (sizeof (Did));
- d->file = strdup (file);
- d->next = did;
- d->state = DID_NEW;
- did = d;
- return d;
-}
-
-struct Section
-{
- char name[8];
- int virtual_size;
- int virtual_address;
- int size_of_raw_data;
- int pointer_to_raw_data;
-};
-
-static int
-rva_to_offset (int rva, char *sections, int nsections, int *sz)
-{
- int i;
-
- if (sections == NULL)
- {
- display_error ("rva_to_offset: NULL passed for sections", true, false);
- return 0;
- }
-
- for (i = 0; i < nsections; i++)
- {
- Section *s = (Section *) (sections + i * 40);
-#if 0
- printf ("%08x < %08x < %08x ? %08x\n",
- s->virtual_address, rva,
- s->virtual_address + s->virtual_size, s->pointer_to_raw_data);
-#endif
- if (rva >= s->virtual_address
- && rva < s->virtual_address + s->virtual_size)
- {
- if (sz)
- *sz = s->virtual_address + s->virtual_size - rva;
- return rva - s->virtual_address + s->pointer_to_raw_data;
- }
- }
- return 0; /* punt */
-}
-
-struct ExpDirectory
-{
- int flags;
- int timestamp;
- short major_ver;
- short minor_ver;
- int name_rva;
-};
-
-struct ImpDirectory
-{
- unsigned characteristics;
- unsigned timestamp;
- unsigned forwarder_chain;
- unsigned name_rva;
- unsigned iat_rva;
-};
-
-static bool track_down (const char *file, const char *suffix, int lvl);
-
-#define CYGPREFIX (sizeof ("%%% Cygwin ") - 1)
-static void
-cygwin_info (HANDLE h)
-{
- char *buf, *bufend, *buf_start = NULL;
- const char *hello = " Cygwin DLL version info:\n";
- DWORD size = GetFileSize (h, NULL);
- DWORD n;
-
- if (size == 0xffffffff)
- return;
-
- buf_start = buf = (char *) calloc (1, size + 1);
- if (buf == NULL)
- {
- display_error ("cygwin_info: calloc()");
- return;
- }
-
- (void) SetFilePointer (h, 0, NULL, FILE_BEGIN);
- if (!ReadFile (h, buf, size, &n, NULL))
- {
- free (buf_start);
- return;
- }
-
- static char dummy[] = "\0\0\0\0\0\0\0";
- char *dll_major = dummy;
- bufend = buf + size;
- while (buf < bufend)
- if ((buf = (char *) memchr (buf, '%', bufend - buf)) == NULL)
- break;
- else if (strncmp ("%%% Cygwin ", buf, CYGPREFIX) != 0)
- buf++;
- else
- {
- char *p = strchr (buf += CYGPREFIX, '\n');
- if (!p)
- break;
- if (strncasecmp (buf, "dll major:", 10) == 0)
- {
- dll_major = buf + 11;
- continue;
- }
- char *s, pbuf[80];
- int len;
- len = 1 + p - buf;
- if (strncasecmp (buf, "dll minor:", 10) != 0)
- s = buf;
- else
- {
- char c = dll_major[1];
- dll_major[1] = '\0';
- int maj = atoi (dll_major);
- dll_major[1] = c;
- int min = atoi (dll_major + 1);
- sprintf (pbuf, "DLL version: %d.%d.%.*s", maj, min, len - 11,
- buf + 11);
- len = strlen (s = pbuf);
- }
- if (strncmp (s, "dll", 3) == 0)
- memcpy (s, "DLL", 3);
- else if (strncmp (s, "api", 3) == 0)
- memcpy (s, "API", 3);
- else if (islower (*s))
- *s = toupper (*s);
- fprintf (stdout, "%s %.*s", hello, len, s);
- hello = "";
- }
-
- if (!*hello)
- puts ("");
-
- free (buf_start);
- return;
-}
-
-static void
-dll_info (const char *path, HANDLE fh, int lvl, int recurse)
-{
- DWORD junk;
- int i;
- int pe_header_offset = get_dword (fh, 0x3c);
- if (GetLastError () != NO_ERROR)
- display_error ("get_dword");
- int opthdr_ofs = pe_header_offset + 4 + 20;
- unsigned short v[6];
-
- if (path == NULL)
- {
- display_error ("dll_info: NULL passed for path", true, false);
- return;
- }
-
- if (SetFilePointer (fh, opthdr_ofs + 40, 0, FILE_BEGIN) ==
- INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR)
- display_error ("dll_info: SetFilePointer()");
-
- if (!ReadFile (fh, &v, sizeof (v), &junk, 0))
- display_error ("dll_info: Readfile()");
-
- if (verbose)
- printf (" - os=%d.%d img=%d.%d sys=%d.%d\n",
- v[0], v[1], v[2], v[3], v[4], v[5]);
- else
- printf ("\n");
-
- int num_entries = get_dword (fh, opthdr_ofs + 92);
- if (GetLastError () != NO_ERROR)
- display_error ("get_dword");
- int export_rva = get_dword (fh, opthdr_ofs + 96);
- if (GetLastError () != NO_ERROR)
- display_error ("get_dword");
- int export_size = get_dword (fh, opthdr_ofs + 100);
- if (GetLastError () != NO_ERROR)
- display_error ("get_dword");
- int import_rva = get_dword (fh, opthdr_ofs + 104);
- if (GetLastError () != NO_ERROR)
- display_error ("get_dword");
- int import_size = get_dword (fh, opthdr_ofs + 108);
- if (GetLastError () != NO_ERROR)
- display_error ("get_dword");
-
- int nsections = get_word (fh, pe_header_offset + 4 + 2);
- if (nsections == -1)
- display_error ("get_word");
- char *sections = (char *) malloc (nsections * 40);
-
- if (SetFilePointer (fh, pe_header_offset + 4 + 20 +
- get_word (fh, pe_header_offset + 4 + 16), 0,
- FILE_BEGIN) == INVALID_SET_FILE_POINTER
- && GetLastError () != NO_ERROR)
- display_error ("dll_info: SetFilePointer()");
-
- if (!ReadFile (fh, sections, nsections * 40, &junk, 0))
- display_error ("dll_info: Readfile()");
-
- if (verbose && num_entries >= 1 && export_size > 0)
- {
- int expsz;
- int expbase = rva_to_offset (export_rva, sections, nsections, &expsz);
-
- if (expbase)
- {
- if (SetFilePointer (fh, expbase, 0, FILE_BEGIN) ==
- INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR)
- display_error ("dll_info: SetFilePointer()");
-
- unsigned char *exp = (unsigned char *) malloc (expsz);
-
- if (!ReadFile (fh, exp, expsz, &junk, 0))
- display_error ("dll_info: Readfile()");
-
- ExpDirectory *ed = (ExpDirectory *) exp;
- int ofs = ed->name_rva - export_rva;
- struct tm *tm = localtime ((const time_t *) &(ed->timestamp));
- if (tm->tm_year < 60)
- tm->tm_year += 2000;
- if (tm->tm_year < 200)
- tm->tm_year += 1900;
- printf ("%*c", lvl + 2, ' ');
- printf ("\"%s\" v%d.%d ts=", exp + ofs,
- ed->major_ver, ed->minor_ver);
- printf ("%d/%d/%d %d:%02d\n",
- tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
- tm->tm_hour, tm->tm_min);
- }
- }
-
- if (num_entries >= 2 && import_size > 0 && recurse)
- {
- int impsz;
- int impbase = rva_to_offset (import_rva, sections, nsections, &impsz);
- if (impbase)
- {
- if (SetFilePointer (fh, impbase, 0, FILE_BEGIN) ==
- INVALID_SET_FILE_POINTER && GetLastError () != NO_ERROR)
- display_error ("dll_info: SetFilePointer()");
-
- unsigned char *imp = (unsigned char *) malloc (impsz);
- if (imp == NULL)
- {
- display_error ("dll_info: malloc()");
- return;
- }
-
- if (!ReadFile (fh, imp, impsz, &junk, 0))
- display_error ("dll_info: Readfile()");
-
- ImpDirectory *id = (ImpDirectory *) imp;
- for (i = 0; id[i].name_rva; i++)
- {
- /* int ofs = id[i].name_rva - import_rva; */
- track_down ((char *) imp + id[i].name_rva - import_rva,
- (char *) ".dll", lvl + 2);
- }
- }
- }
- if (strstr (path, "\\cygwin1.dll"))
- cygwin_info (fh);
-}
-
-// Return true on success, false if error printed
-static bool
-track_down (const char *file, const char *suffix, int lvl)
-{
- if (file == NULL)
- {
- display_error ("track_down: NULL passed for file", true, false);
- return false;
- }
-
- if (suffix == NULL)
- {
- display_error ("track_down: NULL passed for suffix", false, false);
- return false;
- }
-
- const char *path = find_on_path (file, suffix, false, true);
- if (!path)
- {
- display_error ("track_down: could not find %s\n", file);
- return false;
- }
-
- Did *d = already_did (file);
- switch (d->state)
- {
- case DID_NEW:
- break;
- case DID_ACTIVE:
- if (verbose)
- {
- if (lvl)
- printf ("%*c", lvl, ' ');
- printf ("%s", path);
- printf (" (recursive)\n");
- }
- return true;
- case DID_INACTIVE:
- if (verbose)
- {
- if (lvl)
- printf ("%*c", lvl, ' ');
- printf ("%s", path);
- printf (" (already done)\n");
- }
- return true;
- default:
- break;
- }
-
- if (lvl)
- printf ("%*c", lvl, ' ');
-
- if (!path)
- {
- display_error ("file not found - '%s'\n", file);
- return false;
- }
-
- printf ("%s", path);
-
- HANDLE fh =
- CreateFile (path, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (fh == INVALID_HANDLE_VALUE)
- {
- display_error ("cannot open - '%s'\n", path);
- return false;
- }
-
- d->state = DID_ACTIVE;
-
- if (is_exe (fh))
- dll_info (path, fh, lvl, 1);
- else if (is_symlink (fh))
- display_error ("%s is a symlink instead of a DLL\n", path);
- else
- {
- int magic = get_word (fh, 0x0);
- if (magic == -1)
- display_error ("get_word");
- magic &= 0x00FFFFFF;
- display_error_fmt ("%s is not a DLL: magic number %x (%d) '%s'\n",
- path, magic, magic, (char *)&magic);
- }
-
- d->state = DID_INACTIVE;
- if (!CloseHandle (fh))
- display_error ("track_down: CloseHandle()");
- return true;
-}
-
-static void
-ls (char *f)
-{
- HANDLE h = CreateFile (f, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
- BY_HANDLE_FILE_INFORMATION info;
-
- if (!GetFileInformationByHandle (h, &info))
- display_error ("ls: GetFileInformationByHandle()");
-
- SYSTEMTIME systime;
-
- if (!FileTimeToSystemTime (&info.ftLastWriteTime, &systime))
- display_error ("ls: FileTimeToSystemTime()");
- printf ("%5dk %04d/%02d/%02d %s",
- (((int) info.nFileSizeLow) + 512) / 1024,
- systime.wYear, systime.wMonth, systime.wDay, f);
- dll_info (f, h, 16, 0);
- if (!CloseHandle (h))
- display_error ("ls: CloseHandle()");
-}
-
-/* Remove filename from 's' and return directory name without trailing
- backslash, or NULL if 's' doesn't seem to have a dirname. */
-static char *
-dirname (const char *s)
-{
- static char buf[MAX_PATH];
-
- if (!s)
- return NULL;
-
- strncpy (buf, s, MAX_PATH);
- buf[MAX_PATH - 1] = '\0'; // in case strlen(s) > MAX_PATH
- char *lastsep = strrchr (buf, '\\');
- if (!lastsep)
- return NULL; // no backslash -> no dirname
- else if (lastsep - buf <= 2 && buf[1] == ':')
- lastsep[1] = '\0'; // can't remove backslash of "x:\"
- else
- *lastsep = '\0';
- return buf;
-}
-
-// Find a real application on the path (possibly following symlinks)
-static const char *
-find_app_on_path (const char *app, bool showall = false)
-{
- const char *papp = find_on_path (app, ".exe", showall, false, true);
-
- HANDLE fh =
- CreateFile (papp, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
- NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (fh == INVALID_HANDLE_VALUE)
- return NULL;
-
- if (is_symlink (fh))
- {
- static char tmp[SYMLINK_MAX + 1];
- if (!readlink (fh, tmp, SYMLINK_MAX))
- display_error("readlink failed");
-
- /* Resolve the linkname relative to the directory of the link. */
- char *ptr = cygpath_rel (dirname (papp), tmp, NULL);
- printf (" -> %s\n", ptr);
- if (!strchr (ptr, '\\'))
- {
- char *lastsep;
- strncpy (tmp, cygpath (papp, NULL), SYMLINK_MAX);
- lastsep = strrchr (tmp, '\\');
- strncpy (lastsep+1, ptr, SYMLINK_MAX - (lastsep-tmp));
- ptr = tmp;
- }
- if (!CloseHandle (fh))
- display_error ("find_app_on_path: CloseHandle()");
- /* FIXME: We leak the ptr returned by cygpath() here which is a
- malloc()d string. */
- return find_app_on_path (ptr, showall);
- }
-
- if (!CloseHandle (fh))
- display_error ("find_app_on_path: CloseHandle()");
- return papp;
-}
-
-// Return true on success, false if error printed
-static bool
-cygcheck (const char *app)
-{
- const char *papp = find_app_on_path (app, 1);
- if (!papp)
- {
- display_error ("could not find '%s'\n", app);
- return false;
- }
-
- char *s;
- char *sep = strpbrk (papp, ":/\\");
- if (!sep)
- {
- static char dot[] = ".";
- s = dot;
- }
- else
- {
- int n = sep - papp;
- s = (char *) malloc (n + 2);
- memcpy ((char *) s, papp, n);
- strcpy (s + n, "\\");
- }
-
- paths[0].dir = s;
- did = NULL;
- return track_down (papp, ".exe", 0);
-}
-
-struct RegInfo
-{
- RegInfo *prev;
- char *name;
- HKEY key;
-};
-
-static void
-show_reg (RegInfo * ri, int nest)
-{
- if (!ri)
- return;
- show_reg (ri->prev, 1);
- if (nest)
- printf ("%s\\", ri->name);
- else
- printf ("%s\n", ri->name);
-}
-
-static void
-scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
-{
- RegInfo ri;
- ri.prev = prev;
- ri.name = name;
- ri.key = hKey;
-
- char *cp;
- for (cp = name; *cp; cp++)
- if (strncasecmp (cp, "cygnus", 6) == 0)
- cygnus = 1;
-
- DWORD num_subkeys, max_subkey_len, num_values;
- DWORD max_value_len, max_valdata_len, i;
- if (RegQueryInfoKey (hKey, 0, 0, 0, &num_subkeys, &max_subkey_len, 0,
- &num_values, &max_value_len, &max_valdata_len, 0, 0)
- != ERROR_SUCCESS)
- {
-#if 0
- char tmp[400];
- FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError (),
- MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), tmp, 400, 0);
- printf ("RegQueryInfoKey: %s\n", tmp);
-#endif
- return;
- }
-
- if (cygnus)
- {
- show_reg (&ri, 0);
-
- char *value_name = (char *) malloc (max_value_len + 1);
- if (value_name == NULL)
- {
- display_error ("scan_registry: malloc()");
- return;
- }
-
- char *value_data = (char *) malloc (max_valdata_len + 1);
- if (value_data == NULL)
- {
- display_error ("scan_registry: malloc()");
- return;
- }
-
- for (i = 0; i < num_values; i++)
- {
- DWORD dlen = max_valdata_len + 1;
- DWORD nlen = max_value_len + 1;
- DWORD type;
- RegEnumValue (hKey, i, value_name, &nlen, 0,
- &type, (BYTE *) value_data, &dlen);
- {
- printf (" %s = ", i ? value_name : "(default)");
- switch (type)
- {
- case REG_DWORD:
- printf ("0x%08x\n", *(unsigned *) value_data);
- break;
- case REG_EXPAND_SZ:
- case REG_SZ:
- printf ("'%s'\n", value_data);
- break;
- default:
- printf ("(unsupported type)\n");
- break;
- }
- }
- }
- free (value_name);
- free (value_data);
- }
-
- char *subkey_name = (char *) malloc (max_subkey_len + 1);
- for (i = 0; i < num_subkeys; i++)
- {
- if (RegEnumKey (hKey, i, subkey_name, max_subkey_len + 1) ==
- ERROR_SUCCESS)
- {
- HKEY sKey;
- if (RegOpenKeyEx (hKey, subkey_name, 0, KEY_READ, &sKey)
- == ERROR_SUCCESS)
- {
- scan_registry (&ri, sKey, subkey_name, cygnus);
- if (RegCloseKey (sKey) != ERROR_SUCCESS)
- display_error ("scan_registry: RegCloseKey()");
- }
- }
- }
- free (subkey_name);
-}
-
-void
-pretty_id (const char *s, char *cygwin, size_t cyglen)
-{
- char *groups[16384];
-
- strcpy (cygwin + cyglen++, " ");
- strcpy (cygwin + cyglen, s);
- putenv (cygwin);
-
- char *id = cygpath ("/bin/id.exe", NULL);
- for (char *p = id; (p = strchr (p, '/')); p++)
- *p = '\\';
-
- if (access (id, X_OK))
- {
- fprintf (stderr, "'id' program not found\n");
- return;
- }
-
- FILE *f = popen (id, "rt");
-
- char buf[16384];
- buf[0] = '\0';
- fgets (buf, sizeof (buf), f);
- pclose (f);
- char *uid = strtok (buf, ")");
- if (uid)
- uid += strlen ("uid=");
- else
- {
- fprintf (stderr, "garbled output from 'id' command - no uid= found\n");
- return;
- }
- char *gid = strtok (NULL, ")");
- if (gid)
- gid += strlen ("gid=") + 1;
- else
- {
- fprintf (stderr, "garbled output from 'id' command - no gid= found\n");
- return;
- }
-
- char **ng = groups - 1;
- size_t len_uid = strlen ("UID: )") + strlen (uid);
- size_t len_gid = strlen ("GID: )") + strlen (gid);
- *++ng = groups[0] = (char *) alloca (len_uid + 1);
- *++ng = groups[1] = (char *) alloca (len_gid + 1);
- sprintf (groups[0], "UID: %s)", uid);
- sprintf (groups[1], "GID: %s)", gid);
- size_t sz = max (len_uid, len_gid);
- while ((*++ng = strtok (NULL, ",")))
- {
- char *p = strchr (*ng, '\n');
- if (p)
- *p = '\0';
- if (ng == groups + 2)
- *ng += strlen (" groups=");
- size_t len = strlen (*ng);
- if (sz < len)
- sz = len;
- }
- ng--;
-
- printf ("\nOutput from %s (%s)\n", id, s);
- int n = 80 / (int) ++sz;
- int i = n > 2 ? n - 2 : 0;
- sz = -sz;
- for (char **g = groups; g <= ng; g++)
- if ((g != ng) && (++i < n))
- printf ("%*s", sz, *g);
- else
- {
- puts (*g);
- i = 0;
- }
-}
-
-/* This dumps information about each installed cygwin service, if cygrunsrv
- is available. */
-void
-dump_sysinfo_services ()
-{
- char buf[1024];
- char buf2[1024];
- FILE *f;
- bool no_services = false;
-
- if (givehelp)
- printf ("\nChecking for any Cygwin services... %s\n\n",
- verbose ? "" : "(use -v for more detail)");
- else
- fputc ('\n', stdout);
-
- /* find the location of cygrunsrv.exe */
- char *cygrunsrv = cygpath ("/bin/cygrunsrv.exe", NULL);
- for (char *p = cygrunsrv; (p = strchr (p, '/')); p++)
- *p = '\\';
-
- if (access (cygrunsrv, X_OK))
- {
- puts ("Can't find the cygrunsrv utility, skipping services check.\n");
- return;
- }
-
- /* check for a recent cygrunsrv */
- snprintf (buf, sizeof (buf), "%s --version", cygrunsrv);
- if ((f = popen (buf, "rt")) == NULL)
- {
- printf ("Failed to execute '%s', skipping services check.\n", buf);
- return;
- }
- int maj, min;
- int ret = fscanf (f, "cygrunsrv V%u.%u", &maj, &min);
- if (ferror (f) || feof (f) || ret == EOF || maj < 1 || min < 10)
- {
- puts ("The version of cygrunsrv installed is too old to dump service info.\n");
- return;
- }
- fclose (f);
-
- /* For verbose mode, just run cygrunsrv --list --verbose and copy output
- verbatim; otherwise run cygrunsrv --list and then cygrunsrv --query for
- each service. */
- snprintf (buf, sizeof (buf), (verbose ? "%s --list --verbose" : "%s --list"),
- cygrunsrv);
- if ((f = popen (buf, "rt")) == NULL)
- {
- printf ("Failed to execute '%s', skipping services check.\n", buf);
- return;
- }
-
- if (verbose)
- {
- /* copy output to stdout */
- size_t nchars = 0;
- while (!feof (f) && !ferror (f))
- nchars += fwrite ((void *) buf, 1,
- fread ((void *) buf, 1, sizeof (buf), f), stdout);
-
- /* cygrunsrv outputs nothing if there are no cygwin services found */
- if (nchars < 1)
- no_services = true;
- pclose (f);
- }
- else
- {
- /* read the output of --list, and then run --query for each service */
- size_t nchars = fread ((void *) buf, 1, sizeof (buf) - 1, f);
- buf[nchars] = 0;
- pclose (f);
-
- if (nchars > 0)
- for (char *srv = strtok (buf, "\n"); srv; srv = strtok (NULL, "\n"))
- {
- snprintf (buf2, sizeof (buf2), "%s --query %s", cygrunsrv, srv);
- if ((f = popen (buf2, "rt")) == NULL)
- {
- printf ("Failed to execute '%s', skipping services check.\n", buf2);
- return;
- }
-
- /* copy output to stdout */
- while (!feof (f) && !ferror (f))
- fwrite ((void *) buf2, 1,
- fread ((void *) buf2, 1, sizeof (buf2), f), stdout);
- pclose (f);
- }
- else
- no_services = true;
- }
-
- /* inform the user if nothing found */
- if (no_services)
- puts ("No Cygwin services found.\n");
-}
-
-static void
-dump_sysinfo ()
-{
- int i, j;
- char tmp[4000];
- time_t now;
- char *found_cygwin_dll;
- bool is_nt = false;
- bool more_info = true;
- char osname[80];
-
- printf ("\nCygwin Configuration Diagnostics\n");
- time (&now);
- printf ("Current System Time: %s\n", ctime (&now));
-
- OSVERSIONINFOEX osversion;
- osversion.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEX);
- if (!GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&osversion)))
- {
- more_info = false;
- osversion.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- if (!GetVersionEx (reinterpret_cast<LPOSVERSIONINFO>(&osversion)))
- display_error ("dump_sysinfo: GetVersionEx()");
- }
-
- HMODULE k32 = LoadLibrary ("kernel32.dll");
-
- switch (osversion.dwPlatformId)
- {
- case VER_PLATFORM_WIN32s:
- strcpy (osname, "32s (not supported)");
- break;
- case VER_PLATFORM_WIN32_WINDOWS:
- strcpy (osname, "95/98/Me (not supported)");
- break;
- case VER_PLATFORM_WIN32_NT:
- is_nt = true;
- if (osversion.dwMajorVersion == 6)
- {
- BOOL (WINAPI *GetProductInfo) (DWORD, DWORD, DWORD, DWORD, PDWORD) =
- (BOOL (WINAPI *)(DWORD, DWORD, DWORD, DWORD, PDWORD))
- GetProcAddress (k32, "GetProductInfo");
- if (osversion.wProductType == VER_NT_WORKSTATION)
- strcpy (osname, "Vista");
- else
- strcpy (osname, "2008");
- DWORD prod;
- if (GetProductInfo (osversion.dwMajorVersion,
- osversion.dwMinorVersion,
- osversion.wServicePackMajor,
- osversion.wServicePackMinor,
- &prod))
- {
-#define PRODUCT_UNLICENSED 0xabcdabcd
-#define PRODUCT_SMALLBUSINESS_SERVER_PREMIUM 0x19
- const char *products[] =
- {
- "",
- " Ultimate Edition",
- " Home Basic Edition",
- " Home Premium Edition",
- " Enterprise Edition",
- " Home Basic N Edition",
- " Business Edition",
- " Server Standard Edition",
- " Server Datacenter Edition",
- " Small Business Server",
- " Server Enterprise Edition",
- " Starter Edition",
- " Server Datacenter Edition Core",
- " Server Standard Edition Core",
- " Server Enterprise Edition Core",
- " Server Enterprise Edition for Itanium-based Systems",
- " Business N Edition",
- " Web Server Edition",
- " Cluster Server Edition",
- " Home Server Edition",
- " Storage Server Express Edition",
- " Storage Server Standard Edition",
- " Storage Server Workgroup Edition",
- " Storage Server Enterprise Edition",
- " Server for Small Business Edition",
- " Small Business Server Premium Edition"
- };
- if (prod == PRODUCT_UNLICENSED)
- strcat (osname, "Unlicensed");
- else if (prod > PRODUCT_SMALLBUSINESS_SERVER_PREMIUM)
- strcat (osname, "");
- else
- strcat (osname, products[prod]);
- }
- else
- {
- }
- }
- else if (osversion.dwMajorVersion == 5)
- {
- if (osversion.dwMinorVersion == 0)
- {
- strcpy (osname, "2000");
- if (osversion.wProductType == VER_NT_WORKSTATION)
- strcat (osname, " Professional");
- else if (osversion.wSuiteMask & VER_SUITE_DATACENTER)
- strcat (osname, " Datacenter Server");
- else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE)
- strcat (osname, " Advanced Server");
- else
- strcat (osname, " Server");
- }
- else if (osversion.dwMinorVersion == 1)
- {
- strcpy (osname, "XP");
- if (GetSystemMetrics (SM_MEDIACENTER))
- strcat (osname, " Media Center Edition");
- else if (GetSystemMetrics (SM_TABLETPC))
- strcat (osname, " Tablet PC Edition");
- else if (GetSystemMetrics (SM_STARTER))
- strcat (osname, " Starter Edition");
- else if (osversion.wSuiteMask & VER_SUITE_PERSONAL)
- strcat (osname, " Home Edition");
- else
- strcat (osname, " Professional");
- }
- else if (osversion.dwMinorVersion == 2)
- {
- strcpy (osname, "2003 Server");
- if (GetSystemMetrics (SM_SERVERR2))
- strcat (osname, " R2");
- if (osversion.wSuiteMask & VER_SUITE_BLADE)
- strcat (osname, " Web Edition");
- else if (osversion.wSuiteMask & VER_SUITE_DATACENTER)
- strcat (osname, " Datacenter Edition");
- else if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE)
- strcat (osname, " Enterprise Edition");
- else if (osversion.wSuiteMask & VER_SUITE_COMPUTE_SERVER)
- strcat (osname, " Compute Cluster Edition");
- }
- }
- else if (osversion.dwMajorVersion == 4)
- {
- strcpy (osname, "NT 4");
- if (more_info)
- {
- if (osversion.wProductType == VER_NT_WORKSTATION)
- strcat (osname, " Workstation");
- else
- {
- strcat (osname, " Server");
- if (osversion.wSuiteMask & VER_SUITE_ENTERPRISE)
- strcat (osname, " Enterprise Edition");
- }
- }
- }
- else
- strcpy (osname, "NT");
- break;
- default:
- strcpy (osname, "??");
- break;
- }
- printf ("Windows %s Ver %lu.%lu Build %lu %s\n", osname,
- osversion.dwMajorVersion, osversion.dwMinorVersion,
- osversion.dwPlatformId == VER_PLATFORM_WIN32_NT ?
- osversion.dwBuildNumber : (osversion.dwBuildNumber & 0xffff),
- osversion.dwPlatformId == VER_PLATFORM_WIN32_NT ?
- osversion.szCSDVersion : "");
-
- if (osversion.dwPlatformId == VER_PLATFORM_WIN32s
- || osversion.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
- exit (EXIT_FAILURE);
-
- BOOL (WINAPI *wow64_func) (HANDLE, PBOOL) = (BOOL (WINAPI *) (HANDLE, PBOOL))
- GetProcAddress (k32, "IsWow64Process");
- BOOL is_wow64 = FALSE;
- if (wow64_func && wow64_func (GetCurrentProcess (), &is_wow64) && is_wow64)
- {
- void (WINAPI *nativinfo) (LPSYSTEM_INFO) = (void (WINAPI *)
- (LPSYSTEM_INFO)) GetProcAddress (k32, "GetNativeSystemInfo");
- SYSTEM_INFO natinfo;
- nativinfo (&natinfo);
- fputs ("\nRunning under WOW64 on ", stdout);
- switch (natinfo.wProcessorArchitecture)
- {
- case PROCESSOR_ARCHITECTURE_IA64:
- puts ("IA64");
- break;
- case PROCESSOR_ARCHITECTURE_AMD64:
- puts ("AMD64");
- break;
- default:
- puts("??");
- break;
- }
- }
-
- if (GetSystemMetrics (SM_REMOTESESSION))
- printf ("\nRunning in Terminal Service session\n");
-
- printf ("\nPath:");
- char *s = getenv ("PATH"), *e;
- if (!s)
- puts ("");
- else
- {
- char sep = strchr (s, ';') ? ';' : ':';
- int count_path_items = 0;
- while (1)
- {
- for (e = s; *e && *e != sep; e++);
- if (e-s)
- printf ("\t%.*s\n", e - s, s);
- else
- puts ("\t.");
- count_path_items++;
- if (!*e)
- break;
- s = e + 1;
- }
- }
-
- fflush (stdout);
-
- char *cygwin = getenv ("CYGWIN");
- if (cygwin)
- cygwin -= strlen ("CYGWIN=");
- else
- cygwin = const_cast <char *> ("CYGWIN=");
- size_t cyglen = strlen (cygwin);
- cygwin = strcpy ((char *) malloc (cyglen + sizeof (" nontsec")), cygwin);
- pretty_id ("nontsec", cygwin, cyglen);
- pretty_id ("ntsec", cygwin, cyglen);
- cygwin[cyglen] = 0;
- putenv (cygwin);
-
- if (!GetSystemDirectory (tmp, 4000))
- display_error ("dump_sysinfo: GetSystemDirectory()");
- printf ("\nSysDir: %s\n", tmp);
-
- GetWindowsDirectory (tmp, 4000);
- printf ("WinDir: %s\n\n", tmp);
-
-
- if (givehelp)
- printf ("Here's some environment variables that may affect cygwin:\n");
- for (i = 0; environ[i]; i++)
- {
- char *eq = strchr (environ[i], '=');
- if (!eq)
- continue;
- /* int len = eq - environ[i]; */
- for (j = 0; known_env_vars[j]; j++)
- {
- *eq = 0;
- if (strcmp (environ[i], "PATH") == 0)
- continue; /* we handle this one specially */
- if (strcasecmp (environ[i], known_env_vars[j]) == 0)
- printf ("%s = '%s'\n", environ[i], eq + 1);
- *eq = '=';
- }
- }
- printf ("\n");
-
- if (verbose)
- {
- if (givehelp)
- printf ("Here's the rest of your environment variables:\n");
- for (i = 0; environ[i]; i++)
- {
- int found = 0;
- char *eq = strchr (environ[i], '=');
- if (!eq)
- continue;
- /* int len = eq - environ[i]; */
- for (j = 0; known_env_vars[j]; j++)
- {
- *eq = 0;
- if (strcasecmp (environ[i], known_env_vars[j]) == 0)
- found = 1;
- *eq = '=';
- }
- if (!found)
- {
- *eq = 0;
- printf ("%s = '%s'\n", environ[i], eq + 1);
- *eq = '=';
- }
- }
- printf ("\n");
- }
-
- if (registry)
- {
- if (givehelp)
- printf ("Scanning registry for keys with 'Cygnus' in them...\n");
-#if 0
- /* big and not generally useful */
- scan_registry (0, HKEY_CLASSES_ROOT, (char *) "HKEY_CLASSES_ROOT", 0);
-#endif
- scan_registry (0, HKEY_CURRENT_CONFIG,
- (char *) "HKEY_CURRENT_CONFIG", 0);
- scan_registry (0, HKEY_CURRENT_USER, (char *) "HKEY_CURRENT_USER", 0);
- scan_registry (0, HKEY_LOCAL_MACHINE, (char *) "HKEY_LOCAL_MACHINE", 0);
-#if 0
- /* the parts we need are duplicated in HKEY_CURRENT_USER anyway */
- scan_registry (0, HKEY_USERS, (char *) "HKEY_USERS", 0);
-#endif
- printf ("\n");
- }
- else
- printf ("Use '-r' to scan registry\n\n");
-
- if (givehelp)
- {
- printf ("Listing available drives...\n");
- printf ("Drv Type Size Used Flags Name\n");
- }
- int prev_mode =
- SetErrorMode (SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
- int drivemask = GetLogicalDrives ();
-
- BOOL (WINAPI * gdfse) (LPCSTR, long long *, long long *, long long *) =
- (BOOL (WINAPI *) (LPCSTR, long long *, long long *, long long *))
- GetProcAddress (k32, "GetDiskFreeSpaceExA");
-
- for (i = 0; i < 26; i++)
- {
- if (!(drivemask & (1 << i)))
- continue;
- char drive[4], name[200], fsname[200];
- DWORD serno = 0, maxnamelen = 0, flags = 0;
- name[0] = name[0] = fsname[0] = 0;
- sprintf (drive, "%c:\\", i + 'a');
- /* Report all errors, except if the Volume is ERROR_NOT_READY.
- ERROR_NOT_READY is returned when removeable media drives are empty
- (CD, floppy, etc.) */
- if (!GetVolumeInformation (drive, name, sizeof (name), &serno,
- &maxnamelen, &flags, fsname,
- sizeof (fsname))
- && GetLastError () != ERROR_NOT_READY)
- {
-# define FMT "dump_sysinfo: GetVolumeInformation() for drive %c:"
- char buf[sizeof (FMT)];
- sprintf (buf, FMT, 'A' + i);
- display_error (buf);
-# undef FMT
- }
-
- int dtype = GetDriveType (drive);
- char drive_type[4] = "unk";
- switch (dtype)
- {
- case DRIVE_REMOVABLE:
- strcpy (drive_type, "fd ");
- break;
- case DRIVE_FIXED:
- strcpy (drive_type, "hd ");
- break;
- case DRIVE_REMOTE:
- strcpy (drive_type, "net");
- break;
- case DRIVE_CDROM:
- strcpy (drive_type, "cd ");
- break;
- case DRIVE_RAMDISK:
- strcpy (drive_type, "ram");
- break;
- default:
- strcpy (drive_type, "unk");
- }
-
- long capacity_mb = -1;
- int percent_full = -1;
-
- long long free_me = 0ULL, free_bytes = 0ULL, total_bytes = 1ULL;
- if (gdfse != NULL && gdfse (drive, &free_me, &total_bytes, &free_bytes))
- {
- capacity_mb = total_bytes / (1024L * 1024L);
- percent_full = 100 - (int) ((100.0 * free_me) / total_bytes);
- }
- else
- {
- DWORD spc = 0, bps = 0, fc = 0, tc = 1;
- if (GetDiskFreeSpace (drive, &spc, &bps, &fc, &tc))
- {
- capacity_mb = (spc * bps * tc) / (1024 * 1024);
- percent_full = 100 - (int) ((100.0 * fc) / tc);
- }
- }
-
- printf ("%.2s %s %-6s ", drive, drive_type, fsname);
- if (capacity_mb >= 0)
- printf ("%7dMb %3d%% ", (int) capacity_mb, (int) percent_full);
- else
- printf (" N/A N/A ");
- printf ("%s %s %s %s %s %s %s\n",
- flags & FS_CASE_IS_PRESERVED ? "CP" : " ",
- flags & FS_CASE_SENSITIVE ? "CS" : " ",
- flags & FS_UNICODE_STORED_ON_DISK ? "UN" : " ",
- flags & FS_PERSISTENT_ACLS ? "PA" : " ",
- flags & FS_FILE_COMPRESSION ? "FC" : " ",
- flags & FS_VOL_IS_COMPRESSED ? "VC" : " ",
-#if 0
- flags & FILE_SUPPORTS_ENCRYPTION ? "EN" : " ",
- flags & FILE_SUPPORTS_OBJECT_IDS ? "OI" : " ",
- flags & FILE_SUPPORTS_REPARSE_POINTS ? "RP" : " ",
- flags & FILE_SUPPORTS_SPARSE_FILES ? "SP" : " ",
- flags & FILE_VOLUME_QUOTAS ? "QU" : " ",
-#endif
- name);
- }
-
- if (!FreeLibrary (k32))
- display_error ("dump_sysinfo: FreeLibrary()");
- SetErrorMode (prev_mode);
- if (givehelp)
- {
- puts ("\n"
- "fd = floppy, hd = hard drive, cd = CD-ROM\n"
- "net= Network Share, ram= RAM drive, unk= Unknown\n"
- "CP = Case Preserving, CS = Case Sensitive, UN = Unicode\n"
- "PA = Persistent ACLS, FC = File Compression, VC = Volume Compression");
- }
- printf ("\n");
-
- unsigned ml_fsname = 4, ml_dir = 7, ml_type = 6;
- bool ml_trailing = false;
-
- struct mntent *mnt;
- setmntent (0, 0);
- while ((mnt = getmntent (0)))
- {
- unsigned n = (int) strlen (mnt->mnt_fsname);
- ml_trailing |= (n > 1 && strchr ("\\/", mnt->mnt_fsname[n - 1]));
- if (ml_fsname < n)
- ml_fsname = n;
- n = (int) strlen (mnt->mnt_dir);
- ml_trailing |= (n > 1 && strchr ("\\/", mnt->mnt_dir[n - 1]));
- if (ml_dir < n)
- ml_dir = n;
- }
-
- if (ml_trailing)
- puts ("Warning: Mount entries should not have a trailing (back)slash\n");
-
- if (givehelp)
- {
- printf
- ("Mount entries: these map POSIX directories to your NT drives.\n");
- printf ("%-*s %-*s %-*s %s\n", ml_fsname, "-NT-", ml_dir, "-POSIX-",
- ml_type, "-Type-", "-Flags-");
- }
-
- setmntent (0, 0);
- while ((mnt = getmntent (0)))
- {
- printf ("%-*s %-*s %-*s %s\n",
- ml_fsname, mnt->mnt_fsname,
- ml_dir, mnt->mnt_dir, ml_type, mnt->mnt_type, mnt->mnt_opts);
- }
- printf ("\n");
-
- if (givehelp)
- printf
- ("Looking to see where common programs can be found, if at all...\n");
- for (i = 0; common_apps[i].name; i++)
- if (!find_app_on_path ((char *) common_apps[i].name, 1))
- {
- if (common_apps[i].missing_is_good)
- printf ("Not Found: %s (good!)\n", common_apps[i].name);
- else
- printf ("Not Found: %s\n", common_apps[i].name);
- }
- printf ("\n");
-
- if (givehelp)
- printf ("Looking for various Cygwin DLLs... (-v gives version info)\n");
- int cygwin_dll_count = 0;
- char cygdll_path[32768];
- for (pathlike *pth = paths; pth->dir; pth++)
- {
- WIN32_FIND_DATA ffinfo;
- sprintf (tmp, "%s*.*", pth->dir);
- HANDLE ff = FindFirstFile (tmp, &ffinfo);
- int found = (ff != INVALID_HANDLE_VALUE);
- found_cygwin_dll = NULL;
- while (found)
- {
- char *f = ffinfo.cFileName;
- if (strcasecmp (f + strlen (f) - 4, ".dll") == 0)
- {
- if (strncasecmp (f, "cyg", 3) == 0)
- {
- sprintf (tmp, "%s%s", pth->dir, f);
- if (strcasecmp (f, "cygwin1.dll") == 0)
- {
- if (!cygwin_dll_count)
- strcpy (cygdll_path, pth->dir);
- if (!cygwin_dll_count
- || strcasecmp (cygdll_path, pth->dir) != 0)
- cygwin_dll_count++;
- found_cygwin_dll = strdup (tmp);
- }
- else
- ls (tmp);
- }
- }
- found = FindNextFile (ff, &ffinfo);
- }
- if (found_cygwin_dll)
- {
- ls (found_cygwin_dll);
- free (found_cygwin_dll);
- }
-
- FindClose (ff);
- }
- if (cygwin_dll_count > 1)
- puts ("Warning: There are multiple cygwin1.dlls on your path");
- if (!cygwin_dll_count)
- puts ("Warning: cygwin1.dll not found on your path");
-
- dump_dodgy_apps (verbose);
-
- if (is_nt)
- dump_sysinfo_services ();
-}
-
-static int
-check_keys ()
-{
- HANDLE h = CreateFileA ("CONIN$", GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
-
- if (h == INVALID_HANDLE_VALUE || h == NULL)
- return (display_error ("check_keys: Opening CONIN$"));
-
- DWORD mode;
-
- if (!GetConsoleMode (h, &mode))
- display_error ("check_keys: GetConsoleMode()");
- else
- {
- mode &= ~ENABLE_PROCESSED_INPUT;
- if (!SetConsoleMode (h, mode))
- display_error ("check_keys: SetConsoleMode()");
- }
-
- fputs ("\nThis key check works only in a console window,", stderr);
- fputs (" _NOT_ in a terminal session!\n", stderr);
- fputs ("Abort with Ctrl+C if in a terminal session.\n\n", stderr);
- fputs ("Press 'q' to exit.\n", stderr);
-
- INPUT_RECORD in, prev_in;
-
- // Drop first <RETURN> key
- ReadConsoleInput (h, &in, 1, &mode);
-
- memset (&in, 0, sizeof in);
-
- do
- {
- prev_in = in;
- if (!ReadConsoleInput (h, &in, 1, &mode))
- display_error ("check_keys: ReadConsoleInput()");
-
- if (!memcmp (&in, &prev_in, sizeof in))
- continue;
-
- switch (in.EventType)
- {
- case KEY_EVENT:
- printf ("%s %ux VK: 0x%02x VS: 0x%02x A: 0x%02x CTRL: ",
- in.Event.KeyEvent.bKeyDown ? "Pressed " : "Released",
- in.Event.KeyEvent.wRepeatCount,
- in.Event.KeyEvent.wVirtualKeyCode,
- in.Event.KeyEvent.wVirtualScanCode,
- (unsigned char) in.Event.KeyEvent.uChar.AsciiChar);
- fputs (in.Event.KeyEvent.dwControlKeyState & CAPSLOCK_ON ?
- "CL " : "-- ", stdout);
- fputs (in.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY ?
- "EK " : "-- ", stdout);
- fputs (in.Event.KeyEvent.dwControlKeyState & LEFT_ALT_PRESSED ?
- "LA " : "-- ", stdout);
- fputs (in.Event.KeyEvent.dwControlKeyState & LEFT_CTRL_PRESSED ?
- "LC " : "-- ", stdout);
- fputs (in.Event.KeyEvent.dwControlKeyState & NUMLOCK_ON ?
- "NL " : "-- ", stdout);
- fputs (in.Event.KeyEvent.dwControlKeyState & RIGHT_ALT_PRESSED ?
- "RA " : "-- ", stdout);
- fputs (in.Event.KeyEvent.dwControlKeyState & RIGHT_CTRL_PRESSED ?
- "RC " : "-- ", stdout);
- fputs (in.Event.KeyEvent.dwControlKeyState & SCROLLLOCK_ON ?
- "SL " : "-- ", stdout);
- fputs (in.Event.KeyEvent.dwControlKeyState & SHIFT_PRESSED ?
- "SH " : "-- ", stdout);
- fputc ('\n', stdout);
- break;
-
- default:
- break;
- }
- }
- while (in.EventType != KEY_EVENT ||
- in.Event.KeyEvent.bKeyDown != FALSE ||
- in.Event.KeyEvent.uChar.AsciiChar != 'q');
-
- CloseHandle (h);
- return 0;
-}
-
-/* RFC1738 says that these do not need to be escaped. */
-static const char safe_chars[] = "$-_.+!*'(),";
-
-/* the URL to query. */
-static const char base_url[] =
- "http://cygwin.com/cgi-bin2/package-grep.cgi?text=1&grep=";
-
-/* Queries Cygwin web site for packages containing files matching a regexp.
- Return value is 1 if there was a problem, otherwise 0. */
-static int
-package_grep (char *search)
-{
- char buf[1024];
-
- /* Attempt to dynamically load the necessary WinInet API functions so that
- cygcheck can still function on older systems without IE. */
- HMODULE hWinInet;
- if (!(hWinInet = LoadLibrary ("wininet.dll")))
- {
- fputs ("Unable to locate WININET.DLL. This feature requires Microsoft "
- "Internet Explorer v3 or later to function.\n", stderr);
- return 1;
- }
-
- /* InternetCloseHandle is used outside this function so it is declared
- global. The rest of these functions are only used here, so declare them
- and call GetProcAddress for each of them with the following macro. */
-
- pInternetCloseHandle = (BOOL (WINAPI *) (HINTERNET))
- GetProcAddress (hWinInet, "InternetCloseHandle");
-#define make_func_pointer(name, ret, args) ret (WINAPI * p##name) args = \
- (ret (WINAPI *) args) GetProcAddress (hWinInet, #name);
- make_func_pointer (InternetAttemptConnect, DWORD, (DWORD));
- make_func_pointer (InternetOpenA, HINTERNET, (LPCSTR, DWORD, LPCSTR, LPCSTR,
- DWORD));
- make_func_pointer (InternetOpenUrlA, HINTERNET, (HINTERNET, LPCSTR, LPCSTR,
- DWORD, DWORD, DWORD));
- make_func_pointer (InternetReadFile, BOOL, (HINTERNET, PVOID, DWORD, PDWORD));
- make_func_pointer (HttpQueryInfoA, BOOL, (HINTERNET, DWORD, PVOID, PDWORD,
- PDWORD));
-#undef make_func_pointer
-
- if(!pInternetCloseHandle || !pInternetAttemptConnect || !pInternetOpenA
- || !pInternetOpenUrlA || !pInternetReadFile || !pHttpQueryInfoA)
- {
- fputs ("Unable to load one or more functions from WININET.DLL. This "
- "feature requires Microsoft Internet Explorer v3 or later to "
- "function.\n", stderr);
- return 1;
- }
-
- /* construct the actual URL by escaping */
- char *url = (char *) alloca (sizeof (base_url) + strlen (search) * 3);
- strcpy (url, base_url);
-
- char *dest;
- for (dest = &url[sizeof (base_url) - 1]; *search; search++)
- {
- if (isalnum (*search)
- || memchr (safe_chars, *search, sizeof (safe_chars) - 1))
- {
- *dest++ = *search;
- }
- else
- {
- *dest++ = '%';
- sprintf (dest, "%02x", (unsigned char) *search);
- dest += 2;
- }
- }
- *dest = 0;
-
- /* Connect to the net and open the URL. */
- if (pInternetAttemptConnect (0) != ERROR_SUCCESS)
- {
- fputs ("An internet connection is required for this function.\n", stderr);
- return 1;
- }
-
- /* Initialize WinInet and attempt to fetch our URL. */
- HINTERNET hi = NULL, hurl = NULL;
- if (!(hi = pInternetOpenA ("cygcheck", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0)))
- return display_internet_error ("InternetOpen() failed", NULL);
-
- if (!(hurl = pInternetOpenUrlA (hi, url, NULL, 0, 0, 0)))
- return display_internet_error ("unable to contact cygwin.com site, "
- "InternetOpenUrl() failed", hi, NULL);
-
- /* Check the HTTP response code. */
- DWORD rc = 0, rc_s = sizeof (DWORD);
- if (!pHttpQueryInfoA (hurl, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER,
- (void *) &rc, &rc_s, NULL))
- return display_internet_error ("HttpQueryInfo() failed", hurl, hi, NULL);
-
- if (rc != HTTP_STATUS_OK)
- {
- sprintf (buf, "error retrieving results from cygwin.com site, "
- "HTTP status code %lu", rc);
- return display_internet_error (buf, hurl, hi, NULL);
- }
-
- /* Fetch result and print to stdout. */
- DWORD numread;
- do
- {
- if (!pInternetReadFile (hurl, (void *) buf, sizeof (buf), &numread))
- return display_internet_error ("InternetReadFile failed", hurl, hi, NULL);
- if (numread)
- fwrite ((void *) buf, (size_t) numread, 1, stdout);
- }
- while (numread);
-
- pInternetCloseHandle (hurl);
- pInternetCloseHandle (hi);
- return 0;
-}
-
-static void
-usage (FILE * stream, int status)
-{
- fprintf (stream, "\
-Usage: cygcheck PROGRAM [ -v ] [ -h ]\n\
- cygcheck -c [ PACKAGE ] [ -d ]\n\
- cygcheck -s [ -r ] [ -v ] [ -h ]\n\
- cygcheck -k\n\
- cygcheck -f FILE [ FILE ... ]\n\
- cygcheck -l [ PACKAGE ] [ PACKAGE ... ]\n\
- cygcheck -p REGEXP\n\
-List system information, check installed packages, or query package database.\n\
-\n\
-At least one command option or a PROGRAM is required, as shown above.\n\
-\n\
- PROGRAM list library (DLL) dependencies of PROGRAM\n\
- -c, --check-setup show installed version of PACKAGE and verify integrity\n\
- (or for all installed packages if none specified)\n\
- -d, --dump-only just list packages, do not verify (with -c)\n\
- -s, --sysinfo produce diagnostic system information (implies -c -d)\n\
- -r, --registry also scan registry for Cygwin settings (with -s)\n\
- -k, --keycheck perform a keyboard check session (must be run from a\n\
- plain console only, not from a pty/rxvt/xterm)\n\
- -f, --find-package find the package that FILE belongs to\n\
- -l, --list-package list contents of PACKAGE (or all packages if none given)\n\
- -p, --package-query search for REGEXP in the entire cygwin.com package\n\
- repository (requies internet connectivity)\n\
- -v, --verbose produce more verbose output\n\
- -h, --help annotate output with explanatory comments when given\n\
- with another command, otherwise print this help\n\
- -V, --version print the version of cygcheck and exit\n\
-\n\
-Note: -c, -f, and -l only report on packages that are currently installed. To\n\
- search all official Cygwin packages use -p instead. The -p REGEXP matches\n\
- package names, descriptions, and names of files/paths within all packages.\n\
-\n");
- exit (status);
-}
-
-struct option longopts[] = {
- {"check-setup", no_argument, NULL, 'c'},
- {"dump-only", no_argument, NULL, 'd'},
- {"sysinfo", no_argument, NULL, 's'},
- {"registry", no_argument, NULL, 'r'},
- {"verbose", no_argument, NULL, 'v'},
- {"keycheck", no_argument, NULL, 'k'},
- {"find-package", no_argument, NULL, 'f'},
- {"list-package", no_argument, NULL, 'l'},
- {"package-query", no_argument, NULL, 'p'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, 0, 'V'},
- {0, no_argument, NULL, 0}
-};
-
-static char opts[] = "cdsrvkflphV";
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-cygcheck version %.*s\n\
-System Checker for Cygwin\n\
-Copyright (C) 1998 - 2008 Red Hat, Inc.\n\
-Compiled on %s\n\
-", len, v, __DATE__);
-}
-
-void
-nuke (char *ev)
-{
- int n = 1 + strchr (ev, '=') - ev;
- char *s = (char *) malloc (n + 1);
- memcpy (s, ev, n);
- s[n] = '\0';
- putenv (s);
-}
-
-extern "C" {
-unsigned long (*cygwin_internal) (int, ...);
-};
-
-static void
-load_cygwin (int& argc, char **&argv)
-{
- HMODULE h;
-
- if (!(h = LoadLibrary ("cygwin1.dll")))
- return;
- if ((cygwin_internal = (DWORD (*) (int, ...)) GetProcAddress (h, "cygwin_internal")))
- {
- char **av = (char **) cygwin_internal (CW_ARGV);
- if (av && ((DWORD) av != (DWORD) -1))
- {
- /* Copy cygwin's idea of the argument list into this Window application. */
- for (argc = 0; av[argc]; argc++)
- continue;
- argv = (char **) calloc (argc + 1, sizeof (char *));
- for (char **argvp = argv; *av; av++)
- *argvp++ = strdup (*av);
- }
-
-
- char **envp = (char **) cygwin_internal (CW_ENVP);
- if (envp && ((DWORD) envp != (DWORD) -1))
- {
- /* Store path and revert to this value, otherwise path gets overwritten
- by the POSIXy Cygwin variation, which breaks cygcheck.
- Another approach would be to use the Cygwin PATH and convert it to
- Win32 again. */
- char *path = NULL;
- char **env;
- while (*(env = _environ))
- {
- if (strncmp (*env, "PATH=", 5) == 0)
- path = strdup (*env);
- nuke (*env);
- }
- for (char **ev = envp; *ev; ev++)
- if (strncmp (*ev, "PATH=", 5) != 0)
- putenv (strdup (*ev));
- if (path)
- putenv (path);
- }
- }
- FreeLibrary (h);
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
- bool ok = true;
- load_cygwin (argc, argv);
-
- /* Need POSIX sorting while parsing args, but don't forget the
- user's original environment. */
- char *posixly = getenv ("POSIXLY_CORRECT");
- if (posixly == NULL)
- (void) putenv("POSIXLY_CORRECT=1");
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 's':
- sysinfo = 1;
- break;
- case 'c':
- check_setup = 1;
- break;
- case 'd':
- dump_only = 1;
- break;
- case 'r':
- registry = 1;
- break;
- case 'v':
- verbose = 1;
- break;
- case 'k':
- keycheck = 1;
- break;
- case 'f':
- find_package = 1;
- break;
- case 'l':
- list_package = 1;
- break;
- case 'p':
- grep_packages = 1;
- break;
- case 'h':
- givehelp = 1;
- break;
- case 'V':
- print_version ();
- exit (0);
- default:
- usage (stderr, 1);
- /*NOTREACHED*/}
- argc -= optind;
- argv += optind;
- if (posixly == NULL)
- putenv ("POSIXLY_CORRECT=");
-
- if ((argc == 0) && !sysinfo && !keycheck && !check_setup && !list_package)
- {
- if (givehelp)
- usage (stdout, 0);
- else
- usage (stderr, 1);
- }
-
- if ((check_setup || sysinfo || find_package || list_package || grep_packages)
- && keycheck)
- usage (stderr, 1);
-
- if ((find_package || list_package || grep_packages) && check_setup)
- usage (stderr, 1);
-
- if (dump_only && !check_setup)
- usage (stderr, 1);
-
- if (find_package + list_package + grep_packages > 1)
- usage (stderr, 1);
-
- if (keycheck)
- return check_keys ();
- if (grep_packages)
- return package_grep (*argv);
-
- init_paths ();
-
- /* FIXME: Add help for check_setup and {list,find}_package */
- if (argc >= 1 && givehelp && !check_setup && !find_package && !list_package)
- {
- printf("Here is where the OS will find your program%s, and which dlls\n",
- argc > 1 ? "s" : "");
- printf ("will be used for it. Use -v to see DLL version info\n");
-
- if (!sysinfo)
- printf ("\n");
- }
-
- if (check_setup)
- dump_setup (verbose, argv, !dump_only);
- else if (find_package)
- package_find (verbose, argv);
- else if (list_package)
- package_list (verbose, argv);
- else
- for (i = 0; i < argc; i++)
- {
- if (i)
- puts ("");
- ok &= cygcheck (argv[i]);
- }
-
- if (sysinfo)
- {
- dump_sysinfo ();
- if (!check_setup)
- {
- puts ("");
- dump_setup (verbose, NULL, false);
- }
-
- if (!givehelp)
- puts ("Use -h to see help about each section");
- }
-
- return ok ? EXIT_SUCCESS : EXIT_FAILURE;
-}
diff --git a/winsup/utils/cygpath.cc b/winsup/utils/cygpath.cc
deleted file mode 100644
index 6f8eb6b30..000000000
--- a/winsup/utils/cygpath.cc
+++ /dev/null
@@ -1,1010 +0,0 @@
-/* cygpath.cc -- convert pathnames between Windows and Unix format
- Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#define NOCOMATTRIBUTE
-
-#include <shlobj.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <argz.h>
-#include <limits.h>
-#include <getopt.h>
-#include <windows.h>
-#include <io.h>
-#include <sys/fcntl.h>
-#include <sys/cygwin.h>
-#include <ctype.h>
-#include <errno.h>
-#include <ddk/ntddk.h>
-#include <ddk/winddk.h>
-#include <ddk/ntifs.h>
-
-static const char version[] = "$Revision$";
-
-static char *prog_name;
-static char *file_arg, *output_arg;
-static int path_flag, unix_flag, windows_flag, absolute_flag;
-static int shortname_flag, longname_flag;
-static int ignore_flag, allusers_flag, output_flag;
-static int mixed_flag, options_from_file_flag, mode_flag;
-
-static const char *format_type_arg;
-
-static struct option long_options[] = {
- {(char *) "absolute", no_argument, NULL, 'a'},
- {(char *) "close", required_argument, NULL, 'c'},
- {(char *) "dos", no_argument, NULL, 'd'},
- {(char *) "file", required_argument, NULL, 'f'},
- {(char *) "help", no_argument, NULL, 'h'},
- {(char *) "ignore", no_argument, NULL, 'i'},
- {(char *) "long-name", no_argument, NULL, 'l'},
- {(char *) "mixed", no_argument, NULL, 'm'},
- {(char *) "mode", no_argument, NULL, 'M'},
- {(char *) "option", no_argument, NULL, 'o'},
- {(char *) "path", no_argument, NULL, 'p'},
- {(char *) "short-name", no_argument, NULL, 's'},
- {(char *) "type", required_argument, NULL, 't'},
- {(char *) "unix", no_argument, NULL, 'u'},
- {(char *) "version", no_argument, NULL, 'v'},
- {(char *) "windows", no_argument, NULL, 'w'},
- {(char *) "allusers", no_argument, NULL, 'A'},
- {(char *) "desktop", no_argument, NULL, 'D'},
- {(char *) "homeroot", no_argument, NULL, 'H'},
- {(char *) "mydocs", no_argument, NULL, 'O'},
- {(char *) "smprograms", no_argument, NULL, 'P'},
- {(char *) "sysdir", no_argument, NULL, 'S'},
- {(char *) "windir", no_argument, NULL, 'W'},
- {(char *) "folder", required_argument, NULL, 'F'},
- {0, no_argument, 0, 0}
-};
-
-static char options[] = "ac:df:hilmMopst:uvwADHOPSWF:";
-
-static void
-usage (FILE * stream, int status)
-{
- if (!ignore_flag || !status)
- fprintf (stream, "\
-Usage: %s (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME...\n\
- %s [-c HANDLE] \n\
- %s [-ADHOPSW] \n\
- %s [-F ID] \n\
-Convert Unix and Windows format paths, or output system path information\n\
-\n\
-Output type options:\n\
- -d, --dos print DOS (short) form of NAMEs (C:\\PROGRA~1\\)\n\
- -m, --mixed like --windows, but with regular slashes (C:/WINNT)\n\
- -M, --mode report on mode of file (binmode or textmode)\n\
- -u, --unix (default) print Unix form of NAMEs (/cygdrive/c/winnt)\n\
- -w, --windows print Windows form of NAMEs (C:\\WINNT)\n\
- -t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows'\n\
-Path conversion options:\n\
- -a, --absolute output absolute path\n\
- -l, --long-name print Windows long form of NAMEs (with -w, -m only)\n\
- -p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')\n\
- -s, --short-name print DOS (short) form of NAMEs (with -w, -m only)\n\
-System information:\n\
- -A, --allusers use `All Users' instead of current user for -D, -O, -P\n\
- -D, --desktop output `Desktop' directory and exit\n\
- -H, --homeroot output `Profiles' directory (home root) and exit\n\
- -O, --mydocs output `My Documents' directory and exit\n\
- -P, --smprograms output Start Menu `Programs' directory and exit\n\
- -S, --sysdir output system directory and exit\n\
- -W, --windir output `Windows' directory and exit\n\
- -F, --folder ID output special folder with numeric ID and exit\n\
-", prog_name, prog_name, prog_name, prog_name);
- if (ignore_flag)
- /* nothing to do */;
- else if (stream != stdout)
- fprintf(stream, "Try `%s --help' for more information.\n", prog_name);
- else
- {
- fprintf (stream, "\
-Other options:\n\
- -f, --file FILE read FILE for input; use - to read from STDIN\n\
- -o, --option read options from FILE as well (for use with --file)\n\
- -c, --close HANDLE close HANDLE (for use in captured process)\n\
- -i, --ignore ignore missing argument\n\
- -h, --help output usage information and exit\n\
- -v, --version output version information and exit\n\
-");
- }
- exit (ignore_flag ? 0 : status);
-}
-
-static inline BOOLEAN
-RtlAllocateUnicodeString (PUNICODE_STRING uni, ULONG size)
-{
- uni->Length = 0;
- uni->MaximumLength = 512;
- uni->Buffer = (WCHAR *) malloc (size);
- return uni->Buffer != NULL;
-}
-
-static char *
-get_device_name (char *path)
-{
- UNICODE_STRING ntdev, tgtdev, ntdevdir;
- ANSI_STRING ans;
- OBJECT_ATTRIBUTES ntobj;
- NTSTATUS status;
- HANDLE lnk, dir;
- char *ret = strdup (path);
- PDIRECTORY_BASIC_INFORMATION odi = (PDIRECTORY_BASIC_INFORMATION)
- alloca (4096);
- BOOLEAN restart;
- ULONG cont;
-
- if (strncasecmp (path, "\\Device\\", 8))
- return ret;
-
- if (!RtlAllocateUnicodeString (&ntdev, MAX_PATH * 2))
- return ret;
- if (!RtlAllocateUnicodeString (&tgtdev, MAX_PATH * 2))
- return ret;
- RtlInitAnsiString (&ans, path);
- RtlAnsiStringToUnicodeString (&ntdev, &ans, FALSE);
-
- /* First check if the given device name is a symbolic link itself. If so,
- query it and use the new name as actual device name to search for in the
- DOS device name directory. If not, just use the incoming device name. */
- InitializeObjectAttributes (&ntobj, &ntdev, OBJ_CASE_INSENSITIVE, NULL, NULL);
- status = ZwOpenSymbolicLinkObject (&lnk, SYMBOLIC_LINK_QUERY, &ntobj);
- if (NT_SUCCESS (status))
- {
- status = ZwQuerySymbolicLinkObject (lnk, &tgtdev, NULL);
- ZwClose (lnk);
- if (!NT_SUCCESS (status))
- goto out;
- RtlCopyUnicodeString (&ntdev, &tgtdev);
- }
- else if (status != STATUS_OBJECT_TYPE_MISMATCH)
- goto out;
-
- for (int i = 0; i < 2; ++i)
- {
- /* There are two DOS device directories, the local and the global dir.
- Try both, local first. */
- RtlInitUnicodeString (&ntdevdir, i ? L"\\GLOBAL??" : L"\\??");
-
- /* Open the directory... */
- InitializeObjectAttributes (&ntobj, &ntdevdir, OBJ_CASE_INSENSITIVE,
- NULL, NULL);
- status = ZwOpenDirectoryObject (&dir, DIRECTORY_QUERY, &ntobj);
- if (!NT_SUCCESS (status))
- break;
-
- /* ...and scan it. */
- for (restart = TRUE, cont = 0;
- NT_SUCCESS (ZwQueryDirectoryObject (dir, odi, 4096, TRUE,
- restart, &cont, NULL));
- restart = FALSE)
- {
- /* For each entry check if it's a symbolic link. */
- InitializeObjectAttributes (&ntobj, &odi->ObjectName,
- OBJ_CASE_INSENSITIVE, dir, NULL);
- status = ZwOpenSymbolicLinkObject (&lnk, SYMBOLIC_LINK_QUERY, &ntobj);
- if (!NT_SUCCESS (status))
- continue;
- tgtdev.Length = 0;
- tgtdev.MaximumLength = 512;
- /* If so, query it and compare the target of the symlink with the
- incoming device name. */
- status = ZwQuerySymbolicLinkObject (lnk, &tgtdev, NULL);
- ZwClose (lnk);
- if (!NT_SUCCESS (status))
- continue;
- if (RtlEqualUnicodeString (&ntdev, &tgtdev, TRUE))
- {
- /* If the comparison succeeds, the name of the directory entry is
- a valid DOS device name, if prepended with "\\.\". Return that
- valid DOS path. */
- ULONG len = RtlUnicodeStringToAnsiSize (&odi->ObjectName);
- ret = (char *) malloc (len + 4);
- strcpy (ret, "\\\\.\\");
- ans.Length = 0;
- ans.MaximumLength = len;
- ans.Buffer = ret + 4;
- RtlUnicodeStringToAnsiString (&ans, &odi->ObjectName, FALSE);
- ZwClose (dir);
- goto out;
- }
- }
- ZwClose (dir);
- }
-
-out:
- free (tgtdev.Buffer);
- free (ntdev.Buffer);
- return ret;
-}
-
-static char *
-get_device_paths (char *path)
-{
- char *sbuf;
- char *ptr;
- int n = 1;
-
- ptr = path;
- while ((ptr = strchr (ptr, ';')))
- {
- ptr++;
- n++;
- }
-
- char *paths[n];
- DWORD acc = 0;
- int i;
- if (!n)
- return strdup ("");
-
- for (i = 0, ptr = path; ptr; i++)
- {
- char *next = ptr;
- ptr = strchr (ptr, ';');
- if (ptr)
- *ptr++ = 0;
- paths[i] = get_device_name (next);
- acc += strlen (paths[i]) + 1;
- }
-
- sbuf = (char *) malloc (acc + 1);
- if (sbuf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
-
- sbuf[0] = '\0';
- for (i = 0; i < n; i++)
- {
- strcat (strcat (sbuf, paths[i]), ";");
- free (paths[i]);
- }
-
- strchr (sbuf, '\0')[-1] = '\0';
- return sbuf;
-}
-
-static char *
-get_short_paths (char *path)
-{
- char *sbuf;
- char *sptr;
- char *next;
- char *ptr = path;
- char *end = strrchr (path, 0);
- DWORD acc = 0;
- DWORD len;
-
- while (ptr != NULL)
- {
- next = ptr;
- ptr = strchr (ptr, ';');
- if (ptr)
- *ptr++ = 0;
- len = GetShortPathName (next, NULL, 0);
- if (!len)
- {
- fprintf (stderr, "%s: cannot create short name of %s\n", prog_name,
- next);
- exit (2);
- }
- acc += len + 1;
- }
- sptr = sbuf = (char *) malloc (acc + 1);
- if (sbuf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
- ptr = path;
- for (;;)
- {
- len = GetShortPathName (ptr, sptr, acc);
- if (!len)
- {
- fprintf (stderr, "%s: cannot create short name of %s\n", prog_name,
- ptr);
- exit (2);
- }
-
- ptr = strrchr (ptr, 0);
- sptr = strrchr (sptr, 0);
- if (ptr == end)
- break;
- *sptr = ';';
- ++ptr, ++sptr;
- acc -= len + 1;
- }
- return sbuf;
-}
-
-static char *
-get_short_name (const char *filename)
-{
- char *sbuf, buf[MAX_PATH];
- DWORD len = GetShortPathName (filename, buf, MAX_PATH);
- if (!len)
- {
- fprintf (stderr, "%s: cannot create short name of %s\n", prog_name,
- filename);
- exit (2);
- }
- sbuf = (char *) malloc (++len);
- if (sbuf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
- return strcpy (sbuf, buf);
-}
-
-static DWORD WINAPI
-get_long_path_name_w32impl (LPCSTR src, LPSTR sbuf, DWORD)
-{
- char buf1[MAX_PATH], buf2[MAX_PATH], *ptr;
- const char *pelem, *next;
- WIN32_FIND_DATA w32_fd;
- int len;
-
- strcpy (buf1, src);
- *buf2 = 0;
- pelem = src;
- ptr = buf2;
- while (pelem)
- {
- next = pelem;
- if (*next == '\\')
- {
- strcat (ptr++, "\\");
- pelem++;
- if (!*pelem)
- break;
- continue;
- }
- pelem = strchr (next, '\\');
- len = pelem ? (pelem++ - next) : strlen (next);
- strncpy (ptr, next, len);
- ptr[len] = 0;
- if (next[1] != ':' && strcmp(next, ".") && strcmp(next, ".."))
- {
- HANDLE h;
- h = FindFirstFile (buf2, &w32_fd);
- if (h != INVALID_HANDLE_VALUE)
- {
- strcpy (ptr, w32_fd.cFileName);
- FindClose (h);
- }
- }
- ptr += strlen (ptr);
- if (pelem)
- {
- *ptr++ = '\\';
- *ptr = 0;
- }
- }
- if (sbuf)
- strcpy (sbuf, buf2);
- SetLastError (0);
- return strlen (buf2) + (sbuf ? 0 : 1);
-}
-
-static char *
-get_long_name (const char *filename, DWORD& len)
-{
- char *sbuf, buf[MAX_PATH];
- static HINSTANCE k32 = LoadLibrary ("kernel32.dll");
- static DWORD (WINAPI *GetLongPathName) (LPCSTR, LPSTR, DWORD) =
- (DWORD (WINAPI *) (LPCSTR, LPSTR, DWORD)) GetProcAddress (k32, "GetLongPathNameA");
- if (!GetLongPathName)
- GetLongPathName = get_long_path_name_w32impl;
-
- len = GetLongPathName (filename, buf, MAX_PATH);
- if (len == 0)
- {
- DWORD err = GetLastError ();
-
- if (err == ERROR_INVALID_PARAMETER)
- {
- fprintf (stderr, "%s: cannot create long name of %s\n", prog_name,
- filename);
- exit (2);
- }
- else if (err == ERROR_FILE_NOT_FOUND)
- len = get_long_path_name_w32impl (filename, buf, MAX_PATH);
- else
- {
- buf[0] = '\0';
- strncat (buf, filename, MAX_PATH - 1);
- len = strlen (buf);
- }
- }
- sbuf = (char *) malloc (len + 1);
- if (!sbuf)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
- return strcpy (sbuf, buf);
-}
-
-static char *
-get_long_paths (char *path)
-{
- char *sbuf;
- char *ptr;
- int n = 1;
-
- ptr = path;
- while ((ptr = strchr (ptr, ';')))
- {
- ptr++;
- n++;
- }
-
- char *paths[n];
- DWORD acc = 0;
- int i;
- if (!n)
- return strdup ("");
-
- for (i = 0, ptr = path; ptr; i++)
- {
- DWORD len;
- char *next = ptr;
- ptr = strchr (ptr, ';');
- if (ptr)
- *ptr++ = 0;
- paths[i] = get_long_name (next, len);
- acc += len + 1;
- }
-
- sbuf = (char *) malloc (acc + 1);
- if (sbuf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
-
- sbuf[0] = '\0';
- for (i = 0; i < n; i++)
- {
- strcat (strcat (sbuf, paths[i]), ";");
- free (paths[i]);
- }
-
- strchr (sbuf, '\0')[-1] = '\0';
- return sbuf;
-}
-
-static void
-convert_slashes (char* name)
-{
- while ((name = strchr (name, '\\')) != NULL)
- {
- if (*name == '\\')
- *name = '/';
- name++;
- }
-}
-
-static char *
-get_mixed_name (const char* filename)
-{
- char* mixed_buf = strdup (filename);
-
- if (mixed_buf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
-
- convert_slashes (mixed_buf);
-
- return mixed_buf;
-}
-
-static bool
-get_special_folder (char* path, int id)
-{
- path[0] = 0;
- LPITEMIDLIST pidl = 0;
- if (SHGetSpecialFolderLocation (NULL, id, &pidl) != S_OK)
- return false;
- if (!SHGetPathFromIDList (pidl, path) || !path[0])
- return false;
- return true;
-}
-
-static void
-get_user_folder (char* path, int id, int allid)
-{
- get_special_folder (path, allusers_flag ? allid : id);
-}
-
-static void
-do_sysfolders (char option)
-{
- char *buf, buf1[MAX_PATH], buf2[MAX_PATH];
- DWORD len = MAX_PATH;
- WIN32_FIND_DATA w32_fd;
- HINSTANCE k32;
- BOOL (*GetProfilesDirectoryAPtr) (LPSTR, LPDWORD) = 0;
-
- buf = buf1;
- buf[0] = 0;
- switch (option)
- {
- case 'D':
- get_user_folder (buf, CSIDL_DESKTOPDIRECTORY,
- CSIDL_COMMON_DESKTOPDIRECTORY);
- break;
-
- case 'P':
- get_user_folder (buf, CSIDL_PROGRAMS, CSIDL_COMMON_PROGRAMS);
- break;
-
- case 'O':
- get_user_folder (buf, CSIDL_PERSONAL, CSIDL_COMMON_DOCUMENTS);
- break;
-
- case 'F':
- {
- int val = -1, len = -1;
- if (!(sscanf (output_arg, "%i%n", &val, &len) == 1
- && len == (int) strlen (output_arg) && val >= 0))
- {
- fprintf (stderr, "%s: syntax error in special folder ID %s\n",
- prog_name, output_arg);
- exit (1);
- }
- get_special_folder (buf, val);
- }
- break;
-
- case 'H':
- k32 = LoadLibrary ("userenv");
- if (k32)
- GetProfilesDirectoryAPtr = (BOOL (*) (LPSTR, LPDWORD))
- GetProcAddress (k32, "GetProfilesDirectoryA");
- if (GetProfilesDirectoryAPtr)
- (*GetProfilesDirectoryAPtr) (buf, &len);
- else
- {
- GetWindowsDirectory (buf, MAX_PATH);
- strcat (buf, "\\Profiles");
- }
- break;
-
- case 'S':
- GetSystemDirectory (buf, MAX_PATH);
- FindFirstFile (buf, &w32_fd);
- strcpy (strrchr (buf, '\\') + 1, w32_fd.cFileName);
- break;
-
- case 'W':
- GetWindowsDirectory (buf, MAX_PATH);
- break;
-
- default:
- usage (stderr, 1);
- }
-
- if (!buf[0])
- {
- fprintf (stderr, "%s: failed to retrieve special folder path\n", prog_name);
- }
- else if (!windows_flag)
- {
- if (cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_RELATIVE, buf, buf2,
- MAX_PATH))
- fprintf (stderr, "%s: error converting \"%s\" - %s\n",
- prog_name, buf, strerror (errno));
- else
- buf = buf2;
- }
- else
- {
- if (shortname_flag)
- buf = get_short_name (buf);
- if (mixed_flag)
- buf = get_mixed_name (buf);
- }
- printf ("%s\n", buf);
-}
-
-static void
-report_mode (char *filename)
-{
- switch (cygwin_internal (CW_GET_BINMODE, filename))
- {
- case O_BINARY:
- printf ("%s: binary\n", filename);
- break;
- case O_TEXT:
- printf ("%s: text\n", filename);
- break;
- default:
- fprintf (stderr, "%s: file '%s' - %s\n", prog_name, filename,
- strerror (errno));
- break;
- }
-}
-
-static void
-do_pathconv (char *filename)
-{
- char *buf;
- DWORD len;
- ssize_t err;
- cygwin_conv_path_t conv_func =
- (unix_flag ? CCP_WIN_A_TO_POSIX : CCP_POSIX_TO_WIN_A)
- | (absolute_flag ? CCP_ABSOLUTE : CCP_RELATIVE);
-
- if (!path_flag)
- {
- len = strlen (filename);
- if (len)
- len += MAX_PATH + 1001;
- else if (ignore_flag)
- exit (0);
- else
- {
- fprintf (stderr, "%s: can't convert empty path\n", prog_name);
- exit (1);
- }
- }
- else
- len = cygwin_conv_path_list (conv_func, filename, NULL, 0);
-
- buf = (char *) malloc (len);
- if (buf == NULL)
- {
- fprintf (stderr, "%s: out of memory\n", prog_name);
- exit (1);
- }
-
- if (path_flag)
- {
- err = cygwin_conv_path_list (conv_func, filename, buf, len);
- if (!unix_flag)
- {
- if (err)
- /* oops */;
- buf = get_device_paths (buf);
- if (shortname_flag)
- buf = get_short_paths (buf);
- if (longname_flag)
- buf = get_long_paths (buf);
- if (mixed_flag)
- buf = get_mixed_name (buf);
- }
- if (err)
- {
- fprintf (stderr, "%s: error converting \"%s\" - %s\n",
- prog_name, filename, strerror (errno));
- exit (1);
- }
- }
- else
- {
- err = cygwin_conv_path (conv_func, filename, buf, len);
- if (err)
- {
- fprintf (stderr, "%s: error converting \"%s\" - %s\n",
- prog_name, filename, strerror (errno));
- exit (1);
- }
- if (!unix_flag)
- {
- buf = get_device_name (buf);
- if (shortname_flag)
- buf = get_short_name (buf);
- if (longname_flag)
- buf = get_long_name (buf, len);
- if (mixed_flag)
- buf = get_mixed_name (buf);
- }
- }
-
- puts (buf);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-cygpath (cygwin) %.*s\n\
-Path Conversion Utility\n\
-Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, \n\
- 2007, 2008 Red Hat, Inc.\n\
-Compiled on %s\n\
-", len, v, __DATE__);
-}
-
-static int
-do_options (int argc, char **argv, int from_file)
-{
- int c, o = 0;
- path_flag = 0;
- unix_flag = 0;
- windows_flag = 0;
- shortname_flag = 0;
- longname_flag = 0;
- mixed_flag = 0;
- ignore_flag = 0;
- allusers_flag = 0;
- output_flag = 0;
- mode_flag = 0;
- if (!from_file)
- options_from_file_flag = 0;
- optind = 0;
- while ((c = getopt_long (argc, argv, options,
- long_options, (int *) NULL)) != EOF)
- {
- switch (c)
- {
- case 'a':
- absolute_flag = 1;
- break;
-
- case 'c':
- if (!optarg)
- usage (stderr, 1);
- CloseHandle ((HANDLE) strtoul (optarg, NULL, 16));
- break;
-
- case 'd':
- windows_flag = 1;
- shortname_flag = 1;
- break;
-
- case 'f':
- if (from_file || !optarg)
- usage (stderr, 1);
- file_arg = optarg;
- break;
-
- case 'M':
- mode_flag = 1;
- break;
-
- case 'o':
- if (from_file)
- usage (stderr, 1);
- options_from_file_flag = 1;
- break;
-
- case 'p':
- path_flag = 1;
- break;
-
- case 'u':
- unix_flag = 1;
- break;
-
- case 'w':
- windows_flag = 1;
- break;
-
- case 'm':
- windows_flag = 1;
- mixed_flag = 1;
- break;
-
- case 'l':
- longname_flag = 1;
- break;
-
- case 's':
- shortname_flag = 1;
- break;
-
- case 't':
- if (!optarg)
- usage (stderr, 1);
-
- format_type_arg = (*optarg == '=') ? (optarg + 1) : (optarg);
- if (strcasecmp (format_type_arg, "dos") == 0)
- {
- windows_flag = 1;
- shortname_flag = 1;
- }
- else if (!strcasecmp (format_type_arg, "mixed"))
- {
- windows_flag = 1;
- mixed_flag = 1;
- }
- else if (!strcasecmp (format_type_arg, "unix"))
- unix_flag = 1;
- else if (!strcasecmp (format_type_arg, "windows"))
- windows_flag = 1;
- else
- usage (stderr, 1);
- break;
-
- case 'A':
- allusers_flag = 1;
- break;
-
- case 'D':
- case 'H':
- case 'O':
- case 'P':
- case 'S':
- case 'W':
- ++output_flag;
- o = c;
- break;
-
- case 'F':
- if (!optarg)
- usage (stderr, 1);
- ++output_flag;
- output_arg = optarg;
- o = c;
- break;
-
- case 'i':
- ignore_flag = 1;
- break;
-
- case 'h':
- usage (stdout, 0);
- break;
-
- case 'v':
- print_version ();
- exit (0);
-
- default:
- usage (stderr, 1);
- break;
- }
- }
-
- /* If none of the "important" flags are set, -u is default. */
- if (!unix_flag && !windows_flag && !mode_flag
- && (!from_file ? !options_from_file_flag : 1))
- unix_flag = 1;
-
- /* Only one of ... */
- if (unix_flag + windows_flag + mode_flag > 1
- + (!from_file ? options_from_file_flag : 0))
- usage (stderr, 1);
-
- /* options_from_file_flag requires a file. */
- if (!from_file && options_from_file_flag && !file_arg)
- usage (stderr, 1);
-
- /* longname and shortname don't play well together. */
- if (longname_flag && shortname_flag)
- usage (stderr, 1);
-
- /* longname and shortname only make sense with Windows paths. */
- if ((longname_flag || shortname_flag) && !windows_flag)
- usage (stderr, 1);
-
- return o;
-}
-
-static void
-action (int argc, char **argv, int opt)
-{
- if (output_flag)
- {
- if (argv[optind])
- usage (stderr, 1);
-
- do_sysfolders (opt);
- }
- else
- {
- if (optind > argc - 1)
- usage (stderr, 1);
-
- for (int i = optind; argv[i]; i++)
- if (mode_flag)
- report_mode (argv[i]);
- else
- do_pathconv (argv[i]);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- int o;
-
- prog_name = strrchr (argv[0], '/');
- if (!prog_name)
- prog_name = strrchr (argv[0], '\\');
- if (!prog_name)
- prog_name = argv[0];
- else
- prog_name++;
-
- o = do_options (argc, argv, 0);
-
- if (!file_arg)
- action (argc, argv, o);
- else
- {
- FILE *fp;
- char buf[PATH_MAX * 2 + 1];
-
- if (argv[optind])
- usage (stderr, 1);
-
- if (strcmp (file_arg, "-"))
- {
- if (!(fp = fopen (file_arg, "rt")))
- {
- perror ("cygpath");
- exit (1);
- }
- }
- else
- {
- fp = stdin;
- setmode (0, O_TEXT);
- }
- setbuf (stdout, NULL);
-
- while (fgets (buf, sizeof (buf), fp))
- {
- size_t azl = 0;
- int ac;
- char *az, **av;
- char *p = strchr (buf, '\n');
- if (p)
- *p = '\0';
- if (argz_create_sep (buf, ' ', &az, &azl))
- {
- perror ("cygpath");
- exit (1);
- }
- if (!az)
- continue;
- ac = argz_count (az, azl) + 1;
- av = (char **) malloc ((ac + 1) * sizeof (char *));
- if (!av)
- {
- perror ("cygpath");
- exit (1);
- }
- av[0] = prog_name;
- argz_extract (az, azl, av + 1);
- if (options_from_file_flag)
- o = do_options (ac, av, 1);
- else
- optind = 1;
- action (ac, av, o);
- free (az);
- free (av);
- }
- }
- exit (0);
-}
diff --git a/winsup/utils/dump_setup.cc b/winsup/utils/dump_setup.cc
deleted file mode 100644
index e3dacde6c..000000000
--- a/winsup/utils/dump_setup.cc
+++ /dev/null
@@ -1,510 +0,0 @@
-/* dump_setup.cc
-
- Copyright 2001 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <windows.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <io.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include "path.h"
-#if 0
-#include "zlib.h"
-#endif
-
-#ifndef ZLIB_VERSION
-typedef void * gzFile;
-#define gzgets(fp, buf, size) ({0;})
-#define gzclose(fp) ({0;})
-#endif
-
-static int package_len = 20;
-static unsigned int version_len = 10;
-
-
-typedef struct
-{
- char pkgtar[MAX_PATH + 1];
- char pkg[MAX_PATH + 1];
- char ver[MAX_PATH + 1];
- char tail[MAX_PATH + 1];
- char what[16];
-} fileparse;
-
-static int
-find_tar_ext (const char *path)
-{
- char *p = strchr (path, '\0') - 7;
- if (p <= path)
- return 0;
- if (*p == '.')
- {
- if (strcmp (p, ".tar.gz") != 0)
- return 0;
- }
- else if (--p <= path || strcmp (p, ".tar.bz2") != 0)
- return 0;
-
- return p - path;
-}
-
-static char *
-base (const char *s)
-{
- if (!s)
- return 0;
- const char *rv = s;
- while (*s)
- {
- if ((*s == '/' || *s == ':' || *s == '\\') && s[1])
- rv = s + 1;
- s++;
- }
- return (char *) rv;
-}
-
-/* Parse a filename into package, version, and extension components. */
-int
-parse_filename (const char *in_fn, fileparse& f)
-{
- char *p, *ver;
- char fn[strlen (in_fn) + 1];
-
- strcpy (fn, in_fn);
- int n = find_tar_ext (fn);
-
- if (!n)
- return 0;
-
- strcpy (f.tail, fn + n);
- fn[n] = '\0';
- f.pkg[0] = f.what[0] = '\0';
- p = base (fn);
- for (ver = p; *ver; ver++)
- if (*ver != '-')
- continue;
- else if (isdigit (ver[1]))
- {
- *ver++ = '\0';
- strcpy (f.pkg, p);
- break;
- }
- else if (strcasecmp (ver, "-src") == 0 ||
- strcasecmp (ver, "-patch") == 0)
- {
- *ver++ = '\0';
- strcpy (f.pkg, p);
- strcpy (f.what, strlwr (ver));
- strcpy (f.pkgtar, p);
- strcat (f.pkgtar, f.tail);
- ver = strchr (ver, '\0');
- break;
- }
-
- if (!f.pkg[0])
- strcpy (f.pkg, p);
-
- if (!f.what[0])
- {
- int n;
- p = strchr (ver, '\0');
- strcpy (f.pkgtar, in_fn);
- if ((p -= 4) >= ver && strcasecmp (p, "-src") == 0)
- n = 4;
- else if ((p -= 2) >= ver && strcasecmp (p, "-patch") == 0)
- n = 6;
- else
- n = 0;
- if (n)
- {
- strcpy (f.what, p + 1);
- *p = '\0';
- p = f.pkgtar + (p - fn) + n;
- memmove (p - 4, p, strlen (p));
- }
- }
-
- strcpy (f.ver, *ver ? ver : "0.0");
- return 1;
-}
-
-static bool
-dump_file (const char *msg, const char *fn)
-{
- char *path = cygpath ("/etc/setup/", fn, NULL);
- FILE *fp = fopen (path, "rt");
- bool printed;
- char buf[4096];
- if (!fp)
- printed = false;
- else if (!fgets (buf, 4096, fp))
- printed = false;
- {
- char *p = strchr (buf, '\0');
- printf ("%s%s%s", msg, buf, (p == buf) || p[-1] != '\n' ? "\n" : "");
- printed = true;
- }
- if (fp)
- fclose (fp);
- return printed;
-}
-
-struct pkgver
-{
- char *name;
- char *ver;
-};
-
-extern "C" {
-int
-compar (const void *a, const void *b)
-{
- const pkgver *pa = (const pkgver *) a;
- const pkgver *pb = (const pkgver *) b;
- return strcasecmp (pa->name, pb->name);
-}
-}
-
-int
-match_argv (char **argv, const char *name)
-{
- if (!argv || !*argv)
- return -1;
- for (char **a = argv; *a; a++)
- if (strcasecmp (*a, name) == 0)
- return a - argv + 1;
- return 0;
-}
-
-static bool
-could_not_access (int verbose, char *filename, char *package, const char *type)
-{
- switch (errno)
- {
- case ENOTDIR:
- break;
- case ENOENT:
- if (verbose)
- printf ("Missing %s: /%s from package %s\n",
- type, filename, package);
- return true;
- case EACCES:
- if (verbose)
- printf ("Unable to access %s /%s from package %s\n",
- type, filename, package);
- return true;
- }
- return false;
-}
-
-static bool
-directory_exists (int verbose, char *filename, char *package)
-{
- struct stat status;
- if (stat(cygpath("/", filename, ".", NULL), &status))
- {
- if (could_not_access (verbose, filename, package, "directory"))
- return false;
- }
- else if (!S_ISDIR(status.st_mode))
- {
- if (verbose)
- printf ("Directory/file mismatch: /%s from package %s\n", filename, package);
- return false;
- }
- return true;
-}
-
-static bool
-file_exists (int verbose, char *filename, const char *alt, char *package)
-{
- struct stat status;
- if (stat(cygpath("/", filename, NULL), &status) &&
- (!alt || stat(cygpath("/", filename, alt, NULL), &status)))
- {
- if (could_not_access (verbose, filename, package, "file"))
- return false;
- }
- else if (!S_ISREG(status.st_mode))
- {
- if (verbose)
- printf ("File type mismatch: /%s from package %s\n", filename, package);
- return false;
- }
- return true;
-}
-
-static gzFile
-open_package_list (char *package)
-{
- char filelist[MAX_PATH + 1] = "/etc/setup/";
- strcat (strcat (filelist, package), ".lst.gz");
- if (!file_exists (false, filelist + 1, NULL, NULL))
- return NULL;
-
- gzFile fp;
-#ifndef ZLIB_VERSION
- fp = NULL;
-#else
- char *fn = cygpath (filelist, NULL);
- fp = gzopen (fn, "rb9");
- free (fn);
-#endif
-
- return fp;
-}
-
-static bool
-check_package_files (int verbose, char *package)
-{
- gzFile fp = open_package_list (package);
- if (!fp)
- {
- if (verbose)
- printf ("Empty package %s\n", package);
- return true;
- }
-
- bool result = true;
- char buf[MAX_PATH + 1];
- while (gzgets (fp, buf, MAX_PATH))
- {
- char *filename = strtok(buf, "\n");
-
- if (*filename == '/')
- ++filename;
- else if (!strncmp (filename, "./", 2))
- filename += 2;
-
- if (filename[strlen (filename) - 1] == '/')
- {
- if (!directory_exists (verbose, filename, package))
- result = false;
- }
- else if (!strncmp (filename, "etc/postinstall/", 16))
- {
- if (!file_exists (verbose, filename, ".done", package))
- result = false;
- }
- else
- {
- if (!file_exists (verbose, filename, ".lnk", package))
- result = false;
- }
- }
-
- gzclose (fp);
- return result;
-}
-
-/**
- * Returns a calloc'd sorted list of packages or NULL if no info.
- * The last entry in the list is {NULL,NULL}.
- */
-static pkgver *
-get_packages (char **argv)
-{
- char *setup = cygpath ("/etc/setup/installed.db", NULL);
- FILE *fp = fopen (setup, "rt");
-
- if (fp == NULL)
- return NULL;
-
- int nlines;
- nlines = 0;
- char buf[4096];
- while (fgets (buf, 4096, fp))
- nlines += 2; /* potentially binary + source */
- if (!nlines)
- {
- fclose (fp);
- return NULL;
- }
- rewind (fp);
-
- pkgver *packages;
-
- packages = (pkgver *) calloc (nlines + 1, sizeof(packages[0]));
- int n;
- for (n = 0; fgets (buf, 4096, fp) && n < nlines;)
- {
- char *package = strtok (buf, " ");
- if (!package || !*package || !match_argv (argv, package))
- continue;
- for (int i = 0; i < 2; i++)
- {
- fileparse f;
- char *tar = strtok (NULL, " ");
- if (!tar || !*tar || !parse_filename (tar, f))
- break;
-
- int len = strlen (package);
- if (f.what[0])
- len += strlen (f.what) + 1;
- if (len > package_len)
- package_len = len;
- packages[n].name = (char *) malloc (len + 1);
- strcpy (packages[n].name, package);
- if (f.what[0])
- strcat (strcat (packages[n].name, "-"), f.what);
- packages[n].ver = strdup (f.ver);
- if (strlen(f.ver) > version_len)
- version_len = strlen(f.ver);
- n++;
- if (strtok (NULL, " ") == NULL)
- break;
- }
- }
-
- packages[n].name = packages[n].ver = NULL;
-
- qsort (packages, n, sizeof (packages[0]), compar);
-
- fclose (fp);
-
- return packages;
-}
-
-void
-dump_setup (int verbose, char **argv, bool check_files)
-{
- pkgver *packages = get_packages(argv);
-
- puts ("Cygwin Package Information");
- if (packages == NULL)
- {
- puts ("No setup information found");
- return;
- }
-
- if (verbose)
- {
- bool need_nl = dump_file ("Last downloaded files to: ", "last-cache");
- if (dump_file ("Last downloaded files from: ", "last-mirror") || need_nl)
- puts ("");
- }
-
- printf ("%-*s %-*s%s\n", package_len, "Package",
- check_files ? version_len : 7, "Version",
- check_files ? " Status" : "");
- for (int i = 0; packages[i].name; i++)
- {
- if (check_files)
- printf ("%-*s %-*s%s\n", package_len, packages[i].name,
- version_len, packages[i].ver,
- check_package_files (verbose, packages[i].name)
- ? " OK" : " Incomplete");
- else
- printf ("%-*s %s\n", package_len, packages[i].name, packages[i].ver);
- fflush(stdout);
- }
-
- free (packages);
-
- return;
-}
-
-void
-package_list (int verbose, char **argv)
-{
- pkgver *packages = get_packages(argv);
- if (packages == NULL)
- {
- puts ("No setup information found");
- return;
- }
-
- for (int i = 0; packages[i].name; i++)
- {
- gzFile fp = open_package_list (packages[i].name);
- if (!fp)
- {
- if (verbose)
- printf ("Can't open file list /etc/setup/%s.lst.gz for package %s\n",
- packages[i].name, packages[i].name);
- continue;
- }
-
- if (verbose)
- printf ("Package: %s-%s\n", packages[i].name, packages[i].ver);
-
- char buf[MAX_PATH + 1];
- while (gzgets (fp, buf, MAX_PATH))
- {
- char *lastchar = strchr(buf, '\n');
- if (lastchar[-1] != '/')
- printf ("%s/%s", (verbose?" ":""), buf);
- }
-
- gzclose (fp);
- }
-
- free (packages);
-
- return;
-}
-
-void
-package_find (int verbose, char **argv)
-{
- pkgver *packages = get_packages(NULL);
- if (packages == NULL)
- {
- puts ("No setup information found");
- return;
- }
-
- for (int i = 0; packages[i].name; i++)
- {
- gzFile fp = open_package_list (packages[i].name);
- if (!fp)
- continue;
-
- char buf[MAX_PATH + 2];
- buf[0] = '/';
- while (gzgets (fp, buf + 1, MAX_PATH))
- {
- char *filename = strtok(buf, "\n");
- int flen = strlen (filename);
- if (filename[flen - 1] != '/')
- {
- // FIXME: verify that /bin is mounted on /usr/bin; ditto for /lib
- bool is_alias = !strncmp(filename, "/usr/bin/", 9) ||
- !strncmp(filename, "/usr/lib/", 9);
- int a = match_argv (argv, filename);
- if (!a && is_alias)
- a = match_argv (argv, filename + 4);
- if (!a && !strcmp(filename + flen - 4, ".exe"))
- {
- filename[flen - 4] = '\0';
- a = match_argv (argv, filename);
- }
- if (!a && is_alias)
- a = match_argv (argv, filename + 4);
- if (a > 0)
- {
- if (verbose)
- printf ("%s: found in package ", filename);
- printf ("%s-%s\n", packages[i].name, packages[i].ver);
- }
- }
- }
-
- gzclose (fp);
- }
-
- free (packages);
-
- return;
-}
-
diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc
deleted file mode 100644
index 616c36bbe..000000000
--- a/winsup/utils/dumper.cc
+++ /dev/null
@@ -1,950 +0,0 @@
-/* dumper.cc
-
- Copyright 1999, 2001, 2002, 2004, 2006, 2007 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- This file is part of Cygwin.
-
- 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 (file COPYING.dumper) 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. */
-
-#include <ansidecl.h>
-#include <bfd.h>
-#include <elf/common.h>
-#include <elf/external.h>
-#include <sys/procfs.h>
-#include <sys/cygwin.h>
-#include <getopt.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <windows.h>
-
-#include "dumper.h"
-
-#define NOTE_NAME_SIZE 16
-
-typedef struct _note_header
- {
- Elf_External_Note elf_note_header;
- char name[NOTE_NAME_SIZE - 1]; /* external note contains first byte of data */
- }
-#ifdef __GNUC__
-__attribute__ ((packed))
-#endif
- note_header;
-
-static const char version[] = "$Revision$";
-
-BOOL verbose = FALSE;
-
-int deb_printf (const char *format,...)
-{
- if (!verbose)
- return 0;
- va_list va;
- va_start (va, format);
- int ret_val = vprintf (format, va);
- va_end (va);
- return ret_val;
-}
-
-dumper::dumper (DWORD pid, DWORD tid, const char *file_name)
-{
- this->file_name = strdup (file_name);
-
- this->pid = pid;
- this->tid = tid;
- core_bfd = NULL;
- excl_list = new exclusion (20);
-
- list = last = NULL;
-
- status_section = NULL;
-
- memory_num = module_num = thread_num = 0;
-
- hProcess = OpenProcess (PROCESS_ALL_ACCESS,
- FALSE, /* no inheritance */
- pid);
- if (!hProcess)
- {
- fprintf (stderr, "Failed to open process #%lu, error %ld\n", pid, GetLastError ());
- return;
- }
-
- init_core_dump ();
-
- if (!sane ())
- dumper_abort ();
-}
-
-dumper::~dumper ()
-{
- close ();
- free (file_name);
-}
-
-void
-dumper::dumper_abort ()
-{
- close ();
- unlink (file_name);
-}
-
-void
-dumper::close ()
-{
- if (core_bfd)
- bfd_close (core_bfd);
- if (excl_list)
- delete excl_list;
- if (hProcess)
- CloseHandle (hProcess);
- core_bfd = NULL;
- hProcess = NULL;
- excl_list = NULL;
-}
-
-int
-dumper::sane ()
-{
- if (hProcess == NULL || core_bfd == NULL || excl_list == NULL)
- return 0;
- return 1;
-}
-
-void
-print_section_name (bfd* abfd, asection* sect, PTR obj)
-{
- deb_printf (" %s", bfd_get_section_name (abfd, sect));
-}
-
-void
-dumper::print_core_section_list ()
-{
- deb_printf ("current sections:");
- bfd_map_over_sections (core_bfd, &print_section_name, NULL);
- deb_printf ("\n");
-}
-
-process_entity *
-dumper::add_process_entity_to_list (process_entity_type type)
-{
- if (!sane ())
- return NULL;
-
- process_entity *new_entity = (process_entity *) malloc (sizeof (process_entity));
- if (new_entity == NULL)
- return NULL;
- new_entity->next = NULL;
- new_entity->section = NULL;
- if (last == NULL)
- list = new_entity;
- else
- last->next = new_entity;
- last = new_entity;
- return new_entity;
-}
-
-int
-dumper::add_thread (DWORD tid, HANDLE hThread)
-{
- if (!sane ())
- return 0;
-
- CONTEXT *pcontext;
-
- process_entity *new_entity = add_process_entity_to_list (pr_ent_thread);
- if (new_entity == NULL)
- return 0;
- new_entity->type = pr_ent_thread;
- thread_num++;
-
- new_entity->u.thread.tid = tid;
- new_entity->u.thread.hThread = hThread;
-
- pcontext = &(new_entity->u.thread.context);
- pcontext->ContextFlags = CONTEXT_FULL | CONTEXT_FLOATING_POINT;
- if (!GetThreadContext (hThread, pcontext))
- {
- deb_printf ("Failed to read thread context (tid=%x), error %ld\n", tid, GetLastError ());
- return 0;
- }
-
- deb_printf ("added thread %u\n", tid);
- return 1;
-}
-
-int
-dumper::add_mem_region (LPBYTE base, DWORD size)
-{
- if (!sane ())
- return 0;
-
- if (base == NULL || size == 0)
- return 1; // just ignore empty regions
-
- process_entity *new_entity = add_process_entity_to_list (pr_ent_memory);
- if (new_entity == NULL)
- return 0;
- new_entity->type = pr_ent_memory;
- memory_num++;
-
- new_entity->u.memory.base = base;
- new_entity->u.memory.size = size;
-
- deb_printf ("added memory region %08x-%08x\n", (DWORD) base, (DWORD) base + size);
- return 1;
-}
-
-/* split_add_mem_region scans list of regions to be excluded from dumping process
- (excl_list) and removes all "excluded" parts from given region. */
-int
-dumper::split_add_mem_region (LPBYTE base, DWORD size)
-{
- if (!sane ())
- return 0;
-
- if (base == NULL || size == 0)
- return 1; // just ignore empty regions
-
- LPBYTE last_base = base;
-
- for (process_mem_region * p = excl_list->region;
- p < excl_list->region + excl_list->last;
- p++)
- {
- if (p->base >= base + size || p->base + p->size <= base)
- continue;
-
- if (p->base <= base)
- {
- last_base = p->base + p->size;
- continue;
- }
-
- add_mem_region (last_base, p->base - last_base);
- last_base = p->base + p->size;
- }
-
- if (last_base < base + size)
- add_mem_region (last_base, base + size - last_base);
-
- return 1;
-}
-
-int
-dumper::add_module (LPVOID base_address)
-{
- if (!sane ())
- return 0;
-
- char *module_name = psapi_get_module_name (hProcess, (DWORD) base_address);
- if (module_name == NULL)
- return 1;
-
- process_entity *new_entity = add_process_entity_to_list (pr_ent_module);
- if (new_entity == NULL)
- return 0;
- new_entity->type = pr_ent_module;
- module_num++;
-
- new_entity->u.module.base_address = base_address;
- new_entity->u.module.name = module_name;
-
- parse_pe (module_name, excl_list);
-
- deb_printf ("added module %08x %s\n", base_address, module_name);
- return 1;
-}
-
-#define PAGE_BUFFER_SIZE 4096
-
-int
-dumper::collect_memory_sections ()
-{
- if (!sane ())
- return 0;
-
- LPBYTE current_page_address;
- LPBYTE last_base = (LPBYTE) 0xFFFFFFFF;
- DWORD last_size = 0;
- DWORD done;
-
- char mem_buf[PAGE_BUFFER_SIZE];
-
- MEMORY_BASIC_INFORMATION mbi;
-
- if (hProcess == NULL)
- return 0;
-
- for (current_page_address = 0; current_page_address < (LPBYTE) 0xFFFF0000;)
- {
- if (!VirtualQueryEx (hProcess, current_page_address, &mbi, sizeof (mbi)))
- break;
-
- int skip_region_p = 0;
-
- if (mbi.Protect & (PAGE_NOACCESS | PAGE_GUARD) ||
- mbi.State != MEM_COMMIT)
- skip_region_p = 1;
-
- if (!skip_region_p)
- {
- /* just to make sure that later we'll be able to read it.
- According to MS docs either region is all-readable or
- all-nonreadable */
- if (!ReadProcessMemory (hProcess, current_page_address, mem_buf, sizeof (mem_buf), &done))
- {
- DWORD err = GetLastError ();
- const char *pt[10];
- pt[0] = (mbi.Protect & PAGE_READONLY) ? "RO " : "";
- pt[1] = (mbi.Protect & PAGE_READWRITE) ? "RW " : "";
- pt[2] = (mbi.Protect & PAGE_WRITECOPY) ? "WC " : "";
- pt[3] = (mbi.Protect & PAGE_EXECUTE) ? "EX " : "";
- pt[4] = (mbi.Protect & PAGE_EXECUTE_READ) ? "EXRO " : "";
- pt[5] = (mbi.Protect & PAGE_EXECUTE_READWRITE) ? "EXRW " : "";
- pt[6] = (mbi.Protect & PAGE_EXECUTE_WRITECOPY) ? "EXWC " : "";
- pt[7] = (mbi.Protect & PAGE_GUARD) ? "GRD " : "";
- pt[8] = (mbi.Protect & PAGE_NOACCESS) ? "NA " : "";
- pt[9] = (mbi.Protect & PAGE_NOCACHE) ? "NC " : "";
- char buf[10 * 6];
- buf[0] = '\0';
- for (int i = 0; i < 10; i++)
- strcat (buf, pt[i]);
-
- deb_printf ("warning: failed to read memory at %08x-%08x (protect = %s), error %ld.\n",
- (DWORD) current_page_address,
- (DWORD) current_page_address + mbi.RegionSize,
- buf, err);
- skip_region_p = 1;
- }
- }
-
- if (!skip_region_p)
- {
- if (last_base + last_size == current_page_address)
- last_size += mbi.RegionSize;
- else
- {
- split_add_mem_region (last_base, last_size);
- last_base = (LPBYTE) mbi.BaseAddress;
- last_size = mbi.RegionSize;
- }
- }
- else
- {
- split_add_mem_region (last_base, last_size);
- last_base = NULL;
- last_size = 0;
- }
-
- current_page_address += mbi.RegionSize;
- }
-
- /* dump last sections, if any */
- split_add_mem_region (last_base, last_size);
- return 1;
-};
-
-int
-dumper::dump_memory_region (asection * to, process_mem_region * memory)
-{
- if (!sane ())
- return 0;
-
- DWORD size = memory->size;
- DWORD todo;
- DWORD done;
- LPBYTE pos = memory->base;
- DWORD sect_pos = 0;
-
- if (to == NULL || memory == NULL)
- return 0;
-
- char mem_buf[PAGE_BUFFER_SIZE];
-
- while (size > 0)
- {
- todo = min (size, PAGE_BUFFER_SIZE);
- if (!ReadProcessMemory (hProcess, pos, mem_buf, todo, &done))
- {
- deb_printf ("Failed to read process memory at %x(%x), error %ld\n", pos, todo, GetLastError ());
- return 0;
- }
- size -= done;
- pos += done;
- if (!bfd_set_section_contents (core_bfd, to, mem_buf, sect_pos, done))
- {
- bfd_perror ("writing memory region to bfd");
- dumper_abort ();
- return 0;
- };
- sect_pos += done;
- }
- return 1;
-}
-
-int
-dumper::dump_thread (asection * to, process_thread * thread)
-{
- if (!sane ())
- return 0;
-
- if (to == NULL || thread == NULL)
- return 0;
-
- win32_pstatus thread_pstatus;
-
- note_header header;
- bfd_putl32 (NOTE_NAME_SIZE, header.elf_note_header.namesz);
- bfd_putl32 (sizeof (thread_pstatus), header.elf_note_header.descsz);
- bfd_putl32 (NT_WIN32PSTATUS, header.elf_note_header.type);
- strncpy ((char *) &header.elf_note_header.name, "win32thread", NOTE_NAME_SIZE);
-
- thread_pstatus.data_type = NOTE_INFO_THREAD;
- thread_pstatus.data.thread_info.tid = thread->tid;
-
- if (tid == 0)
- {
- /* this is a special case. we don't know, which thread
- was active when exception occured, so let's blame
- the first one */
- thread_pstatus.data.thread_info.is_active_thread = TRUE;
- tid = (DWORD) - 1;
- }
- else if (tid > 0 && thread->tid == tid)
- thread_pstatus.data.thread_info.is_active_thread = TRUE;
- else
- thread_pstatus.data.thread_info.is_active_thread = FALSE;
-
- memcpy (&(thread_pstatus.data.thread_info.thread_context),
- &(thread->context),
- sizeof (thread->context));
-
- if (!bfd_set_section_contents (core_bfd, to, &header,
- 0,
- sizeof (header)) ||
- !bfd_set_section_contents (core_bfd, to, &thread_pstatus,
- sizeof (header),
- sizeof (thread_pstatus)))
- {
- bfd_perror ("writing thread info to bfd");
- dumper_abort ();
- return 0;
- };
- return 1;
-}
-
-int
-dumper::dump_module (asection * to, process_module * module)
-{
- if (!sane ())
- return 0;
-
- if (to == NULL || module == NULL)
- return 0;
-
- struct win32_pstatus *module_pstatus_ptr;
-
- int note_length = sizeof (struct win32_pstatus) + strlen (module->name);
-
- char *buf = (char *) malloc (note_length);
-
- if (!buf)
- {
- fprintf (stderr, "Error alloating memory. Dumping aborted.\n");
- goto out;
- };
-
- module_pstatus_ptr = (struct win32_pstatus *) buf;
-
- note_header header;
- bfd_putl32 (NOTE_NAME_SIZE, header.elf_note_header.namesz);
- bfd_putl32 (note_length, header.elf_note_header.descsz);
- bfd_putl32 (NT_WIN32PSTATUS, header.elf_note_header.type);
- strncpy ((char *) &header.elf_note_header.name, "win32module", NOTE_NAME_SIZE);
-
- module_pstatus_ptr->data_type = NOTE_INFO_MODULE;
- module_pstatus_ptr->data.module_info.base_address = module->base_address;
- module_pstatus_ptr->data.module_info.module_name_size = strlen (module->name) + 1;
- strcpy (module_pstatus_ptr->data.module_info.module_name, module->name);
-
- if (!bfd_set_section_contents (core_bfd, to, &header,
- 0,
- sizeof (header)) ||
- !bfd_set_section_contents (core_bfd, to, module_pstatus_ptr,
- sizeof (header),
- note_length))
- {
- bfd_perror ("writing module info to bfd");
- goto out;
- };
- return 1;
-
-out:
- if (buf)
- free (buf);
- dumper_abort ();
- return 0;
-
-}
-
-int
-dumper::collect_process_information ()
-{
- int exception_level = 0;
-
- if (!sane ())
- return 0;
-
- if (!DebugActiveProcess (pid))
- {
- fprintf (stderr, "Cannot attach to process #%lu, error %ld", pid, GetLastError ());
- return 0;
- }
-
- char event_name[sizeof ("cygwin_error_start_event") + 20];
- sprintf (event_name, "cygwin_error_start_event%16lx", pid);
- HANDLE sync_with_debugee = OpenEvent (EVENT_MODIFY_STATE, FALSE, event_name);
-
- DEBUG_EVENT current_event;
-
- while (1)
- {
- if (!WaitForDebugEvent (&current_event, 20000))
- return 0;
-
- deb_printf ("got debug event %d\n", current_event.dwDebugEventCode);
-
- switch (current_event.dwDebugEventCode)
- {
- case CREATE_THREAD_DEBUG_EVENT:
-
- if (!add_thread (current_event.dwThreadId,
- current_event.u.CreateThread.hThread))
- goto failed;
-
- break;
-
- case CREATE_PROCESS_DEBUG_EVENT:
-
- if (!add_module (current_event.u.CreateProcessInfo.lpBaseOfImage) ||
- !add_thread (current_event.dwThreadId,
- current_event.u.CreateProcessInfo.hThread))
- goto failed;
-
- break;
-
- case EXIT_PROCESS_DEBUG_EVENT:
-
- deb_printf ("debugee quits");
- ContinueDebugEvent (current_event.dwProcessId,
- current_event.dwThreadId,
- DBG_CONTINUE);
-
- return 1;
-
- break;
-
- case LOAD_DLL_DEBUG_EVENT:
-
- if (!add_module (current_event.u.LoadDll.lpBaseOfDll))
- goto failed;
-
- break;
-
- case EXCEPTION_DEBUG_EVENT:
-
- exception_level++;
- if (exception_level == 2)
- break;
- else if (exception_level > 2)
- return 0;
-
- collect_memory_sections ();
-
- /* got all info. time to dump */
-
- if (!prepare_core_dump ())
- {
- fprintf (stderr, "Failed to prepare core dump\n");
- goto failed;
- };
-
- if (!write_core_dump ())
- {
- fprintf (stderr, "Failed to write core dump\n");
- goto failed;
- };
-
- /* signal a debugee that we've finished */
- if (sync_with_debugee)
- SetEvent (sync_with_debugee);
-
- break;
-
- default:
-
- break;
-
- }
-
- ContinueDebugEvent (current_event.dwProcessId,
- current_event.dwThreadId,
- DBG_CONTINUE);
- }
-failed:
- /* set debugee free */
- if (sync_with_debugee)
- SetEvent (sync_with_debugee);
-
- return 0;
-}
-
-int
-dumper::init_core_dump ()
-{
- bfd_init ();
-
- core_bfd = bfd_openw (file_name, "elf32-i386");
- if (core_bfd == NULL)
- {
- bfd_perror ("opening bfd");
- goto failed;
- }
-
- if (!bfd_set_format (core_bfd, bfd_core))
- {
- bfd_perror ("setting bfd format");
- goto failed;
- }
-
- if (!bfd_set_arch_mach (core_bfd, bfd_arch_i386, 0))
- {
- bfd_perror ("setting bfd architecture");
- goto failed;
- }
-
- return 1;
-
-failed:
- dumper_abort ();
- return 0;
-
-}
-
-int
-dumper::prepare_core_dump ()
-{
- if (!sane ())
- return 0;
-
- int sect_no = 0;
- char sect_name[50];
-
- flagword sect_flags;
- DWORD sect_size;
- bfd_vma sect_vma;
-
- asection *new_section;
-
- for (process_entity * p = list; p != NULL; p = p->next)
- {
- sect_no++;
-
- unsigned long phdr_type = PT_LOAD;
-
- switch (p->type)
- {
- case pr_ent_memory:
- sprintf (sect_name, ".mem/%u", sect_no);
- sect_flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD;
- sect_size = p->u.memory.size;
- sect_vma = (bfd_vma) (p->u.memory.base);
- phdr_type = PT_LOAD;
- break;
-
- case pr_ent_thread:
- sprintf (sect_name, ".note/%u", sect_no);
- sect_flags = SEC_HAS_CONTENTS | SEC_LOAD;
- sect_size = sizeof (note_header) + sizeof (struct win32_pstatus);
- sect_vma = 0;
- phdr_type = PT_NOTE;
- break;
-
- case pr_ent_module:
- sprintf (sect_name, ".note/%u", sect_no);
- sect_flags = SEC_HAS_CONTENTS | SEC_LOAD;
- sect_size = sizeof (note_header) + sizeof (struct win32_pstatus) +
- (bfd_size_type) (strlen (p->u.module.name));
- sect_vma = 0;
- phdr_type = PT_NOTE;
- break;
-
- default:
- continue;
- }
-
- if (p->type == pr_ent_module && status_section != NULL)
- {
- if (!bfd_set_section_size (core_bfd,
- status_section,
- (bfd_get_section_size (status_section)
- + sect_size)))
- {
- bfd_perror ("resizing status section");
- goto failed;
- };
- continue;
- }
-
- deb_printf ("creating section (type%u) %s(%u), flags=%08x\n",
- p->type, sect_name, sect_size, sect_flags);
-
- bfd_set_error (bfd_error_no_error);
- char *buf = strdup (sect_name);
- new_section = bfd_make_section (core_bfd, buf);
- if (new_section == NULL)
- {
- if (bfd_get_error () == bfd_error_no_error)
- fprintf (stderr, "error creating new section (%s), section already exists.\n", buf);
- else
- bfd_perror ("creating section");
- goto failed;
- }
-
- if (!bfd_set_section_flags (core_bfd, new_section, sect_flags) ||
- !bfd_set_section_size (core_bfd, new_section, sect_size))
- {
- bfd_perror ("setting section attributes");
- goto failed;
- };
-
- new_section->vma = sect_vma;
- new_section->lma = 0;
- new_section->output_section = new_section;
- new_section->output_offset = 0;
- p->section = new_section;
- int section_count = 1;
-
- bfd_boolean filehdr = 0;
- bfd_boolean phdrs = 0;
-
- bfd_vma at = 0;
- bfd_boolean valid_at = 0;
-
- flagword flags = 0;
- bfd_boolean valid_flags = 1;
-
- if (p->type == pr_ent_memory)
- {
- MEMORY_BASIC_INFORMATION mbi;
- if (!VirtualQueryEx (hProcess, (LPVOID)sect_vma, &mbi, sizeof (mbi)))
- {
- bfd_perror ("getting mem region flags");
- goto failed;
- }
-
- static const struct
- {
- DWORD protect;
- flagword flags;
- } mappings[] =
- {
- { PAGE_READONLY, PF_R },
- { PAGE_READWRITE, PF_R | PF_W },
- { PAGE_WRITECOPY, PF_W },
- { PAGE_EXECUTE, PF_X },
- { PAGE_EXECUTE_READ, PF_X | PF_R },
- { PAGE_EXECUTE_READWRITE, PF_X | PF_R | PF_W },
- { PAGE_EXECUTE_WRITECOPY, PF_X | PF_W }
- };
-
- for (size_t i = 0;
- i < sizeof (mappings) / sizeof (mappings[0]);
- i++)
- if ((mbi.Protect & mappings[i].protect) != 0)
- flags |= mappings[i].flags;
- }
-
- if (!bfd_record_phdr (core_bfd, phdr_type,
- valid_flags, flags,
- valid_at, at,
- filehdr, phdrs,
- section_count, &new_section))
- {
- bfd_perror ("recording program headers");
- goto failed;
- }
- }
- return 1;
-
-failed:
- dumper_abort ();
- return 0;
-}
-
-int
-dumper::write_core_dump ()
-{
- if (!sane ())
- return 0;
-
- for (process_entity * p = list; p != NULL; p = p->next)
- {
- if (p->section == NULL)
- continue;
-
- deb_printf ("writing section type=%u base=%08x size=%08x flags=%08x\n",
- p->type,
- p->section->vma,
- bfd_get_section_size (p->section),
- p->section->flags);
-
- switch (p->type)
- {
- case pr_ent_memory:
- dump_memory_region (p->section, &(p->u.memory));
- break;
-
- case pr_ent_thread:
- dump_thread (p->section, &(p->u.thread));
- break;
-
- case pr_ent_module:
- dump_module (p->section, &(p->u.module));
- break;
-
- default:
- continue;
-
- }
- }
- return 1;
-}
-
-static void
-usage (FILE *stream, int status)
-{
- fprintf (stream, "\
-Usage: dumper [OPTION] FILENAME WIN32PID\n\
-Dump core from WIN32PID to FILENAME.core\n\
-\n\
- -d, --verbose be verbose while dumping\n\
- -h, --help output help information and exit\n\
- -q, --quiet be quiet while dumping (default)\n\
- -v, --version output version information and exit\n\
-");
- exit (status);
-}
-
-struct option longopts[] = {
- {"verbose", no_argument, NULL, 'd'},
- {"help", no_argument, NULL, 'h'},
- {"quiet", no_argument, NULL, 'q'},
- {"version", no_argument, 0, 'v'},
- {0, no_argument, NULL, 0}
-};
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-dumper (cygwin) %.*s\n\
-Core Dumper for Cygwin\n\
-Copyright 1999, 2001, 2002 Red Hat, Inc.\n", len, v);
-}
-
-int
-main (int argc, char **argv)
-{
- int opt;
- const char *p = "";
- DWORD pid;
-
- while ((opt = getopt_long (argc, argv, "dqhv", longopts, NULL) ) != EOF)
- switch (opt)
- {
- case 'd':
- verbose = TRUE;
- break;
- case 'q':
- verbose = FALSE;
- break;
- case 'h':
- usage (stdout, 0);
- case 'v':
- print_version ();
- exit (0);
- default:
- usage (stderr, 1);
- break;
- }
-
- if (argv && *(argv + optind) && *(argv + optind +1))
- {
- ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE,
- *(argv + optind), NULL, 0);
- char *win32_name = (char *) alloca (len);
- cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, *(argv + optind),
- win32_name, len);
- if ((p = strrchr (win32_name, '\\')))
- p++;
- else
- p = win32_name;
- pid = strtoul (*(argv + optind + 1), NULL, 10);
- }
- else
- {
- usage (stderr, 1);
- return -1;
- }
-
- char *core_file = (char *) malloc (strlen (p) + sizeof (".core"));
- if (!core_file)
- {
- fprintf (stderr, "error allocating memory\n");
- return -1;
- }
- sprintf (core_file, "%s.core", p);
-
- DWORD tid = 0;
-
- if (verbose)
- printf ("dumping process #%lu to %s\n", pid, core_file);
-
- dumper d (pid, tid, core_file);
- if (!d.sane ())
- return -1;
- d.collect_process_information ();
- free (core_file);
-
- return 0;
-};
diff --git a/winsup/utils/dumper.h b/winsup/utils/dumper.h
deleted file mode 100644
index 4b8d2bdf7..000000000
--- a/winsup/utils/dumper.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* dumper.h
-
- Copyright 1999,2001 Red Hat Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- This file is part of Cygwin.
-
- 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 (file COPYING.dumper) 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. */
-
-#ifndef _DUMPER_H_
-#define _DUMPER_H_
-
-#include <windows.h>
-
-typedef struct
-{
- LPBYTE base;
- DWORD size;
-} process_mem_region;
-
-typedef struct
-{
- DWORD tid;
- HANDLE hThread;
- CONTEXT context;
-} process_thread;
-
-typedef struct
-{
- LPVOID base_address;
- char* name;
-} process_module;
-
-enum process_entity_type
-{
- pr_ent_memory,
- pr_ent_thread,
- pr_ent_module
-};
-
-typedef struct _process_entity
-{
- process_entity_type type;
- union
- {
- process_thread thread;
- process_mem_region memory;
- process_module module;
- } u;
- asection* section;
- struct _process_entity* next;
-} process_entity;
-
-class exclusion
-{
-public:
- int last;
- int size;
- int step;
- process_mem_region* region;
-
- exclusion ( int step ) { last = size = 0;
- this->step = step;
- region = NULL; }
- ~exclusion () { free ( region ); }
- int add ( LPBYTE mem_base, DWORD mem_size );
- int sort_and_check ();
-};
-
-#define PAGE_BUFFER_SIZE 4096
-
-class dumper
-{
- DWORD pid;
- DWORD tid; /* thread id of active thread */
- HANDLE hProcess;
- process_entity* list;
- process_entity* last;
- exclusion* excl_list;
-
- char* file_name;
- bfd* core_bfd;
-
- asection* status_section;
-
- int memory_num;
- int module_num;
- int thread_num;
-
- void close ();
- void dumper_abort ();
-
- process_entity* add_process_entity_to_list ( process_entity_type type );
- int add_thread ( DWORD tid, HANDLE hThread );
- int add_mem_region ( LPBYTE base, DWORD size );
-
- /* break mem_region by excl_list and add add all subregions */
- int split_add_mem_region ( LPBYTE base, DWORD size );
-
- int add_module ( LPVOID base_address );
-
- int collect_memory_sections ();
- int dump_memory_region ( asection* to, process_mem_region* memory );
- int dump_thread ( asection* to, process_thread* thread );
- int dump_module ( asection* to, process_module* module );
-
-public:
- int sane ();
-
- int collect_process_information ();
- void print_core_section_list ();
-
- dumper ( DWORD pid, DWORD tid, const char* name );
- ~dumper ();
-
- int init_core_dump ();
- int prepare_core_dump ();
- int write_core_dump ();
-};
-
-extern int deb_printf ( const char* format, ... );
-
-extern char* psapi_get_module_name ( HANDLE hProcess, DWORD BaseAddress );
-
-extern int parse_pe ( const char* file_name, exclusion* excl_list );
-
-extern BOOL verbose;
-
-#endif
diff --git a/winsup/utils/getfacl.c b/winsup/utils/getfacl.c
deleted file mode 100644
index 0afcd698d..000000000
--- a/winsup/utils/getfacl.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* getfacl.c
-
- Copyright 2000, 2001, 2002 Red Hat Inc.
-
- Written by Corinna Vinschen <vinschen@redhat.com>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <pwd.h>
-#include <grp.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/types.h>
-#include <sys/acl.h>
-#include <sys/stat.h>
-#include <string.h>
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-char *
-permstr (mode_t perm)
-{
- static char pbuf[4];
-
- pbuf[0] = (perm & S_IROTH) ? 'r' : '-';
- pbuf[1] = (perm & S_IWOTH) ? 'w' : '-';
- pbuf[2] = (perm & S_IXOTH) ? 'x' : '-';
- pbuf[3] = '\0';
- return pbuf;
-}
-
-const char *
-username (uid_t uid)
-{
- static char ubuf[256];
- struct passwd *pw;
-
- if ((pw = getpwuid (uid)))
- strcpy (ubuf, pw->pw_name);
- else
- sprintf (ubuf, "%lu <unknown>", (unsigned long)uid);
- return ubuf;
-}
-
-const char *
-groupname (gid_t gid)
-{
- static char gbuf[256];
- struct group *gr;
-
- if ((gr = getgrgid (gid)))
- strcpy (gbuf, gr->gr_name);
- else
- sprintf (gbuf, "%lu <unknown>", (unsigned long)gid);
- return gbuf;
-}
-
-static void
-usage (FILE * stream)
-{
- fprintf (stream, "Usage: %s [-adn] FILE [FILE2...]\n"
- "Display file and directory access control lists (ACLs).\n"
- "\n"
- " -a, --all display the filename, the owner, the group, and\n"
- " the ACL of the file\n"
- " -d, --dir display the filename, the owner, the group, and\n"
- " the default ACL of the directory, if it exists\n"
- " -h, --help output usage information and exit\n"
- " -n, --noname display user and group IDs instead of names\n"
- " -v, --version output version information and exit\n"
- "\n"
- "When multiple files are specified on the command line, a blank\n"
- "line separates the ACLs for each file.\n", prog_name);
- if (stream == stdout)
- {
- fprintf (stream, ""
- "For each argument that is a regular file, special file or\n"
- "directory, getfacl displays the owner, the group, and the ACL.\n"
- "For directories getfacl displays additionally the default ACL.\n"
- "\n"
- "With no options specified, getfacl displays the filename, the\n"
- "owner, the group, and both the ACL and the default ACL, if it\n"
- "exists.\n"
- "\n"
- "The format for ACL output is as follows:\n"
- " # file: filename\n"
- " # owner: name or uid\n"
- " # group: name or uid\n"
- " user::perm\n"
- " user:name or uid:perm\n"
- " group::perm\n"
- " group:name or gid:perm\n"
- " mask:perm\n"
- " other:perm\n"
- " default:user::perm\n"
- " default:user:name or uid:perm\n"
- " default:group::perm\n"
- " default:group:name or gid:perm\n"
- " default:mask:perm\n"
- " default:other:perm\n"
- "\n");
- }
-}
-
-struct option longopts[] = {
- {"all", no_argument, NULL, 'a'},
- {"dir", no_argument, NULL, 'd'},
- {"help", no_argument, NULL, 'h'},
- {"noname", no_argument, NULL, 'n'},
- {"version", no_argument, NULL, 'v'},
- {0, no_argument, NULL, 0}
-};
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-getfacl (cygwin) %.*s\n\
-ACL Utility\n\
-Copyright (c) 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s\n\
-", len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int c, i;
- int aopt = 0;
- int dopt = 0;
- int nopt = 0;
- int first = 1;
- struct stat st;
- aclent_t acls[MAX_ACL_ENTRIES];
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- while ((c = getopt_long (argc, argv, "adhnv", longopts, NULL)) != EOF)
- switch (c)
- {
- case 'a':
- aopt = 1;
- break;
- case 'd':
- dopt = 1;
- break;
- case 'h':
- usage (stdout);
- return 0;
- case 'n':
- nopt = 1;
- break;
- case 'v':
- print_version ();
- return 0;
- default:
- usage (stderr);
- return 1;
- }
- if (optind > argc - 1)
- {
- usage (stderr);
- return 1;
- }
- while ((c = optind++) < argc)
- {
- if (stat (argv[c], &st))
- {
- perror (argv[0]);
- continue;
- }
- if (!first)
- putchar ('\n');
- first = 0;
- printf ("# file: %s\n", argv[c]);
- if (nopt)
- {
- printf ("# owner: %lu\n", (unsigned long)st.st_uid);
- printf ("# group: %lu\n", (unsigned long)st.st_gid);
- }
- else
- {
- printf ("# owner: %s\n", username (st.st_uid));
- printf ("# group: %s\n", groupname (st.st_gid));
- }
- if ((c = acl (argv[c], GETACL, MAX_ACL_ENTRIES, acls)) < 0)
- {
- perror (argv[0]);
- continue;
- }
- for (i = 0; i < c; ++i)
- {
- if (acls[i].a_type & ACL_DEFAULT)
- {
- if (aopt)
- continue;
- printf ("default:");
- }
- else if (dopt)
- continue;
- switch (acls[i].a_type & ~ACL_DEFAULT)
- {
- case USER_OBJ:
- printf ("user::");
- break;
- case USER:
- if (nopt)
- printf ("user:%lu:", (unsigned long)acls[i].a_id);
- else
- printf ("user:%s:", username (acls[i].a_id));
- break;
- case GROUP_OBJ:
- printf ("group::");
- break;
- case GROUP:
- if (nopt)
- printf ("group:%lu:", (unsigned long)acls[i].a_id);
- else
- printf ("group:%s:", groupname (acls[i].a_id));
- break;
- case CLASS_OBJ:
- printf ("mask:");
- break;
- case OTHER_OBJ:
- printf ("other:");
- break;
- }
- printf ("%s\n", permstr (acls[i].a_perm));
- }
- }
- return 0;
-}
diff --git a/winsup/utils/kill.cc b/winsup/utils/kill.cc
deleted file mode 100644
index f43ef7762..000000000
--- a/winsup/utils/kill.cc
+++ /dev/null
@@ -1,302 +0,0 @@
-/* kill.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <signal.h>
-#include <string.h>
-#include <time.h>
-#include <errno.h>
-#include <windows.h>
-#include <sys/cygwin.h>
-#include <getopt.h>
-#include <limits.h>
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-static struct option longopts[] =
-{
- {"help", no_argument, NULL, 'h' },
- {"list", optional_argument, NULL, 'l'},
- {"force", no_argument, NULL, 'f'},
- {"signal", required_argument, NULL, 's'},
- {"version", no_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "hl::fs:v";
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where , ""
- "Usage: %s [-f] [-signal] [-s signal] pid1 [pid2 ...]\n"
- " %s -l [signal]\n"
- "Send signals to processes\n"
- "\n"
- " -f, --force force, using win32 interface if necessary\n"
- " -l, --list print a list of signal names\n"
- " -s, --signal send signal (use %s --list for a list)\n"
- " -h, --help output usage information and exit\n"
- " -v, --version output version information and exit\n"
- "", prog_name, prog_name, prog_name);
- exit (where == stderr ? 1 : 0);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Process Signaller\n\
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s\n\
-", prog_name, len, v, __DATE__);
-}
-
-static const char *
-strsigno (int signo)
-{
- if (signo >= 0 && signo < NSIG)
- return sys_sigabbrev[signo];
- static char buf[sizeof ("Unknown signal") + 32];
- sprintf (buf, "Unknown signal %d", signo);
- return buf;
-}
-
-static int
-getsig (const char *in_sig)
-{
- const char *sig;
- char buf[80];
- int intsig;
-
- if (strncmp (in_sig, "SIG", 3) == 0)
- sig = in_sig;
- else
- {
- sprintf (buf, "SIG%-.20s", in_sig);
- sig = buf;
- }
- intsig = strtosigno (sig) ?: atoi (in_sig);
- char *p;
- if (!intsig && (strcmp (buf, "SIG0") != 0 && (strtol (in_sig, &p, 10) != 0 || *p)))
- intsig = -1;
- return intsig;
-}
-
-static void
-test_for_unknown_sig (int sig, const char *sigstr)
-{
- if (sig < 0 || sig > NSIG)
- {
- fprintf (stderr, "%s: unknown signal: %s\n", prog_name, sigstr);
- usage ();
- exit (1);
- }
-}
-
-static void
-listsig (const char *in_sig)
-{
- int sig;
- if (!in_sig)
- for (sig = 1; sig < NSIG - 1; sig++)
- printf ("%s%c", strsigno (sig) + 3, (sig < NSIG - 1) ? ' ' : '\n');
- else
- {
- sig = getsig (in_sig);
- test_for_unknown_sig (sig, in_sig);
- if (atoi (in_sig) == sig)
- puts (strsigno (sig) + 3);
- else
- printf ("%d\n", sig);
- }
-}
-
-static void
-get_debug_priv (void)
-{
- HANDLE tok;
- LUID luid;
- TOKEN_PRIVILEGES tkp;
-
- if (!OpenProcessToken (GetCurrentProcess (),
- TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &tok))
- return;
-
- if (!LookupPrivilegeValue (NULL, SE_DEBUG_NAME, &luid))
- {
- CloseHandle (tok);
- return;
- }
-
- tkp.PrivilegeCount = 1;
- tkp.Privileges[0].Luid = luid;
- tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-
- AdjustTokenPrivileges (tok, FALSE, &tkp, sizeof tkp, NULL, NULL);
-
- CloseHandle (tok);
-}
-
-static void __stdcall
-forcekill (int pid, int sig, int wait)
-{
- // try to acquire SeDebugPrivilege
- get_debug_priv();
-
- external_pinfo *p = NULL;
- /* cygwin_internal misinterprets negative pids (Win9x pids) */
- if (pid > 0)
- p = (external_pinfo *) cygwin_internal (CW_GETPINFO_FULL, pid);
- DWORD dwpid = p ? p->dwProcessId : (DWORD) pid;
- HANDLE h = OpenProcess (PROCESS_TERMINATE, FALSE, (DWORD) dwpid);
- if (!h)
- {
- if (!wait || GetLastError () != ERROR_INVALID_PARAMETER)
- fprintf (stderr, "%s: couldn't open pid %u\n",
- prog_name, (unsigned) dwpid);
- return;
- }
- if (!wait || WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
- if (sig && !TerminateProcess (h, sig << 8)
- && WaitForSingleObject (h, 200) != WAIT_OBJECT_0)
- fprintf (stderr, "%s: couldn't kill pid %u, %lu\n",
- prog_name, (unsigned) dwpid, GetLastError ());
- CloseHandle (h);
-}
-
-int
-main (int argc, char **argv)
-{
- int sig = SIGTERM;
- int force = 0;
- int ret = 0;
- char *gotasig = NULL;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- if (argc == 1)
- usage ();
-
- opterr = 0;
-
- char *p;
- long long int pid = 0;
-
- for (;;)
- {
- int ch;
- char **av = argv + optind;
- if ((ch = getopt_long (argc, argv, opts, longopts, NULL)) == EOF)
- break;
- switch (ch)
- {
- case 's':
- gotasig = optarg;
- sig = getsig (gotasig);
- break;
- case 'l':
- if (!optarg)
- {
- optarg = argv[optind];
- if (optarg)
- {
- optind++;
- optreset = 1;
- }
- }
- if (argv[optind])
- usage ();
- listsig (optarg);
- break;
- case 'f':
- force = 1;
- break;
- case 'h':
- usage (stdout);
- break;
- case 'v':
- print_version ();
- break;
- case '?':
- if (gotasig)
- {
- pid = strtoll (argv[optind], &p, 10);
- if (pid < 0)
- goto out;
- usage ();
- }
- optreset = 1;
- optind = 1 + av - argv;
- gotasig = *av + 1;
- sig = getsig (gotasig);
- break;
- default:
- usage ();
- break;
- }
- }
-
-out:
- test_for_unknown_sig (sig, gotasig);
-
- argv += optind;
- while (*argv != NULL)
- {
- if (!pid)
- pid = strtoll (*argv, &p, 10);
- if (*p != '\0'
- || (!force && (pid < LONG_MIN || pid > LONG_MAX))
- || (force && (pid <= 0 || pid > ULONG_MAX)))
- {
- fprintf (stderr, "%s: illegal pid: %s\n", prog_name, *argv);
- ret = 1;
- }
- else if (pid <= LONG_MAX && kill ((pid_t) pid, sig) == 0)
- {
- if (force)
- forcekill ((pid_t) pid, sig, 1);
- }
- else if (force)
- forcekill ((pid_t) pid, sig, 0);
- else
- {
- char buf[1000];
- sprintf (buf, "%s: %lld", prog_name, pid);
- perror (buf);
- ret = 1;
- }
- argv++;
- pid = 0;
- }
- return ret;
-}
-
diff --git a/winsup/utils/mingw b/winsup/utils/mingw
deleted file mode 100755
index 63bfb02ae..000000000
--- a/winsup/utils/mingw
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/sh
-# Front-end kludge to cause a Cygwin gcc to default to
-# an installed version of the MinGW components.
-
-#
-# Find the path to the compiler.
-#
-compiler=$1; shift
-dir=$(cd $(dirname $("$compiler" -print-prog-name=ld))/../..; pwd)
-
-#
-# The mingw32 directory should live somewhere close by to the
-# compiler. Search for it.
-#
-[ "$dir" = '/' ] && dir=''
-mingw_dir=''
-for d in "$dir"/*-mingw32 "$dir"/usr/*-mingw32 "$dir"/*-mingw* "$dir"/usr/*-mingw*; do
- case "$d" in
- *\**) continue ;;
- *) mingw_dir=$d; break;
- esac
-done
-
-if [ -z "$mingw_dir" ]; then
- echo "$0: couldn't find i686-pc-mingw32 directory" 1>&2
- exit 1
-fi
-
-#
-# Inspect each argument throwing away ones that seem to try to include the
-# Cygwin environment.
-#
-newargs=()
-sawcomp() { return 1; }
-sawcfile() { return 1; }
-sawofile() { return 1; }
-sawshared() { return 1; }
-sawnostdinc() { return 1; }
-sawnostdlib() { return 1; }
-eatnext() { return 1; }
-pushnext() { return 1; }
-for f do
- if eatnext; then
- eatnext() { return 1; }
- continue;
- fi
- if pushnext; then
- pushnext() { return 1; }
- else
- case "$f" in
- *cygwin/include*|*newlib|-mno-cygwin) continue ;;
- -c|-E) sawcomp() { return 0; } ;;
- -xc*) sawcfile() { return 0; } ;;
- -isystem) eatnext() { return 0; }; continue ;;
- -o) pushnext() { return 0; } ;;
- -nostdinc*) sawnostdinc() { return 0; } ;;
- -nostdlib) sawnostdlib() { return 0; } ;;
- -shared|-Wl,-shared) sawshared() { return 0; } ;;
- -*) ;;
- *.cc|*.c|*.s|*.S|*.i|*.ii) sawcfile() { return 0; } ;;
- *.o) sawofile() { return 0; };;
- esac
- fi
- newargs[${#newargs[*]}]="$f"
-done
-
-# Set up a new set of arguments + also search the installed mingw
-# directory.
-set -- -B"$mingw_dir"/lib/ "${newargs[@]}"
-
-# Add some default options depending on whether this looks like
-# an attempt to link, compile, or both.
-if sawcomp || sawcfile; then
- ccdir=$(dirname $($compiler -print-libgcc-file-name))
- sawnostdinc || set -- -isystem "$ccdir"/include -I"${mingw_dir}"/include "$@"
- set -- -D__MINGW32__ -D__MSVCRT__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -U__CYGWIN__ -Uunix -U__unix__ -U__unix -U __CYGWIN32__ "$@"
- if ! sawnostdinc; then
- case "$compiler" in
- *++*) set -- -nostdinc++ "$@" ;;
- *) set -- -nostdinc "$@" ;;
- esac
- fi
-fi
-
-if sawofile || ! sawcfile || ! sawcomp; then
- w32api=$($compiler -print-file-name=libc.a)
- w32api=$(cd $(dirname "$w32api")/w32api; pwd)
- set -- -Wl,-nostdlib -L"${w32api}" "$@"
- ! sawnostdlib && set -- -nostdlib "$@" -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -lmingw32 -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
- ! sawnostdlib && ! sawshared && { sawofile || sawcfile; } && set -- "$mingw_dir"/lib/crt2.o "$@"
-fi
-
-# Execute the compiler with new mingw-specific options.
-exec $compiler "$@"
diff --git a/winsup/utils/mkgroup.c b/winsup/utils/mkgroup.c
deleted file mode 100644
index 3a3376f97..000000000
--- a/winsup/utils/mkgroup.c
+++ /dev/null
@@ -1,907 +0,0 @@
-/* mkgroup.c:
-
- Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- 2007, 2008 Red Hat, Inc.
-
- This file is part of Cygwin.
-
- This software is a copyrighted work licensed under the terms of the
- Cygwin license. Please consult the file "CYGWIN_LICENSE" for
- details. */
-
-#define _WIN32_WINNT 0x0600
-#include <ctype.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <io.h>
-#include <sys/fcntl.h>
-#include <sys/cygwin.h>
-#include <windows.h>
-#include <lm.h>
-#include <wininet.h>
-#include <iptypes.h>
-#include <ntsecapi.h>
-#include <dsgetdc.h>
-#include <ntdef.h>
-
-#define print_win_error(x) _print_win_error(x, __LINE__)
-
-#define MAX_SID_LEN 40
-
-static const char version[] = "$Revision$";
-
-extern char *__progname;
-
-SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
-SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
-
-NET_API_STATUS WINAPI (*dsgetdcname)(LPWSTR,LPWSTR,GUID*,LPWSTR,ULONG,PDOMAIN_CONTROLLER_INFOW*);
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-
-typedef struct
-{
- char *str;
- DWORD id_offset;
- BOOL domain;
- BOOL with_dom;
-} domlist_t;
-
-static void
-_print_win_error (DWORD code, int line)
-{
- char buf[4096];
-
- if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- code,
- MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) buf, sizeof (buf), NULL))
- fprintf (stderr, "mkgroup (%d): [%lu] %s", line, code, buf);
- else
- fprintf (stderr, "mkgroup (%d): error %lu", line, code);
-}
-
-static void
-load_dsgetdcname ()
-{
- HANDLE h = LoadLibrary ("netapi32.dll");
- if (h)
- dsgetdcname = (void *) GetProcAddress (h, "DsGetDcNameW");
-}
-
-static PWCHAR
-get_dcname (char *domain)
-{
- static WCHAR server[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- DWORD rc;
- PWCHAR servername;
- WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1];
- PDOMAIN_CONTROLLER_INFOW pdci = NULL;
-
- if (dsgetdcname)
- {
- if (domain)
- {
- mbstowcs (domain_name, domain, strlen (domain) + 1);
- rc = dsgetdcname (NULL, domain_name, NULL, NULL, 0, &pdci);
- }
- else
- rc = dsgetdcname (NULL, NULL, NULL, NULL, 0, &pdci);
- if (rc != ERROR_SUCCESS)
- {
- print_win_error (rc);
- return (PWCHAR) -1;
- }
- wcscpy (server, pdci->DomainControllerName);
- NetApiBufferFree (pdci);
- }
- else
- {
- rc = NetGetDCName (NULL, NULL, (void *) &servername);
- if (rc == ERROR_SUCCESS && domain)
- {
- LPWSTR server = servername;
- mbstowcs (domain_name, domain, strlen (domain) + 1);
- rc = NetGetDCName (server, domain_name, (void *) &servername);
- NetApiBufferFree (server);
- }
- if (rc != ERROR_SUCCESS)
- {
- print_win_error(rc);
- return (PWCHAR) -1;
- }
- wcscpy (server, servername);
- NetApiBufferFree ((PVOID) servername);
- }
- return server;
-}
-
-static char *
-put_sid (PSID psid)
-{
- static char s[512];
- char t[32];
- DWORD i;
-
- strcpy (s, "S-1-");
- sprintf(t, "%u", GetSidIdentifierAuthority (psid)->Value[5]);
- strcat (s, t);
- for (i = 0; i < *GetSidSubAuthorityCount (psid); ++i)
- {
- sprintf(t, "-%lu", *GetSidSubAuthority (psid, i));
- strcat (s, t);
- }
- return s;
-}
-
-typedef struct {
- BYTE Revision;
- BYTE SubAuthorityCount;
- SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
- DWORD SubAuthority[8];
-} DBGSID, *PDBGSID;
-
-#define MAX_BUILTIN_SIDS 100 /* Should be enough for the forseable future. */
-DBGSID builtin_sid_list[MAX_BUILTIN_SIDS];
-DWORD builtin_sid_cnt;
-
-typedef struct {
- PSID psid;
- int buffer[10];
-} sidbuf;
-
-static sidbuf curr_pgrp;
-static BOOL got_curr_pgrp = FALSE;
-
-static void
-fetch_current_pgrp_sid ()
-{
- DWORD len;
- HANDLE ptok;
-
- if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &ptok)
- || !GetTokenInformation (ptok, TokenPrimaryGroup, &curr_pgrp,
- sizeof curr_pgrp, &len)
- || !CloseHandle (ptok))
- {
- print_win_error (GetLastError ());
- return;
- }
-}
-
-static void
-current_group (const char *sep, DWORD id_offset)
-{
- WCHAR grp[GNLEN + 1];
- WCHAR dom[MAX_DOMAIN_NAME_LEN + 1];
- DWORD glen = GNLEN + 1;
- DWORD dlen = MAX_DOMAIN_NAME_LEN + 1;
- int gid;
- SID_NAME_USE acc_type;
-
- if (!curr_pgrp.psid
- || !LookupAccountSidW (NULL, curr_pgrp.psid, grp, &glen, dom, &dlen,
- &acc_type))
- {
- print_win_error (GetLastError ());
- return;
- }
- gid = *GetSidSubAuthority (curr_pgrp.psid,
- *GetSidSubAuthorityCount(curr_pgrp.psid) - 1);
- printf ("%ls%s%ls:%s:%lu:\n",
- sep ? dom : L"",
- sep ?: "",
- grp,
- put_sid (curr_pgrp.psid),
- id_offset + gid);
-}
-
-static void
-enum_unix_groups (domlist_t *dom_or_machine, const char *sep, DWORD id_offset,
- char *unix_grp_list)
-{
- WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- PWCHAR servername = NULL;
- char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL;
- BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE;
- SID_IDENTIFIER_AUTHORITY auth = { { 0, 0, 0, 0, 0, 22 } };
- char *gstr, *grp_list;
- WCHAR grp[GNLEN + sizeof ("Unix Group\\") + 1];
- WCHAR dom[MAX_DOMAIN_NAME_LEN + 1];
- DWORD glen, dlen, sidlen;
- PSID psid;
- char psid_buffer[MAX_SID_LEN];
- SID_NAME_USE acc_type;
-
- if (!d_or_m)
- return;
-
- int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
- {
- fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
- __progname, d_or_m);
- return;
- }
- servername = machine;
-
- if (!AllocateAndInitializeSid (&auth, 2, 2, 0, 0, 0, 0, 0, 0, 0, &psid))
- return;
-
- if (!(grp_list = strdup (unix_grp_list)))
- {
- FreeSid (psid);
- return;
- }
-
- for (gstr = strtok (grp_list, ","); gstr; gstr = strtok (NULL, ","))
- {
- if (!isdigit (gstr[0]) && gstr[0] != '-')
- {
- PWCHAR p = wcpcpy (grp, L"Unix Group\\");
- ret = mbstowcs (p, gstr, GNLEN + 1);
- if (ret < 1 || ret >= GNLEN + 1)
- fprintf (stderr, "%s: Invalid group name '%s'. Skipping...\n",
- __progname, gstr);
- else if (LookupAccountNameW (servername, grp,
- psid = (PSID) psid_buffer,
- (sidlen = MAX_SID_LEN, &sidlen),
- dom,
- (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen),
- &acc_type))
- printf ("%s%s%ls:%s:%lu:\n",
- with_dom ? "Unix Group" : "",
- with_dom ? sep : "",
- p,
- put_sid (psid),
- id_offset +
- *GetSidSubAuthority (psid,
- *GetSidSubAuthorityCount(psid) - 1));
- }
- else
- {
- DWORD start, stop;
- char *p = gstr;
- if (*p == '-')
- start = 0;
- else
- start = strtol (p, &p, 10);
- if (!*p)
- stop = start;
- else if (*p++ != '-' || !isdigit (*p)
- || (stop = strtol (p, &p, 10)) < start || *p)
- {
- fprintf (stderr, "%s: Malformed unix group list entry '%s'. "
- "Skipping...\n", __progname, gstr);
- continue;
- }
- for (; start <= stop; ++ start)
- {
- *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1)
- = start;
- if (LookupAccountSidW (servername, psid,
- grp, (glen = GNLEN + 1, &glen),
- dom,
- (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen),
- &acc_type)
- && !iswdigit (grp[0]))
- printf ("%s%s%ls:%s:%lu:\n",
- with_dom ? "Unix Group" : "",
- with_dom ? sep : "",
- grp,
- put_sid (psid),
- id_offset + start);
- }
- }
- }
-
- free (grp_list);
- FreeSid (psid);
-}
-
-static int
-enum_local_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
- DWORD id_offset, char *disp_groupname, int print_builtin,
- int print_current)
-{
- WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- PWCHAR servername = NULL;
- char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL;
- BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE;
- LOCALGROUP_INFO_0 *buffer;
- DWORD entriesread = 0;
- DWORD totalentries = 0;
- DWORD resume_handle = 0;
- WCHAR gname[GNLEN + 1];
- DWORD rc;
-
- if (domain)
- {
- servername = get_dcname (d_or_m);
- if (servername == (PWCHAR) -1)
- return 1;
- }
- else if (d_or_m)
- {
- int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
- {
- fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
- __progname, d_or_m);
- return 1;
- }
- servername = machine;
- }
-
- do
- {
- DWORD i;
-
- if (disp_groupname != NULL)
- {
- mbstowcs (gname, disp_groupname, GNLEN + 1);
- rc = NetLocalGroupGetInfo (servername, gname, 0, (void *) &buffer);
- if (rc == ERROR_SUCCESS)
- entriesread = 1;
- }
- else
- rc = NetLocalGroupEnum (servername, 0, (void *) &buffer,
- MAX_PREFERRED_LENGTH, &entriesread,
- &totalentries, &resume_handle);
- switch (rc)
- {
- case ERROR_ACCESS_DENIED:
- print_win_error (rc);
- return 1;
-
- case ERROR_MORE_DATA:
- case ERROR_SUCCESS:
- break;
-
- default:
- print_win_error (rc);
- return 1;
- }
-
- for (i = 0; i < entriesread; i++)
- {
- WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1];
- DWORD domname_len = MAX_DOMAIN_NAME_LEN + 1;
- char psid_buffer[MAX_SID_LEN];
- PSID psid = (PSID) psid_buffer;
- DWORD sid_length = MAX_SID_LEN;
- DWORD gid;
- SID_NAME_USE acc_type;
- PDBGSID pdsid;
- BOOL is_builtin = FALSE;
-
- if (!LookupAccountNameW (servername, buffer[i].lgrpi0_name, psid,
- &sid_length, domain_name, &domname_len,
- &acc_type))
- {
- print_win_error (GetLastError ());
- fprintf (stderr, " (%ls)\n", buffer[i].lgrpi0_name);
- continue;
- }
- else if (acc_type == SidTypeDomain)
- {
- WCHAR domname[MAX_DOMAIN_NAME_LEN + GNLEN + 2];
-
- wcscpy (domname, domain_name);
- wcscat (domname, L"\\");
- wcscat (domname, buffer[i].lgrpi0_name);
- sid_length = MAX_SID_LEN;
- domname_len = MAX_DOMAIN_NAME_LEN + 1;
- if (!LookupAccountNameW (servername, domname,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- print_win_error (GetLastError ());
- fprintf(stderr, " (%ls)\n", domname);
- continue;
- }
- }
-
- /* Store all local SIDs with prefix "S-1-5-32-" and check if it
- has been printed already. This allows to get all builtin
- groups exactly once and not once per domain. */
- pdsid = (PDBGSID) psid;
- if (pdsid->IdentifierAuthority.Value[5] == sid_nt_auth.Value[5]
- && pdsid->SubAuthority[0] == SECURITY_BUILTIN_DOMAIN_RID)
- {
- int b;
-
- if (!print_builtin)
- goto skip_group;
- is_builtin = TRUE;
- if (builtin_sid_cnt)
- for (b = 0; b < builtin_sid_cnt; b++)
- if (EqualSid (&builtin_sid_list[b], psid))
- goto skip_group;
- if (builtin_sid_cnt < MAX_BUILTIN_SIDS)
- CopySid (sizeof (DBGSID), &builtin_sid_list[builtin_sid_cnt++],
- psid);
- }
- if (!print_current)
- /* fall through */;
- else if (EqualSid (curr_pgrp.psid, psid))
- got_curr_pgrp = TRUE;
-
- gid = *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1);
- printf ("%ls%s%ls:%s:%ld:\n",
- with_dom && !is_builtin ? domain_name : L"",
- with_dom && !is_builtin ? sep : "",
- buffer[i].lgrpi0_name,
- put_sid (psid),
- gid + (is_builtin ? 0 : id_offset));
-skip_group:
- ;
- }
-
- NetApiBufferFree (buffer);
-
- }
- while (rc == ERROR_MORE_DATA);
-
- /* Return -1 if the single group we're looking for has been found here to
- avoid calling enum_groups for the same group, thus avoiding a spurious
- error message "group name could not be found" in enum_groups. */
- return disp_groupname && entriesread ? -1 : 0;
-}
-
-static void
-enum_groups (BOOL domain, domlist_t *dom_or_machine, const char *sep,
- DWORD id_offset, char *disp_groupname, int print_current)
-{
- WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- PWCHAR servername = NULL;
- char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL;
- BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE;
- GROUP_INFO_2 *buffer;
- DWORD entriesread = 0;
- DWORD totalentries = 0;
- DWORD resume_handle = 0;
- WCHAR gname[GNLEN + 1];
- DWORD rc;
-
- if (domain)
- {
- servername = get_dcname (d_or_m);
- if (servername == (PWCHAR) -1)
- return;
- }
- else if (d_or_m)
- {
- int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
- {
- fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
- __progname, d_or_m);
- return;
- }
- servername = machine;
- }
-
- do
- {
- DWORD i;
-
- if (disp_groupname != NULL)
- {
- mbstowcs (gname, disp_groupname, GNLEN + 1);
- rc = NetGroupGetInfo (servername, (LPWSTR) & gname, 2,
- (void *) &buffer);
- entriesread=1;
- }
- else
- rc = NetGroupEnum (servername, 2, (void *) & buffer,
- MAX_PREFERRED_LENGTH, &entriesread, &totalentries,
- &resume_handle);
- switch (rc)
- {
- case ERROR_ACCESS_DENIED:
- print_win_error (rc);
- return;
-
- case ERROR_MORE_DATA:
- case ERROR_SUCCESS:
- break;
-
- default:
- print_win_error (rc);
- return;
- }
-
- for (i = 0; i < entriesread; i++)
- {
- WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1];
- DWORD domname_len = MAX_DOMAIN_NAME_LEN + 1;
- char psid_buffer[MAX_SID_LEN];
- PSID psid = (PSID) psid_buffer;
- DWORD sid_length = MAX_SID_LEN;
- SID_NAME_USE acc_type;
-
- int gid = buffer[i].grpi2_group_id;
- if (!LookupAccountNameW (servername, buffer[i].grpi2_name,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- print_win_error (GetLastError ());
- fprintf(stderr, " (%ls)\n", buffer[i].grpi2_name);
- continue;
- }
- else if (acc_type == SidTypeDomain)
- {
- WCHAR domname[MAX_DOMAIN_NAME_LEN + GNLEN + 2];
-
- wcscpy (domname, domain || !servername
- ? domain_name : servername);
- wcscat (domname, L"\\");
- wcscat (domname, buffer[i].grpi2_name);
- sid_length = MAX_SID_LEN;
- domname_len = MAX_DOMAIN_NAME_LEN + 1;
- if (!LookupAccountNameW (servername, domname,
- psid, &sid_length,
- domain_name, &domname_len,
- &acc_type))
- {
- print_win_error (GetLastError ());
- fprintf(stderr, " (%ls)\n", domname);
- continue;
- }
- }
- if (!print_current)
- /* fall through */;
- else if (EqualSid (curr_pgrp.psid, psid))
- got_curr_pgrp = TRUE;
-
- printf ("%ls%s%ls:%s:%lu:\n",
- with_dom ? domain_name : L"",
- with_dom ? sep : "",
- buffer[i].grpi2_name,
- put_sid (psid),
- id_offset + gid);
- }
-
- NetApiBufferFree (buffer);
-
- }
- while (rc == ERROR_MORE_DATA);
-}
-
-static void
-print_special (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt,
- DWORD sub1, DWORD sub2, DWORD sub3, DWORD sub4,
- DWORD sub5, DWORD sub6, DWORD sub7, DWORD sub8)
-{
- WCHAR grp[GNLEN + 1], dom[MAX_DOMAIN_NAME_LEN + 1];
- DWORD glen, dlen, rid;
- PSID psid;
- SID_NAME_USE acc_type;
-
- if (AllocateAndInitializeSid (auth, cnt, sub1, sub2, sub3, sub4,
- sub5, sub6, sub7, sub8, &psid))
- {
- if (LookupAccountSidW (NULL, psid,
- grp, (glen = GNLEN + 1, &glen),
- dom, (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen),
- &acc_type))
- {
- if (sub8)
- rid = sub8;
- else if (sub7)
- rid = sub7;
- else if (sub6)
- rid = sub6;
- else if (sub5)
- rid = sub5;
- else if (sub4)
- rid = sub4;
- else if (sub3)
- rid = sub3;
- else if (sub2)
- rid = sub2;
- else
- rid = sub1;
- printf ("%ls:%s:%lu:\n", grp, put_sid (psid), rid);
- }
- FreeSid (psid);
- }
-}
-
-static int
-usage (FILE * stream)
-{
- fprintf (stream,
-"Usage: mkgroup [OPTION]...\n"
-"Print /etc/group file to stdout\n"
-"\n"
-"Options:\n"
-" -l,--local [machine[,offset]]\n"
-" print local groups with gid offset offset\n"
-" (from local machine if no machine specified)\n"
-" -L,--Local [machine[,offset]]\n"
-" ditto, but generate groupname with machine prefix\n"
-" -d,--domain [domain[,offset]]\n"
-" print domain groups with gid offset offset\n"
-" (from current domain if no domain specified)\n"
-" -D,--Domain [domain[,offset]]\n"
-" ditto, but generate groupname with machine prefix\n"
-" -c,--current print current group\n"
-" -C,--Current ditto, but generate groupname with machine or\n"
-" domain prefix\n"
-" -S,--separator char for -L, -D, -C use character char as domain\\group\n"
-" separator in groupname instead of the default '\\'\n"
-" -o,--id-offset offset change the default offset (10000) added to gids\n"
-" in domain or foreign server accounts.\n"
-" -g,--group groupname only return information for the specified group\n"
-" one of -l, -L, -d, -D must be specified, too\n"
-" -b,--no-builtin don't print BUILTIN groups\n"
-" -U,--unix grouplist additionally print UNIX groups when using -l or -L\n"
-" on a UNIX Samba server\n"
-" grouplist is a comma-separated list of groupnames\n"
-" or gid ranges (root,-25,50-100).\n"
-" (enumerating large ranges can take a long time!)\n"
-" -s,--no-sids (ignored)\n"
-" -u,--users (ignored)\n"
-" -h,--help print this message\n"
-" -v,--version print version information and exit\n"
-"\n"
-"Default is to print local groups on stand-alone machines, plus domain\n"
-"groups on domain controllers and domain member machines.\n");
- return 1;
-}
-
-struct option longopts[] = {
- {"no-builtin", no_argument, NULL, 'b'},
- {"current", no_argument, NULL, 'c'},
- {"Current", no_argument, NULL, 'C'},
- {"domain", optional_argument, NULL, 'd'},
- {"Domain", optional_argument, NULL, 'D'},
- {"group", required_argument, NULL, 'g'},
- {"help", no_argument, NULL, 'h'},
- {"local", optional_argument, NULL, 'l'},
- {"Local", optional_argument, NULL, 'L'},
- {"id-offset", required_argument, NULL, 'o'},
- {"no-sids", no_argument, NULL, 's'},
- {"separator", required_argument, NULL, 'S'},
- {"users", no_argument, NULL, 'u'},
- {"unix", required_argument, NULL, 'U'},
- {"version", no_argument, NULL, 'v'},
- {0, no_argument, NULL, 0}
-};
-
-static char opts[] = "bcCd::D::g:hl::L::o:sS:uU:v";
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-mkgroup (cygwin) %.*s\n\
-group File Generator\n\
-Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc.\n\
-Compiled on %s\n\
-", len, v, __DATE__);
-}
-
-static PPOLICY_PRIMARY_DOMAIN_INFO p_dom;
-
-static BOOL
-fetch_primary_domain ()
-{
- NTSTATUS status;
- LSA_OBJECT_ATTRIBUTES oa = { 0, 0, 0, 0, 0, 0 };
- LSA_HANDLE lsa;
-
- if (!p_dom)
- {
- status = LsaOpenPolicy (NULL, &oa, POLICY_EXECUTE, &lsa);
- if (!NT_SUCCESS (status))
- return FALSE;
- status = LsaQueryInformationPolicy (lsa, PolicyPrimaryDomainInformation,
- (PVOID *) ((void *) &p_dom));
- LsaClose (lsa);
- if (!NT_SUCCESS (status))
- return FALSE;
- }
- return !!p_dom->Sid;
-}
-
-int
-main (int argc, char **argv)
-{
- int print_domlist = 0;
- domlist_t domlist[32];
- char *opt, *p, *ep;
- int print_current = 0;
- int print_system = 0;
- int print_builtin = 1;
- char *print_unix = NULL;
- const char *sep_char = "\\";
- DWORD id_offset = 10000, off;
- int c, i;
- char *disp_groupname = NULL;
- BOOL in_domain;
- int optional_args = 0;
-
- if (!isatty (1))
- setmode (1, O_BINARY);
-
- load_dsgetdcname ();
- in_domain = fetch_primary_domain ();
- fetch_current_pgrp_sid ();
-
- if (argc == 1)
- {
- print_special (&sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
- 0, 0, 0, 0, 0, 0, 0);
- if (in_domain)
- {
- if (!enum_local_groups (TRUE, NULL, sep_char, id_offset,
- disp_groupname, print_builtin, 0))
- enum_groups (TRUE, NULL, sep_char, id_offset, disp_groupname, 0);
- }
- else if (!enum_local_groups (FALSE, NULL, sep_char, 0, disp_groupname,
- print_builtin, 0))
- enum_groups (FALSE, NULL, sep_char, 0, disp_groupname, 0);
- return 0;
- }
-
- unsetenv ("POSIXLY_CORRECT"); /* To get optional arg processing right. */
- while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (c)
- {
- case 'd':
- case 'D':
- case 'l':
- case 'L':
- if (print_domlist >= 32)
- {
- fprintf (stderr, "%s: Can not enumerate from more than 32 "
- "domains and machines.\n", __progname);
- return 1;
- }
- domlist[print_domlist].domain = (c == 'd' || c == 'D');
- opt = optarg ?:
- argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
- if (argv[optind] && opt == argv[optind])
- ++optional_args;
- for (i = 0; i < print_domlist; ++i)
- if (domlist[i].domain == domlist[print_domlist].domain
- && ((!domlist[i].str && !opt)
- || (domlist[i].str && opt
- && (off = strlen (domlist[i].str))
- && !strncmp (domlist[i].str, opt, off)
- && (!opt[off] || opt[off] == ','))))
- {
- fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n",
- __progname, domlist[i].domain ? "domain" : "machine",
- domlist[i].str);
- goto skip;
- }
- if (!(domlist[print_domlist].str = opt))
- print_system = 1;
- domlist[print_domlist].id_offset = ULONG_MAX;
- if (opt && (p = strchr (opt, ',')))
- {
- if (p == opt
- || !isdigit (p[1])
- || (domlist[print_domlist].id_offset = strtol (p + 1, &ep, 10)
- , *ep))
- {
- fprintf (stderr, "%s: Malformed machine,offset string '%s'. "
- "Skipping...\n", __progname, opt);
- break;
- }
- *p = '\0';
- }
- domlist[print_domlist++].with_dom = (c == 'D' || c == 'L');
-skip:
- break;
- case 'S':
- sep_char = optarg;
- if (strlen (sep_char) > 1)
- {
- fprintf (stderr, "%s: Only one character allowed as domain\\user "
- "separator character.\n", __progname);
- return 1;
- }
- if (*sep_char == ':')
- {
- fprintf (stderr, "%s: Colon not allowed as domain\\user separator "
- "character.\n", __progname);
- return 1;
- }
- break;
- case 'U':
- print_unix = optarg;
- break;
- case 'c':
- sep_char = NULL;
- /*FALLTHRU*/
- case 'C':
- print_current = 1;
- break;
- case 'o':
- id_offset = strtol (optarg, NULL, 10);
- break;
- case 'b':
- print_builtin = 0;
- break;
- case 's':
- break;
- case 'u':
- break;
- case 'g':
- disp_groupname = optarg;
- break;
- case 'h':
- usage (stdout);
- return 0;
- case 'v':
- print_version ();
- return 0;
- default:
- fprintf (stderr, "Try '%s --help' for more information.\n", argv[0]);
- return 1;
- }
-
- optind += optional_args;
- if (argv[optind])
- {
- fprintf (stderr,
- "mkgroup: non-option command line argument `%s' is not allowed.\n"
- "Try `mkgroup --help' for more information.\n", argv[optind]);
- exit (1);
- }
-
- /* Get 'system' group */
- if (!disp_groupname && print_system && print_builtin && print_domlist)
- print_special (&sid_nt_auth, 1, SECURITY_LOCAL_SYSTEM_RID,
- 0, 0, 0, 0, 0, 0, 0);
-
- off = id_offset;
- for (i = 0; i < print_domlist; ++i)
- {
- DWORD my_off = (domlist[i].domain || domlist[i].str)
- ? domlist[i].id_offset != ULONG_MAX
- ? domlist[i].id_offset : off : 0;
- if (!enum_local_groups (domlist[i].domain, domlist + i, sep_char,
- my_off, disp_groupname, print_builtin, print_current))
- {
- if (!domlist[i].domain && domlist[i].str && print_unix)
- enum_unix_groups (domlist + i, sep_char, my_off, print_unix);
- enum_groups (domlist[i].domain, domlist + i, sep_char, my_off,
- disp_groupname, print_current);
- if (my_off)
- off += id_offset;
- }
- }
-
- if (print_current && !got_curr_pgrp)
- current_group (sep_char, off);
-
- return 0;
-}
diff --git a/winsup/utils/mkpasswd.c b/winsup/utils/mkpasswd.c
deleted file mode 100644
index b341b64c3..000000000
--- a/winsup/utils/mkpasswd.c
+++ /dev/null
@@ -1,887 +0,0 @@
-/* mkpasswd.c:
-
- Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006,
- 2008 Red Hat, Inc.
-
- This file is part of Cygwin.
-
- This software is a copyrighted work licensed under the terms of the
- Cygwin license. Please consult the file "CYGWIN_LICENSE" for
- details. */
-
-#define _WIN32_WINNT 0x0600
-#include <ctype.h>
-#include <stdlib.h>
-#include <wchar.h>
-#include <wctype.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <io.h>
-#include <sys/fcntl.h>
-#include <sys/cygwin.h>
-#include <windows.h>
-#include <lm.h>
-#include <iptypes.h>
-#include <wininet.h>
-#include <ntsecapi.h>
-#include <dsgetdc.h>
-#include <ntdef.h>
-
-#define print_win_error(x) _print_win_error(x, __LINE__)
-
-#define MAX_SID_LEN 40
-
-static const char version[] = "$Revision$";
-
-extern char *__progname;
-
-SID_IDENTIFIER_AUTHORITY sid_world_auth = {SECURITY_WORLD_SID_AUTHORITY};
-SID_IDENTIFIER_AUTHORITY sid_nt_auth = {SECURITY_NT_AUTHORITY};
-
-NET_API_STATUS WINAPI (*dsgetdcname)(LPWSTR,LPWSTR,GUID*,LPWSTR,ULONG,PDOMAIN_CONTROLLER_INFOW*);
-
-#ifndef min
-#define min(a,b) (((a)<(b))?(a):(b))
-#endif
-
-typedef struct
-{
- char *str;
- DWORD id_offset;
- BOOL domain;
- BOOL with_dom;
-} domlist_t;
-
-static void
-_print_win_error(DWORD code, int line)
-{
- char buf[4096];
-
- if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- code,
- MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) buf, sizeof (buf), NULL))
- fprintf (stderr, "mkpasswd (%d): [%lu] %s", line, code, buf);
- else
- fprintf (stderr, "mkpasswd (%d): error %lu", line, code);
-}
-
-static void
-load_dsgetdcname ()
-{
- HANDLE h = LoadLibrary ("netapi32.dll");
-
- if (h)
- dsgetdcname = (void *) GetProcAddress (h, "DsGetDcNameW");
-}
-
-static PWCHAR
-get_dcname (char *domain)
-{
- static WCHAR server[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- DWORD rc;
- PWCHAR servername;
- WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1];
- PDOMAIN_CONTROLLER_INFOW pdci = NULL;
-
- if (dsgetdcname)
- {
- if (domain)
- {
- mbstowcs (domain_name, domain, strlen (domain) + 1);
- rc = dsgetdcname (NULL, domain_name, NULL, NULL, 0, &pdci);
- }
- else
- rc = dsgetdcname (NULL, NULL, NULL, NULL, 0, &pdci);
- if (rc != ERROR_SUCCESS)
- {
- print_win_error(rc);
- return (PWCHAR) -1;
- }
- wcscpy (server, pdci->DomainControllerName);
- NetApiBufferFree (pdci);
- }
- else
- {
- rc = NetGetDCName (NULL, NULL, (void *) &servername);
- if (rc == ERROR_SUCCESS && domain)
- {
- LPWSTR server = servername;
- mbstowcs (domain_name, domain, strlen (domain) + 1);
- rc = NetGetDCName (server, domain_name, (void *) &servername);
- NetApiBufferFree (server);
- }
- if (rc != ERROR_SUCCESS)
- {
- print_win_error(rc);
- return (PWCHAR) -1;
- }
- wcscpy (server, servername);
- NetApiBufferFree ((PVOID) servername);
- }
- return server;
-}
-
-static char *
-put_sid (PSID sid)
-{
- static char s[512];
- char t[32];
- DWORD i;
-
- strcpy (s, "S-1-");
- sprintf(t, "%u", GetSidIdentifierAuthority (sid)->Value[5]);
- strcat (s, t);
- for (i = 0; i < *GetSidSubAuthorityCount (sid); ++i)
- {
- sprintf(t, "-%lu", *GetSidSubAuthority (sid, i));
- strcat (s, t);
- }
- return s;
-}
-
-static void
-psx_dir (char *in, char *out)
-{
- if (isalpha (in[0]) && in[1] == ':')
- {
- sprintf (out, "/cygdrive/%c", in[0]);
- in += 2;
- out += strlen (out);
- }
-
- while (*in)
- {
- if (*in == '\\')
- *out = '/';
- else
- *out = *in;
- in++;
- out++;
- }
-
- *out = '\0';
-}
-
-static void
-uni2ansi (LPWSTR wcs, char *mbs, int size)
-{
- if (wcs)
- wcstombs (mbs, wcs, size);
- else
- *mbs = '\0';
-}
-
-typedef struct {
- PSID psid;
- int buffer[10];
-} sidbuf;
-
-static sidbuf curr_user;
-static sidbuf curr_pgrp;
-static BOOL got_curr_user = FALSE;
-
-static void
-fetch_current_user_sid ()
-{
- DWORD len;
- HANDLE ptok;
-
- if (!OpenProcessToken (GetCurrentProcess (), TOKEN_QUERY, &ptok)
- || !GetTokenInformation (ptok, TokenUser, &curr_user, sizeof curr_user,
- &len)
- || !GetTokenInformation (ptok, TokenPrimaryGroup, &curr_pgrp,
- sizeof curr_pgrp, &len)
- || !CloseHandle (ptok))
- {
- print_win_error (GetLastError ());
- return;
- }
-}
-
-static void
-current_user (int print_cygpath, const char *sep, const char *passed_home_path,
- DWORD id_offset, const char *disp_username)
-{
- WCHAR user[UNLEN + 1];
- WCHAR dom[MAX_DOMAIN_NAME_LEN + 1];
- DWORD ulen = UNLEN + 1;
- DWORD dlen = MAX_DOMAIN_NAME_LEN + 1;
- SID_NAME_USE acc_type;
- int uid, gid;
- char homedir_psx[PATH_MAX] = {0}, homedir_w32[MAX_PATH] = {0};
-
- if (!curr_user.psid || !curr_pgrp.psid
- || !LookupAccountSidW (NULL, curr_user.psid, user, &ulen, dom, &dlen,
- &acc_type))
- {
- print_win_error (GetLastError ());
- return;
- }
-
- uid = *GetSidSubAuthority (curr_user.psid,
- *GetSidSubAuthorityCount(curr_user.psid) - 1);
- gid = *GetSidSubAuthority (curr_pgrp.psid,
- *GetSidSubAuthorityCount(curr_pgrp.psid) - 1);
- if (passed_home_path[0] == '\0')
- {
- char *envhome = getenv ("HOME");
- char *envhomedrive = getenv ("HOMEDRIVE");
- char *envhomepath = getenv ("HOMEPATH");
-
- if (envhome && envhome[0])
- {
- if (print_cygpath)
- cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, envhome,
- homedir_psx, PATH_MAX);
- else
- psx_dir (envhome, homedir_psx);
- }
- else if (envhomepath && envhomepath[0])
- {
- if (envhomedrive)
- strlcpy (homedir_w32, envhomedrive, sizeof (homedir_w32));
- if (envhomepath[0] != '\\')
- strlcat (homedir_w32, "\\", sizeof (homedir_w32));
- strlcat (homedir_w32, envhomepath, sizeof (homedir_w32));
- if (print_cygpath)
- cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, homedir_w32,
- homedir_psx, PATH_MAX);
- else
- psx_dir (homedir_w32, homedir_psx);
- }
- else
- {
- wcstombs (stpncpy (homedir_psx, "/home/", sizeof (homedir_psx)),
- user, sizeof (homedir_psx) - 6);
- homedir_psx[PATH_MAX - 1] = '\0';
- }
- }
- else
- {
- char *p = stpncpy (homedir_psx, passed_home_path, sizeof (homedir_psx));
- wcstombs (p, user, sizeof (homedir_psx) - (p - homedir_psx));
- homedir_psx[PATH_MAX - 1] = '\0';
- }
-
- printf ("%ls%s%ls:unused:%lu:%lu:U-%ls\\%ls,%s:%s:/bin/bash\n",
- sep ? dom : L"",
- sep ?: "",
- user,
- id_offset + uid,
- id_offset + gid,
- dom,
- user,
- put_sid (curr_user.psid),
- homedir_psx);
-}
-
-static void
-enum_unix_users (domlist_t *dom_or_machine, const char *sep, DWORD id_offset,
- char *unix_user_list)
-{
- WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- PWCHAR servername = NULL;
- char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL;
- BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE;
- SID_IDENTIFIER_AUTHORITY auth = { { 0, 0, 0, 0, 0, 22 } };
- char *ustr, *user_list;
- WCHAR user[UNLEN + sizeof ("Unix User\\") + 1];
- WCHAR dom[MAX_DOMAIN_NAME_LEN + 1];
- DWORD ulen, dlen, sidlen;
- PSID psid;
- char psid_buffer[MAX_SID_LEN];
- SID_NAME_USE acc_type;
-
- if (!d_or_m)
- return;
-
- int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
- {
- fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
- __progname, d_or_m);
- return;
- }
- servername = machine;
-
- if (!AllocateAndInitializeSid (&auth, 2, 1, 0, 0, 0, 0, 0, 0, 0, &psid))
- return;
-
- if (!(user_list = strdup (unix_user_list)))
- {
- FreeSid (psid);
- return;
- }
-
- for (ustr = strtok (user_list, ","); ustr; ustr = strtok (NULL, ","))
- {
- if (!isdigit (ustr[0]) && ustr[0] != '-')
- {
- PWCHAR p = wcpcpy (user, L"Unix User\\");
- ret = mbstowcs (p, ustr, UNLEN + 1);
- if (ret < 1 || ret >= UNLEN + 1)
- fprintf (stderr, "%s: Invalid user name '%s'. Skipping...\n",
- __progname, ustr);
- else if (LookupAccountNameW (servername, user,
- psid = (PSID) psid_buffer,
- (sidlen = MAX_SID_LEN, &sidlen),
- dom,
- (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen),
- &acc_type))
- printf ("%s%s%ls:unused:%lu:99999:,%s::\n",
- with_dom ? "Unix User" : "",
- with_dom ? sep : "",
- user + 10,
- id_offset +
- *GetSidSubAuthority (psid,
- *GetSidSubAuthorityCount(psid) - 1),
- put_sid (psid));
- }
- else
- {
- DWORD start, stop;
- char *p = ustr;
- if (*p == '-')
- start = 0;
- else
- start = strtol (p, &p, 10);
- if (!*p)
- stop = start;
- else if (*p++ != '-' || !isdigit (*p)
- || (stop = strtol (p, &p, 10)) < start || *p)
- {
- fprintf (stderr, "%s: Malformed unix user list entry '%s'. "
- "Skipping...\n", __progname, ustr);
- continue;
- }
- for (; start <= stop; ++ start)
- {
- *GetSidSubAuthority (psid, *GetSidSubAuthorityCount(psid) - 1)
- = start;
- if (LookupAccountSidW (servername, psid,
- user, (ulen = GNLEN + 1, &ulen),
- dom,
- (dlen = MAX_DOMAIN_NAME_LEN + 1, &dlen),
- &acc_type)
- && !iswdigit (user[0]))
- printf ("%s%s%ls:unused:%lu:99999:,%s::\n",
- with_dom ? "Unix User" : "",
- with_dom ? sep : "",
- user,
- id_offset + start,
- put_sid (psid));
- }
- }
- }
-
- free (user_list);
- FreeSid (psid);
-}
-
-static int
-enum_users (BOOL domain, domlist_t *dom_or_machine, const char *sep,
- int print_cygpath, const char *passed_home_path, DWORD id_offset,
- char *disp_username, int print_current)
-{
- WCHAR machine[INTERNET_MAX_HOST_NAME_LENGTH + 1];
- PWCHAR servername = NULL;
- char *d_or_m = dom_or_machine ? dom_or_machine->str : NULL;
- BOOL with_dom = dom_or_machine ? dom_or_machine->with_dom : FALSE;
- USER_INFO_3 *buffer;
- DWORD entriesread = 0;
- DWORD totalentries = 0;
- DWORD resume_handle = 0;
- DWORD rc;
- WCHAR uni_name[UNLEN + 1];
- if (domain)
- {
- servername = get_dcname (d_or_m);
- if (servername == (PWCHAR) -1)
- return 1;
- }
- else if (d_or_m)
- {
- int ret = mbstowcs (machine, d_or_m, INTERNET_MAX_HOST_NAME_LENGTH + 1);
- if (ret < 1 || ret >= INTERNET_MAX_HOST_NAME_LENGTH + 1)
- {
- fprintf (stderr, "%s: Invalid machine name '%s'. Skipping...\n",
- __progname, d_or_m);
- return 1;
- }
- servername = machine;
- }
-
- do
- {
- DWORD i;
-
- if (disp_username != NULL)
- {
- mbstowcs (uni_name, disp_username, UNLEN + 1);
- rc = NetUserGetInfo (servername, (LPWSTR) &uni_name, 3,
- (void *) &buffer);
- entriesread = 1;
- }
- else
- rc = NetUserEnum (servername, 3, FILTER_NORMAL_ACCOUNT,
- (void *) &buffer, MAX_PREFERRED_LENGTH,
- &entriesread, &totalentries, &resume_handle);
- switch (rc)
- {
- case ERROR_ACCESS_DENIED:
- print_win_error(rc);
- return 1;
-
- case ERROR_MORE_DATA:
- case ERROR_SUCCESS:
- break;
-
- default:
- print_win_error(rc);
- return 1;
- }
-
- for (i = 0; i < entriesread; i++)
- {
- char homedir_psx[PATH_MAX];
- char homedir_w32[MAX_PATH];
- WCHAR domain_name[MAX_DOMAIN_NAME_LEN + 1];
- DWORD domname_len = MAX_DOMAIN_NAME_LEN + 1;
- char psid_buffer[MAX_SID_LEN];
- PSID psid = (PSID) psid_buffer;
- DWORD sid_length = MAX_SID_LEN;
- SID_NAME_USE acc_type;
-
- int uid = buffer[i].usri3_user_id;
- int gid = buffer[i].usri3_primary_group_id;
- homedir_w32[0] = homedir_psx[0] = '\0';
- if (passed_home_path[0] == '\0')
- {
- uni2ansi (buffer[i].usri3_home_dir, homedir_w32,
- sizeof (homedir_w32));
- if (homedir_w32[0] != '\0')
- {
- if (print_cygpath)
- cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE,
- homedir_w32, homedir_psx, PATH_MAX);
- else
- psx_dir (homedir_w32, homedir_psx);
- }
- else
- uni2ansi (buffer[i].usri3_name,
- stpcpy (homedir_psx, "/home/"), PATH_MAX - 6);
- }
- else
- uni2ansi (buffer[i].usri3_name,
- stpcpy (homedir_psx, passed_home_path),
- PATH_MAX - strlen (passed_home_path));
-
- if (!LookupAccountNameW (servername, buffer[i].usri3_name,
- psid, &sid_length, domain_name,
- &domname_len, &acc_type))
- {
- print_win_error(GetLastError ());
- fprintf(stderr, " (%ls)\n", buffer[i].usri3_name);
- continue;
- }
- else if (acc_type == SidTypeDomain)
- {
- WCHAR domname[MAX_DOMAIN_NAME_LEN + UNLEN + 2];
-
- wcscpy (domname, domain || !servername
- ? domain_name : servername);
- wcscat (domname, L"\\");
- wcscat (domname, buffer[i].usri3_name);
- sid_length = MAX_SID_LEN;
- domname_len = sizeof (domname);
- if (!LookupAccountNameW (servername, domname, psid,
- &sid_length, domain_name,
- &domname_len, &acc_type))
- {
- print_win_error(GetLastError ());
- fprintf(stderr, " (%ls)\n", domname);
- continue;
- }
- }
- if (!print_current)
- /* fall through */;
- else if (EqualSid (curr_user.psid, psid))
- got_curr_user = TRUE;
-
- printf ("%ls%s%ls:unused:%lu:%lu:%ls%sU-%ls\\%ls,%s:%s:/bin/bash\n",
- with_dom ? domain_name : L"",
- with_dom ? sep : "",
- buffer[i].usri3_name,
- id_offset + uid,
- id_offset + gid,
- buffer[i].usri3_full_name ?: L"",
- buffer[i].usri3_full_name
- && buffer[i].usri3_full_name[0] ? "," : "",
- domain_name,
- buffer[i].usri3_name,
- put_sid (psid),
- homedir_psx);
- }
-
- NetApiBufferFree (buffer);
-
- }
- while (rc == ERROR_MORE_DATA);
-
- return 0;
-}
-
-static void
-print_special (PSID_IDENTIFIER_AUTHORITY auth, BYTE cnt,
- DWORD sub1, DWORD sub2, DWORD sub3, DWORD sub4,
- DWORD sub5, DWORD sub6, DWORD sub7, DWORD sub8)
-{
- WCHAR user[UNLEN + 1], dom[MAX_DOMAIN_NAME_LEN + 1];
- DWORD len, len2, rid;
- PSID sid;
- SID_NAME_USE acc_type;
-
- if (AllocateAndInitializeSid (auth, cnt, sub1, sub2, sub3, sub4,
- sub5, sub6, sub7, sub8, &sid))
- {
- if (LookupAccountSidW (NULL, sid,
- user, (len = UNLEN + 1, &len),
- dom, (len2 = MAX_DOMAIN_NAME_LEN + 1, &len),
- &acc_type))
- {
- if (sub8)
- rid = sub8;
- else if (sub7)
- rid = sub7;
- else if (sub6)
- rid = sub6;
- else if (sub5)
- rid = sub5;
- else if (sub4)
- rid = sub4;
- else if (sub3)
- rid = sub3;
- else if (sub2)
- rid = sub2;
- else
- rid = sub1;
- printf ("%ls:*:%lu:%lu:,%s::\n",
- user, rid, rid == 18 ? 544 : rid, /* SYSTEM hack */
- put_sid (sid));
- }
- FreeSid (sid);
- }
-}
-
-static int
-usage (FILE * stream)
-{
- fprintf (stream,
-"Usage: mkpasswd [OPTIONS]...\n"
-"Print /etc/passwd file to stdout\n"
-"\n"
-"Options:\n"
-" -l,--local [machine[,offset]]\n"
-" print local user accounts with uid offset offset\n"
-" (from local machine if no machine specified)\n"
-" -L,--Local [machine[,offset]]\n"
-" ditto, but generate username with machine prefix\n"
-" -d,--domain [domain[,offset]]\n"
-" print domain accounts with uid offset offset\n"
-" (from current domain if no domain specified)\n"
-" -D,--Domain [domain[,offset]]\n"
-" ditto, but generate username with domain prefix\n"
-" -c,--current print current user\n"
-" -C,--Current ditto, but generate username with machine or\n"
-" domain prefix\n"
-" -S,--separator char for -L, -D, -C use character char as domain\\user\n"
-" separator in username instead of the default '\\'\n"
-" -o,--id-offset offset change the default offset (10000) added to uids\n"
-" in domain or foreign server accounts.\n"
-" -u,--username username only return information for the specified user\n"
-" one of -l, -L, -d, -D must be specified, too\n"
-" -p,--path-to-home path use specified path instead of user account home dir\n"
-" or /home prefix\n"
-" -m,--no-mount don't use mount points for home dir\n"
-" -U,--unix userlist additionally print UNIX users when using -l or -L\n"
-" on a UNIX Samba server\n"
-" userlist is a comma-separated list of usernames\n"
-" or uid ranges (root,-25,50-100).\n"
-" (enumerating large ranges can take a long time!)\n"
-" -s,--no-sids (ignored)\n"
-" -g,--local-groups (ignored)\n"
-" -h,--help displays this message\n"
-" -v,--version version information and exit\n"
-"\n"
-"Default is to print local accounts on stand-alone machines, domain accounts\n"
-"on domain controllers and domain member machines.\n");
- return 1;
-}
-
-static struct option longopts[] = {
- {"current", no_argument, NULL, 'c'},
- {"Current", no_argument, NULL, 'C'},
- {"domain", optional_argument, NULL, 'd'},
- {"Domain", optional_argument, NULL, 'D'},
- {"local-groups", no_argument, NULL, 'g'},
- {"help", no_argument, NULL, 'h'},
- {"local", optional_argument, NULL, 'l'},
- {"Local", optional_argument, NULL, 'L'},
- {"no-mount", no_argument, NULL, 'm'},
- {"id-offset", required_argument, NULL, 'o'},
- {"path-to-home", required_argument, NULL, 'p'},
- {"no-sids", no_argument, NULL, 's'},
- {"separator", required_argument, NULL, 'S'},
- {"username", required_argument, NULL, 'u'},
- {"unix", required_argument, NULL, 'U'},
- {"version", no_argument, NULL, 'v'},
- {0, no_argument, NULL, 0}
-};
-
-static char opts[] = "cCd::D::ghl::L::mo:sS:p:u:U:v";
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-mkpasswd (cygwin) %.*s\n\
-passwd File Generator\n\
-Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2008 Red Hat, Inc.\n\
-Compiled on %s\n\
-", len, v, __DATE__);
-}
-
-static void
-enum_std_accounts ()
-{
- /* Generate service starter account entries. */
- printf ("SYSTEM:*:18:544:,S-1-5-18::\n");
- printf ("LocalService:*:19:544:U-NT AUTHORITY\\LocalService,S-1-5-19::\n");
- printf ("NetworkService:*:20:544:U-NT AUTHORITY\\NetworkService,S-1-5-20::\n");
- /* Get 'administrators' group (has localized name). */
- print_special (&sid_nt_auth, 2, SECURITY_BUILTIN_DOMAIN_RID,
- DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0);
-}
-
-static PPOLICY_PRIMARY_DOMAIN_INFO p_dom;
-
-static BOOL
-fetch_primary_domain ()
-{
- NTSTATUS status;
- LSA_OBJECT_ATTRIBUTES oa = { 0, 0, 0, 0, 0, 0 };
- LSA_HANDLE lsa;
-
- if (!p_dom)
- {
- status = LsaOpenPolicy (NULL, &oa, POLICY_VIEW_LOCAL_INFORMATION, &lsa);
- if (!NT_SUCCESS (status))
- return FALSE;
- status = LsaQueryInformationPolicy (lsa, PolicyPrimaryDomainInformation,
- (PVOID *) ((void *) &p_dom));
- LsaClose (lsa);
- if (!NT_SUCCESS (status))
- return FALSE;
- }
- return !!p_dom->Sid;
-}
-
-int
-main (int argc, char **argv)
-{
- int print_domlist = 0;
- domlist_t domlist[32];
- char *opt, *p, *ep;
- int print_cygpath = 1;
- int print_current = 0;
- char *print_unix = NULL;
- const char *sep_char = "\\";
- DWORD id_offset = 10000, off;
- int c, i;
- char *disp_username = NULL;
- char passed_home_path[PATH_MAX];
- BOOL in_domain;
- int optional_args = 0;
-
- passed_home_path[0] = '\0';
- if (!isatty (1))
- setmode (1, O_BINARY);
-
- load_dsgetdcname ();
- in_domain = fetch_primary_domain ();
- fetch_current_user_sid ();
-
- if (argc == 1)
- {
- enum_std_accounts ();
- if (in_domain)
- enum_users (TRUE, NULL, sep_char, print_cygpath, passed_home_path,
- 10000, disp_username, 0);
- else
- enum_users (FALSE, NULL, sep_char, print_cygpath, passed_home_path, 0,
- disp_username, 0);
- return 0;
- }
-
- unsetenv ("POSIXLY_CORRECT"); /* To get optional arg processing right. */
- while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (c)
- {
- case 'd':
- case 'D':
- case 'l':
- case 'L':
- if (print_domlist >= 32)
- {
- fprintf (stderr, "%s: Can not enumerate from more than 32 "
- "domains and machines.\n", __progname);
- return 1;
- }
- domlist[print_domlist].domain = (c == 'd' || c == 'D');
- opt = optarg ?:
- argv[optind] && argv[optind][0] != '-' ? argv[optind] : NULL;
- if (argv[optind] && opt == argv[optind])
- ++optional_args;
- for (i = 0; i < print_domlist; ++i)
- if (domlist[i].domain == domlist[print_domlist].domain
- && ((!domlist[i].str && !opt)
- || (domlist[i].str && opt
- && (off = strlen (domlist[i].str))
- && !strncmp (domlist[i].str, opt, off)
- && (!opt[off] || opt[off] == ','))))
- {
- fprintf (stderr, "%s: Duplicate %s '%s'. Skipping...\n",
- __progname, domlist[i].domain ? "domain" : "machine",
- domlist[i].str);
- goto skip;
- }
- domlist[print_domlist].str = opt;
- domlist[print_domlist].id_offset = ULONG_MAX;
- if (opt && (p = strchr (opt, ',')))
- {
- if (p == opt
- || !isdigit (p[1])
- || (domlist[print_domlist].id_offset = strtol (p + 1, &ep, 10)
- , *ep))
- {
- fprintf (stderr, "%s: Malformed domain,offset string '%s'. "
- "Skipping...\n", __progname, opt);
- break;
- }
- *p = '\0';
- }
- domlist[print_domlist++].with_dom = (c == 'D' || c == 'L');
-skip:
- break;
- case 'S':
- sep_char = optarg;
- if (strlen (sep_char) > 1)
- {
- fprintf (stderr, "%s: Only one character allowed as domain\\user "
- "separator character.\n", __progname);
- return 1;
- }
- if (*sep_char == ':')
- {
- fprintf (stderr, "%s: Colon not allowed as domain\\user separator "
- "character.\n", __progname);
- return 1;
- }
- break;
- case 'U':
- print_unix = optarg;
- break;
- case 'c':
- sep_char = NULL;
- /*FALLTHRU*/
- case 'C':
- print_current = 1;
- break;
- case 'o':
- id_offset = strtoul (optarg, &ep, 10);
- if (*ep)
- {
- fprintf (stderr, "%s: Malformed offset '%s'. "
- "Skipping...\n", __progname, optarg);
- return 1;
- }
- break;
- case 'g':
- break;
- case 's':
- break;
- case 'm':
- print_cygpath = 0;
- break;
- case 'p':
- if (optarg[0] != '/')
- {
- fprintf (stderr, "%s: '%s' is not a fully qualified path.\n",
- __progname, optarg);
- return 1;
- }
- strcpy (passed_home_path, optarg);
- if (optarg[strlen (optarg)-1] != '/')
- strcat (passed_home_path, "/");
- break;
- case 'u':
- disp_username = optarg;
- break;
- case 'h':
- usage (stdout);
- return 0;
- case 'v':
- print_version ();
- return 0;
- default:
- fprintf (stderr, "Try '%s --help' for more information.\n", __progname);
- return 1;
- }
-
- optind += optional_args;
- if (argv[optind])
- {
- fprintf (stderr,
- "mkpasswd: non-option command line argument `%s' is not allowed.\n"
- "Try `mkpasswd --help' for more information.\n", argv[optind]);
- exit (1);
- }
-
- off = id_offset;
- for (i = 0; i < print_domlist; ++i)
- {
- DWORD my_off = (domlist[i].domain || domlist[i].str)
- ? domlist[i].id_offset != ULONG_MAX
- ? domlist[i].id_offset : off : 0;
- if (!domlist[i].domain && domlist[i].str && print_unix)
- enum_unix_users (domlist + i, sep_char, my_off, print_unix);
- if (!my_off && !disp_username)
- enum_std_accounts ();
- enum_users (domlist[i].domain, domlist + i, sep_char, print_cygpath,
- passed_home_path, my_off, disp_username, print_current);
- if (my_off)
- off += id_offset;
- }
-
- if (print_current && !got_curr_user)
- current_user (print_cygpath, sep_char, passed_home_path, off,
- disp_username);
-
- return 0;
-}
diff --git a/winsup/utils/module_info.cc b/winsup/utils/module_info.cc
deleted file mode 100644
index c0e7079cc..000000000
--- a/winsup/utils/module_info.cc
+++ /dev/null
@@ -1,114 +0,0 @@
-/* module_info.cc
-
- Copyright 1999,2000,2001 Red Hat, Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdlib.h>
-#include <windows.h>
-#include <psapi.h>
-
-static int psapi_loaded = 0;
-static HMODULE psapi_module_handle = NULL;
-
-typedef BOOL WINAPI (tf_EnumProcessModules) (HANDLE, HMODULE *, DWORD,
- LPDWORD);
-typedef BOOL WINAPI (tf_GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO,
- DWORD);
-typedef DWORD WINAPI (tf_GetModuleFileNameExA) (HANDLE, HMODULE, LPSTR,
- DWORD);
-
-static tf_EnumProcessModules *psapi_EnumProcessModules = NULL;
-static tf_GetModuleInformation *psapi_GetModuleInformation = NULL;
-static tf_GetModuleFileNameExA *psapi_GetModuleFileNameExA = NULL;
-
-/* Returns full name of Dll, which is loaded by hProcess at BaseAddress.
- Uses psapi.dll. */
-
-char *
-psapi_get_module_name (HANDLE hProcess, DWORD BaseAddress)
-{
- DWORD len;
- MODULEINFO mi;
- unsigned int i;
- HMODULE dh_buf[1];
- HMODULE *DllHandle = dh_buf;
- DWORD cbNeeded;
- BOOL ok;
-
- char name_buf[MAX_PATH + 1];
-
- if (!psapi_loaded ||
- psapi_EnumProcessModules == NULL ||
- psapi_GetModuleInformation == NULL ||
- psapi_GetModuleFileNameExA == NULL)
- {
- if (psapi_loaded)
- goto failed;
- psapi_loaded = 1;
- psapi_module_handle = LoadLibrary ("psapi.dll");
- if (!psapi_module_handle)
- goto failed;
- psapi_EnumProcessModules =
- (tf_EnumProcessModules *) GetProcAddress (psapi_module_handle,
- "EnumProcessModules");
- psapi_GetModuleInformation =
- (tf_GetModuleInformation *) GetProcAddress (psapi_module_handle,
- "GetModuleInformation");
- psapi_GetModuleFileNameExA =
- (tf_GetModuleFileNameExA *) GetProcAddress (psapi_module_handle,
- "GetModuleFileNameExA");
- if (psapi_EnumProcessModules == NULL
- || psapi_GetModuleInformation == NULL
- || psapi_GetModuleFileNameExA == NULL)
- goto failed;
- }
-
- ok = (*psapi_EnumProcessModules) (hProcess,
- DllHandle, sizeof (HMODULE), &cbNeeded);
-
- if (!ok || !cbNeeded)
- goto failed;
- DllHandle = (HMODULE *) malloc (cbNeeded);
- if (!DllHandle)
- goto failed;
- ok = (*psapi_EnumProcessModules) (hProcess, DllHandle, cbNeeded, &cbNeeded);
- if (!ok)
- {
- free (DllHandle);
- goto failed;
- }
-
- for (i = 0; i < cbNeeded / sizeof (HMODULE); i++)
- {
- if (!(*psapi_GetModuleInformation) (hProcess,
- DllHandle[i], &mi, sizeof (mi)))
- {
- free (DllHandle);
- goto failed;
- }
-
- len = (*psapi_GetModuleFileNameExA) (hProcess,
- DllHandle[i], name_buf, MAX_PATH);
- if (len == 0)
- {
- free (DllHandle);
- goto failed;
- }
-
- if ((DWORD) (mi.lpBaseOfDll) == BaseAddress)
- {
- free (DllHandle);
- return strdup (name_buf);
- }
- }
-
-failed:
- return NULL;
-}
diff --git a/winsup/utils/mount.cc b/winsup/utils/mount.cc
deleted file mode 100644
index 464240f75..000000000
--- a/winsup/utils/mount.cc
+++ /dev/null
@@ -1,499 +0,0 @@
-/* mount.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
- 2008 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdio.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-#include <mntent.h>
-#include <windows.h>
-#include <sys/cygwin.h>
-#include <stdlib.h>
-#include <getopt.h>
-#include <dirent.h>
-
-#ifdef errno
-#undef errno
-#endif
-#include <errno.h>
-
-#define NT_MAX_PATH 32768
-
-#define EXEC_FLAGS (MOUNT_EXEC | MOUNT_NOTEXEC | MOUNT_CYGWIN_EXEC)
-
-static void mount_entries (void);
-static void show_mounts (void);
-static void show_cygdrive_info (void);
-static void change_cygdrive_prefix (const char *new_prefix, int flags);
-static int mount_already_exists (const char *posix_path, int flags);
-
-// static short create_missing_dirs = FALSE;
-static short force = FALSE;
-
-static const char version[] = "$Revision$";
-static const char *progname;
-
-static void
-error (const char *path)
-{
- fprintf (stderr, "%s: %s: %s\n", progname, path,
- (errno == EMFILE) ? "Too many mount entries" : strerror (errno));
- exit (1);
-}
-
-/* FIXME: do_mount should also print a warning message if the dev arg
- is a non-existent Win32 path. */
-
-static void
-do_mount (const char *dev, const char *where, int flags)
-{
- struct stat statbuf;
- int statres;
-
- statres = stat (where, &statbuf);
-
-#if 0
- if (statres == -1)
- {
- /* FIXME: this'll fail if mount dir is missing any parent dirs */
- if (create_missing_dirs == TRUE)
- {
- if (mkdir (where, 0755) == -1)
- fprintf (stderr, "Warning: unable to create %s!\n", where);
- else
- statres = 0; /* Pretend stat succeeded if we could mkdir. */
- }
- }
-#endif
-
- if (statres == -1)
- {
- if (!force)
- fprintf (stderr, "%s: warning - %s does not exist.\n", progname, where);
- }
- else if (!(statbuf.st_mode & S_IFDIR))
- {
- if (!force)
- fprintf (stderr, "%s: warning: %s is not a directory.\n", progname, where);
- }
-
- if (!force && !(flags & EXEC_FLAGS) && strlen (dev))
- {
- char devtmp[1 + 2 * strlen (dev)];
- strcpy (devtmp, dev);
- char c = strchr (devtmp, '\0')[-1];
- if (c == '/' || c == '\\')
- strcat (devtmp, ".");
- /* Use a curious property of Windows which allows the use of \.. even
- on non-directory paths. */
- for (const char *p = dev; (p = strpbrk (p, "/\\")); p++)
- strcat (devtmp, "\\..");
- strcat (devtmp, "\\");
- if (GetDriveType (devtmp) == DRIVE_REMOTE)
- {
- fprintf (stderr, "%s: defaulting to '--no-executable' flag for speed since native path\n"
- "%*creferences a remote share. Use '-f' option to override.\n", progname,
- strlen(progname) + 2, ' ');
- flags |= MOUNT_NOTEXEC;
- }
- }
-
- if (mount (dev, where, flags))
- error (where);
-
- exit (0);
-}
-
-static struct option longopts[] =
-{
- {"change-cygdrive-prefix", no_argument, NULL, 'c'},
- {"force", no_argument, NULL, 'f'},
- {"help", no_argument, NULL, 'h' },
- {"mount-entries", no_argument, NULL, 'm'},
- {"options", required_argument, NULL, 'o'},
- {"show-cygdrive-prefix", no_argument, NULL, 'p'},
- {"version", no_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "cfhmpvo:";
-
-struct opt
-{
- const char *name;
- unsigned val;
- bool clear;
-} oopts[] =
-{
- {"binary", MOUNT_BINARY, false},
- {"text", MOUNT_BINARY, true},
- {"exec", MOUNT_EXEC, false},
- {"notexec", MOUNT_NOTEXEC, false},
- {"cygexec", MOUNT_CYGWIN_EXEC, false},
- {"nosuid", 0, 0},
- {"acl", MOUNT_NOACL, true},
- {"noacl", MOUNT_NOACL, false},
- {"posix=1", MOUNT_NOPOSIX, true},
- {"posix=0", MOUNT_NOPOSIX, false},
-};
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where, "Usage: %s [OPTION] [<win32path> <posixpath>]\n\
-Display information about mounted filesystems, or mount a filesystem\n\
-\n\
- -c, --change-cygdrive-prefix change the cygdrive path prefix to <posixpath>\n\
- -f, --force force mount, don't warn about missing mount\n\
- point directories\n\
- -h, --help output usage information and exit\n\
- -m, --mount-entries write fstab entries to replicate mount points\n\
- and cygdrive prefixes\n\
- -o, --options X[,X...] specify mount options\n\
- -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix\n\
- -v, --version output version information and exit\n\
-\n\
-Valid options are:\n\n ", progname);
- for (opt *o = oopts; o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); o++)
- fprintf (where, "%s%s", o == oopts ? "" : ",", o->name);
- fputs ("\n\n", where);
- exit (where == stderr ? 1 : 0);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Filesystem Utility\n\
-Copyright 1996-2008 Red Hat, Inc.\n\
-Compiled on %s\n\
-", progname, len, v, __DATE__);
-}
-
-static char *
-concat3 (char *a, const char *b, const char *c)
-{
- size_t totlen = strlen (a) + strlen (b) + strlen (c) + 1;
- a = (char *) realloc (a, totlen);
- return strcat (strcat (a, b), c);
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
- int flags = MOUNT_BINARY;
- char *options = strdup ("");
- enum do_what
- {
- nada,
- saw_change_cygdrive_prefix,
- saw_show_cygdrive_prefix,
- saw_mount_commands
- } do_what = nada;
-
- progname = strrchr (argv[0], '/');
- if (progname == NULL)
- progname = strrchr (argv[0], '\\');
- if (progname == NULL)
- progname = argv[0];
- else
- progname++;
-
- if (argc == 1)
- {
- show_mounts ();
- exit (0);
- }
-
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 'c':
- if (do_what == nada)
- do_what = saw_change_cygdrive_prefix;
- else
- usage ();
- break;
- case 'f':
- force = TRUE;
- break;
- case 'h':
- usage (stdout);
- break;
- case 'm':
- if (do_what == nada)
- do_what = saw_mount_commands;
- else
- usage ();
- break;
- case 'o':
- if (*options)
- options = concat3 (options, ",", optarg);
- else
- options = strdup (optarg);
- break;
- case 'p':
- if (do_what == nada)
- do_what = saw_show_cygdrive_prefix;
- else
- usage ();
- break;
- case 'v':
- print_version ();
- return 0;
- break;
- default:
- usage ();
- }
-
- while (*options)
- {
- char *p = strchr (options, ',');
- if (p)
- *p++ = '\0';
- else
- p = strchr (options, '\0');
-
- for (opt *o = oopts; o < (oopts + (sizeof (oopts) / sizeof (oopts[0]))); o++)
- if (strcmp (options, o->name) == 0)
- {
- if (o->clear)
- flags &= ~o->val;
- else
- flags |= o->val;
- goto gotit;
- }
- fprintf (stderr, "%s: invalid option - '%s'\n", progname, options);
- exit (1);
-
- gotit:
- options = p;
- }
-
- if (flags & MOUNT_NOTEXEC && flags & (MOUNT_EXEC | MOUNT_CYGWIN_EXEC))
- {
- fprintf (stderr, "%s: invalid combination of executable options\n", progname);
- exit (1);
- }
-
- cygwin_internal (CW_SET_DOS_FILE_WARNING, false);
-
- argc--;
- switch (do_what)
- {
- case saw_change_cygdrive_prefix:
- if (optind != argc)
- usage ();
- change_cygdrive_prefix (argv[optind], flags);
- break;
- case saw_show_cygdrive_prefix:
- if (optind <= argc)
- usage ();
- show_cygdrive_info ();
- break;
- case saw_mount_commands:
- if (optind <= argc)
- usage ();
- mount_entries ();
- break;
- default:
- if (optind != (argc - 1))
- {
- if (optind >= argc)
- fprintf (stderr, "%s: not enough arguments\n", progname);
- else
- fprintf (stderr, "%s: too many arguments\n", progname);
- usage ();
- }
- if (force || !mount_already_exists (argv[optind + 1], flags))
- do_mount (argv[optind], argv[optind + 1], flags);
- else
- {
- errno = EBUSY;
- error (argv[optind + 1]);
- }
- }
-
- /* NOTREACHED */
- return 0;
-}
-
-static char *
-convert_spaces (char *tgt, const char *src)
-{
- char *tp, *spacep;
- const char *sp;
-
- tp = tgt;
- for (sp = src; (spacep = strchr (sp, ' ')); sp = spacep + 1)
- {
- tp = stpncpy (tp, sp, spacep - sp);
- tp = stpcpy (tp, "\\040");
- }
- stpcpy (tp, sp);
- return tgt;
-}
-
-static void
-mount_entries (void)
-{
- FILE *m = setmntent ("/-not-used-", "r");
- struct mntent *p;
- const char *format_mnt = "%s %s %s %s 0 0\n";
- const char *format_cyg = "none %s cygdrive %s 0 0\n";
-
- // write fstab entries for normal mount points
- while ((p = getmntent (m)) != NULL)
- // Only list non-cygdrives
- if (!strstr (p->mnt_opts, ",noumount"))
- {
- char fsname[NT_MAX_PATH], dirname[NT_MAX_PATH];
- printf (format_mnt, convert_spaces (fsname, p->mnt_fsname),
- convert_spaces (dirname, p->mnt_dir),
- p->mnt_type, p->mnt_opts);
- }
- endmntent (m);
-
- // write fstab entry for cygdrive prefix
- m = setmntent ("/-not-used-", "r");
- while ((p = getmntent (m)) != NULL)
- {
- char *noumount;
- if ((noumount = strstr (p->mnt_opts, ",noumount")))
- {
- char dirname[NT_MAX_PATH];
- char opts[strlen (p->mnt_opts) + 1];
-
- convert_spaces (dirname, p->mnt_dir);
- char *ls = strrchr (dirname, '/');
- if (ls && ls > dirname)
- *ls = '\0';
- *stpncpy (opts, p->mnt_opts, noumount - p->mnt_opts) = '\0';
- printf (format_cyg, dirname, opts);
- break;
- }
- }
- endmntent (m);
-
- exit(0);
-}
-
-static void
-show_mounts (void)
-{
- FILE *m = setmntent ("/-not-used-", "r");
- struct mntent *p;
- const char *format = "%s on %s type %s (%s)\n";
-
- // printf (format, "Device", "Directory", "Type", "Flags");
- while ((p = getmntent (m)) != NULL)
- printf (format, p->mnt_fsname, p->mnt_dir, p->mnt_type, p->mnt_opts);
- endmntent (m);
-}
-
-/* Return 1 if mountpoint from the same registry area is already in
- mount table. Otherwise return 0. */
-static int
-mount_already_exists (const char *posix_path, int flags)
-{
- int found_matching = 0;
-
- FILE *m = setmntent ("/-not-used-", "r");
- struct mntent *p;
-
- while ((p = getmntent (m)) != NULL)
- {
- /* if the paths match, and they're both the same type of mount. */
- if (strcmp (p->mnt_dir, posix_path) == 0)
- {
- if (p->mnt_type[0] == 'u')
- {
- if (!(flags & MOUNT_SYSTEM)) /* both current_user */
- found_matching = 1;
- else
- fprintf (stderr,
- "%s: warning: system mount point of '%s' "
- "will always be masked by user mount.\n",
- progname, posix_path);
- break;
- }
- else if (p->mnt_type[0] == 's')
- {
- if (flags & MOUNT_SYSTEM) /* both system */
- found_matching = 1;
- else
- fprintf (stderr,
- "%s: warning: user mount point of '%s' "
- "masks system mount.\n",
- progname, posix_path);
- break;
- }
- else
- {
- fprintf (stderr, "%s: warning: couldn't determine mount type.\n", progname);
- break;
- }
- }
- }
- endmntent (m);
-
- return found_matching;
-}
-
-/* change_cygdrive_prefix: Change the cygdrive prefix */
-static void
-change_cygdrive_prefix (const char *new_prefix, int flags)
-{
- flags |= MOUNT_CYGDRIVE;
-
- if (mount (NULL, new_prefix, flags))
- error (new_prefix);
-
- exit (0);
-}
-
-/* show_cygdrive_info: Show the user and/or cygdrive info, i.e., prefix and
- flags.*/
-static void
-show_cygdrive_info ()
-{
- /* Get the cygdrive info */
- char user[MAX_PATH];
- char system[MAX_PATH];
- char user_flags[MAX_PATH];
- char system_flags[MAX_PATH];
- cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
- system_flags);
-
- /* Display the user and system cygdrive path prefix, if necessary
- (ie, not empty) */
- const char *format = "%-18s %-11s %s\n";
- printf (format, "Prefix", "Type", "Flags");
- if (strlen (user) > 0)
- printf (format, user, "user", user_flags);
- if (strlen (system) > 0)
- printf (format, system, "nouser", system_flags);
-
- exit (0);
-}
diff --git a/winsup/utils/parse_pe.cc b/winsup/utils/parse_pe.cc
deleted file mode 100644
index 44b4068a4..000000000
--- a/winsup/utils/parse_pe.cc
+++ /dev/null
@@ -1,104 +0,0 @@
-/* parse_pe.cc
-
- Copyright 1999, 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
-
- Written by Egor Duda <deo@logos-m.ru>
-
- This file is part of Cygwin.
-
- 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 (file COPYING.dumper) 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. */
-
-#include <bfd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "dumper.h"
-
-int
-exclusion::add (LPBYTE mem_base, DWORD mem_size)
-{
- while (last >= size)
- size += step;
- region = (process_mem_region *) realloc (region, size * sizeof (process_mem_region));
- if (region == NULL)
- return 0;
- region[last].base = mem_base;
- region[last].size = mem_size;
- last++;
- return 1;
-};
-
-int
-cmp_regions (const void *r1, const void *r2)
-{
- if (((process_mem_region *) r1)->base < ((process_mem_region *) r2)->base)
- return -1;
- if (((process_mem_region *) r1)->base > ((process_mem_region *) r2)->base)
- return 1;
- return 0;
-}
-
-int
-exclusion::sort_and_check ()
-{
- qsort (region, last, sizeof (process_mem_region), &cmp_regions);
- for (process_mem_region * p = region; p < region + last - 1; p++)
- {
- process_mem_region *q = p + 1;
- if (q == p + 1)
- continue;
- if (p->base + size > q->base)
- {
- fprintf (stderr, "region error @ (%8p + %d) > %8p\n", p->base, size, q->base);
- return 0;
- }
- }
- return 1;
-}
-
-static void
-select_data_section (bfd * abfd, asection * sect, PTR obj)
-{
- exclusion *excl_list = (exclusion *) obj;
-
- if ((sect->flags & (SEC_CODE | SEC_DEBUGGING)) &&
- sect->vma && bfd_get_section_size (sect))
- {
- excl_list->add ((LPBYTE) sect->vma, (DWORD) bfd_get_section_size (sect));
- deb_printf ("excluding section: %20s %08lx\n", sect->name,
- bfd_get_section_size (sect));
- }
-}
-
-int
-parse_pe (const char *file_name, exclusion * excl_list)
-{
- if (file_name == NULL || excl_list == NULL)
- return 0;
-
- bfd *abfd = bfd_openr (file_name, "pei-i386");
- if (abfd == NULL)
- {
- bfd_perror ("failed to open file");
- return 0;
- }
-
- bfd_check_format (abfd, bfd_object);
- bfd_map_over_sections (abfd, &select_data_section, (PTR) excl_list);
- excl_list->sort_and_check ();
-
- bfd_close (abfd);
- return 1;
-}
diff --git a/winsup/utils/passwd.c b/winsup/utils/passwd.c
deleted file mode 100644
index 3ef4f92d0..000000000
--- a/winsup/utils/passwd.c
+++ /dev/null
@@ -1,609 +0,0 @@
-/* passwd.c: Changing passwords and managing account information
-
- Copyright 1999, 2000, 2001, 2002, 2003, 2008 Red Hat, Inc.
-
- Written by Corinna Vinschen <corinna.vinschen@cityweb.de>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <windows.h>
-#include <wininet.h>
-#include <lmaccess.h>
-#include <lmerr.h>
-#include <lmcons.h>
-#include <lmapibuf.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <pwd.h>
-#include <sys/cygwin.h>
-#include <sys/types.h>
-#include <time.h>
-#include <errno.h>
-
-#define USER_PRIV_ADMIN 2
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-static struct option longopts[] =
-{
- {"cannot-change", no_argument, NULL, 'c'},
- {"can-change", no_argument, NULL, 'C'},
- {"logonserver", required_argument, NULL, 'd'},
- {"never-expires", no_argument, NULL, 'e'},
- {"expires", no_argument, NULL, 'E'},
- {"help", no_argument, NULL, 'h' },
- {"inactive", required_argument, NULL, 'i'},
- {"lock", no_argument, NULL, 'l'},
- {"minage", required_argument, NULL, 'n'},
- {"pwd-not-required", no_argument, NULL, 'p'},
- {"pwd-required", no_argument, NULL, 'P'},
- {"unlock", no_argument, NULL, 'u'},
- {"version", no_argument, NULL, 'v'},
- {"maxage", required_argument, NULL, 'x'},
- {"length", required_argument, NULL, 'L'},
- {"status", no_argument, NULL, 'S'},
- { "reg-store-pwd", no_argument, NULL, 'R'},
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "cCd:eEhi:ln:pPuvx:L:SR";
-
-int
-eprint (int with_name, const char *fmt, ...)
-{
- va_list ap;
-
- if (with_name)
- fprintf(stderr, "%s: ", prog_name);
- va_start (ap, fmt);
- vfprintf (stderr, fmt, ap);
- va_end (ap);
- fprintf(stderr, "\n");
- return 1;
-}
-
-int
-EvalRet (int ret, const char *user)
-{
- switch (ret)
- {
- case NERR_Success:
- return 0;
-
- case ERROR_ACCESS_DENIED:
- if (! user)
- eprint (0, "You may not change password expiry information.");
- else
- eprint (0, "You may not change the password for %s.", user);
- break;
-
- eprint (0, "Bad password: Invalid.");
- break;
-
- case NERR_PasswordTooShort:
- eprint (0, "Bad password: Too short.");
- break;
-
- case NERR_UserNotFound:
- eprint (1, "unknown user %s", user);
- break;
-
- case ERROR_INVALID_PASSWORD:
- case NERR_BadPassword:
- eprint (0, "Incorrect password for %s.", user);
- eprint (0, "The password for %s is unchanged.", user);
- break;
-
- default:
- eprint (1, "unrecoverable error %d", ret);
- break;
- }
- return 1;
-}
-
-PUSER_INFO_3
-GetPW (char *user, int print_win_name, LPCWSTR server)
-{
- char usr_buf[UNLEN + 1];
- WCHAR name[2 * (UNLEN + 1)];
- DWORD ret;
- PUSER_INFO_3 ui;
- struct passwd *pw;
- char *domain = (char *) alloca (INTERNET_MAX_HOST_NAME_LENGTH + 1);
-
- /* Try getting a Win32 username in case the user edited /etc/passwd */
- if ((pw = getpwnam (user)))
- {
- cygwin_internal (CW_EXTRACT_DOMAIN_AND_USER, pw, domain, usr_buf);
- if (strcasecmp (pw->pw_name, usr_buf))
- {
- /* Hack to avoid problem with LookupAccountSid after impersonation */
- if (strcasecmp (usr_buf, "SYSTEM"))
- {
- user = usr_buf;
- if (print_win_name)
- printf ("Windows username : %s\n", user);
- }
- }
- }
- MultiByteToWideChar (CP_ACP, 0, user, -1, name, 2 * (UNLEN + 1));
- ret = NetUserGetInfo (server, name, 3, (void *) &ui);
- return EvalRet (ret, user) ? NULL : ui;
-}
-
-int
-ChangePW (const char *user, const char *oldpwd, const char *pwd, int justcheck,
- LPCWSTR server)
-{
- WCHAR name[2 * (UNLEN + 1)], oldpass[512], pass[512];
- DWORD ret;
-
- MultiByteToWideChar (CP_ACP, 0, user, -1, name, 2 * (UNLEN + 1));
- MultiByteToWideChar (CP_ACP, 0, pwd, -1, pass, 512);
- if (! oldpwd)
- {
- USER_INFO_1003 ui;
-
- ui.usri1003_password = pass;
- ret = NetUserSetInfo (server, name, 1003, (LPBYTE) &ui, NULL);
- }
- else
- {
- MultiByteToWideChar (CP_ACP, 0, oldpwd, -1, oldpass, 512);
- ret = NetUserChangePassword (server, name, oldpass, pass);
- }
- if (justcheck && ret != ERROR_INVALID_PASSWORD)
- return 0;
- if (! EvalRet (ret, user) && ! justcheck)
- {
- eprint (0, "Password changed.");
- }
- return ret;
-}
-
-void
-PrintPW (PUSER_INFO_3 ui, LPCWSTR server)
-{
- time_t t = time (NULL) - ui->usri3_password_age;
- int ret;
- PUSER_MODALS_INFO_0 mi;
-
- printf ("Account disabled : %s",
- (ui->usri3_flags & UF_ACCOUNTDISABLE) ? "yes\n" : "no\n");
- printf ("Password not required : %s",
- (ui->usri3_flags & UF_PASSWD_NOTREQD) ? "yes\n" : "no\n");
- printf ("User can't change password : %s",
- (ui->usri3_flags & UF_PASSWD_CANT_CHANGE) ? "yes\n" : "no\n");
- printf ("Password never expires : %s",
- (ui->usri3_flags & UF_DONT_EXPIRE_PASSWD) ? "yes\n" : "no\n");
- printf ("Password expired : %s",
- (ui->usri3_password_expired) ? "yes\n" : "no\n");
- printf ("Latest password change : %s", ctime(&t));
- ret = NetUserModalsGet (server, 0, (void *) &mi);
- if (! ret)
- {
- if (mi->usrmod0_max_passwd_age == TIMEQ_FOREVER)
- mi->usrmod0_max_passwd_age = 0;
- if (mi->usrmod0_min_passwd_age == TIMEQ_FOREVER)
- mi->usrmod0_min_passwd_age = 0;
- if (mi->usrmod0_force_logoff == TIMEQ_FOREVER)
- mi->usrmod0_force_logoff = 0;
- if (ui->usri3_priv == USER_PRIV_ADMIN)
- mi->usrmod0_min_passwd_len = 0;
- printf ("\nSystem password settings:\n");
- printf ("Max. password age %ld days\n",
- mi->usrmod0_max_passwd_age / ONE_DAY);
- printf ("Min. password age %ld days\n",
- mi->usrmod0_min_passwd_age / ONE_DAY);
- printf ("Force logout after %ld days\n",
- mi->usrmod0_force_logoff / ONE_DAY);
- printf ("Min. password length: %ld\n",
- mi->usrmod0_min_passwd_len);
- }
-}
-
-int
-SetModals (int xarg, int narg, int iarg, int Larg, LPCWSTR server)
-{
- int ret;
- PUSER_MODALS_INFO_0 mi;
-
- ret = NetUserModalsGet (server, 0, (void *) &mi);
- if (! ret)
- {
- if (xarg == 0)
- mi->usrmod0_max_passwd_age = TIMEQ_FOREVER;
- else if (xarg > 0)
- mi->usrmod0_max_passwd_age = xarg * ONE_DAY;
-
- if (narg == 0)
- {
- mi->usrmod0_min_passwd_age = TIMEQ_FOREVER;
- mi->usrmod0_password_hist_len = 0;
- }
- else if (narg > 0)
- mi->usrmod0_min_passwd_age = narg * ONE_DAY;
-
- if (iarg == 0)
- mi->usrmod0_force_logoff = TIMEQ_FOREVER;
- else if (iarg > 0)
- mi->usrmod0_force_logoff = iarg * ONE_DAY;
-
- if (Larg >= 0)
- mi->usrmod0_min_passwd_len = Larg;
-
- ret = NetUserModalsSet (server, 0, (LPBYTE) mi, NULL);
- NetApiBufferFree (mi);
- }
- return EvalRet (ret, NULL);
-}
-
-static void usage (FILE * stream, int status) __attribute__ ((noreturn));
-static void
-usage (FILE * stream, int status)
-{
- fprintf (stream, ""
- "Usage: %s [OPTION] [USER]\n"
- "Change USER's password or password attributes.\n"
- "\n"
- "User operations:\n"
- " -l, --lock lock USER's account.\n"
- " -u, --unlock unlock USER's account.\n"
- " -c, --cannot-change USER can't change password.\n"
- " -C, --can-change USER can change password.\n"
- " -e, --never-expires USER's password never expires.\n"
- " -E, --expires USER's password expires according to system's\n"
- " password aging rule.\n"
- " -p, --pwd-not-required no password required for USER.\n"
- " -P, --pwd-required password is required for USER.\n"
- " -R, --reg-store-pwd enter password to store it in the registry for\n"
- " later usage by services to be able to switch\n"
- " to this user context with network credentials.\n"
- "\n"
- "System operations:\n"
- " -i, --inactive NUM set NUM of days before inactive accounts are disabled\n"
- " (inactive accounts are those with expired passwords).\n"
- " -n, --minage DAYS set system minimum password age to DAYS days.\n"
- " -x, --maxage DAYS set system maximum password age to DAYS days.\n"
- " -L, --length LEN set system minimum password length to LEN.\n"
- "\n"
- "Other options:\n"
- " -d, --logonserver SERVER connect to SERVER (e.g. domain controller).\n"
- " default server is the content of $LOGONSERVER.\n"
- " -S, --status display password status for USER (locked, expired,\n"
- " etc.) plus global system password settings.\n"
- " -h, --help output usage information and exit.\n"
- " -v, --version output version information and exit.\n"
- "\n"
- "If no option is given, change USER's password. If no user name is given,\n"
- "operate on current user. System operations must not be mixed with user\n"
- "operations. Don't specify a USER when triggering a system operation.\n"
- "\n"
- "Don't specify a user or any other option together with the -R option.\n"
- "Non-Admin users can only store their password if cygserver is running and\n"
- "the CYGWIN environment variable is set to contain the word 'server'.\n"
- "Note that storing even obfuscated passwords in the registry is not overly\n"
- "secure. Use this feature only if the machine is adequately locked down.\n"
- "Don't use this feature if you don't need network access within a remote\n"
- "session. You can delete your stored password by using `passwd -R' and\n"
- "specifying an empty password.\n"
- "\n"
- "Report bugs to <cygwin@cygwin.com>\n", prog_name);
- exit (status);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Password Utility\n\
-Copyright 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.\n\
-Compiled on %s\n\
-", prog_name, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- char *c;
- char user[UNLEN + 1], oldpwd[_PASSWORD_LEN + 1], newpwd[_PASSWORD_LEN + 1];
- int ret = 0;
- int cnt = 0;
- int opt, len;
- int Larg = -1;
- int xarg = -1;
- int narg = -1;
- int iarg = -1;
- int lopt = 0;
- int uopt = 0;
- int copt = 0;
- int Copt = 0;
- int eopt = 0;
- int Eopt = 0;
- int popt = 0;
- int Popt = 0;
- int Sopt = 0;
- int Ropt = 0;
- PUSER_INFO_3 ui, li;
- LPWSTR server = NULL;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
- c = strrchr (prog_name, '.');
- if (c)
- *c = '\0';
-
- while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (opt)
- {
- case 'h':
- usage (stdout, 0);
- break;
-
- case 'i':
- if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt)
- usage (stderr, 1);
- if ((iarg = atoi (optarg)) < 0 || iarg > 999)
- return eprint (1, "Force logout time must be between 0 and 999.");
- break;
-
- case 'l':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || uopt || Sopt || Ropt)
- usage (stderr, 1);
- lopt = 1;
- break;
-
- case 'n':
- if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt)
- usage (stderr, 1);
- if ((narg = atoi (optarg)) < 0 || narg > 999)
- return eprint (1, "Minimum password age must be between 0 and 999.");
- if (xarg >= 0 && narg > xarg)
- return eprint (1, "Minimum password age must be less than "
- "maximum password age.");
- break;
-
- case 'u':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || Sopt || Ropt)
- usage (stderr, 1);
- uopt = 1;
- break;
-
- case 'c':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
- usage (stderr, 1);
- copt = 1;
- break;
-
- case 'C':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
- usage (stderr, 1);
- Copt = 1;
- break;
-
- case 'd':
- {
- if (Ropt)
- usage (stderr, 1);
- char *tmpbuf = alloca (strlen (optarg) + 3);
- tmpbuf[0] = '\0';
- if (*optarg != '\\')
- strcpy (tmpbuf, "\\\\");
- strcat (tmpbuf, optarg);
- server = alloca ((strlen (tmpbuf) + 1) * sizeof (WCHAR));
- if (MultiByteToWideChar (CP_ACP, 0, tmpbuf, -1, server,
- strlen (tmpbuf) + 1) <= 0)
- server = NULL;
- }
- break;
-
- case 'e':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
- usage (stderr, 1);
- eopt = 1;
- break;
-
- case 'E':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
- usage (stderr, 1);
- Eopt = 1;
- break;
-
- case 'p':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
- usage (stderr, 1);
- popt = 1;
- break;
-
- case 'P':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || Sopt || Ropt)
- usage (stderr, 1);
- Popt = 1;
- break;
-
- case 'v':
- print_version ();
- exit (0);
- break;
-
- case 'x':
- if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt)
- usage (stderr, 1);
- if ((xarg = atoi (optarg)) < 0 || xarg > 999)
- return eprint (1, "Maximum password age must be between 0 and 999.");
- if (narg >= 0 && xarg < narg)
- return eprint (1, "Maximum password age must be greater than "
- "minimum password age.");
- break;
-
- case 'L':
- if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt || Ropt)
- usage (stderr, 1);
- if ((Larg = atoi (optarg)) < 0 || Larg > LM20_PWLEN)
- return eprint (1, "Minimum password length must be between "
- "0 and %d.", LM20_PWLEN);
- break;
-
- case 'S':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt
- || copt || Copt || eopt || Eopt || popt || Popt || Ropt)
- usage (stderr, 1);
- Sopt = 1;
- break;
-
- case 'R':
- if (xarg >= 0 || narg >= 0 || iarg >= 0 || Larg >= 0 || lopt || uopt
- || copt || Copt || eopt || Eopt || popt || Popt || Sopt
- || server)
- usage (stderr, 1);
- Ropt = 1;
- break;
-
- default:
- usage (stderr, 1);
- }
-
- if (Ropt)
- {
- if (optind < argc)
- usage (stderr, 1);
- printf (
-"This functionality stores a password in the registry for usage by services\n"
-"which need to change the user context and require network access. Typical\n"
-"applications are interactive remote logons using sshd, cron task, etc.\n"
-"This password will always tried first when any privileged application is\n"
-"about to switch the user context.\n\n"
-"Note that storing even obfuscated passwords in the registry is not overly\n"
-"secure. Use this feature only if the machine is adequately locked down.\n"
-"Don't use this feature if you don't need network access within a remote\n"
-"session.\n\n"
-"You can delete your stored password by specifying an empty password.\n\n");
- strcpy (newpwd, getpass ("Enter your current password: "));
- if (strcmp (newpwd, getpass ("Re-enter your current password: ")))
- eprint (0, "Password is not identical.");
- else if (cygwin_internal (CW_SET_PRIV_KEY, newpwd))
- return eprint (0, "Storing password failed: %s", strerror (errno));
- return 0;
- }
-
- if (!server)
- {
- len = GetEnvironmentVariableW (L"LOGONSERVER", NULL, 0);
- if (len > 0)
- {
- server = alloca (len * sizeof (WCHAR));
- if (GetEnvironmentVariableW (L"LOGONSERVER", server, len) <= 0)
- server = NULL;
- }
- }
-
- if (Larg >= 0 || xarg >= 0 || narg >= 0 || iarg >= 0)
- {
- if (optind < argc)
- usage (stderr, 1);
- return SetModals (xarg, narg, iarg, Larg, server);
- }
-
- strcpy (user, optind >= argc ? getlogin () : argv[optind]);
-
- li = GetPW (getlogin (), 0, server);
- if (! li)
- return 1;
-
- ui = GetPW (user, 1, server);
- if (! ui)
- return 1;
-
- if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt || Sopt)
- {
- USER_INFO_1008 uif;
-
- if (li->usri3_priv != USER_PRIV_ADMIN)
- return eprint (0, "You have no maintenance privileges.");
- uif.usri1008_flags = ui->usri3_flags;
- if (lopt)
- {
- if (ui->usri3_priv == USER_PRIV_ADMIN)
- return eprint (0, "Locking an admin account is disallowed.");
- uif.usri1008_flags |= UF_ACCOUNTDISABLE;
- }
- if (uopt)
- uif.usri1008_flags &= ~UF_ACCOUNTDISABLE;
- if (copt)
- uif.usri1008_flags |= UF_PASSWD_CANT_CHANGE;
- if (Copt)
- uif.usri1008_flags &= ~UF_PASSWD_CANT_CHANGE;
- if (eopt)
- uif.usri1008_flags |= UF_DONT_EXPIRE_PASSWD;
- if (Eopt)
- uif.usri1008_flags &= ~UF_DONT_EXPIRE_PASSWD;
- if (popt)
- uif.usri1008_flags |= UF_PASSWD_NOTREQD;
- if (Popt)
- uif.usri1008_flags &= ~UF_PASSWD_NOTREQD;
-
- if (lopt || uopt || copt || Copt || eopt || Eopt || popt || Popt)
- {
- ret = NetUserSetInfo (server, ui->usri3_name, 1008, (LPBYTE) &uif,
- NULL);
- return EvalRet (ret, NULL);
- }
- // Sopt
- PrintPW (ui, server);
- return 0;
- }
-
- if (li->usri3_priv != USER_PRIV_ADMIN && strcmp (getlogin (), user))
- return eprint (0, "You may not change the password for %s.", user);
-
- eprint (0, "Enter the new password (minimum of 5, maximum of 8 characters).");
- eprint (0, "Please use a combination of upper and lower case letters and numbers.");
-
- oldpwd[0] = '\0';
- if (li->usri3_priv != USER_PRIV_ADMIN)
- {
- strcpy (oldpwd, getpass ("Old password: "));
- if (ChangePW (user, oldpwd, oldpwd, 1, server))
- return 1;
- }
-
- do
- {
- strcpy (newpwd, getpass ("New password: "));
- if (strcmp (newpwd, getpass ("Re-enter new password: ")))
- eprint (0, "Password is not identical.");
- else if (! ChangePW (user, *oldpwd ? oldpwd : NULL, newpwd, 0, server))
- ret = 1;
- if (! ret && cnt < 2)
- eprint (0, "Try again.");
- }
- while (! ret && ++cnt < 3);
- return ! ret;
-}
diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc
deleted file mode 100644
index 787467f1d..000000000
--- a/winsup/utils/path.cc
+++ /dev/null
@@ -1,859 +0,0 @@
-/* path.cc
-
- Copyright 2001, 2002, 2003, 2005, 2006, 2007, 2008 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-/* The purpose of this file is to hide all the details about accessing
- Cygwin's mount table, shortcuts, etc. If the format or location of
- the mount table, or the shortcut format changes, this is the file to
- change to match it. */
-
-#define str(a) #a
-#define scat(a,b) str(a##b)
-#include <windows.h>
-#include <lmcons.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <malloc.h>
-#include <wchar.h>
-#include "path.h"
-#include "cygwin/include/cygwin/version.h"
-#include "cygwin/include/sys/mount.h"
-#include "cygwin/include/mntent.h"
-#include "testsuite.h"
-
-/* Used when treating / and \ as equivalent. */
-#define isslash(ch) \
- ({ \
- char __c = (ch); \
- ((__c) == '/' || (__c) == '\\'); \
- })
-
-
-static const GUID GUID_shortcut =
- {0x00021401L, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}};
-
-enum {
- WSH_FLAG_IDLIST = 0x01, /* Contains an ITEMIDLIST. */
- WSH_FLAG_FILE = 0x02, /* Contains a file locator element. */
- WSH_FLAG_DESC = 0x04, /* Contains a description. */
- WSH_FLAG_RELPATH = 0x08, /* Contains a relative path. */
- WSH_FLAG_WD = 0x10, /* Contains a working dir. */
- WSH_FLAG_CMDLINE = 0x20, /* Contains command line args. */
- WSH_FLAG_ICON = 0x40 /* Contains a custom icon. */
-};
-
-struct win_shortcut_hdr
- {
- DWORD size; /* Header size in bytes. Must contain 0x4c. */
- GUID magic; /* GUID of shortcut files. */
- DWORD flags; /* Content flags. See above. */
-
- /* The next fields from attr to icon_no are always set to 0 in Cygwin
- and U/Win shortcuts. */
- DWORD attr; /* Target file attributes. */
- FILETIME ctime; /* These filetime items are never touched by the */
- FILETIME mtime; /* system, apparently. Values don't matter. */
- FILETIME atime;
- DWORD filesize; /* Target filesize. */
- DWORD icon_no; /* Icon number. */
-
- DWORD run; /* Values defined in winuser.h. Use SW_NORMAL. */
- DWORD hotkey; /* Hotkey value. Set to 0. */
- DWORD dummy[2]; /* Future extension probably. Always 0. */
- };
-
-static bool
-cmp_shortcut_header (win_shortcut_hdr *file_header)
-{
- /* A Cygwin or U/Win shortcut only contains a description and a relpath.
- Cygwin shortcuts also might contain an ITEMIDLIST. The run type is
- always set to SW_NORMAL. */
- return file_header->size == sizeof (win_shortcut_hdr)
- && !memcmp (&file_header->magic, &GUID_shortcut, sizeof GUID_shortcut)
- && (file_header->flags & ~WSH_FLAG_IDLIST)
- == (WSH_FLAG_DESC | WSH_FLAG_RELPATH)
- && file_header->run == SW_NORMAL;
-}
-
-int
-get_word (HANDLE fh, int offset)
-{
- unsigned short rv;
- unsigned r;
-
- SetLastError(NO_ERROR);
- if (SetFilePointer (fh, offset, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER
- && GetLastError () != NO_ERROR)
- return -1;
-
- if (!ReadFile (fh, &rv, 2, (DWORD *) &r, 0))
- return -1;
-
- return rv;
-}
-
-/*
- * Check the value of GetLastError() to find out whether there was an error.
- */
-int
-get_dword (HANDLE fh, int offset)
-{
- int rv;
- unsigned r;
-
- SetLastError(NO_ERROR);
- if (SetFilePointer (fh, offset, 0, FILE_BEGIN) == INVALID_SET_FILE_POINTER
- && GetLastError () != NO_ERROR)
- return -1;
-
- if (!ReadFile (fh, &rv, 4, (DWORD *) &r, 0))
- return -1;
-
- return rv;
-}
-
-#define EXE_MAGIC ((int)*(unsigned short *)"MZ")
-#define SHORTCUT_MAGIC ((int)*(unsigned short *)"L\0")
-#define SYMLINK_COOKIE "!<symlink>"
-#define SYMLINK_MAGIC ((int)*(unsigned short *)SYMLINK_COOKIE)
-
-bool
-is_exe (HANDLE fh)
-{
- int magic = get_word (fh, 0x0);
- return magic == EXE_MAGIC;
-}
-
-bool
-is_symlink (HANDLE fh)
-{
- int magic = get_word (fh, 0x0);
- if (magic != SHORTCUT_MAGIC && magic != SYMLINK_MAGIC)
- return false;
- DWORD got;
- BY_HANDLE_FILE_INFORMATION local;
- if (!GetFileInformationByHandle (fh, &local))
- return false;
- if (magic == SHORTCUT_MAGIC)
- {
- DWORD size;
- if (!local.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
- return false; /* Not a Cygwin symlink. */
- if ((size = GetFileSize (fh, NULL)) > 8192)
- return false; /* Not a Cygwin symlink. */
- char buf[size];
- SetFilePointer (fh, 0, 0, FILE_BEGIN);
- if (!ReadFile (fh, buf, size, &got, 0))
- return false;
- if (got != size || !cmp_shortcut_header ((win_shortcut_hdr *) buf))
- return false; /* Not a Cygwin symlink. */
- /* TODO: check for invalid path contents
- (see symlink_info::check() in ../cygwin/path.cc) */
- }
- else /* magic == SYMLINK_MAGIC */
- {
- if (!local.dwFileAttributes & FILE_ATTRIBUTE_SYSTEM)
- return false; /* Not a Cygwin symlink. */
- char buf[sizeof (SYMLINK_COOKIE) - 1];
- SetFilePointer (fh, 0, 0, FILE_BEGIN);
- if (!ReadFile (fh, buf, sizeof (buf), &got, 0))
- return false;
- if (got != sizeof (buf) ||
- memcmp (buf, SYMLINK_COOKIE, sizeof (buf)) != 0)
- return false; /* Not a Cygwin symlink. */
- }
- return true;
-}
-
-/* Assumes is_symlink(fh) is true */
-bool
-readlink (HANDLE fh, char *path, int maxlen)
-{
- DWORD rv;
- char *buf, *cp;
- unsigned short len;
- win_shortcut_hdr *file_header;
- BY_HANDLE_FILE_INFORMATION fi;
-
- if (!GetFileInformationByHandle (fh, &fi)
- || fi.nFileSizeHigh != 0
- || fi.nFileSizeLow > 8192)
- return false;
-
- buf = (char *) alloca (fi.nFileSizeLow + 1);
- file_header = (win_shortcut_hdr *) buf;
-
- if (SetFilePointer (fh, 0L, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER
- || !ReadFile (fh, buf, fi.nFileSizeLow, &rv, NULL)
- || rv != fi.nFileSizeLow)
- return false;
-
- if (fi.nFileSizeLow > sizeof (file_header)
- && cmp_shortcut_header (file_header))
- {
- cp = buf + sizeof (win_shortcut_hdr);
- if (file_header->flags & WSH_FLAG_IDLIST) /* Skip ITEMIDLIST */
- cp += *(unsigned short *) cp + 2;
- if (!(len = *(unsigned short *) cp))
- return false;
- cp += 2;
- /* Has appended full path? If so, use it instead of description. */
- unsigned short relpath_len = *(unsigned short *) (cp + len);
- if (cp + len + 2 + relpath_len < buf + fi.nFileSizeLow)
- {
- cp += len + 2 + relpath_len;
- len = *(unsigned short *) cp;
- cp += 2;
- }
- if (len + 1 > maxlen)
- return false;
- memcpy (path, cp, len);
- path[len] = '\0';
- return true;
- }
- else if (strncmp (buf, SYMLINK_COOKIE, strlen (SYMLINK_COOKIE)) == 0
- && fi.nFileSizeLow - strlen (SYMLINK_COOKIE) <= (unsigned) maxlen
- && buf[fi.nFileSizeLow - 1] == '\0')
- {
- strcpy (path, &buf[strlen (SYMLINK_COOKIE)]);
- return true;
- }
- else
- return false;
-}
-
-struct mnt_t
-{
- char *native;
- char *posix;
- unsigned flags;
-};
-
-#ifndef TESTSUITE
-static mnt_t mount_table[255];
-static int max_mount_entry;
-#else
-# define TESTSUITE_MOUNT_TABLE
-# include "testsuite.h"
-# undef TESTSUITE_MOUNT_TABLE
-#endif
-
-mnt_t *root_here = NULL;
-
-inline void
-unconvert_slashes (char* name)
-{
- while ((name = strchr (name, '/')) != NULL)
- *name++ = '\\';
-}
-
-/* These functions aren't called when defined(TESTSUITE) which results
- in a compiler warning. */
-#ifndef TESTSUITE
-inline char *
-skip_ws (char *in)
-{
- while (*in == ' ' || *in == '\t')
- ++in;
- return in;
-}
-
-inline char *
-find_ws (char *in)
-{
- while (*in && *in != ' ' && *in != '\t')
- ++in;
- return in;
-}
-
-inline char *
-conv_fstab_spaces (char *field)
-{
- register char *sp = field;
- while ((sp = strstr (sp, "\\040")) != NULL)
- {
- *sp++ = ' ';
- memmove (sp, sp + 3, strlen (sp + 3) + 1);
- }
- return field;
-}
-
-static struct opt
-{
- const char *name;
- unsigned val;
- bool clear;
-} oopts[] =
-{
- {"user", MOUNT_SYSTEM, 1},
- {"nouser", MOUNT_SYSTEM, 0},
- {"binary", MOUNT_BINARY, 0},
- {"text", MOUNT_BINARY, 1},
- {"exec", MOUNT_EXEC, 0},
- {"notexec", MOUNT_NOTEXEC, 0},
- {"cygexec", MOUNT_CYGWIN_EXEC, 0},
- {"nosuid", 0, 0},
- {"acl", MOUNT_NOACL, 1},
- {"noacl", MOUNT_NOACL, 0},
- {"posix=1", MOUNT_NOPOSIX, 1},
- {"posix=0", MOUNT_NOPOSIX, 0}
-};
-
-static bool
-read_flags (char *options, unsigned &flags)
-{
- while (*options)
- {
- char *p = strchr (options, ',');
- if (p)
- *p++ = '\0';
- else
- p = strchr (options, '\0');
-
- for (opt *o = oopts;
- o < (oopts + (sizeof (oopts) / sizeof (oopts[0])));
- o++)
- if (strcmp (options, o->name) == 0)
- {
- if (o->clear)
- flags &= ~o->val;
- else
- flags |= o->val;
- goto gotit;
- }
- return false;
-
- gotit:
- options = p;
- }
- return true;
-}
-
-static bool
-from_fstab_line (mnt_t *m, char *line, bool user)
-{
- char *native_path, *posix_path, *fs_type;
-
- /* First field: Native path. */
- char *c = skip_ws (line);
- if (!*c || *c == '#')
- return false;
- char *cend = find_ws (c);
- *cend = '\0';
- native_path = conv_fstab_spaces (c);
- /* Second field: POSIX path. */
- c = skip_ws (cend + 1);
- if (!*c)
- return false;
- cend = find_ws (c);
- *cend = '\0';
- posix_path = conv_fstab_spaces (c);
- /* Third field: FS type. */
- c = skip_ws (cend + 1);
- if (!*c)
- return false;
- cend = find_ws (c);
- *cend = '\0';
- fs_type = c;
- /* Forth field: Flags. */
- c = skip_ws (cend + 1);
- if (!*c)
- return false;
- cend = find_ws (c);
- *cend = '\0';
- unsigned mount_flags = MOUNT_SYSTEM;
- if (!read_flags (c, mount_flags))
- return false;
- if (user)
- mount_flags &= ~MOUNT_SYSTEM;
- if (!strcmp (fs_type, "cygdrive"))
- {
- for (mnt_t *sm = mount_table; sm < m; ++sm)
- if (sm->flags & MOUNT_CYGDRIVE)
- {
- if ((mount_flags & MOUNT_SYSTEM) || !(sm->flags & MOUNT_SYSTEM))
- {
- if (sm->posix)
- free (sm->posix);
- sm->posix = strdup (posix_path);
- sm->flags = mount_flags | MOUNT_CYGDRIVE;
- }
- return false;
- }
- m->posix = strdup (posix_path);
- m->native = strdup (".");
- m->flags = mount_flags | MOUNT_CYGDRIVE;
- }
- else
- {
- for (mnt_t *sm = mount_table; sm < m; ++sm)
- if (!strcasecmp (sm->posix, posix_path))
- {
- if ((mount_flags & MOUNT_SYSTEM) || !(sm->flags & MOUNT_SYSTEM))
- {
- if (sm->native)
- free (sm->native);
- sm->native = strdup (native_path);
- sm->flags = mount_flags;
- }
- return false;
- }
- m->posix = strdup (posix_path);
- unconvert_slashes (native_path);
- m->native = strdup (native_path);
- m->flags = mount_flags;
- }
- return true;
-}
-
-#define BUFSIZE 65536
-
-static char *
-get_user ()
-{
- static char user[UNLEN + 1];
- char *userenv;
-
- user[0] = '\0';
- if ((userenv = getenv ("USER")) || (userenv = getenv ("USERNAME")))
- strncat (user, userenv, UNLEN);
- return user;
-}
-
-void
-from_fstab (bool user, PWCHAR path, PWCHAR path_end)
-{
- mnt_t *m = mount_table + max_mount_entry;
- char buf[BUFSIZE];
-
- if (!user)
- {
- /* Create a default root dir from path. */
- WideCharToMultiByte (GetACP (), 0, path, -1, buf, BUFSIZE,
- NULL, NULL);
- unconvert_slashes (buf);
- char *native_path = buf;
- if (!strncmp (native_path, "\\\\?\\", 4))
- native_path += 4;
- if (!strncmp (native_path, "UNC\\", 4))
- *(native_path += 2) = '\\';
- m->posix = strdup ("/");
- m->native = strdup (native_path);
- m->flags = MOUNT_SYSTEM | MOUNT_BINARY;
- ++m;
- /* Create a default cygdrive entry. Note that this is a user entry.
- This allows to override it with mount, unless the sysadmin created
- a cygdrive entry in /etc/fstab. */
- m->posix = strdup (CYGWIN_INFO_CYGDRIVE_DEFAULT_PREFIX);
- m->native = strdup (".");
- m->flags = MOUNT_BINARY | MOUNT_CYGDRIVE;
- ++m;
- max_mount_entry = m - mount_table;
- }
-
- PWCHAR u = wcscpy (path_end, L"\\etc\\fstab") + 10;
- if (user)
- MultiByteToWideChar (GetACP (), 0, get_user (), -1,
- wcscpy (u, L".d\\") + 3, BUFSIZE - (u - path));
- HANDLE h = CreateFileW (path, GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- if (h == INVALID_HANDLE_VALUE)
- return;
- char *got = buf;
- DWORD len = 0;
- /* Using BUFSIZE-1 leaves space to append two \0. */
- while (ReadFile (h, got, BUFSIZE - 1 - (got - buf),
- &len, NULL))
- {
- char *end;
-
- /* Set end marker. */
- got[len] = got[len + 1] = '\0';
- /* Set len to the absolute len of bytes in buf. */
- len += got - buf;
- /* Reset got to start reading at the start of the buffer again. */
- got = buf;
- while (got < buf + len && (end = strchr (got, '\n')))
- {
- end[end[-1] == '\r' ? -1 : 0] = '\0';
- if (from_fstab_line (m, got, user))
- ++m;
- got = end + 1;
- }
- if (len < BUFSIZE - 1)
- break;
- /* We have to read once more. Move remaining bytes to the start of
- the buffer and reposition got so that it points to the end of
- the remaining bytes. */
- len = buf + len - got;
- memmove (buf, got, len);
- got = buf + len;
- buf[len] = buf[len + 1] = '\0';
- }
- if (got > buf && from_fstab_line (m, got, user))
- ++m;
- max_mount_entry = m - mount_table;
- CloseHandle (h);
-}
-#endif
-
-static int
-mnt_sort (const void *a, const void *b)
-{
- const mnt_t *ma = (const mnt_t *) a;
- const mnt_t *mb = (const mnt_t *) b;
- int ret;
-
- ret = (ma->flags & MOUNT_CYGDRIVE) - (mb->flags & MOUNT_CYGDRIVE);
- if (ret)
- return ret;
- ret = (ma->flags & MOUNT_SYSTEM) - (mb->flags & MOUNT_SYSTEM);
- if (ret)
- return ret;
- return strcmp (ma->posix, mb->posix);
-}
-
-static void
-read_mounts ()
-{
-/* If TESTSUITE is defined, bypass this whole function as a harness
- mount table will be provided. */
-#ifndef TESTSUITE
- HKEY setup_key;
- LONG ret;
- DWORD len;
- WCHAR path[32768];
- PWCHAR path_end;
-
- for (mnt_t *m1 = mount_table; m1->posix; m1++)
- {
- free (m1->posix);
- if (m1->native)
- free ((char *) m1->native);
- m1->posix = NULL;
- }
- max_mount_entry = 0;
-
- for (int i = 0; i < 2; ++i)
- if ((ret = RegOpenKeyExW (i ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
- L"Software\\Cygwin\\setup", 0,
- KEY_READ, &setup_key)) == ERROR_SUCCESS)
- {
- len = 32768 * sizeof (WCHAR);
- ret = RegQueryValueExW (setup_key, L"rootdir", NULL, NULL,
- (PBYTE) path, &len);
- RegCloseKey (setup_key);
- if (ret == ERROR_SUCCESS)
- break;
- }
- if (ret == ERROR_SUCCESS)
- path_end = wcschr (path, L'\0');
- else
- {
- if (!GetModuleFileNameW (NULL, path, 32768))
- return;
- path_end = wcsrchr (path, L'\\');
- if (path_end)
- {
- *path_end = L'\0';
- path_end = wcsrchr (path, L'\\');
- }
- }
- if (!path_end)
- return;
- *path_end = L'\0';
-
- from_fstab (false, path, path_end);
- from_fstab (true, path, path_end);
- qsort (mount_table, max_mount_entry, sizeof (mnt_t), mnt_sort);
-#endif /* !defined(TESTSUITE) */
-}
-
-/* Return non-zero if PATH1 is a prefix of PATH2.
- Both are assumed to be of the same path style and / vs \ usage.
- Neither may be "".
- LEN1 = strlen (PATH1). It's passed because often it's already known.
-
- Examples:
- /foo/ is a prefix of /foo <-- may seem odd, but desired
- /foo is a prefix of /foo/
- / is a prefix of /foo/bar
- / is not a prefix of foo/bar
- foo/ is a prefix foo/bar
- /foo is not a prefix of /foobar
-*/
-
-static int
-path_prefix_p (const char *path1, const char *path2, int len1)
-{
- /* Handle case where PATH1 has trailing '/' and when it doesn't. */
- if (len1 > 0 && isslash (path1[len1 - 1]))
- len1--;
-
- if (len1 == 0)
- return isslash (path2[0]) && !isslash (path2[1]);
-
- if (strncasecmp (path1, path2, len1) != 0)
- return 0;
-
- return isslash (path2[len1]) || path2[len1] == 0 || path1[len1 - 1] == ':';
-}
-
-static char *
-vconcat (const char *s, va_list v)
-{
- int len;
- char *rv, *arg;
- va_list save_v = v;
- int unc;
-
- if (!s)
- return 0;
-
- len = strlen (s);
-
- unc = isslash (*s) && isslash (s[1]);
-
- while (1)
- {
- arg = va_arg (v, char *);
- if (arg == 0)
- break;
- len += strlen (arg);
- }
- va_end (v);
-
- rv = (char *) malloc (len + 1);
- strcpy (rv, s);
- v = save_v;
- while (1)
- {
- arg = va_arg (v, char *);
- if (arg == 0)
- break;
- strcat (rv, arg);
- }
- va_end (v);
-
- char *d, *p;
-
- /* concat is only used for urls and files, so we can safely
- canonicalize the results */
- for (p = d = rv; *p; p++)
- {
- *d++ = *p;
- /* special case for URLs */
- if (*p == ':' && p[1] == '/' && p[2] == '/' && p > rv + 1)
- {
- *d++ = *++p;
- *d++ = *++p;
- }
- else if (isslash (*p))
- {
- if (p == rv && unc)
- *d++ = *p++;
- while (p[1] == '/')
- p++;
- }
- }
- *d = 0;
-
- return rv;
-}
-
-static char *
-concat (const char *s, ...)
-{
- va_list v;
-
- va_start (v, s);
-
- return vconcat (s, v);
-}
-
-/* This is a helper function for when vcygpath is passed what appears
- to be a relative POSIX path. We take a Win32 CWD (either as specified
- in 'cwd' or as retrieved with GetCurrentDirectory() if 'cwd' is NULL)
- and find the mount table entry with the longest match. We replace the
- matching portion with the corresponding POSIX prefix, and to that append
- 's' and anything in 'v'. The returned result is a mostly-POSIX
- absolute path -- 'mostly' because the portions of CWD that didn't
- match the mount prefix will still have '\\' separators. */
-static char *
-rel_vconcat (const char *cwd, const char *s, va_list v)
-{
- char pathbuf[MAX_PATH];
- if (!cwd || *cwd == '\0')
- {
- if (!GetCurrentDirectory (MAX_PATH, pathbuf))
- return NULL;
- cwd = pathbuf;
- }
-
- int max_len = -1;
- mnt_t *m, *match = NULL;
-
- for (m = mount_table; m->posix; m++)
- {
- if (m->flags & MOUNT_CYGDRIVE)
- continue;
-
- int n = strlen (m->native);
- if (n < max_len || !path_prefix_p (m->native, cwd, n))
- continue;
- max_len = n;
- match = m;
- }
-
- char *temppath;
- if (!match)
- // No prefix matched - best effort to return meaningful value.
- temppath = concat (cwd, "/", s, NULL);
- else if (strcmp (match->posix, "/") != 0)
- // Matched on non-root. Copy matching prefix + remaining 'path'.
- temppath = concat (match->posix, cwd + max_len, "/", s, NULL);
- else if (cwd[max_len] == '\0')
- // Matched on root and there's no remaining 'path'.
- temppath = concat ("/", s, NULL);
- else if (isslash (cwd[max_len]))
- // Matched on root but remaining 'path' starts with a slash anyway.
- temppath = concat (cwd + max_len, "/", s, NULL);
- else
- temppath = concat ("/", cwd + max_len, "/", s, NULL);
-
- char *res = vconcat (temppath, v);
- free (temppath);
- return res;
-}
-
-/* Convert a POSIX path in 's' to an absolute Win32 path, and append
- anything in 'v' to the end, returning the result. If 's' is a
- relative path then 'cwd' is used as the working directory to make
- it absolute. Pass NULL in 'cwd' to use GetCurrentDirectory. */
-static char *
-vcygpath (const char *cwd, const char *s, va_list v)
-{
- int max_len = -1;
- mnt_t *m, *match = NULL;
-
- if (!max_mount_entry)
- read_mounts ();
- char *path;
- if (s[0] == '.' && isslash (s[1]))
- s += 2;
-
- if (s[0] == '/' || s[1] == ':') /* FIXME: too crude? */
- path = vconcat (s, v);
- else
- path = rel_vconcat (cwd, s, v);
-
- if (!path)
- return NULL;
-
- if (strncmp (path, "/./", 3) == 0)
- memmove (path + 1, path + 3, strlen (path + 3) + 1);
-
- for (m = mount_table; m->posix; m++)
- {
- if (m->flags & MOUNT_CYGDRIVE)
- continue;
-
- int n = strlen (m->posix);
- if (n < max_len || !path_prefix_p (m->posix, path, n))
- continue;
- max_len = n;
- match = m;
- }
-
- char *native;
- if (match == NULL)
- native = strdup (path);
- else if (max_len == (int) strlen (path))
- native = strdup (match->native);
- else if (isslash (path[max_len]))
- native = concat (match->native, path + max_len, NULL);
- else
- native = concat (match->native, "\\", path + max_len, NULL);
- free (path);
-
- unconvert_slashes (native);
- for (char *s = strstr (native + 1, "\\.\\"); s && *s; s = strstr (s, "\\.\\"))
- memmove (s + 1, s + 3, strlen (s + 3) + 1);
- return native;
-}
-
-char *
-cygpath_rel (const char *cwd, const char *s, ...)
-{
- va_list v;
-
- va_start (v, s);
-
- return vcygpath (cwd, s, v);
-}
-
-char *
-cygpath (const char *s, ...)
-{
- va_list v;
-
- va_start (v, s);
-
- return vcygpath (NULL, s, v);
-}
-
-static mnt_t *m = NULL;
-
-extern "C" FILE *
-setmntent (const char *, const char *)
-{
- m = mount_table;
- if (!max_mount_entry)
- read_mounts ();
- return NULL;
-}
-
-extern "C" struct mntent *
-getmntent (FILE *)
-{
- static mntent mnt;
- if (!m->posix)
- return NULL;
-
- mnt.mnt_fsname = (char *) m->native;
- mnt.mnt_dir = (char *) m->posix;
- if (!mnt.mnt_type)
- mnt.mnt_type = (char *) malloc (1024);
- if (!mnt.mnt_opts)
- mnt.mnt_opts = (char *) malloc (1024);
- if (m->flags & MOUNT_SYSTEM)
- strcpy (mnt.mnt_type, (char *) "system");
- else
- strcpy (mnt.mnt_type, (char *) "user");
- if (!(m->flags & MOUNT_BINARY))
- strcpy (mnt.mnt_opts, (char *) "textmode");
- else
- strcpy (mnt.mnt_opts, (char *) "binmode");
- if (m->flags & MOUNT_CYGWIN_EXEC)
- strcat (mnt.mnt_opts, (char *) ",cygexec");
- else if (m->flags & MOUNT_EXEC)
- strcat (mnt.mnt_opts, (char *) ",exec");
- else if (m->flags & MOUNT_NOTEXEC)
- strcat (mnt.mnt_opts, (char *) ",noexec");
- if ((m->flags & MOUNT_CYGDRIVE)) /* cygdrive */
- strcat (mnt.mnt_opts, (char *) ",cygdrive");
- if ((m->flags & MOUNT_NOACL))
- strcat (mnt.mnt_opts, (char *) ",noacl");
- if ((m->flags & MOUNT_NOPOSIX))
- strcat (mnt.mnt_opts, (char *) ",posix=0");
- mnt.mnt_freq = 1;
- mnt.mnt_passno = 1;
- m++;
- return &mnt;
-}
diff --git a/winsup/utils/path.h b/winsup/utils/path.h
deleted file mode 100644
index 48739df74..000000000
--- a/winsup/utils/path.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* path.h
-
- Copyright 2001, 2002, 2003 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-char *cygpath (const char *s, ...);
-char *cygpath_rel (const char *cwd, const char *s, ...);
-bool is_exe (HANDLE);
-bool is_symlink (HANDLE);
-bool readlink (HANDLE, char *, int);
-int get_word (HANDLE, int);
-int get_dword (HANDLE, int);
-
-#define SYMLINK_MAX 4095 /* PATH_MAX - 1 */
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
deleted file mode 100644
index 2ad2a39a5..000000000
--- a/winsup/utils/ps.cc
+++ /dev/null
@@ -1,432 +0,0 @@
-/* ps.cc
-
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2008 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdio.h>
-#include <windows.h>
-#include <time.h>
-#include <getopt.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <pwd.h>
-#include <limits.h>
-#include <sys/cygwin.h>
-#include <tlhelp32.h>
-#include <psapi.h>
-
-/* Maximum possible path length under NT. There's no official define
- for that value. Note that PATH_MAX is only 4K. */
-#define NT_MAX_PATH 32768
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-static struct option longopts[] =
-{
- {"all", no_argument, NULL, 'a' },
- {"everyone", no_argument, NULL, 'e' },
- {"full", no_argument, NULL, 'f' },
- {"help", no_argument, NULL, 'h' },
- {"long", no_argument, NULL, 'l' },
- {"process", required_argument, NULL, 'p'},
- {"summary", no_argument, NULL, 's' },
- {"user", required_argument, NULL, 'u'},
- {"version", no_argument, NULL, 'v'},
- {"windows", no_argument, NULL, 'W'},
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "aefhlp:su:vW";
-
-typedef BOOL (WINAPI *ENUMPROCESSMODULES)(
- HANDLE hProcess, // handle to the process
- HMODULE * lphModule, // array to receive the module handles
- DWORD cb, // size of the array
- LPDWORD lpcbNeeded // receives the number of bytes returned
-);
-
-typedef DWORD (WINAPI *GETMODULEFILENAME)(
- HANDLE hProcess,
- HMODULE hModule,
- LPTSTR lpstrFileName,
- DWORD nSize
-);
-
-typedef HANDLE (WINAPI *CREATESNAPSHOT)(
- DWORD dwFlags,
- DWORD th32ProcessID
-);
-
-// Win95 functions
-typedef BOOL (WINAPI *PROCESSWALK)(
- HANDLE hSnapshot,
- LPPROCESSENTRY32 lppe
-);
-
-ENUMPROCESSMODULES myEnumProcessModules;
-GETMODULEFILENAME myGetModuleFileNameEx;
-CREATESNAPSHOT myCreateToolhelp32Snapshot;
-PROCESSWALK myProcess32First;
-PROCESSWALK myProcess32Next;
-
-static BOOL WINAPI dummyprocessmodules (
- HANDLE hProcess, // handle to the process
- HMODULE * lphModule, // array to receive the module handles
- DWORD cb, // size of the array
- LPDWORD lpcbNeeded // receives the number of bytes returned
-)
-{
- lphModule[0] = (HMODULE) *lpcbNeeded;
- *lpcbNeeded = 1;
- return 1;
-}
-
-static DWORD WINAPI GetModuleFileNameEx95 (
- HANDLE hProcess,
- HMODULE hModule,
- LPTSTR lpstrFileName,
- DWORD n
-)
-{
- HANDLE h;
- DWORD pid = (DWORD) hModule;
-
- h = myCreateToolhelp32Snapshot (TH32CS_SNAPPROCESS, 0);
- if (!h)
- return 0;
-
- PROCESSENTRY32 proc;
- proc.dwSize = sizeof (proc);
- if (myProcess32First(h, &proc))
- do
- if (proc.th32ProcessID == pid)
- {
- CloseHandle (h);
- strcpy (lpstrFileName, proc.szExeFile);
- return 1;
- }
- while (myProcess32Next (h, &proc));
- CloseHandle (h);
- return 0;
-}
-
-int
-init_win ()
-{
- OSVERSIONINFO os_version_info;
-
- memset (&os_version_info, 0, sizeof os_version_info);
- os_version_info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
- GetVersionEx (&os_version_info);
-
- HMODULE h;
- if (os_version_info.dwPlatformId == VER_PLATFORM_WIN32_NT)
- {
- h = LoadLibrary ("psapi.dll");
- if (!h)
- return 0;
- myEnumProcessModules = (ENUMPROCESSMODULES) GetProcAddress (h, "EnumProcessModules");
- myGetModuleFileNameEx = (GETMODULEFILENAME) GetProcAddress (h, "GetModuleFileNameExA");
- if (!myEnumProcessModules || !myGetModuleFileNameEx)
- return 0;
- return 1;
- }
-
- h = GetModuleHandle("KERNEL32.DLL");
- myCreateToolhelp32Snapshot = (CREATESNAPSHOT)GetProcAddress (h, "CreateToolhelp32Snapshot");
- myProcess32First = (PROCESSWALK)GetProcAddress (h, "Process32First");
- myProcess32Next = (PROCESSWALK)GetProcAddress (h, "Process32Next");
- if (!myCreateToolhelp32Snapshot || !myProcess32First || !myProcess32Next)
- return 0;
-
- myEnumProcessModules = dummyprocessmodules;
- myGetModuleFileNameEx = GetModuleFileNameEx95;
- return 1;
-}
-
-static char *
-start_time (external_pinfo *child)
-{
- time_t st = child->start_time;
- time_t t = time (NULL);
- static char stime[40] = {'\0'};
- char now[40];
-
- strncpy (stime, ctime (&st) + 4, 15);
- strcpy (now, ctime (&t) + 4);
-
- if ((t - st) < (24 * 3600))
- return (stime + 7);
-
- stime[6] = '\0';
-
- return stime;
-}
-
-#define FACTOR (0x19db1ded53ea710LL)
-#define NSPERSEC 10000000LL
-
-/* Convert a Win32 time to "UNIX" format. */
-long __stdcall
-to_time_t (FILETIME *ptr)
-{
- /* A file time is the number of 100ns since jan 1 1601
- stuffed into two long words.
- A time_t is the number of seconds since jan 1 1970. */
-
- long rem;
- long long x = ((long long) ptr->dwHighDateTime << 32) + ((unsigned)ptr->dwLowDateTime);
- x -= FACTOR; /* number of 100ns between 1601 and 1970 */
- rem = x % ((long long)NSPERSEC);
- rem += (NSPERSEC / 2);
- x /= (long long) NSPERSEC; /* number of 100ns in a second */
- x += (long long) (rem / NSPERSEC);
- return x;
-}
-
-static const char *
-ttynam (int ntty)
-{
- static char buf[5];
- if (ntty < 0)
- return " ?";
- if (ntty == TTY_CONSOLE)
- return " con";
- sprintf (buf, "%4d", ntty);
- return buf;
-}
-
-static void
-usage (FILE * stream, int status)
-{
- fprintf (stream, "\
-Usage: %s [-aefls] [-u UID] [-p PID]\n\
-Report process status\n\
-\n\
- -a, --all show processes of all users\n\
- -e, --everyone show processes of all users\n\
- -f, --full show process uids, ppids\n\
- -h, --help output usage information and exit\n\
- -l, --long show process uids, ppids, pgids, winpids\n\
- -p, --process show information for specified PID\n\
- -s, --summary show process summary\n\
- -u, --user list processes owned by UID\n\
- -v, --version output version information and exit\n\
- -W, --windows show windows as well as cygwin processes\n\
-With no options, %s outputs the long format by default\n",
- prog_name, prog_name);
- exit (status);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Process Statistics\n\
-Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s\n\
-", prog_name, len, v, __DATE__);
-}
-
-int
-main (int argc, char *argv[])
-{
- external_pinfo *p;
- int aflag, lflag, fflag, sflag, uid, proc_id;
- cygwin_getinfo_types query = CW_GETPINFO;
- const char *dtitle = " PID TTY STIME COMMAND\n";
- const char *dfmt = "%7d%4s%10s %s\n";
- const char *ftitle = " UID PID PPID TTY STIME COMMAND\n";
- const char *ffmt = "%8.8s%8d%8d%4s%10s %s\n";
- const char *ltitle = " PID PPID PGID WINPID TTY UID STIME COMMAND\n";
- const char *lfmt = "%c %7d %7d %7d %10u %4s %4u %8s %s\n";
- char ch;
-
- aflag = lflag = fflag = sflag = 0;
- uid = getuid ();
- proc_id = -1;
- lflag = 1;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- while ((ch = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (ch)
- {
- case 'a':
- case 'e':
- aflag = 1;
- break;
- case 'f':
- fflag = 1;
- break;
- case 'h':
- usage (stdout, 0);
- case 'l':
- lflag = 1;
- break;
- case 'p':
- proc_id = atoi (optarg);
- aflag = 1;
- break;
- case 's':
- sflag = 1;
- break;
- case 'u':
- uid = atoi (optarg);
- if (uid == 0)
- {
- struct passwd *pw;
-
- if ((pw = getpwnam (optarg)))
- uid = pw->pw_uid;
- else
- {
- fprintf (stderr, "%s: user %s unknown\n", prog_name, optarg);
- exit (1);
- }
- }
- break;
- case 'v':
- print_version ();
- exit (0);
- break;
- case 'W':
- query = CW_GETPINFO_FULL;
- aflag = 1;
- break;
-
- default:
- usage (stderr, 1);
- }
-
- if (sflag)
- printf (dtitle);
- else if (fflag)
- printf (ftitle);
- else if (lflag)
- printf (ltitle);
-
- (void) cygwin_internal (CW_LOCK_PINFO, 1000);
-
- if (query == CW_GETPINFO_FULL && !init_win ())
- query = CW_GETPINFO;
-
- for (int pid = 0;
- (p = (external_pinfo *) cygwin_internal (query, pid | CW_NEXTPID));
- pid = p->pid)
- {
- if ((proc_id > 0) && (p->pid != proc_id))
- continue;
-
- if (aflag)
- /* nothing to do */;
- else if (p->version >= EXTERNAL_PINFO_VERSION_32_BIT)
- {
- if (p->uid32 != (__uid32_t) uid)
- continue;
- }
- else if (p->uid != uid)
- continue;
- char status = ' ';
- if (p->process_state & PID_STOPPED)
- status = 'S';
- else if (p->process_state & PID_TTYIN)
- status = 'I';
- else if (p->process_state & PID_TTYOU)
- status = 'O';
-
- /* Maximum possible path length under NT. There's no official define
- for that value. */
- char pname[NT_MAX_PATH];
- if (p->process_state & PID_EXITED || (p->exitcode & ~0xffff))
- strcpy (pname, "<defunct>");
- else if (p->ppid)
- {
- char *s;
- pname[0] = '\0';
- if (p->version >= EXTERNAL_PINFO_VERSION_32_LP)
- cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE,
- p->progname_long, pname, NT_MAX_PATH);
- else
- cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE,
- p->progname, pname, NT_MAX_PATH);
- s = strchr (pname, '\0') - 4;
- if (s > pname && strcasecmp (s, ".exe") == 0)
- *s = '\0';
- }
- else if (query == CW_GETPINFO_FULL)
- {
- HANDLE h = OpenProcess (PROCESS_QUERY_INFORMATION | PROCESS_VM_READ,
- FALSE, p->dwProcessId);
- if (!h)
- continue;
- HMODULE hm[1000];
- DWORD n = p->dwProcessId;
- if (!myEnumProcessModules (h, hm, sizeof (hm), &n))
- n = 0;
- if (!n || !myGetModuleFileNameEx (h, hm[0], pname, PATH_MAX))
- strcpy (pname, "*** unknown ***");
- FILETIME ct, et, kt, ut;
- if (GetProcessTimes (h, &ct, &et, &kt, &ut))
- p->start_time = to_time_t (&ct);
- CloseHandle (h);
- }
-
- char uname[128];
-
- if (fflag)
- {
- struct passwd *pw;
-
- if ((pw = getpwuid (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ?
- p->uid32 : p->uid)))
- strcpy (uname, pw->pw_name);
- else
- sprintf (uname, "%u", (unsigned)
- (p->version >= EXTERNAL_PINFO_VERSION_32_BIT ?
- p->uid32 : p->uid));
- }
-
- if (sflag)
- printf (dfmt, p->pid, ttynam (p->ctty), start_time (p), pname);
- else if (fflag)
- printf (ffmt, uname, p->pid, p->ppid, ttynam (p->ctty), start_time (p),
- pname);
- else if (lflag)
- printf (lfmt, status, p->pid, p->ppid, p->pgid,
- p->dwProcessId, ttynam (p->ctty),
- p->version >= EXTERNAL_PINFO_VERSION_32_BIT ? p->uid32 : p->uid,
- start_time (p), pname);
-
- }
- (void) cygwin_internal (CW_UNLOCK_PINFO);
-
- return 0;
-}
-
diff --git a/winsup/utils/regtool.cc b/winsup/utils/regtool.cc
deleted file mode 100644
index 7a853be85..000000000
--- a/winsup/utils/regtool.cc
+++ /dev/null
@@ -1,980 +0,0 @@
-/* regtool.cc
-
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <ctype.h>
-#include <getopt.h>
-#define WINVER 0x0502
-#include <windows.h>
-#include <sys/cygwin.h>
-
-#define DEFAULT_KEY_SEPARATOR '\\'
-
-#define REG_AUTO -1
-
-int value_type = REG_AUTO;
-
-char key_sep = DEFAULT_KEY_SEPARATOR;
-
-#define LIST_KEYS 0x01
-#define LIST_VALS 0x02
-#define LIST_ALL (LIST_KEYS | LIST_VALS)
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-static struct option longopts[] =
-{
- {"binary", no_argument, NULL, 'b' },
- {"dword", no_argument, NULL, 'd' },
- {"dword-le", no_argument, NULL, 'D' },
- {"expand-string", no_argument, NULL, 'e' },
- {"help", no_argument, NULL, 'h' },
- {"integer", no_argument, NULL, 'i' },
- {"keys", no_argument, NULL, 'k'},
- {"list", no_argument, NULL, 'l'},
- {"multi-string", no_argument, NULL, 'm'},
- {"none", no_argument, NULL, 'n' },
- {"postfix", no_argument, NULL, 'p'},
- {"quiet", no_argument, NULL, 'q'},
- {"qword", no_argument, NULL, 'Q' },
- {"string", no_argument, NULL, 's'},
- {"verbose", no_argument, NULL, 'v'},
- {"version", no_argument, NULL, 'V'},
- {"wow64", no_argument, NULL, 'w'},
- {"wow32", no_argument, NULL, 'W'},
- {"hex", no_argument, NULL, 'x'},
- {"key-separator", required_argument, NULL, 'K'},
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "bdDehiklmnpqQsvVwWxK:";
-
-const char *types[] =
-{
- "REG_NONE",
- "REG_SZ",
- "REG_EXPAND_SZ",
- "REG_BINARY",
- "REG_DWORD",
- "REG_DWORD_BIG_ENDIAN",
- "REG_LINK",
- "REG_MULTI_SZ",
- "REG_RESOURCE_LIST",
- "REG_FULL_RESOURCE_DESCRIPTOR",
- "REG_RESOURCE_REQUIREMENTS_LIST",
- "REG_QWORD",
-};
-
-int listwhat = 0;
-int postfix = 0;
-int verbose = 0;
-int quiet = 0;
-int hex = 0;
-DWORD wow64 = 0;
-char **argv;
-
-HKEY key;
-char *value;
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where, ""
- "Usage: %s [OPTION] ACTION KEY [data...]\n"
- "View or edit the Win32 registry\n"
- "\n", prog_name);
- if (where == stdout)
- {
- fprintf (where, ""
- "Actions:\n"
- " add KEY\\SUBKEY add new SUBKEY\n"
- " check KEY exit 0 if KEY exists, 1 if not\n"
- " get KEY\\VALUE prints VALUE to stdout\n"
- " list KEY list SUBKEYs and VALUEs\n"
- " remove KEY remove KEY\n"
- " set KEY\\VALUE [data ...] set VALUE\n"
- " unset KEY\\VALUE removes VALUE from KEY\n"
- " load KEY\\SUBKEY PATH load hive from PATH into new SUBKEY\n"
- " unload KEY\\SUBKEY unload hive and remove SUBKEY\n"
- " save KEY\\SUBKEY PATH save SUBKEY into new hive PATH\n"
- "\n");
- fprintf (where, ""
- "Options for 'list' Action:\n"
- " -k, --keys print only KEYs\n"
- " -l, --list print only VALUEs\n"
- " -p, --postfix like ls -p, appends '\\' postfix to KEY names\n"
- "\n"
- "Options for 'get' Action:\n"
- " -b, --binary print data as printable hex bytes\n"
- " -n, --none print data as stream of bytes as stored in registry\n"
- " -x, --hex print numerical data as hex numbers\n"
- "\n"
- "Options for 'set' Action:\n"
- " -b, --binary set type to REG_BINARY (hex args or '-')\n"
- " -d, --dword set type to REG_DWORD\n"
- " -D, --dword-le set type to REG_DWORD_LITTLE_ENDIAN\n"
- " -e, --expand-string set type to REG_EXPAND_SZ\n"
- " -i, --integer set type to REG_DWORD\n"
- " -m, --multi-string set type to REG_MULTI_SZ\n"
- " -n, --none set type to REG_NONE\n"
- " -Q, --qword set type to REG_QWORD\n"
- " -s, --string set type to REG_SZ\n"
- "\n"
- "Options for 'set' and 'unset' Actions:\n"
- " -K<c>, --key-separator[=]<c> set key-value separator to <c> instead of '\\'\n"
- "\n"
- "Other Options:\n"
- " -h, --help output usage information and exit\n"
- " -q, --quiet no error output, just nonzero return if KEY/VALUE missing\n"
- " -v, --verbose verbose output, including VALUE contents when applicable\n"
- " -w, --wow64 access 64 bit registry view (ignored on 32 bit Windows)\n"
- " -W, --wow32 access 32 bit registry view (ignored on 32 bit Windows)\n"
- " -V, --version output version information and exit\n"
- "\n");
- fprintf (where, ""
- "KEY is in the format [host]\\prefix\\KEY\\KEY\\VALUE, where host is optional\n"
- "remote host in either \\\\hostname or hostname: format and prefix is any of:\n"
- " root HKCR HKEY_CLASSES_ROOT (local only)\n"
- " config HKCC HKEY_CURRENT_CONFIG (local only)\n"
- " user HKCU HKEY_CURRENT_USER (local only)\n"
- " machine HKLM HKEY_LOCAL_MACHINE\n"
- " users HKU HKEY_USERS\n"
- "\n"
- "If the keyname starts with a forward slash ('/'), the forward slash is used\n"
- "as separator and the backslash can be used as escape character.\n");
- fprintf (where, ""
- "Example:\n"
- "%s list '/machine/SOFTWARE/Classes/MIME/Database/Content Type/audio\\/wav'\n", prog_name);
- }
- if (where == stderr)
- fprintf (where,
- "ACTION is one of add, check, get, list, remove, set, unset, load, unload, save\n"
- "\n"
- "Try '%s --help' for more information.\n", prog_name);
- exit (where == stderr ? 1 : 0);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Registry Tool\n\
-Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Red Hat, Inc.\n\
-Compiled on %s\n\
-", prog_name, len, v, __DATE__);
-}
-
-void
-Fail (DWORD rv)
-{
- char *buf;
- if (!quiet)
- {
- FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
- | FORMAT_MESSAGE_FROM_SYSTEM,
- 0, rv, 0, (CHAR *) & buf, 0, 0);
- fprintf (stderr, "Error (%ld): %s\n", rv, buf);
- LocalFree (buf);
- }
- exit (1);
-}
-
-static struct
-{
- const char *string;
- HKEY key;
-} wkprefixes[] =
-{
- {"root", HKEY_CLASSES_ROOT},
- {"HKCR", HKEY_CLASSES_ROOT},
- {"HKEY_CLASSES_ROOT", HKEY_CLASSES_ROOT},
- {"config", HKEY_CURRENT_CONFIG},
- {"HKCC", HKEY_CURRENT_CONFIG},
- {"HKEY_CURRENT_CONFIG", HKEY_CURRENT_CONFIG},
- {"user", HKEY_CURRENT_USER},
- {"HKCU", HKEY_CURRENT_USER},
- {"HKEY_CURRENT_USER", HKEY_CURRENT_USER},
- {"machine", HKEY_LOCAL_MACHINE},
- {"HKLM", HKEY_LOCAL_MACHINE},
- {"HKEY_LOCAL_MACHINE", HKEY_LOCAL_MACHINE},
- {"users", HKEY_USERS},
- {"HKU", HKEY_USERS},
- {"HKEY_USERS", HKEY_USERS},
- {0, 0}
-};
-
-void
-translate (char *key)
-{
-#define isodigit(c) (strchr("01234567", c))
-#define tooct(c) ((c)-'0')
-#define tohex(c) (strchr(_hs,tolower(c))-_hs)
- static char _hs[] = "0123456789abcdef";
-
- char *d = key;
- char *s = key;
- char c;
-
- while (*s)
- {
- if (*s == '\\')
- switch (*++s)
- {
- case 'a':
- *d++ = '\007';
- break;
- case 'b':
- *d++ = '\b';
- break;
- case 'e':
- *d++ = '\033';
- break;
- case 'f':
- *d++ = '\f';
- break;
- case 'n':
- *d++ = '\n';
- break;
- case 'r':
- *d++ = '\r';
- break;
- case 't':
- *d++ = '\t';
- break;
- case 'v':
- *d++ = '\v';
- break;
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- c = tooct (*s);
- if (isodigit (s[1]))
- {
- c = (c << 3) | tooct (*++s);
- if (isodigit (s[1]))
- c = (c << 3) | tooct (*++s);
- }
- *d++ = c;
- break;
- case 'x':
- if (!isxdigit (s[1]))
- c = '0';
- else
- {
- c = tohex (*++s);
- if (isxdigit (s[1]))
- c = (c << 4) | tohex (*++s);
- }
- *d++ = c;
- break;
- default: /* before non-special char: just add the char */
- *d++ = *s;
- break;
- }
- else if (*s == '/')
- *d++ = '\\';
- else
- *d++ = *s;
- ++s;
- }
- *d = '\0';
-}
-
-void
-find_key (int howmanyparts, REGSAM access, int option = 0)
-{
- HKEY base;
- int rv;
- char *n = argv[0], *e, *h, c;
- char* host = NULL;
- int i;
- if (*n == '/')
- translate (n);
- if (*n != '\\')
- {
- /* expect host:/key/value format */
- host = (char*) malloc (strlen (n) + 1);
- host[0] = host [1] = '\\';
- for (e = n, h = host + 2; *e && *e != ':'; e++, h++)
- *h = *e;
- *h = 0;
- n = e + 1;
- if (*n == '/')
- translate (n);
- }
- else if (n[0] == '\\' && n[1] == '\\')
- {
- /* expect //host/key/value format */
- host = (char*) malloc (strlen (n) + 1);
- host[0] = host[1] = '\\';
- for (e = n + 2, h = host + 2; *e && *e != '\\'; e++, h++)
- *h = *e;
- *h = 0;
- n = e;
- }
- while (*n != '\\')
- n++;
- *n++ = 0;
- for (e = n; *e && *e != '\\'; e++);
- c = *e;
- *e = 0;
- for (i = 0; wkprefixes[i].string; i++)
- if (strcmp (wkprefixes[i].string, n) == 0)
- break;
- if (!wkprefixes[i].string)
- {
- fprintf (stderr, "Unknown key prefix. Valid prefixes are:\n");
- for (i = 0; wkprefixes[i].string; i++)
- fprintf (stderr, "\t%s\n", wkprefixes[i].string);
- exit (1);
- }
-
- n = e;
- *e = c;
- while (*n && *n == '\\')
- n++;
- e = n + strlen (n);
- if (howmanyparts > 1)
- {
- while (n < e && *e != key_sep)
- e--;
- if (*e != key_sep)
- {
- key = wkprefixes[i].key;
- value = n;
- return;
- }
- else
- {
- *e = 0;
- value = e + 1;
- }
- }
- if (host)
- {
- rv = RegConnectRegistry (host, wkprefixes[i].key, &base);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- free (host);
- }
- else
- base = wkprefixes[i].key;
-
- if (n[0] == 0)
- key = base;
- else
- {
- if (access)
- {
- rv = RegOpenKeyEx (base, n, 0, access | wow64, &key);
- if (option && (rv == ERROR_SUCCESS || rv == ERROR_ACCESS_DENIED))
- {
- /* reopen with desired option due to missing option support in RegOpenKeyE */
- /* FIXME: may create the key in rare cases (e.g. access denied in parent) */
- HKEY key2;
- if (RegCreateKeyEx (base, n, 0, NULL, option, access | wow64, NULL, &key2, NULL)
- == ERROR_SUCCESS)
- {
- if (rv == ERROR_SUCCESS)
- RegCloseKey (key);
- key = key2;
- rv = ERROR_SUCCESS;
- }
- }
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- }
- else if (argv[1])
- {
- ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE,
- argv[1], NULL, 0);
- char win32_path[len];
- cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, argv[1],
- win32_path, len);
- rv = RegLoadKey (base, n, win32_path);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- if (verbose)
- printf ("key %s loaded from file %s\n", n, win32_path);
- }
- else
- {
- rv = RegUnLoadKey (base, n);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- if (verbose)
- printf ("key %s unloaded\n", n);
- }
- }
- //printf("key `%s' value `%s'\n", n, value);
-}
-
-
-int
-cmd_list ()
-{
- DWORD num_subkeys, maxsubkeylen, num_values, maxvalnamelen, maxvaluelen;
- DWORD maxclasslen;
- char *subkey_name, *value_name, *class_name;
- unsigned char *value_data, *vd;
- DWORD i, j, m, n, t;
- int v;
-
- find_key (1, KEY_READ);
- RegQueryInfoKey (key, 0, 0, 0, &num_subkeys, &maxsubkeylen, &maxclasslen,
- &num_values, &maxvalnamelen, &maxvaluelen, 0, 0);
-
- subkey_name = (char *) malloc (maxsubkeylen + 1);
- class_name = (char *) malloc (maxclasslen + 1);
- value_name = (char *) malloc (maxvalnamelen + 1);
- value_data = (unsigned char *) malloc (maxvaluelen + 1);
-
- if (!listwhat)
- listwhat = LIST_ALL;
-
- if (listwhat & LIST_KEYS)
- for (i = 0; i < num_subkeys; i++)
- {
- m = maxsubkeylen + 1;
- n = maxclasslen + 1;
- RegEnumKeyEx (key, i, subkey_name, &m, 0, class_name, &n, 0);
- fputs (subkey_name, stdout);
- if (postfix || verbose)
- fputc (key_sep, stdout);
-
- if (verbose)
- printf (" (%s)", class_name);
-
- puts ("");
- }
-
- if (listwhat & LIST_VALS)
- for (i = 0; i < num_values; i++)
- {
- m = maxvalnamelen + 1;
- n = maxvaluelen + 1;
- RegEnumValue (key, i, value_name, &m, 0, &t, (BYTE *) value_data, &n);
- value_data[n] = 0;
- if (!verbose)
- printf ("%s\n", value_name);
- else
- {
- printf ("%s (%s) = ", value_name, types[t]);
- switch (t)
- {
- case REG_NONE:
- case REG_LINK:
- case REG_BINARY:
- for (j = 0; j < 8 && j < n; j++)
- printf ("%02x ", value_data[j]);
- printf ("\n");
- break;
- case REG_DWORD:
- printf ("0x%08lx (%lu)\n", *(DWORD *) value_data,
- *(DWORD *) value_data);
- break;
- case REG_DWORD_BIG_ENDIAN:
- v = ((value_data[0] << 24)
- | (value_data[1] << 16)
- | (value_data[2] << 8)
- | (value_data[3]));
- printf ("0x%08x (%d)\n", v, v);
- break;
- case REG_QWORD:
- printf ("0x%016llx (%llu)\n",
- *(unsigned long long *) value_data,
- *(unsigned long long *) value_data);
- break;
- case REG_EXPAND_SZ:
- case REG_SZ:
- printf ("\"%s\"\n", value_data);
- break;
- case REG_MULTI_SZ:
- vd = value_data;
- while (vd && *vd)
- {
- printf ("\"%s\"", vd);
- vd = vd + strlen ((const char *) vd) + 1;
- if (*vd)
- printf (", ");
- }
- printf ("\n");
- break;
- default:
- printf ("?\n");
- break;
- }
- }
- }
- return 0;
-}
-
-int
-cmd_add ()
-{
- find_key (2, KEY_ALL_ACCESS);
- HKEY newkey;
- DWORD newtype;
- int rv = RegCreateKeyEx (key, value, 0, (char *) "", REG_OPTION_NON_VOLATILE,
- KEY_ALL_ACCESS | wow64, 0, &newkey, &newtype);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
-
- if (verbose)
- {
- if (newtype == REG_OPENED_EXISTING_KEY)
- printf ("Key %s already exists\n", value);
- else
- printf ("Key %s created\n", value);
- }
- return 0;
-}
-
-extern "C" {
-WINADVAPI LONG WINAPI (*regDeleteKeyEx)(HKEY, LPCSTR, REGSAM, DWORD);
-}
-
-int
-cmd_remove ()
-{
- DWORD rv;
-
- find_key (2, KEY_ALL_ACCESS);
- if (wow64)
- {
- HMODULE mod = LoadLibrary ("advapi32.dll");
- if (mod)
- regDeleteKeyEx = (WINADVAPI LONG WINAPI (*)(HKEY, LPCSTR, REGSAM, DWORD)) GetProcAddress (mod, "RegDeleteKeyExA");
- }
- if (regDeleteKeyEx)
- rv = (*regDeleteKeyEx) (key, value, wow64, 0);
- else
- rv = RegDeleteKey (key, value);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- if (verbose)
- printf ("subkey %s deleted\n", value);
- return 0;
-}
-
-int
-cmd_check ()
-{
- find_key (1, KEY_READ);
- if (verbose)
- printf ("key %s exists\n", argv[0]);
- return 0;
-}
-
-int
-cmd_set ()
-{
- int i, n;
- DWORD v, rv;
- unsigned long long llval;
- char *a = argv[1], *data = 0;
- find_key (2, KEY_ALL_ACCESS);
-
- if (!a)
- usage ();
- if (value_type == REG_AUTO)
- {
- char *e;
- llval = strtoull (a, &e, 0);
- if (a[0] == '%')
- value_type = REG_EXPAND_SZ;
- else if (a[0] && !*e)
- value_type = llval > 0xffffffffULL ? REG_QWORD : REG_DWORD;
- else if (argv[2])
- value_type = REG_MULTI_SZ;
- else
- value_type = REG_SZ;
- }
-
- switch (value_type)
- {
- case REG_NONE:
- case REG_BINARY:
- for (n = 0; argv[n+1]; n++)
- ;
- if (n == 1 && strcmp (argv[1], "-") == 0)
- { /* read from stdin */
- i = n = 0;
- for (;;)
- {
- if (i <= n)
- {
- i = n + BUFSIZ;
- data = (char *) realloc (data, i);
- }
- int r = fread (data+n, 1, i-n, stdin);
- if (r <= 0)
- break;
- n += r;
- }
- }
- else if (n > 0)
- { /* parse hex from argv */
- data = (char *) malloc (n);
- for (i = 0; i < n; i++)
- {
- char *e;
- errno = 0;
- v = strtoul (argv[i+1], &e, 16);
- if (errno || v > 0xff || *e)
- {
- fprintf (stderr, "Invalid hex constant `%s'\n", argv[i+1]);
- exit (1);
- }
- data[i] = (char) v;
- }
- }
- rv = RegSetValueEx (key, value, 0, value_type, (const BYTE *) data, n);
- break;
- case REG_DWORD:
- v = strtoul (a, 0, 0);
- rv = RegSetValueEx (key, value, 0, REG_DWORD, (const BYTE *) &v,
- sizeof (v));
- break;
- case REG_DWORD_BIG_ENDIAN:
- v = strtoul (a, 0, 0);
- v = (((v & 0xff) << 24)
- | ((v & 0xff00) << 8)
- | ((v & 0xff0000) >> 8)
- | ((v & 0xff000000) >> 24));
- rv = RegSetValueEx (key, value, 0, REG_DWORD_BIG_ENDIAN,
- (const BYTE *) &v, sizeof (v));
- break;
- case REG_QWORD:
- llval = strtoul (a, 0, 0);
- rv = RegSetValueEx (key, value, 0, REG_QWORD, (const BYTE *) &llval,
- sizeof (llval));
- break;
- case REG_SZ:
- rv = RegSetValueEx (key, value, 0, REG_SZ, (const BYTE *) a, strlen (a) + 1);
- break;
- case REG_EXPAND_SZ:
- rv = RegSetValueEx (key, value, 0, REG_EXPAND_SZ, (const BYTE *) a,
- strlen (a) + 1);
- break;
- case REG_MULTI_SZ:
- for (i = 1, n = 1; argv[i]; i++)
- n += strlen (argv[i]) + 1;
- data = (char *) malloc (n);
- for (i = 1, n = 0; argv[i]; i++)
- {
- strcpy (data + n, argv[i]);
- n += strlen (argv[i]) + 1;
- }
- data[n] = 0;
- rv = RegSetValueEx (key, value, 0, REG_MULTI_SZ, (const BYTE *) data,
- n + 1);
- break;
- case REG_AUTO:
- rv = ERROR_SUCCESS;
- break;
- default:
- rv = ERROR_INVALID_CATEGORY;
- break;
- }
-
- if (data)
- free(data);
-
- if (rv != ERROR_SUCCESS)
- Fail (rv);
-
- return 0;
-}
-
-int
-cmd_unset ()
-{
- find_key (2, KEY_ALL_ACCESS);
- DWORD rv = RegDeleteValue (key, value);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- if (verbose)
- printf ("value %s deleted\n", value);
- return 0;
-}
-
-int
-cmd_get ()
-{
- find_key (2, KEY_READ);
- DWORD vtype, dsize, rv;
- char *data, *vd;
- rv = RegQueryValueEx (key, value, 0, &vtype, 0, &dsize);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- data = (char *) malloc (dsize + 1);
- rv = RegQueryValueEx (key, value, 0, &vtype, (BYTE *) data, &dsize);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- if (value_type == REG_BINARY)
- {
- for (unsigned i = 0; i < dsize; i++)
- printf ("%02x%c", (unsigned char)data[i],
- (i < dsize-1 ? ' ' : '\n'));
- }
- else if (value_type == REG_NONE)
- fwrite (data, dsize, 1, stdout);
- else
- switch (vtype)
- {
- case REG_NONE:
- case REG_BINARY:
- case REG_LINK:
- fwrite (data, dsize, 1, stdout);
- break;
- case REG_DWORD:
- printf (hex ? "0x%08lx\n" : "%lu\n", *(DWORD *) data);
- break;
- case REG_DWORD_BIG_ENDIAN:
- rv = ((data[0] << 24)
- | (data[1] << 16)
- | (data[2] << 8)
- | (data[3]));
- printf (hex ? "0x%08lx\n" : "%lu\n", rv);
- break;
- case REG_QWORD:
- printf (hex ? "0x%016llx\n" : "%llu\n", *(unsigned long long *) data);
- break;
- case REG_SZ:
- printf ("%s\n", data);
- break;
- case REG_EXPAND_SZ:
- if (value_type == REG_EXPAND_SZ) // hack
- {
- char *buf;
- DWORD bufsize;
- bufsize = ExpandEnvironmentStrings (data, 0, 0);
- buf = (char *) malloc (bufsize + 1);
- ExpandEnvironmentStrings (data, buf, bufsize + 1);
- free (data);
- data = buf;
- }
- printf ("%s\n", data);
- break;
- case REG_MULTI_SZ:
- vd = data;
- while (vd && *vd)
- {
- printf ("%s\n", vd);
- vd = vd + strlen ((const char *) vd) + 1;
- }
- break;
- }
- return 0;
-}
-
-int
-cmd_load ()
-{
- if (!argv[1])
- {
- usage ();
- return 1;
- }
- find_key (1, 0);
- return 0;
-}
-
-int
-cmd_unload ()
-{
- if (argv[1])
- {
- usage ();
- return 1;
- }
- find_key (1, 0);
- return 0;
-}
-
-DWORD
-set_privilege (const char * name)
-{
- TOKEN_PRIVILEGES tp;
- if (!LookupPrivilegeValue (NULL, name, &tp.Privileges[0].Luid))
- return GetLastError ();
- tp.PrivilegeCount = 1;
- tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
- HANDLE t;
- /* OpenProcessToken does not work here, because main thread has its own
- impersonation token */
- if (!OpenThreadToken (GetCurrentThread (), TOKEN_ADJUST_PRIVILEGES, FALSE, &t))
- return GetLastError ();
- AdjustTokenPrivileges (t, FALSE, &tp, 0, NULL, NULL);
- DWORD rv = GetLastError ();
- CloseHandle (t);
- return rv;
-}
-
-int
-cmd_save ()
-{
- if (!argv[1])
- {
- usage ();
- return 1;
- }
- /* try to set SeBackupPrivilege, let RegSaveKey report the error */
- set_privilege (SE_BACKUP_NAME);
- /* REG_OPTION_BACKUP_RESTORE is necessary to save /HKLM/SECURITY */
- find_key (1, KEY_QUERY_VALUE, REG_OPTION_BACKUP_RESTORE);
- ssize_t len = cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE,
- argv[1], NULL, 0);
- char win32_path[len];
- cygwin_conv_path (CCP_POSIX_TO_WIN_A | CCP_RELATIVE, argv[1],
- win32_path, len);
- DWORD rv = RegSaveKey (key, win32_path, NULL);
- if (rv != ERROR_SUCCESS)
- Fail (rv);
- if (verbose)
- printf ("key saved to %s\n", win32_path);
- return 0;
-}
-
-static struct
-{
- const char *name;
- int (*func) ();
-} commands[] =
-{
- {"list", cmd_list},
- {"add", cmd_add},
- {"remove", cmd_remove},
- {"check", cmd_check},
- {"set", cmd_set},
- {"unset", cmd_unset},
- {"get", cmd_get},
- {"load", cmd_load},
- {"unload", cmd_unload},
- {"save", cmd_save},
- {0, 0}
-};
-
-int
-main (int argc, char **_argv)
-{
- int g;
-
- prog_name = strrchr (_argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (_argv[0], '\\');
- if (prog_name == NULL)
- prog_name = _argv[0];
- else
- prog_name++;
-
- while ((g = getopt_long (argc, _argv, opts, longopts, NULL)) != EOF)
- switch (g)
- {
- case 'b':
- value_type = REG_BINARY;
- break;
- case 'd':
- value_type = REG_DWORD;
- break;
- case 'D':
- value_type = REG_DWORD_BIG_ENDIAN;
- break;
- case 'e':
- value_type = REG_EXPAND_SZ;
- break;
- case 'k':
- listwhat |= LIST_KEYS;
- break;
- case 'h':
- usage (stdout);
- case 'i':
- value_type = REG_DWORD;
- break;
- case 'l':
- listwhat |= LIST_VALS;
- break;
- case 'm':
- value_type = REG_MULTI_SZ;
- break;
- case 'n':
- value_type = REG_NONE;
- break;
- case 'p':
- postfix++;
- break;
- case 'q':
- quiet++;
- break;
- case 'Q':
- value_type = REG_QWORD;
- break;
- case 's':
- value_type = REG_SZ;
- break;
- case 'v':
- verbose++;
- break;
- case 'V':
- print_version ();
- exit (0);
- case 'w':
- wow64 = KEY_WOW64_64KEY;
- break;
- case 'W':
- wow64 = KEY_WOW64_32KEY;
- break;
- case 'x':
- hex++;
- break;
- case 'K':
- key_sep = *optarg;
- break;
- default :
- usage ();
- }
-
- if ((_argv[optind] == NULL) || (_argv[optind+1] == NULL))
- usage ();
-
- argv = _argv + optind;
- int i;
- for (i = 0; commands[i].name; i++)
- if (strcmp (commands[i].name, argv[0]) == 0)
- {
- argv++;
- return commands[i].func ();
- }
- usage ();
-
- return 0;
-}
diff --git a/winsup/utils/setfacl.c b/winsup/utils/setfacl.c
deleted file mode 100644
index 8dcce4a73..000000000
--- a/winsup/utils/setfacl.c
+++ /dev/null
@@ -1,573 +0,0 @@
-/* setfacl.c
-
- Copyright 2000, 2001, 2002, 2003 Red Hat Inc.
-
- Written by Corinna Vinschen <vinschen@redhat.com>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <pwd.h>
-#include <grp.h>
-#include <sys/types.h>
-#include <sys/acl.h>
-
-#ifndef BOOL
-#define BOOL int
-#endif
-
-#ifndef TRUE
-#define TRUE (1)
-#endif
-
-#ifndef FALSE
-#define FALSE (0)
-#endif
-
-#ifndef ILLEGAL_MODE
-#define ILLEGAL_MODE ((mode_t)0xffffffff)
-#endif
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-typedef enum {
- NoAction,
- Set,
- Modify,
- Delete,
- ModNDel,
- SetFromFile
-} action_t;
-
-mode_t getperm (char *in)
-{
- if (isdigit (*in) && !in[1])
- {
- int i = atoi (in);
- if (i < 0 || i > 7)
- return ILLEGAL_MODE;
- return i << 6 | i << 3 | i;
- }
- if (strlen (in) > 3 && strchr (" \t\n\r#", in[3]))
- in[3] = '\0';
- if (strlen (in) != 3)
- return ILLEGAL_MODE;
- if (!strchr ("r-", in[0])
- || !strchr ("w-", in[1])
- || !strchr ("x-", in[2]))
- return ILLEGAL_MODE;
- return (in[0] == 'r' ? S_IROTH : 0)
- | (in[1] == 'w' ? S_IWOTH : 0)
- | (in[2] == 'x' ? S_IXOTH : 0);
-}
-
-BOOL
-getaclentry (action_t action, char *c, aclent_t *ace)
-{
- char *c2;
-
- ace->a_type = 0;
- ace->a_id = -1;
- ace->a_perm = 0;
-
- if (!strncmp (c, "default:", 8)
- || !strncmp (c, "d:", 2))
- {
- ace->a_type = ACL_DEFAULT;
- c = strchr (c, ':') + 1;
- }
- if (!strncmp (c, "user:", 5)
- || !strncmp (c, "u:", 2))
- {
- ace->a_type |= USER_OBJ;
- c = strchr (c, ':') + 1;
- }
- else if (!strncmp (c, "group:", 6)
- || !strncmp (c, "g:", 2))
- {
- ace->a_type |= GROUP_OBJ;
- c = strchr (c, ':') + 1;
- }
- else if (!strncmp (c, "mask:", 5)
- || !strncmp (c, "m:", 2))
- {
- ace->a_type |= CLASS_OBJ;
- c = strchr (c, ':') + 1;
- }
- else if (!strncmp (c, "other:", 6)
- || !strncmp (c, "o:", 2))
- {
- ace->a_type |= OTHER_OBJ;
- c = strchr (c, ':') + 1;
- }
- else
- return FALSE;
- if (ace->a_type & (USER_OBJ | GROUP_OBJ))
- {
- if ((c2 = strchr (c, ':')))
- {
- if (action == Delete)
- return FALSE;
- *c2 = '\0';
- }
- else if (action != Delete)
- return FALSE;
- if (c2 == c)
- {
- if (action == Delete)
- return FALSE;
- }
- else if (isdigit (*c))
- {
- char *c3;
-
- ace->a_id = strtol (c, &c3, 10);
- if (*c3)
- return FALSE;
- }
- else if (ace->a_type & USER_OBJ)
- {
- struct passwd *pw = getpwnam (c);
- if (!pw)
- return FALSE;
- ace->a_id = pw->pw_uid;
- }
- else
- {
- struct group *gr = getgrnam (c);
- if (!gr)
- return FALSE;
- ace->a_id = gr->gr_gid;
- }
- if (c2 != c)
- {
- if (ace->a_type & USER_OBJ)
- {
- ace->a_type &= ~USER_OBJ;
- ace->a_type |= USER;
- }
- else
- {
- ace->a_type &= ~GROUP_OBJ;
- ace->a_type |= GROUP;
- }
- }
- if (c2)
- c = c2 + 1;
- }
- /* FIXME: currently allow both :: and : */
- else if (*c == ':')
- c++;
- if (action == Delete)
- {
- if ((ace->a_type & (CLASS_OBJ | OTHER_OBJ))
- && *c)
- return FALSE;
- ace->a_perm = ILLEGAL_MODE;
- return TRUE;
- }
- if ((ace->a_perm = getperm (c)) == ILLEGAL_MODE)
- return FALSE;
- return TRUE;
-}
-
-BOOL
-getaclentries (action_t action, char *buf, aclent_t *acls, int *idx)
-{
- char *c;
-
- if (action == SetFromFile)
- {
- FILE *fp;
- char fbuf[256], *fb;
-
- if (!strcmp (buf, "-"))
- fp = stdin;
- else if (! (fp = fopen (buf, "r")))
- return FALSE;
- while ((fb = fgets (fbuf, 256, fp)))
- {
- while (strchr (" \t", *fb))
- ++fb;
- if (strchr ("\n\r#", *fb))
- continue;
- if (!getaclentry (action, fb, acls + (*idx)++))
- {
- fclose (fp);
- return FALSE;
- }
- }
- if (fp != stdin)
- fclose (fp);
- }
- else
- for (c = strtok (buf, ","); c; c = strtok (NULL, ","))
- if (!getaclentry (action, c, acls + (*idx)++))
- return FALSE;
- return TRUE;
-}
-
-int
-searchace (aclent_t *aclp, int nentries, int type, int id)
-{
- int i;
-
- for (i = 0; i < nentries; ++i)
- if ((aclp[i].a_type == type && (id < 0 || aclp[i].a_id == id))
- || !aclp[i].a_type)
- return i;
- return -1;
-}
-
-int
-modacl (aclent_t *tgt, int tcnt, aclent_t *src, int scnt)
-{
- int t, s, i;
-
- for (s = 0; s < scnt; ++s)
- {
- t = searchace (tgt, MAX_ACL_ENTRIES, src[s].a_type,
- (src[s].a_type & (USER | GROUP)) ? src[s].a_id : -1);
- if (t < 0)
- return -1;
- if (src[s].a_perm == ILLEGAL_MODE)
- {
- if (t < tcnt)
- {
- for (i = t + 1; i < tcnt; ++i)
- tgt[i - 1] = tgt[i];
- --tcnt;
- }
- }
- else
- {
- tgt[t] = src[s];
- if (t >= tcnt)
- ++tcnt;
- }
- }
- return tcnt;
-}
-
-int
-setfacl (action_t action, char *path, aclent_t *acls, int cnt)
-{
- aclent_t lacl[MAX_ACL_ENTRIES];
- int lcnt;
-
- memset (lacl, 0, sizeof lacl);
- if (action == Set)
- {
- if (acl (path, SETACL, cnt, acls))
- {
- perror (prog_name);
- return 2;
- }
- }
- else if ((lcnt = acl (path, GETACL, MAX_ACL_ENTRIES, lacl)) < 0
- || (lcnt = modacl (lacl, lcnt, acls, cnt)) < 0
- || (lcnt = acl (path, SETACL, lcnt, lacl)) < 0)
- {
- perror (prog_name);
- return 2;
- }
- return 0;
-}
-
-static void
-usage (FILE * stream)
-{
- fprintf (stream, ""
- "Usage: %s [-r] (-f ACL_FILE | -s acl_entries) FILE...\n"
- " %s [-r] ([-d acl_entries] [-m acl_entries]) FILE...\n"
- "Modify file and directory access control lists (ACLs)\n"
- "\n"
- " -d, --delete delete one or more specified ACL entries\n"
- " -f, --file set ACL entries for FILE to ACL entries read\n"
- " from a ACL_FILE\n"
- " -m, --modify modify one or more specified ACL entries\n"
- " -r, --replace replace mask entry with maximum permissions\n"
- " needed for the file group class\n"
- " -s, --substitute substitute specified ACL entries for the\n"
- " ACL of FILE\n"
- " -h, --help output usage information and exit\n"
- " -v, --version output version information and exit\n"
- "\n"
- "At least one of (-d, -f, -m, -s) must be specified\n"
- "\n"
- "", prog_name, prog_name);
- if (stream == stdout)
- {
- printf(""
- " Acl_entries are one or more comma-separated ACL entries \n"
- " from the following list:\n"
- "\n"
- " u[ser]::perm\n"
- " u[ser]:uid:perm\n"
- " g[roup]::perm\n"
- " g[roup]:gid:perm\n"
- " m[ask]:perm\n"
- " o[ther]:perm\n"
- "\n"
- " Default entries are like the above with the additional\n"
- " default identifier. For example: \n"
- "\n"
- " d[efault]:u[ser]:uid:perm\n"
- "\n"
- " 'perm' is either a 3-char permissions string in the form\n"
- " \"rwx\" with the character - for no permission\n"
- " or it is the octal representation of the permissions, a\n"
- " value from 0 (equivalent to \"---\") to 7 (\"rwx\").\n"
- " 'uid' is a user name or a numerical uid.\n"
- " 'gid' is a group name or a numerical gid.\n"
- "\n"
- "\n"
- "For each file given as parameter, %s will either replace its\n"
- "complete ACL (-s, -f), or it will add, modify, or delete ACL\n"
- "entries.\n"
- "\n"
- "The following options are supported:\n"
- "\n"
- "-d Delete one or more specified entries from the file's ACL.\n"
- " The owner, group and others entries must not be deleted.\n"
- " Acl_entries to be deleted should be specified without\n"
- " permissions, as in the following list:\n"
- "\n"
- " u[ser]:uid\n"
- " g[roup]:gid\n"
- " d[efault]:u[ser]:uid\n"
- " d[efault]:g[roup]:gid\n"
- " d[efault]:m[ask]:\n"
- " d[efault]:o[ther]:\n"
- "\n"
- "-f Take the Acl_entries from ACL_FILE one per line. Whitespace\n"
- " characters are ignored, and the character \"#\" may be used\n"
- " to start a comment. The special filename \"-\" indicates\n"
- " reading from stdin.\n"
- " Required entries are\n"
- " - One user entry for the owner of the file.\n"
- " - One group entry for the group of the file.\n"
- " - One other entry.\n"
- " If additional user and group entries are given:\n"
- " - A mask entry for the file group class of the file.\n"
- " - No duplicate user or group entries with the same uid/gid.\n"
- " If it is a directory:\n"
- " - One default user entry for the owner of the file.\n"
- " - One default group entry for the group of the file.\n"
- " - One default mask entry for the file group class.\n"
- " - One default other entry.\n"
- "\n"
- "-m Add or modify one or more specified ACL entries.\n"
- " Acl_entries is a comma-separated list of entries from the \n"
- " same list as above.\n"
- "\n"
- "-r Causes the permissions specified in the mask entry to be\n"
- " ignored and replaced by the maximum permissions needed for\n"
- " the file group class.\n"
- "\n"
- "-s Like -f, but substitute the file's ACL with Acl_entries\n"
- " specified in a comma-separated list on the command line.\n"
- "\n"
- "While the -d and -m options may be used in the same command, the\n"
- "-f and -s options may be used only exclusively.\n"
- "\n"
- "Directories may contain default ACL entries. Files created\n"
- "in a directory that contains default ACL entries will have\n"
- "permissions according to the combination of the current umask,\n"
- "the explicit permissions requested and the default ACL entries\n"
- "Note: Under Cygwin, the default ACL entries are not taken into\n"
- "account currently.\n", prog_name);
- }
- else
- fprintf(stream, "Try '%s --help' for more information.\n", prog_name);
-}
-
-struct option longopts[] = {
- {"delete", required_argument, NULL, 'd'},
- {"file", required_argument, NULL, 'f'},
- {"modify", required_argument, NULL, 'm'},
- {"replace", no_argument, NULL, 'r'},
- {"substitute", required_argument, NULL, 's'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'v'},
- {0, no_argument, NULL, 0}
-};
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-setfacl (cygwin) %.*s\n\
-ACL Modification Utility\n\
-Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s\n\
-", len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int c;
- action_t action = NoAction;
- int ropt = 0;
- aclent_t acls[MAX_ACL_ENTRIES];
- int aclidx = 0;
- int ret = 0;
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- memset (acls, 0, sizeof acls);
- while ((c = getopt_long (argc, argv, "d:f:hm:rs:v", longopts, NULL)) != EOF)
- switch (c)
- {
- case 'd':
- if (action == NoAction)
- action = Delete;
- else if (action == Modify)
- action = ModNDel;
- else
- {
- usage (stderr);
- return 1;
- }
- if (! getaclentries (Delete, optarg, acls, &aclidx))
- {
- fprintf (stderr, "%s: illegal acl entries\n", prog_name);
- return 2;
- }
- break;
- case 'f':
- if (action == NoAction)
- action = Set;
- else
- {
- usage (stderr);
- return 1;
- }
- if (! getaclentries (SetFromFile, optarg, acls, &aclidx))
- {
- fprintf (stderr, "%s: illegal acl entries\n", prog_name);
- return 2;
- }
- break;
- case 'h':
- usage (stdout);
- return 0;
- case 'm':
- if (action == NoAction)
- action = Modify;
- else if (action == Delete)
- action = ModNDel;
- else
- {
- usage (stderr);
- return 1;
- }
- if (! getaclentries (Modify, optarg, acls, &aclidx))
- {
- fprintf (stderr, "%s: illegal acl entries\n", prog_name);
- return 2;
- }
- break;
- case 'r':
- if (!ropt)
- ropt = 1;
- else
- {
- usage (stderr);
- return 1;
- }
- break;
- case 's':
- if (action == NoAction)
- action = Set;
- else
- {
- usage (stderr);
- return 1;
- }
- if (! getaclentries (Set, optarg, acls, &aclidx))
- {
- fprintf (stderr, "%s: illegal acl entries\n", prog_name);
- return 2;
- }
- break;
- case 'v':
- print_version ();
- return 0;
- default:
- usage (stderr);
- return 1;
- }
- if (action == NoAction)
- {
- usage (stderr);
- return 1;
- }
- if (optind > argc - 1)
- {
- usage (stderr);
- return 1;
- }
- if (action == Set)
- switch (aclcheck (acls, aclidx, NULL))
- {
- case GRP_ERROR:
- fprintf (stderr, "%s: more than one group entry.\n", prog_name);
- return 2;
- case USER_ERROR:
- fprintf (stderr, "%s: more than one user entry.\n", prog_name);
- return 2;
- case CLASS_ERROR:
- fprintf (stderr, "%s: more than one mask entry.\n", prog_name);
- return 2;
- case OTHER_ERROR:
- fprintf (stderr, "%s: more than one other entry.\n", prog_name);
- return 2;
- case DUPLICATE_ERROR:
- fprintf (stderr, "%s: duplicate additional user or group.\n", prog_name);
- return 2;
- case ENTRY_ERROR:
- fprintf (stderr, "%s: invalid entry type.\n", prog_name);
- return 2;
- case MISS_ERROR:
- fprintf (stderr, "%s: missing entries.\n", prog_name);
- return 2;
- case MEM_ERROR:
- fprintf (stderr, "%s: out of memory.\n", prog_name);
- return 2;
- default:
- break;
- }
- for (c = optind; c < argc; ++c)
- ret |= setfacl (action, argv[c], acls, aclidx);
- return ret;
-}
diff --git a/winsup/utils/setmetamode.c b/winsup/utils/setmetamode.c
deleted file mode 100644
index 65bd02b78..000000000
--- a/winsup/utils/setmetamode.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/* setmetamode.c
-
- Copyright 2006 Red Hat Inc.
-
- Written by Kazuhiro Fujieda <fujieda@jaist.ac.jp>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <cygwin/kd.h>
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-static void
-usage (void)
-{
- fprintf (stderr, "Usage: %s [metabit|escprefix]\n"
- " Without argument, it shows the current meta key mode.\n"
- " metabit|meta|bit The meta key sets the top bit of the character.\n"
- " escprefix|esc|prefix The meta key sends an escape prefix.\n",
- prog_name);
-}
-
-static void
-error (void)
-{
- fprintf (stderr,
- "%s: The standard input isn't a console device.\n",
- prog_name);
-}
-
-int
-main (int ac, char *av[])
-{
- int param;
-
- prog_name = strrchr (av[0], '/');
- if (!prog_name)
- prog_name = strrchr (av[0], '\\');
- if (!prog_name)
- prog_name = av[0];
- else
- prog_name++;
-
- if (ac < 2)
- {
- if (ioctl (0, KDGKBMETA, &param) < 0)
- {
- error ();
- return 1;
- }
- if (param == 0x03)
- puts ("metabit");
- else
- puts ("escprefix");
- return 0;
- }
- if (!strcmp ("meta", av[1]) || !strcmp ("bit", av[1])
- || !strcmp ("metabit", av[1]))
- param = 0x03;
- else if (!strcmp ("esc", av[1]) || !strcmp ("prefix", av[1])
- || !strcmp ("escprefix", av[1]))
- param = 0x04;
- else
- {
- usage ();
- return 1;
- }
- if (ioctl (0, KDSKBMETA, param) < 0)
- {
- error ();
- return 1;
- }
- return 0;
-}
diff --git a/winsup/utils/ssp.c b/winsup/utils/ssp.c
deleted file mode 100644
index c7370d94d..000000000
--- a/winsup/utils/ssp.c
+++ /dev/null
@@ -1,953 +0,0 @@
-/*
- * Copyright (c) 2000, 2001, 2002 Red Hat, Inc.
- *
- * 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.
- *
- * A copy of the GNU General Public License can be found at
- * http://www.gnu.org/
- *
- * Written by DJ Delorie <dj@redhat.com>
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <time.h>
-#include <ctype.h>
-#include <windows.h>
-#include <getopt.h>
-
-static const char version[] = "$Revision$";
-static char *prog_name;
-
-static struct option longopts[] =
-{
- {"console-trace", no_argument, NULL, 'c' },
- {"disable", no_argument, NULL, 'd' },
- {"enable", no_argument, NULL, 'e' },
- {"help", no_argument, NULL, 'h' },
- {"dll", no_argument, NULL, 'l' },
- {"sub-threads", no_argument, NULL, 's' },
- {"trace-eip", no_argument, NULL, 't' },
- {"verbose", no_argument, NULL, 'v' },
- {"version", no_argument, NULL, 'V' },
- {NULL, 0, NULL, 0}
-};
-
-static char opts[] = "+cdehlstvV";
-
-#define KERNEL_ADDR 0x77000000
-
-#define TRACE_SSP 0
-
-#define VERBOSE 1
-#define TIMES 1000
-
-/* from winsup/gmon.h */
-struct gmonhdr {
- unsigned long lpc; /* base pc address of sample buffer */
- unsigned long hpc; /* max pc address of sampled buffer */
- int ncnt; /* size of sample buffer (plus this header) */
- int version; /* version number */
- int profrate; /* profiling clock rate */
- int spare[3]; /* reserved */
-};
-#define GMONVERSION 0x00051879
-#define HISTCOUNTER unsigned short
-
-typedef struct {
- unsigned int base_address;
- int pcount;
- int scount;
- char *name;
-} DllInfo;
-
-typedef struct {
- unsigned int address;
- unsigned char real_byte;
-} PendingBreakpoints;
-
-unsigned low_pc=0, high_pc=0;
-unsigned last_pc=0, pc, last_sp=0, sp;
-int total_cycles, count;
-HANDLE hProcess;
-PROCESS_INFORMATION procinfo;
-STARTUPINFO startup;
-CONTEXT context;
-HISTCOUNTER *hits=0;
-struct gmonhdr hdr;
-int running = 1, profiling = 1;
-char dll_name[1024], *dll_ptr, *cp;
-int eip;
-unsigned opcode_count = 0;
-
-int stepping_enabled = 1;
-int tracing_enabled = 0;
-int trace_console = 0;
-int trace_all_threads = 0;
-int dll_counts = 0;
-int verbose = 0;
-
-#define MAXTHREADS 100
-DWORD active_thread_ids[MAXTHREADS];
-HANDLE active_threads[MAXTHREADS];
-DWORD thread_step_flags[MAXTHREADS];
-DWORD thread_return_address[MAXTHREADS];
-int num_active_threads = 0;
-int suspended_count=0;
-
-#define MAXDLLS 100
-DllInfo dll_info[MAXDLLS];
-int num_dlls=0;
-
-#define MAXPENDS 100
-PendingBreakpoints pending_breakpoints[MAXPENDS];
-int num_breakpoints=0;
-
-static void
-add_breakpoint (unsigned int address)
-{
- int i;
- DWORD rv;
- static char int3[] = { 0xcc };
- for (i=0; i<num_breakpoints; i++)
- {
- if (pending_breakpoints[i].address == address)
- return;
- if (pending_breakpoints[i].address == 0)
- break;
- }
- if (i == MAXPENDS)
- return;
- pending_breakpoints[i].address = address;
- ReadProcessMemory (hProcess,
- (void *)address,
- &(pending_breakpoints[i].real_byte),
- 1, &rv);
-
- WriteProcessMemory (hProcess,
- (void *)address,
- (LPVOID)int3, 1, &rv);
- if (i >= num_breakpoints)
- num_breakpoints = i+1;
-}
-
-static int
-remove_breakpoint (unsigned int address)
-{
- int i;
- DWORD rv;
- for (i=0; i<num_breakpoints; i++)
- {
- if (pending_breakpoints[i].address == address)
- {
- pending_breakpoints[i].address = 0;
- WriteProcessMemory (hProcess,
- (void *)address,
- &(pending_breakpoints[i].real_byte),
- 1, &rv);
- return 1;
- }
- }
- return 0;
-}
-
-static HANDLE
-lookup_thread_id (DWORD threadId, int *tix)
-{
- int i;
- *tix = 0;
- for (i=0; i<num_active_threads; i++)
- if (active_thread_ids[i] == threadId)
- {
- if (tix)
- *tix = i;
- return active_threads[i];
- }
- return 0;
-}
-
-static void
-set_step_threads (int threadId, int trace)
-{
- int rv, tix;
- HANDLE thread = lookup_thread_id (threadId, &tix);
-
- rv = GetThreadContext (thread, &context);
- if (rv != -1)
- {
- thread_step_flags[tix] = trace;
- if (trace)
- context.EFlags |= 0x100; /* TRAP (single step) flag */
- else
- context.EFlags &= ~0x100; /* TRAP (single step) flag */
- SetThreadContext (thread, &context);
- }
-}
-
-static void
-set_steps ()
-{
- int i, s;
- for (i=0; i<num_active_threads; i++)
- {
- GetThreadContext (active_threads[i], &context);
- s = context.EFlags & 0x0100;
- if (!s && thread_step_flags[i])
- {
- set_step_threads (active_thread_ids[i], 1);
- }
- }
-}
-
-static int
-dll_sort (const void *va, const void *vb)
-{
- DllInfo *a = (DllInfo *)va;
- DllInfo *b = (DllInfo *)vb;
- if (a->base_address < b->base_address)
- return -1;
- return 1;
-}
-
-static char *
-addr2dllname (unsigned int addr)
-{
- int i;
- for (i=num_dlls-1; i>=0; i--)
- {
- if (dll_info[i].base_address < addr)
- {
- return dll_info[i].name;
- }
- }
- return (char *)"";
-}
-
-static void
-dump_registers (HANDLE thread)
-{
- context.ContextFlags = CONTEXT_FULL;
- GetThreadContext (thread, &context);
- printf ("eax %08lx ebx %08lx ecx %08lx edx %08lx eip\n",
- context.Eax, context.Ebx, context.Ecx, context.Edx);
- printf ("esi %08lx edi %08lx ebp %08lx esp %08lx %08lx\n",
- context.Esi, context.Esi, context.Ebp, context.Esp, context.Eip);
-}
-
-typedef struct Edge {
- struct Edge *next;
- unsigned int from_pc;
- unsigned int to_pc;
- unsigned int count;
-} Edge;
-
-Edge *edges[4096];
-
-void
-store_call_edge (unsigned int from_pc, unsigned int to_pc)
-{
- Edge *e;
- unsigned int h = ((from_pc + to_pc)>>4) & 4095;
- for (e=edges[h]; e; e=e->next)
- if (e->from_pc == from_pc && e->to_pc == to_pc)
- break;
- if (!e)
- {
- e = (Edge *)malloc (sizeof (Edge));
- e->next = edges[h];
- edges[h] = e;
- e->from_pc = from_pc;
- e->to_pc = to_pc;
- e->count = 0;
- }
- e->count++;
-}
-
-void
-write_call_edges (FILE *f)
-{
- int h;
- Edge *e;
- for (h=0; h<4096; h++)
- for (e=edges[h]; e; e=e->next)
- fwrite (&(e->from_pc), 1, 3*sizeof (unsigned int), f);
-}
-
-char *
-wide_strdup (char *cp)
-{
- unsigned short *s = (unsigned short *)cp;
- int len;
- char *rv;
- for (len=0; s[len]; len++);
- rv = (char *)malloc (len+1);
- for (len=0; s[len]; len++)
- rv[len] = s[len];
- rv[len] = 0;
- return rv;
-}
-
-void
-run_program (char *cmdline)
-{
- FILE *tracefile = 0;
- int tix, i;
- HANDLE hThread;
- char *string;
-
- memset (&startup, 0, sizeof (startup));
- startup.cb = sizeof (startup);
-
- if (!CreateProcess (0, cmdline, 0, 0, 0,
- CREATE_NEW_PROCESS_GROUP
- | CREATE_SUSPENDED
- | DEBUG_PROCESS
- | DEBUG_ONLY_THIS_PROCESS,
- 0, 0, &startup, &procinfo))
- {
- fprintf (stderr, "Can't create process: error %ld\n", GetLastError ());
- exit (1);
- }
-
- hProcess = procinfo.hProcess;
-#if 0
- printf ("procinfo: %08x %08x %08x %08x\n",
- hProcess, procinfo.hThread, procinfo.dwProcessId, procinfo.dwThreadId);
-#endif
-
- active_threads[0] = procinfo.hThread;
- active_thread_ids[0] = procinfo.dwThreadId;
- thread_step_flags[0] = stepping_enabled;
- num_active_threads = 1;
-
- dll_info[0].base_address = 0;
- dll_info[0].pcount = 0;
- dll_info[0].scount = 0;
- dll_info[0].name = cmdline;
- num_dlls = 1;
-
- SetThreadPriority (procinfo.hThread, THREAD_PRIORITY_IDLE);
-
- context.ContextFlags = CONTEXT_FULL;
-
- ResumeThread (procinfo.hThread);
-
- total_cycles = 0;
-
- if (tracing_enabled)
- {
- tracefile = fopen ("trace.ssp", "w");
- if (!tracefile)
- {
- tracing_enabled = 0;
- perror ("trace.ssp");
- }
- }
-
- running = 1;
- while (running)
- {
- int src, dest;
- DWORD rv;
- DEBUG_EVENT event;
- int contv = DBG_CONTINUE;
-
- event.dwDebugEventCode = -1;
- if (!WaitForDebugEvent (&event, INFINITE))
- {
- printf ("idle...\n");
- }
-
- hThread = lookup_thread_id (event.dwThreadId, &tix);
-
-#if 0
- printf ("DE: %x/%d %d %d ",
- hThread, tix,
- event.dwDebugEventCode, num_active_threads);
- for (src=0; src<num_active_threads; src++)
- {
- int sc = SuspendThread (active_threads[src]);
- int rv = GetThreadContext (active_threads[src], &context);
- ResumeThread (active_threads[src]);
- printf (" [%x,%x,%x]",
- active_threads[src], context.Eip, active_thread_ids[src]);
- }
- printf ("\n");
-#endif
-
- switch (event.dwDebugEventCode)
- {
-
- case CREATE_PROCESS_DEBUG_EVENT:
- break;
-
- case CREATE_THREAD_DEBUG_EVENT:
- if (verbose)
- printf ("create thread %08lx at %08x %s\n",
- event.dwThreadId,
- (int)event.u.CreateThread.lpStartAddress,
- addr2dllname ((unsigned int)event.u.CreateThread.lpStartAddress));
-
- active_thread_ids[num_active_threads] = event.dwThreadId;
- active_threads[num_active_threads] = event.u.CreateThread.hThread;
- thread_return_address[num_active_threads] = 0;
- num_active_threads++;
-
- if (trace_all_threads && stepping_enabled)
- {
- thread_step_flags[num_active_threads-1] = stepping_enabled;
- add_breakpoint ((int)event.u.CreateThread.lpStartAddress);
- }
-
- break;
-
- case EXIT_THREAD_DEBUG_EVENT:
- if (verbose)
- printf ("exit thread %08lx, code=%ld\n",
- event.dwThreadId,
- event.u.ExitThread.dwExitCode);
-
- for (src=0, dest=0; src<num_active_threads; src++)
- if (active_thread_ids[src] != event.dwThreadId)
- {
- active_thread_ids[dest] = active_thread_ids[src];
- active_threads[dest] = active_threads[src];
- dest++;
- }
- num_active_threads = dest;
- break;
-
- case EXCEPTION_DEBUG_EVENT:
- rv = GetThreadContext (hThread, &context);
- switch (event.u.Exception.ExceptionRecord.ExceptionCode)
- {
- case STATUS_BREAKPOINT:
- if (remove_breakpoint ((int)event.u.Exception.ExceptionRecord.ExceptionAddress))
- {
- context.Eip --;
- if (!rv)
- SetThreadContext (hThread, &context);
- if (ReadProcessMemory (hProcess, (void *)context.Esp, &rv, 4, &rv))
- thread_return_address[tix] = rv;
- }
- set_step_threads (event.dwThreadId, stepping_enabled);
- case STATUS_SINGLE_STEP:
- opcode_count++;
- pc = (unsigned int)event.u.Exception.ExceptionRecord.ExceptionAddress;
- sp = (unsigned int)context.Esp;
- if (tracing_enabled)
- fprintf (tracefile, "%08x %08lx\n", pc, event.dwThreadId);
- if (trace_console)
- {
- printf ("%d %08x\n", tix, pc);
- fflush (stdout);
- }
-
- if (dll_counts)
- {
- int i;
- for (i=num_dlls-1; i>=0; i--)
- {
- if (dll_info[i].base_address < context.Eip)
- {
- if (hThread == procinfo.hThread)
- dll_info[i].pcount++;
- else
- dll_info[i].scount++;
- break;
- }
- }
- }
-
- if (pc < last_pc || pc > last_pc+10)
- {
- static int ncalls=0;
- static int qq=0;
- if (++qq % 100 == 0)
- fprintf (stderr, " %08x %d %d \r",
- pc, ncalls, opcode_count);
-
- if (sp == last_sp-4)
- {
- ncalls++;
- store_call_edge (last_pc, pc);
- if (last_pc < KERNEL_ADDR && pc > KERNEL_ADDR)
- {
- int retaddr;
- DWORD rv;
- ReadProcessMemory (hProcess,
- (void *)sp,
- (LPVOID)&(retaddr),
- 4, &rv);
-#if 0
- printf ("call last_pc = %08x pc = %08x rv = %08x\n",
- last_pc, pc, retaddr);
- /* experimental - try to skip kernel calls for speed */
- add_breakpoint (retaddr);
- set_step_threads (event.dwThreadId, 0);
-#endif
- }
- }
- }
-
- total_cycles++;
- last_sp = sp;
- last_pc = pc;
- if (pc >= low_pc && pc < high_pc)
- hits[(pc - low_pc)/2] ++;
- break;
- default:
- if (verbose)
- {
- printf ("exception %ld, ", event.u.Exception.dwFirstChance);
- printf ("code: %lx flags: %lx\n",
- event.u.Exception.ExceptionRecord.ExceptionCode,
- event.u.Exception.ExceptionRecord.ExceptionFlags);
- if (event.u.Exception.dwFirstChance == 1)
- dump_registers (hThread);
- }
- contv = DBG_EXCEPTION_NOT_HANDLED;
- running = 0;
- break;
- }
-
- if (!rv)
- {
- if (pc == thread_return_address[tix])
- {
- if (context.EFlags & 0x100)
- {
- context.EFlags &= ~0x100; /* TRAP (single step) flag */
- SetThreadContext (hThread, &context);
- }
- }
- else if (stepping_enabled)
- {
- if (!(context.EFlags & 0x100))
- {
- context.EFlags |= 0x100; /* TRAP (single step) flag */
- SetThreadContext (hThread, &context);
- }
- }
- }
- break;
-
- case OUTPUT_DEBUG_STRING_EVENT:
- string = (char *)malloc (event.u.DebugString.nDebugStringLength+1);
- i = ReadProcessMemory (hProcess,
- event.u.DebugString.lpDebugStringData,
- (LPVOID)string,
- event.u.DebugString.nDebugStringLength,
- &rv);
- if (!i)
- {
- printf ("error reading memory: %ld %ld\n", rv, GetLastError ());
- }
- if (verbose)
- printf ("ODS: %x/%d \"%s\"\n",
- (int)hThread, tix, string);
-
- if (strcmp (string, "ssp on") == 0)
- {
- stepping_enabled = 1;
- set_step_threads (event.dwThreadId, 1);
- }
-
- if (strcmp (string, "ssp off") == 0)
- {
- stepping_enabled = 0;
- set_step_threads (event.dwThreadId, 0);
- }
-
- break;
-
-
- case LOAD_DLL_DEBUG_EVENT:
- if (verbose)
- printf ("load dll %08x:",
- (int)event.u.LoadDll.lpBaseOfDll);
-
- dll_ptr = (char *)"( u n k n o w n ) \0\0";
- if (event.u.LoadDll.lpImageName)
- {
- ReadProcessMemory (hProcess,
- event.u.LoadDll.lpImageName,
- (LPVOID)&src,
- sizeof (src),
- &rv);
- if (src)
- {
- ReadProcessMemory (hProcess,
- (void *)src,
- (LPVOID)dll_name,
- sizeof (dll_name),
- &rv);
- dll_name[rv] = 0;
- dll_ptr = dll_name;
- for (cp=dll_name; *cp; cp++)
- {
- if (*cp == '\\' || *cp == '/')
- {
- dll_ptr = cp+1;
- }
- *cp = tolower (*cp);
- }
- }
- }
-
-
- dll_info[num_dlls].base_address
- = (unsigned int)event.u.LoadDll.lpBaseOfDll;
- dll_info[num_dlls].pcount = 0;
- dll_info[num_dlls].scount = 0;
- dll_info[num_dlls].name = wide_strdup (dll_ptr);
- if (verbose)
- printf (" %s\n", dll_info[num_dlls].name);
- num_dlls++;
- qsort (dll_info, num_dlls, sizeof (DllInfo), dll_sort);
-
- break;
-
- case UNLOAD_DLL_DEBUG_EVENT:
- if (verbose)
- printf ("unload dll\n");
- break;
-
- case EXIT_PROCESS_DEBUG_EVENT:
- if (verbose)
- printf ("process %08lx %08lx exit %ld\n",
- event.dwProcessId, event.dwThreadId,
- event.u.ExitProcess.dwExitCode);
-
- running = 0;
- break;
- }
-
- set_steps ();
- ContinueDebugEvent (event.dwProcessId, event.dwThreadId, contv);
- }
-
- count = 0;
- for (pc=low_pc; pc<high_pc; pc+=2)
- {
- count += hits[(pc - low_pc)/2];
- }
- printf ("total cycles: %d, counted cycles: %d\n", total_cycles, count);
-
- if (tracing_enabled)
- fclose (tracefile);
-
-}
-
-static void
-usage (FILE * stream)
-{
- fprintf (stream , ""
- "Usage: %s [options] low_pc high_pc command...\n"
- "Single-step profile COMMAND\n"
- "\n"
- " -c, --console-trace trace every EIP value to the console. *Lots* slower.\n"
- " -d, --disable disable single-stepping by default; use\n"
- " OutputDebugString (\"ssp on\") to enable stepping\n"
- " -e, --enable enable single-stepping by default; use\n"
- " OutputDebugString (\"ssp off\") to disable stepping\n"
- " -h, --help output usage information and exit\n"
- " -l, --dll enable dll profiling. A chart of relative DLL usage\n"
- " is produced after the run.\n"
- " -s, --sub-threads trace sub-threads too. Dangerous if you have\n"
- " race conditions.\n"
- " -t, --trace-eip trace every EIP value to a file TRACE.SSP. This\n"
- " gets big *fast*.\n"
- " -v, --verbose output verbose messages about debug events.\n"
- " -V, --version output version information and exit\n"
- "\n"
- "Example: %s 0x401000 0x403000 hello.exe\n"
- "\n"
- "", prog_name, prog_name);
- if (stream == stdout)
- fprintf (stream , ""
- "SSP - The Single Step Profiler\n"
- "\n"
- "Original Author: DJ Delorie <dj@redhat.com>\n"
- "\n"
- "The SSP is a program that uses the Win32 debug API to run a program\n"
- "one ASM instruction at a time. It records the location of each\n"
- "instruction used, how many times that instruction is used, and all\n"
- "function calls. The results are saved in a format that is usable by\n"
- "the profiling program \"gprof\", although gprof will claim the values\n"
- "are seconds, they really are instruction counts. More on that later.\n"
- "\n"
- "Because the SSP was originally designed to profile the cygwin DLL, it\n"
- "does not automatically select a block of code to report statistics on.\n"
- "You must specify the range of memory addresses to keep track of\n"
- "manually, but it's not hard to figure out what to specify. Use the\n"
- "\"objdump\" program to determine the bounds of the target's \".text\"\n"
- "section. Let's say we're profiling cygwin1.dll. Make sure you've\n"
- "built it with debug symbols (else gprof won't run) and run objdump\n"
- "like this:\n"
- "\n"
- " objdump -h cygwin1.dll\n"
- "\n"
- "It will print a report like this:\n"
- "\n"
- "cygwin1.dll: file format pei-i386\n"
- "\n"
- "Sections:\n"
- "Idx Name Size VMA LMA File off Algn\n"
- " 0 .text 0007ea00 61001000 61001000 00000400 2**2\n"
- " CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA\n"
- " 1 .data 00008000 61080000 61080000 0007ee00 2**2\n"
- " CONTENTS, ALLOC, LOAD, DATA\n"
- " . . .\n"
- "\n"
- "The only information we're concerned with are the VMA of the .text\n"
- "section and the VMA of the section after it (sections are usually\n"
- "contiguous; you can also add the Size to the VMA to get the end\n"
- "address). In this case, the VMA is 0x61001000 and the ending address\n"
- "is either 0x61080000 (start of .data method) or 0x0x6107fa00 (VMA+Size\n"
- "method).\n"
- "\n"
- "There are two basic ways to use SSP - either profiling a whole\n"
- "program, or selectively profiling parts of the program.\n"
- "\n"
- "To profile a whole program, just run ssp without options. By default,\n"
- "it will step the whole program. Here's a simple example, using the\n"
- "numbers above:\n"
- "\n"
- " ssp 0x61001000 0x61080000 hello.exe\n"
- "\n"
- "This will step the whole program. It will take at least 8 minutes on\n"
- "a PII/300 (yes, really). When it's done, it will create a file called\n"
- "\"gmon.out\". You can turn this data file into a readable report with\n"
- "gprof:\n"
- "\n"
- " gprof -b cygwin1.dll\n"
- "\n"
- "The \"-b\" means 'skip the help pages'. You can omit this until you're\n"
- "familiar with the report layout. The gprof documentation explains\n"
- "a lot about this report, but ssp changes a few things. For example,\n"
- "the first part of the report reports the amount of time spent in each\n"
- "function, like this:\n"
- "\n"
- "Each sample counts as 0.01 seconds.\n"
- " %% cumulative self self total\n"
- " time seconds seconds calls ms/call ms/call name\n"
- " 10.02 231.22 72.43 46 1574.57 1574.57 strcspn\n"
- " 7.95 288.70 57.48 130 442.15 442.15 strncasematch\n"
- "\n"
- "The \"seconds\" columns are really CPU opcodes, 1/100 second per opcode.\n"
- "So, \"231.22\" above means 23,122 opcodes. The ms/call values are 10x\n"
- "too big; 1574.57 means 157.457 opcodes per call. Similar adjustments\n"
- "need to be made for the \"self\" and \"children\" columns in the second\n"
- "part of the report.\n"
- "\n"
- "OK, so now we've got a huge report that took a long time to generate,\n"
- "and we've identified a spot we want to work on optimizing. Let's say\n"
- "it's the time() function. We can use SSP to selectively profile this\n"
- "function by using OutputDebugString() to control SSP from within the\n"
- "program. Here's a sample program:\n"
- "\n"
- " #include <windows.h>\n"
- " main()\n"
- " {\n"
- " time_t t;\n"
- " OutputDebugString(\"ssp on\");\n"
- " time(&t);\n"
- " OutputDebugString(\"ssp off\");\n"
- " }\n"
- "\n"
- "Then, add the \"-d\" option to ssp to default to *disabling* profiling.\n"
- "The program will run at full speed until the first OutputDebugString,\n"
- "then step until the second.\n"
- "\n"
- " ssp -d 0x61001000 0x61080000 hello.exe\n"
- "\n"
- "You can then use gprof (as usual) to see the performance profile for\n"
- "just that portion of the program's execution.\n"
- "\n"
- "There are many options to ssp. Since step-profiling makes your\n"
- "program run about 1,000 times slower than normal, it's best to\n"
- "understand all the options so that you can narrow down the parts\n"
- "of your program you need to single-step.\n"
- "\n"
- "\"-v\" - verbose. This prints messages about threads starting and\n"
- "stopping, OutputDebugString calls, DLLs loading, etc.\n"
- "\n"
- "\"-t\" and \"-c\" - tracing. With -t, *every* step's address is written\n"
- "to the file \"trace.ssp\". This can be used to help debug functions,\n"
- "since it can trace multiple threads. Clever use of scripts can match\n"
- "addresses with disassembled opcodes if needed. Warning: creates\n"
- "*huge* files, very quickly. \"-c\" prints each address to the console,\n"
- "useful for debugging key chunks of assembler.\n"
- "Use \"addr2line -C -f -s -e foo.exe < trace.ssp > lines.ssp\" and then\n"
- "\"perl cvttrace\" to convert to symbolic traces.\n"
- "\n"
- "\"-s\" - subthreads. Usually, you only need to trace the main thread,\n"
- "but sometimes you need to trace all threads, so this enables that.\n"
- "It's also needed when you want to profile a function that only a\n"
- "subthread calls. However, using OutputDebugString automatically\n"
- "enables profiling on the thread that called it, not the main thread.\n"
- "\n"
- "\"-l\" - dll profiling. Generates a pretty table of how much time was\n"
- "spent in each dll the program used. No sense optimizing a function in\n"
- "your program if most of the time is spent in the DLL.\n"
- "\n"
- "I usually use the -v, -s, and -l options:\n"
- "\n"
- " ssp -v -s -l -d 0x61001000 0x61080000 hello.exe\n"
- "\n");
- if (stream == stderr)
- fprintf (stream, "Try '%s --help' for more information.\n", prog_name);
- exit (stream == stderr ? 1 : 0);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Single-Step Profiler\n\
-Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
-Compiled on %s\n\
-", prog_name, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int c, i;
- int total_pcount = 0, total_scount = 0;
- FILE *gmon;
-
- setbuf (stdout, 0);
-
- prog_name = strrchr (argv[0], '/');
- if (prog_name == NULL)
- prog_name = strrchr (argv[0], '\\');
- if (prog_name == NULL)
- prog_name = argv[0];
- else
- prog_name++;
-
- while ((c = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (c)
- {
- case 'c':
- printf ("tracing *all* $eip to the console\n");
- trace_console = 1;
- break;
- case 'd':
- printf ("stepping disabled; enable via OutputDebugString (\"ssp on\")\n");
- stepping_enabled = 0;
- break;
- case 'e':
- printf ("stepping enabled; disable via OutputDebugString (\"ssp off\")\n");
- stepping_enabled = 1;
- break;
- case 'h':
- usage (stdout);
- break;
- case 'l':
- printf ("profiling dll usage\n");
- dll_counts = 1;
- break;
- case 's':
- printf ("tracing all sub-threads too, not just the main one\n");
- trace_all_threads = 1;
- break;
- case 't':
- printf ("tracing all $eip to trace.ssp\n");
- tracing_enabled = 1;
- break;
- case 'v':
- printf ("verbose messages enabled\n");
- verbose = 1;
- break;
- case 'V':
- print_version ();
- exit (0);
- default:
- usage (stderr);
- }
-
- if ( (argc - optind) < 3 )
- usage (stderr);
- sscanf (argv[optind++], "%i", &low_pc);
- sscanf (argv[optind++], "%i", &high_pc);
-
- if (low_pc > high_pc-8)
- {
- fprintf (stderr, "Hey, low_pc must be lower than high_pc\n");
- exit (1);
- }
-
- hits = (HISTCOUNTER *)malloc (high_pc-low_pc+4);
- memset (hits, 0, high_pc-low_pc+4);
-
- fprintf (stderr, "prun: [%08x,%08x] Running '%s'\n",
- low_pc, high_pc, argv[optind]);
-
- run_program (argv[optind]);
-
- hdr.lpc = low_pc;
- hdr.hpc = high_pc;
- hdr.ncnt = high_pc-low_pc + sizeof (hdr);
- hdr.version = GMONVERSION;
- hdr.profrate = 100;
-
- gmon = fopen ("gmon.out", "wb");
- fwrite (&hdr, 1, sizeof (hdr), gmon);
- fwrite (hits, 1, high_pc-low_pc, gmon);
- write_call_edges (gmon);
- fclose (gmon);
-
- if (dll_counts)
- {
- /* 1234567 123% 1234567 123% 12345678 xxxxxxxxxxx */
- printf (" Main-Thread Other-Thread BaseAddr DLL Name\n");
-
- total_pcount = 0;
- total_scount = 0;
- for (i=0; i<num_dlls; i++)
- {
- total_pcount += dll_info[i].pcount;
- total_scount += dll_info[i].scount;
- }
-
- if (total_pcount == 0) total_pcount++;
- if (total_scount == 0) total_scount++;
-
- for (i=0; i<num_dlls; i++)
- if (dll_info[i].pcount || dll_info[i].scount)
- {
- printf ("%7d %3d%% %7d %3d%% %08x %s\n",
- dll_info[i].pcount,
- (dll_info[i].pcount*100)/opcode_count,
- dll_info[i].scount,
- (dll_info[i].scount*100)/opcode_count,
- dll_info[i].base_address,
- dll_info[i].name);
- }
- }
-
- exit (0);
-}
-
diff --git a/winsup/utils/ssp.txt b/winsup/utils/ssp.txt
deleted file mode 100644
index e73880e90..000000000
--- a/winsup/utils/ssp.txt
+++ /dev/null
@@ -1,125 +0,0 @@
-
-SSP - The Single Step Profiler
-
-Original Author: DJ Delorie <dj@redhat.com>
-
-The SSP is a program that uses the Win32 debug API to run a program
-one ASM instruction at a time. It records the location of each
-instruction used, how many times that instruction is used, and all
-function calls. The results are saved in a format that is usable by
-the profiling program "gprof", although gprof will claim the values
-are seconds, they really are instruction counts. More on that later.
-
-Because the SSP was originally designed to profile the cygwin DLL, it
-does not automatically select a block of code to report statistics on.
-You must specify the range of memory addresses to keep track of
-manually, but it's not hard to figure out what to specify. Use the
-"objdump" program to determine the bounds of the target's ".text"
-section. Let's say we're profiling cygwin1.dll. Make sure you've
-built it with debug symbols (else gprof won't run) and run objdump
-like this:
-
- objdump -h cygwin1.dll
-
-It will print a report like this:
-
-cygwin1.dll: file format pei-i386
-
-Sections:
-Idx Name Size VMA LMA File off Algn
- 0 .text 0007ea00 61001000 61001000 00000400 2**2
- CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
- 1 .data 00008000 61080000 61080000 0007ee00 2**2
- CONTENTS, ALLOC, LOAD, DATA
- . . .
-
-The only information we're concerned with are the VMA of the .text
-section and the VMA of the section after it (sections are usually
-contiguous; you can also add the Size to the VMA to get the end
-address). In this case, the VMA is 0x61001000 and the ending address
-is either 0x61080000 (start of .data method) or 0x0x6107fa00 (VMA+Size
-method).
-
-There are two basic ways to use SSP - either profiling a whole
-program, or selectively profiling parts of the program.
-
-To profile a whole program, just run ssp without options. By default,
-it will step the whole program. Here's a simple example, using the
-numbers above:
-
- ssp 0x61001000 0x61080000 hello.exe
-
-This will step the whole program. It will take at least 8 minutes on
-a PII/300 (yes, really). When it's done, it will create a file called
-"gmon.out". You can turn this data file into a readable report with
-gprof:
-
- gprof -b cygwin1.dll
-
-The "-b" means "skip the help pages". You can omit this until you're
-familiar with the report layout. The gprof documentation explains
-a lot about this report, but ssp changes a few things. For example,
-the first part of the report reports the amount of time spent in each
-function, like this:
-
-Each sample counts as 0.01 seconds.
- % cumulative self self total
- time seconds seconds calls ms/call ms/call name
- 10.02 231.22 72.43 46 1574.57 1574.57 strcspn
- 7.95 288.70 57.48 130 442.15 442.15 strncasematch
-
-The "seconds" columns are really CPU opcodes, 1/100 second per opcode.
-So, "231.22" above means 23,122 opcodes. The ms/call values are 10x
-too big; 1574.57 means 157.457 opcodes per call. Similar adjustments
-need to be made for the "self" and "children" columns in the second
-part of the report.
-
-OK, so now we've got a huge report that took a long time to generate,
-and we've identified a spot we want to work on optimizing. Let's say
-it's the time() function. We can use SSP to selectively profile this
-function by using OutputDebugString() to control SSP from within the
-program. Here's a sample program:
-
- #include <windows.h>
- main()
- {
- time_t t;
- OutputDebugString("ssp on");
- time(&t);
- OutputDebugString("ssp off");
- }
-
-Then, add the "-d" option to ssp to default to *disabling* profiling.
-The program will run at full speed until the first OutputDebugString,
-then step until the second.
-
- ssp -d 0x61001000 0x61080000 hello.exe
-
-You can then use gprof (as usual) to see the performance profile for
-just that portion of the program's execution.
-
-OK, now for the other ssp options, and when to use them:
-
-"-v" - verbose. This prints messages about threads starting and
-stopping, OutputDebugString calls, DLLs loading, etc.
-
-"-t" and "-tc" - tracing. With -t, *every* step's address is written
-to the file "trace.ssp". This can be used to help debug functions,
-since it can trace multiple threads. Clever use of scripts can match
-addresses with disassembled opcodes if needed. Warning: creates
-*huge* files, very quickly. "-tc" prints each address to the console,
-useful for debugging key chunks of assembler.
-
-"-s" - subthreads. Usually, you only need to trace the main thread,
-but sometimes you need to trace all threads, so this enables that.
-It's also needed when you want to profile a function that only a
-subthread calls. However, using OutputDebugString automatically
-enables profiling on the thread that called it, not the main thread.
-
-"-dll" - dll profiling. Generates a pretty table of how much time was
-spent in each dll the program used. No sense optimizing a function in
-your program if most of the time is spent in the DLL.
-
-I usually use the -v, -s, and -dll options:
-
- ssp -v -s -dll -d 0x61001000 0x61080000 hello.exe
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc
deleted file mode 100644
index 19d15bd6d..000000000
--- a/winsup/utils/strace.cc
+++ /dev/null
@@ -1,1061 +0,0 @@
-/* strace.cc
-
- Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Red Hat Inc.
-
- Written by Chris Faylor <cgf@redhat.com>
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#define cygwin_internal cygwin_internal_dontuse
-#include <stdio.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <stdarg.h>
-#include <string.h>
-#include <stdlib.h>
-#include <time.h>
-#include <windows.h>
-#include <signal.h>
-#include <errno.h>
-#include "cygwin/include/sys/strace.h"
-#include "cygwin/include/sys/cygwin.h"
-#include "path.h"
-#undef cygwin_internal
-
-/* we *know* we're being built with GCC */
-#define alloca __builtin_alloca
-
-// Version string.
-static const char version[] = "$Revision$";
-
-static const char *pgm;
-static int forkdebug = 1;
-static int numerror = 1;
-static int show_usecs = 1;
-static int delta = 1;
-static int hhmmss;
-static int bufsize;
-static int new_window;
-static long flush_period;
-static int include_hex;
-static int quiet = -1;
-
-static unsigned char strace_active = 1;
-static int processes;
-
-static BOOL close_handle (HANDLE h, DWORD ok);
-
-#define CloseHandle(h) close_handle(h, 0)
-
-struct child_list
-{
- DWORD id;
- HANDLE hproc;
- int saw_stars;
- char nfields;
- long long start_time;
- DWORD last_usecs;
- struct child_list *next;
- child_list ():id (0), hproc (NULL), saw_stars (0), nfields (0),
- start_time (0), last_usecs (0), next (NULL)
- {
- }
-};
-
-child_list children;
-
-static void
-warn (int geterrno, const char *fmt, ...)
-{
- va_list args;
- char buf[4096];
-
- va_start (args, fmt);
- sprintf (buf, "%s: ", pgm);
- vsprintf (strchr (buf, '\0'), fmt, args);
- if (geterrno)
- perror (buf);
- else
- {
- fputs (buf, stderr);
- fputs ("\n", stderr);
- }
-}
-
-static void __attribute__ ((noreturn))
-error (int geterrno, const char *fmt, ...)
-{
- va_list args;
- char buf[4096];
-
- va_start (args, fmt);
- sprintf (buf, "%s: ", pgm);
- vsprintf (strchr (buf, '\0'), fmt, args);
- if (geterrno)
- perror (buf);
- else
- {
- fputs (buf, stderr);
- fputs ("\n", stderr);
- }
- exit (1);
-}
-
-DWORD lastid = 0;
-HANDLE lasth;
-
-static child_list *
-get_child (DWORD id)
-{
- child_list *c;
- for (c = &children; (c = c->next) != NULL;)
- if (c->id == id)
- return c;
-
- return NULL;
-}
-
-static void
-add_child (DWORD id, HANDLE hproc)
-{
- if (!get_child (id))
- {
- child_list *c = children.next;
- children.next = (child_list *) calloc (1, sizeof (child_list));
- children.next->next = c;
- lastid = children.next->id = id;
- lasth = children.next->hproc = hproc;
- processes++;
- if (!quiet)
- fprintf (stderr, "Windows process %lu attached\n", id);
- }
-}
-
-static void
-remove_child (DWORD id)
-{
- child_list *c;
- if (id == lastid)
- lastid = 0;
- for (c = &children; c->next != NULL; c = c->next)
- if (c->next->id == id)
- {
- child_list *c1 = c->next;
- c->next = c1->next;
- free (c1);
- if (!quiet)
- fprintf (stderr, "Windows process %lu detached\n", id);
- processes--;
- return;
- }
-
- error (0, "no process id %d found", id);
-}
-
-#define LINE_BUF_CHUNK 128
-
-class linebuf
-{
- size_t alloc;
-public:
- size_t ix;
- char *buf;
- linebuf ()
- {
- ix = 0;
- alloc = 0;
- buf = NULL;
- }
- ~linebuf ()
- {
- if (buf)
- free (buf);
- }
- void add (const char *what, int len);
- void add (const char *what)
- {
- add (what, strlen (what));
- }
- void prepend (const char *what, int len);
-};
-
-void
-linebuf::add (const char *what, int len)
-{
- size_t newix;
- if ((newix = ix + len) >= alloc)
- {
- alloc += LINE_BUF_CHUNK + len;
- buf = (char *) realloc (buf, alloc + 1);
- }
- memcpy (buf + ix, what, len);
- ix = newix;
- buf[ix] = '\0';
-}
-
-void
-linebuf::prepend (const char *what, int len)
-{
- int buflen;
- size_t newix;
- if ((newix = ix + len) >= alloc)
- {
- alloc += LINE_BUF_CHUNK + len;
- buf = (char *) realloc (buf, alloc + 1);
- buf[ix] = '\0';
- }
- if ((buflen = strlen (buf)))
- memmove (buf + len, buf, buflen + 1);
- else
- buf[newix] = '\0';
- memcpy (buf, what, len);
- ix = newix;
-}
-
-static void
-make_command_line (linebuf & one_line, char **argv)
-{
- for (; *argv; argv++)
- {
- char *p = NULL;
- const char *a = *argv;
-
- int len = strlen (a);
- if (len != 0 && !(p = strpbrk (a, " \t\n\r\"")))
- one_line.add (a, len);
- else
- {
- one_line.add ("\"", 1);
- for (; p; a = p, p = strchr (p, '"'))
- {
- one_line.add (a, ++p - a);
- if (p[-1] == '"')
- one_line.add ("\"", 1);
- }
- if (*a)
- one_line.add (a);
- one_line.add ("\"", 1);
- }
- one_line.add (" ", 1);
- }
-
- if (one_line.ix)
- one_line.buf[one_line.ix - 1] = '\0';
- else
- one_line.add ("", 1);
-}
-
-static DWORD child_pid;
-
-static BOOL WINAPI
-ctrl_c (DWORD)
-{
- static int tic = 1;
- if ((tic ^= 1) && !GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0))
- error (0, "couldn't send CTRL-C to child, win32 error %d\n",
- GetLastError ());
- return TRUE;
-}
-
-extern "C" {
-unsigned long (*cygwin_internal) (int, ...);
-};
-
-static int
-load_cygwin ()
-{
- static HMODULE h;
-
- if (cygwin_internal)
- return 1;
-
- if (h)
- return 0;
-
- if (!(h = LoadLibrary ("cygwin1.dll")))
- {
- errno = ENOENT;
- return 0;
- }
- if (!(cygwin_internal = (DWORD (*) (int, ...)) GetProcAddress (h, "cygwin_internal")))
- {
- errno = ENOSYS;
- return 0;
- }
- return 1;
-}
-
-static void
-attach_process (pid_t pid)
-{
- child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
- if (!child_pid)
- child_pid = pid;
-
- if (!DebugActiveProcess (child_pid))
- error (0, "couldn't attach to pid %d for debugging", child_pid);
-
- return;
-}
-
-
-static void
-create_child (char **argv)
-{
- linebuf one_line;
-
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- BOOL ret;
- DWORD flags;
-
- if (strchr (*argv, '/'))
- *argv = cygpath (*argv, NULL);
- memset (&si, 0, sizeof (si));
- si.cb = sizeof (si);
-
- flags = CREATE_DEFAULT_ERROR_MODE
- | (forkdebug ? DEBUG_PROCESS : DEBUG_ONLY_THIS_PROCESS);
- if (new_window)
- flags |= CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP;
-
- make_command_line (one_line, argv);
-
- SetConsoleCtrlHandler (NULL, 0);
- ret = CreateProcess (0, one_line.buf, /* command line */
- NULL, /* Security */
- NULL, /* thread */
- TRUE, /* inherit handles */
- flags, /* start flags */
- NULL, NULL, /* current directory */
- &si, &pi);
- if (!ret)
- error (0, "error creating process %s, (error %d)", *argv,
- GetLastError ());
-
- CloseHandle (pi.hThread);
- CloseHandle (pi.hProcess);
- child_pid = pi.dwProcessId;
- SetConsoleCtrlHandler (ctrl_c, 1);
-}
-
-static int
-output_winerror (FILE *ofile, char *s)
-{
- char *winerr = strstr (s, "Win32 error ");
- if (!winerr)
- return 0;
-
- DWORD errnum = atoi (winerr + sizeof ("Win32 error ") - 1);
- if (!errnum)
- return 0;
-
- /*
- * NOTE: Currently there is no policy for how long the
- * the buffers are, and looks like 256 is a smallest one
- * (dlfcn.cc). Other than error 1395 (length 213) and
- * error 1015 (length 249), the rest are all under 188
- * characters, and so I'll use 189 as the buffer length.
- * For those longer error messages, FormatMessage will
- * return FALSE, and we'll get the old behaviour such as
- * ``Win32 error 1395'' etc.
- */
- char buf[4096];
- if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
- | FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- errnum,
- MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPTSTR) buf, sizeof (buf), NULL))
- return 0;
-
- /* Get rid the trailing CR/NL pair. */
- char *p = strchr (buf, '\0');
- p[-2] = '\n';
- p[-1] = '\0';
-
- *winerr = '\0';
- fputs (s, ofile);
- fputs (buf, ofile);
- return 1;
-}
-
-static SYSTEMTIME *
-syst (long long t)
-{
- FILETIME n;
- static SYSTEMTIME st;
- long long now = t /*+ ((long long) usecs * 10)*/;
- n.dwHighDateTime = now >> 32;
- n.dwLowDateTime = now & 0xffffffff;
- FileTimeToSystemTime (&n, &st);
- return &st;
-}
-
-static void __stdcall
-handle_output_debug_string (DWORD id, LPVOID p, unsigned mask, FILE *ofile)
-{
- int len;
- int special;
- char alen[3 + 8 + 1];
- DWORD nbytes;
- child_list *child = get_child (id);
- if (!child)
- error (0, "no process id %d found", id);
- HANDLE hchild = child->hproc;
-#define INTROLEN (sizeof (alen) - 1)
-
- if (id == lastid && hchild != lasth)
- warn (0, "%p != %p", hchild, lasth);
-
- alen[INTROLEN] = '\0';
- if (!ReadProcessMemory (hchild, p, alen, INTROLEN, &nbytes))
-#ifndef DEBUGGING
- return;
-#else
- error (0,
- "couldn't get message length from subprocess %d<%p>, windows error %d",
- id, hchild, GetLastError ());
-#endif
-
- if (strncmp (alen, "cYg", 3))
- return;
- len = (int) strtoul (alen + 3, NULL, 16);
- if (!len)
- return;
-
- if (len > 0)
- special = 0;
- else
- {
- special = len;
- if (special == _STRACE_INTERFACE_ACTIVATE_ADDR || special == _STRACE_CHILD_PID)
- len = 17;
- }
-
- char *buf;
- buf = (char *) alloca (len + 85) + 20;
-
- if (!ReadProcessMemory (hchild, ((char *) p) + INTROLEN, buf, len, &nbytes))
- error (0, "couldn't get message from subprocess, windows error %d",
- GetLastError ());
-
- buf[len] = '\0';
- char *s = strtok (buf, " ");
-
- unsigned long n = strtoul (s, NULL, 16);
-
- s = strchr (s, '\0') + 1;
-
- if (special == _STRACE_CHILD_PID)
- {
- if (!DebugActiveProcess (n))
- error (0, "couldn't attach to subprocess %d for debugging, "
- "windows error %d", n, GetLastError ());
- return;
- }
-
- if (special == _STRACE_INTERFACE_ACTIVATE_ADDR)
- {
- if (!WriteProcessMemory (hchild, (LPVOID) n, &strace_active,
- sizeof (strace_active), &nbytes))
- error (0, "couldn't write strace flag to subprocess at %p, "
- "windows error %d", n, GetLastError ());
- return;
- }
-
- char *origs = s;
-
- if (mask & n)
- /* got it */ ;
- else if (!(mask & _STRACE_ALL) || (n & _STRACE_NOTALL))
- return; /* This should not be included in "all" output */
-
- DWORD dusecs, usecs;
- char *ptusec, *ptrest;
-
- dusecs = strtoul (s, &ptusec, 10);
- char *q = ptusec;
- while (*q == ' ')
- q++;
- if (*q != '[')
- {
- usecs = strtoul (q, &ptrest, 10);
- while (*ptrest == ' ')
- ptrest++;
- }
- else
- {
- ptrest = q;
- ptusec = show_usecs ? s : ptrest;
- usecs = dusecs;
- }
-
- if (child->saw_stars == 0)
- {
- FILETIME st;
- char *news;
-
- GetSystemTimeAsFileTime (&st);
- FileTimeToLocalFileTime (&st, &st);
- child->start_time = st.dwHighDateTime;
- child->start_time <<= 32;
- child->start_time |= st.dwLowDateTime;
- if (*(news = ptrest) != '[')
- child->saw_stars = 2;
- else
- {
- child->saw_stars++;
- while ((news = strchr (news, ' ')) != NULL && *++news != '*')
- child->nfields++;
- if (news == NULL)
- child->saw_stars++;
- else
- {
- s = news;
- child->nfields++;
- }
- }
- }
- else if (child->saw_stars < 2)
- {
- int i;
- char *news;
- if (*(news = ptrest) != '[')
- child->saw_stars = 2;
- else
- {
- for (i = 0; i < child->nfields; i++)
- if ((news = strchr (news, ' ')) == NULL)
- break; // Should never happen
- else
- news++;
-
- if (news == NULL)
- child->saw_stars = 2;
- else
- {
- s = news;
- if (*s == '*')
- {
- SYSTEMTIME *st = syst (child->start_time);
- fprintf (ofile,
- "Date/Time: %d-%02d-%02d %02d:%02d:%02d\n",
- st->wYear, st->wMonth, st->wDay, st->wHour,
- st->wMinute, st->wSecond);
- child->saw_stars++;
- }
- }
- }
- }
-
- long long d = usecs - child->last_usecs;
- char intbuf[40];
-
- if (child->saw_stars < 2 || s != origs)
- /* Nothing */ ;
- else if (hhmmss)
- {
- s = ptrest - 9;
- SYSTEMTIME *st = syst (child->start_time + (long long) usecs * 10);
- sprintf (s, "%02d:%02d:%02d", st->wHour, st->wMinute, st->wSecond);
- *strchr (s, '\0') = ' ';
- }
- else if (!delta)
- s = ptusec;
- else
- {
- s = ptusec;
- sprintf (intbuf, "%5d ", (int) d);
- int len = strlen (intbuf);
-
- memcpy ((s -= len), intbuf, len);
- }
-
- if (include_hex)
- {
- s -= 8;
- sprintf (s, "%p", (void *) n);
- strchr (s, '\0')[0] = ' ';
- }
- child->last_usecs = usecs;
- if (numerror || !output_winerror (ofile, s))
- fputs (s, ofile);
- if (!bufsize)
- fflush (ofile);
-}
-
-static DWORD
-proc_child (unsigned mask, FILE *ofile, pid_t pid)
-{
- DWORD res = 0;
- DEBUG_EVENT ev;
- time_t cur_time, last_time;
-
- SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST);
- last_time = time (NULL);
- while (1)
- {
- BOOL debug_event = WaitForDebugEvent (&ev, 1000);
- DWORD status = DBG_CONTINUE;
-
- if (bufsize && flush_period > 0 &&
- (cur_time = time (NULL)) >= last_time + flush_period)
- {
- last_time = cur_time;
- fflush (ofile);
- }
-
- if (!debug_event)
- continue;
-
- if (pid)
- {
- (void) cygwin_internal (CW_STRACE_TOGGLE, pid);
- pid = 0;
- }
-
- switch (ev.dwDebugEventCode)
- {
- case CREATE_PROCESS_DEBUG_EVENT:
- if (ev.u.CreateProcessInfo.hFile)
- CloseHandle (ev.u.CreateProcessInfo.hFile);
- add_child (ev.dwProcessId, ev.u.CreateProcessInfo.hProcess);
- break;
-
- case CREATE_THREAD_DEBUG_EVENT:
- break;
-
- case LOAD_DLL_DEBUG_EVENT:
- if (ev.u.LoadDll.hFile)
- CloseHandle (ev.u.LoadDll.hFile);
- break;
-
- case OUTPUT_DEBUG_STRING_EVENT:
- handle_output_debug_string (ev.dwProcessId,
- ev.u.DebugString.lpDebugStringData,
- mask, ofile);
- break;
-
- case EXIT_PROCESS_DEBUG_EVENT:
- res = ev.u.ExitProcess.dwExitCode >> 8;
- remove_child (ev.dwProcessId);
- break;
- case EXCEPTION_DEBUG_EVENT:
- if (ev.u.Exception.ExceptionRecord.ExceptionCode != STATUS_BREAKPOINT)
- {
- status = DBG_EXCEPTION_NOT_HANDLED;
- if (ev.u.Exception.dwFirstChance)
- fprintf (ofile, "--- Process %lu, exception %p at %p\n", ev.dwProcessId,
- ev.u.Exception.ExceptionRecord.ExceptionCode,
- ev.u.Exception.ExceptionRecord.ExceptionAddress);
- }
- break;
- }
- if (!ContinueDebugEvent (ev.dwProcessId, ev.dwThreadId, status))
- error (0, "couldn't continue debug event, windows error %d",
- GetLastError ());
- if (!processes)
- break;
- }
-
- return res;
-}
-
-static void
-dotoggle (pid_t pid)
-{
- child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
- if (!child_pid)
- {
- warn (0, "no such cygwin pid - %d", pid);
- child_pid = pid;
- }
- if (cygwin_internal (CW_STRACE_TOGGLE, child_pid))
- error (0, "failed to toggle tracing for process %d<%d>", pid, child_pid);
-
- return;
-}
-
-static DWORD
-dostrace (unsigned mask, FILE *ofile, pid_t pid, char **argv)
-{
- if (!pid)
- create_child (argv);
- else
- attach_process (pid);
-
- return proc_child (mask, ofile, pid);
-}
-
-typedef struct tag_mask_mnemonic
-{
- unsigned long val;
- const char *text;
-}
-mask_mnemonic;
-
-static const mask_mnemonic mnemonic_table[] = {
- {_STRACE_ALL, "all"},
- {_STRACE_FLUSH, "flush"},
- {_STRACE_INHERIT, "inherit"},
- {_STRACE_UHOH, "uhoh"},
- {_STRACE_SYSCALL, "syscall"},
- {_STRACE_STARTUP, "startup"},
- {_STRACE_DEBUG, "debug"},
- {_STRACE_PARANOID, "paranoid"},
- {_STRACE_TERMIOS, "termios"},
- {_STRACE_SELECT, "select"},
- {_STRACE_WM, "wm"},
- {_STRACE_SIGP, "sigp"},
- {_STRACE_MINIMAL, "minimal"},
- {_STRACE_EXITDUMP, "exitdump"},
- {_STRACE_SYSTEM, "system"},
- {_STRACE_NOMUTEX, "nomutex"},
- {_STRACE_MALLOC, "malloc"},
- {_STRACE_THREAD, "thread"},
- {0, NULL}
-};
-
-static unsigned long
-mnemonic2ul (const char *nptr, char **endptr)
-{
- // Look up mnemonic in table, return value.
- // *endptr = ptr to char that breaks match.
- const mask_mnemonic *mnp = mnemonic_table;
-
- while (mnp->text != NULL)
- {
- if (strcmp (mnp->text, nptr) == 0)
- {
- // Found a match.
- if (endptr != NULL)
- {
- *endptr = ((char *) nptr) + strlen (mnp->text);
- }
- return mnp->val;
- }
- mnp++;
- }
-
- // Didn't find it.
- if (endptr != NULL)
- {
- *endptr = (char *) nptr;
- }
- return 0;
-}
-
-static unsigned long
-parse_mask (const char *ms, char **endptr)
-{
- const char *p = ms;
- char *newp;
- unsigned long retval = 0, thisval;
- const size_t bufsize = 16;
- char buffer[bufsize];
- size_t len;
-
- while (*p != '\0')
- {
- // First extract the term, terminate it, and lowercase it.
- strncpy (buffer, p, bufsize);
- buffer[bufsize - 1] = '\0';
- len = strcspn (buffer, "+,\0");
- buffer[len] = '\0';
- strlwr (buffer);
-
- // Check if this is a mnemonic. We have to do this first or strtoul()
- // will false-trigger on anything starting with "a" through "f".
- thisval = mnemonic2ul (buffer, &newp);
- if (buffer == newp)
- {
- // This term isn't mnemonic, check if it's hex.
- thisval = strtoul (buffer, &newp, 16);
- if (newp != buffer + len)
- {
- // Not hex either, syntax error.
- *endptr = (char *) p;
- return 0;
- }
- }
-
- p += len;
- retval += thisval;
-
- // Handle operators
- if (*p == '\0')
- break;
- if ((*p == '+') || (*p == ','))
- {
- // For now these both equate to addition/ORing. Until we get
- // fancy and add things like "all-<something>", all we need do is
- // continue the looping.
- p++;
- continue;
- }
- else
- {
- // Syntax error
- *endptr = (char *) p;
- return 0;
- }
- }
-
- *endptr = (char *) p;
- return retval;
-}
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where, "\
-Usage: %s [OPTIONS] <command-line>\n\
-Usage: %s [OPTIONS] -p <pid>\n\
-Trace system calls and signals\n\
-\n\
- -b, --buffer-size=SIZE set size of output file buffer\n\
- -d, --no-delta don't display the delta-t microsecond timestamp\n\
- -f, --trace-children trace child processes (toggle - default true)\n\
- -h, --help output usage information and exit\n\
- -m, --mask=MASK set message filter mask\n\
- -n, --crack-error-numbers output descriptive text instead of error\n\
- numbers for Windows errors\n\
- -o, --output=FILENAME set output file to FILENAME\n\
- -p, --pid=n attach to executing program with cygwin pid n\n\
- -q, --quiet suppress messages about attaching, detaching, etc.\n\
- -S, --flush-period=PERIOD flush buffered strace output every PERIOD secs\n\
- -t, --timestamp use an absolute hh:mm:ss timestamp insted of \n\
- the default microsecond timestamp. Implies -d\n\
- -T, --toggle toggle tracing in a process already being\n\
- traced. Requires -p <pid>\n\
- -u, --usecs toggle printing of microseconds timestamp\n\
- -v, --version output version information and exit\n\
- -w, --new-window spawn program under test in a new window\n\
-\n", pgm, pgm);
- if ( where == stdout)
- fprintf (stdout, "\
- MASK can be any combination of the following mnemonics and/or hex values\n\
- (0x is optional). Combine masks with '+' or ',' like so:\n\
-\n\
- --mask=wm+system,malloc+0x00800\n\
-\n\
- Mnemonic Hex Corresponding Def Description\n\
- =========================================================================\n\
- all 0x00001 (_STRACE_ALL) All strace messages.\n\
- flush 0x00002 (_STRACE_FLUSH) Flush output buffer after each message.\n\
- inherit 0x00004 (_STRACE_INHERIT) Children inherit mask from parent.\n\
- uhoh 0x00008 (_STRACE_UHOH) Unusual or weird phenomenon.\n\
- syscall 0x00010 (_STRACE_SYSCALL) System calls.\n\
- startup 0x00020 (_STRACE_STARTUP) argc/envp printout at startup.\n\
- debug 0x00040 (_STRACE_DEBUG) Info to help debugging. \n\
- paranoid 0x00080 (_STRACE_PARANOID) Paranoid info.\n\
- termios 0x00100 (_STRACE_TERMIOS) Info for debugging termios stuff.\n\
- select 0x00200 (_STRACE_SELECT) Info on ugly select internals.\n\
- wm 0x00400 (_STRACE_WM) Trace Windows msgs (enable _strace_wm).\n\
- sigp 0x00800 (_STRACE_SIGP) Trace signal and process handling.\n\
- minimal 0x01000 (_STRACE_MINIMAL) Very minimal strace output.\n\
- exitdump 0x04000 (_STRACE_EXITDUMP) Dump strace cache on exit.\n\
- system 0x08000 (_STRACE_SYSTEM) Serious error; goes to console and log.\n\
- nomutex 0x10000 (_STRACE_NOMUTEX) Don't use mutex for synchronization.\n\
- malloc 0x20000 (_STRACE_MALLOC) Trace malloc calls.\n\
- thread 0x40000 (_STRACE_THREAD) Thread-locking calls.\n\
-");
- if (where == stderr)
- fprintf (stderr, "Try '%s --help' for more information.\n", pgm);
- exit (where == stderr ? 1 : 0 );
-}
-
-struct option longopts[] = {
- {"buffer-size", required_argument, NULL, 'b'},
- {"help", no_argument, NULL, 'h'},
- {"flush-period", required_argument, NULL, 'S'},
- {"hex", no_argument, NULL, 'H'},
- {"mask", required_argument, NULL, 'm'},
- {"new-window", no_argument, NULL, 'w'},
- {"output", required_argument, NULL, 'o'},
- {"no-delta", no_argument, NULL, 'd'},
- {"pid", required_argument, NULL, 'p'},
- {"quiet", no_argument, NULL, 'q'},
- {"timestamp", no_argument, NULL, 't'},
- {"toggle", no_argument, NULL, 'T'},
- {"trace-children", no_argument, NULL, 'f'},
- {"translate-error-numbers", no_argument, NULL, 'n'},
- {"usecs", no_argument, NULL, 'u'},
- {"version", no_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
-};
-
-static const char *const opts = "+b:dhHfm:no:p:qS:tTuvw";
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-System Trace\n\
-Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.\n\
-Compiled on %s\n\
-", pgm, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- unsigned mask = 0;
- FILE *ofile = NULL;
- pid_t pid = 0;
- int opt;
- int toggle = 0;
- int sawquiet = -1;
-
- if (load_cygwin ())
- {
- char **av = (char **) cygwin_internal (CW_ARGV);
- if (av && (DWORD) av != (DWORD) -1)
- for (argc = 0, argv = av; *av; av++)
- argc++;
- }
-
- if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/')))
- pgm = *argv;
- else
- pgm++;
-
- while ((opt = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (opt)
- {
- case 'b':
- bufsize = atoi (optarg);
- break;
- case 'd':
- delta ^= 1;
- break;
- case 'f':
- forkdebug ^= 1;
- break;
- case 'h':
- // Print help and exit
- usage (stdout);
- break;
- case 'H':
- include_hex ^= 1;
- break;
- case 'm':
- {
- char *endptr;
- mask = parse_mask (optarg, &endptr);
- if (*endptr != '\0')
- {
- // Bad mask expression.
- error (0, "syntax error in mask expression \"%s\" near \
-character #%d.\n", optarg, (int) (endptr - optarg), endptr);
- }
- break;
- }
- case 'n':
- numerror ^= 1;
- break;
- case 'o':
- if ((ofile = fopen (cygpath (optarg, NULL), "w")) == NULL)
- error (1, "can't open %s", optarg);
-#ifdef F_SETFD
- (void) fcntl (fileno (ofile), F_SETFD, 0);
-#endif
- break;
- case 'p':
- pid = strtoul (optarg, NULL, 10);
- strace_active |= 2;
- break;
- case 'q':
- if (sawquiet < 0)
- sawquiet = 1;
- else
- sawquiet ^= 1;
- break;
- case 'S':
- flush_period = strtoul (optarg, NULL, 10);
- break;
- case 't':
- hhmmss ^= 1;
- break;
- case 'T':
- toggle ^= 1;
- break;
- case 'u':
- // FIXME: currently unimplemented
- show_usecs ^= 1;
- delta ^= 1;
- break;
- case 'v':
- // Print version info and exit
- print_version ();
- return 0;
- case 'w':
- new_window ^= 1;
- break;
- case '?':
- fprintf (stderr, "Try '%s --help' for more information.\n", pgm);
- exit (1);
- }
-
- if (pid && argv[optind])
- error (0, "cannot provide both a command line and a process id");
-
- if (!pid && !argv[optind])
- error (0, "must provide either a command line or a process id");
-
- if (toggle && !pid)
- error (0, "must provide a process id to toggle tracing");
-
- if (!pid)
- quiet = sawquiet < 0 || !sawquiet;
- else if (sawquiet < 0)
- quiet = 0;
- else
- quiet = sawquiet;
-
- if (!mask)
- mask = _STRACE_ALL;
-
- if (bufsize)
- setvbuf (ofile, (char *) alloca (bufsize), _IOFBF, bufsize);
-
- if (!ofile)
- ofile = stdout;
-
- DWORD res = 0;
- if (toggle)
- dotoggle (pid);
- else
- res = dostrace (mask, ofile, pid, argv + optind);
- return res;
-}
-
-#undef CloseHandle
-
-static BOOL
-close_handle (HANDLE h, DWORD ok)
-{
- child_list *c;
- for (c = &children; (c = c->next) != NULL;)
- if (c->hproc == h && c->id != ok)
- error (0, "Closing child handle %p", h);
- return CloseHandle (h);
-}
diff --git a/winsup/utils/testsuite.cc b/winsup/utils/testsuite.cc
deleted file mode 100644
index b87f85cf8..000000000
--- a/winsup/utils/testsuite.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-/* testsuite.cc
-
- Copyright 2008 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-/* This file implements a driver for performing tests on the file/path
- translation code in path.cc. This file is meant to be generic, all
- test harness data is in testsuite.h. */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-#define TESTSUITE
-#include "testsuite.h"
-
-typedef struct
- {
- const char *cwd; /* in win32 form, as if by GetCurrentDirectory */
- const char *posix; /* input */
- const char *win32; /* expected output */
- } test_t;
-
-#define TESTSUITE_TESTS
-#include "testsuite.h"
-#undef TESTSUITE_TESTS
-
-static int curtest;
-
-/* A replacement for the w32api GetCurrentDirectory() that returns
- the cwd that the current test specifies. */
-DWORD
-testsuite_getcwd (DWORD nBufferLength, LPSTR lpBuffer)
-{
- unsigned len = strlen (testsuite_tests[curtest].cwd) + 1;
-
- /* If the test specified NO_CWD, then it means we should not have
- needed the CWD for that test as the test was for an absolute path,
- and so if we see that here return 0, simulating a
- GetCurrentDirectory() error. */
- if (strcmp (testsuite_tests[curtest].cwd, NO_CWD) == 0)
- return 0;
-
- if (nBufferLength >= len)
- {
- strcpy (lpBuffer, testsuite_tests[curtest].cwd);
- return len - 1;
- }
- return len;
-}
-
-extern char *cygpath (const char *s, ...);
-
-int
-main (int argc, char **argv)
-{
- int numpass = 0;
-
- for (test_t &t = testsuite_tests[curtest]; t.posix; t = testsuite_tests[++curtest])
- {
- char *result = cygpath (t.posix, NULL);
- bool pass = (strcmp (result, t.win32) == 0);
-
- if (pass)
- {
- numpass++;
- printf ("test %03d: PASS cwd=%-18s input=%-22s expected+actual=%s\n",
- curtest, t.cwd, t.posix, result);
- }
- else
- {
- printf ("test %03d: FAIL cwd=%-18s input=%-29s expected=%-25s actual=%s\n",
- curtest, t.cwd, t.posix, t.win32, result);
- }
- }
- printf ("\n"
- "total tests: %d\n"
- "pass : %d (%.1f%%)\n"
- "fail : %d (%.1f%%)\n",
- curtest, numpass, ((float)numpass)/curtest * 100.0F, curtest - numpass,
- ((float)curtest - numpass)/curtest * 100.0F);
- return (numpass < curtest ? 1 : 0);
-}
diff --git a/winsup/utils/testsuite.h b/winsup/utils/testsuite.h
deleted file mode 100644
index 3bc360ab5..000000000
--- a/winsup/utils/testsuite.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/* testsuite.h
-
- Copyright 2008 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-/* This file implements a test harness for the MinGW implementation of
- POSIX path translation in utils/path.cc. This code is used by strace
- and cygcheck which cannot depend on the Cygwin DLL. The tests below
- are a basic set of sanity checks for translating relative and
- absolute paths from POSIX form to Win32 form based on the contents of
- a mount table. */
-
-/* Including this file should be a no-op if TESTSUITE is not defined. */
-#ifdef TESTSUITE
-
-/* These definitions are common to both the testsuite mount table
- as well as the testsuite definitions themselves, so define them
- here so that they are only defined in one location. */
-#define TESTSUITE_ROOT "X:\\xyzroot"
-#define TESTSUITE_CYGDRIVE "/testcygdrive"
-
-/* Define a mount table in the form that read_mounts() would populate.
- This is used in place of actually reading the host mount
- table from the registry for the duration of the testsuite. This
- table should match the battery of tests below. */
-
-#if defined(TESTSUITE_MOUNT_TABLE)
-static mnt_t mount_table[] = {
-/* native posix flags issys */
- { TESTSUITE_ROOT, (char*)"/", MOUNT_BINARY | MOUNT_SYSTEM, 1 },
- { "O:\\other", (char*)"/otherdir", MOUNT_BINARY | MOUNT_SYSTEM, 1 },
- { "S:\\some\\dir", (char*)"/somedir", MOUNT_BINARY | MOUNT_SYSTEM, 1 },
- { TESTSUITE_ROOT"\\bin", (char*)"/usr/bin", MOUNT_BINARY | MOUNT_SYSTEM, 1 },
- { TESTSUITE_ROOT"\\lib", (char*)"/usr/lib", MOUNT_BINARY | MOUNT_SYSTEM, 1 },
- { ".", (char*)TESTSUITE_CYGDRIVE, MOUNT_BINARY | MOUNT_SYSTEM | MOUNT_CYGDRIVE, 1 },
- { NULL, (char*)NULL, 0, 0 }
-};
-
-
-/* Define the main set of tests. This is defined here instead of in
- testsuite.cc so that all test harness data is in one place and not
- spread over several files. */
-
-#elif defined(TESTSUITE_TESTS)
-#define NO_CWD "N/A"
-static test_t testsuite_tests[] = {
- { NO_CWD, "/file.ext", TESTSUITE_ROOT"\\file.ext" },
- { NO_CWD, "/dir/file.ext", TESTSUITE_ROOT"\\dir\\file.ext" },
- { NO_CWD, "/foo/dir/file.ext", TESTSUITE_ROOT"\\foo\\dir\\file.ext" },
- { NO_CWD, "/bin/file.ext", TESTSUITE_ROOT"\\bin\\file.ext" },
- { NO_CWD, "/bin/dir/file.ext", TESTSUITE_ROOT"\\bin\\dir\\file.ext" },
- { NO_CWD, "/lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" },
- { NO_CWD, "/lib/dir/file.ext", TESTSUITE_ROOT"\\lib\\dir\\file.ext" },
- { NO_CWD, "/usr/bin/file.ext", TESTSUITE_ROOT"\\bin\\file.ext" },
- { NO_CWD, "/usr/bin/dir/file.ext", TESTSUITE_ROOT"\\bin\\dir\\file.ext" },
- { NO_CWD, "/usr/lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" },
- { NO_CWD, "/usr/lib/dir/file.ext", TESTSUITE_ROOT"\\lib\\dir\\file.ext" },
- { NO_CWD, "/home/file.ext", TESTSUITE_ROOT"\\home\\file.ext" },
- { NO_CWD, "/home/foo/file.ext", TESTSUITE_ROOT"\\home\\foo\\file.ext" },
- { NO_CWD, "/home/foo/dir/file.ext", TESTSUITE_ROOT"\\home\\foo\\dir\\file.ext" },
- { NO_CWD, "/usr/file.ext", TESTSUITE_ROOT"\\usr\\file.ext" },
- { NO_CWD, "/usr/share/file.ext", TESTSUITE_ROOT"\\usr\\share\\file.ext" },
- { TESTSUITE_ROOT, "foo", TESTSUITE_ROOT"\\foo" },
- { TESTSUITE_ROOT, "./foo", TESTSUITE_ROOT"\\foo" },
- { TESTSUITE_ROOT, "foo/bar", TESTSUITE_ROOT"\\foo\\bar" },
- { TESTSUITE_ROOT, "./foo/bar", TESTSUITE_ROOT"\\foo\\bar" },
- { TESTSUITE_ROOT, "foo/./bar", TESTSUITE_ROOT"\\foo\\bar" },
- { TESTSUITE_ROOT, "./foo/./bar", TESTSUITE_ROOT"\\foo\\bar" },
- { TESTSUITE_ROOT, "bin/file.ext", TESTSUITE_ROOT"\\bin\\file.ext" },
- { TESTSUITE_ROOT, "lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" },
- { TESTSUITE_ROOT, "usr/bin/file.ext", TESTSUITE_ROOT"\\bin\\file.ext" },
- { TESTSUITE_ROOT, "usr/lib/file.ext", TESTSUITE_ROOT"\\lib\\file.ext" },
- { TESTSUITE_ROOT, "etc/file.ext", TESTSUITE_ROOT"\\etc\\file.ext" },
- { TESTSUITE_ROOT, "etc/foo/file.ext", TESTSUITE_ROOT"\\etc\\foo\\file.ext" },
- { TESTSUITE_ROOT"\\bin", "foo", TESTSUITE_ROOT"\\bin\\foo" },
- { TESTSUITE_ROOT"\\bin", "./foo", TESTSUITE_ROOT"\\bin\\foo" },
- { TESTSUITE_ROOT"\\bin", "foo/bar", TESTSUITE_ROOT"\\bin\\foo\\bar" },
- { TESTSUITE_ROOT"\\bin", "./foo/bar", TESTSUITE_ROOT"\\bin\\foo\\bar" },
- { TESTSUITE_ROOT"\\bin", "foo/./bar", TESTSUITE_ROOT"\\bin\\foo\\bar" },
- { TESTSUITE_ROOT"\\bin", "./foo/./bar", TESTSUITE_ROOT"\\bin\\foo\\bar" },
- { TESTSUITE_ROOT"\\bin\\foo", "bar", TESTSUITE_ROOT"\\bin\\foo\\bar" },
- { TESTSUITE_ROOT"\\bin\\foo", "./bar", TESTSUITE_ROOT"\\bin\\foo\\bar" },
- { TESTSUITE_ROOT"\\bin\\foo", "bar/baz", TESTSUITE_ROOT"\\bin\\foo\\bar\\baz" },
- { TESTSUITE_ROOT"\\bin\\foo", "./bar/baz", TESTSUITE_ROOT"\\bin\\foo\\bar\\baz" },
- { TESTSUITE_ROOT"\\bin\\foo", "bar/./baz", TESTSUITE_ROOT"\\bin\\foo\\bar\\baz" },
- { TESTSUITE_ROOT"\\bin\\foo", "./bar/./baz", TESTSUITE_ROOT"\\bin\\foo\\bar\\baz" },
- { TESTSUITE_ROOT"\\tmp", "foo", TESTSUITE_ROOT"\\tmp\\foo" },
- { TESTSUITE_ROOT"\\tmp", "./foo", TESTSUITE_ROOT"\\tmp\\foo" },
- { TESTSUITE_ROOT"\\tmp", "foo/bar", TESTSUITE_ROOT"\\tmp\\foo\\bar" },
- { TESTSUITE_ROOT"\\tmp", "./foo/bar", TESTSUITE_ROOT"\\tmp\\foo\\bar" },
- { NO_CWD, "/otherdir/file.ext", "O:\\other\\file.ext" },
- { NO_CWD, "/otherdir/./file.ext", "O:\\other\\file.ext" },
- { NO_CWD, "/otherdir/foo/file.ext", "O:\\other\\foo\\file.ext" },
- { "O:\\other", "file.ext", "O:\\other\\file.ext" },
- { "O:\\other", "./file.ext", "O:\\other\\file.ext" },
- { "O:\\other", "foo/file.ext", "O:\\other\\foo\\file.ext" },
- { "O:\\other\\foo", "file.ext", "O:\\other\\foo\\file.ext" },
- { "O:\\other\\foo", "./file.ext", "O:\\other\\foo\\file.ext" },
- { "O:\\other\\foo", "bar/file.ext", "O:\\other\\foo\\bar\\file.ext" },
- { NO_CWD, "/somedir/file.ext", "S:\\some\\dir\\file.ext" },
- { NO_CWD, "/somedir/./file.ext", "S:\\some\\dir\\file.ext" },
- { NO_CWD, "/somedir/foo/file.ext", "S:\\some\\dir\\foo\\file.ext" },
- { "S:\\some\\dir", "file.ext", "S:\\some\\dir\\file.ext" },
- { "S:\\some\\dir", "./file.ext", "S:\\some\\dir\\file.ext" },
- { "S:\\some\\dir", "foo/file.ext", "S:\\some\\dir\\foo\\file.ext" },
- { "S:\\some\\dir\\foo", "file.ext", "S:\\some\\dir\\foo\\file.ext" },
- { "S:\\some\\dir\\foo", "./file.ext", "S:\\some\\dir\\foo\\file.ext" },
- { "S:\\some\\dir\\foo", "bar/file.ext", "S:\\some\\dir\\foo\\bar\\file.ext" },
- { NO_CWD, "//server/share/foo/bar", "\\\\server\\share\\foo\\bar" },
- { NO_CWD, NULL, NULL }
-};
-
-#else
-
-/* Redirect calls to GetCurrentDirectory() to the testsuite instead. */
-#ifdef GetCurrentDirectory
-#undef GetCurrentDirectory
-#endif
-#define GetCurrentDirectory testsuite_getcwd
-
-DWORD testsuite_getcwd (DWORD, LPSTR);
-
-#endif
-
-#endif /* TESTSUITE */
-
diff --git a/winsup/utils/umount.cc b/winsup/utils/umount.cc
deleted file mode 100644
index 5be116b71..000000000
--- a/winsup/utils/umount.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-/* umount.cc
-
- Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2008 Red Hat, Inc.
-
-This file is part of Cygwin.
-
-This software is a copyrighted work licensed under the terms of the
-Cygwin license. Please consult the file "CYGWIN_LICENSE" for
-details. */
-
-#include <stdio.h>
-#include <string.h>
-#include <sys/mount.h>
-#include <mntent.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <getopt.h>
-
-static void remove_all_user_mounts ();
-
-static const char version[] = "$Revision$";
-static const char *progname;
-
-struct option longopts[] =
-{
- {"help", no_argument, NULL, 'h' },
- {"remove-user-mounts", no_argument, NULL, 'U'},
- {"version", no_argument, NULL, 'v'},
- {NULL, 0, NULL, 0}
-};
-
-char opts[] = "hUv";
-
-static void
-usage (FILE *where = stderr)
-{
- fprintf (where, "\
-Usage: %s [OPTION] [<posixpath>]\n\
-Unmount filesystems\n\
-\n\
- -h, --help output usage information and exit\n\
- -U, --remove-user-mounts remove all user mounts\n\
- -v, --version output version information and exit\n\
-", progname);
- exit (where == stderr ? 1 : 0);
-}
-
-static void
-error (const char *path)
-{
- fprintf (stderr, "%s: %s: %s\n", progname, path, strerror (errno));
- exit (1);
-}
-
-static void
-print_version ()
-{
- const char *v = strchr (version, ':');
- int len;
- if (!v)
- {
- v = "?";
- len = 1;
- }
- else
- {
- v += 2;
- len = strchr (v, ' ') - v;
- }
- printf ("\
-%s (cygwin) %.*s\n\
-Filesystem Utility\n\
-Copyright 1996, 1998, 1999, 2000, 2001, 2002\n\
-Compiled on %s\n\
-", progname, len, v, __DATE__);
-}
-
-int
-main (int argc, char **argv)
-{
- int i;
- int flags = 0;
- int default_flag = MOUNT_SYSTEM;
- enum do_what
- {
- nada,
- saw_remove_all_user_mounts
- } do_what = nada;
-
- progname = strrchr (argv[0], '/');
- if (progname == NULL)
- progname = strrchr (argv[0], '\\');
- if (progname == NULL)
- progname = argv[0];
- else
- progname++;
-
- if (argc == 1)
- usage ();
-
- while ((i = getopt_long (argc, argv, opts, longopts, NULL)) != EOF)
- switch (i)
- {
- case 'h':
- usage (stdout);
- case 'U':
- if (do_what != nada)
- usage ();
- do_what = saw_remove_all_user_mounts;
- break;
- case 'v':
- print_version ();
- exit (0);
- default:
- usage ();
- }
-
- switch (do_what)
- {
- case saw_remove_all_user_mounts:
- if (optind != argc)
- usage ();
- remove_all_user_mounts ();
- break;
- default:
- if (optind != argc - 1)
- usage ();
- if (cygwin_umount (argv[optind], flags | default_flag) != 0)
- error (argv[optind]);
- }
-
- return 0;
-}
-
-/* remove_all_user_mounts: Unmount all user mounts. */
-static void
-remove_all_user_mounts ()
-{
- FILE *m = setmntent ("/-not-used-", "r");
- struct mntent *p;
-
- while ((p = getmntent (m)) != NULL)
- {
- /* Remove the mount if it's a user mount. */
- if (strncmp (p->mnt_type, "user", 4) == 0 &&
- strstr (p->mnt_opts, "noumount") == NULL)
- {
- if (cygwin_umount (p->mnt_dir, 0))
- error (p->mnt_dir);
-
- /* We've modified the table so we need to start over. */
- endmntent (m);
- m = setmntent ("/-not-used-", "r");
- }
- }
-
- endmntent (m);
-}
diff --git a/winsup/utils/utils.sgml b/winsup/utils/utils.sgml
deleted file mode 100644
index e71de7d64..000000000
--- a/winsup/utils/utils.sgml
+++ /dev/null
@@ -1,1673 +0,0 @@
-<sect1 id="using-utils"><title>Cygwin Utilities</title>
-
-<para>Cygwin comes with a number of command-line utilities that are
-used to manage the UNIX emulation portion of the Cygwin environment.
-While many of these reflect their UNIX counterparts, each was written
-specifically for Cygwin. You may use the long or short option names
-interchangeably; for example, <literal>--help</literal> and
-<literal>-h</literal> function identically. All of the Cygwin
-command-line utilities support the <literal>--help</literal> and
-<literal>--version</literal> options.
-</para>
-
-<sect2 id="cygcheck"><title>cygcheck</title>
-
-<screen>
-Usage: cygcheck PROGRAM [ -v ] [ -h ]
- cygcheck -c [ PACKAGE ... ] [ -d ]
- cygcheck -s [ -r ] [ -v ] [ -h ]
- cygcheck -k
- cygcheck -f FILE [ FILE ... ]
- cygcheck -l [ PACKAGE ... ]
- cygcheck -p REGEXP
-List system information, check installed packages, or query package database.
-
-At least one command option or a PROGRAM is required, as shown above.
-
- PROGRAM list library (DLL) dependencies of PROGRAM
- -c, --check-setup show installed version of PACKAGE and verify integrity
- (or for all installed packages if none specified)
- -d, --dump-only just list packages, do not verify (with -c)
- -s, --sysinfo produce diagnostic system information (implies -c -d)
- -r, --registry also scan registry for Cygwin settings (with -s)
- -k, --keycheck perform a keyboard check session (must be run from a
- plain console only, not from a pty/rxvt/xterm)
- -f, --find-package find the package that FILE belongs to
- -l, --list-package list contents of PACKAGE (or all packages if none given)
- -p, --package-query search for REGEXP in the entire cygwin.com package
- repository (requies internet connectivity)
- -v, --verbose produce more verbose output
- -h, --help annotate output with explanatory comments when given
- with another command, otherwise print this help
- -V, --version print the version of cygcheck and exit
-
-Note: -c, -f, and -l only report on packages that are currently installed. To
- search all official Cygwin packages use -p instead. The -p REGEXP matches
- package names, descriptions, and names of files/paths within all packages.
-</screen>
-
-<para>
-The <command>cygcheck</command> program is a diagnostic utility for
-dealing with Cygwin programs. If you are familiar with
-<command>dpkg</command> or <command>rpm</command>,
-<command>cygcheck</command> is similar in many ways. (The major difference
-is that <command>setup.exe</command> handles installing and uninstalling
-packages; see <xref linkend="internet-setup"></xref> for more information.)
-</para>
-<para>
-The <literal>-c</literal> option checks the version and status of
-installed Cygwin packages. If you specify one or more package names,
-<command>cygcheck</command> will limit its output to those packages,
-or with no arguments it lists all packages. A package will be marked
-<literal>Incomplete</literal> if files originally installed are no longer
-present. The best thing to do in that situation is reinstall the package
-with <command>setup.exe</command>. To see which files are missing, use the
-<literal>-v</literal> option. If you do not need to know the status
-of each package and want <command>cygcheck</command> to run faster, add the
-<literal>-d</literal> option and <command>cygcheck</command> will only
-output the name and version for each package.
-</para>
-<para>
-If you list one or more programs on the command line,
-<command>cygcheck</command> will diagnose the runtime environment of that
-program or programs, providing the names of DLL files on which the program
-depends. If you specify the <literal>-s</literal> option,
-<command>cygcheck</command> will give general system information. If you
-list one or more programs on the command line and specify
-<literal>-s</literal>, <command>cygcheck</command> will report on
-both.</para>
-<para>
-The <literal>-f</literal> option helps you to track down which package a
-file came from, and <literal>-l</literal> lists all files in a package.
-For example, to find out about <filename>/usr/bin/less</filename> and its
-package:
-<example id="utils-cygcheck-ex"><title>Example <command>cygcheck</command> usage</title>
-<screen>
-$ cygcheck -f /usr/bin/less
-less-381-1
-
-$ cygcheck -l less
-/usr/bin/less.exe
-/usr/bin/lessecho.exe
-/usr/bin/lesskey.exe
-/usr/man/man1/less.1
-/usr/man/man1/lesskey.1
-</screen>
-</example>
-</para>
-
-<para>The <literal>-h</literal> option prints additional helpful
-messages in the report, at the beginning of each section. It also
-adds table column headings. While this is useful information, it also
-adds some to the size of the report, so if you want a compact report
-or if you know what everything is already, just leave this out.</para>
-
-<para>The <literal>-v</literal> option causes the output to be more
-verbose. What this means is that additional information will be
-reported which is usually not interesting, such as the internal
-version numbers of DLLs, additional information about recursive DLL
-usage, and if a file in one directory in the PATH also occurs in other
-directories on the PATH. </para>
-
-<para>The <literal>-r</literal> option causes
-<command>cygcheck</command> to search your registry for information
-that is relevent to Cygwin programs. These registry entries are the
-ones that have "Cygwin" in the name. If you are paranoid about
-privacy, you may remove information from this report, but please keep
-in mind that doing so makes it harder to diagnose your problems.</para>
-
-<para>In contrast to the other options that search the packages that are
-installed on your local system, the <literal>-p</literal> option can be used
-to search the entire official Cygwin package repository. It takes as argument
-a Perl-compatible regular expression which is used to match package names,
-package descriptions, and path/filenames of the contents of packages. This
-feature requires an active internet connection, since it must query the
-<literal>cygwin.com</literal> web site. In fact, it is equalivant to the
-search that is available on the <ulink url="http://cygwin.com/packages/">Cygwin
-package listing</ulink> page.</para>
-
-<para>For example, perhaps you are getting an error because you are missing a
-certain DLL and you want to know which package includes that file:
-<example id="utils-search-ex"><title>Searching all packages for a file</title>
-<screen>
-$ cygcheck -p 'cygintl-2\.dll'
-Found 1 matches for 'cygintl-2\.dll'.
-
-libintl2-0.12.1-3 GNU Internationalization runtime library
-
-$ cygcheck -p 'libexpat.*\.a'
-Found 2 matches for 'libexpat.*\.a'.
-
-expat-1.95.7-1 XML parser library written in C
-expat-1.95.8-1 XML parser library written in C
-
-$ cygcheck -p '/ls\.exe'
-Found 2 matches for '/ls\.exe'.
-
-coreutils-5.2.1-5 GNU core utilities (includes fileutils, sh-utils and textutils)
-coreutils-5.3.0-6 GNU core utilities (includes fileutils, sh-utils and textutils)
-</screen>
-</example>
-</para>
-
-<para>Note that this option takes a regular expression, not a glob or wildcard.
-This means that you need to use <literal>.*</literal> if you want something
-similar to the wildcard <literal>*</literal> commonly used in filename globbing.
-Similarly, to match the period character you should use <literal>\.</literal>
-since the <literal>.</literal> character in a regexp is a metacharacter that
-will match any character. Also be aware that the characters such as
-<literal>\</literal> and <literal>*</literal> are shell metacharacters, so
-they must be either escaped or quoted, as in the example above.</para>
-
-<para>The third example above illustrates that if you want to match a whole
-filename, you should include the <literal>/</literal> path seperator. In the
-given example this ensures that filenames that happen to end in
-<literal>ls.exe</literal> such as <literal>ncftpls.exe</literal> are not shown.
-Note that this use does not mean "look for packages with <literal>ls</literal>
-in the root directory," since the <literal>/</literal> can match anywhere in the
-path. It's just there to anchor the match so that it matches a full
-filename.</para>
-
-<para>By default the matching is case-sensitive. To get a case insensitive
-match, begin your regexp with <literal>(?i)</literal> which is a PCRE-specific
-feature. For complete documentation on Perl-compatible regular expression
-syntax and options, read the <command>perlre</command> manpage, or one of many
-websites such as <literal>perldoc.com</literal> that document the Perl
-language.</para>
-
-<para>The <command>cygcheck</command> program should be used to send
-information about your system for troubleshooting when requested.
-When asked to run this command save the output so that you can email it,
-for example:</para>
-
-<screen>
-<prompt>C:\cygwin&gt;</prompt> <userinput>cygcheck -s -v -r -h &gt; cygcheck_output.txt</userinput>
-</screen>
-
-</sect2>
-
-<sect2 id="cygpath"><title>cygpath</title>
-
-<screen>
-Usage: cygpath (-d|-m|-u|-w|-t TYPE) [-f FILE] [OPTION]... NAME...
- cygpath [-c HANDLE]
- cygpath [-ADHOPSW]
- cygpath [-F ID]
-Convert Unix and Windows format paths, or output system path information
-
-Output type options:
- -d, --dos print DOS (short) form of NAMEs (C:\PROGRA~1\)
- -m, --mixed like --windows, but with regular slashes (C:/WINNT)
- -M, --mode report on mode of file (currently binmode or textmode)
- -u, --unix (default) print Unix form of NAMEs (/cygdrive/c/winnt)
- -w, --windows print Windows form of NAMEs (C:\WINNT)
- -t, --type TYPE print TYPE form: 'dos', 'mixed', 'unix', or 'windows'
-Path conversion options:
- -a, --absolute output absolute path
- -l, --long-name print Windows long form of NAMEs (with -w, -m only)
- -p, --path NAME is a PATH list (i.e., '/bin:/usr/bin')
- -s, --short-name print DOS (short) form of NAMEs (with -w, -m only)
-System information:
- -A, --allusers use `All Users' instead of current user for -D, -P
- -D, --desktop output `Desktop' directory and exit
- -H, --homeroot output `Profiles' directory (home root) and exit
- -O, --mydocs output `My Documents' directory and exit
- -P, --smprograms output Start Menu `Programs' directory and exit
- -S, --sysdir output system directory and exit
- -W, --windir output `Windows' directory and exit
- -F, --folder ID output special folder with numeric ID and exit
-Other options:
- -f, --file FILE read FILE for input; use - to read from STDIN
- -o, --option read options from FILE as well (for use with --file)
- -c, --close HANDLE close HANDLE (for use in captured process)
- -i, --ignore ignore missing argument
- -h, --help output usage information and exit
- -v, --version output version information and exit
-</screen>
-
-<para>The <command>cygpath</command> program is a utility that
-converts Windows native filenames to Cygwin POSIX-style pathnames and
-vice versa. It can be used when a Cygwin program needs to pass a file
-name to a native Windows program, or expects to get a file name from a
-native Windows program. Alternatively, <command>cygpath</command> can
-output information about the location of important system directories
-in either format.
-</para>
-
-<para>The <literal>-u</literal> and <literal>-w</literal> options
-indicate whether you want a conversion to UNIX (POSIX) format
-(<literal>-u</literal>) or to Windows format (<literal>-w</literal>).
-Use the <literal>-d</literal> to get DOS-style (8.3) file and path names.
-The <literal>-m</literal> option will output Windows-style format
-but with forward slashes instead of backslashes. This option is
-especially useful in shell scripts, which use backslashes as an escape
-character.</para>
-
-<para> In combination with the <literal>-w</literal> option, you can use
-the <literal>-l</literal> and <literal>-s</literal> options to use normal
-(long) or DOS-style (short) form. The <literal>-d</literal> option is
-identical to <literal>-w</literal> and <literal>-s</literal> together.
-</para>
-
-<para>The <literal>-p</literal> option means that you want to convert
-a path-style string rather than a single filename. For example, the
-PATH environment variable is semicolon-delimited in Windows, but
-colon-delimited in UNIX. By giving <literal>-p</literal> you are
-instructing <command>cygpath</command> to convert between these
-formats.</para>
-
-<para>The <literal>-i</literal> option supresses the print out of the
-usage message if no filename argument was given. It can be used in
-make file rules converting variables that may be omitted
-to a proper format. Note that <command>cygpath</command> output may
-contain spaces (C:\Program Files) so should be enclosed in quotes.
-</para>
-
-
-<example id="utils-cygpath-ex"><title>Example <command>cygpath</command> usage</title>
-<screen>
-<![CDATA[
-#!/bin/sh
-if [ "${1}" = "" ];
- then
- XPATH=".";
- else
- XPATH="$(cygpath -w "${1}")";
-fi
-explorer $XPATH &
-]]>
-</screen>
-</example>
-
-<para>The capital options
-<literal>-D</literal>, <literal>-H</literal>, <literal>-P</literal>,
-<literal>-S</literal>, and <literal>-W</literal> output directories used
-by Windows that are not the same on all systems, for example
-<literal>-S</literal> might output C:\WINNT\system32 or C:\Windows\System32.
-The <literal>-H</literal> shows the Windows profiles directory that can
-be used as root of home. The <literal>-A</literal> option forces use of
-the "All Users" directories instead of the current user for the
-<literal>-D</literal>, <literal>-O</literal> and <literal>-P</literal>
-options.
-The <literal>-F</literal> outputs other special folders specified by
-their internal numeric code (decimal or 0xhex). For valid codes and
-symbolic names, see the CSIDL_* definitions in the include file
-/usr/include/w32api/shlobj.h from package w32api. The current valid
-range of codes for folders is 0 (Desktop) to 59 (CDBurn area).
-By default the output is in UNIX (POSIX) format;
-use the <literal>-w</literal> or <literal>-d</literal> options to get
-other formats.</para>
-
-</sect2>
-
-<sect2 id="dumper"><title>dumper</title>
-
-<screen>
-Usage: dumper [OPTION] FILENAME WIN32PID
-Dump core from WIN32PID to FILENAME.core
-
--d, --verbose be verbose while dumping
--h, --help output help information and exit
--q, --quiet be quiet while dumping (default)
--v, --version output version information and exit
-</screen>
-
-<para>The <command>dumper</command> utility can be used to create a
-core dump of running Windows process. This core dump can be later loaded
-to <command>gdb</command> and analyzed. One common way to use
-<command>dumper</command> is to plug it into cygwin's Just-In-Time
-debugging facility by adding
-
-<screen>
-error_start=x:\path\to\dumper.exe
-</screen>
-
-to the <emphasis>CYGWIN</emphasis> environment variable. Please note that
-<literal>x:\path\to\dumper.exe</literal> is Windows-style and not cygwin
-path. If <literal>error_start</literal> is set this way, then dumper will
-be started whenever some program encounters a fatal error.
-</para>
-
-<para>
-<command>dumper</command> can be also be started from the command line to
-create a core dump of any running process. Unfortunately, because of a Windows
-API limitation, when a core dump is created and <command>dumper</command>
-exits, the target process is terminated too.
-</para>
-
-<para>
-To save space in the core dump, <command>dumper</command> doesn't write those
-portions of target process' memory space that are loaded from executable and
-dll files and are unchangeable, such as program code and debug info. Instead,
-<command>dumper</command> saves paths to files which contain that data. When a
-core dump is loaded into gdb, it uses these paths to load appropriate files.
-That means that if you create a core dump on one machine and try to debug it on
-another, you'll need to place identical copies of the executable and dlls in
-the same directories as on the machine where the core dump was created.
-</para>
-
-</sect2>
-
-<sect2 id="getfacl"><title>getfacl</title>
-
-<screen>
-Usage: getfacl [-adn] FILE [FILE2...]
-Display file and directory access control lists (ACLs).
-
- -a, --all display the filename, the owner, the group, and
- the ACL of the file
- -d, --dir display the filename, the owner, the group, and
- the default ACL of the directory, if it exists
- -h, --help output usage information and exit
- -n, --noname display user and group IDs instead of names
- -v, --version output version information and exit
-
-When multiple files are specified on the command line, a blank
-line separates the ACLs for each file.
-</screen>
-
-<para>
-For each argument that is a regular file, special file or
-directory, <command>getfacl</command> displays the owner, the group, and the
-ACL. For directories <command>getfacl</command> displays additionally the
-default ACL. With no options specified, <command>getfacl</command> displays
-the filename, the owner, the group, and both the ACL and the default ACL, if
-it exists. For more information on Cygwin and Windows ACLs, see
-see <xref linkend="ntsec"></xref> in the Cygwin User's Guide.
-The format for ACL output is as follows:
-<screen>
- # file: filename
- # owner: name or uid
- # group: name or uid
- user::perm
- user:name or uid:perm
- group::perm
- group:name or gid:perm
- mask:perm
- other:perm
- default:user::perm
- default:user:name or uid:perm
- default:group::perm
- default:group:name or gid:perm
- default:mask:perm
- default:other:perm
-</screen>
-</para>
-</sect2>
-
-<sect2 id="kill"><title>kill</title>
-
-<screen>
-Usage: kill [-f] [-signal] [-s signal] pid1 [pid2 ...]
- kill -l [signal]
-Send signals to processes
-
- -f, --force force, using win32 interface if necessary
- -l, --list print a list of signal names
- -s, --signal send signal (use kill --list for a list)
- -h, --help output usage information and exit
- -v, --version output version information and exit
-</screen>
-
-<para>The <command>kill</command> program allows you to send arbitrary
-signals to other Cygwin programs. The usual purpose is to end a
-running program from some other window when ^C won't work, but you can
-also send program-specified signals such as SIGUSR1 to trigger actions
-within the program, like enabling debugging or re-opening log files.
-Each program defines the signals they understand.</para>
-
-<para>You may need to specify the full path to use <command>kill</command>
-from within some shells, including <command>bash</command>, the default Cygwin
-shell. This is because <command>bash</command> defines a
-<command>kill</command> builtin function; see the <command>bash</command>
-man page under <emphasis>BUILTIN COMMANDS</emphasis> for more information.
-To make sure you are using the Cygwin version, try
-
-<screen>
-$ /bin/kill --version
-</screen>
-
-which should give the Cygwin <command>kill</command> version number and
-copyright information.
-</para>
-
-<para>Unless you specific the <literal>-f</literal> option, the "pid" values
-used by <command>kill</command> are the Cygwin pids, not the Windows pids.
-To get a list of running programs and their Cygwin pids, use the Cygwin
-<command>ps</command> program. <command>ps -W</command> will display
-<emphasis>all</emphasis> windows pids.</para>
-
-<para>The <command>kill -l</command> option prints the name of the
-given signal, or a list of all signal names if no signal is given.</para>
-
-<para>To send a specific signal, use the <literal>-signN</literal>
-option, either with a signal number or a signal name (minus the "SIG"
-part), like these examples:</para>
-
-<example id="utils-kill-ex"><title>Using the kill command</title>
-<screen>
-<prompt>$</prompt> <userinput>kill 123</userinput>
-<prompt>$</prompt> <userinput>kill -1 123</userinput>
-<prompt>$</prompt> <userinput>kill -HUP 123</userinput>
-<prompt>$</prompt> <userinput>kill -f 123</userinput>
-</screen>
-</example>
-
-<para>Here is a list of available signals, their numbers, and some
-commentary on them, from the file
-<literal>&lt;sys/signal.h&gt;</literal>, which should be considered
-the official source of this information.</para>
-
-<screen>
-SIGHUP 1 hangup
-SIGINT 2 interrupt
-SIGQUIT 3 quit
-SIGILL 4 illegal instruction (not reset when caught)
-SIGTRAP 5 trace trap (not reset when caught)
-SIGABRT 6 used by abort
-SIGEMT 7 EMT instruction
-SIGFPE 8 floating point exception
-SIGKILL 9 kill (cannot be caught or ignored)
-SIGBUS 10 bus error
-SIGSEGV 11 segmentation violation
-SIGSYS 12 bad argument to system call
-SIGPIPE 13 write on a pipe with no one to read it
-SIGALRM 14 alarm clock
-SIGTERM 15 software termination signal from kill
-SIGURG 16 urgent condition on IO channel
-SIGSTOP 17 sendable stop signal not from tty
-SIGTSTP 18 stop signal from tty
-SIGCONT 19 continue a stopped process
-SIGCHLD 20 to parent on child stop or exit
-SIGTTIN 21 to readers pgrp upon background tty read
-SIGTTOU 22 like TTIN for output if (tp-&gt;t_local&amp;LTOSTOP)
-SIGPOLL 23 System V name for SIGIO
-SIGXCPU 24 exceeded CPU time limit
-SIGXFSZ 25 exceeded file size limit
-SIGVTALRM 26 virtual time alarm
-SIGPROF 27 profiling time alarm
-SIGWINCH 28 window changed
-SIGLOST 29 resource lost (eg, record-lock lost)
-SIGUSR1 30 user defined signal 1
-SIGUSR2 31 user defined signal 2
-</screen>
-
-</sect2>
-
-<sect2 id="mkgroup"><title>mkgroup</title>
-
-<screen>
-Usage: mkgroup [OPTION]...
-Print /etc/group file to stdout
-
-Options:
- -l,--local [machine[,offset]]
- print local groups with gid offset offset
- (from local machine if no machine specified)
- -L,--Local [machine[,offset]]
- ditto, but generate groupname with machine prefix
- -d,--domain [domain[,offset]]
- print domain groups with gid offset offset
- (from current domain if no domain specified)
- -D,--Domain [domain[,offset]]
- ditto, but generate groupname with machine prefix
- -c,--current print current group
- -C,--Current ditto, but generate groupname with machine or
- domain prefix
- -S,--separator char for -L, -D, -C use character char as domain\group
- separator in groupname instead of the default '\'
- -o,--id-offset offset change the default offset (10000) added to gids
- in domain or foreign server accounts.
- -g,--group groupname only return information for the specified group
- one of -l, -L, -d, -D must be specified, too
- -b,--no-builtin don't print BUILTIN groups
- -U,--unix grouplist additionally print UNIX groups when using -l or -L
- on a UNIX Samba server
- grouplist is a comma-separated list of groupnames
- or gid ranges (root,-25,50-100).
- (enumerating large ranges can take a long time!)
- -s,--no-sids (ignored)
- -u,--users (ignored)
- -h,--help print this message
- -v,--version print version information and exit
-
-Default is to print local groups on stand-alone machines, plus domain
-groups on domain controllers and domain member machines.
-</screen>
-
-<para>The <command>mkgroup</command> program can be used to help
-configure Cygwin by creating a <filename>/etc/group</filename>
-file. Its use is essential to include Windows security information.</para>
-
-<para>The command is initially called by <command>setup.exe</command> to
-create a default <filename>/etc/group</filename>. This should be
-sufficient in most circumstances. However, especially when working
-in a multi-domain environment, you can use <command>mkgroup</command>
-manually to create a more complete <filename>/etc/group</filename> file for
-all domains. Especially when you have the same group name used on
-multiple machines or in multiple domains, you can use the <literal>-D</literal>,
-<literal>-L</literal> and <literal>-C</literal> options to create unique
-domain\group style groupnames.</para>
-
-<para>Note that this information is static. If you change the group
-information in your system, you'll need to regenerate the group file
-for it to have the new information.</para>
-
-<para>The <literal>-d/-D</literal> and <literal>-l/-L</literal> options
-allow you to specify where the information comes from, the
-local SAM of a machine or from the domain, or both.
-With the <literal>-d/-D</literal> options the program contacts a Domain
-Controller, which my be unreachable or have restricted access.
-Comma-separated from the machine or domain, you can specify an offset
-which is used as base added to the group's RID to compute the gid
-(offset + RID = gid). This allows to create the same gids every time you
-re-run <command>mkgroup</command>.
-For very simple needs, an entry for the current user's group can be
-created by using the option <literal>-c</literal> or <literal>-C</literal>.
-If you want to use one of the <literal>-D</literal>, <literal>-L</literal>
-or <literal>-C</literal> options, but you don't like the backslash as
-domain/group separator, you can specify another separator using the
-<literal>-S</literal> option, for instance</para>
-
-<example id="utils-mkgroup-ex"><title>Setting up group entry for current user with different domain/group separator</title>
-<screen>
-<prompt>$</prompt> <userinput>mkgroup -C -S+ &gt; /etc/group</userinput>
-<prompt>$</prompt> <userinput>cat /etc/group</userinput>
-DOMAIN+my_group:S-1-5-21-2913048732-1697188782-3448811101-1144:11144:
-</screen>
-</example>
-
-<para>The <literal>-o</literal> option allows for special cases
-(such as multiple domains) where the GIDs might match otherwise.
-The <literal>-g</literal> option only prints the information for one group.
-The <literal>-U</literal> option allows to enumerate the standard UNIX
-groups on a Samba machine. It's used together with
-<literal>-l samba-server</literal> or <literal>-L samba-server</literal>.
-The normal UNIX groups are usually not enumerated, but they can show
-up as group in <command>ls -l</command> output.
-</para>
-
-</sect2>
-
-<sect2 id="mkpasswd"><title>mkpasswd</title>
-
-<screen>
-Usage: mkpasswd [OPTIONS]...
-Print /etc/passwd file to stdout
-
-Options:
- -l,--local [machine[,offset]]
- print local user accounts with uid offset offset
- (from local machine if no machine specified)
- -L,--Local [machine[,offset]]
- ditto, but generate username with machine prefix
- -d,--domain [domain[,offset]]
- print domain accounts with uid offset offset
- (from current domain if no domain specified)
- -D,--Domain [domain[,offset]]
- ditto, but generate username with domain prefix
- -c,--current print current user
- -C,--Current ditto, but generate username with machine or
- domain prefix
- -S,--separator char for -L, -D, -C use character char as domain\user
- separator in username instead of the default '\'
- -o,--id-offset offset change the default offset (10000) added to uids
- in domain or foreign server accounts.
- -u,--username username only return information for the specified user
- one of -l, -L, -d, -D must be specified, too
- -p,--path-to-home path use specified path instead of user account home dir
- or /home prefix
- -m,--no-mount don't use mount points for home dir
- -U,--unix userlist additionally print UNIX users when using -l or -L\
- on a UNIX Samba server
- userlist is a comma-separated list of usernames
- or uid ranges (root,-25,50-100).
- (enumerating large ranges can take a long time!)
- -s,--no-sids (ignored)
- -g,--local-groups (ignored)
- -h,--help displays this message
- -v,--version version information and exit
-
-Default is to print local accounts on stand-alone machines, domain accounts
-on domain controllers and domain member machines.
-</screen>
-
-<para>The <command>mkpasswd</command> program can be used to help
-configure Cygwin by creating a <filename>/etc/passwd</filename> from
-your system information.
-Its use is essential to include Windows security information. However,
-the actual passwords are determined by Windows, not by the content of
-<filename>/etc/passwd</filename>.</para>
-
-<para>The command is initially called by <command>setup.exe</command> to
-create a default <filename>/etc/passwd</filename>. This should be
-sufficient in most circumstances. However, especially when working
-in a multi-domain environment, you can use <command>mkpasswd</command>
-manually to create a more complete <filename>/etc/passwd</filename> file for
-all domains. Especially when you have the same user name used on
-multiple machines or in multiple domains, you can use the <literal>-D</literal>,
-<literal>-L</literal> and <literal>-C</literal> options to create unique
-domain\user style usernames.</para>
-
-<para>Note that this information is static. If you change the user
-information in your system, you'll need to regenerate the passwd file
-for it to have the new information.</para>
-
-<para>The <literal>-d/-D</literal> and <literal>-l/-L</literal> options
-allow you to specify where the information comes from, the
-local machine or the domain (default or given), or both.
-With the <literal>-d/-D</literal> options the program contacts the Domain
-Controller, which may be unreachable or have restricted access.
-Comma-separated from the machine or domain, you can specify an offset
-which is used as base added to the user's RID to compute the uid
-(offset + RID = uid). This allows to create the same uids every time you
-re-run <command>mkpasswd</command>.
-An entry for the current user can be created by using the
-option <literal>-c</literal> or <literal>-C</literal>.
-If you want to use one of the <literal>-D</literal>, <literal>-L</literal>
-or <literal>-C</literal> options, but you don't like the backslash as
-domain/group separator, you can specify another separator using the
-<literal>-S</literal> option, simialar to the <command>mkgroup</command>.
-The <literal>-o</literal> option allows for special cases
-(such as multiple domains) where the UIDs might match otherwise.
-The <literal>-m</literal> option bypasses the current
-mount table so that, for example, two users who have a Windows home
-directory of H: could mount them differently. For more information on
-SIDs, see <xref linkend="ntsec"></xref> in the Cygwin User's Guide. The
-<literal>-p</literal> option causes <command>mkpasswd</command> to
-use the specified prefix instead of the account home dir or <literal>/home/
-</literal>. For example, this command:
-
-<example id="utils-althome-ex"><title>Using an alternate home root</title>
-<screen>
-<prompt>$</prompt> <userinput>mkpasswd -l -p "$(cygpath -H)" &gt; /etc/passwd</userinput>
-</screen>
-</example>
-
-would put local users' home directories in the Windows 'Profiles' directory.
-The <literal>-u</literal> option creates just an entry for
-the specified user.
-The <literal>-U</literal> option allows to enumerate the standard UNIX
-users on a Samba machine. It's used together with
-<literal>-l samba-server</literal> or <literal>-L samba-server</literal>.
-The normal UNIX users are usually not enumerated, but they can show
-up as file owners in <command>ls -l</command> output.
-</para>
-
-</sect2>
-
-<sect2 id="mount"><title>mount</title>
-
-<screen>
-Usage: mount [OPTION] [&lt;win32path&gt; &lt;posixpath&gt;]
-Display information about mounted filesystems, or mount a filesystem
-
- -c, --change-cygdrive-prefix change the cygdrive path prefix to &lt;posixpath&gt;
- -f, --force force mount, don't warn about missing mount
- point directories
- -h, --help output usage information and exit
- -m, --mount-entries write fstab entries to replicate mount points
- and cygdrive prefixes
- -o, --options X[,X...] specify mount options
- -p, --show-cygdrive-prefix show user and/or system cygdrive path prefix
- -v, --version output version information and exit
-</screen>
-
-<para>The <command>mount</command> program is used to map your drives
-and shares onto Cygwin's simulated POSIX directory tree, much like as is
-done by mount commands on typical UNIX systems. However, in contrast to
-mount points given in <filename>/etc/fstab</filename>, mount points
-created or changed with <command>mount</command> are not persistent. They
-disappear immediately after the last process of the current user exited.
-Please see <xref linkend="mount-table"></xref> for more information on the
-concepts behind the Cygwin POSIX file system and strategies for using
-mounts. To remove mounts temporarily, use <command>umount</command></para>
-
-<sect3 id="utils-mount"><title>Using mount</title>
-
-<para>If you just type <command>mount</command> with no parameters, it
-will display the current mount table for you.</para>
-
-<example id="utils-mount-ex">
-<title>Displaying the current set of mount points</title>
-<screen>
-<prompt>c:\cygwin\&gt;</prompt> <userinput>mount</userinput>
-c:\cygwin\bin on /usr/bin type ntfs (binary)
-c:\cygwin\lib on /usr/lib type ntfs (binary)
-c:\cygwin on / type ntfs (binary)
-c: on /c type ntfs (binary,user,noumount)
-d: on /d type fat (binary,user,noumount)
-</screen>
-</example>
-
-<para>In this example, c:\cygwin is the POSIX root and D drive is mapped to
-<filename>/d</filename>. Note that in this case, the root mount is a
-system-wide mount point that is visible to all users running Cygwin
-programs, whereas the <filename>/d</filename> mount is only visible
-to the current user.</para>
-
-<para>The <command>mount</command> utility is also the mechanism for
-adding new mounts to the mount table. The following example
-demonstrates how to mount the directory
-<filename>//pollux/home/joe/data</filename> to <filename>/data</filename>
-for the duration of the current session.
-</para>
-
-<example id="utils-mount-add-ex">
-<title>Adding mount points</title>
-<screen>
-<prompt>c:\cygwin\&gt;</prompt> <userinput>ls /data</userinput>
-ls: /data: No such file or directory
-<prompt>c:\cygwin\&gt;</prompt> <userinput>mount //pollux/home/joe/data /data</userinput>
-mount: warning - /data does not exist!
-<prompt>c:\cygwin\&gt;</prompt> <userinput>mount</userinput>
-//pollux/home/joe/data on /data type smbfs (binary)
-c:/cygwin/bin on /usr/bin type ntfs (binary)
-c:/cygwin/lib on /usr/lib type ntfs (binary)
-c:/cygwin on / type ntfs (binary)
-c: on /c type ntfs (binary,user,noumount)
-d: on /d type fat (binary,user,noumount)
-</screen>
-</example>
-
-<para>A given POSIX path may only exist once in the mount table. Attempts to
-replace the mount will fail with a busy error. The <literal>-f</literal>
-(force) option causes the old mount to be silently replaced with the new one,
-provided the old mount point was a user mount point. It's not valid to
-replace system-wide mount points. Additionally, the <literal>-f</literal>
-option will silence warnings about the non-existence of directories at the
-Win32 path location.</para>
-
-<para>
-The <literal>-o</literal> option is the method via which various options about
-the mount point may be recorded. The following options are available (note that
-most of the options are duplicates of other mount flags):</para>
-
-<screen>
- acl - Use the filesystem's access control lists (ACLs) to
- implement real POSIX permissions (default).
- noacl - Ignore ACLs and fake POSIX permissions.
- binary - Files default to binary mode (default).
- text - Files default to CRLF text mode line endings.
- exec - Treat all files below mount point as executable.
- notexec - Treat all files below mount point as not executable.
- cygexec - Treat all files below mount point as cygwin executables.
- nosuid - No suid files are allowed (currently unimplemented)
- posix=0 - Switch off case sensitivity for paths under this mount point.
- posix=1 - Switch on case sensitivity for paths under this mount point
- (default).
-</screen>
-
-<para>For a more complete description of the mount options and the
-<filename>/etc/fstab</filename> file, see
-<xref linkend="mount-table"></xref>.</para>
-
-<para>Note that all mount points added with <command>mount</command> are
-user mount points. System mount points can only be specified in
-the <filename>/etc/fstab</filename> file.</para>
-
-<para>
-The <literal>-m</literal> option causes the <command>mount</command> utility
-to output the current mount table in a series of fstab entries. This allows
-You can save this output as a backup when experimenting with the mount table.
-Copy the output to <filename>/etc/fstab</filename> to restore the old state.
-It also makes moving your settings to a different machine much easier.</para>
-
-</sect3>
-
-<sect3 id="utils-cygdrive"><title>Cygdrive mount points</title>
-
-<para>Whenever Cygwin cannot use any of the existing mounts to convert
-from a particular Win32 path to a POSIX one, Cygwin will, instead,
-convert to a POSIX path using a default mount point:
-<filename>/cygdrive</filename>. For example, if Cygwin accesses
-<filename>z:\foo</filename> and the z drive is not currently in the
-mount table, then <filename>z:\</filename> will be accessible as
-<filename>/cygdrive/z</filename>. The <command>mount</command> utility
-can be used to change this default automount prefix through the use of the
-"--change-cygdrive-prefix" option. In the following example, we will
-set the automount prefix to <filename>/</filename>:</para>
-
-<example id="utils-cygdrive-ex">
-<title>Changing the default prefix</title>
-<screen>
-<prompt>c:\cygwin\&gt;</prompt> <userinput>mount --change-cygdrive-prefix /</userinput>
-</screen>
-</example>
-
-<para>Note that the cygdrive prefix can be set both per-user and system-wide,
-and that as with all mounts, a user-specific mount takes precedence over the
-system-wide setting. The <command>mount</command> utility creates system-wide
-mounts by default if you do not specify a type. Use the <literal>-s</literal>
-or <literal>-u</literal> flag to indicate a system or user mount, respectively.
-You can always see the user and system cygdrive prefixes with the
-<literal>-p</literal> option. Using the <literal>-b</literal>
-flag with <literal>--change-cygdrive-prefix</literal> makes all new
-automounted filesystems default to binary mode file accesses.</para>
-
-</sect3>
-
-<sect3 id="utils-limitations"><title>Limitations</title>
-
-<para>Limitations: there is a hard-coded limit of 30 mount
-points. Also, although you can mount to pathnames that do not start
-with "/", there is no way to make use of such mount points.</para>
-
-<para>Normally the POSIX mount point in Cygwin is an existing empty
-directory, as in standard UNIX. If this is the case, or if there is a
-place-holder for the mount point (such as a file, a symbolic link
-pointing anywhere, or a non-empty directory), you will get the expected
-behavior. Files present in a mount point directory before the mount
-become invisible to Cygwin programs.
-</para>
-
-<para>It is sometimes desirable to mount to a non-existent directory,
-for example to avoid cluttering the root directory with names
-such as
-<filename>a</filename>, <filename>b</filename>, <filename>c</filename>
-pointing to disks.
-Although <command>mount</command> will give you a warning, most
-everything will work properly when you refer to the mount point
-explicitly. Some strange effects can occur however.
-For example if your current working directory is
-<filename>/dir</filename>,
-say, and <filename>/dir/mtpt</filename> is a mount point, then
-<filename>mtpt</filename> will not show up in an <command>ls</command>
-or
-<command>echo *</command> command and <command>find .</command> will
-not
-find <filename>mtpt</filename>.
-</para>
-
-</sect3>
-
-</sect2>
-
-<sect2 id="passwd"><title>passwd</title>
-
-<screen>
-Usage: passwd [OPTION] [USER]
-Change USER's password or password attributes.
-
-User operations:
- -l, --lock lock USER's account.
- -u, --unlock unlock USER's account.
- -c, --cannot-change USER can't change password.
- -C, --can-change USER can change password.
- -e, --never-expires USER's password never expires.
- -E, --expires USER's password expires according to system's
- password aging rule.
- -p, --pwd-not-required no password required for USER.
- -P, --pwd-required password is required for USER.
- -R, --reg-store-pwd enter password to store it in the registry for
- later usage by services to be able to switch
- to this user context with network credentials.
-
-System operations:
- -i, --inactive NUM set NUM of days before inactive accounts are disabled
- (inactive accounts are those with expired passwords).
- -n, --minage DAYS set system minimum password age to DAYS days.
- -x, --maxage DAYS set system maximum password age to DAYS days.
- -L, --length LEN set system minimum password length to LEN.
-
-Other options:
- -S, --status display password status for USER (locked, expired,
- etc.) plus global system password settings.
- -h, --help output usage information and exit.
- -v, --version output version information and exit.
-
-If no option is given, change USER's password. If no user name is given,
-operate on current user. System operations must not be mixed with user
-operations. Don't specify a USER when triggering a system operation.
-
-Don't specify a user or any other option together with the -R option.
-Non-Admin users can only store their password if cygserver is running and
-the CYGWIN environment variable is set to contain the word 'server'.
-Note that storing even obfuscated passwords in the registry is not overly
-secure. Use this feature only if the machine is adequately locked down.
-Don't use this feature if you don't need network access within a remote
-session. You can delete your stored password by using `passwd -R' and
-specifying an empty password.
-</screen>
-
-<para> <command>passwd</command> changes passwords for user accounts.
-A normal user may only change the password for their own account,
-but administrators may change passwords on any account.
-<command>passwd</command> also changes account information, such as
-password expiry dates and intervals.</para>
-
-<para>For password changes, the user is first prompted for their old
-password, if one is present. This password is then encrypted and
-compared against the stored password. The user has only one chance to
-enter the correct password. The administrators are permitted to
-bypass this step so that forgotten passwords may be changed.</para>
-
-<para>The user is then prompted for a replacement password.
-<command>passwd</command> will prompt twice for this replacement and
-compare the second entry against the first. Both entries are required to
-match in order for the password to be changed.</para>
-
-<para>After the password has been entered, password aging information
-is checked to see if the user is permitted to change their password
-at this time. If not, <command>passwd</command> refuses to change the
-password and exits.</para>
-
-<para>
-To get current password status information, use the
-<literal>-S</literal> option. Administrators can use
-<command>passwd</command> to perform several account maintenance
-functions (users may perform some of these functions on their own
-accounts). Accounts may be locked with the <literal>-l</literal> flag
-and unlocked with the <literal>-u</literal> flag. Similarly,
-<literal>-c</literal> disables a user's ability to change passwords, and
-<literal>-C</literal> allows a user to change passwords. For password
-expiry, the <literal>-e</literal> option disables expiration, while the
-<literal>-E</literal> option causes the password to expire according to
-the system's normal aging rules. Use <literal>-p</literal> to disable
-the password requirement for a user, or <literal>-P</literal> to require
-a password.
-</para>
-
-<para>Administrators can also use <command>passwd</command> to change
-system-wide password expiry and length requirements with the
-<literal>-i</literal>, <literal>-n</literal>, <literal>-x</literal>,
-and <literal>-L</literal> options. The <literal>-i</literal>
-option is used to disable an account after the password has been expired
-for a number of days. After a user account has had an expired password
-for <emphasis>NUM</emphasis> days, the user may no longer sign on to
-the account. The <literal>-n</literal> option is
-used to set the minimum number of days before a password may be changed.
-The user will not be permitted to change the password until
-<emphasis>MINDAYS</emphasis> days have elapsed. The
-<literal>-x</literal> option is used to set the maximum number of days
-a password remains valid. After <emphasis>MAXDAYS</emphasis> days, the
-password is required to be changed. Allowed values for the above options
-are 0 to 999. The <literal>-L</literal> option sets the minimum length of
-allowed passwords for users who don't belong to the administrators group
-to <emphasis>LEN</emphasis> characters. Allowed values for the minimum
-password length are 0 to 14. In any of the above cases, a value of 0
-means `no restrictions'.</para>
-
-<para>Users can use the <command>passwd -R</command> to enter
-a password which then gets stored in a special area of the registry,
-which is also used by Windows to store passwords of accounts running
-Windows services. When a privileged Cygwin application calls the
-<command>set{e}uid(user_id)</command> system call, Cygwin checks if a
-password for that user has been stored in this registry area. If so, it
-uses this password to switch to this user account using that password.
-This allows to logon through, for instance, <command>ssh</command> with
-public key authentication and to get a full qualified user token with
-all credentials for network access. However, the method has some
-drawbacks security-wise. This is explained in more detail in the
-<xref linkend="ntsec"></xref> section.</para>
-
-<para>Please note that storing password in that registry area is a
-privileged operation which only administrative accounts are allowed to
-do. If normal, non-admin users should be allowed to enter their
-passwords using <command>passwd -R</command>, it's required to run
-<command>cygserver</command> as a service under the LocalSystem account
-and the environment variable CYGWIN
-(see <xref linkend="using-cygwinenv"></xref>)
-must be set to contain the "server" setting before running
-<command>passwd -R</command>. This only affects storing passwords.
-Using passwords in privileged processes does not require
-<command>cygserver</command> to run.</para>
-
-<para>Limitations: Users may not be able to change their password on
-some systems.</para>
-
-</sect2>
-
-<sect2 id="ps"><title>ps</title>
-
-<screen>
-Usage: ps [-aefls] [-u UID]
-Report process status
-
- -a, --all show processes of all users
- -e, --everyone show processes of all users
- -f, --full show process uids, ppids
- -h, --help output usage information and exit
- -l, --long show process uids, ppids, pgids, winpids
- -p, --process show information for specified PID
- -s, --summary show process summary
- -u, --user list processes owned by UID
- -v, --version output version information and exit
- -W, --windows show windows as well as cygwin processes
-With no options, ps outputs the long format by default
-</screen>
-
-<para>The <command>ps</command> program gives the status of all the
-Cygwin processes running on the system (ps = "process status"). Due
-to the limitations of simulating a POSIX environment under Windows,
-there is little information to give.
-</para>
-
-<para>
-The PID column is the process ID you need to give to the
-<command>kill</command> command. The PPID is the parent process ID,
-and PGID is the process group ID. The WINPID column is the process
-ID displayed by NT's Task Manager program. The TTY column gives which
-pseudo-terminal a process is running on, or a <literal>'?'</literal>
-for services. The UID column shows which user owns each process.
-STIME is the time the process was started, and COMMAND gives the name
-of the program running. Listings may also have a status flag in
-column zero; <literal>S</literal> means stopped or suspended (in other
-words, in the background), <literal>I</literal> means waiting for
-input or interactive (foreground), and <literal>O</literal> means
-waiting to output.
-</para>
-
-<para>
-By default <command>ps</command> will only show processes owned by the
-current user. With either the <literal>-a</literal> or <literal>-e</literal>
-option, all user's processes (and system processes) are listed. There are
-historical UNIX reasons for the synonomous options, which are functionally
-identical. The <literal>-f</literal> option outputs a "full" listing with
-usernames for UIDs. The <literal>-l</literal> option is the default display
-mode, showing a "long" listing with all the above columns. The other display
-option is <literal>-s</literal>, which outputs a shorter listing of just
-PID, TTY, STIME, and COMMAND. The <literal>-u</literal> option allows you
-to show only processes owned by a specific user. The <literal>-p</literal>
-option allows you to show information for only the process with the
-specified PID. The <literal>-W</literal>
-option causes <command>ps</command> show non-Cygwin Windows processes as
-well as Cygwin processes. The WINPID is also the PID, and they can be killed
-with the Cygwin <command>kill</command> command's <literal>-f</literal>
-option.
-</para>
-
-</sect2>
-
-<sect2 id="regtool"><title>regtool</title>
-
-<screen>
-Usage: regtool [OPTION] (add|check|get|list|remove|unset|load|unload|save) KEY
-View or edit the Win32 registry
-
-Actions:
- add KEY\SUBKEY add new SUBKEY
- check KEY exit 0 if KEY exists, 1 if not
- get KEY\VALUE prints VALUE to stdout
- list KEY list SUBKEYs and VALUEs
- remove KEY remove KEY
- set KEY\VALUE [data ...] set VALUE
- unset KEY\VALUE removes VALUE from KEY
- load KEY\SUBKEY PATH load hive from PATH into new SUBKEY
- unload KEY\SUBKEY unload hive and remove SUBKEY
- save KEY\SUBKEY PATH save SUBKEY into new hive PATH
-
-Options for 'list' Action:
- -k, --keys print only KEYs
- -l, --list print only VALUEs
- -p, --postfix like ls -p, appends '\' postfix to KEY names
-
-Options for 'get' Action:
- -b, --binary print REG_BINARY data as hex bytes
-
-Options for 'set' Action:
- -b, --binary set type to REG_BINARY (hex args or '-')
- -e, --expand-string set type to REG_EXPAND_SZ
- -i, --integer set type to REG_DWORD
- -m, --multi-string set type to REG_MULTI_SZ
- -s, --string set type to REG_SZ
-
-Options for 'set' and 'unset' Actions:
- -K&lt;c&gt;, --key-separator[=]&lt;c&gt; set key separator to &lt;c&gt; instead of '\'
-
-Other Options:
- -h, --help output usage information and exit
- -q, --quiet no error output, just nonzero return if KEY/VALUE missing
- -v, --verbose verbose output, including VALUE contents when applicable
- -w, --wow64 access 64 bit registry view (ignored on 32 bit Windows)
- -W, --wow32 access 32 bit registry view (ignored on 32 bit Windows)
- -V, --version output version information and exit
-
-KEY is in the format [host]\prefix\KEY\KEY\VALUE, where host is optional
-remote host in either \\hostname or hostname: format and prefix is any of:
- root HKCR HKEY_CLASSES_ROOT (local only)
- config HKCC HKEY_CURRENT_CONFIG (local only)
- user HKCU HKEY_CURRENT_USER (local only)
- machine HKLM HKEY_LOCAL_MACHINE
- users HKU HKEY_USERS
-
-You can use forward slash ('/') as a separator instead of backslash, in
-that case backslash is treated as escape character
-Example: regtool.exe get '\user\software\Microsoft\Clock\iFormat'
-</screen>
-
-<para>The <command>regtool</command> program allows shell scripts
-to access and modify the Windows registry. Note that modifying the
-Windows registry is dangerous, and carelessness here can result
-in an unusable system. Be careful.</para>
-
-<para>The <literal>-v</literal> option means "verbose". For most
-commands, this causes additional or lengthier messages to be printed.
-Conversely, the <literal>-q</literal> option supresses error messages,
-so you can use the exit status of the program to detect if a key
-exists or not (for example).</para>
-
-<para>The <literal>-w</literal> option allows to access the 64 bit view
-on the registry. Several subkeys exist in a 32 bit and a 64 bit version
-when running on Windows 64. Since Cygwin is running in 32 bit mode, it
-has only access to the 32 bit view of these registry keys. When using
-the <literal>-w</literal> the 64 bit view is used and
-<command>regtool</command> can access the entire registry.
-This option is simply ignored when running on 32 bit Windows versions.
-</para>
-
-<para>The <literal>-W</literal> option allows to access the 32 bit view
-on the registry. The purpose of this option is mainly symmetry. It
-allows to create OS agnostic scripts which would also work in a hypothetic
-64 bit version of Cygwin.</para>
-
-<para>You must provide <command>regtool</command> with an
-<emphasis>action</emphasis> following options (if any). Currently,
-the action must be <literal>add</literal>, <literal>set</literal>,
-<literal>check</literal>, <literal>get</literal>, <literal>list</literal>,
-<literal>remove</literal>, <literal>set</literal>, or <literal>unset</literal>.
-</para>
-
-<para>The <literal>add</literal> action adds a new key. The
-<literal>check</literal> action checks to see if a key exists (the
-exit code of the program is zero if it does, nonzero if it does not).
-The <literal>get</literal> action gets the value of a value of a key,
-and prints it (and nothing else) to stdout. Note: if the value
-doesn't exist, an error message is printed and the program returns a
-non-zero exit code. If you give <literal>-q</literal>, it doesn't
-print the message but does return the non-zero exit code.</para>
-
-<para>
-The <literal>list</literal> action lists the subkeys and values
-belonging to the given key. With <literal>list</literal>, the
-<literal>-k</literal> option instructs <command>regtool</command>
-to print only KEYs, and the <literal>-l</literal> option to print
-only VALUEs. The <literal>-p</literal> option postfixes a
-<literal>'/'</literal> to each KEY, but leave VALUEs with no
-postfix. The <literal>remove</literal> action
-removes a key. Note that you may need to remove everything in the key
-before you may remove it, but don't rely on this stopping you from
-accidentally removing too much.
-</para>
-
-<para>The <literal>set</literal> action sets a value within a key.
-<literal>-b</literal> means it's binary data (REG_BINARY).
-The binary values are specified as hex bytes in the argument list.
-If the argument is <literal>'-'</literal>, binary data is read
-from stdin instead.
-<literal>-e</literal> means it's an expanding string (REG_EXPAND_SZ)
-that contains embedded environment variables.
-<literal>-i</literal> means the value is an integer (REG_DWORD).
-<literal>-m</literal> means it's a multi-string (REG_MULTI_SZ).
-<literal>-s</literal> means the value is a string (REG_SZ).
-If you don't specify one of these, <command>regtool</command> tries to
-guess the type based on the value you give. If it looks like a
-number, it's a DWORD. If it starts with a percent, it's an expanding
-string. If you give multiple values, it's a multi-string. Else, it's
-a regular string.
-The <literal>unset</literal> action removes a value from a key.
-</para>
-
-<para>The <literal>load</literal> action adds a new subkey and loads
-the contents of a registry hive into it.
-The parent key must be HKEY_LOCAL_MACHINE or HKEY_USERS.
-The <literal>unload</literal> action unloads the file and removes
-the subkey.
-</para>
-
-<para>The <literal>save</literal> action saves a subkey into a
-registry hive.
-</para>
-
-<para>
-By default, the last "\" or "/" is assumed to be the separator between the
-key and the value. You can use the <literal>-K</literal> option to provide
-an alternate key/value separator character.
-</para>
-
-</sect2>
-
-<sect2 id="setfacl"><title>setfacl</title>
-
-<screen>
-Usage: setfacl [-r] (-f ACL_FILE | -s acl_entries) FILE...
- setfacl [-r] ([-d acl_entries] [-m acl_entries]) FILE...
-Modify file and directory access control lists (ACLs)
-
- -d, --delete delete one or more specified ACL entries
- -f, --file set ACL entries for FILE to ACL entries read
- from a ACL_FILE
- -m, --modify modify one or more specified ACL entries
- -r, --replace replace mask entry with maximum permissions
- needed for the file group class
- -s, --substitute substitute specified ACL entries for the
- ACL of FILE
- -h, --help output usage information and exit
- -v, --version output version information and exit
-
-At least one of (-d, -f, -m, -s) must be specified
-</screen>
-
-<para>
-For each file given as parameter, <command>setfacl</command> will
-either replace its complete ACL (<literal>-s</literal>, <literal>-f</literal>),
-or it will add, modify, or delete ACL entries.
-For more information on Cygwin and Windows ACLs, see
-see <xref linkend="ntsec"></xref> in the Cygwin User's Guide.
-</para>
-
-<para>
-Acl_entries are one or more comma-separated ACL entries
-from the following list:
-<screen>
- u[ser]::perm
- u[ser]:uid:perm
- g[roup]::perm
- g[roup]:gid:perm
- m[ask]::perm
- o[ther]::perm
-</screen>
-Default entries are like the above with the additional
-default identifier. For example:
-<screen>
- d[efault]:u[ser]:uid:perm
-</screen>
-</para>
-
-<para>
-<emphasis>perm</emphasis> is either a 3-char permissions string in the form
-"rwx" with the character <literal>'-'</literal> for no permission
-or it is the octal representation of the permissions, a
-value from 0 (equivalent to "---") to 7 ("rwx").
-<emphasis>uid</emphasis> is a user name or a numerical uid.
-<emphasis>gid</emphasis> is a group name or a numerical gid.
-</para>
-
-<para>
-The following options are supported:
-</para>
-
-<para>
-<literal>-d</literal>
-Delete one or more specified entries from the file's ACL.
-The owner, group and others entries must not be deleted.
-Acl_entries to be deleted should be specified without
-permissions, as in the following list:
-<screen>
- u[ser]:uid
- g[roup]:gid
- d[efault]:u[ser]:uid
- d[efault]:g[roup]:gid
- d[efault]:m[ask]:
- d[efault]:o[ther]:
-</screen>
-</para>
-
-<para>
-<literal>-f</literal>
-Take the Acl_entries from ACL_FILE one per line. Whitespace
-characters are ignored, and the character "#" may be used
-to start a comment. The special filename "-" indicates
-reading from stdin. Note that you can use this with
-<command>getfacl</command> and <command>setfacl</command> to copy
-ACLs from one file to another:
-<screen>
-$ getfacl source_file | setfacl -f - target_file
-</screen>
-</para>
-
-<para>
-Required entries are:
-one user entry for the owner of the file,
-one group entry for the group of the file, and
-one other entry.
-</para>
-
-<para>
-If additional user and group entries are given:
-a mask entry for the file group class of the file, and
-no duplicate user or group entries with the same uid/gid.
-</para>
-
-<para>
-If it is a directory:
-one default user entry for the owner of the file,
-one default group entry for the group of the file,
-one default mask entry for the file group class, and
-one default other entry.
-</para>
-
-<para>
-<literal>-m</literal>
-Add or modify one or more specified ACL entries. Acl_entries is a
-comma-separated list of entries from the same list as above.
-</para>
-
-<para>
-<literal>-r</literal>
-Causes the permissions specified in the mask
-entry to be ignored and replaced by the maximum permissions needed for
-the file group class.
-</para>
-
-<para>
-<literal>-s</literal>
-Like <literal>-f</literal>, but substitute the
-file's ACL with Acl_entries specified in a comma-separated list on the
-command line.
-</para>
-
-<para>
-While the <literal>-d</literal> and <literal>-m</literal> options may be used
-in the same command, the <literal>-f</literal> and <literal>-s</literal>
-options may be used only exclusively.
-</para>
-
-<para>
-Directories may contain default ACL entries. Files created
-in a directory that contains default ACL entries will have
-permissions according to the combination of the current umask,
-the explicit permissions requested and the default ACL entries
-</para>
-
-<para>
-Limitations: Under Cygwin, the default ACL entries are not taken into
-account currently.
-</para>
-
-</sect2>
-
-<sect2 id="ssp"><title>ssp</title>
-
-<screen>
-Usage: ssp [options] low_pc high_pc command...
-Single-step profile COMMAND
-
- -c, --console-trace trace every EIP value to the console. *Lots* slower.
- -d, --disable disable single-stepping by default; use
- OutputDebugString ("ssp on") to enable stepping
- -e, --enable enable single-stepping by default; use
- OutputDebugString ("ssp off") to disable stepping
- -h, --help output usage information and exit
- -l, --dll enable dll profiling. A chart of relative DLL usage
- is produced after the run.
- -s, --sub-threads trace sub-threads too. Dangerous if you have
- race conditions.
- -t, --trace-eip trace every EIP value to a file TRACE.SSP. This
- gets big *fast*.
- -v, --verbose output verbose messages about debug events.
- -V, --version output version information and exit
-
-Example: ssp 0x401000 0x403000 hello.exe
-</screen>
-
-<para>
-SSP - The Single Step Profiler
-</para>
-
-<para>
-Original Author: DJ Delorie
-</para>
-
-<para>
-The SSP is a program that uses the Win32 debug API to run a program
-one ASM instruction at a time. It records the location of each
-instruction used, how many times that instruction is used, and all
-function calls. The results are saved in a format that is usable by
-the profiling program <command>gprof</command>, although
-<command>gprof</command> will claim the values
-are seconds, they really are instruction counts. More on that later.
-</para>
-
-<para>
-Because the SSP was originally designed to profile the cygwin DLL, it
-does not automatically select a block of code to report statistics on.
-You must specify the range of memory addresses to keep track of
-manually, but it's not hard to figure out what to specify. Use the
-"objdump" program to determine the bounds of the target's ".text"
-section. Let's say we're profiling cygwin1.dll. Make sure you've
-built it with debug symbols (else <command>gprof</command> won't run)
-and run objdump like this:
-
-<screen>
-$ objdump -h cygwin1.dll
-</screen>
-
-It will print a report like this:
-<screen>
-cygwin1.dll: file format pei-i386
-
-Sections:
-Idx Name Size VMA LMA File off Algn
- 0 .text 0007ea00 61001000 61001000 00000400 2**2
- CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA
- 1 .data 00008000 61080000 61080000 0007ee00 2**2
- CONTENTS, ALLOC, LOAD, DATA
- . . .
-</screen>
-</para>
-
-<para>
-The only information we're concerned with are the VMA of
-the .text section and the VMA of the section after it
-(sections are usually contiguous; you can also add the
-Size to the VMA to get the end address). In this case,
-the VMA is 0x61001000 and the ending address is either
-0x61080000 (start of .data method) or 0x0x6107fa00 (VMA+Size
-method).
-</para>
-
-<para>
-There are two basic ways to use SSP - either profiling a whole
-program, or selectively profiling parts of the program.
-</para>
-
-<para>
-To profile a whole program, just run <command>ssp</command> without options.
-By default, it will step the whole program. Here's a simple example, using
-the numbers above:
-
-<screen>
-$ ssp 0x61001000 0x61080000 hello.exe
-</screen>
-
-This will step the whole program. It will take at least 8 minutes on
-a PII/300 (yes, really). When it's done, it will create a file called
-"gmon.out". You can turn this data file into a readable report with
-<command>gprof</command>:
-
-<screen>
-$ gprof -b cygwin1.dll
-</screen>
-
-The "-b" means 'skip the help pages'. You can omit this until you're
-familiar with the report layout. The <command>gprof</command> documentation
-explains a lot about this report, but <command>ssp</command> changes a few
-things. For example, the first part of the report reports the amount of time
-spent in each function, like this:
-
-<screen>
-Each sample counts as 0.01 seconds.
- % cumulative self self total
- time seconds seconds calls ms/call ms/call name
- 10.02 231.22 72.43 46 1574.57 1574.57 strcspn
- 7.95 288.70 57.48 130 442.15 442.15 strncasematch
-</screen>
-
-The "seconds" columns are really CPU opcodes, 1/100 second per opcode.
-So, "231.22" above means 23,122 opcodes. The ms/call values are 10x
-too big; 1574.57 means 157.457 opcodes per call. Similar adjustments
-need to be made for the "self" and "children" columns in the second
-part of the report.
-</para>
-
-<para>
-OK, so now we've got a huge report that took a long time to generate,
-and we've identified a spot we want to work on optimizing. Let's say
-it's the time() function. We can use SSP to selectively profile this
-function by using OutputDebugString() to control SSP from within the
-program. Here's a sample program:
-
-<screen>
- #include &lt;windows.h&gt;
- main()
- {
- time_t t;
- OutputDebugString("ssp on");
- time(&amp;t);
- OutputDebugString("ssp off");
- }
-</screen>
-</para>
-
-<para>
-Then, add the <literal>-d</literal> option to ssp to default to
-*disabling* profiling. The program will run at full speed until the first
-OutputDebugString, then step until the second.
-You can then use <command>gprof</command> (as usual) to see the performance
-profile for just that portion of the program's execution.
-</para>
-
-<para>
-There are many options to ssp. Since step-profiling makes your
-program run about 1,000 times slower than normal, it's best to
-understand all the options so that you can narrow down the parts
-of your program you need to single-step.
-</para>
-
-<para>
-<literal>-v</literal> - verbose. This prints messages about threads
-starting and stopping, OutputDebugString calls, DLLs loading, etc.
-</para>
-
-<para>
-<literal>-t</literal> and <literal>-c</literal> - tracing.
-With <literal>-t</literal>, *every* step's address is written
-to the file "trace.ssp". This can be used to help debug functions,
-since it can trace multiple threads. Clever use of scripts can match
-addresses with disassembled opcodes if needed. Warning: creates
-*huge* files, very quickly. <literal>-c</literal> prints each address to
-the console, useful for debugging key chunks of assembler. Use
-<literal>addr2line -C -f -s -e foo.exe &lt; trace.ssp &gt; lines.ssp</literal>
-and then <literal>perl cvttrace</literal> to convert to symbolic traces.
-</para>
-
-<para>
-<literal>-s</literal> - subthreads. Usually, you only need to trace the
-main thread, but sometimes you need to trace all threads, so this enables that.
-It's also needed when you want to profile a function that only a
-subthread calls. However, using OutputDebugString automatically
-enables profiling on the thread that called it, not the main thread.
-</para>
-
-<para>
-<literal>-l</literal> - dll profiling. Generates a pretty table of how much
-time was spent in each dll the program used. No sense optimizing a function in
-your program if most of the time is spent in the DLL.
-I usually use the <literal>-v</literal>, <literal>-s</literal>, and
-<literal>-l</literal> options:
-
-<screen>
-$ ssp <literal>-v</literal> <literal>-s</literal> <literal>-l</literal> <literal>-d</literal> 0x61001000 0x61080000 hello.exe
-</screen>
-</para>
-</sect2>
-
-<sect2 id="strace"><title>strace</title>
-
-<screen>
-Usage: strace.exe [OPTIONS] &lt;command-line&gt;
-Usage: strace.exe [OPTIONS] -p &lt;pid&gt;
-Trace system calls and signals
-
- -b, --buffer-size=SIZE set size of output file buffer
- -d, --no-delta don't display the delta-t microsecond timestamp
- -f, --trace-children trace child processes (toggle - default true)
- -h, --help output usage information and exit
- -m, --mask=MASK set message filter mask
- -n, --crack-error-numbers output descriptive text instead of error
- numbers for Windows errors
- -o, --output=FILENAME set output file to FILENAME
- -p, --pid=n attach to executing program with cygwin pid n
- -q, --quiet toggle "quiet" flag. Defaults to on if "-p",
- off otherwise.
- -S, --flush-period=PERIOD flush buffered strace output every PERIOD secs
- -t, --timestamp use an absolute hh:mm:ss timestamp insted of
- the default microsecond timestamp. Implies -d
- -T, --toggle toggle tracing in a process already being
- -u, --usecs toggle printing of microseconds timestamp
- traced. Requires -p &lt;pid&gt;
- -v, --version output version information and exit
- -w, --new-window spawn program under test in a new window
-
- MASK can be any combination of the following mnemonics and/or hex values
- (0x is optional). Combine masks with '+' or ',' like so:
-
- --mask=wm+system,malloc+0x00800
-
- Mnemonic Hex Corresponding Def Description
- =========================================================================
- all 0x00001 (_STRACE_ALL) All strace messages.
- flush 0x00002 (_STRACE_FLUSH) Flush output buffer after each message.
- inherit 0x00004 (_STRACE_INHERIT) Children inherit mask from parent.
- uhoh 0x00008 (_STRACE_UHOH) Unusual or weird phenomenon.
- syscall 0x00010 (_STRACE_SYSCALL) System calls.
- startup 0x00020 (_STRACE_STARTUP) argc/envp printout at startup.
- debug 0x00040 (_STRACE_DEBUG) Info to help debugging.
- paranoid 0x00080 (_STRACE_PARANOID) Paranoid info.
- termios 0x00100 (_STRACE_TERMIOS) Info for debugging termios stuff.
- select 0x00200 (_STRACE_SELECT) Info on ugly select internals.
- wm 0x00400 (_STRACE_WM) Trace Windows msgs (enable _strace_wm).
- sigp 0x00800 (_STRACE_SIGP) Trace signal and process handling.
- minimal 0x01000 (_STRACE_MINIMAL) Very minimal strace output.
- exitdump 0x04000 (_STRACE_EXITDUMP) Dump strace cache on exit.
- system 0x08000 (_STRACE_SYSTEM) Serious error; goes to console and log.
- nomutex 0x10000 (_STRACE_NOMUTEX) Don't use mutex for synchronization.
- malloc 0x20000 (_STRACE_MALLOC) Trace malloc calls.
- thread 0x40000 (_STRACE_THREAD) Thread-locking calls.
-</screen>
-
-<para>The <command>strace</command> program executes a program, and
-optionally the children of the program, reporting any Cygwin DLL output
-from the program(s) to stdout, or to a file with the <literal>-o</literal>
-option. With the <literal>-w</literal> option, you can start an strace
-session in a new window, for example:
-
-<screen>
-$ strace -o tracing_output -w sh -c 'while true; do echo "tracing..."; done' &amp;
-</screen>
-This is particularly useful for <command>strace</command> sessions that
-take a long time to complete.
-</para>
-
-<para>
-Note that <command>strace</command> is a standalone Windows program and so does
-not rely on the Cygwin DLL itself (you can verify this with
-<command>cygcheck</command>). As a result it does not understand symlinks.
-This program is mainly useful for debugging the Cygwin DLL itself.</para>
-
-</sect2>
-
-<sect2 id="umount"><title>umount</title>
-
-<screen>
-Usage: umount.exe [OPTION] [&lt;posixpath&gt;]
-Unmount filesystems
-
- -h, --help output usage information and exit
- -U, --remove-user-mounts remove all user mounts
- -v, --version output version information and exit
-</screen>
-
-<para>The <command>umount</command> program removes mounts from the
-mount table in the current session. If you specify a POSIX path that
-corresponds to a current mount point, <command>umount</command> will
-remove it from the current mount table. Note that you can only remove
-user mount points. The <literal>-U</literal> flag may be used to
-specify removing all user mount points from the current user session.</para>
-
-<para>See <xref linkend="mount-table"></xref> for more information on the mount
-table.</para>
-</sect2>
-
-</sect1>