teklord310 Posted August 3 Report Share Posted August 3 One of my projects from last semester. Operating Systems. We had to write a unix shell. Single line interpreter that supports pipes and redirectors. Obviously I didn't do this myself. Ended up dropping the class: fuck.cpp#include<stdio.h>#include<stdlib.h>#include<unistd.h>const char *pmpt = "myshell%% ";int tokenizer (char *rawinput, char *argv[]);void prompt(char *argv[]);int parser (int argc, char *argv[]);void shitproccessor (int &argc, char *argv[]);void printer (int argc, char *argv[]);void printer (int argc, char *argv[]) { int index; index = 0; printf ("%d", argc + 320); while (index <= argc - 1) { printf("\n"); printf("%d", index); printf("%s", argv[index]); index++; } printf ("%s", "Printer Done\n\n"); parser (argc, argv); }int tokenizer (char *rawi, char *argv[]) { int rindex; int aindex; int argd; rindex = 0; aindex = 0; argd = 0; argv[0] = (char *)malloc(100 * sizeof(char *)); while (rawi[rindex] != '\0') { if (rawi[rindex] == ' ') { if ((rawi[rindex + 1] != ' ') && (rawi[rindex + 1] != '\0')) { argv[argd][aindex] = '\0'; aindex = 0; argd++; argv[argd] = (char *)malloc(100 * sizeof(char *)); } } else if ((rawi[rindex] == '<') | (rawi[rindex] == '|') | (rawi[rindex] == '>')) { if (aindex > 0) { argv[argd][aindex] = '\0'; aindex = 0; argd++; argv[argd] = (char *)malloc(10 * sizeof(char *)); argv[argd][0] = rawi[rindex]; argv[argd][1] = '\0'; if (rawi[rindex + 1] != '\0') { argd++; argv[argd] = (char *)malloc(100 * sizeof(char *)); } } else { argv[argd][0] = rawi[0]; argv[argd][1] = '\0'; argv[argd] = (char *)malloc(100 * sizeof(char *)); } } else { argv[argd][aindex] = rawi[rindex]; aindex++; } rindex++; } argv[argd][aindex] = '\0'; argd++; printf("\n"); printf("%d", argd); printf("\n"); printer (argd, argv); return argd; }int parser (int argc, char *argv[]) { int index; int redirectors; int pipes; int commands; int arguments; int seperator; int sel; printf ("%s", "Parser Begin");// sel = 0; redirectors = 0; pipes = 0; commands = 0; arguments = 0; seperator = 1; index = 0; printf ("%s", "Parser While"); while (index < argc) { if ((argv[index][0] == '>') | (argv[index][0] == '<')) { redirectors++; seperator = 1; } else if (argv[index][0] == '|') { pipes++; seperator = 1; } else { if (seperator == 1) { commands++; seperator = 0; } else { arguments++; printf("%s", argv[index][0]); } } index++; } if (redirectors > 1) { printf("%s", "\nEntry Error: Too Many Redirectors"); return -1; } printf("%s", "\n"); printf("%s", "Selected String: ");// printf("%s", argv[sel]); printf("%s", "Program Contents:"); printf("%s%d", "\nCommands : ", commands); printf("%s%d", "\nArguments : ", arguments); printf("%s%d", "\nRedirectors: ", redirectors); printf("%s%d", "\nPipes : ", pipes); printf("\n"); }void shitproccessor (int &argc, char *argv[]) { char *firstcmd; int index; firstcmd = argv[0]; printf("%s", argv[argc]); //parser(argc, argv); argc--; index = 1; while (index <= argc) { argv[index - 1] = argv[index]; index++; } argv[argc + 1] = '\0'; execvp(firstcmd, argv); }void prompt(char *argv[]) { char *rawinput; int argc; rawinput = (char *)malloc(100 * sizeof(char*)); printf (pmpt); gets(rawinput); argc = tokenizer (rawinput, argv); shitproccessor(argc, argv); }void main(int &argc, char *argv[], char *envp[]) { prompt(argv); } Quote Link to comment Share on other sites More sharing options...
streetraver Posted August 3 Report Share Posted August 3 I feel your pain man, god was I glad to get out of that class. Nowadays most classes allow you to use java to do that stuff, a lot easier. Quote Link to comment Share on other sites More sharing options...
teklord310 Posted August 3 Author Report Share Posted August 3 Yeah I guess you are right... but i'd rather avoid programming as a whole. Computer Engineering isn't that bad, not too much of it... just a few classes i have to squeeze by in. Quote Link to comment Share on other sites More sharing options...
dr0ne Posted August 3 Report Share Posted August 3 Originally posted by teklord310 One of my projects from last semester. Operating Systems. We had to write a unix shell. Single line interpreter that supports pipes and redirectors. Obviously I didn't do this myself. Ended up dropping the class: fuck.cppthat was our very first project at my OS class back in school. We had 10 days to write a shell. We had one month to write a full kernel (with all syscalls) and another to write the filesystem for it. I didn't get to go out too much that semester. Quote Link to comment Share on other sites More sharing options...
teklord310 Posted August 3 Author Report Share Posted August 3 Originally posted by dr0ne that was our very first project at my OS class back in school. We had 10 days to write a shell. We had one month to write a full kernel (with all syscalls) and another to write the filesystem for it. I didn't get to go out too much that semester. WOW! That is pretty nuts, I have to take and pass this class this coming year in order to graduate. Maybe i'll get some help from u And I thought this was a bitch... I don't know why, but the program that the TA wrote was 15 pages long. I think the average on this assignment was a 20/50. Quote Link to comment Share on other sites More sharing options...
dr0ne Posted August 3 Report Share Posted August 3 Originally posted by teklord310 WOW! That is pretty nuts, I have to take and pass this class this coming year in order to graduate. Maybe i'll get some help from u And I thought this was a bitch... I don't know why, but the program that the TA wrote was 15 pages long. I think the average on this assignment was a 20/50. thats cuz rutgers kids party too much i got fucked on the shell cuz my partner was a dumbfuck and we split the work evenly. then i pretty much decided to shove him to the side and do all work myself in order to pass the class.....end result:shell - 60%terminal driver - 95%kernel - 98%filesystem - 97% Quote Link to comment Share on other sites More sharing options...
karch Posted August 3 Report Share Posted August 3 Fuuuuuuuck Computer Programming. I remember back in the day when I thought I would be a Computer Science major. lmao:laugh: :laugh: I dropped the first course, Comp Sci 111(but I heard 111 and 112 are the hardest ones). Quote Link to comment Share on other sites More sharing options...
Codica3 Posted August 3 Report Share Posted August 3 Geeks. Quote Link to comment Share on other sites More sharing options...
dr0ne Posted August 3 Report Share Posted August 3 Originally posted by codica3 Geeks. an understatement. Quote Link to comment Share on other sites More sharing options...
Codica3 Posted August 3 Report Share Posted August 3 Originally posted by dr0ne an understatement. Dorkus Maximus perhaps?? Quote Link to comment Share on other sites More sharing options...
teklord310 Posted August 3 Author Report Share Posted August 3 Originally posted by codica3 Dorkus Maximus perhaps?? Yo... do u mind if I take "Intro to Alcoholism 01:210:101" with you?? Quote Link to comment Share on other sites More sharing options...
Codica3 Posted August 3 Report Share Posted August 3 Originally posted by teklord310 Yo... do u mind if I take "Intro to Alcoholism 01:210:101" with you?? Werd.. it's a good class.. we went on a field trip to Centro the other day and drank our faces off.. you should join, it's a lot of independent study work and whatnot. Quote Link to comment Share on other sites More sharing options...
teklord310 Posted August 3 Author Report Share Posted August 3 Originally posted by codica3 Werd.. it's a good class.. we went on a field trip to Centro the other day and drank our faces off.. you should join, it's a lot of independent study work and whatnot. Count me in, field trips rule! Can I study with you this time around? Let's start before classes resume, meet me at Alexander tonight at 9pm in front of the Undergrad reserve desk. Quote Link to comment Share on other sites More sharing options...
Codica3 Posted August 3 Report Share Posted August 3 Originally posted by teklord310 Count me in, field trips rule! Can I study with you this time around? Let's start before classes resume, meet me at Alexander tonight at 9pm in front of the Undergrad reserve desk. Excuse me? :rolleyes: Quote Link to comment Share on other sites More sharing options...
teklord310 Posted August 3 Author Report Share Posted August 3 Originally posted by codica3 Excuse me? :rolleyes: You cutting class already? Slacker Quote Link to comment Share on other sites More sharing options...
Codica3 Posted August 3 Report Share Posted August 3 Originally posted by teklord310 You cutting class already? Slacker LOL no of course not, I'm doing my homework and having a beer right now. Quote Link to comment Share on other sites More sharing options...
scoob-e Posted August 3 Report Share Posted August 3 think thats ruff? try being a network admin and having the hard drive on the PDC crash as you search through a closet looking for that backup tape drive so that you can get the network back up as you have 100 people askin you why their computers arent working and your boss is screaming at you that hes gonna fire you if you dont get the network back up in 5 minutes. time is money. Quote Link to comment Share on other sites More sharing options...
teklord310 Posted August 3 Author Report Share Posted August 3 Originally posted by scoob-e think thats ruff? try being a network admin and having the hard drive on the PDC crash as you search through a closet looking for that backup tape drive so that you can get the network back up as you have 100 people askin you why their computers arent working and your boss is screaming at you that hes gonna fire you if you dont get the network back up in 5 minutes. time is money. Hardware is my thing, i'd much rather deal with hardware problems over software anyway. I'd like to become MCSE certified, maybe CCNE too. Hopefully I can get those done this year, gotta get up off my ass and do something. Quote Link to comment Share on other sites More sharing options...
dirtyepic18 Posted August 7 Report Share Posted August 7 *bump*you think thats bad? my job at the moment consists of editing 3 linked C librarys totalling almost 40,000 lines of code that was last updated in 1987, and has a total of like 6 comments.all so i can fuckin use the librarys in a bigger project.lets see... only 6 more hours till i can go home... Quote Link to comment Share on other sites More sharing options...
tottallyoff Posted August 7 Report Share Posted August 7 so what do you need help with? Quote Link to comment Share on other sites More sharing options...
gmoneyjive Posted August 7 Report Share Posted August 7 I have OS coming up this fall... its definitely gonna be my hardest and most hated class in college - I hate coding in the first place. I'm seriously considering paying someone to write the 4 programs for me (I can handle the tests) Quote Link to comment Share on other sites More sharing options...
teklord310 Posted August 7 Author Report Share Posted August 7 Originally posted by gmoneyjive I have OS coming up this fall... its definitely gonna be my hardest and most hated class in college - I hate coding in the first place. I'm seriously considering paying someone to write the 4 programs for me (I can handle the tests) Indeed, i've got to take it again either next semester or the following semester. We'll see what happens. The comp sci dept at my school is all high tech, they run a code checker on all our programs and see if two students used similar code. Changing the variables doesn't work Gluck man! Quote Link to comment Share on other sites More sharing options...
gmoneyjive Posted August 7 Report Share Posted August 7 Originally posted by teklord310 Indeed, i've got to take it again either next semester or the following semester. We'll see what happens. The comp sci dept at my school is all high tech, they run a code checker on all our programs and see if two students used similar code. Changing the variables doesn't work Gluck man! yeah they use code comparing programs here to... so u gotta go beyond just variables... but you can do it if you change a lotta other stuff too... I've come to the conclusion that copying code and changing it takes about as long as writing it yourself, but you don't have to think Quote Link to comment Share on other sites More sharing options...
teklord310 Posted August 7 Author Report Share Posted August 7 Originally posted by gmoneyjive yeah they use code comparing programs here to... so u gotta go beyond just variables... but you can do it if you change a lotta other stuff too... I've come to the conclusion that copying code and changing it takes about as long as writing it yourself, but you don't have to think So you see my point.. It's the whole thinking thing that makes it worth it. Try to think as little as possible. Thinking is stressful. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.