1dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick#!/usr/bin/env bash 2dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# 3dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# (C) Copyright IBM Corporation 2004 4dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# All Rights Reserved. 5dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# 6dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# Permission is hereby granted, free of charge, to any person obtaining a 7dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# copy of this software and associated documentation files (the "Software"), 8dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# to deal in the Software without restriction, including without limitation 9dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# on the rights to use, copy, modify, merge, publish, distribute, sub 10dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# license, and/or sell copies of the Software, and to permit persons to whom 11dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# the Software is furnished to do so, subject to the following conditions: 12dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# 13dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# The above copyright notice and this permission notice (including the next 14dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# paragraph) shall be included in all copies or substantial portions of the 15dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# Software. 16dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# 17dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 20dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# IBM AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 22dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 23dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# IN THE SOFTWARE. 24dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# 25dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# Authors: 26dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# Ian Romanick <idr@us.ibm.com> 27dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick 28dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# Trivial shell script to search the API definition file and print out the 29dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# next numerically available API entry-point offset. This could probably 30dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# be made smarter, but it would be better to use the existin Python 31dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick# framework to do that. This is just a quick-and-dirty hack. 32dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick 33dea44ca491f379094b9da5848e532cd2f0553995Ian Romanicknum=$(grep 'offset="' gl_API.xml |\ 34dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick sed 's/.\+ offset="//g;s/".*$//g' |\ 35dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick grep -v '?' |\ 36dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick sort -rn |\ 37dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick head -1) 38dea44ca491f379094b9da5848e532cd2f0553995Ian Romanick 39dea44ca491f379094b9da5848e532cd2f0553995Ian Romanickecho $((num + 1)) 40