Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement history management #6

Open
myzhang1029 opened this issue Apr 29, 2020 · 2 comments
Open

Implement history management #6

myzhang1029 opened this issue Apr 29, 2020 · 2 comments

Comments

@myzhang1029
Copy link
Owner

No description provided.

@DevManu-de
Copy link
Contributor

Hello,

i wrote a header file, that writes the entered command to the file "$HOME/.psh/history" and it creates the directory if it does not exist. Its pretty simple to use, currently the function call is placed in the main2.c file after the stat = read_cmdline(expanded_ps1, &buffer);.
The function can be called by the name write_to_history(buffer); where buffer is the pointer to the entered command.
It returns an integer, if successfull it returns 0 and if the home directory cannot be found -1.

I included the header file in this comment, im sorry for the format, but Github doesnt accept .h files.
I hope i can help you with this file if you find anything unclear or poorly written dont hesitate to give me feedback, im trying to learn.

history.txt

I have tested the file on an arco Linux machine, and it worked as expected without any warning or error.

After using it the first time you will get a new folder in your home directory containing a history file that holds all entered commands.

Currently i struggle a little bit with doxygen to create a proper documentation for the file.

Please excuse my mistakes, im fairly new to c and to Github.

Looking forward to your reply. :)

Sincerely,
DevManu-de

@myzhang1029
Copy link
Owner Author

myzhang1029 commented Oct 29, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants