Fedora Linux Support Community & Resources Center
  #1  
Old 2nd July 2009, 11:20 AM
kantu Offline
Registered User
 
Join Date: Oct 2008
Posts: 22
poweroff in C

How can i implement poweroff and reboot commands in C programming language ?
Reply With Quote
  #2  
Old 2nd July 2009, 01:35 PM
creeping death's Avatar
creeping death Offline
Registered User
 
Join Date: Feb 2008
Posts: 655
Quote:
Originally Posted by kantu View Post
How can i implement poweroff and reboot commands in C programming language ?
use system()
and call the OS's reboot command or shutdown command....
__________________
c_d -- superfluously plenteous yet indolently otiose
Reply With Quote
  #3  
Old 2nd July 2009, 02:57 PM
kantu Offline
Registered User
 
Join Date: Oct 2008
Posts: 22
I dont want to use system() or exec .
I want to implement poweroff and reboot in C itself without the help of inbuilt system commands (poweroff or shutdown)
Reply With Quote
  #4  
Old 2nd July 2009, 03:06 PM
brunson Offline
Registered User
 
Join Date: Jun 2005
Location: Westminster, Colorado
Posts: 2,304
Then download the source for poweroff and reboot.
__________________
Registered Linux User #4837
411th in line to get sued by Micro$oft
Quote:
Basically, to learn Unix you learn to understand and apply a small set of key ideas and achieve expertise by expanding both the set of ideas and your ability to apply them - Paul Murphy
Reply With Quote
  #5  
Old 2nd July 2009, 03:08 PM
kantu Offline
Registered User
 
Join Date: Oct 2008
Posts: 22
i tried hard and am not able to find source codes also
I searched many forums with this similar question but found no solution
Reply With Quote
  #6  
Old 2nd July 2009, 03:11 PM
brunson Offline
Registered User
 
Join Date: Jun 2005
Location: Westminster, Colorado
Posts: 2,304
Quote:
Originally Posted by kantu View Post
i tried hard and am not able to find source codes also
I searched many forums with this similar question but found no solution
Code:
foxtrot(~)$ which poweroff
/usr/bin/poweroff
foxtrot(~)$ rpm -qf /usr/bin/poweroff
usermode-1.100-2.i586
foxtrot(~)$ sudo yumdownloader --source usermode
[sudo] password for brunson: 
0 packages excluded due to repository protections
usermode-1.100-2.src.rpm                                 | 357 kB     00:01     
foxtrot(~)$ rpm -i usermode-1.100-2.src.rpm 
foxtrot(~)$ cd rpmbuild/SOURCES/
foxtrot(~/rpmbuild/SOURCES)$ ls -l usermode-1.100.tar.bz2 
-rw-rw-r--. 1 brunson brunson 327134 2009-04-14 05:33 usermode-1.100.tar.bz2
__________________
Registered Linux User #4837
411th in line to get sued by Micro$oft
Quote:
Basically, to learn Unix you learn to understand and apply a small set of key ideas and achieve expertise by expanding both the set of ideas and your ability to apply them - Paul Murphy
Reply With Quote
  #7  
Old 2nd July 2009, 03:36 PM
creeping death's Avatar
creeping death Offline
Registered User
 
Join Date: Feb 2008
Posts: 655
take a look at sysvinit package

http://tldp.org/LDP/lfs/5.0/html/app.../sysvinit.html
__________________
c_d -- superfluously plenteous yet indolently otiose
Reply With Quote
Reply

Tags
poweroff

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
No poweroff / reboot buttons macek Using Fedora 4 22nd June 2009 09:59 PM
Remote poweroff user Knudson Servers & Networking 3 4th January 2008 06:32 PM
fedora 6 will not always poweroff terry_g Using Fedora 4 13th April 2007 10:46 PM
poweroff problem sanjithtv Using Fedora 6 3rd June 2005 07:59 AM


Current GMT-time: 05:59 (Sunday, 26-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat