1*51ffecc1SBen Gras#!/usr/bin/awk -F 2*51ffecc1SBen Gras# 3*51ffecc1SBen Gras# $NetBSD: genfileioh.awk,v 1.2 2008/05/02 11:13:02 martin Exp $ 4*51ffecc1SBen Gras# 5*51ffecc1SBen Gras# Copyright (c) 2008 The NetBSD Foundation, Inc. 6*51ffecc1SBen Gras# All rights reserved. 7*51ffecc1SBen Gras# 8*51ffecc1SBen Gras# This code is derived from software contributed to The NetBSD Foundation 9*51ffecc1SBen Gras# by Julian Coleman. 10*51ffecc1SBen Gras# 11*51ffecc1SBen Gras# Redistribution and use in source and binary forms, with or without 12*51ffecc1SBen Gras# modification, are permitted provided that the following conditions 13*51ffecc1SBen Gras# are met: 14*51ffecc1SBen Gras# 1. Redistributions of source code must retain the above copyright 15*51ffecc1SBen Gras# notice, this list of conditions and the following disclaimer. 16*51ffecc1SBen Gras# 2. Redistributions in binary form must reproduce the above copyright 17*51ffecc1SBen Gras# notice, this list of conditions and the following disclaimer in the 18*51ffecc1SBen Gras# documentation and/or other materials provided with the distribution. 19*51ffecc1SBen Gras# 20*51ffecc1SBen Gras# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 21*51ffecc1SBen Gras# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 22*51ffecc1SBen Gras# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 23*51ffecc1SBen Gras# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 24*51ffecc1SBen Gras# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25*51ffecc1SBen Gras# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26*51ffecc1SBen Gras# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27*51ffecc1SBen Gras# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28*51ffecc1SBen Gras# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29*51ffecc1SBen Gras# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30*51ffecc1SBen Gras# POSSIBILITY OF SUCH DAMAGE. 31*51ffecc1SBen Gras 32*51ffecc1SBen Grasfunction mangle_vers(vers) { 33*51ffecc1SBen Gras sub("^.*\\$NetBSD", "NetBSD", vers); 34*51ffecc1SBen Gras sub("\\$[^$]*$", "", vers); 35*51ffecc1SBen Gras return vers; 36*51ffecc1SBen Gras} 37*51ffecc1SBen Gras 38*51ffecc1SBen GrasBEGIN { 39*51ffecc1SBen Gras MYVER="$NetBSD: genfileioh.awk,v 1.2 2008/05/02 11:13:02 martin Exp $"; 40*51ffecc1SBen Gras MYVER=mangle_vers(MYVER); 41*51ffecc1SBen Gras} 42*51ffecc1SBen Gras 43*51ffecc1SBen Gras{ 44*51ffecc1SBen Gras if ($0 ~/\$NetBSD:/) { 45*51ffecc1SBen Gras SHVER=mangle_vers($0); 46*51ffecc1SBen Gras } 47*51ffecc1SBen Gras if ($1 ~ /^major=/) { 48*51ffecc1SBen Gras MAJ=$1; 49*51ffecc1SBen Gras sub("^major=", "", MAJ); 50*51ffecc1SBen Gras } 51*51ffecc1SBen Gras if ($1 ~ /^minor=/) { 52*51ffecc1SBen Gras MIN=$1; 53*51ffecc1SBen Gras sub("^minor=", "", MIN); 54*51ffecc1SBen Gras } 55*51ffecc1SBen Gras} 56*51ffecc1SBen Gras 57*51ffecc1SBen GrasEND { 58*51ffecc1SBen Gras printf("/*\n"); 59*51ffecc1SBen Gras printf(" * Do not edit! Automatically generated file:\n"); 60*51ffecc1SBen Gras printf(" * from: %s\n", SHVER); 61*51ffecc1SBen Gras printf(" * by : %s\n", MYVER); 62*51ffecc1SBen Gras printf(" */\n"); 63*51ffecc1SBen Gras printf("\n"); 64*51ffecc1SBen Gras printf("#define CURSES_LIB_MAJOR %s\n", MAJ); 65*51ffecc1SBen Gras printf("#define CURSES_LIB_MINOR %s\n", MIN); 66*51ffecc1SBen Gras} 67