* regtool.cc (translate): Ensure that 'c' is initialized.

(cmd_set): Ditto for rv.
This commit is contained in:
Christopher Faylor 2001-01-10 14:20:16 +00:00
parent 7416e1d2f6
commit b82a7a5e35
3 changed files with 593 additions and 572 deletions

View File

@ -1,347 +1,4 @@
Fri Dec 15 23:41:48 2000 Christopher Faylor <cgf@cygnus.com> Wed Jan 10 09:16:57 2001 Christopher Faylor <cgf@cygnus.com>
* cygcheck.cc (cygwin_info): Add some more bounds checking. * regtool.cc (translate): Ensure that 'c' is initialized.
(cmd_set): Ditto for rv.
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.

347
winsup/utils/ChangeLog-2000 Normal file
View File

@ -0,0 +1,347 @@
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.

View File

@ -14,7 +14,8 @@ details. */
#include <getopt.h> #include <getopt.h>
#include <windows.h> #include <windows.h>
enum { enum
{
KT_AUTO, KT_INT, KT_STRING, KT_EXPAND, KT_MULTI KT_AUTO, KT_INT, KT_STRING, KT_EXPAND, KT_MULTI
} key_type = KT_AUTO; } key_type = KT_AUTO;
@ -25,8 +26,7 @@ char **argv;
HKEY key; HKEY key;
char *value; char *value;
const char *usage_msg[] = const char *usage_msg[] = {
{
"Regtool Copyright (c) 2000 Red Hat Inc", "Regtool Copyright (c) 2000 Red Hat Inc",
" regtool -h - print this message", " regtool -h - print this message",
" regtool [-v] list [key] - list subkeys and values", " regtool [-v] list [key] - list subkeys and values",
@ -49,51 +49,54 @@ const char *usage_msg[] =
}; };
void void
usage(void) usage (void)
{ {
int i; int i;
for (i=0; usage_msg[i]; i++) for (i = 0; usage_msg[i]; i++)
fprintf(stderr, "%s\n", usage_msg[i]); fprintf (stderr, "%s\n", usage_msg[i]);
exit(1); exit (1);
} }
void void
Fail(DWORD rv) Fail (DWORD rv)
{ {
char *buf; char *buf;
if (!quiet) if (!quiet)
{ {
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM, | FORMAT_MESSAGE_FROM_SYSTEM,
0, rv, 0, (CHAR *)&buf, 0, 0); 0, rv, 0, (CHAR *) & buf, 0, 0);
fprintf(stderr, "Error: %s\n", buf); fprintf (stderr, "Error: %s\n", buf);
} }
exit(1); exit (1);
} }
struct { struct
{
const char *string; const char *string;
HKEY key; HKEY key;
} wkprefixes[] = { } wkprefixes[] =
{ "root", HKEY_CLASSES_ROOT }, {
{ "HKCR", HKEY_CLASSES_ROOT }, {"root", HKEY_CLASSES_ROOT},
{ "HKEY_CLASSES_ROOT", HKEY_CLASSES_ROOT }, {"HKCR", HKEY_CLASSES_ROOT},
{ "config", HKEY_CURRENT_CONFIG }, {"HKEY_CLASSES_ROOT", HKEY_CLASSES_ROOT},
{ "HKCC", HKEY_CURRENT_CONFIG }, {"config", HKEY_CURRENT_CONFIG},
{ "HKEY_CURRENT_CONFIG", HKEY_CURRENT_CONFIG }, {"HKCC", HKEY_CURRENT_CONFIG},
{ "user", HKEY_CURRENT_USER }, {"HKEY_CURRENT_CONFIG", HKEY_CURRENT_CONFIG},
{ "HKCU", HKEY_CURRENT_USER }, {"user", HKEY_CURRENT_USER},
{ "HKEY_CURRENT_USER", HKEY_CURRENT_USER }, {"HKCU", HKEY_CURRENT_USER},
{ "machine", HKEY_LOCAL_MACHINE }, {"HKEY_CURRENT_USER", HKEY_CURRENT_USER},
{ "HKLM", HKEY_LOCAL_MACHINE }, {"machine", HKEY_LOCAL_MACHINE},
{ "HKEY_LOCAL_MACHINE", HKEY_LOCAL_MACHINE }, {"HKLM", HKEY_LOCAL_MACHINE},
{ "users", HKEY_USERS }, {"HKEY_LOCAL_MACHINE", HKEY_LOCAL_MACHINE},
{ "HKU", HKEY_USERS }, {"users", HKEY_USERS},
{ "HKEY_USERS", HKEY_USERS }, {"HKU", HKEY_USERS},
{ 0, 0 } {"HKEY_USERS", HKEY_USERS},
{0, 0}
}; };
void translate(char *key) void
translate (char *key)
{ {
#define isodigit(c) (strchr("01234567", c)) #define isodigit(c) (strchr("01234567", c))
#define tooct(c) ((c)-'0') #define tooct(c) ((c)-'0')
@ -107,119 +110,127 @@ void translate(char *key)
while (*s) while (*s)
{ {
if (*s == '\\') if (*s == '\\')
switch (*++s) switch (*++s)
{ {
case 'a': case 'a':
*d++ = '\007'; *d++ = '\007';
break; break;
case 'b': case 'b':
*d++ = '\b'; *d++ = '\b';
break; break;
case 'e': case 'e':
*d++ = '\033'; *d++ = '\033';
break; break;
case 'f': case 'f':
*d++ = '\f'; *d++ = '\f';
break; break;
case 'n': case 'n':
*d++ = '\n'; *d++ = '\n';
break; break;
case 'r': case 'r':
*d++ = '\r'; *d++ = '\r';
break; break;
case 't': case 't':
*d++ = '\t'; *d++ = '\t';
break; break;
case 'v': case 'v':
*d++ = '\v'; *d++ = '\v';
break; break;
case '0': case '1': case '2': case '3': case '0':
case '4': case '5': case '6': case '7': case '1':
c = tooct(*s); case '2':
if (isodigit(s[1])) case '3':
{ case '4':
c = (c << 3) | tooct(*++s); case '5':
if (isodigit(s[1])) case '6':
c = (c << 3) | tooct(*++s); case '7':
} c = tooct (*s);
*d++ = c; if (isodigit (s[1]))
break; {
case 'x': c = (c << 3) | tooct (*++s);
if (isxdigit(s[1])) if (isodigit (s[1]))
{ c = (c << 3) | tooct (*++s);
c = tohex(*++s); }
if (isxdigit(s[1])) *d++ = c;
c = (c << 4) | tohex(*++s); break;
} case 'x':
*d++ = c; if (!isxdigit (s[1]))
break; c = 0;
default: /* before non-special char: just add the char */ else
*d++ = *s; {
break; 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 == '/') else if (*s == '/')
*d++ = '\\'; *d++ = '\\';
else else
*d++ = *s; *d++ = *s;
++s; ++s;
} }
*d = '\0'; *d = '\0';
} }
void void
find_key(int howmanyparts, REGSAM access) find_key (int howmanyparts, REGSAM access)
{ {
char *n = argv[0], *e, c; char *n = argv[0], *e, c;
int i; int i;
if (*n == '/') if (*n == '/')
translate(n); translate (n);
while (*n == '\\') while (*n == '\\')
n++; n++;
for (e=n; *e && *e != '\\'; e++); for (e = n; *e && *e != '\\'; e++);
c = *e; c = *e;
*e = 0; *e = 0;
for (i=0; wkprefixes[i].string; i++) for (i = 0; wkprefixes[i].string; i++)
if (strcmp(wkprefixes[i].string, n) == 0) if (strcmp (wkprefixes[i].string, n) == 0)
break; break;
if (!wkprefixes[i].string) if (!wkprefixes[i].string)
{ {
fprintf(stderr, "Unknown key prefix. Valid prefixes are:\n"); fprintf (stderr, "Unknown key prefix. Valid prefixes are:\n");
for (i=0; wkprefixes[i].string; i++) for (i = 0; wkprefixes[i].string; i++)
fprintf(stderr, "\t%s\n", wkprefixes[i].string); fprintf (stderr, "\t%s\n", wkprefixes[i].string);
exit(1); exit (1);
} }
n = e; n = e;
*e = c; *e = c;
while (*n && *n == '\\') while (*n && *n == '\\')
n++; n++;
e = n+strlen(n); e = n + strlen (n);
if (howmanyparts > 1) if (howmanyparts > 1)
{ {
while (n < e && *e != '\\') while (n < e && *e != '\\')
e--; e--;
if (*e != '\\') if (*e != '\\')
{ {
fprintf(stderr, "Invalid key\n"); fprintf (stderr, "Invalid key\n");
exit(1); exit (1);
} }
*e = 0; *e = 0;
value = e+1; value = e + 1;
} }
if (n[0] == 0) if (n[0] == 0)
{ {
key = wkprefixes[i].key; key = wkprefixes[i].key;
return; return;
} }
int rv = RegOpenKeyEx(wkprefixes[i].key, n, 0, access, &key); int rv = RegOpenKeyEx (wkprefixes[i].key, n, 0, access, &key);
if (rv != ERROR_SUCCESS) if (rv != ERROR_SUCCESS)
Fail(rv); Fail (rv);
//printf("key `%s' value `%s'\n", n, value); //printf("key `%s' value `%s'\n", n, value);
} }
int int
cmd_list() cmd_list ()
{ {
DWORD num_subkeys, maxsubkeylen, num_values, maxvalnamelen, maxvaluelen; DWORD num_subkeys, maxsubkeylen, num_values, maxvalnamelen, maxvaluelen;
DWORD maxclasslen; DWORD maxclasslen;
@ -228,71 +239,70 @@ cmd_list()
DWORD i, j, m, n, t; DWORD i, j, m, n, t;
int v; int v;
find_key(1, KEY_READ); find_key (1, KEY_READ);
RegQueryInfoKey(key, 0, 0, 0, &num_subkeys, &maxsubkeylen, &maxclasslen, RegQueryInfoKey (key, 0, 0, 0, &num_subkeys, &maxsubkeylen, &maxclasslen,
&num_values, &maxvalnamelen, &maxvaluelen, 0, 0); &num_values, &maxvalnamelen, &maxvaluelen, 0, 0);
subkey_name = (char *)malloc(maxsubkeylen+1); subkey_name = (char *) malloc (maxsubkeylen + 1);
class_name = (char *)malloc(maxclasslen+1); class_name = (char *) malloc (maxclasslen + 1);
value_name = (char *)malloc(maxvalnamelen+1); value_name = (char *) malloc (maxvalnamelen + 1);
value_data = (unsigned char *)malloc(maxvaluelen+1); value_data = (unsigned char *) malloc (maxvaluelen + 1);
for (i=0; i<num_subkeys; i++) for (i = 0; i < num_subkeys; i++)
{ {
m = maxsubkeylen+1; m = maxsubkeylen + 1;
n = maxclasslen+1; n = maxclasslen + 1;
RegEnumKeyEx(key, i, subkey_name, &m, 0, class_name, &n, 0); RegEnumKeyEx (key, i, subkey_name, &m, 0, class_name, &n, 0);
if (verbose) if (verbose)
printf("%s\\ (%s)\n", subkey_name, class_name); printf ("%s\\ (%s)\n", subkey_name, class_name);
else else
printf("%s\n", subkey_name); printf ("%s\n", subkey_name);
} }
for (i=0; i<num_values; i++) for (i = 0; i < num_values; i++)
{ {
m = maxvalnamelen+1; m = maxvalnamelen + 1;
n = maxvaluelen+1; n = maxvaluelen + 1;
RegEnumValue(key, i, value_name, &m, 0, &t, (BYTE *)value_data, &n); RegEnumValue (key, i, value_name, &m, 0, &t, (BYTE *) value_data, &n);
if (!verbose) if (!verbose)
printf("%s\n", value_name); printf ("%s\n", value_name);
else else
{ {
printf("%s = ", value_name); printf ("%s = ", value_name);
switch (t) switch (t)
{ {
case REG_BINARY: case REG_BINARY:
for (j=0; j<8 && j<n; j++) for (j = 0; j < 8 && j < n; j++)
printf("%02x ", value_data[j]); printf ("%02x ", value_data[j]);
printf("\n"); printf ("\n");
break; break;
case REG_DWORD: case REG_DWORD:
printf("0x%08lx (%lu)\n", *(DWORD *)value_data, printf ("0x%08lx (%lu)\n", *(DWORD *) value_data,
*(DWORD *)value_data); *(DWORD *) value_data);
break; break;
case REG_DWORD_BIG_ENDIAN: case REG_DWORD_BIG_ENDIAN:
v = ((value_data[0] << 24) v = ((value_data[0] << 24)
| (value_data[1] << 16) | (value_data[1] << 16)
| (value_data[2] << 8) | (value_data[2] << 8) | (value_data[3]));
| (value_data[3])); printf ("0x%08x (%d)\n", v, v);
printf("0x%08x (%d)\n", v, v);
break; break;
case REG_EXPAND_SZ: case REG_EXPAND_SZ:
case REG_SZ: case REG_SZ:
printf("\"%s\"\n", value_data); printf ("\"%s\"\n", value_data);
break; break;
case REG_MULTI_SZ: case REG_MULTI_SZ:
vd = value_data; vd = value_data;
while (vd && *vd) while (vd && *vd)
{ {
printf("\"%s\"", vd); printf ("\"%s\"", vd);
vd = vd+strlen((const char *)vd) + 1; vd = vd + strlen ((const char *) vd) + 1;
if (*vd) if (*vd)
printf(", "); printf (", ");
} }
printf("\n"); printf ("\n");
break; break;
default: default:
printf("? (type %d)\n", (int)t); printf ("? (type %d)\n", (int) t);
} }
} }
} }
@ -300,59 +310,59 @@ cmd_list()
} }
int int
cmd_add() cmd_add ()
{ {
find_key(2, KEY_ALL_ACCESS); find_key (2, KEY_ALL_ACCESS);
HKEY newkey; HKEY newkey;
DWORD newtype; DWORD newtype;
int rv = RegCreateKeyEx(key, value, 0, (char *)"", REG_OPTION_NON_VOLATILE, int rv = RegCreateKeyEx (key, value, 0, (char *) "", REG_OPTION_NON_VOLATILE,
KEY_ALL_ACCESS, 0, &newkey, &newtype); KEY_ALL_ACCESS, 0, &newkey, &newtype);
if (rv != ERROR_SUCCESS) if (rv != ERROR_SUCCESS)
Fail(rv); Fail (rv);
if (verbose) if (verbose)
{ {
if (newtype == REG_OPENED_EXISTING_KEY) if (newtype == REG_OPENED_EXISTING_KEY)
printf("Key %s already exists\n", value); printf ("Key %s already exists\n", value);
else else
printf("Key %s created\n", value); printf ("Key %s created\n", value);
} }
return 0; return 0;
} }
int int
cmd_remove() cmd_remove ()
{ {
find_key(2, KEY_ALL_ACCESS); find_key (2, KEY_ALL_ACCESS);
DWORD rv = RegDeleteKey(key, value); DWORD rv = RegDeleteKey (key, value);
if (rv != ERROR_SUCCESS) if (rv != ERROR_SUCCESS)
Fail(rv); Fail (rv);
if (verbose) if (verbose)
printf("subkey %s deleted\n", value); printf ("subkey %s deleted\n", value);
return 0; return 0;
} }
int int
cmd_check() cmd_check ()
{ {
find_key(1, KEY_READ); find_key (1, KEY_READ);
if (verbose) if (verbose)
printf("key %s exists\n", argv[0]); printf ("key %s exists\n", argv[0]);
return 0; return 0;
} }
int int
cmd_set() cmd_set ()
{ {
int i, n; int i, n;
DWORD v, rv; DWORD v, rv;
char *a = argv[1], *data; char *a = argv[1], *data;
find_key(2, KEY_ALL_ACCESS); find_key (2, KEY_ALL_ACCESS);
if (key_type == KT_AUTO) if (key_type == KT_AUTO)
{ {
char *e; char *e;
strtoul(a, &e, 0); strtoul (a, &e, 0);
if (a[0] == '%') if (a[0] == '%')
key_type = KT_EXPAND; key_type = KT_EXPAND;
else if (a[0] && !*e) else if (a[0] && !*e)
@ -366,114 +376,121 @@ cmd_set()
switch (key_type) switch (key_type)
{ {
case KT_INT: case KT_INT:
v = strtoul(a, 0, 0); v = strtoul (a, 0, 0);
rv = RegSetValueEx(key, value, 0, REG_DWORD, (const BYTE *)&v, sizeof(v)); rv = RegSetValueEx (key, value, 0, REG_DWORD, (const BYTE *) &v,
sizeof (v));
break; break;
case KT_STRING: case KT_STRING:
rv = RegSetValueEx(key, value, 0, REG_SZ, (const BYTE *)a, strlen(a)); rv = RegSetValueEx (key, value, 0, REG_SZ, (const BYTE *) a, strlen (a));
break; break;
case KT_EXPAND: case KT_EXPAND:
rv = RegSetValueEx(key, value, 0, REG_EXPAND_SZ, (const BYTE *)a, strlen(a)); rv = RegSetValueEx (key, value, 0, REG_EXPAND_SZ, (const BYTE *) a,
strlen (a));
break; break;
case KT_MULTI: case KT_MULTI:
for (i=1, n=1; argv[i]; i++) for (i = 1, n = 1; argv[i]; i++)
n += strlen(argv[i])+1; n += strlen (argv[i]) + 1;
data = (char *)malloc(n); data = (char *) malloc (n);
for (i=1, n=0; argv[i]; i++) for (i = 1, n = 0; argv[i]; i++)
{ {
strcpy(data+n, argv[i]); strcpy (data + n, argv[i]);
n += strlen(argv[i])+1; n += strlen (argv[i]) + 1;
} }
data[n] = 0; data[n] = 0;
rv = RegSetValueEx(key, value, 0, REG_MULTI_SZ, (const BYTE *)data, n+1); rv = RegSetValueEx (key, value, 0, REG_MULTI_SZ, (const BYTE *) data,
n + 1);
break; break;
case KT_AUTO: case KT_AUTO:
default:
rv = ERROR_SUCCESS;
break; break;
} }
if (rv != ERROR_SUCCESS) if (rv != ERROR_SUCCESS)
Fail(rv); Fail (rv);
return 0; return 0;
} }
int int
cmd_unset() cmd_unset ()
{ {
find_key(2, KEY_ALL_ACCESS); find_key (2, KEY_ALL_ACCESS);
DWORD rv = RegDeleteValue(key, value); DWORD rv = RegDeleteValue (key, value);
if (rv != ERROR_SUCCESS) if (rv != ERROR_SUCCESS)
Fail(rv); Fail (rv);
if (verbose) if (verbose)
printf("value %s deleted\n", value); printf ("value %s deleted\n", value);
return 0; return 0;
} }
int int
cmd_get() cmd_get ()
{ {
find_key(2, KEY_READ); find_key (2, KEY_READ);
DWORD vtype, dsize, rv; DWORD vtype, dsize, rv;
char *data, *vd; char *data, *vd;
rv = RegQueryValueEx(key, value, 0, &vtype, 0, &dsize); rv = RegQueryValueEx (key, value, 0, &vtype, 0, &dsize);
if (rv != ERROR_SUCCESS) if (rv != ERROR_SUCCESS)
Fail(rv); Fail (rv);
dsize++; dsize++;
data = (char *)malloc(dsize); data = (char *) malloc (dsize);
rv = RegQueryValueEx(key, value, 0, &vtype, (BYTE *)data, &dsize); rv = RegQueryValueEx (key, value, 0, &vtype, (BYTE *) data, &dsize);
if (rv != ERROR_SUCCESS) if (rv != ERROR_SUCCESS)
Fail(rv); Fail (rv);
switch (vtype) switch (vtype)
{ {
case REG_BINARY: case REG_BINARY:
fwrite(data, dsize, 0, stdout); fwrite (data, dsize, 0, stdout);
break; break;
case REG_DWORD: case REG_DWORD:
printf("%lu\n", *(DWORD *)data); printf ("%lu\n", *(DWORD *) data);
break; break;
case REG_SZ: case REG_SZ:
printf("%s\n", data); printf ("%s\n", data);
break; break;
case REG_EXPAND_SZ: case REG_EXPAND_SZ:
if (key_type == KT_EXPAND) // hack if (key_type == KT_EXPAND) // hack
{ {
char *buf; char *buf;
DWORD bufsize; DWORD bufsize;
bufsize = ExpandEnvironmentStrings(data, 0, 0); bufsize = ExpandEnvironmentStrings (data, 0, 0);
buf = (char *)malloc(bufsize+1); buf = (char *) malloc (bufsize + 1);
ExpandEnvironmentStrings(data, buf, bufsize+1); ExpandEnvironmentStrings (data, buf, bufsize + 1);
data = buf; data = buf;
} }
printf("%s\n", data); printf ("%s\n", data);
break; break;
case REG_MULTI_SZ: case REG_MULTI_SZ:
vd = data; vd = data;
while (vd && *vd) while (vd && *vd)
{ {
printf("%s\n", vd); printf ("%s\n", vd);
vd = vd+strlen((const char *)vd) + 1; vd = vd + strlen ((const char *) vd) + 1;
} }
break; break;
} }
return 0; return 0;
} }
struct { struct
{
const char *name; const char *name;
int (*func)(); int (*func) ();
} commands[] = { } commands[] =
{ "list", cmd_list }, {
{ "add", cmd_add }, {"list", cmd_list},
{ "remove", cmd_remove }, {"add", cmd_add},
{ "check", cmd_check }, {"remove", cmd_remove},
{ "set", cmd_set }, {"check", cmd_check},
{ "unset", cmd_unset }, {"set", cmd_set},
{ "get", cmd_get }, {"unset", cmd_unset},
{ 0, 0 } {"get", cmd_get},
{0, 0}
}; };
int int
main(int argc, char **_argv) main (int argc, char **_argv)
{ {
while (1) while (1)
{ {
@ -481,44 +498,44 @@ main(int argc, char **_argv)
if (g == -1) if (g == -1)
break; break;
switch (g) switch (g)
{ {
case 'v': case 'v':
verbose ++; verbose++;
break; break;
case 'q': case 'q':
quiet ++; quiet++;
break; break;
case 'i': case 'i':
key_type = KT_INT; key_type = KT_INT;
break; break;
case 's': case 's':
key_type = KT_STRING; key_type = KT_STRING;
break; break;
case 'e': case 'e':
key_type = KT_EXPAND; key_type = KT_EXPAND;
break; break;
case 'm': case 'm':
key_type = KT_MULTI; key_type = KT_MULTI;
break; break;
case '?': case '?':
case 'h': case 'h':
usage(); usage ();
} }
} }
if (_argv[optind] == NULL) if (_argv[optind] == NULL)
usage(); usage ();
argv = _argv+optind; argv = _argv + optind;
int i; int i;
for (i=0; commands[i].name; i++) for (i = 0; commands[i].name; i++)
if (strcmp(commands[i].name, argv[0]) == 0) if (strcmp (commands[i].name, argv[0]) == 0)
{ {
argv++; argv++;
return commands[i].func(); return commands[i].func ();
} }
usage(); usage ();
return 0; return 0;
} }