- •Введение
- •Лабораторная работа № 1 основы интерфейса пользователя с posix-совместимой ос на уровне командной строки
- •Указания к работе
- •Информация, необходимая для начала работы
- •Основные команды ос unix
- •Последовательность выполнения работы
- •Контрольные вопросы
- •Лабораторная работа № 2 анализ файловой структуры posix-совместимой ос. Команды для работы с файлами и каталогами
- •Указания к работе
- •Физическая модель диска
- •Логическая модель диска
- •Общие черты файловых систем Unix / Posix-совместимых ос
- •Команды для работы с файлами и каталогами
- •Копирование файлов и каталогов
- •Перемещение и переименование файлов и каталогов
- •Права доступа
- •Изменение прав доступа
- •Контекстный поиск в файле
- •Проверка использования диска
- •Управление процессами
- •Получение информации о процессах
- •Последовательность выполнения работы
- •Контрольные вопросы
- •Лабораторная работа № 3 экранный интерфейс для posix-совместимых ос
- •Указания к работе
- •Окна mc
- •Выполнение команд ос Unix
- •Типы файлов
- •Работа с отмеченными файлами
- •Вызов меню
- •Настройка окон
- •Порядок сортировки
- •Прервать
- •Другие режимы отображения
- •Справка (f1)
- •Переименование-Перемещение (f6)
- •Создание Каталога (f7)
- •Удаление (f8)
- •Выход (f10, Shift-f10)
- •Быстрая смена каталога (Alt-c)
- •Различные команды
- •Меню Options
- •Пункт «Внешний вид»
- •Пункт «Биты символов…»
- •Отображение символов Полный 8-битный ввод 7-бит Дальше Прервать
- •Пункт «Подтверждение»
- •Пункт «Распознавание клавиш…»
- •Пользовательские меню
- •Выполнение файлов
- •Последовательность выполнения работы
- •Контрольные вопросы
- •Лабораторная работа № 4 экранный редактор VI/vim
- •Указания к работе Текстовые редакторы
- •Редактор VI (Visual display editor)
- •Основные группы команд редактора Команды управления курсором
- •Команды позиционирования
- •Команды редактирования
- •Команды редактирования в режиме командной строки
- •Последовательность выполнения работы
- •Контрольные вопросы
- •Лабораторная работа № 5 базовые средства для создания приложений в posix-совместимых ос
- •Указания к лабораторной работе
- •Система контроля версий
- •Компиляция исходного текста и построение исполняемого файла
- •Тестирование и отладка
- •Тестовый пример для лабораторной работы
- •Исходный текст программы abcd.C для лаботаторной работы № 5
- •Последовательность выполнения работы
- •Контрольные вопросы к работе
- •Лабораторная работа № 6 сетевые средства posix-совместимых ос. Использование сетевых команд
- •Указания к работе
- •Обзор сетевых команд для tcp/ip
- •Последовательность выполнения работы
- •Контрольные вопросы
- •Лабораторная работа № 7 анализ функционирования и диагностика ip-сетей
- •Указания к работе
- •Аппаратный уровень (уровень сетевого интерфейса)
- •Сетевой уровень
- •Адресация в ip-сетях
- •Internet-адреса
- •Команды диагностики сети
- •Последовательность выполнения работы
- •Контрольные вопросы
- •Лабораторная работа № 8
- •Чтение присланных сообщений
- •Как ответить на сообщения
- •Удаление сообщений
- •Прекращение работы с программой mail
- •Использование почтовых псевдонимов (alias)
- •Система обмена сообщениями netnews (usenet)
- •Разговор в сети с другим пользователем
- •Телеконференции в реальном времени
- •Замечания по основным командам irc
- •Последовательность выполнения работы
- •1. Программа mail
- •1.1. Отправление почты
- •1.2. Чтение присланных сообщений
- •3. Программа talk
- •4. Программа irc
- •Контрольные вопросы
- •Оглавление
- •Николай Лаврентьевич Долозов основы операционных систем и сетевых технологий Учебно-методическое пособие
- •630092, Г. Новосибирск, пр. К. Маркса, 20
Тестовый пример для лабораторной работы
При выполнении лабораторной работы будет использоваться программа abcd.c на языке Си, исходный текст которой приведен ниже. Эта программа представляет собой простейший лексический анализатор, который читает входной текст со стандартного ввода (клавиатуры) и результаты печатает на стандартный вывод (экран).
Для каждой строки, принятой со стандартного ввода, программа печатает на стандартный вывод слова по одному в строку.
Словом является последовательность алфавитно-цифровых символов, заключенная между пробелами. Если задан в качестве аргумента некоторый символ (например -t), то на стандартный вывод из вво-димой строки печатаются только слова, которые включают данный символ.
Приведенный ниже текст программы abcd.cсодержит целый ряд ошибок как синтаксических, так и семантических. Предполагается, что при выполнении лабораторной работы студенты должны отыскать и исправить эти ошибки и тем самым приобрести практические навыки по использованию таких инструментальных средств, какCVS,gdb,gcc,make.
В качестве тестового примера при выполнении лабораторной работы будем использовать строку:
this is a test the abcd program
При запуске отлаженной программы abcdбез параметров после ввода этой строки на экране должно быть:
this
is
a
test
the
abcd
program
При запуске отлаженной программы abcd с параметром -tпосле ввода этой строки на экране должно быть: this
test
the
Исходный текст программы abcd.C для лаботаторной работы № 5
#include <stdio.h>
#include <ctype.h> /* */
#include <string.h>
/* Manifests for state machine to parse input line. */
#define WORD 0
#define IGNORE 1
/* Globals, used by both subroutines. */
char *Words[BUFSIZ/2]; /* Worst case, single letters. */
int WordCount;
/* Walk through the array of works, find those with the
* matching charakter, printing them on stdout. Note that
* the NULL charakter will match all words. */
void PrintWords(wc, match)
int wc; /* Number of words in Words[] */
char match; /* Attempt to match this charakter. */
{ register int ix; /* Index in Words[]. */
register char *cp; /* Pointer for searching. */
for (ix=0; ix < wc; ix++) {
cp = Words[ix];
/* Try to match the given character.
* Scan the word, attempting to match,
* or until the end of the word is found. */
while ((*cp) && (*cp++ != match));
if (*cp == match) /* Found a match? Write the word on stdout. */
(void) printf("%s0, Words[ix]); } return; }
/* Find words in the gives buffer. The Words[] array is set
* to point at words in the buffer, and the buffer modifeid
* with NULL characters to delimit the words. */
int GetWords (buf)
char buf[]; /* The input buffer. */
{ register char *cp; /* Pointer for scanning. */
int end = strlen(buf); /* length of the buffer. */
register int wc = 0; /* Number of words found. */
int state = IGNORE; /* Current state. */
/* For each character in the buffer. */
for (cp = &buf[0]; cp < &buf[end]; cp++) {
/* A simple state machine to process
* the current character in the buffer. */
switch(state) {
case IGNORE:
if (!isspace(*cp)) {
Words[wc++] = cp; /* Just started a word? Save it. */
state = WORD; /* Reset the state. */ } break;
case WORD:
if (isspace(*cp)) {
*cp = '\0'; /* Just completed aword? terminate it. */
state = IGNORE; /* Reset the state. */ } break; }}
return wc; /* Return the word count. */ }
int main(argc, argv) int argc; char *argv[]; { char buf[BUFSIZ], match;
/* Check command line arguments. */
if (argc < 2) match = ' ';
/* No command line argument, match all words. */
else match = *++argv[1]; /* match the char after the first - */
/* Until no more input on stdin. */
while(gets(buf) != (char *)NULL) {
WordCount = GetWords(buf); /* Paste the input buffer. */
PrintWords(WordCount, match); /* Print the matching words. */ }
return(0); /* Return success to the shell. *