Skip to content

Commit

Permalink
Update from 10
Browse files Browse the repository at this point in the history
  • Loading branch information
Administrator committed Nov 22, 2021
1 parent b826817 commit 73fa7fe
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 26 deletions.
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ The russian version of the task can be found in the repository.

## Preamble

![simple_bash_utils](misc/eng/images/bashutils.png)

It was an ordinary grey autumn day in 1993. You came home from work at Hewlett-Packard, feeling a little tired. You had a small two-room apartment on the outskirts of N town. There was a low-alcohol drink in the refrigerator called "pivo". You took that drink and a bag of crackers then went to your little nook, to your computer made by Dell.

`*Click*` - the power button was pressed. A couple of minutes of boot loading and... yeah, it feels good. You always get that feeling when you turn on a computer. A few seconds of undisturbed pleasure and you opened
Expand Down Expand Up @@ -89,35 +91,43 @@ Cat is one of the most frequently used commands on Unix-like operating systems.
| 4 | -c | Output count of matching lines only. |
| 5 | -l | Output matching files only. |
| 6 | -n | Precede each matching line with a line number. |
| 7 | -b | A historical curiosity: precede each matching line with a block number. |
| 8 | -h | Output matching lines without preceding them by file names. |
| 9 | -s | Suppress error messages about nonexistent or unreadable files. |
| 10 | -f file | Take regexes from a file. |
| 11 | -o | Output the matched parts of a matching line. |
| 7 | -h | Output matching lines without preceding them by file names. |
| 8 | -s | Suppress error messages about nonexistent or unreadable files. |
| 9 | -f file | Take regexes from a file. |
| 10 | -o | Output the matched parts of a matching line. |


## Chapter III

- The programs must be developed in C language of C11 standard using gcc compiler.
- The program code must be located in the src folder
- The program must be built with Makefile with appropriate targets: s21_cat, s21_grep
- The programs must be executable files with command line arguments
- The programs must be built with Makefile with appropriate targets: s21_cat, s21_grep
- If third-party libraries are used, there must be build scripts in makefile to connect/load them
- Integration tests must cover all flag variants and input values, based on a comparison with the behavior of real Bash utilities
- The program must be developed according to the principles of structured programming
- The programs must be developed according to the principles of structured programming
- Code duplication must be avoided, common modules must be reused between the utilities
- You can use standard and non-standard C libraries or you can use your own developed libraries from other projects
- You can use standard and non-standard C libraries, or you can use your own developed libraries from other projects

## Part 1. Working with the cat utility

You need to develop a cat utility:
- Support all flags
- Support of all flags
- The source, header, and build files must be placed in the src/cat/ directory
- The resulting executable file must be placed in the directory src/cat/ and named s21_cat

## Part 2. Working with grep utility

You need to develop the grep utility:
- Support all flags
- You can use any library for regular expressions (e.g. pcre).
- The source, header and build files must be placed in the src/grep/ directory.
- Support of the following flags: -e, -i, -v, -c, -l, -n
- You can use any library for regular expressions (e.g. pcre)
- The source, header and build files must be placed in the src/grep/ directory
- The resulting executable file must be placed in the directory src/grep/ and named s21_grep

## Part 3. Bonus. Implementation of some grep utility flags

Bonus assignment for extra points. You need to develop the grep utility:
- Support of all flags, including: -h, -s, -f, -o
- You can use any library for regular expressions (e.g. pcre)
- The source, header and build files must be placed in the src/grep/ directory
- The resulting executable file must be placed in the directory src/grep/ and named s21_grep
38 changes: 24 additions & 14 deletions README_RUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

## Preamble

![simple_bash_utils](misc/rus/images/bashutils.png)

То был обычный серый осенний день 1993 года. Вы пришли домой со своей работы в Hewlett-Packard,
немного уставший. У вас была небольшая двухкомнатная квартира на окраинах города N,
а в холодильнике был слабоалкогольный напиток под названием pivo. Вы взяли этот напиток,
Expand Down Expand Up @@ -86,22 +88,22 @@ grep впервые был включен в Версию 4 Unix. Заявив,
|| Опции | Описание |
| ------ | ------ | ------ |
| 1 | -e | Шаблон |
| 2 | -i | Игнорирует различия регистра |
| 3 | -v | Инвертирует смысл поиска соответствий |
| 2 | -i | Игнорирует различия регистра. |
| 3 | -v | Инвертирует смысл поиска соответствий. |
| 4 | -c | Выводит только количество совпадающих строк. |
| 5 | -l | Выводит только совпадающие файлы |
| 6 | -n | Предваряет каждую строку вывода номером строки из файла ввода |
| 7 | -b | Исторический курьез: Печатает перед каждой совпадающей строкой вывода номер блока. |
| 8 | -h | Выводит совпадающие строки, не предваряя их именами файлов |
| 9 | -s | Подавляет сообщения об ошибках о несуществующих или нечитаемых файлах. |
| 10 | -f file | Получает регулярные выражения из файла. |
| 11 | -o | Печатает только совпадающие (непустые) части совпавшей строки |
| 5 | -l | Выводит только совпадающие файлы. |
| 6 | -n | Предваряет каждую строку вывода номером строки из файла ввода. |
| 7 | -h | Выводит совпадающие строки, не предваряя их именами файлов. |
| 8 | -s | Подавляет сообщения об ошибках о несуществующих или нечитаемых файлах. |
| 9 | -f file | Получает регулярные выражения из файла. |
| 10 | -o | Печатает только совпадающие (непустые) части совпавшей строки. |


## Chapter III

- Программы должны быть разработаны на языке Си стандарта C11 с использованием компилятора gcc
- Код программ должен находиться в папке src
- Код программ должен находиться в папке src
- Программы должны представлять собой исполняемый файл с аргументами командной строки
- Сборка программ должна быть настроена с помощью Makefile с соответствующими целями: s21_cat, s21_grep
- Если используются сторонние библиотеки, в Makefile должны быть заложены сценарии сборки, предусматривающие их подключение / загрузку
- Необходимо покрытие интеграционными тестами для всех вариантов флагов и входных значений, на базе сравнения с поведением реальных утилит Bash
Expand All @@ -113,13 +115,21 @@ grep впервые был включен в Версию 4 Unix. Заявив,

Необходимо разработать утилиту cat:
- Поддержка всех флагов
- Исходные, заголовочные и сборочный файлы должны распологаться в директории src/cat/
- Исходные, заголовочные и сборочный файлы должны располагаться в директории src/cat/
- Итоговый исполняемый файл должен располагаться в директории src/cat/ и называться s21_cat

## Part 2. Работа с утилитой grep

Необходимо разработать утилиту grep:
- Поддержка всех флагов
- Для регулярных выражений можно использовать любую библиотеку (например, pcre).
- Исходные, заголовочные и сборочный файлы должны распологаться в директории src/grep/
- Поддержка следующих флагов: -e, -i, -v, -c, -l, -n
- Для регулярных выражений можно использовать любую библиотеку (например, pcre)
- Исходные, заголовочные и сборочный файлы должны располагаться в директории src/grep/
- Итоговый исполняемый файл должен располагаться в директории src/grep/ и называться s21_grep

## Part 3. Дополнительно. Реализация некоторых флагов утилиты grep

Необязательное задание на дополнительные баллы. Необходимо разработать утилиту grep:
- Поддержка всех флагов, включая: -h, -s, -f, -o.
- Для регулярных выражений можно использовать любую библиотеку (например, pcre)
- Исходные, заголовочные и сборочный файлы должны располагаться в директории src/grep/
- Итоговый исполняемый файл должен располагаться в директории src/grep/ и называться s21_grep
Binary file added misc/eng/images/bashutils.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed misc/images/.gitkeep
Empty file.
Binary file added misc/rus/images/bashutils.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 73fa7fe

Please sign in to comment.