Skip to content

Commit

Permalink
Merge pull request #80 from fischerling/improve_man_pages
Browse files Browse the repository at this point in the history
Improve man pages
  • Loading branch information
Galfurian authored Jul 16, 2024
2 parents 95c33bd + c2e4ef9 commit 4bc52fb
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 5 deletions.
4 changes: 2 additions & 2 deletions files/usr/share/man/cat.man
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
SYNOPSIS
cat [FILE]
cat [FILE]...

DESCRIPTION
Prints the content of the given file.
Print the content of each given file.

OPTIONS
-h, --help shows command help.
5 changes: 5 additions & 0 deletions files/usr/share/man/env.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SYNOPSIS
env

DESCRIPTION
Print the current environment, with one name=value pair per line.
35 changes: 35 additions & 0 deletions files/usr/share/man/hier.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
NAME
hier - description of the filesystem hierarchy

DESCRIPTION
The filesystem is structured like a typical Linux system and more or less
resembles the Filesystem Hierarchy Standard by the Linux Foundation.

The filesystem has among others the following directories:

/ This is the root directory. This is where the whole tree starts.

/bin This directory contains basic and required executable programs.

/dev Special or device files, which refer to physical devices.

/etc Contains system-wide configuration files of the machine.

/home Contains the home directories for individual users.

/proc This is the mount point for the proc filesystem, which provides
information about running processes and the kernel.

/root This directory is the home directory for the root user.

/usr/bin
This is the directory for additional executable programs.

/usr/srv
Contains the source code used to build the system.

/usr/share
Contains the source code used to build the system.

/usr/share/man
Manual pages go here.
9 changes: 9 additions & 0 deletions files/usr/share/man/init.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SYNOPSIS
init

DESCRIPTION
init is used as PID 1 program, started by the operating system's kernel.

init forks and executes the login program in the new process.
It then awaits child processes. If the forked login process terminates
a new one will be started.
14 changes: 14 additions & 0 deletions files/usr/share/man/kill.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SYNOPSIS
kill SIGNAL PID...
kill PID
kill -l

DESCRIPTION
The kill utility shall send a signal to the process or processes specified
by each PID operand.

If no signal is given the TERM signal will be send to the process specified
by PID.

OPTIONS
-l Write a list of all suported signals.
14 changes: 14 additions & 0 deletions files/usr/share/man/login.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SYNOPSIS
login

DESCRIPTION
login is used when signing onto a system.

login prompts for the username and the password, where appropriate.
Echoing is disabled to prevent revealing the password.

The user and group ID will be set according to their values in the
/etc/passwd file.

The greeting message from the file /etc/motd is printed and the
user shell specified in /etc/passwd is started.
2 changes: 1 addition & 1 deletion files/usr/share/man/ls.man
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SYNOPSIS
ls [OPTIONS] [FILE/FOLDER]
ls [OPTIONS] [DIRECTORY]...

DESCRIPTION
List information about the given file, or the files contained in the given
Expand Down
12 changes: 12 additions & 0 deletions files/usr/share/man/stat.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
SYNOPSIS
stat [OPTIONS]... FILE...

DESCRIPTION
Display file status of one or more given files.

OPTIONS
-h, --help shows command help.

EXIT STATUS
stat will exit with status 1 if the stat system call fails.
Otherwise, stat will exit with status 0.
18 changes: 18 additions & 0 deletions files/usr/share/man/touch.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
SYNOPSIS
touch FILE

DESCRIPTION
The touch utility shall change the last data modification timestamps,
the last data access timestamps, or both.

touch shall perform actions equivalent to the following functions:
1. If file does not exist:

a. The creat() function is called with the following arguments:
-- The file operand is used as the path argument.
-- The value of the bitwise-inclusive OR of S_IRUSR, S_IWUSR,
S_IRGRP, S_IROTH is used as the mode argument.
b. The file is opened for reading.

OPTIONS
-h, --help shows command help.
5 changes: 5 additions & 0 deletions files/usr/share/man/uptime.man
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
SYNOPSIS
uptime

DESCRIPTION
Tell how long the system has been running.
2 changes: 1 addition & 1 deletion programs/cat.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int main(int argc, char **argv)
// Check if `--help` is provided.
for (int i = 1; i < argc; ++i) {
if ((strcmp(argv[i], "--help") == 0) || (strcmp(argv[i], "-h") == 0)) {
printf("Prints the content of the given file.\n");
printf("Print the content of each given file.\n");
printf("Usage:\n");
printf(" cat <file>\n");
return 0;
Expand Down
2 changes: 1 addition & 1 deletion programs/man.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int main(int argc, char *argv[])
exit(1);
}
close(fd);
execlp(pager, pager, filepath);
execlp(pager, pager, filepath, NULL);
}
return 0;
}

0 comments on commit 4bc52fb

Please sign in to comment.