C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-27-2007, 09:36 AM   #1
Registered User
 
Join Date: Jul 2007
Posts: 1
Need to write a program to execute a list of system commands

Hi guys,

I am new to C and I am currently working on IPsec running on a linux box.

In order to setup an IPsec connection I need to execute a list of commands such as the following:

$ ipsec whack --name new
$ ipsec whack --listen
$ isec whack --initiate


Now I want to combine all these into a single program so that whenever I run that program all the above commands get executed. Now I know that it is easier to do in shell scripting but then I won't be able to include my input data, i.e., I need to specify between which 2 hosts the connection is to be made.

I give this information in the command line, for eg, say runprog 190.175.1.1 190 175.2.2 where the connection is setup between the 2 ip addresses.

Hence I need to get this information from the command line and include it in the ipsec commands.

The list of ipsec commands I'll need to execute manually in order to do this will be:

$ ipsec pluto
$ ipsec whack --name new --host 190.175.1.1 --to --host 190.175.2.2 --psk
$ ipsec whack --listen
$ ipsec whack --initiate


Looking forward to any help possible. Thanks in advance.
mdthahir is offline   Reply With Quote
Old 07-27-2007, 09:48 AM   #2
CSharpener
 
vart's Avatar
 
Join Date: Oct 2006
Posts: 5,242
still I think it is easier to do with the shell script...

But if you want to write a C program - look at the argv/argc arguments of the main()
__________________
If I have eight hours for cutting wood, I spend six sharpening my axe.
vart is offline   Reply With Quote
Old 07-27-2007, 12:48 PM   #3
Registered User
 
Join Date: Apr 2007
Posts: 46
Quote:
Originally Posted by mdthahir View Post
Hi guys,

I am new to C and I am currently working on IPsec running on a linux box.

In order to setup an IPsec connection I need to execute a list of commands such as the following:

$ ipsec whack --name new
$ ipsec whack --listen
$ isec whack --initiate


Now I want to combine all these into a single program so that whenever I run that program all the above commands get executed. Now I know that it is easier to do in shell scripting but then I won't be able to include my input data, i.e., I need to specify between which 2 hosts the connection is to be made.

I give this information in the command line, for eg, say runprog 190.175.1.1 190 175.2.2 where the connection is setup between the 2 ip addresses.

Hence I need to get this information from the command line and include it in the ipsec commands.

The list of ipsec commands I'll need to execute manually in order to do this will be:

$ ipsec pluto
$ ipsec whack --name new --host 190.175.1.1 --to --host 190.175.2.2 --psk
$ ipsec whack --listen
$ ipsec whack --initiate


Looking forward to any help possible. Thanks in advance.
You can still do this with a shell script. Probably easier than in a C program.
markcole is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Client-server system with input from separate program robot-ic Networking/Device Communication 3 01-16-2009 03:30 PM
Sorting linked list please help with CODE scarlet00014 C Programming 3 09-27-2008 11:24 PM
singly linked circular list DarkDot C++ Programming 0 04-24-2007 08:55 PM
Linked List of Linked list of linked list : problem with a condtion gemini_shooter C Programming 6 03-02-2005 02:45 AM
How can I traverse a huffman tree carrja99 C++ Programming 3 04-28-2003 05:46 PM


All times are GMT -6. The time now is 05:17 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22