Skip to content

Mcsavvy/simple_shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

99 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

C - BUILD YOUR OWN SHELL

Introduction: ๐Ÿ“’

  • One of the core tenets of the ALX SE program is the belief in doing hard things and now, they have presented us with another hard thing
  • The mission of this current task is to build a shell that will work as good as any bash shell or even better
  • As usual, there are restraints and constraints on the number and type of functions we're allowed to use but the fact that we're working in teams of two means that we have more info and resources to use

Helper Files: ๐Ÿ™Œ

Every file is a helper file though as ALX didn't provide us with the usual _putchar function

Header Files: ๐Ÿ“œ

  • shell.h It contains all the header files we should have been constantly declaring to usse functions and syscalls like the write and read_

  • header ๐Ÿ“

It contains other header files that were used in declaring related function prototypes
  • builtin.h ๐Ÿ“œ
    Contains the header prototypes for the builtins
  • include.h ๐Ÿ“œ
    Contains the struct for the node type and the C header files
  • path.h ๐Ÿ“œ
    Contains the prototpyes for the functions that find the environmental path
  • string.h ๐Ÿ“œ
    Contains prototypes for the string functions

Contents

  • Files which are sourcefiles for the codes ๐Ÿ“„

FILES FUNCTIONS ACTIONS
append.c int appendStr(char ***arr, size_t *size, char *str, int index) Appends a string to an array of strings_
int appendChar(char **string, size_t *size, char chr, int index) Appends a character to a string_
int appendInt(char **string, size_t *size, int num, int index) Appends an integer to a string
find.c char *findenv(char *env[], const char *name) Returns the value of a n environmental variable
struct dirent *findfile(DIR *dir, const char *filename) searches through the directory for a a file
char *joinpath(const char *base, const char *child) Joins two paths together using "/"
char *findcmd(const char *command, const char *PATH) searches throuh the $PATH variable to find a command
line.c char **tokenizeLine(char *line) Split a line into separate words
quote.c int findquote(char *str, char quote) Finds a string in quotes within a string(unescaped quote)
int parsequote(char *string, int *index, char **buffer, size_t *buf_size, int *buf_index) Groups characters in quotes as a single word during tokenization
run.c int execute(const char *program, char *args[]) Executes a programin a child process
atoi.c bool checkatoi(char *s) checks if a string can be turned into numbers
int _atoi(char *s) converts a string into an integer
** AND MANY MORE FUNCTIONS WORKING BEHIND THE SCENE
  • Files with a program as a target ๐Ÿ“ƒ

FILE PROGRAM FUNCTION
main.c It is the entry point for the shell

See Also

Please click this arrow for compilation instructions
  • Use gcc *.c -o hsh to compile
  • THen run ./hsh
  • Ignore any .swo, .swp and any other file that is not an executable, C or header file
  • This shell has been tested and trusted. It comes with some builtins though

AUTHORS

Ugwuanyi Afam alias Phyro Kelstein ๐Ÿ˜œโœŒ๏ธ

  • To view my github, click here

David John alias Dave Mcsavvy ๐Ÿ˜Ž๐Ÿ‘Œ

  • To view my github, click here

About

ALX Simple Shell Team Project ๐Ÿฆพ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages