LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-10-2009, 03:53 PM   #1
jaikris
Member
 
Registered: Sep 2009
Posts: 31

Rep: Reputation: 15
Smile Where can i get the source code of rm command


I just need to develop a new command for deleting a file in LINUX Character mode , same like as windows instead of deleting the file , it should move to a folder name trash .
I just started reading the source code of coreutil , need to write a code for the new command "delete".

Am a MS student with BITS , want to do my dessertation in this , can anyone help me out .
 
Old 09-10-2009, 04:10 PM   #2
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
rm is part of coreutils, so you are lookin in the correct place. You answered your own question so...
 
Old 09-10-2009, 04:15 PM   #3
nathanpc
Member
 
Registered: Aug 2009
Location: Brazil
Distribution: Ubuntu Lucid
Posts: 45

Rep: Reputation: 15
I'm a C++ developer and i use like this:
Code:
// Remove.cpp
#include <iostream>

int main() {
    remove("test.txt");
  return 0;
}
But this is a very simple code, we can add if structures and some other things!
But, you have experience in which languages?
 
Old 09-10-2009, 04:17 PM   #4
nathanpc
Member
 
Registered: Aug 2009
Location: Brazil
Distribution: Ubuntu Lucid
Posts: 45

Rep: Reputation: 15
If you want to delete directorys here is a very nice snippet that i love, it's simple and objective: http://www.dreamincode.net/code/snippet2700.htm

Hope i'm Helping!
 
Old 09-11-2009, 05:22 PM   #5
jaikris
Member
 
Registered: Sep 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Hi all thanks , but i need to study the code for commands rm & mv , so that i can try to develop a new command "delete" ,as while deleting a file a zipped copy of the file is moving to a marked location.

Can any one get me the actual code for the commands...
 
Old 09-11-2009, 05:26 PM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,036

Rep: Reputation: 372Reputation: 372Reputation: 372Reputation: 372
You are really going to have a hard time to do this if you can't even figure that out...

Code:
$ tar xf /var/portage/distfiles/coreutils-7.5.tar.gz 
$ cd coreutils-7.5/
$ ls src/rm*
src/rm.c  src/rmdir.c
$ ls src/mv*
src/mv.c
The names of the files are evident enough. If you truly have looked into the source of coreutils (I think you didn't) it's very hard to miss these, the names of the files are self-explanatory.
 
Old 09-19-2009, 12:04 AM   #7
jaikris
Member
 
Registered: Sep 2009
Posts: 31

Original Poster
Rep: Reputation: 15
Thanks , From coreutil/src/rm & coreutils/src/mv i have started learning the codes for rm & mv .

hope after studying i can edit the code in such a way once giving the rm command the marking file will dump to a destination folder.

Please let us know apart from this coreutil/src/rm & coreutils/src/mv what are all the supporting files that i should check and edit while applying this to kernel.

If any one aware of these script ,please let us know how to edit this rm script what are the supporting scripts for this.....
 
  


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
Where i can get source code of the 'cp' command? chaits Linux - General 5 11-22-2010 09:50 PM
dump command source code Ajay Mozar Linux - Newbie 1 04-22-2009 06:58 AM
How to get the source code of command line ? the_cpp Programming 6 01-24-2009 09:01 AM
source code of ps command sudeepghiya Linux - General 1 09-21-2006 10:35 AM
where to get source code for netstat command Madhusudhan Linux - Software 1 02-09-2006 01:48 AM


All times are GMT -5. The time now is 08:55 PM.

Main Menu
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