[interchange-cvs] interchange - jon modified lib/Vend/Util.pm
interchange-core@interchange.redhat.com
interchange-core@interchange.redhat.com
Fri Sep 7 00:39:01 2001
User: jon
Date: 2001-09-07 04:38:27 GMT
Modified: lib/Vend Util.pm
Log:
Adding new chkcat tool, similar to chkconfig(1), for enabling/disabling/
querying new SysV-style catalog configuration files.
Revision Changes Path
2.4 +20 -2 interchange/lib/Vend/Util.pm
rev 2.4, prev_rev 2.3
Index: Util.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Util.pm,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -u -r2.3 -r2.4
--- Util.pm 2001/08/29 15:14:45 2.3
+++ Util.pm 2001/09/07 04:38:27 2.4
@@ -1,6 +1,6 @@
# Vend::Util - Interchange utility functions
#
-# $Id: Util.pm,v 2.3 2001/08/29 15:14:45 mheins Exp $
+# $Id: Util.pm,v 2.4 2001/09/07 04:38:27 jon Exp $
#
# Copyright (C) 1996-2001 Red Hat, Inc. <interchange@redhat.com>
#
@@ -77,7 +77,7 @@
use Safe;
use subs qw(logError logGlobal);
use vars qw($VERSION @EXPORT @EXPORT_OK);
-$VERSION = substr(q$Revision: 2.3 $, 10);
+$VERSION = substr(q$Revision: 2.4 $, 10);
BEGIN {
eval {
@@ -2062,6 +2062,24 @@
$ok;
}
+
+
+sub Vend::Util::get_cfg_header {
+ my ($file) = @_;
+ my $cfg = {};
+ local ($_, *IN);
+ unless (open IN, "<$file") {
+ my @msg = ("Can't open config file '%s': %s\n", $file, $!);
+ logError(@msg);
+ return { error => errmsg(@msg) };
+ }
+ while (<IN>) {
+ ($cfg->{position} = $1, last) if /^\s*#\s*position\s*:\s*(\d+)/i;
+ }
+ close IN;
+ return $cfg;
+}
+
1;
__END__