C-Shell
A simple shell written in C.
Loading...
Searching...
No Matches
internal_commands.h File Reference

This header file contains declarations for the internal commands. More...

#include <stdbool.h>

Go to the source code of this file.

Typedefs

typedef bool option
 

Functions

int cd (int nargs, char **args)
 Change the shell working directory.
 
int echo (int nargs, char **args)
 Write arguments to the standard output.
 
int pwd (int nargs, char **args)
 Print the full filename of the current working directory.
 

Detailed Description

This header file contains declarations for the internal commands.

Author
Swastik Pal
Version
0.1
Date
2022-11-05

Typedef Documentation

◆ option

typedef bool option

Function Documentation

◆ cd()

int cd ( int nargs,
char ** args )

Change the shell working directory.

If no path is provided, changes the current directory to /.

◆ echo()

int echo ( int nargs,
char ** args )

Write arguments to the standard output.

Display the ARGs, separated by a single space character and followed by a newline, on the standard output.

Options:

  • -c - separate arguments with commas
  • -n - no newline at the end
  • -l - format output as a list

◆ pwd()

int pwd ( int nargs,
char ** args )

Print the full filename of the current working directory.

If no option is specified, -P is assumed. Option -L overrides -P when both are used together.

Options:

  • -L - use PWD from environment
  • -P - resolves symlinks to get the current working directory.