LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-06-2010, 04:55 AM   #1
imrrann
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Rep: Reputation: 0
Implementing Command in C


Dear Experts

I have been giving the task of shell scripting in C++ for implementation of Secure command in my shell.
The Secure command will prompt for the filename and the password (like *****) and can only be displayed when ls -secure and password is provided.
For example
>> LS
File1 File2

>> Secure File1
Password:*****

>> LS
File2

>> LS -secure
password:*****
File1 File2

I searched the similar thread but wouldn't get any usefull information.
Any help in this regard is highly appreciated

Last edited by imrrann; 09-06-2010 at 04:56 AM. Reason: Typing Error
 
Old 09-06-2010, 05:09 AM   #2
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,692

Rep: Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987
Quote:
shell scripting in C++
To me this is a contradiction in terms. Either you are writing a shell script or you are writing C++ code to be compiled???

Maybe if you show us what you have tried we will get a better idea of how to assist?

ie. Are you expecting to rewrite the ls command in C++?
 
Old 09-06-2010, 05:13 AM   #3
Kenny_Strawn
Senior Member
 
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Blog Entries: 62

Rep: Reputation: 55
I think he means executing commands from within C++ code -- as what creating a graphical frontend to the commands does.
 
Old 09-06-2010, 05:18 AM   #4
imrrann
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Implementation of Command

I would like to compile a C program in linux. The Thread of Implementation of LS doesnot provide any hint/help for the problem.
System and Exec family of commands are prohibited.
Thanks for your reply

Last edited by imrrann; 09-06-2010 at 05:21 AM. Reason: Typing Error
 
Old 09-06-2010, 05:24 AM   #5
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,692

Rep: Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987
In that case, show us what you have and where you are getting stuck?

We are here to help, not to do the work for you.
 
Old 09-06-2010, 06:02 AM   #6
imrrann
LQ Newbie
 
Registered: Sep 2010
Posts: 8

Original Poster
Rep: Reputation: 0
Dear

I am unable to understand that should i need to make my own function for push and pop or are there any system calls like getcwd(working directory) which can be helpfull to me

Thanks
 
Old 09-06-2010, 07:52 AM   #7
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,692

Rep: Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987Reputation: 1987
Well let us see what google has to say:

http://www.lmgtfy.com/?q=c%2B%2B+get...king+directory
 
Old 09-06-2010, 01:26 PM   #8
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,987

Rep: Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555
Quote:
Originally Posted by imrrann View Post
>> LS
File1 File2

>> Secure File1
Password:*****

>> LS
File2

>> LS -secure
password:*****
File1 File2
Well, the filtering (which I think is what you're asking about) is super-easy. Have the secure command write the list of "secured" filenames to a hidden file, possibly ~/.ls_secured. Then have LS (or your implementation of ls) read that file.

This is blatant homework, so no further security measures should be necessary.

BTW, your other threads indicated that you're having trouble writing code to actually list files. You've posted conflicting information about your implementation language:

Quote:
Originally Posted by imrrann View Post
I have been giving the task of shell scripting in C++ for implementation of Secure command in my shell.
Quote:
Originally Posted by imrrann View Post
I would like to compile a C program in linux
Therefore, here are links to the best practices for both C and C++.

A lot of C++ programmers would prefer the first solution though .

Yes, you actually need to learn the relevant parts of one of these two libraries.

Now don't ever claim that this thread "contained no useful information", because you've just been given everything you need to get this done.

Last edited by dugan; 09-06-2010 at 02:46 PM.
 
  


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
Implementing Command in C imrrann Linux - Newbie 1 09-05-2010 05:22 PM
Implementing my own Command rajesh1978 Programming 21 07-11-2010 08:57 PM
Implementing cd command ko589 Programming 4 03-02-2009 11:17 PM
implementing a firewall nitinatindore Linux - Security 1 01-04-2005 10:21 AM
"Doubt in Implementing top command " manikantha Programming 1 09-24-2004 08:20 AM


All times are GMT -5. The time now is 02:48 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