# Arabic translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # زايد السعيدي , 2026. msgid "" msgstr "" "Project-Id-Version: manpages-l10n\n" "POT-Creation-Date: 2026-06-05 06:24+0200\n" "PO-Revision-Date: 2026-06-06 08:52+0400\n" "Last-Translator: Zayed Al-Saidi \n" "Language-Team: Arabic \n" "Language: ar\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" ".MIME-Version: 1.0\n" "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 &&" " n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" "X-Generator: Lokalize 23.08.5\n" #. type: TH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "fopencookie" msgstr "fopencookie" #. type: TH #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "2025-09-21" msgstr "21 سبتمبر 2025" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.18" msgstr "صفحات دليل لينكس 6.18" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "الاسم" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "fopencookie - open a custom stream" msgstr "fopencookie - فتح دفق مخصص" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "المكتبة" #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "Standard C library (I,\\ I<-lc>)" msgstr "مكتبة سي المعيارية (I،\\ I<-lc>)" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "موجز" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" "B<#define _FILE_OFFSET_BITS 64>\n" "B<#include Estdio.hE>\n" msgstr "" "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" "B<#define _FILE_OFFSET_BITS 64>\n" "B<#include Estdio.hE>\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "BIB<, const char *restrict >IB<,>\n" "B< cookie_io_functions_t >IB<);>\n" msgstr "" "BIB<, const char *restrict >IB<,>\n" "B< cookie_io_functions_t >IB<);>\n" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "الوصف" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function allows the programmer to create a custom " "implementation for a standard I/O stream. This implementation can store the " "stream's data at a location of its own choosing; for example, " "B() is used to implement B(3), which provides a " "stream interface to data that is stored in a buffer in memory." msgstr "" "تسمح الدالة B() للمبرمج بإنشاء تنفيذ مخصص لدفق إدخال/إخراج " "قياسي. يمكن لهذا التنفيذ تخزين بيانات الدفق في موقع يختاره بنفسه؛ على سبيل " "المثال، تُستخدم B() لتنفيذ B(3)، التي توفر واجهة دفق " "للبيانات المخزنة في مخزن مؤقت في الذاكرة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "In order to create a custom stream the programmer must:" msgstr "لإنشاء دفق مخصص، يجب على المبرمج:" #. type: IP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "\\[bu]" msgstr "\\[bu]" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Implement four \"hook\" functions that are used internally by the standard I/" "O library when performing I/O on the stream." msgstr "" "تنفيذ أربع دوال \"خطافية\" تُستخدم داخليًا بواسطة مكتبة الإدخال/الإخراج " "القياسية عند تنفيذ الإدخال/الإخراج على الدفق." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #| msgid "" #| "Define a \"cookie\" data type, a structure that provides bookkeeping " #| "information (e.g., where to store data) used by the aforementioned hook " #| "functions. The standard I/O package knows nothing about the contents of " #| "this cookie (thus it is typed as I when passed to " #| "B()), but automatically supplies the cookie as the first " #| "argument when calling the hook functions." msgid "" "Define a \"cookie\" data type, a structure that provides bookkeeping " "information (e.g., where to store data) used by the aforementioned hook " "functions. The standard I/O package knows nothing about the contents of " "this cookie (thus it is typed as I when passed to " "B()), but automatically supplies the cookie as the first " "argument when calling the hook functions." msgstr "" "تحديد نوع بيانات \"كعكة\" (cookie)، وهي بنية توفر معلومات الحفظ والسجلات " "(مثل مكان تخزين البيانات) التي تُستخدم من قِبل دالات الخطاف (hook functions) " "المذكورة سابقاً. لا تحوز حزمة الإدخال/الإخراج القياسية أي معرفة بمحتويات هذه " "الكعكة (لذا تُعرّف بالنوع I عند تمريرها إلى الدالة " "B())، ولكنها تمرر الكعكة تلقائياً بصفتها وسيطاً أولاً عند" " استدعاء " "دالات الخطاف." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Call B() to open a new stream and associate the cookie and " "hook functions with that stream." msgstr "" "استدعاء B() لفتح دفق جديد وربط الخبيئة ودوال الخطاف بهذا الدفق." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function serves a purpose similar to B(3): it " "opens a new stream and returns a pointer to a I object that is used to " "operate on that stream." msgstr "" "تخدم الدالة B() غرضًا مشابهًا لـ B(3): فهي تفتح دفقًا " "جديدًا وتُعيد مؤشرًا إلى كائن I يُستخدم للتعامل مع ذلك الدفق." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I argument is a pointer to the caller's cookie structure that is " "to be associated with the new stream. This pointer is supplied as the first " "argument when the standard I/O library invokes any of the hook functions " "described below." msgstr "" "الوسيط I هو مؤشر إلى هيكل الخبيئة الخاص بالمستدعي الذي سيُربط بالدفق " "الجديد. يُوفر هذا المؤشر كوسيط أول عندما تستدعي مكتبة الإدخال/الإخراج " "القياسية أيًا من دوال الخطاف الموصوفة أدناه." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I argument serves the same purpose as for B(3). The " "following modes are supported: I, I, I, I, I, and I. " "See B(3) for details." msgstr "" "يخدم الوسيط I نفس الغرض كما في B(3). الأوضاع التالية مدعومة: " "I، I، I، I، I، و I. انظر B(3) للتفاصيل." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I argument is a structure that contains four fields pointing " "to the programmer-defined hook functions that are used to implement this " "stream. The structure is defined as follows" msgstr "" "الوسيط I هو هيكل يحتوي على أربعة حقول تشير إلى دوال الخطاف المعرفة " "من قبل المبرمج والتي تُستخدم لتنفيذ هذا الدفق. يُعرف الهيكل كالتالي" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "typedef struct {\n" " cookie_read_function_t *read;\n" " cookie_write_function_t *write;\n" " cookie_seek_function_t *seek;\n" " cookie_close_function_t *close;\n" "} cookie_io_functions_t;\n" msgstr "" "typedef struct {\n" " cookie_read_function_t *read;\n" " cookie_write_function_t *write;\n" " cookie_seek_function_t *seek;\n" " cookie_close_function_t *close;\n" "} cookie_io_functions_t;\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "The four fields are as follows:" msgstr "الحقول الأربعة هي كالتالي:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This function implements read operations for the stream. When called, it " "receives three arguments:" msgstr "" "تنفذ هذه الدالة عمليات القراءة للدفق. عند استدعائها، تتلقى ثلاثة وسائط:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ssize_t read(void *cookie, char *buf, size_t size);\n" msgstr "ssize_t read(void *cookie, char *buf, size_t size);\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I and I arguments are, respectively, a buffer into which " "input data can be placed and the size of that buffer. As its function " "result, the I function should return the number of bytes copied into " "I, 0 on end of file, or -1 on error. The I function should " "update the stream offset appropriately." msgstr "" "الوسيطان I و I هما، على التوالي، مخزن يمكن وضع بيانات الإدخال فيه " "وحجم ذلك المخزن. كنتيجة للدالة، يجب أن تُعيد دالة I عدد البايتات " "المنسوخة إلى I، أو 0 عند نهاية الملف، أو -1 عند الخطأ. يجب أن تُحدّث" " دالة " "I إزاحة الدفق بشكل مناسب." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If I<*read> is a null pointer, then reads from the custom stream always " "return end of file." msgstr "" "إذا كان I<*read> مؤشرًا فارغًا، فإن القراءات من الدفق المخصص تُعيد دائمًا" " نهاية " "الملف." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This function implements write operations for the stream. When called, it " "receives three arguments:" msgstr "" "تنفذ هذه الدالة عمليات الكتابة للدفق. عند استدعائها، تستقبل ثلاث وسائط:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ssize_t write(void *cookie, const char *buf, size_t size);\n" msgstr "ssize_t write(void *cookie, const char *buf, size_t size);\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I and I arguments are, respectively, a buffer of data to be " "output to the stream and the size of that buffer. As its function result, " "the I function should return the number of bytes copied from I, " "or 0 on error. (The function must not return a negative value.) The " "I function should update the stream offset appropriately." msgstr "" "الوسيطان I و I هما، على التوالي، مخزن بيانات سيُخرج إلى الدفق وحجم " "ذلك المخزن. كنتيجة لدالتها، يجب على دالة I أن تُرجع عدد البايتات " "المنسوخة من I، أو 0 عند الخطأ. (يجب ألا تُرجع الدالة قيمة سالبة.) يجب " "على دالة I أن تُحدّث إزاحة الدفق بشكل مناسب." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "If I<*write> is a null pointer, then output to the stream is discarded." msgstr "إذا كان I<*write> مؤشرًا فارغًا، فسيُتجاهل الإخراج إلى الدفق." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This function implements seek operations on the stream. When called, it " "receives three arguments:" msgstr "" "تنفذ هذه الدالة عمليات البحث في الدفق. عند استدعائها، تستقبل ثلاث وسائط:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "int seek(void *cookie, off_t *offset, int whence);\n" msgstr "int seek(void *cookie, off_t *offset, int whence);\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I<*offset> argument specifies the new file offset depending on which of " "the following three values is supplied in I:" msgstr "" "يحدد الوسيط I<*offset> إزاحة الملف الجديدة اعتمادًا على أي من القيم الثلاث " "التالية المُقدمة في I:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The stream offset should be set I<*offset> bytes from the start of the " "stream." msgstr "يجب ضبط إزاحة الدفق على I<*offset> بايت من بداية الدفق." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "I<*offset> should be added to the current stream offset." msgstr "يجب إضافة I<*offset> إلى إزاحة الدفق الحالية." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The stream offset should be set to the size of the stream plus I<*offset>." msgstr "يجب ضبط إزاحة الدفق على حجم الدفق زائد I<*offset>." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Before returning, the I function should update I<*offset> to indicate " "the new stream offset." msgstr "" "قبل الإرجاع، يجب على دالة I أن تُحدّث I<*offset> للإشارة إلى إزاحة" " الدفق " "الجديدة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "As its function result, the I function should return 0 on success, and " "-1 on error." msgstr "" "كنتيجة لدالتها، يجب على دالة I أن تُرجع 0 عند النجاح، و -1 عند الخطأ." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If I<*seek> is a null pointer, then it is not possible to perform seek " "operations on the stream." msgstr "" "إذا كان I<*seek> مؤشرًا فارغًا، فمن غير الممكن تنفيذ عمليات بحث على الدفق." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "This function closes the stream. The hook function can do things such as " "freeing buffers allocated for the stream. When called, it receives one " "argument:" msgstr "" "تغلق هذه الدالة الدفق. يمكن لدالة الخطاف أن تفعل أشياء مثل تحرير المخازن " "المُخصصة للدفق. عند استدعائها، تستقبل وسيطًا واحدًا:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "int close(void *cookie);\n" msgstr "int close(void *cookie);\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I argument is the cookie that the programmer supplied when " "calling B()." msgstr "" "الوسيط I هو الكعكة التي قدمها المبرمج عند استدعاء B()." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "As its function result, the I function should return 0 on success, " "and B on error." msgstr "" "كنتيجة لدالتها، يجب على دالة I أن تُرجع 0 عند النجاح، و B عند " "الخطأ." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If I<*close> is NULL, then no special action is performed when the stream is " "closed." msgstr "إذا كان I<*close> NULL، فلن يُنفذ أي إجراء خاص عند إغلاق الدفق." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "قيمة الإرجاع" #. .SH ERRORS #. It's not clear if errno ever gets set... #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "On success B() returns a pointer to the new stream. On error, " "NULL is returned." msgstr "" "عند النجاح، تُرجع B() مؤشرًا إلى التدفق الجديد. عند الخطأ، يُرجع " "NULL." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ATTRIBUTES" msgstr "السمات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For an explanation of the terms used in this section, see B(7)." msgstr "" "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B(7)." #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Interface" msgstr "الواجهة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Attribute" msgstr "السمة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Value" msgstr "القيمة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".na\n" msgstr ".na\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".nh\n" msgstr ".nh\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B()" msgstr "B()" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Thread safety" msgstr "سلامة الخيوط" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "MT-Safe" msgstr "MT-Safe" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "المعايير" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "GNU." msgstr "GNU." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "أمثلة" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The program below implements a custom stream whose functionality is similar " "(but not identical) to that available via B(3). It implements a " "stream whose data is stored in a memory buffer. The program writes its " "command-line arguments to the stream, and then seeks through the stream " "reading two out of every five characters and writing them to standard " "output. The following shell session demonstrates the use of the program:" msgstr "" "البرنامج أدناه يُنفذ تدفقًا مخصصًا وظيفته مشابهة (ولكن ليست مطابقة) لتلك " "المتاحة عبر B(3). يُنفذ تدفقًا تُخزّن بياناته في مخزن مؤقت للذاكرة. " "يكتب البرنامج وسائط سطر الأوامر إلى التدفق، ثم يبحث عبر التدفق قارئًا حرفين " "من كل خمسة أحرف ويكتبها إلى المخرجات القياسية. جلسة الصدفة التالية تُظهر " "استخدام البرنامج:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "$B< ./a.out \\[aq]hello world\\[aq]>\n" "/he/\n" "/ w/\n" "/d/\n" "Reached end of file\n" msgstr "" "$B< ./a.out \\[aq]hello world\\[aq]>\n" "/he/\n" "/ w/\n" "/d/\n" "Reached end of file\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Note that a more general version of the program below could be improved to " "more robustly handle various error situations (e.g., opening a stream with a " "cookie that already has an open stream; closing a stream that has already " "been closed)." msgstr "" "لاحظ أن نسخة أكثر عمومية من البرنامج أدناه يُمكن تحسينها للتعامل بشكل أكثر " "متانة مع حالات خطأ متنوعة (مثل، فتح تدفق باستخدام كعكة لديها بالفعل تدفق " "مفتوح؛ إغلاق تدفق أُغلق بالفعل)." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "مصدر البرنامج" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define INIT_BUF_SIZE 4\n" "\\&\n" "struct memfile_cookie {\n" " char *buf; /* Dynamically sized buffer for data */\n" " size_t allocated; /* Size of buf */\n" " size_t endpos; /* Number of characters in buf */\n" " off_t offset; /* Current file offset in buf */\n" "};\n" "\\&\n" "static ssize_t\n" "memfile_write(void *c, const char *buf, size_t size)\n" "{\n" " char *new_buff;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " /* Buffer too small? Keep doubling size until big enough. */\n" "\\&\n" " while (size + cookie-Eoffset E cookie-Eallocated) {\n" " new_buff = realloc(cookie-Ebuf, cookie-Eallocated * 2);\n" " if (new_buff == NULL)\n" " return -1;\n" " cookie-Eallocated *= 2;\n" " cookie-Ebuf = new_buff;\n" " }\n" "\\&\n" " memcpy(cookie-Ebuf + cookie-Eoffset, buf, size);\n" "\\&\n" " cookie-Eoffset += size;\n" " if (cookie-Eoffset E cookie-Eendpos)\n" " cookie-Eendpos = cookie-Eoffset;\n" "\\&\n" " return size;\n" "}\n" "\\&\n" "static ssize_t\n" "memfile_read(void *c, char *buf, size_t size)\n" "{\n" " ssize_t xbytes;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " /* Fetch minimum of bytes requested and bytes available. */\n" "\\&\n" " xbytes = size;\n" " if (cookie-Eoffset + size E cookie-Eendpos)\n" " xbytes = cookie-Eendpos - cookie-Eoffset;\n" " if (xbytes E 0) /* offset may be past endpos */\n" " xbytes = 0;\n" "\\&\n" " memcpy(buf, cookie-Ebuf + cookie-Eoffset, xbytes);\n" "\\&\n" " cookie-Eoffset += xbytes;\n" " return xbytes;\n" "}\n" "\\&\n" "static int\n" "memfile_seek(void *c, off_t *offset, int whence)\n" "{\n" " off_t new_offset;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " if (whence == SEEK_SET)\n" " new_offset = *offset;\n" " else if (whence == SEEK_END)\n" " new_offset = cookie-Eendpos + *offset;\n" " else if (whence == SEEK_CUR)\n" " new_offset = cookie-Eoffset + *offset;\n" " else\n" " return -1;\n" "\\&\n" " if (new_offset E 0)\n" " return -1;\n" "\\&\n" " cookie-Eoffset = new_offset;\n" " *offset = new_offset;\n" " return 0;\n" "}\n" "\\&\n" "static int\n" "memfile_close(void *c)\n" "{\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " free(cookie-Ebuf);\n" " cookie-Eallocated = 0;\n" " cookie-Ebuf = NULL;\n" "\\&\n" " return 0;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " cookie_io_functions_t memfile_func = {\n" " .read = memfile_read,\n" " .write = memfile_write,\n" " .seek = memfile_seek,\n" " .close = memfile_close\n" " };\n" " FILE *stream;\n" " struct memfile_cookie mycookie;\n" " size_t nread;\n" " char buf[1000];\n" "\\&\n" " /* Set up the cookie before calling fopencookie(). */\n" "\\&\n" " mycookie.buf = malloc(INIT_BUF_SIZE);\n" " if (mycookie.buf == NULL) {\n" " perror(\"malloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mycookie.allocated = INIT_BUF_SIZE;\n" " mycookie.offset = 0;\n" " mycookie.endpos = 0;\n" "\\&\n" " stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" " if (stream == NULL) {\n" " perror(\"fopencookie\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Write command-line arguments to our file. */\n" "\\&\n" " for (size_t j = 1; j E argc; j++)\n" " if (fputs(argv[j], stream) == EOF) {\n" " perror(\"fputs\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Read two bytes out of every five, until EOF. */\n" "\\&\n" " for (long p = 0; ; p += 5) {\n" " if (fseek(stream, p, SEEK_SET) == -1) {\n" " perror(\"fseek\");\n" " exit(EXIT_FAILURE);\n" " }\n" " nread = fread(buf, 1, 2, stream);\n" " if (nread == 0) {\n" " if (ferror(stream) != 0) {\n" " fprintf(stderr, \"fread failed\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"Reached end of file\\[rs]n\");\n" " break;\n" " }\n" "\\&\n" " printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" " }\n" "\\&\n" " free(mycookie.buf);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define INIT_BUF_SIZE 4\n" "\\&\n" "struct memfile_cookie {\n" " char *buf; /* Dynamically sized buffer for data */\n" " size_t allocated; /* Size of buf */\n" " size_t endpos; /* Number of characters in buf */\n" " off_t offset; /* Current file offset in buf */\n" "};\n" "\\&\n" "static ssize_t\n" "memfile_write(void *c, const char *buf, size_t size)\n" "{\n" " char *new_buff;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " /* Buffer too small? Keep doubling size until big enough. */\n" "\\&\n" " while (size + cookie-Eoffset E cookie-Eallocated) {\n" " new_buff = realloc(cookie-Ebuf, cookie-Eallocated * 2);\n" " if (new_buff == NULL)\n" " return -1;\n" " cookie-Eallocated *= 2;\n" " cookie-Ebuf = new_buff;\n" " }\n" "\\&\n" " memcpy(cookie-Ebuf + cookie-Eoffset, buf, size);\n" "\\&\n" " cookie-Eoffset += size;\n" " if (cookie-Eoffset E cookie-Eendpos)\n" " cookie-Eendpos = cookie-Eoffset;\n" "\\&\n" " return size;\n" "}\n" "\\&\n" "static ssize_t\n" "memfile_read(void *c, char *buf, size_t size)\n" "{\n" " ssize_t xbytes;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " /* Fetch minimum of bytes requested and bytes available. */\n" "\\&\n" " xbytes = size;\n" " if (cookie-Eoffset + size E cookie-Eendpos)\n" " xbytes = cookie-Eendpos - cookie-Eoffset;\n" " if (xbytes E 0) /* offset may be past endpos */\n" " xbytes = 0;\n" "\\&\n" " memcpy(buf, cookie-Ebuf + cookie-Eoffset, xbytes);\n" "\\&\n" " cookie-Eoffset += xbytes;\n" " return xbytes;\n" "}\n" "\\&\n" "static int\n" "memfile_seek(void *c, off_t *offset, int whence)\n" "{\n" " off_t new_offset;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " if (whence == SEEK_SET)\n" " new_offset = *offset;\n" " else if (whence == SEEK_END)\n" " new_offset = cookie-Eendpos + *offset;\n" " else if (whence == SEEK_CUR)\n" " new_offset = cookie-Eoffset + *offset;\n" " else\n" " return -1;\n" "\\&\n" " if (new_offset E 0)\n" " return -1;\n" "\\&\n" " cookie-Eoffset = new_offset;\n" " *offset = new_offset;\n" " return 0;\n" "}\n" "\\&\n" "static int\n" "memfile_close(void *c)\n" "{\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " free(cookie-Ebuf);\n" " cookie-Eallocated = 0;\n" " cookie-Ebuf = NULL;\n" "\\&\n" " return 0;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " cookie_io_functions_t memfile_func = {\n" " .read = memfile_read,\n" " .write = memfile_write,\n" " .seek = memfile_seek,\n" " .close = memfile_close\n" " };\n" " FILE *stream;\n" " struct memfile_cookie mycookie;\n" " size_t nread;\n" " char buf[1000];\n" "\\&\n" " /* Set up the cookie before calling fopencookie(). */\n" "\\&\n" " mycookie.buf = malloc(INIT_BUF_SIZE);\n" " if (mycookie.buf == NULL) {\n" " perror(\"malloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mycookie.allocated = INIT_BUF_SIZE;\n" " mycookie.offset = 0;\n" " mycookie.endpos = 0;\n" "\\&\n" " stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" " if (stream == NULL) {\n" " perror(\"fopencookie\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Write command-line arguments to our file. */\n" "\\&\n" " for (size_t j = 1; j E argc; j++)\n" " if (fputs(argv[j], stream) == EOF) {\n" " perror(\"fputs\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Read two bytes out of every five, until EOF. */\n" "\\&\n" " for (long p = 0; ; p += 5) {\n" " if (fseek(stream, p, SEEK_SET) == -1) {\n" " perror(\"fseek\");\n" " exit(EXIT_FAILURE);\n" " }\n" " nread = fread(buf, 1, 2, stream);\n" " if (nread == 0) {\n" " if (ferror(stream) != 0) {\n" " fprintf(stderr, \"fread failed\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"Reached end of file\\[rs]n\");\n" " break;\n" " }\n" "\\&\n" " printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" " }\n" "\\&\n" " free(mycookie.buf);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. SRC END #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "ملاحظات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "B<_FILE_OFFSET_BITS> should be defined to be 64 in code that uses non-null " "I or that takes the address of B, if the code is intended " "to be portable to traditional 32-bit x86 and ARM platforms where B's " "width defaults to 32 bits." msgstr "" "يجب تعريف B<_FILE_OFFSET_BITS> على أنه 64 في الكود الذي يستخدم I غير " "فارغ أو الذي يأخذ عنوان B، إذا كان الكود يُقصد به أن يكون" " محمولاً " "إلى منصات x86 و ARM التقليدية ذات 32 بت حيث عرض B المبدئي هو 32 بت." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "انظر أيضًا" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "B(3), B(3), B(3), B(3)" msgstr "B(3), B(3), B(3), B(3)" #. type: TH #: debian-trixie #, no-wrap msgid "2024-06-15" msgstr "15 يونيو 2024" #. type: TH #: debian-trixie #, no-wrap msgid "Linux man-pages 6.9.1" msgstr "صفحات دليل لينكس 6.9.1" #. type: Plain text #: debian-trixie msgid "Standard C library (I, I<-lc>)" msgstr "مكتبة سي المعيارية (I، I<-lc>)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "#define _GNU_SOURCE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define INIT_BUF_SIZE 4\n" "\\&\n" "struct memfile_cookie {\n" " char *buf; /* Dynamically sized buffer for data */\n" " size_t allocated; /* Size of buf */\n" " size_t endpos; /* Number of characters in buf */\n" " off_t offset; /* Current file offset in buf */\n" "};\n" "\\&\n" "ssize_t\n" "memfile_write(void *c, const char *buf, size_t size)\n" "{\n" " char *new_buff;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " /* Buffer too small? Keep doubling size until big enough. */\n" "\\&\n" " while (size + cookie-Eoffset E cookie-Eallocated) {\n" " new_buff = realloc(cookie-Ebuf, cookie-Eallocated * 2);\n" " if (new_buff == NULL)\n" " return -1;\n" " cookie-Eallocated *= 2;\n" " cookie-Ebuf = new_buff;\n" " }\n" "\\&\n" " memcpy(cookie-Ebuf + cookie-Eoffset, buf, size);\n" "\\&\n" " cookie-Eoffset += size;\n" " if (cookie-Eoffset E cookie-Eendpos)\n" " cookie-Eendpos = cookie-Eoffset;\n" "\\&\n" " return size;\n" "}\n" "\\&\n" "ssize_t\n" "memfile_read(void *c, char *buf, size_t size)\n" "{\n" " ssize_t xbytes;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " /* Fetch minimum of bytes requested and bytes available. */\n" "\\&\n" " xbytes = size;\n" " if (cookie-Eoffset + size E cookie-Eendpos)\n" " xbytes = cookie-Eendpos - cookie-Eoffset;\n" " if (xbytes E 0) /* offset may be past endpos */\n" " xbytes = 0;\n" "\\&\n" " memcpy(buf, cookie-Ebuf + cookie-Eoffset, xbytes);\n" "\\&\n" " cookie-Eoffset += xbytes;\n" " return xbytes;\n" "}\n" "\\&\n" "int\n" "memfile_seek(void *c, off_t *offset, int whence)\n" "{\n" " off_t new_offset;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " if (whence == SEEK_SET)\n" " new_offset = *offset;\n" " else if (whence == SEEK_END)\n" " new_offset = cookie-Eendpos + *offset;\n" " else if (whence == SEEK_CUR)\n" " new_offset = cookie-Eoffset + *offset;\n" " else\n" " return -1;\n" "\\&\n" " if (new_offset E 0)\n" " return -1;\n" "\\&\n" " cookie-Eoffset = new_offset;\n" " *offset = new_offset;\n" " return 0;\n" "}\n" "\\&\n" "int\n" "memfile_close(void *c)\n" "{\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " free(cookie-Ebuf);\n" " cookie-Eallocated = 0;\n" " cookie-Ebuf = NULL;\n" "\\&\n" " return 0;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " cookie_io_functions_t memfile_func = {\n" " .read = memfile_read,\n" " .write = memfile_write,\n" " .seek = memfile_seek,\n" " .close = memfile_close\n" " };\n" " FILE *stream;\n" " struct memfile_cookie mycookie;\n" " size_t nread;\n" " char buf[1000];\n" "\\&\n" " /* Set up the cookie before calling fopencookie(). */\n" "\\&\n" " mycookie.buf = malloc(INIT_BUF_SIZE);\n" " if (mycookie.buf == NULL) {\n" " perror(\"malloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mycookie.allocated = INIT_BUF_SIZE;\n" " mycookie.offset = 0;\n" " mycookie.endpos = 0;\n" "\\&\n" " stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" " if (stream == NULL) {\n" " perror(\"fopencookie\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Write command-line arguments to our file. */\n" "\\&\n" " for (size_t j = 1; j E argc; j++)\n" " if (fputs(argv[j], stream) == EOF) {\n" " perror(\"fputs\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Read two bytes out of every five, until EOF. */\n" "\\&\n" " for (long p = 0; ; p += 5) {\n" " if (fseek(stream, p, SEEK_SET) == -1) {\n" " perror(\"fseek\");\n" " exit(EXIT_FAILURE);\n" " }\n" " nread = fread(buf, 1, 2, stream);\n" " if (nread == 0) {\n" " if (ferror(stream) != 0) {\n" " fprintf(stderr, \"fread failed\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"Reached end of file\\[rs]n\");\n" " break;\n" " }\n" "\\&\n" " printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" " }\n" "\\&\n" " free(mycookie.buf);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "#define _GNU_SOURCE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/types.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define INIT_BUF_SIZE 4\n" "\\&\n" "struct memfile_cookie {\n" " char *buf; /* Dynamically sized buffer for data */\n" " size_t allocated; /* Size of buf */\n" " size_t endpos; /* Number of characters in buf */\n" " off_t offset; /* Current file offset in buf */\n" "};\n" "\\&\n" "ssize_t\n" "memfile_write(void *c, const char *buf, size_t size)\n" "{\n" " char *new_buff;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " /* Buffer too small? Keep doubling size until big enough. */\n" "\\&\n" " while (size + cookie-Eoffset E cookie-Eallocated) {\n" " new_buff = realloc(cookie-Ebuf, cookie-Eallocated * 2);\n" " if (new_buff == NULL)\n" " return -1;\n" " cookie-Eallocated *= 2;\n" " cookie-Ebuf = new_buff;\n" " }\n" "\\&\n" " memcpy(cookie-Ebuf + cookie-Eoffset, buf, size);\n" "\\&\n" " cookie-Eoffset += size;\n" " if (cookie-Eoffset E cookie-Eendpos)\n" " cookie-Eendpos = cookie-Eoffset;\n" "\\&\n" " return size;\n" "}\n" "\\&\n" "ssize_t\n" "memfile_read(void *c, char *buf, size_t size)\n" "{\n" " ssize_t xbytes;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " /* Fetch minimum of bytes requested and bytes available. */\n" "\\&\n" " xbytes = size;\n" " if (cookie-Eoffset + size E cookie-Eendpos)\n" " xbytes = cookie-Eendpos - cookie-Eoffset;\n" " if (xbytes E 0) /* offset may be past endpos */\n" " xbytes = 0;\n" "\\&\n" " memcpy(buf, cookie-Ebuf + cookie-Eoffset, xbytes);\n" "\\&\n" " cookie-Eoffset += xbytes;\n" " return xbytes;\n" "}\n" "\\&\n" "int\n" "memfile_seek(void *c, off_t *offset, int whence)\n" "{\n" " off_t new_offset;\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " if (whence == SEEK_SET)\n" " new_offset = *offset;\n" " else if (whence == SEEK_END)\n" " new_offset = cookie-Eendpos + *offset;\n" " else if (whence == SEEK_CUR)\n" " new_offset = cookie-Eoffset + *offset;\n" " else\n" " return -1;\n" "\\&\n" " if (new_offset E 0)\n" " return -1;\n" "\\&\n" " cookie-Eoffset = new_offset;\n" " *offset = new_offset;\n" " return 0;\n" "}\n" "\\&\n" "int\n" "memfile_close(void *c)\n" "{\n" " struct memfile_cookie *cookie = c;\n" "\\&\n" " free(cookie-Ebuf);\n" " cookie-Eallocated = 0;\n" " cookie-Ebuf = NULL;\n" "\\&\n" " return 0;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " cookie_io_functions_t memfile_func = {\n" " .read = memfile_read,\n" " .write = memfile_write,\n" " .seek = memfile_seek,\n" " .close = memfile_close\n" " };\n" " FILE *stream;\n" " struct memfile_cookie mycookie;\n" " size_t nread;\n" " char buf[1000];\n" "\\&\n" " /* Set up the cookie before calling fopencookie(). */\n" "\\&\n" " mycookie.buf = malloc(INIT_BUF_SIZE);\n" " if (mycookie.buf == NULL) {\n" " perror(\"malloc\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " mycookie.allocated = INIT_BUF_SIZE;\n" " mycookie.offset = 0;\n" " mycookie.endpos = 0;\n" "\\&\n" " stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" " if (stream == NULL) {\n" " perror(\"fopencookie\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Write command-line arguments to our file. */\n" "\\&\n" " for (size_t j = 1; j E argc; j++)\n" " if (fputs(argv[j], stream) == EOF) {\n" " perror(\"fputs\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Read two bytes out of every five, until EOF. */\n" "\\&\n" " for (long p = 0; ; p += 5) {\n" " if (fseek(stream, p, SEEK_SET) == -1) {\n" " perror(\"fseek\");\n" " exit(EXIT_FAILURE);\n" " }\n" " nread = fread(buf, 1, 2, stream);\n" " if (nread == 0) {\n" " if (ferror(stream) != 0) {\n" " fprintf(stderr, \"fread failed\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" " }\n" " printf(\"Reached end of file\\[rs]n\");\n" " break;\n" " }\n" "\\&\n" " printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" " }\n" "\\&\n" " free(mycookie.buf);\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "2024-07-23" msgstr "23 يوليو 2024" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "Linux man-pages 6.13" msgstr "صفحات دليل لينكس 6.13" #. type: TH #: mageia-cauldron #, no-wrap msgid "Linux man-pages 6.17" msgstr "صفحات دليل لينكس 6.17" #. type: TH #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "صفحات دليل لينكس (لم تصدر بعد)"