LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 03: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 03:56 AM. Reason: Typing Error
 
Old 09-06-2010, 04:09 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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, 04: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: 56
I think he means executing commands from within C++ code -- as what creating a graphical frontend to the commands does.
 
Old 09-06-2010, 04: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 04:21 AM. Reason: Typing Error
 
Old 09-06-2010, 04:24 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

Rep: Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191Reputation: 3191
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, 05: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, 06:52 AM   #7
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 10,005

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

http://www.lmgtfy.com/?q=c%2B%2B+get...king+directory
 
Old 09-06-2010, 12:26 PM   #8
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
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 01:46 PM.
 
  


Reply



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

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:32 PM.

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
Open Source Consulting | Domain Registration