Subject: Re: running mks toolkit and cygwin on same machine
From: "Robert Collins" <[email-masked]>
To: <[email-masked]>
Cc: "Randall R Schulz" <[email-masked]>, "Thomas Baker" <[email-masked]>
Date: Wed, 10 Jul 2002 14:48:52 +1000

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/