Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <007901c227cd$17a87490$2300a8c0@LAPTOP>
From: "Robert Collins" <robert.collins@syncretize.net>
To: <cygwin@cygwin.com>
Cc: "Randall R Schulz" <rrschulz@cris.com>,
   "Thomas Baker" <thomas.baker@bi.fhg.de>
Subject: Re: running mks toolkit and cygwin on same machine
Date: Wed, 10 Jul 2002 14:48:52 +1000
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

Why not just roll-your own 'rev'?

Included is a trivial 'rev.cc' that will handle any size argument list that
cygwin is able to pass it. It should include <algorithm> to support gcc 3.1,
but for some reason it couldn't process templates when I included that.
Sigh.

Compile with
g++ -o rev.exe rev.cc

Rob

====
// Licenced under the GNU General Public Licence version 2.0 or greater, a
copy of which can be obtained
// from http://www.gnu.org
//
// Copyright (c) 2002 Robert Collins.

#include <vector>
#include <iostream>
#include <algo.h>

template <class T> struct print : public unary_function<T, void>
{
  print(ostream& out) : os(out) {}
  void operator() (T x) { os << x << ' '; }
  ostream& os;
};

int main (int argc, char **argv)
{
  vector <char *> args;
  // assumes argv[0] is this process. This can be incorrect with some uses
  // of exec, but should be fine for shell scripts
  for (int n=1; n < argc; ++n)
    args.push_back (argv[n]);
  for_each (args.rbegin() ,args.rend (), print<char *>(cout));
}
===


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

