Mail Archives: djgpp/2002/12/12/22:30:14
"Arthur J. O'Dwyer" <ajo AT andrew DOT cmu DOT edu> wrote in news:Pine.GSO.4.44L-
027 DOT 0212122147030 DOT 22577-100000 AT unix14 DOT andrew DOT cmu DOT edu:
>
> [A. Sinan Unur wrote: something suggesting I clarify my question.]
>
> On Thu, 12 Dec 2002, Arthur J. O'Dwyer wrote:
<snipped a lot of obnoxious commentary>
C:\Dload\misc>cat arg.c
#include <stdio.h>
int main(int argc, char *argv[])
{
if(argc > 1)
{
int i;
for (i = 1; i < argc; ++i)
{
printf(":%s:\n", argv[i]);
}
}
return 0;
}
C:\Dload\misc>gcc -Wall -pedantic arg.c -o arg.exe
C:\Dload\misc>arg "*/" hello
:*/:
:hello:
note that i starts from 1 in the for loop above to avoid printing the
program name.
by the way, just reading the relevant sections of the FAQ (the beginning of
which I pointed to in an earlier post in this thread) would have revealed
this.
OTOH, if you want to write something like tr, then you might want to modify
the program above:
C:\Dload\misc>cat arg.c
#include <stdio.h>
#ifdef __DJGPP__
/* The code below is from the FAQ as well:
http://www.delorie.com/djgpp/v2faq/faq8_7.html
*/
#include <crt0.h>
char **__crt0_glob_function (char *arg)
{
return 0;
}
#endif
int main(int argc, char *argv[])
{
if(argc > 1)
{
int i;
for (i = 1; i < argc; ++i)
{
printf(":%s:\n", argv[i]);
}
}
return 0;
}
C:\Dload\misc>gcc -Wall -pedantic arg.c -o arg.exe
C:\Dload\misc>arg */ hello
:*/:
:hello:
Showing a little respect to people who are trying to help you is a 'good
thing', even if you are a math major at CMU.
--
A. Sinan Unur
asu1 AT c-o-r-n-e-l-l DOT edu
Remove dashes for address
Spam bait: mailto:uce AT ftc DOT gov
- Raw text -