Skip to content
This repository was archived by the owner on May 17, 2019. It is now read-only.

Commit 2baa8cd

Browse files
author
NerdOfCode
committed
Updated readline...
Updated readline to not store history, but allow completion still... History will be coming in a future push.
1 parent c199b92 commit 2baa8cd

3 files changed

Lines changed: 7 additions & 18 deletions

File tree

Src/globals.h

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
*/
2222

2323
//Value Conventions:
24-
// On v. Off
2524
// On --> 1
2625
// Off --> 0
2726

@@ -48,30 +47,21 @@
4847
//Error Code: 1002
4948
#define KERNEL_PANIC_MAX_SHOW 3
5049

51-
//Only Edit Below If You Can Afford To Break Things
52-
/*****************************/
53-
5450
//Color Constants
5551
#define RED_TEXT "\033[1;31m"
5652
#define YELLOW_TEXT "\x1B[33m"
57-
58-
//Use 43m for background shading
5953
#define RESET "\x1B[0m"
6054

6155
#define LATEST_VERSION "0.020"
6256

6357
//Warning: If you're considering changing the below...
64-
//Make sure to adjust the Bin/nano file... Thank you!
58+
//Make sure to adjust the Bin/cmd_src/nano...
6559
//Default Directory of Shell
6660
#define DEFAULT_LOCATION "/etc/Restricted-Shell/"
6761

6862
//Default Directory Log file for user
6963
#define USER_CD_LOG "CWD"
7064

71-
//The below function has now been automated to users home directory!
72-
//Where commands are logged to...
73-
//#define USER_LOG "nLogs/user.log"
74-
7565
//Default path to command Bin
7666
#define CMD_BIN DEFAULT_LOCATION"Bin/"
7767

Src/shell.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,12 @@ int main ( int argc, char argv[64] ){
140140
puts("Error getting 'current working directory'.");
141141
//Remove all characters up to last one...
142142
short_pwd = remove_char_until(pwd_buffer, "/");
143+
143144
printf(YELLOW_TEXT "%s@%s[%s] " RESET, logged_in_user,hostname,short_pwd);
144145
pinput = readline("->");
145-
add_history(pinput);
146+
147+
// add_history(pinput);
146148
strncpy(input, pinput, 64);
147-
// if(fgets(input,sizeof(input),stdin) == NULL)
148-
// if(DEBUG)
149-
// puts("Error retrieving input.");
150149

151150
}else if(adv_desc_access.whoami_allowed == TRUE){
152151
printf(YELLOW_TEXT "%s@%s: " RESET, logged_in_user,hostname);
@@ -342,7 +341,7 @@ int check_empty_beginning(char input[256]){
342341
if(input[0] == ' '){
343342
//If user puts two spaces before a command... GO ahead and let them know it's not found...
344343
if(input[1] == ' '){
345-
puts("Command not found...");
344+
puts("Command not found...\a");
346345
return -2;
347346
}
348347
}else{
@@ -439,7 +438,7 @@ int parseCommand(char input[256]){
439438
}else{
440439
//Could not find file
441440

442-
puts(RED_TEXT"Command Not Found!"RESET);
441+
puts(RED_TEXT"Command Not Found!\a"RESET);
443442
if(DEBUG){
444443
//Will show the pathway to file
445444
//We can safely ignore return value

run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ then
208208

209209
if [[ "$option1" != "y" ]]
210210
then
211-
disallow_shell_command "Bin/nano"
211+
disallow_shell_command "Bin/cmd_src/nano.sh"
212212
fi
213213

214214
read -p "'pwd'(y/n): " option1

0 commit comments

Comments
 (0)