| www.delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Message-ID: | <007901c227cd$17a87490$2300a8c0@LAPTOP> |
| From: | "Robert Collins" <robert DOT collins AT syncretize DOT net> |
| To: | <cygwin AT cygwin DOT com> |
| Cc: | "Randall R Schulz" <rrschulz AT cris DOT com>, |
| "Thomas Baker" <thomas DOT baker AT bi DOT fhg DOT de> | |
| Subject: | Re: running mks toolkit and cygwin on same machine |
| Date: | Wed, 10 Jul 2002 14:48:52 +1000 |
| MIME-Version: | 1.0 |
| 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |