| 1 |
# Russian translation of manpages |
| 2 |
# This file is distributed under the same license as the manpages-l10n package. |
| 3 |
# Copyright © of this file: |
| 4 |
# Azamat Hackimov <[email protected]>, 2017. |
| 5 |
# Dmitry Bolkhovskikh <[email protected]>, 2017. |
| 6 |
# Yuri Kozlov <[email protected]>, 2011-2019. |
| 7 |
# Иван Павлов <[email protected]>, 2017. |
| 8 |
msgid "" |
| 9 |
msgstr "" |
| 10 |
"Project-Id-Version: manpages-l10n\n" |
| 11 |
"POT-Creation-Date: 2026-06-05 06:24+0200\n" |
| 12 |
"PO-Revision-Date: 2024-12-21 19:50+0300\n" |
| 13 |
"Last-Translator: Yuri Kozlov <[email protected]>\n" |
| 14 |
"Language-Team: Russian <[email protected]>\n" |
| 15 |
"Language: ru\n" |
| 16 |
"MIME-Version: 1.0\n" |
| 17 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 18 |
"Content-Transfer-Encoding: 8bit\n" |
| 19 |
"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " |
| 20 |
"n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || " |
| 21 |
"(n%100>=11 && n%100<=14)? 2 : 3);\n" |
| 22 |
"X-Generator: Lokalize 2.0\n" |
| 23 |
|
| 24 |
#. type: TH |
| 25 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 26 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 27 |
#, fuzzy, no-wrap |
| 28 |
#| msgid "B<fopencookie>()" |
| 29 |
msgid "fopencookie" |
| 30 |
msgstr "B<fopencookie>()" |
| 31 |
|
| 32 |
#. type: TH |
| 33 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 34 |
#: opensuse-tumbleweed |
| 35 |
#, no-wrap |
| 36 |
msgid "2025-09-21" |
| 37 |
msgstr "21 сентября 2025 г." |
| 38 |
|
| 39 |
#. type: TH |
| 40 |
#: archlinux debian-unstable |
| 41 |
#, fuzzy, no-wrap |
| 42 |
#| msgid "Linux man-pages 6.17" |
| 43 |
msgid "Linux man-pages 6.18" |
| 44 |
msgstr "Справочные страницы Linux 6.17" |
| 45 |
|
| 46 |
#. type: SH |
| 47 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 48 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 49 |
#, no-wrap |
| 50 |
msgid "NAME" |
| 51 |
msgstr "НАИМЕНОВАНИЕ" |
| 52 |
|
| 53 |
#. type: Plain text |
| 54 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 55 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 56 |
#, fuzzy |
| 57 |
#| msgid "fopencookie - opening a custom stream" |
| 58 |
msgid "fopencookie - open a custom stream" |
| 59 |
msgstr "fopencookie - открывает нестандартный поток" |
| 60 |
|
| 61 |
#. type: SH |
| 62 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 63 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 64 |
#, no-wrap |
| 65 |
msgid "LIBRARY" |
| 66 |
msgstr "БИБЛИОТЕКА" |
| 67 |
|
| 68 |
#. type: Plain text |
| 69 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 70 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 71 |
msgid "Standard C library (I<libc>,\\ I<-lc>)" |
| 72 |
msgstr "Стандартная библиотека языка C (I<libc>,\\ I<-lc>)" |
| 73 |
|
| 74 |
#. type: SH |
| 75 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 76 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 77 |
#, no-wrap |
| 78 |
msgid "SYNOPSIS" |
| 79 |
msgstr "СИНТАКСИС" |
| 80 |
|
| 81 |
#. type: Plain text |
| 82 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 83 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 84 |
#, fuzzy, no-wrap |
| 85 |
#| msgid "" |
| 86 |
#| "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" |
| 87 |
#| "B<#include E<lt>stdio.hE<gt>>\n" |
| 88 |
msgid "" |
| 89 |
"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" |
| 90 |
"B<#define _FILE_OFFSET_BITS 64>\n" |
| 91 |
"B<#include E<lt>stdio.hE<gt>>\n" |
| 92 |
msgstr "" |
| 93 |
"B<#define _GNU_SOURCE> /* см. feature_test_macros(7) */\n" |
| 94 |
"B<#include E<lt>stdio.hE<gt>>\n" |
| 95 |
|
| 96 |
#. type: Plain text |
| 97 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 98 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 99 |
#, fuzzy, no-wrap |
| 100 |
#| msgid "" |
| 101 |
#| "B<FILE *fopencookie(void *>I<cookie>B<, const char *>I<mode>B<,>\n" |
| 102 |
#| "B< cookie_io_functions_t >I<io_funcs>B<);>\n" |
| 103 |
msgid "" |
| 104 |
"B<FILE *fopencookie(void *restrict >I<cookie>B<, const char *restrict >I<mode>B<,>\n" |
| 105 |
"B< cookie_io_functions_t >I<io_funcs>B<);>\n" |
| 106 |
msgstr "" |
| 107 |
"B<FILE *fopencookie(void *>I<cookie>B<, const char *>I<mode>B<,>\n" |
| 108 |
"B< cookie_io_functions_t >I<io_funcs>B<);>\n" |
| 109 |
|
| 110 |
#. type: SH |
| 111 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 112 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 113 |
#, no-wrap |
| 114 |
msgid "DESCRIPTION" |
| 115 |
msgstr "ОПИСАНИЕ" |
| 116 |
|
| 117 |
#. type: Plain text |
| 118 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 119 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 120 |
msgid "" |
| 121 |
"The B<fopencookie>() function allows the programmer to create a custom " |
| 122 |
"implementation for a standard I/O stream. This implementation can store the " |
| 123 |
"stream's data at a location of its own choosing; for example, " |
| 124 |
"B<fopencookie>() is used to implement B<fmemopen>(3), which provides a " |
| 125 |
"stream interface to data that is stored in a buffer in memory." |
| 126 |
msgstr "" |
| 127 |
"Функция B<fopencookie>() позволяет программисту создать нестандартную " |
| 128 |
"реализацию стандартного потока ввода-вывода. Эта реализация может хранить " |
| 129 |
"данные потока в расположении по своему выбору; например, B<fopencookie>() " |
| 130 |
"используется для реализации функции B<fmemopen>(3), которая предоставляет " |
| 131 |
"потоковый интерфейс для данных, хранящихся в буфере в памяти." |
| 132 |
|
| 133 |
#. type: Plain text |
| 134 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 135 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 136 |
msgid "In order to create a custom stream the programmer must:" |
| 137 |
msgstr "Для создания нестандартного потока программист должен:" |
| 138 |
|
| 139 |
#. type: IP |
| 140 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 141 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 142 |
#, no-wrap |
| 143 |
msgid "\\[bu]" |
| 144 |
msgstr "\\[bu]" |
| 145 |
|
| 146 |
#. type: Plain text |
| 147 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 148 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 149 |
msgid "" |
| 150 |
"Implement four \"hook\" functions that are used internally by the standard I/" |
| 151 |
"O library when performing I/O on the stream." |
| 152 |
msgstr "" |
| 153 |
"Реализовать четыре «обрабатывающих» (hook) функции, которые используются " |
| 154 |
"внутри стандартной библиотеки ввода-вывода при операциях ввода-вывода над " |
| 155 |
"потоком." |
| 156 |
|
| 157 |
#. type: Plain text |
| 158 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 159 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 160 |
#, fuzzy |
| 161 |
#| msgid "" |
| 162 |
#| "Define a \"cookie\" data type, a structure that provides bookkeeping " |
| 163 |
#| "information (e.g., where to store data) used by the aforementioned hook " |
| 164 |
#| "functions. The standard I/O package knows nothing about the contents of " |
| 165 |
#| "this cookie (thus it is typed as I<void\\ *> when passed to " |
| 166 |
#| "B<fopencookie>()), but automatically supplies the cookie as the first " |
| 167 |
#| "argument when calling the hook functions." |
| 168 |
msgid "" |
| 169 |
"Define a \"cookie\" data type, a structure that provides bookkeeping " |
| 170 |
"information (e.g., where to store data) used by the aforementioned hook " |
| 171 |
"functions. The standard I/O package knows nothing about the contents of " |
| 172 |
"this cookie (thus it is typed as I<void\\ *> when passed to " |
| 173 |
"B<fopencookie>()), but automatically supplies the cookie as the first " |
| 174 |
"argument when calling the hook functions." |
| 175 |
msgstr "" |
| 176 |
"Определить тип данных «cookie» — структуру для учёта информации (например, " |
| 177 |
"где хранятся данные), используемую вышеупомянутыми обрабатывающими " |
| 178 |
"функциями. Стандартный пакет ввода-вывода ничего не знает о содержимом этого " |
| 179 |
"cookie (к нему обращаются как к I<void\\ *> при передаче в " |
| 180 |
"B<fopencookie>()), но автоматически передаёт cookie в первом аргументе при " |
| 181 |
"вызове обрабатывающих функций." |
| 182 |
|
| 183 |
#. type: Plain text |
| 184 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 185 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 186 |
msgid "" |
| 187 |
"Call B<fopencookie>() to open a new stream and associate the cookie and " |
| 188 |
"hook functions with that stream." |
| 189 |
msgstr "" |
| 190 |
"Вызвать B<fopencookie>() для открытия нового потока и связывания cookie и " |
| 191 |
"обрабатывающими функциями с этим потоком." |
| 192 |
|
| 193 |
#. type: Plain text |
| 194 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 195 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 196 |
msgid "" |
| 197 |
"The B<fopencookie>() function serves a purpose similar to B<fopen>(3): it " |
| 198 |
"opens a new stream and returns a pointer to a I<FILE> object that is used to " |
| 199 |
"operate on that stream." |
| 200 |
msgstr "" |
| 201 |
"Функция B<fopencookie>() подобна B<fopen>(3): она открывает новый поток и " |
| 202 |
"возвращает указатель на объект I<FILE>, который используется для работы с " |
| 203 |
"потоком." |
| 204 |
|
| 205 |
#. type: Plain text |
| 206 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 207 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 208 |
msgid "" |
| 209 |
"The I<cookie> argument is a pointer to the caller's cookie structure that is " |
| 210 |
"to be associated with the new stream. This pointer is supplied as the first " |
| 211 |
"argument when the standard I/O library invokes any of the hook functions " |
| 212 |
"described below." |
| 213 |
msgstr "" |
| 214 |
"Аргумент I<cookie> — это указатель на структуру cookie вызывающего, которая " |
| 215 |
"связывается с новым потоком. Данный указатель передаётся в первом аргументе " |
| 216 |
"в моменты, когда стандартная библиотека ввода-вывода вызывает одну из " |
| 217 |
"обрабатывающих функций, описанных ниже." |
| 218 |
|
| 219 |
#. type: Plain text |
| 220 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 221 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 222 |
msgid "" |
| 223 |
"The I<mode> argument serves the same purpose as for B<fopen>(3). The " |
| 224 |
"following modes are supported: I<r>, I<w>, I<a>, I<r+>, I<w+>, and I<a+>. " |
| 225 |
"See B<fopen>(3) for details." |
| 226 |
msgstr "" |
| 227 |
"Аргумент I<mode> служит той же цели что и для B<fopen>(3). Поддерживаются " |
| 228 |
"следующие режимы: I<r>, I<w>, I<a>, I<r+>, I<w+> и I<a+>. Подробности " |
| 229 |
"смотрите в B<fopen>(3)." |
| 230 |
|
| 231 |
#. type: Plain text |
| 232 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 233 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 234 |
msgid "" |
| 235 |
"The I<io_funcs> argument is a structure that contains four fields pointing " |
| 236 |
"to the programmer-defined hook functions that are used to implement this " |
| 237 |
"stream. The structure is defined as follows" |
| 238 |
msgstr "" |
| 239 |
"Аргумент I<io_funcs> — это структура, которая содержит четыре поля с " |
| 240 |
"задаваемыми программистом обрабатывающими функциями, которые используются " |
| 241 |
"для реализации этого потока. Структура определена как" |
| 242 |
|
| 243 |
#. type: Plain text |
| 244 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 245 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 246 |
#, no-wrap |
| 247 |
msgid "" |
| 248 |
"typedef struct {\n" |
| 249 |
" cookie_read_function_t *read;\n" |
| 250 |
" cookie_write_function_t *write;\n" |
| 251 |
" cookie_seek_function_t *seek;\n" |
| 252 |
" cookie_close_function_t *close;\n" |
| 253 |
"} cookie_io_functions_t;\n" |
| 254 |
msgstr "" |
| 255 |
"typedef struct {\n" |
| 256 |
" cookie_read_function_t *read;\n" |
| 257 |
" cookie_write_function_t *write;\n" |
| 258 |
" cookie_seek_function_t *seek;\n" |
| 259 |
" cookie_close_function_t *close;\n" |
| 260 |
"} cookie_io_functions_t;\n" |
| 261 |
|
| 262 |
#. type: Plain text |
| 263 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 264 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 265 |
msgid "The four fields are as follows:" |
| 266 |
msgstr "Поля:" |
| 267 |
|
| 268 |
#. type: TP |
| 269 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 270 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 271 |
#, no-wrap |
| 272 |
msgid "I<cookie_read_function_t *read>" |
| 273 |
msgstr "I<cookie_read_function_t *read>" |
| 274 |
|
| 275 |
#. type: Plain text |
| 276 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 277 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 278 |
msgid "" |
| 279 |
"This function implements read operations for the stream. When called, it " |
| 280 |
"receives three arguments:" |
| 281 |
msgstr "" |
| 282 |
"Эта функция реализует операции чтения из потока. Она вызывается с тремя " |
| 283 |
"аргументами:" |
| 284 |
|
| 285 |
#. type: Plain text |
| 286 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 287 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 288 |
#, fuzzy, no-wrap |
| 289 |
#| msgid " ssize_t read(void *cookie, char *buf, size_t size);\n" |
| 290 |
msgid "ssize_t read(void *cookie, char *buf, size_t size);\n" |
| 291 |
msgstr " ssize_t read(void *cookie, char *buf, size_t size);\n" |
| 292 |
|
| 293 |
#. type: Plain text |
| 294 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 295 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 296 |
msgid "" |
| 297 |
"The I<buf> and I<size> arguments are, respectively, a buffer into which " |
| 298 |
"input data can be placed and the size of that buffer. As its function " |
| 299 |
"result, the I<read> function should return the number of bytes copied into " |
| 300 |
"I<buf>, 0 on end of file, or -1 on error. The I<read> function should " |
| 301 |
"update the stream offset appropriately." |
| 302 |
msgstr "" |
| 303 |
"Аргументы I<buf> и I<size> — буфер для получаемых данных и его размер. В " |
| 304 |
"качестве результата функция I<read> возвращает количество байт, " |
| 305 |
"скопированных в I<buf>, 0 — при окончании файла и -1 при ошибке. Функция " |
| 306 |
"I<read> обновляет смещение в потоке соответствующим образом." |
| 307 |
|
| 308 |
#. type: Plain text |
| 309 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 310 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 311 |
msgid "" |
| 312 |
"If I<*read> is a null pointer, then reads from the custom stream always " |
| 313 |
"return end of file." |
| 314 |
msgstr "" |
| 315 |
"Если значение I<*read> равно null, то при чтении из нестандартного потока " |
| 316 |
"всегда возвращается конец файла." |
| 317 |
|
| 318 |
#. type: TP |
| 319 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 320 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 321 |
#, no-wrap |
| 322 |
msgid "I<cookie_write_function_t *write>" |
| 323 |
msgstr "I<cookie_write_function_t *write>" |
| 324 |
|
| 325 |
#. type: Plain text |
| 326 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 327 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 328 |
msgid "" |
| 329 |
"This function implements write operations for the stream. When called, it " |
| 330 |
"receives three arguments:" |
| 331 |
msgstr "" |
| 332 |
"Эта функция реализует операции записи в поток. Она вызывается с тремя " |
| 333 |
"аргументами:" |
| 334 |
|
| 335 |
#. type: Plain text |
| 336 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 337 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 338 |
#, fuzzy, no-wrap |
| 339 |
#| msgid " ssize_t write(void *cookie, const char *buf, size_t size);\n" |
| 340 |
msgid "ssize_t write(void *cookie, const char *buf, size_t size);\n" |
| 341 |
msgstr " ssize_t write(void *cookie, const char *buf, size_t size);\n" |
| 342 |
|
| 343 |
#. type: Plain text |
| 344 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 345 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 346 |
msgid "" |
| 347 |
"The I<buf> and I<size> arguments are, respectively, a buffer of data to be " |
| 348 |
"output to the stream and the size of that buffer. As its function result, " |
| 349 |
"the I<write> function should return the number of bytes copied from I<buf>, " |
| 350 |
"or 0 on error. (The function must not return a negative value.) The " |
| 351 |
"I<write> function should update the stream offset appropriately." |
| 352 |
msgstr "" |
| 353 |
"Аргументы I<buf> и I<size> — буфер для выходных данных и его размер (данные, " |
| 354 |
"записываемые в поток). В качестве результата функция I<write> возвращает " |
| 355 |
"количество байт, скопированных из I<buf>, и 0 при ошибке (функция не должна " |
| 356 |
"возвращать отрицательное значение). Функция I<write> обновляет смещение в " |
| 357 |
"потоке соответствующим образом." |
| 358 |
|
| 359 |
#. type: Plain text |
| 360 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 361 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 362 |
msgid "If I<*write> is a null pointer, then output to the stream is discarded." |
| 363 |
msgstr "Если значение I<*write> равно null, то вывод в поток отбрасывается." |
| 364 |
|
| 365 |
#. type: TP |
| 366 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 367 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 368 |
#, no-wrap |
| 369 |
msgid "I<cookie_seek_function_t *seek>" |
| 370 |
msgstr "I<cookie_seek_function_t *seek>" |
| 371 |
|
| 372 |
#. type: Plain text |
| 373 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 374 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 375 |
msgid "" |
| 376 |
"This function implements seek operations on the stream. When called, it " |
| 377 |
"receives three arguments:" |
| 378 |
msgstr "" |
| 379 |
"Эта функция реализует операции смещения в потоке. Она вызывается с тремя " |
| 380 |
"аргументами:" |
| 381 |
|
| 382 |
#. type: Plain text |
| 383 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 384 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 385 |
#, fuzzy, no-wrap |
| 386 |
#| msgid " int seek(void *cookie, off64_t *offset, int whence);\n" |
| 387 |
msgid "int seek(void *cookie, off_t *offset, int whence);\n" |
| 388 |
msgstr " int seek(void *cookie, off64_t *offset, int whence);\n" |
| 389 |
|
| 390 |
#. type: Plain text |
| 391 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 392 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 393 |
msgid "" |
| 394 |
"The I<*offset> argument specifies the new file offset depending on which of " |
| 395 |
"the following three values is supplied in I<whence>:" |
| 396 |
msgstr "" |
| 397 |
"В аргументе I<*offset> указывается новое файловое смещение, зависящее от " |
| 398 |
"значения I<whence>:" |
| 399 |
|
| 400 |
#. type: TP |
| 401 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 402 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 403 |
#, no-wrap |
| 404 |
msgid "B<SEEK_SET>" |
| 405 |
msgstr "B<SEEK_SET>" |
| 406 |
|
| 407 |
#. type: Plain text |
| 408 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 409 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 410 |
msgid "" |
| 411 |
"The stream offset should be set I<*offset> bytes from the start of the " |
| 412 |
"stream." |
| 413 |
msgstr "Значение смещения приравнивается I<*offset> байт от начала потока." |
| 414 |
|
| 415 |
#. type: TP |
| 416 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 417 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 418 |
#, no-wrap |
| 419 |
msgid "B<SEEK_CUR>" |
| 420 |
msgstr "B<SEEK_CUR>" |
| 421 |
|
| 422 |
#. type: Plain text |
| 423 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 424 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 425 |
msgid "I<*offset> should be added to the current stream offset." |
| 426 |
msgstr "" |
| 427 |
"Значение I<*offset> должно быть добавлено к текущему смещению в потоке." |
| 428 |
|
| 429 |
#. type: TP |
| 430 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 431 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 432 |
#, no-wrap |
| 433 |
msgid "B<SEEK_END>" |
| 434 |
msgstr "B<SEEK_END>" |
| 435 |
|
| 436 |
#. type: Plain text |
| 437 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 438 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 439 |
msgid "" |
| 440 |
"The stream offset should be set to the size of the stream plus I<*offset>." |
| 441 |
msgstr "Значение смещения приравнивается к размеру потока плюс I<*offset>." |
| 442 |
|
| 443 |
#. type: Plain text |
| 444 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 445 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 446 |
msgid "" |
| 447 |
"Before returning, the I<seek> function should update I<*offset> to indicate " |
| 448 |
"the new stream offset." |
| 449 |
msgstr "" |
| 450 |
"Перед возвратом функция I<seek> должна обновить I<*offset>, чтобы показать " |
| 451 |
"новое смещение в потоке." |
| 452 |
|
| 453 |
#. type: Plain text |
| 454 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 455 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 456 |
msgid "" |
| 457 |
"As its function result, the I<seek> function should return 0 on success, and " |
| 458 |
"-1 on error." |
| 459 |
msgstr "" |
| 460 |
"В качестве результата функция I<seek> должна возвращать 0 при успешном " |
| 461 |
"выполнении и -1 при ошибке." |
| 462 |
|
| 463 |
#. type: Plain text |
| 464 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 465 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 466 |
msgid "" |
| 467 |
"If I<*seek> is a null pointer, then it is not possible to perform seek " |
| 468 |
"operations on the stream." |
| 469 |
msgstr "" |
| 470 |
"Если значение I<*seek> равно null, то операции смещения в потоке выполнить " |
| 471 |
"невозможно." |
| 472 |
|
| 473 |
#. type: TP |
| 474 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 475 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 476 |
#, no-wrap |
| 477 |
msgid "I<cookie_close_function_t *close>" |
| 478 |
msgstr "I<cookie_close_function_t *close>" |
| 479 |
|
| 480 |
#. type: Plain text |
| 481 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 482 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 483 |
msgid "" |
| 484 |
"This function closes the stream. The hook function can do things such as " |
| 485 |
"freeing buffers allocated for the stream. When called, it receives one " |
| 486 |
"argument:" |
| 487 |
msgstr "" |
| 488 |
"Эта функция закрывает поток. Обрабатывающая функция может выполнить такие " |
| 489 |
"операции как освобождение буферов, выделенных для потока. При вызове она " |
| 490 |
"принимает один аргумент:" |
| 491 |
|
| 492 |
#. type: Plain text |
| 493 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 494 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 495 |
#, fuzzy, no-wrap |
| 496 |
#| msgid " int close(void *cookie);\n" |
| 497 |
msgid "int close(void *cookie);\n" |
| 498 |
msgstr " int close(void *cookie);\n" |
| 499 |
|
| 500 |
#. type: Plain text |
| 501 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 502 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 503 |
msgid "" |
| 504 |
"The I<cookie> argument is the cookie that the programmer supplied when " |
| 505 |
"calling B<fopencookie>()." |
| 506 |
msgstr "" |
| 507 |
"Аргумент I<cookie> — это cookie, которую программист передал при вызове " |
| 508 |
"B<fopencookie>()." |
| 509 |
|
| 510 |
#. type: Plain text |
| 511 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 512 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 513 |
msgid "" |
| 514 |
"As its function result, the I<close> function should return 0 on success, " |
| 515 |
"and B<EOF> on error." |
| 516 |
msgstr "" |
| 517 |
"В качестве результата функция I<close> должна возвращать 0 при успешном " |
| 518 |
"выполнении и B<EOF> при ошибке." |
| 519 |
|
| 520 |
#. type: Plain text |
| 521 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 522 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 523 |
msgid "" |
| 524 |
"If I<*close> is NULL, then no special action is performed when the stream is " |
| 525 |
"closed." |
| 526 |
msgstr "" |
| 527 |
"Если значение I<*close> равно NULL, то при закрытии потока не выполняется " |
| 528 |
"никаких действий." |
| 529 |
|
| 530 |
#. type: SH |
| 531 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 532 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 533 |
#, no-wrap |
| 534 |
msgid "RETURN VALUE" |
| 535 |
msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" |
| 536 |
|
| 537 |
#. .SH ERRORS |
| 538 |
#. It's not clear if errno ever gets set... |
| 539 |
#. type: Plain text |
| 540 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 541 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 542 |
msgid "" |
| 543 |
"On success B<fopencookie>() returns a pointer to the new stream. On error, " |
| 544 |
"NULL is returned." |
| 545 |
msgstr "" |
| 546 |
"При успешном выполнении B<fopencookie>() возвращает указатель на новый " |
| 547 |
"поток. При ошибке возвращается NULL." |
| 548 |
|
| 549 |
#. type: SH |
| 550 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 551 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 552 |
#, no-wrap |
| 553 |
msgid "ATTRIBUTES" |
| 554 |
msgstr "АТРИБУТЫ" |
| 555 |
|
| 556 |
#. type: Plain text |
| 557 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 558 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 559 |
msgid "" |
| 560 |
"For an explanation of the terms used in this section, see B<attributes>(7)." |
| 561 |
msgstr "Описание терминов данного раздела смотрите в B<attributes>(7)." |
| 562 |
|
| 563 |
#. type: tbl table |
| 564 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 565 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 566 |
#, no-wrap |
| 567 |
msgid "Interface" |
| 568 |
msgstr "Интерфейс" |
| 569 |
|
| 570 |
#. type: tbl table |
| 571 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 572 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 573 |
#, no-wrap |
| 574 |
msgid "Attribute" |
| 575 |
msgstr "Атрибут" |
| 576 |
|
| 577 |
#. type: tbl table |
| 578 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 579 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 580 |
#, no-wrap |
| 581 |
msgid "Value" |
| 582 |
msgstr "Значение" |
| 583 |
|
| 584 |
#. type: tbl table |
| 585 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 586 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 587 |
#, no-wrap |
| 588 |
msgid ".na\n" |
| 589 |
msgstr ".na\n" |
| 590 |
|
| 591 |
#. type: tbl table |
| 592 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 593 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 594 |
#, no-wrap |
| 595 |
msgid ".nh\n" |
| 596 |
msgstr ".nh\n" |
| 597 |
|
| 598 |
#. type: tbl table |
| 599 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 600 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 601 |
#, no-wrap |
| 602 |
msgid "B<fopencookie>()" |
| 603 |
msgstr "B<fopencookie>()" |
| 604 |
|
| 605 |
#. type: tbl table |
| 606 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 607 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 608 |
#, no-wrap |
| 609 |
msgid "Thread safety" |
| 610 |
msgstr "Безвредность в нитях" |
| 611 |
|
| 612 |
#. type: tbl table |
| 613 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 614 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 615 |
#, no-wrap |
| 616 |
msgid "MT-Safe" |
| 617 |
msgstr "MT-Safe" |
| 618 |
|
| 619 |
#. type: SH |
| 620 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 621 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 622 |
#, no-wrap |
| 623 |
msgid "STANDARDS" |
| 624 |
msgstr "СТАНДАРТЫ" |
| 625 |
|
| 626 |
#. type: Plain text |
| 627 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 628 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 629 |
msgid "GNU." |
| 630 |
msgstr "GNU." |
| 631 |
|
| 632 |
#. type: SH |
| 633 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 634 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 635 |
#, no-wrap |
| 636 |
msgid "EXAMPLES" |
| 637 |
msgstr "ПРИМЕРЫ" |
| 638 |
|
| 639 |
#. type: Plain text |
| 640 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 641 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 642 |
msgid "" |
| 643 |
"The program below implements a custom stream whose functionality is similar " |
| 644 |
"(but not identical) to that available via B<fmemopen>(3). It implements a " |
| 645 |
"stream whose data is stored in a memory buffer. The program writes its " |
| 646 |
"command-line arguments to the stream, and then seeks through the stream " |
| 647 |
"reading two out of every five characters and writing them to standard " |
| 648 |
"output. The following shell session demonstrates the use of the program:" |
| 649 |
msgstr "" |
| 650 |
"Программа, представленная ниже, реализует нестандартный поток, свойства " |
| 651 |
"которого похожи (но не одинаковы) на свойство потока, получаемого от " |
| 652 |
"B<fmemopen>(3). Она реализует поток, данные которого хранятся в буфере " |
| 653 |
"памяти. Программа записывает свои аргументы командной строки в поток, а " |
| 654 |
"затем перемещается по потоку, читая два из каждых пяти символов и записывая " |
| 655 |
"их в стандартный вывод. Сеанс оболочки, демонстрирующий использование " |
| 656 |
"программы:" |
| 657 |
|
| 658 |
#. type: Plain text |
| 659 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 660 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 661 |
#, fuzzy, no-wrap |
| 662 |
#| msgid "" |
| 663 |
#| "$B< ./a.out \\(aqhello world\\(aq>\n" |
| 664 |
#| "/he/\n" |
| 665 |
#| "/ w/\n" |
| 666 |
#| "/d/\n" |
| 667 |
#| "Reached end of file\n" |
| 668 |
msgid "" |
| 669 |
"$B< ./a.out \\[aq]hello world\\[aq]>\n" |
| 670 |
"/he/\n" |
| 671 |
"/ w/\n" |
| 672 |
"/d/\n" |
| 673 |
"Reached end of file\n" |
| 674 |
msgstr "" |
| 675 |
"$B< ./a.out \\(aqhello world\\(aq>\n" |
| 676 |
"/he/\n" |
| 677 |
"/ w/\n" |
| 678 |
"/d/\n" |
| 679 |
"Достигнут конец файла\n" |
| 680 |
|
| 681 |
#. type: Plain text |
| 682 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 683 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 684 |
msgid "" |
| 685 |
"Note that a more general version of the program below could be improved to " |
| 686 |
"more robustly handle various error situations (e.g., opening a stream with a " |
| 687 |
"cookie that already has an open stream; closing a stream that has already " |
| 688 |
"been closed)." |
| 689 |
msgstr "" |
| 690 |
"Заметим, что представленную версию можно сильно улучшить, добавив обработку " |
| 691 |
"ошибок (например, открытие потока с cookie, которая уже имеет открытый " |
| 692 |
"поток; закрытие потока, который уже был закрыт)." |
| 693 |
|
| 694 |
#. type: SS |
| 695 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 696 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 697 |
#, no-wrap |
| 698 |
msgid "Program source" |
| 699 |
msgstr "Исходный код программы" |
| 700 |
|
| 701 |
#. type: Plain text |
| 702 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 703 |
#: opensuse-tumbleweed |
| 704 |
#, no-wrap |
| 705 |
msgid "" |
| 706 |
"#define _GNU_SOURCE\n" |
| 707 |
"#include E<lt>stdio.hE<gt>\n" |
| 708 |
"#include E<lt>stdlib.hE<gt>\n" |
| 709 |
"#include E<lt>string.hE<gt>\n" |
| 710 |
"#include E<lt>sys/types.hE<gt>\n" |
| 711 |
"#include E<lt>unistd.hE<gt>\n" |
| 712 |
"\\&\n" |
| 713 |
"#define INIT_BUF_SIZE 4\n" |
| 714 |
"\\&\n" |
| 715 |
"struct memfile_cookie {\n" |
| 716 |
" char *buf; /* Dynamically sized buffer for data */\n" |
| 717 |
" size_t allocated; /* Size of buf */\n" |
| 718 |
" size_t endpos; /* Number of characters in buf */\n" |
| 719 |
" off_t offset; /* Current file offset in buf */\n" |
| 720 |
"};\n" |
| 721 |
"\\&\n" |
| 722 |
"static ssize_t\n" |
| 723 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 724 |
"{\n" |
| 725 |
" char *new_buff;\n" |
| 726 |
" struct memfile_cookie *cookie = c;\n" |
| 727 |
"\\&\n" |
| 728 |
" /* Buffer too small? Keep doubling size until big enough. */\n" |
| 729 |
"\\&\n" |
| 730 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 731 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 732 |
" if (new_buff == NULL)\n" |
| 733 |
" return -1;\n" |
| 734 |
" cookie-E<gt>allocated *= 2;\n" |
| 735 |
" cookie-E<gt>buf = new_buff;\n" |
| 736 |
" }\n" |
| 737 |
"\\&\n" |
| 738 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 739 |
"\\&\n" |
| 740 |
" cookie-E<gt>offset += size;\n" |
| 741 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 742 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 743 |
"\\&\n" |
| 744 |
" return size;\n" |
| 745 |
"}\n" |
| 746 |
"\\&\n" |
| 747 |
"static ssize_t\n" |
| 748 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 749 |
"{\n" |
| 750 |
" ssize_t xbytes;\n" |
| 751 |
" struct memfile_cookie *cookie = c;\n" |
| 752 |
"\\&\n" |
| 753 |
" /* Fetch minimum of bytes requested and bytes available. */\n" |
| 754 |
"\\&\n" |
| 755 |
" xbytes = size;\n" |
| 756 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 757 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 758 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 759 |
" xbytes = 0;\n" |
| 760 |
"\\&\n" |
| 761 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 762 |
"\\&\n" |
| 763 |
" cookie-E<gt>offset += xbytes;\n" |
| 764 |
" return xbytes;\n" |
| 765 |
"}\n" |
| 766 |
"\\&\n" |
| 767 |
"static int\n" |
| 768 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 769 |
"{\n" |
| 770 |
" off_t new_offset;\n" |
| 771 |
" struct memfile_cookie *cookie = c;\n" |
| 772 |
"\\&\n" |
| 773 |
" if (whence == SEEK_SET)\n" |
| 774 |
" new_offset = *offset;\n" |
| 775 |
" else if (whence == SEEK_END)\n" |
| 776 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 777 |
" else if (whence == SEEK_CUR)\n" |
| 778 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 779 |
" else\n" |
| 780 |
" return -1;\n" |
| 781 |
"\\&\n" |
| 782 |
" if (new_offset E<lt> 0)\n" |
| 783 |
" return -1;\n" |
| 784 |
"\\&\n" |
| 785 |
" cookie-E<gt>offset = new_offset;\n" |
| 786 |
" *offset = new_offset;\n" |
| 787 |
" return 0;\n" |
| 788 |
"}\n" |
| 789 |
"\\&\n" |
| 790 |
"static int\n" |
| 791 |
"memfile_close(void *c)\n" |
| 792 |
"{\n" |
| 793 |
" struct memfile_cookie *cookie = c;\n" |
| 794 |
"\\&\n" |
| 795 |
" free(cookie-E<gt>buf);\n" |
| 796 |
" cookie-E<gt>allocated = 0;\n" |
| 797 |
" cookie-E<gt>buf = NULL;\n" |
| 798 |
"\\&\n" |
| 799 |
" return 0;\n" |
| 800 |
"}\n" |
| 801 |
"\\&\n" |
| 802 |
"int\n" |
| 803 |
"main(int argc, char *argv[])\n" |
| 804 |
"{\n" |
| 805 |
" cookie_io_functions_t memfile_func = {\n" |
| 806 |
" .read = memfile_read,\n" |
| 807 |
" .write = memfile_write,\n" |
| 808 |
" .seek = memfile_seek,\n" |
| 809 |
" .close = memfile_close\n" |
| 810 |
" };\n" |
| 811 |
" FILE *stream;\n" |
| 812 |
" struct memfile_cookie mycookie;\n" |
| 813 |
" size_t nread;\n" |
| 814 |
" char buf[1000];\n" |
| 815 |
"\\&\n" |
| 816 |
" /* Set up the cookie before calling fopencookie(). */\n" |
| 817 |
"\\&\n" |
| 818 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 819 |
" if (mycookie.buf == NULL) {\n" |
| 820 |
" perror(\"malloc\");\n" |
| 821 |
" exit(EXIT_FAILURE);\n" |
| 822 |
" }\n" |
| 823 |
"\\&\n" |
| 824 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 825 |
" mycookie.offset = 0;\n" |
| 826 |
" mycookie.endpos = 0;\n" |
| 827 |
"\\&\n" |
| 828 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 829 |
" if (stream == NULL) {\n" |
| 830 |
" perror(\"fopencookie\");\n" |
| 831 |
" exit(EXIT_FAILURE);\n" |
| 832 |
" }\n" |
| 833 |
"\\&\n" |
| 834 |
" /* Write command-line arguments to our file. */\n" |
| 835 |
"\\&\n" |
| 836 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 837 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 838 |
" perror(\"fputs\");\n" |
| 839 |
" exit(EXIT_FAILURE);\n" |
| 840 |
" }\n" |
| 841 |
"\\&\n" |
| 842 |
" /* Read two bytes out of every five, until EOF. */\n" |
| 843 |
"\\&\n" |
| 844 |
" for (long p = 0; ; p += 5) {\n" |
| 845 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 846 |
" perror(\"fseek\");\n" |
| 847 |
" exit(EXIT_FAILURE);\n" |
| 848 |
" }\n" |
| 849 |
" nread = fread(buf, 1, 2, stream);\n" |
| 850 |
" if (nread == 0) {\n" |
| 851 |
" if (ferror(stream) != 0) {\n" |
| 852 |
" fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 853 |
" exit(EXIT_FAILURE);\n" |
| 854 |
" }\n" |
| 855 |
" printf(\"Reached end of file\\[rs]n\");\n" |
| 856 |
" break;\n" |
| 857 |
" }\n" |
| 858 |
"\\&\n" |
| 859 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 860 |
" }\n" |
| 861 |
"\\&\n" |
| 862 |
" free(mycookie.buf);\n" |
| 863 |
"\\&\n" |
| 864 |
" exit(EXIT_SUCCESS);\n" |
| 865 |
"}\n" |
| 866 |
msgstr "" |
| 867 |
|
| 868 |
#. SRC END |
| 869 |
#. type: SH |
| 870 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 871 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 872 |
#, no-wrap |
| 873 |
msgid "NOTES" |
| 874 |
msgstr "ПРИМЕЧАНИЯ" |
| 875 |
|
| 876 |
#. type: Plain text |
| 877 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 878 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 879 |
msgid "" |
| 880 |
"B<_FILE_OFFSET_BITS> should be defined to be 64 in code that uses non-null " |
| 881 |
"I<seek> or that takes the address of B<fopencookie>, if the code is intended " |
| 882 |
"to be portable to traditional 32-bit x86 and ARM platforms where B<off_t>'s " |
| 883 |
"width defaults to 32 bits." |
| 884 |
msgstr "" |
| 885 |
|
| 886 |
#. type: SH |
| 887 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 888 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 889 |
#, no-wrap |
| 890 |
msgid "SEE ALSO" |
| 891 |
msgstr "СМОТРИТЕ ТАКЖЕ" |
| 892 |
|
| 893 |
#. type: Plain text |
| 894 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 895 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 896 |
msgid "B<fclose>(3), B<fmemopen>(3), B<fopen>(3), B<fseek>(3)" |
| 897 |
msgstr "B<fclose>(3), B<fmemopen>(3), B<fopen>(3), B<fseek>(3)" |
| 898 |
|
| 899 |
#. type: TH |
| 900 |
#: debian-trixie |
| 901 |
#, no-wrap |
| 902 |
msgid "2024-06-15" |
| 903 |
msgstr "15 июня 2024 г." |
| 904 |
|
| 905 |
#. type: TH |
| 906 |
#: debian-trixie |
| 907 |
#, no-wrap |
| 908 |
msgid "Linux man-pages 6.9.1" |
| 909 |
msgstr "Страницы руководства Linux 6.9.1" |
| 910 |
|
| 911 |
#. type: Plain text |
| 912 |
#: debian-trixie |
| 913 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 914 |
msgstr "Стандартная библиотека языка C (I<libc>, I<-lc>)" |
| 915 |
|
| 916 |
#. type: Plain text |
| 917 |
#: debian-trixie fedora-44 fedora-rawhide |
| 918 |
#, no-wrap |
| 919 |
msgid "" |
| 920 |
"#define _GNU_SOURCE\n" |
| 921 |
"#include E<lt>stdio.hE<gt>\n" |
| 922 |
"#include E<lt>stdlib.hE<gt>\n" |
| 923 |
"#include E<lt>string.hE<gt>\n" |
| 924 |
"#include E<lt>sys/types.hE<gt>\n" |
| 925 |
"#include E<lt>unistd.hE<gt>\n" |
| 926 |
"\\&\n" |
| 927 |
"#define INIT_BUF_SIZE 4\n" |
| 928 |
"\\&\n" |
| 929 |
"struct memfile_cookie {\n" |
| 930 |
" char *buf; /* Dynamically sized buffer for data */\n" |
| 931 |
" size_t allocated; /* Size of buf */\n" |
| 932 |
" size_t endpos; /* Number of characters in buf */\n" |
| 933 |
" off_t offset; /* Current file offset in buf */\n" |
| 934 |
"};\n" |
| 935 |
"\\&\n" |
| 936 |
"ssize_t\n" |
| 937 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 938 |
"{\n" |
| 939 |
" char *new_buff;\n" |
| 940 |
" struct memfile_cookie *cookie = c;\n" |
| 941 |
"\\&\n" |
| 942 |
" /* Buffer too small? Keep doubling size until big enough. */\n" |
| 943 |
"\\&\n" |
| 944 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 945 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 946 |
" if (new_buff == NULL)\n" |
| 947 |
" return -1;\n" |
| 948 |
" cookie-E<gt>allocated *= 2;\n" |
| 949 |
" cookie-E<gt>buf = new_buff;\n" |
| 950 |
" }\n" |
| 951 |
"\\&\n" |
| 952 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 953 |
"\\&\n" |
| 954 |
" cookie-E<gt>offset += size;\n" |
| 955 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 956 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 957 |
"\\&\n" |
| 958 |
" return size;\n" |
| 959 |
"}\n" |
| 960 |
"\\&\n" |
| 961 |
"ssize_t\n" |
| 962 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 963 |
"{\n" |
| 964 |
" ssize_t xbytes;\n" |
| 965 |
" struct memfile_cookie *cookie = c;\n" |
| 966 |
"\\&\n" |
| 967 |
" /* Fetch minimum of bytes requested and bytes available. */\n" |
| 968 |
"\\&\n" |
| 969 |
" xbytes = size;\n" |
| 970 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 971 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 972 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 973 |
" xbytes = 0;\n" |
| 974 |
"\\&\n" |
| 975 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 976 |
"\\&\n" |
| 977 |
" cookie-E<gt>offset += xbytes;\n" |
| 978 |
" return xbytes;\n" |
| 979 |
"}\n" |
| 980 |
"\\&\n" |
| 981 |
"int\n" |
| 982 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 983 |
"{\n" |
| 984 |
" off_t new_offset;\n" |
| 985 |
" struct memfile_cookie *cookie = c;\n" |
| 986 |
"\\&\n" |
| 987 |
" if (whence == SEEK_SET)\n" |
| 988 |
" new_offset = *offset;\n" |
| 989 |
" else if (whence == SEEK_END)\n" |
| 990 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 991 |
" else if (whence == SEEK_CUR)\n" |
| 992 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 993 |
" else\n" |
| 994 |
" return -1;\n" |
| 995 |
"\\&\n" |
| 996 |
" if (new_offset E<lt> 0)\n" |
| 997 |
" return -1;\n" |
| 998 |
"\\&\n" |
| 999 |
" cookie-E<gt>offset = new_offset;\n" |
| 1000 |
" *offset = new_offset;\n" |
| 1001 |
" return 0;\n" |
| 1002 |
"}\n" |
| 1003 |
"\\&\n" |
| 1004 |
"int\n" |
| 1005 |
"memfile_close(void *c)\n" |
| 1006 |
"{\n" |
| 1007 |
" struct memfile_cookie *cookie = c;\n" |
| 1008 |
"\\&\n" |
| 1009 |
" free(cookie-E<gt>buf);\n" |
| 1010 |
" cookie-E<gt>allocated = 0;\n" |
| 1011 |
" cookie-E<gt>buf = NULL;\n" |
| 1012 |
"\\&\n" |
| 1013 |
" return 0;\n" |
| 1014 |
"}\n" |
| 1015 |
"\\&\n" |
| 1016 |
"int\n" |
| 1017 |
"main(int argc, char *argv[])\n" |
| 1018 |
"{\n" |
| 1019 |
" cookie_io_functions_t memfile_func = {\n" |
| 1020 |
" .read = memfile_read,\n" |
| 1021 |
" .write = memfile_write,\n" |
| 1022 |
" .seek = memfile_seek,\n" |
| 1023 |
" .close = memfile_close\n" |
| 1024 |
" };\n" |
| 1025 |
" FILE *stream;\n" |
| 1026 |
" struct memfile_cookie mycookie;\n" |
| 1027 |
" size_t nread;\n" |
| 1028 |
" char buf[1000];\n" |
| 1029 |
"\\&\n" |
| 1030 |
" /* Set up the cookie before calling fopencookie(). */\n" |
| 1031 |
"\\&\n" |
| 1032 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 1033 |
" if (mycookie.buf == NULL) {\n" |
| 1034 |
" perror(\"malloc\");\n" |
| 1035 |
" exit(EXIT_FAILURE);\n" |
| 1036 |
" }\n" |
| 1037 |
"\\&\n" |
| 1038 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 1039 |
" mycookie.offset = 0;\n" |
| 1040 |
" mycookie.endpos = 0;\n" |
| 1041 |
"\\&\n" |
| 1042 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 1043 |
" if (stream == NULL) {\n" |
| 1044 |
" perror(\"fopencookie\");\n" |
| 1045 |
" exit(EXIT_FAILURE);\n" |
| 1046 |
" }\n" |
| 1047 |
"\\&\n" |
| 1048 |
" /* Write command-line arguments to our file. */\n" |
| 1049 |
"\\&\n" |
| 1050 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 1051 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 1052 |
" perror(\"fputs\");\n" |
| 1053 |
" exit(EXIT_FAILURE);\n" |
| 1054 |
" }\n" |
| 1055 |
"\\&\n" |
| 1056 |
" /* Read two bytes out of every five, until EOF. */\n" |
| 1057 |
"\\&\n" |
| 1058 |
" for (long p = 0; ; p += 5) {\n" |
| 1059 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 1060 |
" perror(\"fseek\");\n" |
| 1061 |
" exit(EXIT_FAILURE);\n" |
| 1062 |
" }\n" |
| 1063 |
" nread = fread(buf, 1, 2, stream);\n" |
| 1064 |
" if (nread == 0) {\n" |
| 1065 |
" if (ferror(stream) != 0) {\n" |
| 1066 |
" fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 1067 |
" exit(EXIT_FAILURE);\n" |
| 1068 |
" }\n" |
| 1069 |
" printf(\"Reached end of file\\[rs]n\");\n" |
| 1070 |
" break;\n" |
| 1071 |
" }\n" |
| 1072 |
"\\&\n" |
| 1073 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 1074 |
" }\n" |
| 1075 |
"\\&\n" |
| 1076 |
" free(mycookie.buf);\n" |
| 1077 |
"\\&\n" |
| 1078 |
" exit(EXIT_SUCCESS);\n" |
| 1079 |
"}\n" |
| 1080 |
msgstr "" |
| 1081 |
|
| 1082 |
#. type: TH |
| 1083 |
#: fedora-44 fedora-rawhide |
| 1084 |
#, no-wrap |
| 1085 |
msgid "2024-07-23" |
| 1086 |
msgstr "23 июля 2024 г." |
| 1087 |
|
| 1088 |
#. type: TH |
| 1089 |
#: fedora-44 fedora-rawhide |
| 1090 |
#, no-wrap |
| 1091 |
msgid "Linux man-pages 6.13" |
| 1092 |
msgstr "Страницы руководства Linux 6.13" |
| 1093 |
|
| 1094 |
#. type: TH |
| 1095 |
#: mageia-cauldron |
| 1096 |
#, no-wrap |
| 1097 |
msgid "Linux man-pages 6.17" |
| 1098 |
msgstr "Страницы руководства Linux 6.17" |
| 1099 |
|
| 1100 |
#. type: TH |
| 1101 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 1102 |
#, no-wrap |
| 1103 |
msgid "Linux man-pages (unreleased)" |
| 1104 |
msgstr "Страницы руководства Linux (не выпущены)" |