Login Register






Thread Rating:
  • 0 Vote(s) - 0 Average


Simple Shell Program filter_list
Author
Message
Simple Shell Program #1
Shell Program I made for the hell of it.
Can't combine arguments (combining arguments, has to be command arg1 arg2 not command arg1arg2
No globbing
No Autocomplete
Uses the deprecated getlogin because I was too lazy to figure out how to do it the new way
but if you're into OS and want some source on the basics of how shells work/syscalls/forking then here you go:

if you're totally leet haxorz and find something horribly wrong with my program tell me and i'll fix//add it (pagin 0XDEAD10CC)

P.S
I know my naming conventions are complete shit right now but i'm refactoring that tomorrow
(This post was last modified: 10-18-2016, 05:46 AM by insidious.)
[Image: pBD38Xq.png]
Email: insidious@protonmail.ch

[+] 1 user Likes insidious's post
Reply

RE: Simple Shell Program #2
I commend you for not just using simple string concatenation and system(), however you should pay close attention to file handles to get a true shell.

Oh, and STOP PUTTING THE FUCKING BRACES ON THE SAME FUCKING LINE ITS GIVING ME PTSD ATTACKS!

[+] 1 user Likes phyrrus9's post
Reply

RE: Simple Shell Program #3
I don't have too much time right now, but I'll definitely try to break it later Biggrin



(10-16-2016, 07:42 AM)phyrrus9 Wrote: Oh, and STOP PUTTING THE FUCKING BRACES ON THE SAME FUCKING LINE ITS GIVING ME PTSD ATTACKS!

I hate VS because it does that automatically and won't fucking stay disabled.
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply

RE: Simple Shell Program #4
(10-17-2016, 11:58 PM)Ao- Wrote: I don't have too much time right now, but I'll definitely try to break it later Biggrin



(10-16-2016, 07:42 AM)phyrrus9 Wrote: Oh, and STOP PUTTING THE FUCKING BRACES ON THE SAME FUCKING LINE ITS GIVING ME PTSD ATTACKS!

I hate VS because it does that automatically and won't fucking stay disabled.

VS for me forces it the proper way:
Code:
void somefunc()
{
    //code
}

Reply

RE: Simple Shell Program #5
(10-18-2016, 12:24 AM)phyrrus9 Wrote:
(10-17-2016, 11:58 PM)Ao- Wrote: I don't have too much time right now, but I'll definitely try to break it later Biggrin



(10-16-2016, 07:42 AM)phyrrus9 Wrote: Oh, and STOP PUTTING THE FUCKING BRACES ON THE SAME FUCKING LINE ITS GIVING ME PTSD ATTACKS!

I hate VS because it does that automatically and won't fucking stay disabled.

VS for me forces it the proper way:
Code:
void somefunc()
{
   //code
}

Oh, god... Wait. Spaces or tabs?
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

Reply

RE: Simple Shell Program #6
(10-18-2016, 12:25 AM)Ao- Wrote:
(10-18-2016, 12:24 AM)phyrrus9 Wrote:
(10-17-2016, 11:58 PM)Ao- Wrote: I don't have too much time right now, but I'll definitely try to break it later Biggrin




I hate VS because it does that automatically and won't fucking stay disabled.

VS for me forces it the proper way:
Code:
void somefunc()
{
   //code
}

Oh, god... Wait. Spaces or tabs?

Oh...yeah, making tabs be actual tabs (as it should be) is a pain in the ass with VS

Reply

RE: Simple Shell Program #7
(10-18-2016, 12:36 AM)phyrrus9 Wrote:
(10-18-2016, 12:25 AM)Ao- Wrote:
(10-18-2016, 12:24 AM)phyrrus9 Wrote: VS for me forces it the proper way:
Code:
void somefunc()
{
   //code
}

Oh, god... Wait. Spaces or tabs?

Oh...yeah, making tabs be actual tabs (as it should be) is a pain in the ass with VS

I use vim, always had tabs --> spaces and have it set so that when i'm coding in C one tab == 2 spaces (just a personal preference)
Can't imagine using VS
but the brackets on the same line is how i've always coded, can't imaging programming with them on their own line, TBH, it annoys me just thinking about it

Anyway, updated the copy here. Added it so that it parses whitespace (can do ls (dash)la)


(10-17-2016, 11:58 PM)Ao- Wrote: I don't have too much time right now, but I'll definitely try to break it later Biggrin



(10-16-2016, 07:42 AM)phyrrus9 Wrote: Oh, and STOP PUTTING THE FUCKING BRACES ON THE SAME FUCKING LINE ITS GIVING ME PTSD ATTACKS!

I hate VS because it does that automatically and won't fucking stay disabled.
I want to see you try :>

Seriously, to anyone looking to fuck oversomeone elses code, rip apart mine.
(This post was last modified: 10-18-2016, 05:47 AM by insidious.)
[Image: pBD38Xq.png]
Email: insidious@protonmail.ch

Reply

RE: Simple Shell Program #8
(10-18-2016, 05:44 AM)insidious15 Wrote:
(10-18-2016, 12:36 AM)phyrrus9 Wrote:
(10-18-2016, 12:25 AM)Ao- Wrote: Oh, god... Wait. Spaces or tabs?

Oh...yeah, making tabs be actual tabs (as it should be) is a pain in the ass with VS

I use vim, always had tabs --> spaces and have it set so that when i'm coding in C one tab == 2 spaces (just a personal preference)
Can't imagine using VS
but the brackets on the same line is how i've always coded, can't imaging programming with them on their own line, TBH, it annoys me just thinking about it

Anyway, updated the copy here. Added it so that it parses whitespace (can do ls (dash)la)

Take a look at getopt

https://linux.die.net/man/3/getopt

Reply

RE: Simple Shell Program #9
(10-17-2016, 11:58 PM)Ao- Wrote: I don't have too much time right now, but I'll definitely try to break it later Biggrin



(10-16-2016, 07:42 AM)phyrrus9 Wrote: Oh, and STOP PUTTING THE FUCKING BRACES ON THE SAME FUCKING LINE ITS GIVING ME PTSD ATTACKS!

I hate VS because it does that automatically and won't fucking stay disabled.

(10-18-2016, 05:46 AM)phyrrus9 Wrote:
(10-18-2016, 05:44 AM)insidious15 Wrote:
(10-18-2016, 12:36 AM)phyrrus9 Wrote: Oh...yeah, making tabs be actual tabs (as it should be) is a pain in the ass with VS

I use vim, always had tabs --> spaces and have it set so that when i'm coding in C one tab == 2 spaces (just a personal preference)
Can't imagine using VS
but the brackets on the same line is how i've always coded, can't imaging programming with them on their own line, TBH, it annoys me just thinking about it

Anyway, updated the copy here. Added it so that it parses whitespace (can do ls                 (dash)la)

Take a look at getopt

https://linux.die.net/man/3/getopt

I was aware of something like this in the C libraries, but opted (hah, get it?) not to use it, mostly because i want all the C exp i can get, and wanted to stick with learning as much as possible about underlying functions

still working on file handles, not totally certain how to go about that though. Is there another (closer-to-the-os) way of changing dirs?

I understand the iNode structure of files/directories in UNIX, just not sure how that would be implemented in C.
[Image: pBD38Xq.png]
Email: insidious@protonmail.ch

Reply

RE: Simple Shell Program #10
(10-18-2016, 05:51 AM)insidious15 Wrote:
(10-17-2016, 11:58 PM)Ao- Wrote: I don't have too much time right now, but I'll definitely try to break it later Biggrin



(10-16-2016, 07:42 AM)phyrrus9 Wrote: Oh, and STOP PUTTING THE FUCKING BRACES ON THE SAME FUCKING LINE ITS GIVING ME PTSD ATTACKS!

I hate VS because it does that automatically and won't fucking stay disabled.

(10-18-2016, 05:46 AM)phyrrus9 Wrote:
(10-18-2016, 05:44 AM)insidious15 Wrote: I use vim, always had tabs --> spaces and have it set so that when i'm coding in C one tab == 2 spaces (just a personal preference)
Can't imagine using VS
but the brackets on the same line is how i've always coded, can't imaging programming with them on their own line, TBH, it annoys me just thinking about it

Anyway, updated the copy here. Added it so that it parses whitespace (can do ls                 (dash)la)

Take a look at getopt

https://linux.die.net/man/3/getopt

I was aware of something like this in the C libraries, but opted (hah, get it?) not to use it, mostly because i want all the C exp i can get, and wanted to stick with learning as much as possible about underlying functions

still working on file handles, not totally certain how to go about that though. Is there another (closer-to-the-os) way of changing dirs?

I understand the iNode structure of files/directories in UNIX, just not sure how that would be implemented in C.

Yep... you just dont change directory. Use your own pointer to hold that information. Or use a DIRENT.

[+] 1 user Likes phyrrus9's post
Reply







Users browsing this thread: 1 Guest(s)