From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/9317 Path: main.gmane.org!not-for-mail From: Wybo Dekker Newsgroups: gmane.comp.tex.context Subject: Re: getting context's version Date: Wed, 18 Sep 2002 17:28:13 +0200 (CEST) Sender: owner-ntg-context@let.uu.nl Message-ID: References: <20020918114734.404ff990.taco@elvenkind.com> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1035399656 2249 80.91.224.250 (23 Oct 2002 19:00:56 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 19:00:56 +0000 (UTC) Cc: Tobias Burnus , Original-To: Taco Hoekwater In-Reply-To: <20020918114734.404ff990.taco@elvenkind.com> Xref: main.gmane.org gmane.comp.tex.context:9317 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:9317 On Wed, 18 Sep 2002, Taco Hoekwater wrote: > Surely that's the file date of the format file? > > stat (`kpsewhich cont-en.efmt`) No, you can create a very new format file from a very old context version > perl doesnt care about that binary stuff :) > > /\(format=cont-.. (\d+).(\d+).(\d+)\)/; I tried that one already, but what you get is the file date, not the context version. The latter isn't in the format, unless in binary maybe. I think I need the following routine (yes, it's much more than 4 lines): #!/usr/bin/perl -w sub test_context_version { my $required=shift; chomp (my $fmt=`kpsewhich cont-en.efmt`); chomp (my $tex=`kpsewhich context.tex`); (stat $fmt)[10] < (stat $tex)[10] and die "Your context formats need (re)generation:\n"; open(IN,$tex) or do { warn "can't find context.tex"; return 1; }; while() { if ( /contextversion\{(\d+)\.(\d+)\.(\d+)\}/ ) { my $have; $have=sprintf('%4d%02d%02d',$1,$2,$3); $have < $required and warn "Your ConTeXt is too old ($have); you need $required\n"; return 1; last; } } return 0; } for $v (20020701,20020901) { warn "testing $v:\n"; test_context_version($v); } -- Wybo