Re: [PATCH] Fix cygrunsrv invocation in cygcheck

2005-08-16 Thread Brian Dessent
Brian Dessent wrote:

  why not simply run cygrunsrv --list --verbose in verbose mode, instead
  of actually going through one iteration of the loop?  Simply to reuse the
  copy output code?  Brian?
 
 The reason I did it that way is because if I had run cygrunsrv --list

Now that I re-read what you said I think I misunderstood.  You're right,
it could have simply done

if(verbose)
  cygrunsrv --list --verbose
else
  foreach cygrunsrv --list
cygrunsrv --query

And that would be somewhat more efficient.  But you're right, I did it
that way so that I wouldn't have to duplicate code between the two
cases... laziness.

Brian


Re: [PATCH] Fix cygrunsrv invocation in cygcheck

2005-08-16 Thread Igor Pechtchanski
On Tue, 16 Aug 2005, Brian Dessent wrote:

 Igor Pechtchanski wrote:

  As mentioned in http://cygwin.com/ml/cygwin/2005-08/msg00724.html, I
  noticed something strange in the cygcheck -s output:

 This fix was part of my patch from June in
 http://cygwin.com/ml/cygwin-patches/2005-q2/msg00138.html but since it
 was grouped with the unrelated cygcheck -p code, it kind of got lost on
 the floor.

That's why it's better to send many micro-patches instead of one monster
patch...  :-)
Hmm, you should ping the list about it, then -- it's been what, two months?

  why not simply run cygrunsrv --list --verbose in verbose mode, instead
  of actually going through one iteration of the loop?  Simply to reuse the
  copy output code?  Brian?

 The reason I did it that way is because if I had run cygrunsrv --list
 --verbose initially, then it would be necessary to parse the output and
 extract out the service names, since it has to run cygrunsrv --query
 for each individual service in the case of (!verbose).  By running just
 cygrunsrv --list you get a simple listing of service names with no
 parsing necessary, and I did not want to make cygcheck depend on the
 particular output format of cygrunsrv.

 This is awkward I admit because there is no cygrunsrv option that does
 the equivalent of --query for all services.  So to support both
 verbose and non-verbose listing of all services, you either have to run
 --list --verbose and then filter out the fields that should not be in
 the verbose output, or you have to run --query individually for each
 service.  And I did not want to mess about with text parsing and
 filtering so I decided to take the easy route and just invoke cygrunsrv
 a few extra times.

I actually meant something like

if (verbose) {
  f = popen(cygrunsrv --list --verbose);
  copy_output(f, stdout);
} else {
  f = popen(cygrunsrv --list);
  buf[fread(buf, 1, sizeof(buf)-1, f)] = '\0';
  pclose(f);
  for (char *srv = strtok(buf), \n); srv; srv = strtok(NULL, \n)) {
f = popen(cygrunsrv --query +srv);
copy_output(f, stdout);
  }
}

Igor
-- 
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!

If there's any real truth it's that the entire multidimensional infinity
of the Universe is almost certainly being run by a bunch of maniacs. /DA


Re: [PATCH] Fix cygrunsrv invocation in cygcheck

2005-08-16 Thread Christopher Faylor
On Tue, Aug 16, 2005 at 07:17:17PM -0400, Igor Pechtchanski wrote:
Hmm, you should ping the list about it, then -- it's been what, two
months?

There's no need to ping anybody.  I do read this list and I haven't
forgotten about the patch.  If it didn't require changs to a file
on sourceware.org, I'd have checked it in by now.

cgf


Re: [PATCH] Fix cygrunsrv invocation in cygcheck

2005-08-16 Thread Brian Dessent
Christopher Faylor wrote:

 Go ahead and check this in.  Thanks.

Ok.

 Thanks, Igor, for bringing this up (again).

Thanks Igor, I had meant to bring this up but forgot.

 There's no need to ping anybody.  I do read this list and I haven't
 forgotten about the patch.  If it didn't require changs to a file
 on sourceware.org, I'd have checked it in by now.

I can rework the patch if there are parts of it that are objectionable. 
I figured that parsing html in C without external libraries was kind of
silly when we have control of the cgi script on the other end.

Brian