| 1 |
# Arabic translation of manpages |
| 2 |
# This file is distributed under the same license as the manpages-l10n package. |
| 3 |
# Copyright © of this file: |
| 4 |
# زايد السعيدي <[email protected]>, 2026. |
| 5 |
|
| 6 |
msgid "" |
| 7 |
msgstr "" |
| 8 |
"Project-Id-Version: manpages-l10n\n" |
| 9 |
"POT-Creation-Date: 2026-06-05 06:24+0200\n" |
| 10 |
"PO-Revision-Date: 2026-06-06 08:52+0400\n" |
| 11 |
"Last-Translator: Zayed Al-Saidi <[email protected]>\n" |
| 12 |
"Language-Team: Arabic <[email protected]>\n" |
| 13 |
"Language: ar\n" |
| 14 |
"MIME-Version: 1.0\n" |
| 15 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 16 |
"Content-Transfer-Encoding: 8bit\n" |
| 17 |
".MIME-Version: 1.0\n" |
| 18 |
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 &&" |
| 19 |
" n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" |
| 20 |
"X-Generator: Lokalize 23.08.5\n" |
| 21 |
|
| 22 |
#. type: TH |
| 23 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 24 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 25 |
#, no-wrap |
| 26 |
msgid "fopencookie" |
| 27 |
msgstr "fopencookie" |
| 28 |
|
| 29 |
#. type: TH |
| 30 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 31 |
#: opensuse-tumbleweed |
| 32 |
#, no-wrap |
| 33 |
msgid "2025-09-21" |
| 34 |
msgstr "21 سبتمبر 2025" |
| 35 |
|
| 36 |
#. type: TH |
| 37 |
#: archlinux debian-unstable |
| 38 |
#, no-wrap |
| 39 |
msgid "Linux man-pages 6.18" |
| 40 |
msgstr "صفحات دليل لينكس 6.18" |
| 41 |
|
| 42 |
#. type: SH |
| 43 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 44 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 45 |
#, no-wrap |
| 46 |
msgid "NAME" |
| 47 |
msgstr "الاسم" |
| 48 |
|
| 49 |
#. type: Plain text |
| 50 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 51 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 52 |
msgid "fopencookie - open a custom stream" |
| 53 |
msgstr "fopencookie - فتح دفق مخصص" |
| 54 |
|
| 55 |
#. type: SH |
| 56 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 57 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 58 |
#, no-wrap |
| 59 |
msgid "LIBRARY" |
| 60 |
msgstr "المكتبة" |
| 61 |
|
| 62 |
#. type: Plain text |
| 63 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 64 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 65 |
msgid "Standard C library (I<libc>,\\ I<-lc>)" |
| 66 |
msgstr "مكتبة سي المعيارية (I<libc>،\\ I<-lc>)" |
| 67 |
|
| 68 |
#. type: SH |
| 69 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 70 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 71 |
#, no-wrap |
| 72 |
msgid "SYNOPSIS" |
| 73 |
msgstr "موجز" |
| 74 |
|
| 75 |
#. type: Plain text |
| 76 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 77 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 78 |
#, no-wrap |
| 79 |
msgid "" |
| 80 |
"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" |
| 81 |
"B<#define _FILE_OFFSET_BITS 64>\n" |
| 82 |
"B<#include E<lt>stdio.hE<gt>>\n" |
| 83 |
msgstr "" |
| 84 |
"B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" |
| 85 |
"B<#define _FILE_OFFSET_BITS 64>\n" |
| 86 |
"B<#include E<lt>stdio.hE<gt>>\n" |
| 87 |
|
| 88 |
#. type: Plain text |
| 89 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 90 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 91 |
#, no-wrap |
| 92 |
msgid "" |
| 93 |
"B<FILE *fopencookie(void *restrict >I<cookie>B<, const char *restrict >I<mode" |
| 94 |
">B<,>\n" |
| 95 |
"B< cookie_io_functions_t >I<io_funcs>B<);>\n" |
| 96 |
msgstr "" |
| 97 |
"B<FILE *fopencookie(void *restrict >I<cookie>B<, const char *restrict >I<mode" |
| 98 |
">B<,>\n" |
| 99 |
"B< cookie_io_functions_t >I<io_funcs>B<);>\n" |
| 100 |
|
| 101 |
#. type: SH |
| 102 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 103 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 104 |
#, no-wrap |
| 105 |
msgid "DESCRIPTION" |
| 106 |
msgstr "الوصف" |
| 107 |
|
| 108 |
#. type: Plain text |
| 109 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 110 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 111 |
msgid "" |
| 112 |
"The B<fopencookie>() function allows the programmer to create a custom " |
| 113 |
"implementation for a standard I/O stream. This implementation can store the " |
| 114 |
"stream's data at a location of its own choosing; for example, " |
| 115 |
"B<fopencookie>() is used to implement B<fmemopen>(3), which provides a " |
| 116 |
"stream interface to data that is stored in a buffer in memory." |
| 117 |
msgstr "" |
| 118 |
"تسمح الدالة B<fopencookie>() للمبرمج بإنشاء تنفيذ مخصص لدفق إدخال/إخراج " |
| 119 |
"قياسي. يمكن لهذا التنفيذ تخزين بيانات الدفق في موقع يختاره بنفسه؛ على سبيل " |
| 120 |
"المثال، تُستخدم B<fopencookie>() لتنفيذ B<fmemopen>(3)، التي توفر واجهة دفق " |
| 121 |
"للبيانات المخزنة في مخزن مؤقت في الذاكرة." |
| 122 |
|
| 123 |
#. type: Plain text |
| 124 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 125 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 126 |
msgid "In order to create a custom stream the programmer must:" |
| 127 |
msgstr "لإنشاء دفق مخصص، يجب على المبرمج:" |
| 128 |
|
| 129 |
#. type: IP |
| 130 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 131 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 132 |
#, no-wrap |
| 133 |
msgid "\\[bu]" |
| 134 |
msgstr "\\[bu]" |
| 135 |
|
| 136 |
#. type: Plain text |
| 137 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 138 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 139 |
msgid "" |
| 140 |
"Implement four \"hook\" functions that are used internally by the standard I/" |
| 141 |
"O library when performing I/O on the stream." |
| 142 |
msgstr "" |
| 143 |
"تنفيذ أربع دوال \"خطافية\" تُستخدم داخليًا بواسطة مكتبة الإدخال/الإخراج " |
| 144 |
"القياسية عند تنفيذ الإدخال/الإخراج على الدفق." |
| 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 |
#| "Define a \"cookie\" data type, a structure that provides bookkeeping " |
| 151 |
#| "information (e.g., where to store data) used by the aforementioned hook " |
| 152 |
#| "functions. The standard I/O package knows nothing about the contents of " |
| 153 |
#| "this cookie (thus it is typed as I<void\\~*> when passed to " |
| 154 |
#| "B<fopencookie>()), but automatically supplies the cookie as the first " |
| 155 |
#| "argument when calling the hook functions." |
| 156 |
msgid "" |
| 157 |
"Define a \"cookie\" data type, a structure that provides bookkeeping " |
| 158 |
"information (e.g., where to store data) used by the aforementioned hook " |
| 159 |
"functions. The standard I/O package knows nothing about the contents of " |
| 160 |
"this cookie (thus it is typed as I<void\\ *> when passed to " |
| 161 |
"B<fopencookie>()), but automatically supplies the cookie as the first " |
| 162 |
"argument when calling the hook functions." |
| 163 |
msgstr "" |
| 164 |
"تحديد نوع بيانات \"كعكة\" (cookie)، وهي بنية توفر معلومات الحفظ والسجلات " |
| 165 |
"(مثل مكان تخزين البيانات) التي تُستخدم من قِبل دالات الخطاف (hook functions) " |
| 166 |
"المذكورة سابقاً. لا تحوز حزمة الإدخال/الإخراج القياسية أي معرفة بمحتويات هذه " |
| 167 |
"الكعكة (لذا تُعرّف بالنوع I<void\\ *> عند تمريرها إلى الدالة " |
| 168 |
"B<fopencookie>())، ولكنها تمرر الكعكة تلقائياً بصفتها وسيطاً أولاً عند" |
| 169 |
" استدعاء " |
| 170 |
"دالات الخطاف." |
| 171 |
|
| 172 |
#. type: Plain text |
| 173 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 174 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 175 |
msgid "" |
| 176 |
"Call B<fopencookie>() to open a new stream and associate the cookie and " |
| 177 |
"hook functions with that stream." |
| 178 |
msgstr "" |
| 179 |
"استدعاء B<fopencookie>() لفتح دفق جديد وربط الخبيئة ودوال الخطاف بهذا الدفق." |
| 180 |
|
| 181 |
#. type: Plain text |
| 182 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 183 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 184 |
msgid "" |
| 185 |
"The B<fopencookie>() function serves a purpose similar to B<fopen>(3): it " |
| 186 |
"opens a new stream and returns a pointer to a I<FILE> object that is used to " |
| 187 |
"operate on that stream." |
| 188 |
msgstr "" |
| 189 |
"تخدم الدالة B<fopencookie>() غرضًا مشابهًا لـ B<fopen>(3): فهي تفتح دفقًا " |
| 190 |
"جديدًا وتُعيد مؤشرًا إلى كائن I<FILE> يُستخدم للتعامل مع ذلك الدفق." |
| 191 |
|
| 192 |
#. type: Plain text |
| 193 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 194 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 195 |
msgid "" |
| 196 |
"The I<cookie> argument is a pointer to the caller's cookie structure that is " |
| 197 |
"to be associated with the new stream. This pointer is supplied as the first " |
| 198 |
"argument when the standard I/O library invokes any of the hook functions " |
| 199 |
"described below." |
| 200 |
msgstr "" |
| 201 |
"الوسيط I<cookie> هو مؤشر إلى هيكل الخبيئة الخاص بالمستدعي الذي سيُربط بالدفق " |
| 202 |
"الجديد. يُوفر هذا المؤشر كوسيط أول عندما تستدعي مكتبة الإدخال/الإخراج " |
| 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<mode> argument serves the same purpose as for B<fopen>(3). The " |
| 210 |
"following modes are supported: I<r>, I<w>, I<a>, I<r+>, I<w+>, and I<a+>. " |
| 211 |
"See B<fopen>(3) for details." |
| 212 |
msgstr "" |
| 213 |
"يخدم الوسيط I<mode> نفس الغرض كما في B<fopen>(3). الأوضاع التالية مدعومة: " |
| 214 |
"I<r>، I<w>، I<a>، I<r+>، I<w+>، و I<a+>. انظر B<fopen>(3) للتفاصيل." |
| 215 |
|
| 216 |
#. type: Plain text |
| 217 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 218 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 219 |
msgid "" |
| 220 |
"The I<io_funcs> argument is a structure that contains four fields pointing " |
| 221 |
"to the programmer-defined hook functions that are used to implement this " |
| 222 |
"stream. The structure is defined as follows" |
| 223 |
msgstr "" |
| 224 |
"الوسيط I<io_funcs> هو هيكل يحتوي على أربعة حقول تشير إلى دوال الخطاف المعرفة " |
| 225 |
"من قبل المبرمج والتي تُستخدم لتنفيذ هذا الدفق. يُعرف الهيكل كالتالي" |
| 226 |
|
| 227 |
#. type: Plain text |
| 228 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 229 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 230 |
#, no-wrap |
| 231 |
msgid "" |
| 232 |
"typedef struct {\n" |
| 233 |
" cookie_read_function_t *read;\n" |
| 234 |
" cookie_write_function_t *write;\n" |
| 235 |
" cookie_seek_function_t *seek;\n" |
| 236 |
" cookie_close_function_t *close;\n" |
| 237 |
"} cookie_io_functions_t;\n" |
| 238 |
msgstr "" |
| 239 |
"typedef struct {\n" |
| 240 |
" cookie_read_function_t *read;\n" |
| 241 |
" cookie_write_function_t *write;\n" |
| 242 |
" cookie_seek_function_t *seek;\n" |
| 243 |
" cookie_close_function_t *close;\n" |
| 244 |
"} cookie_io_functions_t;\n" |
| 245 |
|
| 246 |
#. type: Plain text |
| 247 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 248 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 249 |
msgid "The four fields are as follows:" |
| 250 |
msgstr "الحقول الأربعة هي كالتالي:" |
| 251 |
|
| 252 |
#. type: TP |
| 253 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 254 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 255 |
#, no-wrap |
| 256 |
msgid "I<cookie_read_function_t *read>" |
| 257 |
msgstr "I<cookie_read_function_t *read>" |
| 258 |
|
| 259 |
#. type: Plain text |
| 260 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 261 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 262 |
msgid "" |
| 263 |
"This function implements read operations for the stream. When called, it " |
| 264 |
"receives three arguments:" |
| 265 |
msgstr "" |
| 266 |
"تنفذ هذه الدالة عمليات القراءة للدفق. عند استدعائها، تتلقى ثلاثة وسائط:" |
| 267 |
|
| 268 |
#. type: Plain text |
| 269 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 270 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 271 |
#, no-wrap |
| 272 |
msgid "ssize_t read(void *cookie, char *buf, size_t size);\n" |
| 273 |
msgstr "ssize_t read(void *cookie, char *buf, size_t size);\n" |
| 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 |
"The I<buf> and I<size> arguments are, respectively, a buffer into which " |
| 280 |
"input data can be placed and the size of that buffer. As its function " |
| 281 |
"result, the I<read> function should return the number of bytes copied into " |
| 282 |
"I<buf>, 0 on end of file, or -1 on error. The I<read> function should " |
| 283 |
"update the stream offset appropriately." |
| 284 |
msgstr "" |
| 285 |
"الوسيطان I<buf> و I<size> هما، على التوالي، مخزن يمكن وضع بيانات الإدخال فيه " |
| 286 |
"وحجم ذلك المخزن. كنتيجة للدالة، يجب أن تُعيد دالة I<read> عدد البايتات " |
| 287 |
"المنسوخة إلى I<buf>، أو 0 عند نهاية الملف، أو -1 عند الخطأ. يجب أن تُحدّث" |
| 288 |
" دالة " |
| 289 |
"I<read> إزاحة الدفق بشكل مناسب." |
| 290 |
|
| 291 |
#. type: Plain text |
| 292 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 293 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 294 |
msgid "" |
| 295 |
"If I<*read> is a null pointer, then reads from the custom stream always " |
| 296 |
"return end of file." |
| 297 |
msgstr "" |
| 298 |
"إذا كان I<*read> مؤشرًا فارغًا، فإن القراءات من الدفق المخصص تُعيد دائمًا" |
| 299 |
" نهاية " |
| 300 |
"الملف." |
| 301 |
|
| 302 |
#. type: TP |
| 303 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 304 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 305 |
#, no-wrap |
| 306 |
msgid "I<cookie_write_function_t *write>" |
| 307 |
msgstr "I<cookie_write_function_t *write>" |
| 308 |
|
| 309 |
#. type: Plain text |
| 310 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 311 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 312 |
msgid "" |
| 313 |
"This function implements write operations for the stream. When called, it " |
| 314 |
"receives three arguments:" |
| 315 |
msgstr "" |
| 316 |
"تنفذ هذه الدالة عمليات الكتابة للدفق. عند استدعائها، تستقبل ثلاث وسائط:" |
| 317 |
|
| 318 |
#. type: Plain text |
| 319 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 320 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 321 |
#, no-wrap |
| 322 |
msgid "ssize_t write(void *cookie, const char *buf, size_t size);\n" |
| 323 |
msgstr "ssize_t write(void *cookie, const char *buf, size_t size);\n" |
| 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 |
"The I<buf> and I<size> arguments are, respectively, a buffer of data to be " |
| 330 |
"output to the stream and the size of that buffer. As its function result, " |
| 331 |
"the I<write> function should return the number of bytes copied from I<buf>, " |
| 332 |
"or 0 on error. (The function must not return a negative value.) The " |
| 333 |
"I<write> function should update the stream offset appropriately." |
| 334 |
msgstr "" |
| 335 |
"الوسيطان I<buf> و I<size> هما، على التوالي، مخزن بيانات سيُخرج إلى الدفق وحجم " |
| 336 |
"ذلك المخزن. كنتيجة لدالتها، يجب على دالة I<write> أن تُرجع عدد البايتات " |
| 337 |
"المنسوخة من I<buf>، أو 0 عند الخطأ. (يجب ألا تُرجع الدالة قيمة سالبة.) يجب " |
| 338 |
"على دالة I<write> أن تُحدّث إزاحة الدفق بشكل مناسب." |
| 339 |
|
| 340 |
#. type: Plain text |
| 341 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 342 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 343 |
msgid "If I<*write> is a null pointer, then output to the stream is discarded." |
| 344 |
msgstr "إذا كان I<*write> مؤشرًا فارغًا، فسيُتجاهل الإخراج إلى الدفق." |
| 345 |
|
| 346 |
#. type: TP |
| 347 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 348 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 349 |
#, no-wrap |
| 350 |
msgid "I<cookie_seek_function_t *seek>" |
| 351 |
msgstr "I<cookie_seek_function_t *seek>" |
| 352 |
|
| 353 |
#. type: Plain text |
| 354 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 355 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 356 |
msgid "" |
| 357 |
"This function implements seek operations on the stream. When called, it " |
| 358 |
"receives three arguments:" |
| 359 |
msgstr "" |
| 360 |
"تنفذ هذه الدالة عمليات البحث في الدفق. عند استدعائها، تستقبل ثلاث وسائط:" |
| 361 |
|
| 362 |
#. type: Plain text |
| 363 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 364 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 365 |
#, no-wrap |
| 366 |
msgid "int seek(void *cookie, off_t *offset, int whence);\n" |
| 367 |
msgstr "int seek(void *cookie, off_t *offset, int whence);\n" |
| 368 |
|
| 369 |
#. type: Plain text |
| 370 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 371 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 372 |
msgid "" |
| 373 |
"The I<*offset> argument specifies the new file offset depending on which of " |
| 374 |
"the following three values is supplied in I<whence>:" |
| 375 |
msgstr "" |
| 376 |
"يحدد الوسيط I<*offset> إزاحة الملف الجديدة اعتمادًا على أي من القيم الثلاث " |
| 377 |
"التالية المُقدمة في I<whence>:" |
| 378 |
|
| 379 |
#. type: TP |
| 380 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 381 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 382 |
#, no-wrap |
| 383 |
msgid "B<SEEK_SET>" |
| 384 |
msgstr "B<SEEK_SET>" |
| 385 |
|
| 386 |
#. type: Plain text |
| 387 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 388 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 389 |
msgid "" |
| 390 |
"The stream offset should be set I<*offset> bytes from the start of the " |
| 391 |
"stream." |
| 392 |
msgstr "يجب ضبط إزاحة الدفق على I<*offset> بايت من بداية الدفق." |
| 393 |
|
| 394 |
#. type: TP |
| 395 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 396 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 397 |
#, no-wrap |
| 398 |
msgid "B<SEEK_CUR>" |
| 399 |
msgstr "B<SEEK_CUR>" |
| 400 |
|
| 401 |
#. type: Plain text |
| 402 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 403 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 404 |
msgid "I<*offset> should be added to the current stream offset." |
| 405 |
msgstr "يجب إضافة I<*offset> إلى إزاحة الدفق الحالية." |
| 406 |
|
| 407 |
#. type: TP |
| 408 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 409 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 410 |
#, no-wrap |
| 411 |
msgid "B<SEEK_END>" |
| 412 |
msgstr "B<SEEK_END>" |
| 413 |
|
| 414 |
#. type: Plain text |
| 415 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 416 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 417 |
msgid "" |
| 418 |
"The stream offset should be set to the size of the stream plus I<*offset>." |
| 419 |
msgstr "يجب ضبط إزاحة الدفق على حجم الدفق زائد I<*offset>." |
| 420 |
|
| 421 |
#. type: Plain text |
| 422 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 423 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 424 |
msgid "" |
| 425 |
"Before returning, the I<seek> function should update I<*offset> to indicate " |
| 426 |
"the new stream offset." |
| 427 |
msgstr "" |
| 428 |
"قبل الإرجاع، يجب على دالة I<seek> أن تُحدّث I<*offset> للإشارة إلى إزاحة" |
| 429 |
" الدفق " |
| 430 |
"الجديدة." |
| 431 |
|
| 432 |
#. type: Plain text |
| 433 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 434 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 435 |
msgid "" |
| 436 |
"As its function result, the I<seek> function should return 0 on success, and " |
| 437 |
"-1 on error." |
| 438 |
msgstr "" |
| 439 |
"كنتيجة لدالتها، يجب على دالة I<seek> أن تُرجع 0 عند النجاح، و -1 عند الخطأ." |
| 440 |
|
| 441 |
#. type: Plain text |
| 442 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 443 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 444 |
msgid "" |
| 445 |
"If I<*seek> is a null pointer, then it is not possible to perform seek " |
| 446 |
"operations on the stream." |
| 447 |
msgstr "" |
| 448 |
"إذا كان I<*seek> مؤشرًا فارغًا، فمن غير الممكن تنفيذ عمليات بحث على الدفق." |
| 449 |
|
| 450 |
#. type: TP |
| 451 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 452 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 453 |
#, no-wrap |
| 454 |
msgid "I<cookie_close_function_t *close>" |
| 455 |
msgstr "I<cookie_close_function_t *close>" |
| 456 |
|
| 457 |
#. type: Plain text |
| 458 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 459 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 460 |
msgid "" |
| 461 |
"This function closes the stream. The hook function can do things such as " |
| 462 |
"freeing buffers allocated for the stream. When called, it receives one " |
| 463 |
"argument:" |
| 464 |
msgstr "" |
| 465 |
"تغلق هذه الدالة الدفق. يمكن لدالة الخطاف أن تفعل أشياء مثل تحرير المخازن " |
| 466 |
"المُخصصة للدفق. عند استدعائها، تستقبل وسيطًا واحدًا:" |
| 467 |
|
| 468 |
#. type: Plain text |
| 469 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 470 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 471 |
#, no-wrap |
| 472 |
msgid "int close(void *cookie);\n" |
| 473 |
msgstr "int close(void *cookie);\n" |
| 474 |
|
| 475 |
#. type: Plain text |
| 476 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 477 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 478 |
msgid "" |
| 479 |
"The I<cookie> argument is the cookie that the programmer supplied when " |
| 480 |
"calling B<fopencookie>()." |
| 481 |
msgstr "" |
| 482 |
"الوسيط I<cookie> هو الكعكة التي قدمها المبرمج عند استدعاء B<fopencookie>()." |
| 483 |
|
| 484 |
#. type: Plain text |
| 485 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 486 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 487 |
msgid "" |
| 488 |
"As its function result, the I<close> function should return 0 on success, " |
| 489 |
"and B<EOF> on error." |
| 490 |
msgstr "" |
| 491 |
"كنتيجة لدالتها، يجب على دالة I<close> أن تُرجع 0 عند النجاح، و B<EOF> عند " |
| 492 |
"الخطأ." |
| 493 |
|
| 494 |
#. type: Plain text |
| 495 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 496 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 497 |
msgid "" |
| 498 |
"If I<*close> is NULL, then no special action is performed when the stream is " |
| 499 |
"closed." |
| 500 |
msgstr "إذا كان I<*close> NULL، فلن يُنفذ أي إجراء خاص عند إغلاق الدفق." |
| 501 |
|
| 502 |
#. type: SH |
| 503 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 504 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 505 |
#, no-wrap |
| 506 |
msgid "RETURN VALUE" |
| 507 |
msgstr "قيمة الإرجاع" |
| 508 |
|
| 509 |
#. .SH ERRORS |
| 510 |
#. It's not clear if errno ever gets set... |
| 511 |
#. type: Plain text |
| 512 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 513 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 514 |
msgid "" |
| 515 |
"On success B<fopencookie>() returns a pointer to the new stream. On error, " |
| 516 |
"NULL is returned." |
| 517 |
msgstr "" |
| 518 |
"عند النجاح، تُرجع B<fopencookie>() مؤشرًا إلى التدفق الجديد. عند الخطأ، يُرجع " |
| 519 |
"NULL." |
| 520 |
|
| 521 |
#. type: SH |
| 522 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 523 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 524 |
#, no-wrap |
| 525 |
msgid "ATTRIBUTES" |
| 526 |
msgstr "السمات" |
| 527 |
|
| 528 |
#. type: Plain text |
| 529 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 530 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 531 |
msgid "" |
| 532 |
"For an explanation of the terms used in this section, see B<attributes>(7)." |
| 533 |
msgstr "" |
| 534 |
"للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B<attributes>(7)." |
| 535 |
|
| 536 |
#. type: tbl table |
| 537 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 538 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 539 |
#, no-wrap |
| 540 |
msgid "Interface" |
| 541 |
msgstr "الواجهة" |
| 542 |
|
| 543 |
#. type: tbl table |
| 544 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 545 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 546 |
#, no-wrap |
| 547 |
msgid "Attribute" |
| 548 |
msgstr "السمة" |
| 549 |
|
| 550 |
#. type: tbl table |
| 551 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 552 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 553 |
#, no-wrap |
| 554 |
msgid "Value" |
| 555 |
msgstr "القيمة" |
| 556 |
|
| 557 |
#. type: tbl table |
| 558 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 559 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 560 |
#, no-wrap |
| 561 |
msgid ".na\n" |
| 562 |
msgstr ".na\n" |
| 563 |
|
| 564 |
#. type: tbl table |
| 565 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 566 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 567 |
#, no-wrap |
| 568 |
msgid ".nh\n" |
| 569 |
msgstr ".nh\n" |
| 570 |
|
| 571 |
#. type: tbl table |
| 572 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 573 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 574 |
#, no-wrap |
| 575 |
msgid "B<fopencookie>()" |
| 576 |
msgstr "B<fopencookie>()" |
| 577 |
|
| 578 |
#. type: tbl table |
| 579 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 580 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 581 |
#, no-wrap |
| 582 |
msgid "Thread safety" |
| 583 |
msgstr "سلامة الخيوط" |
| 584 |
|
| 585 |
#. type: tbl table |
| 586 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 587 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 588 |
#, no-wrap |
| 589 |
msgid "MT-Safe" |
| 590 |
msgstr "MT-Safe" |
| 591 |
|
| 592 |
#. type: SH |
| 593 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 594 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 595 |
#, no-wrap |
| 596 |
msgid "STANDARDS" |
| 597 |
msgstr "المعايير" |
| 598 |
|
| 599 |
#. type: Plain text |
| 600 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 601 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 602 |
msgid "GNU." |
| 603 |
msgstr "GNU." |
| 604 |
|
| 605 |
#. type: SH |
| 606 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 607 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 608 |
#, no-wrap |
| 609 |
msgid "EXAMPLES" |
| 610 |
msgstr "أمثلة" |
| 611 |
|
| 612 |
#. type: Plain text |
| 613 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 614 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 615 |
msgid "" |
| 616 |
"The program below implements a custom stream whose functionality is similar " |
| 617 |
"(but not identical) to that available via B<fmemopen>(3). It implements a " |
| 618 |
"stream whose data is stored in a memory buffer. The program writes its " |
| 619 |
"command-line arguments to the stream, and then seeks through the stream " |
| 620 |
"reading two out of every five characters and writing them to standard " |
| 621 |
"output. The following shell session demonstrates the use of the program:" |
| 622 |
msgstr "" |
| 623 |
"البرنامج أدناه يُنفذ تدفقًا مخصصًا وظيفته مشابهة (ولكن ليست مطابقة) لتلك " |
| 624 |
"المتاحة عبر B<fmemopen>(3). يُنفذ تدفقًا تُخزّن بياناته في مخزن مؤقت للذاكرة. " |
| 625 |
"يكتب البرنامج وسائط سطر الأوامر إلى التدفق، ثم يبحث عبر التدفق قارئًا حرفين " |
| 626 |
"من كل خمسة أحرف ويكتبها إلى المخرجات القياسية. جلسة الصدفة التالية تُظهر " |
| 627 |
"استخدام البرنامج:" |
| 628 |
|
| 629 |
#. type: Plain text |
| 630 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 631 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 632 |
#, no-wrap |
| 633 |
msgid "" |
| 634 |
"$B< ./a.out \\[aq]hello world\\[aq]>\n" |
| 635 |
"/he/\n" |
| 636 |
"/ w/\n" |
| 637 |
"/d/\n" |
| 638 |
"Reached end of file\n" |
| 639 |
msgstr "" |
| 640 |
"$B< ./a.out \\[aq]hello world\\[aq]>\n" |
| 641 |
"/he/\n" |
| 642 |
"/ w/\n" |
| 643 |
"/d/\n" |
| 644 |
"Reached end of file\n" |
| 645 |
|
| 646 |
#. type: Plain text |
| 647 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 648 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 649 |
msgid "" |
| 650 |
"Note that a more general version of the program below could be improved to " |
| 651 |
"more robustly handle various error situations (e.g., opening a stream with a " |
| 652 |
"cookie that already has an open stream; closing a stream that has already " |
| 653 |
"been closed)." |
| 654 |
msgstr "" |
| 655 |
"لاحظ أن نسخة أكثر عمومية من البرنامج أدناه يُمكن تحسينها للتعامل بشكل أكثر " |
| 656 |
"متانة مع حالات خطأ متنوعة (مثل، فتح تدفق باستخدام كعكة لديها بالفعل تدفق " |
| 657 |
"مفتوح؛ إغلاق تدفق أُغلق بالفعل)." |
| 658 |
|
| 659 |
#. type: SS |
| 660 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 661 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 662 |
#, no-wrap |
| 663 |
msgid "Program source" |
| 664 |
msgstr "مصدر البرنامج" |
| 665 |
|
| 666 |
#. type: Plain text |
| 667 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 668 |
#: opensuse-tumbleweed |
| 669 |
#, no-wrap |
| 670 |
msgid "" |
| 671 |
"#define _GNU_SOURCE\n" |
| 672 |
"#include E<lt>stdio.hE<gt>\n" |
| 673 |
"#include E<lt>stdlib.hE<gt>\n" |
| 674 |
"#include E<lt>string.hE<gt>\n" |
| 675 |
"#include E<lt>sys/types.hE<gt>\n" |
| 676 |
"#include E<lt>unistd.hE<gt>\n" |
| 677 |
"\\&\n" |
| 678 |
"#define INIT_BUF_SIZE 4\n" |
| 679 |
"\\&\n" |
| 680 |
"struct memfile_cookie {\n" |
| 681 |
" char *buf; /* Dynamically sized buffer for data */\n" |
| 682 |
" size_t allocated; /* Size of buf */\n" |
| 683 |
" size_t endpos; /* Number of characters in buf */\n" |
| 684 |
" off_t offset; /* Current file offset in buf */\n" |
| 685 |
"};\n" |
| 686 |
"\\&\n" |
| 687 |
"static ssize_t\n" |
| 688 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 689 |
"{\n" |
| 690 |
" char *new_buff;\n" |
| 691 |
" struct memfile_cookie *cookie = c;\n" |
| 692 |
"\\&\n" |
| 693 |
" /* Buffer too small? Keep doubling size until big enough. */\n" |
| 694 |
"\\&\n" |
| 695 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 696 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 697 |
" if (new_buff == NULL)\n" |
| 698 |
" return -1;\n" |
| 699 |
" cookie-E<gt>allocated *= 2;\n" |
| 700 |
" cookie-E<gt>buf = new_buff;\n" |
| 701 |
" }\n" |
| 702 |
"\\&\n" |
| 703 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 704 |
"\\&\n" |
| 705 |
" cookie-E<gt>offset += size;\n" |
| 706 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 707 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 708 |
"\\&\n" |
| 709 |
" return size;\n" |
| 710 |
"}\n" |
| 711 |
"\\&\n" |
| 712 |
"static ssize_t\n" |
| 713 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 714 |
"{\n" |
| 715 |
" ssize_t xbytes;\n" |
| 716 |
" struct memfile_cookie *cookie = c;\n" |
| 717 |
"\\&\n" |
| 718 |
" /* Fetch minimum of bytes requested and bytes available. */\n" |
| 719 |
"\\&\n" |
| 720 |
" xbytes = size;\n" |
| 721 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 722 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 723 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 724 |
" xbytes = 0;\n" |
| 725 |
"\\&\n" |
| 726 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 727 |
"\\&\n" |
| 728 |
" cookie-E<gt>offset += xbytes;\n" |
| 729 |
" return xbytes;\n" |
| 730 |
"}\n" |
| 731 |
"\\&\n" |
| 732 |
"static int\n" |
| 733 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 734 |
"{\n" |
| 735 |
" off_t new_offset;\n" |
| 736 |
" struct memfile_cookie *cookie = c;\n" |
| 737 |
"\\&\n" |
| 738 |
" if (whence == SEEK_SET)\n" |
| 739 |
" new_offset = *offset;\n" |
| 740 |
" else if (whence == SEEK_END)\n" |
| 741 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 742 |
" else if (whence == SEEK_CUR)\n" |
| 743 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 744 |
" else\n" |
| 745 |
" return -1;\n" |
| 746 |
"\\&\n" |
| 747 |
" if (new_offset E<lt> 0)\n" |
| 748 |
" return -1;\n" |
| 749 |
"\\&\n" |
| 750 |
" cookie-E<gt>offset = new_offset;\n" |
| 751 |
" *offset = new_offset;\n" |
| 752 |
" return 0;\n" |
| 753 |
"}\n" |
| 754 |
"\\&\n" |
| 755 |
"static int\n" |
| 756 |
"memfile_close(void *c)\n" |
| 757 |
"{\n" |
| 758 |
" struct memfile_cookie *cookie = c;\n" |
| 759 |
"\\&\n" |
| 760 |
" free(cookie-E<gt>buf);\n" |
| 761 |
" cookie-E<gt>allocated = 0;\n" |
| 762 |
" cookie-E<gt>buf = NULL;\n" |
| 763 |
"\\&\n" |
| 764 |
" return 0;\n" |
| 765 |
"}\n" |
| 766 |
"\\&\n" |
| 767 |
"int\n" |
| 768 |
"main(int argc, char *argv[])\n" |
| 769 |
"{\n" |
| 770 |
" cookie_io_functions_t memfile_func = {\n" |
| 771 |
" .read = memfile_read,\n" |
| 772 |
" .write = memfile_write,\n" |
| 773 |
" .seek = memfile_seek,\n" |
| 774 |
" .close = memfile_close\n" |
| 775 |
" };\n" |
| 776 |
" FILE *stream;\n" |
| 777 |
" struct memfile_cookie mycookie;\n" |
| 778 |
" size_t nread;\n" |
| 779 |
" char buf[1000];\n" |
| 780 |
"\\&\n" |
| 781 |
" /* Set up the cookie before calling fopencookie(). */\n" |
| 782 |
"\\&\n" |
| 783 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 784 |
" if (mycookie.buf == NULL) {\n" |
| 785 |
" perror(\"malloc\");\n" |
| 786 |
" exit(EXIT_FAILURE);\n" |
| 787 |
" }\n" |
| 788 |
"\\&\n" |
| 789 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 790 |
" mycookie.offset = 0;\n" |
| 791 |
" mycookie.endpos = 0;\n" |
| 792 |
"\\&\n" |
| 793 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 794 |
" if (stream == NULL) {\n" |
| 795 |
" perror(\"fopencookie\");\n" |
| 796 |
" exit(EXIT_FAILURE);\n" |
| 797 |
" }\n" |
| 798 |
"\\&\n" |
| 799 |
" /* Write command-line arguments to our file. */\n" |
| 800 |
"\\&\n" |
| 801 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 802 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 803 |
" perror(\"fputs\");\n" |
| 804 |
" exit(EXIT_FAILURE);\n" |
| 805 |
" }\n" |
| 806 |
"\\&\n" |
| 807 |
" /* Read two bytes out of every five, until EOF. */\n" |
| 808 |
"\\&\n" |
| 809 |
" for (long p = 0; ; p += 5) {\n" |
| 810 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 811 |
" perror(\"fseek\");\n" |
| 812 |
" exit(EXIT_FAILURE);\n" |
| 813 |
" }\n" |
| 814 |
" nread = fread(buf, 1, 2, stream);\n" |
| 815 |
" if (nread == 0) {\n" |
| 816 |
" if (ferror(stream) != 0) {\n" |
| 817 |
" fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 818 |
" exit(EXIT_FAILURE);\n" |
| 819 |
" }\n" |
| 820 |
" printf(\"Reached end of file\\[rs]n\");\n" |
| 821 |
" break;\n" |
| 822 |
" }\n" |
| 823 |
"\\&\n" |
| 824 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 825 |
" }\n" |
| 826 |
"\\&\n" |
| 827 |
" free(mycookie.buf);\n" |
| 828 |
"\\&\n" |
| 829 |
" exit(EXIT_SUCCESS);\n" |
| 830 |
"}\n" |
| 831 |
msgstr "" |
| 832 |
"#define _GNU_SOURCE\n" |
| 833 |
"#include E<lt>stdio.hE<gt>\n" |
| 834 |
"#include E<lt>stdlib.hE<gt>\n" |
| 835 |
"#include E<lt>string.hE<gt>\n" |
| 836 |
"#include E<lt>sys/types.hE<gt>\n" |
| 837 |
"#include E<lt>unistd.hE<gt>\n" |
| 838 |
"\\&\n" |
| 839 |
"#define INIT_BUF_SIZE 4\n" |
| 840 |
"\\&\n" |
| 841 |
"struct memfile_cookie {\n" |
| 842 |
" char *buf; /* Dynamically sized buffer for data */\n" |
| 843 |
" size_t allocated; /* Size of buf */\n" |
| 844 |
" size_t endpos; /* Number of characters in buf */\n" |
| 845 |
" off_t offset; /* Current file offset in buf */\n" |
| 846 |
"};\n" |
| 847 |
"\\&\n" |
| 848 |
"static ssize_t\n" |
| 849 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 850 |
"{\n" |
| 851 |
" char *new_buff;\n" |
| 852 |
" struct memfile_cookie *cookie = c;\n" |
| 853 |
"\\&\n" |
| 854 |
" /* Buffer too small? Keep doubling size until big enough. */\n" |
| 855 |
"\\&\n" |
| 856 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 857 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 858 |
" if (new_buff == NULL)\n" |
| 859 |
" return -1;\n" |
| 860 |
" cookie-E<gt>allocated *= 2;\n" |
| 861 |
" cookie-E<gt>buf = new_buff;\n" |
| 862 |
" }\n" |
| 863 |
"\\&\n" |
| 864 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 865 |
"\\&\n" |
| 866 |
" cookie-E<gt>offset += size;\n" |
| 867 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 868 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 869 |
"\\&\n" |
| 870 |
" return size;\n" |
| 871 |
"}\n" |
| 872 |
"\\&\n" |
| 873 |
"static ssize_t\n" |
| 874 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 875 |
"{\n" |
| 876 |
" ssize_t xbytes;\n" |
| 877 |
" struct memfile_cookie *cookie = c;\n" |
| 878 |
"\\&\n" |
| 879 |
" /* Fetch minimum of bytes requested and bytes available. */\n" |
| 880 |
"\\&\n" |
| 881 |
" xbytes = size;\n" |
| 882 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 883 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 884 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 885 |
" xbytes = 0;\n" |
| 886 |
"\\&\n" |
| 887 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 888 |
"\\&\n" |
| 889 |
" cookie-E<gt>offset += xbytes;\n" |
| 890 |
" return xbytes;\n" |
| 891 |
"}\n" |
| 892 |
"\\&\n" |
| 893 |
"static int\n" |
| 894 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 895 |
"{\n" |
| 896 |
" off_t new_offset;\n" |
| 897 |
" struct memfile_cookie *cookie = c;\n" |
| 898 |
"\\&\n" |
| 899 |
" if (whence == SEEK_SET)\n" |
| 900 |
" new_offset = *offset;\n" |
| 901 |
" else if (whence == SEEK_END)\n" |
| 902 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 903 |
" else if (whence == SEEK_CUR)\n" |
| 904 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 905 |
" else\n" |
| 906 |
" return -1;\n" |
| 907 |
"\\&\n" |
| 908 |
" if (new_offset E<lt> 0)\n" |
| 909 |
" return -1;\n" |
| 910 |
"\\&\n" |
| 911 |
" cookie-E<gt>offset = new_offset;\n" |
| 912 |
" *offset = new_offset;\n" |
| 913 |
" return 0;\n" |
| 914 |
"}\n" |
| 915 |
"\\&\n" |
| 916 |
"static int\n" |
| 917 |
"memfile_close(void *c)\n" |
| 918 |
"{\n" |
| 919 |
" struct memfile_cookie *cookie = c;\n" |
| 920 |
"\\&\n" |
| 921 |
" free(cookie-E<gt>buf);\n" |
| 922 |
" cookie-E<gt>allocated = 0;\n" |
| 923 |
" cookie-E<gt>buf = NULL;\n" |
| 924 |
"\\&\n" |
| 925 |
" return 0;\n" |
| 926 |
"}\n" |
| 927 |
"\\&\n" |
| 928 |
"int\n" |
| 929 |
"main(int argc, char *argv[])\n" |
| 930 |
"{\n" |
| 931 |
" cookie_io_functions_t memfile_func = {\n" |
| 932 |
" .read = memfile_read,\n" |
| 933 |
" .write = memfile_write,\n" |
| 934 |
" .seek = memfile_seek,\n" |
| 935 |
" .close = memfile_close\n" |
| 936 |
" };\n" |
| 937 |
" FILE *stream;\n" |
| 938 |
" struct memfile_cookie mycookie;\n" |
| 939 |
" size_t nread;\n" |
| 940 |
" char buf[1000];\n" |
| 941 |
"\\&\n" |
| 942 |
" /* Set up the cookie before calling fopencookie(). */\n" |
| 943 |
"\\&\n" |
| 944 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 945 |
" if (mycookie.buf == NULL) {\n" |
| 946 |
" perror(\"malloc\");\n" |
| 947 |
" exit(EXIT_FAILURE);\n" |
| 948 |
" }\n" |
| 949 |
"\\&\n" |
| 950 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 951 |
" mycookie.offset = 0;\n" |
| 952 |
" mycookie.endpos = 0;\n" |
| 953 |
"\\&\n" |
| 954 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 955 |
" if (stream == NULL) {\n" |
| 956 |
" perror(\"fopencookie\");\n" |
| 957 |
" exit(EXIT_FAILURE);\n" |
| 958 |
" }\n" |
| 959 |
"\\&\n" |
| 960 |
" /* Write command-line arguments to our file. */\n" |
| 961 |
"\\&\n" |
| 962 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 963 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 964 |
" perror(\"fputs\");\n" |
| 965 |
" exit(EXIT_FAILURE);\n" |
| 966 |
" }\n" |
| 967 |
"\\&\n" |
| 968 |
" /* Read two bytes out of every five, until EOF. */\n" |
| 969 |
"\\&\n" |
| 970 |
" for (long p = 0; ; p += 5) {\n" |
| 971 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 972 |
" perror(\"fseek\");\n" |
| 973 |
" exit(EXIT_FAILURE);\n" |
| 974 |
" }\n" |
| 975 |
" nread = fread(buf, 1, 2, stream);\n" |
| 976 |
" if (nread == 0) {\n" |
| 977 |
" if (ferror(stream) != 0) {\n" |
| 978 |
" fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 979 |
" exit(EXIT_FAILURE);\n" |
| 980 |
" }\n" |
| 981 |
" printf(\"Reached end of file\\[rs]n\");\n" |
| 982 |
" break;\n" |
| 983 |
" }\n" |
| 984 |
"\\&\n" |
| 985 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 986 |
" }\n" |
| 987 |
"\\&\n" |
| 988 |
" free(mycookie.buf);\n" |
| 989 |
"\\&\n" |
| 990 |
" exit(EXIT_SUCCESS);\n" |
| 991 |
"}\n" |
| 992 |
|
| 993 |
#. SRC END |
| 994 |
#. type: SH |
| 995 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 996 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 997 |
#, no-wrap |
| 998 |
msgid "NOTES" |
| 999 |
msgstr "ملاحظات" |
| 1000 |
|
| 1001 |
#. type: Plain text |
| 1002 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1003 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1004 |
msgid "" |
| 1005 |
"B<_FILE_OFFSET_BITS> should be defined to be 64 in code that uses non-null " |
| 1006 |
"I<seek> or that takes the address of B<fopencookie>, if the code is intended " |
| 1007 |
"to be portable to traditional 32-bit x86 and ARM platforms where B<off_t>'s " |
| 1008 |
"width defaults to 32 bits." |
| 1009 |
msgstr "" |
| 1010 |
"يجب تعريف B<_FILE_OFFSET_BITS> على أنه 64 في الكود الذي يستخدم I<seek> غير " |
| 1011 |
"فارغ أو الذي يأخذ عنوان B<fopencookie>، إذا كان الكود يُقصد به أن يكون" |
| 1012 |
" محمولاً " |
| 1013 |
"إلى منصات x86 و ARM التقليدية ذات 32 بت حيث عرض B<off_t> المبدئي هو 32 بت." |
| 1014 |
|
| 1015 |
#. type: SH |
| 1016 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1017 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1018 |
#, no-wrap |
| 1019 |
msgid "SEE ALSO" |
| 1020 |
msgstr "انظر أيضًا" |
| 1021 |
|
| 1022 |
#. type: Plain text |
| 1023 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1024 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1025 |
msgid "B<fclose>(3), B<fmemopen>(3), B<fopen>(3), B<fseek>(3)" |
| 1026 |
msgstr "B<fclose>(3), B<fmemopen>(3), B<fopen>(3), B<fseek>(3)" |
| 1027 |
|
| 1028 |
#. type: TH |
| 1029 |
#: debian-trixie |
| 1030 |
#, no-wrap |
| 1031 |
msgid "2024-06-15" |
| 1032 |
msgstr "15 يونيو 2024" |
| 1033 |
|
| 1034 |
#. type: TH |
| 1035 |
#: debian-trixie |
| 1036 |
#, no-wrap |
| 1037 |
msgid "Linux man-pages 6.9.1" |
| 1038 |
msgstr "صفحات دليل لينكس 6.9.1" |
| 1039 |
|
| 1040 |
#. type: Plain text |
| 1041 |
#: debian-trixie |
| 1042 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 1043 |
msgstr "مكتبة سي المعيارية (I<libc>، I<-lc>)" |
| 1044 |
|
| 1045 |
#. type: Plain text |
| 1046 |
#: debian-trixie fedora-44 fedora-rawhide |
| 1047 |
#, no-wrap |
| 1048 |
msgid "" |
| 1049 |
"#define _GNU_SOURCE\n" |
| 1050 |
"#include E<lt>stdio.hE<gt>\n" |
| 1051 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1052 |
"#include E<lt>string.hE<gt>\n" |
| 1053 |
"#include E<lt>sys/types.hE<gt>\n" |
| 1054 |
"#include E<lt>unistd.hE<gt>\n" |
| 1055 |
"\\&\n" |
| 1056 |
"#define INIT_BUF_SIZE 4\n" |
| 1057 |
"\\&\n" |
| 1058 |
"struct memfile_cookie {\n" |
| 1059 |
" char *buf; /* Dynamically sized buffer for data */\n" |
| 1060 |
" size_t allocated; /* Size of buf */\n" |
| 1061 |
" size_t endpos; /* Number of characters in buf */\n" |
| 1062 |
" off_t offset; /* Current file offset in buf */\n" |
| 1063 |
"};\n" |
| 1064 |
"\\&\n" |
| 1065 |
"ssize_t\n" |
| 1066 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 1067 |
"{\n" |
| 1068 |
" char *new_buff;\n" |
| 1069 |
" struct memfile_cookie *cookie = c;\n" |
| 1070 |
"\\&\n" |
| 1071 |
" /* Buffer too small? Keep doubling size until big enough. */\n" |
| 1072 |
"\\&\n" |
| 1073 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 1074 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 1075 |
" if (new_buff == NULL)\n" |
| 1076 |
" return -1;\n" |
| 1077 |
" cookie-E<gt>allocated *= 2;\n" |
| 1078 |
" cookie-E<gt>buf = new_buff;\n" |
| 1079 |
" }\n" |
| 1080 |
"\\&\n" |
| 1081 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 1082 |
"\\&\n" |
| 1083 |
" cookie-E<gt>offset += size;\n" |
| 1084 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 1085 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 1086 |
"\\&\n" |
| 1087 |
" return size;\n" |
| 1088 |
"}\n" |
| 1089 |
"\\&\n" |
| 1090 |
"ssize_t\n" |
| 1091 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 1092 |
"{\n" |
| 1093 |
" ssize_t xbytes;\n" |
| 1094 |
" struct memfile_cookie *cookie = c;\n" |
| 1095 |
"\\&\n" |
| 1096 |
" /* Fetch minimum of bytes requested and bytes available. */\n" |
| 1097 |
"\\&\n" |
| 1098 |
" xbytes = size;\n" |
| 1099 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 1100 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 1101 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 1102 |
" xbytes = 0;\n" |
| 1103 |
"\\&\n" |
| 1104 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 1105 |
"\\&\n" |
| 1106 |
" cookie-E<gt>offset += xbytes;\n" |
| 1107 |
" return xbytes;\n" |
| 1108 |
"}\n" |
| 1109 |
"\\&\n" |
| 1110 |
"int\n" |
| 1111 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 1112 |
"{\n" |
| 1113 |
" off_t new_offset;\n" |
| 1114 |
" struct memfile_cookie *cookie = c;\n" |
| 1115 |
"\\&\n" |
| 1116 |
" if (whence == SEEK_SET)\n" |
| 1117 |
" new_offset = *offset;\n" |
| 1118 |
" else if (whence == SEEK_END)\n" |
| 1119 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 1120 |
" else if (whence == SEEK_CUR)\n" |
| 1121 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 1122 |
" else\n" |
| 1123 |
" return -1;\n" |
| 1124 |
"\\&\n" |
| 1125 |
" if (new_offset E<lt> 0)\n" |
| 1126 |
" return -1;\n" |
| 1127 |
"\\&\n" |
| 1128 |
" cookie-E<gt>offset = new_offset;\n" |
| 1129 |
" *offset = new_offset;\n" |
| 1130 |
" return 0;\n" |
| 1131 |
"}\n" |
| 1132 |
"\\&\n" |
| 1133 |
"int\n" |
| 1134 |
"memfile_close(void *c)\n" |
| 1135 |
"{\n" |
| 1136 |
" struct memfile_cookie *cookie = c;\n" |
| 1137 |
"\\&\n" |
| 1138 |
" free(cookie-E<gt>buf);\n" |
| 1139 |
" cookie-E<gt>allocated = 0;\n" |
| 1140 |
" cookie-E<gt>buf = NULL;\n" |
| 1141 |
"\\&\n" |
| 1142 |
" return 0;\n" |
| 1143 |
"}\n" |
| 1144 |
"\\&\n" |
| 1145 |
"int\n" |
| 1146 |
"main(int argc, char *argv[])\n" |
| 1147 |
"{\n" |
| 1148 |
" cookie_io_functions_t memfile_func = {\n" |
| 1149 |
" .read = memfile_read,\n" |
| 1150 |
" .write = memfile_write,\n" |
| 1151 |
" .seek = memfile_seek,\n" |
| 1152 |
" .close = memfile_close\n" |
| 1153 |
" };\n" |
| 1154 |
" FILE *stream;\n" |
| 1155 |
" struct memfile_cookie mycookie;\n" |
| 1156 |
" size_t nread;\n" |
| 1157 |
" char buf[1000];\n" |
| 1158 |
"\\&\n" |
| 1159 |
" /* Set up the cookie before calling fopencookie(). */\n" |
| 1160 |
"\\&\n" |
| 1161 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 1162 |
" if (mycookie.buf == NULL) {\n" |
| 1163 |
" perror(\"malloc\");\n" |
| 1164 |
" exit(EXIT_FAILURE);\n" |
| 1165 |
" }\n" |
| 1166 |
"\\&\n" |
| 1167 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 1168 |
" mycookie.offset = 0;\n" |
| 1169 |
" mycookie.endpos = 0;\n" |
| 1170 |
"\\&\n" |
| 1171 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 1172 |
" if (stream == NULL) {\n" |
| 1173 |
" perror(\"fopencookie\");\n" |
| 1174 |
" exit(EXIT_FAILURE);\n" |
| 1175 |
" }\n" |
| 1176 |
"\\&\n" |
| 1177 |
" /* Write command-line arguments to our file. */\n" |
| 1178 |
"\\&\n" |
| 1179 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 1180 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 1181 |
" perror(\"fputs\");\n" |
| 1182 |
" exit(EXIT_FAILURE);\n" |
| 1183 |
" }\n" |
| 1184 |
"\\&\n" |
| 1185 |
" /* Read two bytes out of every five, until EOF. */\n" |
| 1186 |
"\\&\n" |
| 1187 |
" for (long p = 0; ; p += 5) {\n" |
| 1188 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 1189 |
" perror(\"fseek\");\n" |
| 1190 |
" exit(EXIT_FAILURE);\n" |
| 1191 |
" }\n" |
| 1192 |
" nread = fread(buf, 1, 2, stream);\n" |
| 1193 |
" if (nread == 0) {\n" |
| 1194 |
" if (ferror(stream) != 0) {\n" |
| 1195 |
" fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 1196 |
" exit(EXIT_FAILURE);\n" |
| 1197 |
" }\n" |
| 1198 |
" printf(\"Reached end of file\\[rs]n\");\n" |
| 1199 |
" break;\n" |
| 1200 |
" }\n" |
| 1201 |
"\\&\n" |
| 1202 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 1203 |
" }\n" |
| 1204 |
"\\&\n" |
| 1205 |
" free(mycookie.buf);\n" |
| 1206 |
"\\&\n" |
| 1207 |
" exit(EXIT_SUCCESS);\n" |
| 1208 |
"}\n" |
| 1209 |
msgstr "" |
| 1210 |
"#define _GNU_SOURCE\n" |
| 1211 |
"#include E<lt>stdio.hE<gt>\n" |
| 1212 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1213 |
"#include E<lt>string.hE<gt>\n" |
| 1214 |
"#include E<lt>sys/types.hE<gt>\n" |
| 1215 |
"#include E<lt>unistd.hE<gt>\n" |
| 1216 |
"\\&\n" |
| 1217 |
"#define INIT_BUF_SIZE 4\n" |
| 1218 |
"\\&\n" |
| 1219 |
"struct memfile_cookie {\n" |
| 1220 |
" char *buf; /* Dynamically sized buffer for data */\n" |
| 1221 |
" size_t allocated; /* Size of buf */\n" |
| 1222 |
" size_t endpos; /* Number of characters in buf */\n" |
| 1223 |
" off_t offset; /* Current file offset in buf */\n" |
| 1224 |
"};\n" |
| 1225 |
"\\&\n" |
| 1226 |
"ssize_t\n" |
| 1227 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 1228 |
"{\n" |
| 1229 |
" char *new_buff;\n" |
| 1230 |
" struct memfile_cookie *cookie = c;\n" |
| 1231 |
"\\&\n" |
| 1232 |
" /* Buffer too small? Keep doubling size until big enough. */\n" |
| 1233 |
"\\&\n" |
| 1234 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 1235 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 1236 |
" if (new_buff == NULL)\n" |
| 1237 |
" return -1;\n" |
| 1238 |
" cookie-E<gt>allocated *= 2;\n" |
| 1239 |
" cookie-E<gt>buf = new_buff;\n" |
| 1240 |
" }\n" |
| 1241 |
"\\&\n" |
| 1242 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 1243 |
"\\&\n" |
| 1244 |
" cookie-E<gt>offset += size;\n" |
| 1245 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 1246 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 1247 |
"\\&\n" |
| 1248 |
" return size;\n" |
| 1249 |
"}\n" |
| 1250 |
"\\&\n" |
| 1251 |
"ssize_t\n" |
| 1252 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 1253 |
"{\n" |
| 1254 |
" ssize_t xbytes;\n" |
| 1255 |
" struct memfile_cookie *cookie = c;\n" |
| 1256 |
"\\&\n" |
| 1257 |
" /* Fetch minimum of bytes requested and bytes available. */\n" |
| 1258 |
"\\&\n" |
| 1259 |
" xbytes = size;\n" |
| 1260 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 1261 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 1262 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 1263 |
" xbytes = 0;\n" |
| 1264 |
"\\&\n" |
| 1265 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 1266 |
"\\&\n" |
| 1267 |
" cookie-E<gt>offset += xbytes;\n" |
| 1268 |
" return xbytes;\n" |
| 1269 |
"}\n" |
| 1270 |
"\\&\n" |
| 1271 |
"int\n" |
| 1272 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 1273 |
"{\n" |
| 1274 |
" off_t new_offset;\n" |
| 1275 |
" struct memfile_cookie *cookie = c;\n" |
| 1276 |
"\\&\n" |
| 1277 |
" if (whence == SEEK_SET)\n" |
| 1278 |
" new_offset = *offset;\n" |
| 1279 |
" else if (whence == SEEK_END)\n" |
| 1280 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 1281 |
" else if (whence == SEEK_CUR)\n" |
| 1282 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 1283 |
" else\n" |
| 1284 |
" return -1;\n" |
| 1285 |
"\\&\n" |
| 1286 |
" if (new_offset E<lt> 0)\n" |
| 1287 |
" return -1;\n" |
| 1288 |
"\\&\n" |
| 1289 |
" cookie-E<gt>offset = new_offset;\n" |
| 1290 |
" *offset = new_offset;\n" |
| 1291 |
" return 0;\n" |
| 1292 |
"}\n" |
| 1293 |
"\\&\n" |
| 1294 |
"int\n" |
| 1295 |
"memfile_close(void *c)\n" |
| 1296 |
"{\n" |
| 1297 |
" struct memfile_cookie *cookie = c;\n" |
| 1298 |
"\\&\n" |
| 1299 |
" free(cookie-E<gt>buf);\n" |
| 1300 |
" cookie-E<gt>allocated = 0;\n" |
| 1301 |
" cookie-E<gt>buf = NULL;\n" |
| 1302 |
"\\&\n" |
| 1303 |
" return 0;\n" |
| 1304 |
"}\n" |
| 1305 |
"\\&\n" |
| 1306 |
"int\n" |
| 1307 |
"main(int argc, char *argv[])\n" |
| 1308 |
"{\n" |
| 1309 |
" cookie_io_functions_t memfile_func = {\n" |
| 1310 |
" .read = memfile_read,\n" |
| 1311 |
" .write = memfile_write,\n" |
| 1312 |
" .seek = memfile_seek,\n" |
| 1313 |
" .close = memfile_close\n" |
| 1314 |
" };\n" |
| 1315 |
" FILE *stream;\n" |
| 1316 |
" struct memfile_cookie mycookie;\n" |
| 1317 |
" size_t nread;\n" |
| 1318 |
" char buf[1000];\n" |
| 1319 |
"\\&\n" |
| 1320 |
" /* Set up the cookie before calling fopencookie(). */\n" |
| 1321 |
"\\&\n" |
| 1322 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 1323 |
" if (mycookie.buf == NULL) {\n" |
| 1324 |
" perror(\"malloc\");\n" |
| 1325 |
" exit(EXIT_FAILURE);\n" |
| 1326 |
" }\n" |
| 1327 |
"\\&\n" |
| 1328 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 1329 |
" mycookie.offset = 0;\n" |
| 1330 |
" mycookie.endpos = 0;\n" |
| 1331 |
"\\&\n" |
| 1332 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 1333 |
" if (stream == NULL) {\n" |
| 1334 |
" perror(\"fopencookie\");\n" |
| 1335 |
" exit(EXIT_FAILURE);\n" |
| 1336 |
" }\n" |
| 1337 |
"\\&\n" |
| 1338 |
" /* Write command-line arguments to our file. */\n" |
| 1339 |
"\\&\n" |
| 1340 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 1341 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 1342 |
" perror(\"fputs\");\n" |
| 1343 |
" exit(EXIT_FAILURE);\n" |
| 1344 |
" }\n" |
| 1345 |
"\\&\n" |
| 1346 |
" /* Read two bytes out of every five, until EOF. */\n" |
| 1347 |
"\\&\n" |
| 1348 |
" for (long p = 0; ; p += 5) {\n" |
| 1349 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 1350 |
" perror(\"fseek\");\n" |
| 1351 |
" exit(EXIT_FAILURE);\n" |
| 1352 |
" }\n" |
| 1353 |
" nread = fread(buf, 1, 2, stream);\n" |
| 1354 |
" if (nread == 0) {\n" |
| 1355 |
" if (ferror(stream) != 0) {\n" |
| 1356 |
" fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 1357 |
" exit(EXIT_FAILURE);\n" |
| 1358 |
" }\n" |
| 1359 |
" printf(\"Reached end of file\\[rs]n\");\n" |
| 1360 |
" break;\n" |
| 1361 |
" }\n" |
| 1362 |
"\\&\n" |
| 1363 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 1364 |
" }\n" |
| 1365 |
"\\&\n" |
| 1366 |
" free(mycookie.buf);\n" |
| 1367 |
"\\&\n" |
| 1368 |
" exit(EXIT_SUCCESS);\n" |
| 1369 |
"}\n" |
| 1370 |
|
| 1371 |
#. type: TH |
| 1372 |
#: fedora-44 fedora-rawhide |
| 1373 |
#, no-wrap |
| 1374 |
msgid "2024-07-23" |
| 1375 |
msgstr "23 يوليو 2024" |
| 1376 |
|
| 1377 |
#. type: TH |
| 1378 |
#: fedora-44 fedora-rawhide |
| 1379 |
#, no-wrap |
| 1380 |
msgid "Linux man-pages 6.13" |
| 1381 |
msgstr "صفحات دليل لينكس 6.13" |
| 1382 |
|
| 1383 |
#. type: TH |
| 1384 |
#: mageia-cauldron |
| 1385 |
#, no-wrap |
| 1386 |
msgid "Linux man-pages 6.17" |
| 1387 |
msgstr "صفحات دليل لينكس 6.17" |
| 1388 |
|
| 1389 |
#. type: TH |
| 1390 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 1391 |
#, no-wrap |
| 1392 |
msgid "Linux man-pages (unreleased)" |
| 1393 |
msgstr "صفحات دليل لينكس (لم تصدر بعد)" |
| 1394 |
|