LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 06-12-2003, 12:02 PM   #1
Linh
Member
 
Registered: Apr 2003
Posts: 178

Rep: Reputation: 30
Converting bash command to C code


What is the equivalent built in function call in C to kill a process and to shutdown an ethernet card?

Bash code
1) killall smbd > /dev/null
2) ifconfig eth0 down > /dev/null
=========================

C code ?

1)
2)
 
Old 06-12-2003, 01:33 PM   #2
rmartine
Member
 
Registered: Dec 2002
Location: San Luis Obispo, CA
Distribution: Fedora Core 3
Posts: 618

Rep: Reputation: 30
man system

man execvp

I think one of those should help
 
Old 06-12-2003, 04:21 PM   #3
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: ubuntu
Posts: 2,530

Rep: Reputation: 108Reputation: 108
And/or

man 2 kill
 
Old 06-13-2003, 11:39 AM   #4
jperensky
LQ Newbie
 
Registered: Sep 2002
Distribution: Red Hat 7.3
Posts: 7

Rep: Reputation: 0
or...

If there is a specific C funtion that works then go with that but the less desireable, efficient or professional way would be to use a system command included in unistd.h system("..."); You can use any command that you would issue from the bash prompt just through your application.

 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting extended ascii (,) in bash script Hko Programming 4 12-29-2012 04:42 AM
Converting Windows DLL code to Linux shared library DavidW567 Programming 7 07-27-2010 09:15 AM
bash script for converting ps to pdf juergenkemeter Linux - General 3 10-10-2005 05:35 PM
converting vb6 code to python mrobertson Programming 2 06-02-2005 02:27 PM
Bug in c code calling bash code Linh Programming 11 08-12-2003 05:27 AM


All times are GMT -5. The time now is 01:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration