On Fri, 15 Aug 2003, Corinna Vinschen wrote: > On Fri, Aug 15, 2003 at 03:38:30PM -0400, Igor Pechtchanski wrote: > > > On Cygwin: > > > > > > $ cygcheck -f /usr/bin/tcsh.exe > > > /usr/bin/tcsh.exe: found in package tcsh-6.12.00-6 > > > > > > On Linux: > > > > > > $ rpm -qf /usr/bin/tcsh > > > tcsh-6.12.00-134 > > > > > > Shouldn't we also just print the package name? It doesn't really matter, > > > just a question... > > > > Fixed. > > I'm happy!
On second thought, we're not using the verbose flag much. We could certainly use it for this. If you don't mind, I'll revert the printout to the more verbose form if -v is passed to cygcheck. Also see below. > Another difference to Linux is when using -l. rpm -ql doesn't > prepend the package version to each file list, it just prints a list of > files of all packages on the command line: > > $ rpm -ql bash tcsh > /bin/bash > [more bash files] > /usr/bin/tcsh > [more tcsh files] > $ > > On Cygwin: > > $ cygcheck -l bash tcsh > Package: bash-2.05b-12 > /usr/bin/bash.exe > [more bash files] > Package: tcsh-6.12.00-7 > /usr/bin/tcsh.exe > [more tcsh files] > $ > > Should we do it also like rpm or do you like it better as it is? Let's do it like rpm unless verbose output is requested. > > Well, I agree with all the above points, so here's another iteration. > > Same ChangeLog (except for the date -- reposting just in case). > > I've checked it in and added some formatting changes. I removed most > of the `puts("");' lines and the "Use -h to see..." is now only printed > where it belongs to, to the end of a sysinfo dump. Oh, and the other > helptext ("Here is where the OS will...") would have been printed also > on -f -h or -l -h, I've fixed the if clause appropriately. Thanks. > Thanks for the patch, it's really cool, > Corinna You're welcome. Here's a minor adjustment based on the comments above. Another thing to do is make cygcheck respect the order of arguments (right now it lists the packages in alphabetical order). Igor ============================================================================== ChangeLog: 2003-08-15 Igor Pechtchanski <[EMAIL PROTECTED]> * dump_setup.cc: (package_list): Make output terse unless verbose requested. Fix formatting. (package_find): Ditto. -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ [EMAIL PROTECTED] ZZZzz /,`.-'`' -. ;-;;,_ [EMAIL PROTECTED] |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton
Index: dump_setup.cc =================================================================== RCS file: /cvs/src/src/winsup/utils/dump_setup.cc,v retrieving revision 1.10 diff -u -p -r1.10 dump_setup.cc --- dump_setup.cc 15 Aug 2003 20:26:11 -0000 1.10 +++ dump_setup.cc 15 Aug 2003 22:54:10 -0000 @@ -411,21 +411,22 @@ package_list (int verbose, char **argv) { FILE *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); - return; - } + { + if (verbose) + printf ("Can't open file list /etc/setup/%s.lst.gz for package %s\n", + packages[i].name, packages[i].name); + return; + } - printf ("Package: %s-%s\n", packages[i].name, packages[i].ver); + if (verbose) + printf ("Package: %s-%s\n", packages[i].name, packages[i].ver); char buf[MAX_PATH + 1]; while (fgets (buf, MAX_PATH, fp)) { char *lastchar = strchr(buf, '\n'); if (lastchar[-1] != '/') - printf (" /%s", buf); + printf ("%s/%s", (verbose?" ":""), buf); } fclose (fp); @@ -450,12 +451,7 @@ package_find (int verbose, char **argv) { FILE *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); return; - } char buf[MAX_PATH + 2]; buf[0] = '/'; @@ -479,7 +475,11 @@ package_find (int verbose, char **argv) if (!a && is_alias) a = match_argv (argv, filename + 4); if (a > 0) - printf ("%s-%s\n", packages[i].name, packages[i].ver); + { + if (verbose) + printf ("%s: found in package ", filename); + printf ("%s-%s\n", packages[i].name, packages[i].ver); + } } }