W3C home > Mailing lists > Public > www-validator@w3.org > May 2002

Who has a local install of validator run from command line?

From: John Murdie <john@cs.york.ac.uk>
Date: Wed, 1 May 2002 18:16:01 +0100 (BST)
To: www-validator@w3.org
cc: John Murdie <john@cs.york.ac.uk>
Message-Id: <E172xi4-0003uj-00@minster.cs.york.ac.uk>
I've installed a local copy of the W3C Validator (accessed via a web
page), and now wish to run it `in batch' under Linux. I could hack at
the Perl `check' script, but would rather not do so. I imagine that
there is a solution - e.g. a C program which execs `check'. Has any one
got a ready-made one they're willing to share?

I guess this is a FAQ, but I've searched the archive of this mailing
list for `command-line' and `exec', and found nothing. Searching for
`batch' gets several queries similar to mine, but no off-the-shelf
solution.

I think something like:

#include <stdio.h>
#include <unistd.h>

int
main(int argc, char *argv[])
{
	char *query = "QUERY_STRING=uri=http://www.cnn.com/";
	fprintf(stderr, "query \"%s\"\n", query);
	if (putenv(query) != 0) {
		fprintf(stderr, "putenv fails\n");
		exit(1);
	}

	/* Arrange that perl check script finds correct directory from $0. */
	argv[0] = "/var/www/validator-20010913/";
	execv("/var/www/validator-20010913/httpd/cgi-bin/check", argv);
  
}

ought to work - but instead check complains that it can't see the URI.
(I've also tried putting "" around the r.h.s. of the query string - no
fix.)

Failing this, if I can't make a satisfactory solution myself, I'll
install the WDG validator instead - I see that that can be run from the
command line out of the box, see
http://www.htmlhelp.com/tools/validator/offline/.
-- 

John A. Murdie
Experimental Officer (Software)
Department of Computer Science
University of York
England
Received on Wednesday, 1 May 2002 13:19:48 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 25 April 2012 12:14:03 GMT