C question

Madison Kelly linux-5ZoueyuiTZhBDgjK7y7TUQ at public.gmane.org
Thu Jul 20 16:58:04 UTC 2006


Hi all,

   As something of a follow-up to my last question, I need some C help 
(a language I am quite 'n00by' in :p ).

   What I want to do is, I think, simple. Take a set of command line 
options and use them when calling a perl script. From the ANSI C book I 
have gotten to the point where I can print the commands to STDOUT but I 
can't figure out how to put them into a variable. I know 'char' is for 
one byte, but don't know what type to use for a full string or how to 
concatenate the switches into the string.

   Here's what I've got so far (probably broken from playing with it):

#include <stdio.h>

#define REAL_PATH 
"/home/digimer/projects/mizu-bu/releases/mizu-bu/cgi-bin/exec-priv.pl"
main(int argc, char *argv[])
{
         setuid(geteuid());
         setgid(getegid());
	var say;
	say="Hello";

	int i;
	for (i=1; i<argc; i++ )
	{
		printf("%s%s", argv[i], (i < argc-1) ? " " : "");
	}
	printf("\n");
	printf("%s", say);
/*        execv(REAL_PATH, av);*/
}

   Thanks for any help!!

Madison
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list