| 1 |
# French translation of manpages |
| 2 |
# This file is distributed under the same license as the manpages-l10n package. |
| 3 |
# Copyright © of this file: |
| 4 |
# Christophe Blaess <https://www.blaess.fr/christophe/>, 1996-2003. |
| 5 |
# Stéphan Rafin <[email protected]>, 2002. |
| 6 |
# Thierry Vignaud <[email protected]>, 1999, 2002. |
| 7 |
# François Micaux, 2002. |
| 8 |
# Alain Portal <[email protected]>, 2003-2008. |
| 9 |
# Jean-Philippe Guérard <[email protected]>, 2005-2006. |
| 10 |
# Jean-Luc Coulon (f5ibh) <[email protected]>, 2006-2007. |
| 11 |
# Julien Cristau <[email protected]>, 2006-2007. |
| 12 |
# Thomas Huriaux <[email protected]>, 2006-2008. |
| 13 |
# Nicolas François <[email protected]>, 2006-2008. |
| 14 |
# Florentin Duneau <[email protected]>, 2006-2010. |
| 15 |
# Simon Paillard <[email protected]>, 2006. |
| 16 |
# Denis Barbier <[email protected]>, 2006, 2010. |
| 17 |
# David Prévot <[email protected]>, 2010-2014. |
| 18 |
# Frédéric Hantrais <[email protected]>, 2013, 2014. |
| 19 |
# Jean-Pierre Giraud <[email protected]>, 2024. |
| 20 |
msgid "" |
| 21 |
msgstr "" |
| 22 |
"Project-Id-Version: manpages-l10n 4.22.0\n" |
| 23 |
"POT-Creation-Date: 2026-06-05 06:24+0200\n" |
| 24 |
"PO-Revision-Date: 2024-06-02 14:05+0200\n" |
| 25 |
"Last-Translator: Jean-Pierre Giraud <[email protected]>\n" |
| 26 |
"Language-Team: French <[email protected]>\n" |
| 27 |
"Language: fr\n" |
| 28 |
"MIME-Version: 1.0\n" |
| 29 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 30 |
"Content-Transfer-Encoding: 8bit\n" |
| 31 |
"\n" |
| 32 |
"Plural-Forms: nplurals=2; plural=n > 1;\n" |
| 33 |
"X-Generator: Lokalize 22.12.3\n" |
| 34 |
|
| 35 |
#. type: TH |
| 36 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 37 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 38 |
#, no-wrap |
| 39 |
msgid "fopencookie" |
| 40 |
msgstr "fopencookie" |
| 41 |
|
| 42 |
#. type: TH |
| 43 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 44 |
#: opensuse-tumbleweed |
| 45 |
#, no-wrap |
| 46 |
msgid "2025-09-21" |
| 47 |
msgstr "21 septembre 2025" |
| 48 |
|
| 49 |
#. type: TH |
| 50 |
#: archlinux debian-unstable |
| 51 |
#, no-wrap |
| 52 |
msgid "Linux man-pages 6.18" |
| 53 |
msgstr "Pages du manuel de Linux 6.18" |
| 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 "NAME" |
| 60 |
msgstr "NOM" |
| 61 |
|
| 62 |
#. type: Plain text |
| 63 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 64 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 65 |
msgid "fopencookie - open a custom stream" |
| 66 |
msgstr "fopencookie – Ouvrir un flux particulier" |
| 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 "LIBRARY" |
| 73 |
msgstr "BIBLIOTHÈQUE" |
| 74 |
|
| 75 |
#. type: Plain text |
| 76 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 77 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 78 |
msgid "Standard C library (I<libc>,\\ I<-lc>)" |
| 79 |
msgstr "Bibliothèque C standard (I<libc>,\\ I<-lc>)" |
| 80 |
|
| 81 |
#. type: SH |
| 82 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 83 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 84 |
#, no-wrap |
| 85 |
msgid "SYNOPSIS" |
| 86 |
msgstr "SYNOPSIS" |
| 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<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n" |
| 94 |
"B<#define _FILE_OFFSET_BITS 64>\n" |
| 95 |
"B<#include E<lt>stdio.hE<gt>>\n" |
| 96 |
msgstr "" |
| 97 |
"B<#define _GNU_SOURCE> /* Consultez feature_test_macros(7) */\n" |
| 98 |
"B<#define _FILE_OFFSET_BITS 64>\n" |
| 99 |
"B<#include E<lt>stdio.hE<gt>>\n" |
| 100 |
|
| 101 |
#. type: Plain text |
| 102 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 103 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 104 |
#, no-wrap |
| 105 |
msgid "" |
| 106 |
"B<FILE *fopencookie(void *restrict >I<cookie>B<, const char *restrict >I<mode>B<,>\n" |
| 107 |
"B< cookie_io_functions_t >I<io_funcs>B<);>\n" |
| 108 |
msgstr "" |
| 109 |
"B<FILE *fopencookie(void *restrict >I<cookie>B<, const char *restrict >I<mode>B<,>\n" |
| 110 |
"B< cookie_io_functions_t >I<io_funcs>B<);>\n" |
| 111 |
|
| 112 |
#. type: SH |
| 113 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 114 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 115 |
#, no-wrap |
| 116 |
msgid "DESCRIPTION" |
| 117 |
msgstr "DESCRIPTION" |
| 118 |
|
| 119 |
#. type: Plain text |
| 120 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 121 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 122 |
msgid "" |
| 123 |
"The B<fopencookie>() function allows the programmer to create a custom " |
| 124 |
"implementation for a standard I/O stream. This implementation can store the " |
| 125 |
"stream's data at a location of its own choosing; for example, " |
| 126 |
"B<fopencookie>() is used to implement B<fmemopen>(3), which provides a " |
| 127 |
"stream interface to data that is stored in a buffer in memory." |
| 128 |
msgstr "" |
| 129 |
"La fonction B<fopencookie>() permet au programmeur de créer des " |
| 130 |
"implémentations particulières de flux d'entrées-sorties. Cette " |
| 131 |
"implémentation peut sauvegarder les flux de données dans une location " |
| 132 |
"choisie. Par exemple, B<fopencookie>() est utilisée pour implémenter " |
| 133 |
"B<fmemopen>(3), qui fournit une interface qui sauvegarde les flux de données " |
| 134 |
"dans un tampon en mémoire." |
| 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 "In order to create a custom stream the programmer must:" |
| 140 |
msgstr "Pour créer un flux particulier, le programmeur doit\\ :" |
| 141 |
|
| 142 |
#. type: IP |
| 143 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 144 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 145 |
#, no-wrap |
| 146 |
msgid "\\[bu]" |
| 147 |
msgstr "-" |
| 148 |
|
| 149 |
#. type: Plain text |
| 150 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 151 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 152 |
msgid "" |
| 153 |
"Implement four \"hook\" functions that are used internally by the standard I/" |
| 154 |
"O library when performing I/O on the stream." |
| 155 |
msgstr "" |
| 156 |
"Implémenter quatre fonctions de «\\ hook\\ » qui seront utilisées en interne " |
| 157 |
"par la bibliothèque standard d'entrées-sorties lors d'opération d'E/S." |
| 158 |
|
| 159 |
#. type: Plain text |
| 160 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 161 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 162 |
msgid "" |
| 163 |
"Define a \"cookie\" data type, a structure that provides bookkeeping " |
| 164 |
"information (e.g., where to store data) used by the aforementioned hook " |
| 165 |
"functions. The standard I/O package knows nothing about the contents of " |
| 166 |
"this cookie (thus it is typed as I<void\\ *> when passed to " |
| 167 |
"B<fopencookie>()), but automatically supplies the cookie as the first " |
| 168 |
"argument when calling the hook functions." |
| 169 |
msgstr "" |
| 170 |
"Définit un type de données «\\ cookie\\ », une structure permettant de " |
| 171 |
"sauvegarder des informations (par exemple, où sauvegarder les données) " |
| 172 |
"utilisée par les fonctions de hook. Les fonctions E/S standards ne " |
| 173 |
"connaissent rien à propos du contenu de ce cookie (il est passé comme un " |
| 174 |
"type I<void\\ *> à B<fopencookie>()) et celui-ci est automatiquement passé " |
| 175 |
"en premier argument des fonctions de hook." |
| 176 |
|
| 177 |
#. type: Plain text |
| 178 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 179 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 180 |
msgid "" |
| 181 |
"Call B<fopencookie>() to open a new stream and associate the cookie and " |
| 182 |
"hook functions with that stream." |
| 183 |
msgstr "" |
| 184 |
"Appeler B<fopencookie>() pour ouvrir un nouveau flux et associer le cookie " |
| 185 |
"et les fonctions de «\\ hook\\ » à ce flux." |
| 186 |
|
| 187 |
#. type: Plain text |
| 188 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 189 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 190 |
msgid "" |
| 191 |
"The B<fopencookie>() function serves a purpose similar to B<fopen>(3): it " |
| 192 |
"opens a new stream and returns a pointer to a I<FILE> object that is used to " |
| 193 |
"operate on that stream." |
| 194 |
msgstr "" |
| 195 |
"La fonction B<fopencookie>() effectue une tâche similaire à celle de " |
| 196 |
"B<fopen>(3)\\ : elle ouvre un nouveau flux et renvoie un pointeur vers un " |
| 197 |
"objet I<FILE> utilisé pour manipuler le flux." |
| 198 |
|
| 199 |
#. type: Plain text |
| 200 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 201 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 202 |
msgid "" |
| 203 |
"The I<cookie> argument is a pointer to the caller's cookie structure that is " |
| 204 |
"to be associated with the new stream. This pointer is supplied as the first " |
| 205 |
"argument when the standard I/O library invokes any of the hook functions " |
| 206 |
"described below." |
| 207 |
msgstr "" |
| 208 |
"L'argument I<cookie> est un pointeur vers la structure cookie appelante qui " |
| 209 |
"est associée au nouveau flux. Ce pointeur est passé en premier argument " |
| 210 |
"lorsque les bibliothèques d'E/S standard appellent une des fonctions de hook." |
| 211 |
|
| 212 |
#. type: Plain text |
| 213 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 214 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 215 |
msgid "" |
| 216 |
"The I<mode> argument serves the same purpose as for B<fopen>(3). The " |
| 217 |
"following modes are supported: I<r>, I<w>, I<a>, I<r+>, I<w+>, and I<a+>. " |
| 218 |
"See B<fopen>(3) for details." |
| 219 |
msgstr "" |
| 220 |
"L'argument I<mode> a le même sens que pour B<fopen>(3). Les modes suivants " |
| 221 |
"sont gérés\\ : I<r>, I<w>, I<a>, I<r+>, I<w+> et I<a+>. Consultez " |
| 222 |
"B<fopen>(3) pour plus de détails." |
| 223 |
|
| 224 |
#. type: Plain text |
| 225 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 226 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 227 |
msgid "" |
| 228 |
"The I<io_funcs> argument is a structure that contains four fields pointing " |
| 229 |
"to the programmer-defined hook functions that are used to implement this " |
| 230 |
"stream. The structure is defined as follows" |
| 231 |
msgstr "" |
| 232 |
"L'argument I<io_funcs> est une structure qui contient quatre champs pointant " |
| 233 |
"vers les fonctions de «\\ hook\\ » définies par le programmeur qui seront " |
| 234 |
"utilisées dans l'implémentation du flux. La structure est définie comme " |
| 235 |
"suit\\ :" |
| 236 |
|
| 237 |
#. type: Plain text |
| 238 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 239 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 240 |
#, no-wrap |
| 241 |
msgid "" |
| 242 |
"typedef struct {\n" |
| 243 |
" cookie_read_function_t *read;\n" |
| 244 |
" cookie_write_function_t *write;\n" |
| 245 |
" cookie_seek_function_t *seek;\n" |
| 246 |
" cookie_close_function_t *close;\n" |
| 247 |
"} cookie_io_functions_t;\n" |
| 248 |
msgstr "" |
| 249 |
"typedef struct {\n" |
| 250 |
" cookie_read_function_t *read;\n" |
| 251 |
" cookie_write_function_t *write;\n" |
| 252 |
" cookie_seek_function_t *seek;\n" |
| 253 |
" cookie_close_function_t *close;\n" |
| 254 |
"} cookie_io_functions_t;\n" |
| 255 |
|
| 256 |
#. type: Plain text |
| 257 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 258 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 259 |
msgid "The four fields are as follows:" |
| 260 |
msgstr "Les quatre membres sont définis comme suit\\ :" |
| 261 |
|
| 262 |
#. type: TP |
| 263 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 264 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 265 |
#, no-wrap |
| 266 |
msgid "I<cookie_read_function_t *read>" |
| 267 |
msgstr "I<cookie_read_function_t *read>" |
| 268 |
|
| 269 |
#. type: Plain text |
| 270 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 271 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 272 |
msgid "" |
| 273 |
"This function implements read operations for the stream. When called, it " |
| 274 |
"receives three arguments:" |
| 275 |
msgstr "" |
| 276 |
"Cette fonction implémente les opérations de lecture du flux. Lorsqu'elle est " |
| 277 |
"appelée, elle reçoit trois arguments." |
| 278 |
|
| 279 |
#. type: Plain text |
| 280 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 281 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 282 |
#, no-wrap |
| 283 |
msgid "ssize_t read(void *cookie, char *buf, size_t size);\n" |
| 284 |
msgstr "ssize_t read(void *cookie, char *buf, size_t size);\n" |
| 285 |
|
| 286 |
#. type: Plain text |
| 287 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 288 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 289 |
msgid "" |
| 290 |
"The I<buf> and I<size> arguments are, respectively, a buffer into which " |
| 291 |
"input data can be placed and the size of that buffer. As its function " |
| 292 |
"result, the I<read> function should return the number of bytes copied into " |
| 293 |
"I<buf>, 0 on end of file, or -1 on error. The I<read> function should " |
| 294 |
"update the stream offset appropriately." |
| 295 |
msgstr "" |
| 296 |
"Les argument I<buf> et I<size> sont respectivement, un tampon de données " |
| 297 |
"pour sauvegarder les données en provenance du flux et la taille du tampon. " |
| 298 |
"La fonction I<read> renvoie le nombre d'octets copiés depuis le flux ou -1 " |
| 299 |
"en cas d'erreur. La fonction I<read> doit mettre à jour la position dans le " |
| 300 |
"flux en conséquence." |
| 301 |
|
| 302 |
#. type: Plain text |
| 303 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 304 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 305 |
msgid "" |
| 306 |
"If I<*read> is a null pointer, then reads from the custom stream always " |
| 307 |
"return end of file." |
| 308 |
msgstr "" |
| 309 |
"Si I<*read> est un pointeur NULL, alors les lectures du flux renvoient " |
| 310 |
"toujours fin de fichier." |
| 311 |
|
| 312 |
#. type: TP |
| 313 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 314 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 315 |
#, no-wrap |
| 316 |
msgid "I<cookie_write_function_t *write>" |
| 317 |
msgstr "I<cookie_write_function_t *write>" |
| 318 |
|
| 319 |
#. type: Plain text |
| 320 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 321 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 322 |
msgid "" |
| 323 |
"This function implements write operations for the stream. When called, it " |
| 324 |
"receives three arguments:" |
| 325 |
msgstr "" |
| 326 |
"Cette fonction implémente les opérations d'écriture du flux. Lorsqu'elle est " |
| 327 |
"appelée, elle reçoit trois arguments\\ :" |
| 328 |
|
| 329 |
#. type: Plain text |
| 330 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 331 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 332 |
#, no-wrap |
| 333 |
msgid "ssize_t write(void *cookie, const char *buf, size_t size);\n" |
| 334 |
msgstr "ssize_t write(void *cookie, const char *buf, size_t size);\n" |
| 335 |
|
| 336 |
#. type: Plain text |
| 337 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 338 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 339 |
msgid "" |
| 340 |
"The I<buf> and I<size> arguments are, respectively, a buffer of data to be " |
| 341 |
"output to the stream and the size of that buffer. As its function result, " |
| 342 |
"the I<write> function should return the number of bytes copied from I<buf>, " |
| 343 |
"or 0 on error. (The function must not return a negative value.) The " |
| 344 |
"I<write> function should update the stream offset appropriately." |
| 345 |
msgstr "" |
| 346 |
"Les argument I<buf> et I<size> sont respectivement, un tampon de données à " |
| 347 |
"écrire dans le flux et la taille du tampon. La fonction I<write> renvoie le " |
| 348 |
"nombre d'octets copiés depuis I<buf> ou 0 en cas d'erreur (la fonction ne " |
| 349 |
"doit pas renvoyer de valeur négative). La fonction I<write> doit mettre à " |
| 350 |
"jour la position dans le flux en conséquence." |
| 351 |
|
| 352 |
#. type: Plain text |
| 353 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 354 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 355 |
msgid "If I<*write> is a null pointer, then output to the stream is discarded." |
| 356 |
msgstr "" |
| 357 |
"Si I<*write> est un pointeur NULL, alors les écritures dans le flux ne sont " |
| 358 |
"pas réalisées." |
| 359 |
|
| 360 |
#. type: TP |
| 361 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 362 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 363 |
#, no-wrap |
| 364 |
msgid "I<cookie_seek_function_t *seek>" |
| 365 |
msgstr "I<cookie_seek_function_t *seek>" |
| 366 |
|
| 367 |
#. type: Plain text |
| 368 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 369 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 370 |
msgid "" |
| 371 |
"This function implements seek operations on the stream. When called, it " |
| 372 |
"receives three arguments:" |
| 373 |
msgstr "" |
| 374 |
"Cette fonction implémente les opérations de positionnement dans le flux. " |
| 375 |
"Lorsqu'elle est appelée, elle prend trois arguments\\ :" |
| 376 |
|
| 377 |
#. type: Plain text |
| 378 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 379 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 380 |
#, no-wrap |
| 381 |
msgid "int seek(void *cookie, off_t *offset, int whence);\n" |
| 382 |
msgstr "int seek(void *cookie, off_t *offset, int whence);\n" |
| 383 |
|
| 384 |
#. type: Plain text |
| 385 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 386 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 387 |
msgid "" |
| 388 |
"The I<*offset> argument specifies the new file offset depending on which of " |
| 389 |
"the following three values is supplied in I<whence>:" |
| 390 |
msgstr "" |
| 391 |
"L'argument I<*offset> spécifie le nouveau décalage du fichier selon les " |
| 392 |
"trois valeurs suivantes fournies à I<whence>\\ :" |
| 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_SET>" |
| 399 |
msgstr "B<SEEK_SET>" |
| 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 "" |
| 405 |
"The stream offset should be set I<*offset> bytes from the start of the " |
| 406 |
"stream." |
| 407 |
msgstr "" |
| 408 |
"Le décalage du flux doit être défini à I<*offset> octets après le début du " |
| 409 |
"flux." |
| 410 |
|
| 411 |
#. type: TP |
| 412 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 413 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 414 |
#, no-wrap |
| 415 |
msgid "B<SEEK_CUR>" |
| 416 |
msgstr "B<SEEK_CUR>" |
| 417 |
|
| 418 |
#. type: Plain text |
| 419 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 420 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 421 |
msgid "I<*offset> should be added to the current stream offset." |
| 422 |
msgstr "I<*offset> doit être ajouté à l'offset actuel du flux." |
| 423 |
|
| 424 |
#. type: TP |
| 425 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 426 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 427 |
#, no-wrap |
| 428 |
msgid "B<SEEK_END>" |
| 429 |
msgstr "B<SEEK_END>" |
| 430 |
|
| 431 |
#. type: Plain text |
| 432 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 433 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 434 |
msgid "" |
| 435 |
"The stream offset should be set to the size of the stream plus I<*offset>." |
| 436 |
msgstr "L'offset du flux doit être défini à la taille du flux plus I<*offset>." |
| 437 |
|
| 438 |
#. type: Plain text |
| 439 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 440 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 441 |
msgid "" |
| 442 |
"Before returning, the I<seek> function should update I<*offset> to indicate " |
| 443 |
"the new stream offset." |
| 444 |
msgstr "" |
| 445 |
"La fonction I<seek> doit mettre à jour I<*offset> pour indiquer le nouvel " |
| 446 |
"offset du flux avant de renvoyer." |
| 447 |
|
| 448 |
#. type: Plain text |
| 449 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 450 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 451 |
msgid "" |
| 452 |
"As its function result, the I<seek> function should return 0 on success, and " |
| 453 |
"-1 on error." |
| 454 |
msgstr "" |
| 455 |
"La function I<seek> devrait renvoyer B<0> en cas de succès et B<-1> en cas " |
| 456 |
"d'erreur." |
| 457 |
|
| 458 |
#. type: Plain text |
| 459 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 460 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 461 |
msgid "" |
| 462 |
"If I<*seek> is a null pointer, then it is not possible to perform seek " |
| 463 |
"operations on the stream." |
| 464 |
msgstr "" |
| 465 |
"Si I<*seek> est un pointeur NULL, alors il est impossible de se positionner " |
| 466 |
"dans le flux." |
| 467 |
|
| 468 |
#. type: TP |
| 469 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 470 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 471 |
#, no-wrap |
| 472 |
msgid "I<cookie_close_function_t *close>" |
| 473 |
msgstr "I<cookie_close_function_t *close>" |
| 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 |
"This function closes the stream. The hook function can do things such as " |
| 480 |
"freeing buffers allocated for the stream. When called, it receives one " |
| 481 |
"argument:" |
| 482 |
msgstr "" |
| 483 |
"Cette fonction ferme le flux. Par exemple, la fonction de hook peut " |
| 484 |
"désallouer des tampons alloués pour le flux. Lorsqu'elle est appelée, elle " |
| 485 |
"prend un argument\\ :" |
| 486 |
|
| 487 |
#. type: Plain text |
| 488 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 489 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 490 |
#, no-wrap |
| 491 |
msgid "int close(void *cookie);\n" |
| 492 |
msgstr "int close(void *cookie);\n" |
| 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 |
"The I<cookie> argument is the cookie that the programmer supplied when " |
| 499 |
"calling B<fopencookie>()." |
| 500 |
msgstr "" |
| 501 |
"L'argument I<cookie> est le cookie que le programmeur fournit à " |
| 502 |
"B<fopencookie>()." |
| 503 |
|
| 504 |
#. type: Plain text |
| 505 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 506 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 507 |
msgid "" |
| 508 |
"As its function result, the I<close> function should return 0 on success, " |
| 509 |
"and B<EOF> on error." |
| 510 |
msgstr "" |
| 511 |
"La function I<close> devrait renvoyée 0 en cas de succès et B<EOF> en cas " |
| 512 |
"d'erreur." |
| 513 |
|
| 514 |
#. type: Plain text |
| 515 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 516 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 517 |
msgid "" |
| 518 |
"If I<*close> is NULL, then no special action is performed when the stream is " |
| 519 |
"closed." |
| 520 |
msgstr "" |
| 521 |
"Si I<*close> est NULL, alors aucune action n'est réalisée lorsque le flux " |
| 522 |
"est fermé." |
| 523 |
|
| 524 |
#. type: SH |
| 525 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 526 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 527 |
#, no-wrap |
| 528 |
msgid "RETURN VALUE" |
| 529 |
msgstr "VALEUR RENVOYÉE" |
| 530 |
|
| 531 |
#. .SH ERRORS |
| 532 |
#. It's not clear if errno ever gets set... |
| 533 |
#. type: Plain text |
| 534 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 535 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 536 |
msgid "" |
| 537 |
"On success B<fopencookie>() returns a pointer to the new stream. On error, " |
| 538 |
"NULL is returned." |
| 539 |
msgstr "" |
| 540 |
"En cas de succès, B<fopencookie>() renvoie un pointeur sur le nouveau flux. " |
| 541 |
"En cas d'erreur, NULL est renvoyé." |
| 542 |
|
| 543 |
#. type: SH |
| 544 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 545 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 546 |
#, no-wrap |
| 547 |
msgid "ATTRIBUTES" |
| 548 |
msgstr "ATTRIBUTS" |
| 549 |
|
| 550 |
#. type: Plain text |
| 551 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 552 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 553 |
msgid "" |
| 554 |
"For an explanation of the terms used in this section, see B<attributes>(7)." |
| 555 |
msgstr "" |
| 556 |
"Pour une explication des termes utilisés dans cette section, consulter " |
| 557 |
"B<attributes>(7)." |
| 558 |
|
| 559 |
#. type: tbl table |
| 560 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 561 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 562 |
#, no-wrap |
| 563 |
msgid "Interface" |
| 564 |
msgstr "Interface" |
| 565 |
|
| 566 |
#. type: tbl table |
| 567 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 568 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 569 |
#, no-wrap |
| 570 |
msgid "Attribute" |
| 571 |
msgstr "Attribut" |
| 572 |
|
| 573 |
#. type: tbl table |
| 574 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 575 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 576 |
#, no-wrap |
| 577 |
msgid "Value" |
| 578 |
msgstr "Valeur" |
| 579 |
|
| 580 |
#. type: tbl table |
| 581 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 582 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 583 |
#, no-wrap |
| 584 |
msgid ".na\n" |
| 585 |
msgstr ".na\n" |
| 586 |
|
| 587 |
#. type: tbl table |
| 588 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 589 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 590 |
#, no-wrap |
| 591 |
msgid ".nh\n" |
| 592 |
msgstr ".nh\n" |
| 593 |
|
| 594 |
#. type: tbl table |
| 595 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 596 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 597 |
#, no-wrap |
| 598 |
msgid "B<fopencookie>()" |
| 599 |
msgstr "B<fopencookie>()" |
| 600 |
|
| 601 |
#. type: tbl table |
| 602 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 603 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 604 |
#, no-wrap |
| 605 |
msgid "Thread safety" |
| 606 |
msgstr "Sécurité des threads" |
| 607 |
|
| 608 |
#. type: tbl table |
| 609 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 610 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 611 |
#, no-wrap |
| 612 |
msgid "MT-Safe" |
| 613 |
msgstr "MT-Safe" |
| 614 |
|
| 615 |
#. type: SH |
| 616 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 617 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 618 |
#, no-wrap |
| 619 |
msgid "STANDARDS" |
| 620 |
msgstr "NORMES" |
| 621 |
|
| 622 |
#. type: Plain text |
| 623 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 624 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 625 |
msgid "GNU." |
| 626 |
msgstr "GNU." |
| 627 |
|
| 628 |
#. type: SH |
| 629 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 630 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 631 |
#, no-wrap |
| 632 |
msgid "EXAMPLES" |
| 633 |
msgstr "EXEMPLES" |
| 634 |
|
| 635 |
#. type: Plain text |
| 636 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 637 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 638 |
msgid "" |
| 639 |
"The program below implements a custom stream whose functionality is similar " |
| 640 |
"(but not identical) to that available via B<fmemopen>(3). It implements a " |
| 641 |
"stream whose data is stored in a memory buffer. The program writes its " |
| 642 |
"command-line arguments to the stream, and then seeks through the stream " |
| 643 |
"reading two out of every five characters and writing them to standard " |
| 644 |
"output. The following shell session demonstrates the use of the program:" |
| 645 |
msgstr "" |
| 646 |
"Le programme ci-dessous implémente un flux particulier dont la " |
| 647 |
"fonctionnalité est similaire (mais non identique) à celle de B<fmemopen>(3). " |
| 648 |
"Il implémente un flux dont les données sont sauvegardées dans un tampon. Le " |
| 649 |
"programme écrit les options de sa ligne de commande dans le flux et se " |
| 650 |
"positionne dans le flux afin de lire 2 caractères sur 5 et les écrit sur la " |
| 651 |
"sortie standard. La session shell suivante explique comment utiliser ce " |
| 652 |
"programme." |
| 653 |
|
| 654 |
#. type: Plain text |
| 655 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 656 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 657 |
#, no-wrap |
| 658 |
msgid "" |
| 659 |
"$B< ./a.out \\[aq]hello world\\[aq]>\n" |
| 660 |
"/he/\n" |
| 661 |
"/ w/\n" |
| 662 |
"/d/\n" |
| 663 |
"Reached end of file\n" |
| 664 |
msgstr "" |
| 665 |
"$B< ./a.out \\[aq]hello world\\[aq]>\n" |
| 666 |
"/he/\n" |
| 667 |
"/ w/\n" |
| 668 |
"/d/\n" |
| 669 |
"Fin de fichier atteinte\n" |
| 670 |
|
| 671 |
#. type: Plain text |
| 672 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 673 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 674 |
msgid "" |
| 675 |
"Note that a more general version of the program below could be improved to " |
| 676 |
"more robustly handle various error situations (e.g., opening a stream with a " |
| 677 |
"cookie that already has an open stream; closing a stream that has already " |
| 678 |
"been closed)." |
| 679 |
msgstr "" |
| 680 |
"Notez qu'une version plus générique et plus robuste du programme ci-dessous, " |
| 681 |
"avec une gestion des erreurs pourrait être implémenté (par exemple, " |
| 682 |
"l'ouverture d'un flux avec un cookie en cours d'utilisation par un autre " |
| 683 |
"flux\\ ; la fermeture d'un flux déjà fermé)." |
| 684 |
|
| 685 |
#. type: SS |
| 686 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 687 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 688 |
#, no-wrap |
| 689 |
msgid "Program source" |
| 690 |
msgstr "Source du programme" |
| 691 |
|
| 692 |
#. type: Plain text |
| 693 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 694 |
#: opensuse-tumbleweed |
| 695 |
#, fuzzy, no-wrap |
| 696 |
#| msgid "" |
| 697 |
#| "#define _GNU_SOURCE\n" |
| 698 |
#| "#include E<lt>stdio.hE<gt>\n" |
| 699 |
#| "#include E<lt>stdlib.hE<gt>\n" |
| 700 |
#| "#include E<lt>string.hE<gt>\n" |
| 701 |
#| "#include E<lt>sys/types.hE<gt>\n" |
| 702 |
#| "#include E<lt>unistd.hE<gt>\n" |
| 703 |
#| "\\&\n" |
| 704 |
#| "#define INIT_BUF_SIZE 4\n" |
| 705 |
#| "\\&\n" |
| 706 |
#| "struct memfile_cookie {\n" |
| 707 |
#| " char *buf; /* Dynamically sized buffer for data */\n" |
| 708 |
#| " size_t allocated; /* Size of buf */\n" |
| 709 |
#| " size_t endpos; /* Number of characters in buf */\n" |
| 710 |
#| " off_t offset; /* Current file offset in buf */\n" |
| 711 |
#| "};\n" |
| 712 |
#| "\\&\n" |
| 713 |
#| "ssize_t\n" |
| 714 |
#| "memfile_write(void *c, const char *buf, size_t size)\n" |
| 715 |
#| "{\n" |
| 716 |
#| " char *new_buff;\n" |
| 717 |
#| " struct memfile_cookie *cookie = c;\n" |
| 718 |
#| "\\&\n" |
| 719 |
#| " /* Buffer too small? Keep doubling size until big enough. */\n" |
| 720 |
#| "\\&\n" |
| 721 |
#| " while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 722 |
#| " new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 723 |
#| " if (new_buff == NULL)\n" |
| 724 |
#| " return -1;\n" |
| 725 |
#| " cookie-E<gt>allocated *= 2;\n" |
| 726 |
#| " cookie-E<gt>buf = new_buff;\n" |
| 727 |
#| " }\n" |
| 728 |
#| "\\&\n" |
| 729 |
#| " memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 730 |
#| "\\&\n" |
| 731 |
#| " cookie-E<gt>offset += size;\n" |
| 732 |
#| " if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 733 |
#| " cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 734 |
#| "\\&\n" |
| 735 |
#| " return size;\n" |
| 736 |
#| "}\n" |
| 737 |
#| "\\&\n" |
| 738 |
#| "ssize_t\n" |
| 739 |
#| "memfile_read(void *c, char *buf, size_t size)\n" |
| 740 |
#| "{\n" |
| 741 |
#| " ssize_t xbytes;\n" |
| 742 |
#| " struct memfile_cookie *cookie = c;\n" |
| 743 |
#| "\\&\n" |
| 744 |
#| " /* Fetch minimum of bytes requested and bytes available. */\n" |
| 745 |
#| "\\&\n" |
| 746 |
#| " xbytes = size;\n" |
| 747 |
#| " if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 748 |
#| " xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 749 |
#| " if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 750 |
#| " xbytes = 0;\n" |
| 751 |
#| "\\&\n" |
| 752 |
#| " memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 753 |
#| "\\&\n" |
| 754 |
#| " cookie-E<gt>offset += xbytes;\n" |
| 755 |
#| " return xbytes;\n" |
| 756 |
#| "}\n" |
| 757 |
#| "\\&\n" |
| 758 |
#| "int\n" |
| 759 |
#| "memfile_seek(void *c, off_t *offset, int whence)\n" |
| 760 |
#| "{\n" |
| 761 |
#| " off_t new_offset;\n" |
| 762 |
#| " struct memfile_cookie *cookie = c;\n" |
| 763 |
#| "\\&\n" |
| 764 |
#| " if (whence == SEEK_SET)\n" |
| 765 |
#| " new_offset = *offset;\n" |
| 766 |
#| " else if (whence == SEEK_END)\n" |
| 767 |
#| " new_offset = cookie-E<gt>endpos + *offset;\n" |
| 768 |
#| " else if (whence == SEEK_CUR)\n" |
| 769 |
#| " new_offset = cookie-E<gt>offset + *offset;\n" |
| 770 |
#| " else\n" |
| 771 |
#| " return -1;\n" |
| 772 |
#| "\\&\n" |
| 773 |
#| " if (new_offset E<lt> 0)\n" |
| 774 |
#| " return -1;\n" |
| 775 |
#| "\\&\n" |
| 776 |
#| " cookie-E<gt>offset = new_offset;\n" |
| 777 |
#| " *offset = new_offset;\n" |
| 778 |
#| " return 0;\n" |
| 779 |
#| "}\n" |
| 780 |
#| "\\&\n" |
| 781 |
#| "int\n" |
| 782 |
#| "memfile_close(void *c)\n" |
| 783 |
#| "{\n" |
| 784 |
#| " struct memfile_cookie *cookie = c;\n" |
| 785 |
#| "\\&\n" |
| 786 |
#| " free(cookie-E<gt>buf);\n" |
| 787 |
#| " cookie-E<gt>allocated = 0;\n" |
| 788 |
#| " cookie-E<gt>buf = NULL;\n" |
| 789 |
#| "\\&\n" |
| 790 |
#| " return 0;\n" |
| 791 |
#| "}\n" |
| 792 |
#| "\\&\n" |
| 793 |
#| "int\n" |
| 794 |
#| "main(int argc, char *argv[])\n" |
| 795 |
#| "{\n" |
| 796 |
#| " cookie_io_functions_t memfile_func = {\n" |
| 797 |
#| " .read = memfile_read,\n" |
| 798 |
#| " .write = memfile_write,\n" |
| 799 |
#| " .seek = memfile_seek,\n" |
| 800 |
#| " .close = memfile_close\n" |
| 801 |
#| " };\n" |
| 802 |
#| " FILE *stream;\n" |
| 803 |
#| " struct memfile_cookie mycookie;\n" |
| 804 |
#| " size_t nread;\n" |
| 805 |
#| " char buf[1000];\n" |
| 806 |
#| "\\&\n" |
| 807 |
#| " /* Set up the cookie before calling fopencookie(). */\n" |
| 808 |
#| "\\&\n" |
| 809 |
#| " mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 810 |
#| " if (mycookie.buf == NULL) {\n" |
| 811 |
#| " perror(\"malloc\");\n" |
| 812 |
#| " exit(EXIT_FAILURE);\n" |
| 813 |
#| " }\n" |
| 814 |
#| "\\&\n" |
| 815 |
#| " mycookie.allocated = INIT_BUF_SIZE;\n" |
| 816 |
#| " mycookie.offset = 0;\n" |
| 817 |
#| " mycookie.endpos = 0;\n" |
| 818 |
#| "\\&\n" |
| 819 |
#| " stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 820 |
#| " if (stream == NULL) {\n" |
| 821 |
#| " perror(\"fopencookie\");\n" |
| 822 |
#| " exit(EXIT_FAILURE);\n" |
| 823 |
#| " }\n" |
| 824 |
#| "\\&\n" |
| 825 |
#| " /* Write command-line arguments to our file. */\n" |
| 826 |
#| "\\&\n" |
| 827 |
#| " for (size_t j = 1; j E<lt> argc; j++)\n" |
| 828 |
#| " if (fputs(argv[j], stream) == EOF) {\n" |
| 829 |
#| " perror(\"fputs\");\n" |
| 830 |
#| " exit(EXIT_FAILURE);\n" |
| 831 |
#| " }\n" |
| 832 |
#| "\\&\n" |
| 833 |
#| " /* Read two bytes out of every five, until EOF. */\n" |
| 834 |
#| "\\&\n" |
| 835 |
#| " for (long p = 0; ; p += 5) {\n" |
| 836 |
#| " if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 837 |
#| " perror(\"fseek\");\n" |
| 838 |
#| " exit(EXIT_FAILURE);\n" |
| 839 |
#| " }\n" |
| 840 |
#| " nread = fread(buf, 1, 2, stream);\n" |
| 841 |
#| " if (nread == 0) {\n" |
| 842 |
#| " if (ferror(stream) != 0) {\n" |
| 843 |
#| " fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 844 |
#| " exit(EXIT_FAILURE);\n" |
| 845 |
#| " }\n" |
| 846 |
#| " printf(\"Reached end of file\\[rs]n\");\n" |
| 847 |
#| " break;\n" |
| 848 |
#| " }\n" |
| 849 |
#| "\\&\n" |
| 850 |
#| " printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 851 |
#| " }\n" |
| 852 |
#| "\\&\n" |
| 853 |
#| " free(mycookie.buf);\n" |
| 854 |
#| "\\&\n" |
| 855 |
#| " exit(EXIT_SUCCESS);\n" |
| 856 |
#| "}\n" |
| 857 |
msgid "" |
| 858 |
"#define _GNU_SOURCE\n" |
| 859 |
"#include E<lt>stdio.hE<gt>\n" |
| 860 |
"#include E<lt>stdlib.hE<gt>\n" |
| 861 |
"#include E<lt>string.hE<gt>\n" |
| 862 |
"#include E<lt>sys/types.hE<gt>\n" |
| 863 |
"#include E<lt>unistd.hE<gt>\n" |
| 864 |
"\\&\n" |
| 865 |
"#define INIT_BUF_SIZE 4\n" |
| 866 |
"\\&\n" |
| 867 |
"struct memfile_cookie {\n" |
| 868 |
" char *buf; /* Dynamically sized buffer for data */\n" |
| 869 |
" size_t allocated; /* Size of buf */\n" |
| 870 |
" size_t endpos; /* Number of characters in buf */\n" |
| 871 |
" off_t offset; /* Current file offset in buf */\n" |
| 872 |
"};\n" |
| 873 |
"\\&\n" |
| 874 |
"static ssize_t\n" |
| 875 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 876 |
"{\n" |
| 877 |
" char *new_buff;\n" |
| 878 |
" struct memfile_cookie *cookie = c;\n" |
| 879 |
"\\&\n" |
| 880 |
" /* Buffer too small? Keep doubling size until big enough. */\n" |
| 881 |
"\\&\n" |
| 882 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 883 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 884 |
" if (new_buff == NULL)\n" |
| 885 |
" return -1;\n" |
| 886 |
" cookie-E<gt>allocated *= 2;\n" |
| 887 |
" cookie-E<gt>buf = new_buff;\n" |
| 888 |
" }\n" |
| 889 |
"\\&\n" |
| 890 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 891 |
"\\&\n" |
| 892 |
" cookie-E<gt>offset += size;\n" |
| 893 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 894 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 895 |
"\\&\n" |
| 896 |
" return size;\n" |
| 897 |
"}\n" |
| 898 |
"\\&\n" |
| 899 |
"static ssize_t\n" |
| 900 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 901 |
"{\n" |
| 902 |
" ssize_t xbytes;\n" |
| 903 |
" struct memfile_cookie *cookie = c;\n" |
| 904 |
"\\&\n" |
| 905 |
" /* Fetch minimum of bytes requested and bytes available. */\n" |
| 906 |
"\\&\n" |
| 907 |
" xbytes = size;\n" |
| 908 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 909 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 910 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 911 |
" xbytes = 0;\n" |
| 912 |
"\\&\n" |
| 913 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 914 |
"\\&\n" |
| 915 |
" cookie-E<gt>offset += xbytes;\n" |
| 916 |
" return xbytes;\n" |
| 917 |
"}\n" |
| 918 |
"\\&\n" |
| 919 |
"static int\n" |
| 920 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 921 |
"{\n" |
| 922 |
" off_t new_offset;\n" |
| 923 |
" struct memfile_cookie *cookie = c;\n" |
| 924 |
"\\&\n" |
| 925 |
" if (whence == SEEK_SET)\n" |
| 926 |
" new_offset = *offset;\n" |
| 927 |
" else if (whence == SEEK_END)\n" |
| 928 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 929 |
" else if (whence == SEEK_CUR)\n" |
| 930 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 931 |
" else\n" |
| 932 |
" return -1;\n" |
| 933 |
"\\&\n" |
| 934 |
" if (new_offset E<lt> 0)\n" |
| 935 |
" return -1;\n" |
| 936 |
"\\&\n" |
| 937 |
" cookie-E<gt>offset = new_offset;\n" |
| 938 |
" *offset = new_offset;\n" |
| 939 |
" return 0;\n" |
| 940 |
"}\n" |
| 941 |
"\\&\n" |
| 942 |
"static int\n" |
| 943 |
"memfile_close(void *c)\n" |
| 944 |
"{\n" |
| 945 |
" struct memfile_cookie *cookie = c;\n" |
| 946 |
"\\&\n" |
| 947 |
" free(cookie-E<gt>buf);\n" |
| 948 |
" cookie-E<gt>allocated = 0;\n" |
| 949 |
" cookie-E<gt>buf = NULL;\n" |
| 950 |
"\\&\n" |
| 951 |
" return 0;\n" |
| 952 |
"}\n" |
| 953 |
"\\&\n" |
| 954 |
"int\n" |
| 955 |
"main(int argc, char *argv[])\n" |
| 956 |
"{\n" |
| 957 |
" cookie_io_functions_t memfile_func = {\n" |
| 958 |
" .read = memfile_read,\n" |
| 959 |
" .write = memfile_write,\n" |
| 960 |
" .seek = memfile_seek,\n" |
| 961 |
" .close = memfile_close\n" |
| 962 |
" };\n" |
| 963 |
" FILE *stream;\n" |
| 964 |
" struct memfile_cookie mycookie;\n" |
| 965 |
" size_t nread;\n" |
| 966 |
" char buf[1000];\n" |
| 967 |
"\\&\n" |
| 968 |
" /* Set up the cookie before calling fopencookie(). */\n" |
| 969 |
"\\&\n" |
| 970 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 971 |
" if (mycookie.buf == NULL) {\n" |
| 972 |
" perror(\"malloc\");\n" |
| 973 |
" exit(EXIT_FAILURE);\n" |
| 974 |
" }\n" |
| 975 |
"\\&\n" |
| 976 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 977 |
" mycookie.offset = 0;\n" |
| 978 |
" mycookie.endpos = 0;\n" |
| 979 |
"\\&\n" |
| 980 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 981 |
" if (stream == NULL) {\n" |
| 982 |
" perror(\"fopencookie\");\n" |
| 983 |
" exit(EXIT_FAILURE);\n" |
| 984 |
" }\n" |
| 985 |
"\\&\n" |
| 986 |
" /* Write command-line arguments to our file. */\n" |
| 987 |
"\\&\n" |
| 988 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 989 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 990 |
" perror(\"fputs\");\n" |
| 991 |
" exit(EXIT_FAILURE);\n" |
| 992 |
" }\n" |
| 993 |
"\\&\n" |
| 994 |
" /* Read two bytes out of every five, until EOF. */\n" |
| 995 |
"\\&\n" |
| 996 |
" for (long p = 0; ; p += 5) {\n" |
| 997 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 998 |
" perror(\"fseek\");\n" |
| 999 |
" exit(EXIT_FAILURE);\n" |
| 1000 |
" }\n" |
| 1001 |
" nread = fread(buf, 1, 2, stream);\n" |
| 1002 |
" if (nread == 0) {\n" |
| 1003 |
" if (ferror(stream) != 0) {\n" |
| 1004 |
" fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 1005 |
" exit(EXIT_FAILURE);\n" |
| 1006 |
" }\n" |
| 1007 |
" printf(\"Reached end of file\\[rs]n\");\n" |
| 1008 |
" break;\n" |
| 1009 |
" }\n" |
| 1010 |
"\\&\n" |
| 1011 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 1012 |
" }\n" |
| 1013 |
"\\&\n" |
| 1014 |
" free(mycookie.buf);\n" |
| 1015 |
"\\&\n" |
| 1016 |
" exit(EXIT_SUCCESS);\n" |
| 1017 |
"}\n" |
| 1018 |
msgstr "" |
| 1019 |
"#define _GNU_SOURCE\n" |
| 1020 |
"#include E<lt>stdio.hE<gt>\n" |
| 1021 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1022 |
"#include E<lt>string.hE<gt>\n" |
| 1023 |
"#include E<lt>sys/types.hE<gt>\n" |
| 1024 |
"#include E<lt>unistd.hE<gt>\n" |
| 1025 |
"\\&\n" |
| 1026 |
"#define INIT_BUF_SIZE 4\n" |
| 1027 |
"\\&\n" |
| 1028 |
"struct memfile_cookie {\n" |
| 1029 |
" char *buf; /* Tampon de taille dynamique pour les données */\n" |
| 1030 |
" size_t allocated; /* Taille du tampon */\n" |
| 1031 |
" size_t endpos; /* Nombre de caractères dans le tampon */\n" |
| 1032 |
" off_t offset; /* Décalage du fichier actuel dans le tampon */\n" |
| 1033 |
"};\n" |
| 1034 |
"\\&\n" |
| 1035 |
"ssize_t\n" |
| 1036 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 1037 |
"{\n" |
| 1038 |
" char *new_buff;\n" |
| 1039 |
" struct memfile_cookie *cookie = c;\n" |
| 1040 |
"\\&\n" |
| 1041 |
" /* Tampon trop petit : doubler sa taille jusqu'à ce\n" |
| 1042 |
" qu'il soit assez grand. */\n" |
| 1043 |
"\\&\n" |
| 1044 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 1045 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 1046 |
" if (new_buff == NULL)\n" |
| 1047 |
" return -1;\n" |
| 1048 |
" cookie-E<gt>allocated *= 2;\n" |
| 1049 |
" cookie-E<gt>buf = new_buff;\n" |
| 1050 |
" }\n" |
| 1051 |
"\\&\n" |
| 1052 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 1053 |
"\\&\n" |
| 1054 |
" cookie-E<gt>offset += size;\n" |
| 1055 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 1056 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 1057 |
"\\&\n" |
| 1058 |
" return size;\n" |
| 1059 |
"}\n" |
| 1060 |
"\\&\n" |
| 1061 |
"ssize_t\n" |
| 1062 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 1063 |
"{\n" |
| 1064 |
" ssize_t xbytes;\n" |
| 1065 |
" struct memfile_cookie *cookie = c;\n" |
| 1066 |
"\\&\n" |
| 1067 |
" /* Obtenir le minimum d'octets requis et d'octets disponibles. */\n" |
| 1068 |
"\\&\n" |
| 1069 |
" xbytes = size;\n" |
| 1070 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 1071 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 1072 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 1073 |
" xbytes = 0;\n" |
| 1074 |
"\\&\n" |
| 1075 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 1076 |
"\\&\n" |
| 1077 |
" cookie-E<gt>offset += xbytes;\n" |
| 1078 |
" return xbytes;\n" |
| 1079 |
"}\n" |
| 1080 |
"\\&\n" |
| 1081 |
"int\n" |
| 1082 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 1083 |
"{\n" |
| 1084 |
" off_t new_offset;\n" |
| 1085 |
" struct memfile_cookie *cookie = c;\n" |
| 1086 |
"\\&\n" |
| 1087 |
" if (whence == SEEK_SET)\n" |
| 1088 |
" new_offset = *offset;\n" |
| 1089 |
" else if (whence == SEEK_END)\n" |
| 1090 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 1091 |
" else if (whence == SEEK_CUR)\n" |
| 1092 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 1093 |
" else\n" |
| 1094 |
" return -1;\n" |
| 1095 |
"\\&\n" |
| 1096 |
" if (new_offset E<lt> 0)\n" |
| 1097 |
" return -1;\n" |
| 1098 |
"\\&\n" |
| 1099 |
" cookie-E<gt>offset = new_offset;\n" |
| 1100 |
" *offset = new_offset;\n" |
| 1101 |
" return 0;\n" |
| 1102 |
"}\n" |
| 1103 |
"\\&\n" |
| 1104 |
"int\n" |
| 1105 |
"memfile_close(void *c)\n" |
| 1106 |
"{\n" |
| 1107 |
" struct memfile_cookie *cookie = c;\n" |
| 1108 |
"\\&\n" |
| 1109 |
" free(cookie-E<gt>buf);\n" |
| 1110 |
" cookie-E<gt>allocated = 0;\n" |
| 1111 |
" cookie-E<gt>buf = NULL;\n" |
| 1112 |
"\\&\n" |
| 1113 |
" return 0;\n" |
| 1114 |
"}\n" |
| 1115 |
"\\&\n" |
| 1116 |
"int\n" |
| 1117 |
"main(int argc, char *argv[])\n" |
| 1118 |
"{\n" |
| 1119 |
" cookie_io_functions_t memfile_func = {\n" |
| 1120 |
" .read = memfile_read,\n" |
| 1121 |
" .write = memfile_write,\n" |
| 1122 |
" .seek = memfile_seek,\n" |
| 1123 |
" .close = memfile_close\n" |
| 1124 |
" };\n" |
| 1125 |
" FILE *stream;\n" |
| 1126 |
" struct memfile_cookie mycookie;\n" |
| 1127 |
" size_t nread;\n" |
| 1128 |
" char buf[1000];\n" |
| 1129 |
"\\&\n" |
| 1130 |
" /* Définir le cookie avant l'appel de fopencookie(). */\n" |
| 1131 |
"\\&\n" |
| 1132 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 1133 |
" if (mycookie.buf == NULL) {\n" |
| 1134 |
" perror(\"malloc\");\n" |
| 1135 |
" exit(EXIT_FAILURE);\n" |
| 1136 |
" }\n" |
| 1137 |
"\\&\n" |
| 1138 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 1139 |
" mycookie.offset = 0;\n" |
| 1140 |
" mycookie.endpos = 0;\n" |
| 1141 |
"\\&\n" |
| 1142 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 1143 |
" if (stream == NULL) {\n" |
| 1144 |
" perror(\"fopencookie\");\n" |
| 1145 |
" exit(EXIT_FAILURE);\n" |
| 1146 |
" }\n" |
| 1147 |
"\\&\n" |
| 1148 |
" /* Écrire les arguments de la ligne de commande sur le fichier. */\n" |
| 1149 |
"\\&\n" |
| 1150 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 1151 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 1152 |
" perror(\"fputs\");\n" |
| 1153 |
" exit(EXIT_FAILURE);\n" |
| 1154 |
" }\n" |
| 1155 |
"\\&\n" |
| 1156 |
" /* Lire deux octets tous les cinq octets jusqu'à EOF. */\n" |
| 1157 |
"\\&\n" |
| 1158 |
" for (long p = 0; ; p += 5) {\n" |
| 1159 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 1160 |
" perror(\"fseek\");\n" |
| 1161 |
" exit(EXIT_FAILURE);\n" |
| 1162 |
" }\n" |
| 1163 |
" nread = fread(buf, 1, 2, stream);\n" |
| 1164 |
" if (nread == 0) {\n" |
| 1165 |
" if (ferror(stream) != 0) {\n" |
| 1166 |
" fprintf(stderr, \"échec fread\\[rs]n\");\n" |
| 1167 |
" exit(EXIT_FAILURE);\n" |
| 1168 |
" }\n" |
| 1169 |
" printf(\"Fin de fichier atteinte\\[rs]n\");\n" |
| 1170 |
" break;\n" |
| 1171 |
" }\n" |
| 1172 |
"\\&\n" |
| 1173 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 1174 |
" }\n" |
| 1175 |
"\\&\n" |
| 1176 |
" free(mycookie.buf);\n" |
| 1177 |
"\\&\n" |
| 1178 |
" exit(EXIT_SUCCESS);\n" |
| 1179 |
"}\n" |
| 1180 |
|
| 1181 |
#. SRC END |
| 1182 |
#. type: SH |
| 1183 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1184 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1185 |
#, no-wrap |
| 1186 |
msgid "NOTES" |
| 1187 |
msgstr "NOTES" |
| 1188 |
|
| 1189 |
#. type: Plain text |
| 1190 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1191 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1192 |
msgid "" |
| 1193 |
"B<_FILE_OFFSET_BITS> should be defined to be 64 in code that uses non-null " |
| 1194 |
"I<seek> or that takes the address of B<fopencookie>, if the code is intended " |
| 1195 |
"to be portable to traditional 32-bit x86 and ARM platforms where B<off_t>'s " |
| 1196 |
"width defaults to 32 bits." |
| 1197 |
msgstr "" |
| 1198 |
"B<_FILE_OFFSET_BITS> devrait être défini à 64 dans du code qui utilise une " |
| 1199 |
"valeur de I<seek> non NULL ou qui prend l'adresse de B<fopencookie>, si le " |
| 1200 |
"code est destiné à être portable pour les plateformes traditionelles x86 et " |
| 1201 |
"ARM 32 bits où la taille par défaut de B<off_t> est 32 bits." |
| 1202 |
|
| 1203 |
#. type: SH |
| 1204 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1205 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1206 |
#, no-wrap |
| 1207 |
msgid "SEE ALSO" |
| 1208 |
msgstr "VOIR AUSSI" |
| 1209 |
|
| 1210 |
#. type: Plain text |
| 1211 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1212 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1213 |
msgid "B<fclose>(3), B<fmemopen>(3), B<fopen>(3), B<fseek>(3)" |
| 1214 |
msgstr "B<fclose>(3), B<fmemopen>(3), B<fopen>(3), B<fseek>(3)" |
| 1215 |
|
| 1216 |
#. type: TH |
| 1217 |
#: debian-trixie |
| 1218 |
#, no-wrap |
| 1219 |
msgid "2024-06-15" |
| 1220 |
msgstr "15 juin 2024" |
| 1221 |
|
| 1222 |
#. type: TH |
| 1223 |
#: debian-trixie |
| 1224 |
#, no-wrap |
| 1225 |
msgid "Linux man-pages 6.9.1" |
| 1226 |
msgstr "Pages du manuel de Linux 6.9.1" |
| 1227 |
|
| 1228 |
#. type: Plain text |
| 1229 |
#: debian-trixie |
| 1230 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 1231 |
msgstr "Bibliothèque C standard (I<libc>, I<-lc>)" |
| 1232 |
|
| 1233 |
#. type: Plain text |
| 1234 |
#: debian-trixie fedora-44 fedora-rawhide |
| 1235 |
#, no-wrap |
| 1236 |
msgid "" |
| 1237 |
"#define _GNU_SOURCE\n" |
| 1238 |
"#include E<lt>stdio.hE<gt>\n" |
| 1239 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1240 |
"#include E<lt>string.hE<gt>\n" |
| 1241 |
"#include E<lt>sys/types.hE<gt>\n" |
| 1242 |
"#include E<lt>unistd.hE<gt>\n" |
| 1243 |
"\\&\n" |
| 1244 |
"#define INIT_BUF_SIZE 4\n" |
| 1245 |
"\\&\n" |
| 1246 |
"struct memfile_cookie {\n" |
| 1247 |
" char *buf; /* Dynamically sized buffer for data */\n" |
| 1248 |
" size_t allocated; /* Size of buf */\n" |
| 1249 |
" size_t endpos; /* Number of characters in buf */\n" |
| 1250 |
" off_t offset; /* Current file offset in buf */\n" |
| 1251 |
"};\n" |
| 1252 |
"\\&\n" |
| 1253 |
"ssize_t\n" |
| 1254 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 1255 |
"{\n" |
| 1256 |
" char *new_buff;\n" |
| 1257 |
" struct memfile_cookie *cookie = c;\n" |
| 1258 |
"\\&\n" |
| 1259 |
" /* Buffer too small? Keep doubling size until big enough. */\n" |
| 1260 |
"\\&\n" |
| 1261 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 1262 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 1263 |
" if (new_buff == NULL)\n" |
| 1264 |
" return -1;\n" |
| 1265 |
" cookie-E<gt>allocated *= 2;\n" |
| 1266 |
" cookie-E<gt>buf = new_buff;\n" |
| 1267 |
" }\n" |
| 1268 |
"\\&\n" |
| 1269 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 1270 |
"\\&\n" |
| 1271 |
" cookie-E<gt>offset += size;\n" |
| 1272 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 1273 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 1274 |
"\\&\n" |
| 1275 |
" return size;\n" |
| 1276 |
"}\n" |
| 1277 |
"\\&\n" |
| 1278 |
"ssize_t\n" |
| 1279 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 1280 |
"{\n" |
| 1281 |
" ssize_t xbytes;\n" |
| 1282 |
" struct memfile_cookie *cookie = c;\n" |
| 1283 |
"\\&\n" |
| 1284 |
" /* Fetch minimum of bytes requested and bytes available. */\n" |
| 1285 |
"\\&\n" |
| 1286 |
" xbytes = size;\n" |
| 1287 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 1288 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 1289 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 1290 |
" xbytes = 0;\n" |
| 1291 |
"\\&\n" |
| 1292 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 1293 |
"\\&\n" |
| 1294 |
" cookie-E<gt>offset += xbytes;\n" |
| 1295 |
" return xbytes;\n" |
| 1296 |
"}\n" |
| 1297 |
"\\&\n" |
| 1298 |
"int\n" |
| 1299 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 1300 |
"{\n" |
| 1301 |
" off_t new_offset;\n" |
| 1302 |
" struct memfile_cookie *cookie = c;\n" |
| 1303 |
"\\&\n" |
| 1304 |
" if (whence == SEEK_SET)\n" |
| 1305 |
" new_offset = *offset;\n" |
| 1306 |
" else if (whence == SEEK_END)\n" |
| 1307 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 1308 |
" else if (whence == SEEK_CUR)\n" |
| 1309 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 1310 |
" else\n" |
| 1311 |
" return -1;\n" |
| 1312 |
"\\&\n" |
| 1313 |
" if (new_offset E<lt> 0)\n" |
| 1314 |
" return -1;\n" |
| 1315 |
"\\&\n" |
| 1316 |
" cookie-E<gt>offset = new_offset;\n" |
| 1317 |
" *offset = new_offset;\n" |
| 1318 |
" return 0;\n" |
| 1319 |
"}\n" |
| 1320 |
"\\&\n" |
| 1321 |
"int\n" |
| 1322 |
"memfile_close(void *c)\n" |
| 1323 |
"{\n" |
| 1324 |
" struct memfile_cookie *cookie = c;\n" |
| 1325 |
"\\&\n" |
| 1326 |
" free(cookie-E<gt>buf);\n" |
| 1327 |
" cookie-E<gt>allocated = 0;\n" |
| 1328 |
" cookie-E<gt>buf = NULL;\n" |
| 1329 |
"\\&\n" |
| 1330 |
" return 0;\n" |
| 1331 |
"}\n" |
| 1332 |
"\\&\n" |
| 1333 |
"int\n" |
| 1334 |
"main(int argc, char *argv[])\n" |
| 1335 |
"{\n" |
| 1336 |
" cookie_io_functions_t memfile_func = {\n" |
| 1337 |
" .read = memfile_read,\n" |
| 1338 |
" .write = memfile_write,\n" |
| 1339 |
" .seek = memfile_seek,\n" |
| 1340 |
" .close = memfile_close\n" |
| 1341 |
" };\n" |
| 1342 |
" FILE *stream;\n" |
| 1343 |
" struct memfile_cookie mycookie;\n" |
| 1344 |
" size_t nread;\n" |
| 1345 |
" char buf[1000];\n" |
| 1346 |
"\\&\n" |
| 1347 |
" /* Set up the cookie before calling fopencookie(). */\n" |
| 1348 |
"\\&\n" |
| 1349 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 1350 |
" if (mycookie.buf == NULL) {\n" |
| 1351 |
" perror(\"malloc\");\n" |
| 1352 |
" exit(EXIT_FAILURE);\n" |
| 1353 |
" }\n" |
| 1354 |
"\\&\n" |
| 1355 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 1356 |
" mycookie.offset = 0;\n" |
| 1357 |
" mycookie.endpos = 0;\n" |
| 1358 |
"\\&\n" |
| 1359 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 1360 |
" if (stream == NULL) {\n" |
| 1361 |
" perror(\"fopencookie\");\n" |
| 1362 |
" exit(EXIT_FAILURE);\n" |
| 1363 |
" }\n" |
| 1364 |
"\\&\n" |
| 1365 |
" /* Write command-line arguments to our file. */\n" |
| 1366 |
"\\&\n" |
| 1367 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 1368 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 1369 |
" perror(\"fputs\");\n" |
| 1370 |
" exit(EXIT_FAILURE);\n" |
| 1371 |
" }\n" |
| 1372 |
"\\&\n" |
| 1373 |
" /* Read two bytes out of every five, until EOF. */\n" |
| 1374 |
"\\&\n" |
| 1375 |
" for (long p = 0; ; p += 5) {\n" |
| 1376 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 1377 |
" perror(\"fseek\");\n" |
| 1378 |
" exit(EXIT_FAILURE);\n" |
| 1379 |
" }\n" |
| 1380 |
" nread = fread(buf, 1, 2, stream);\n" |
| 1381 |
" if (nread == 0) {\n" |
| 1382 |
" if (ferror(stream) != 0) {\n" |
| 1383 |
" fprintf(stderr, \"fread failed\\[rs]n\");\n" |
| 1384 |
" exit(EXIT_FAILURE);\n" |
| 1385 |
" }\n" |
| 1386 |
" printf(\"Reached end of file\\[rs]n\");\n" |
| 1387 |
" break;\n" |
| 1388 |
" }\n" |
| 1389 |
"\\&\n" |
| 1390 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 1391 |
" }\n" |
| 1392 |
"\\&\n" |
| 1393 |
" free(mycookie.buf);\n" |
| 1394 |
"\\&\n" |
| 1395 |
" exit(EXIT_SUCCESS);\n" |
| 1396 |
"}\n" |
| 1397 |
msgstr "" |
| 1398 |
"#define _GNU_SOURCE\n" |
| 1399 |
"#include E<lt>stdio.hE<gt>\n" |
| 1400 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1401 |
"#include E<lt>string.hE<gt>\n" |
| 1402 |
"#include E<lt>sys/types.hE<gt>\n" |
| 1403 |
"#include E<lt>unistd.hE<gt>\n" |
| 1404 |
"\\&\n" |
| 1405 |
"#define INIT_BUF_SIZE 4\n" |
| 1406 |
"\\&\n" |
| 1407 |
"struct memfile_cookie {\n" |
| 1408 |
" char *buf; /* Tampon de taille dynamique pour les données */\n" |
| 1409 |
" size_t allocated; /* Taille du tampon */\n" |
| 1410 |
" size_t endpos; /* Nombre de caractères dans le tampon */\n" |
| 1411 |
" off_t offset; /* Décalage du fichier actuel dans le tampon */\n" |
| 1412 |
"};\n" |
| 1413 |
"\\&\n" |
| 1414 |
"ssize_t\n" |
| 1415 |
"memfile_write(void *c, const char *buf, size_t size)\n" |
| 1416 |
"{\n" |
| 1417 |
" char *new_buff;\n" |
| 1418 |
" struct memfile_cookie *cookie = c;\n" |
| 1419 |
"\\&\n" |
| 1420 |
" /* Tampon trop petit : doubler sa taille jusqu'à ce\n" |
| 1421 |
" qu'il soit assez grand. */\n" |
| 1422 |
"\\&\n" |
| 1423 |
" while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n" |
| 1424 |
" new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n" |
| 1425 |
" if (new_buff == NULL)\n" |
| 1426 |
" return -1;\n" |
| 1427 |
" cookie-E<gt>allocated *= 2;\n" |
| 1428 |
" cookie-E<gt>buf = new_buff;\n" |
| 1429 |
" }\n" |
| 1430 |
"\\&\n" |
| 1431 |
" memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n" |
| 1432 |
"\\&\n" |
| 1433 |
" cookie-E<gt>offset += size;\n" |
| 1434 |
" if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n" |
| 1435 |
" cookie-E<gt>endpos = cookie-E<gt>offset;\n" |
| 1436 |
"\\&\n" |
| 1437 |
" return size;\n" |
| 1438 |
"}\n" |
| 1439 |
"\\&\n" |
| 1440 |
"ssize_t\n" |
| 1441 |
"memfile_read(void *c, char *buf, size_t size)\n" |
| 1442 |
"{\n" |
| 1443 |
" ssize_t xbytes;\n" |
| 1444 |
" struct memfile_cookie *cookie = c;\n" |
| 1445 |
"\\&\n" |
| 1446 |
" /* Obtenir le minimum d'octets requis et d'octets disponibles. */\n" |
| 1447 |
"\\&\n" |
| 1448 |
" xbytes = size;\n" |
| 1449 |
" if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n" |
| 1450 |
" xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n" |
| 1451 |
" if (xbytes E<lt> 0) /* offset may be past endpos */\n" |
| 1452 |
" xbytes = 0;\n" |
| 1453 |
"\\&\n" |
| 1454 |
" memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n" |
| 1455 |
"\\&\n" |
| 1456 |
" cookie-E<gt>offset += xbytes;\n" |
| 1457 |
" return xbytes;\n" |
| 1458 |
"}\n" |
| 1459 |
"\\&\n" |
| 1460 |
"int\n" |
| 1461 |
"memfile_seek(void *c, off_t *offset, int whence)\n" |
| 1462 |
"{\n" |
| 1463 |
" off_t new_offset;\n" |
| 1464 |
" struct memfile_cookie *cookie = c;\n" |
| 1465 |
"\\&\n" |
| 1466 |
" if (whence == SEEK_SET)\n" |
| 1467 |
" new_offset = *offset;\n" |
| 1468 |
" else if (whence == SEEK_END)\n" |
| 1469 |
" new_offset = cookie-E<gt>endpos + *offset;\n" |
| 1470 |
" else if (whence == SEEK_CUR)\n" |
| 1471 |
" new_offset = cookie-E<gt>offset + *offset;\n" |
| 1472 |
" else\n" |
| 1473 |
" return -1;\n" |
| 1474 |
"\\&\n" |
| 1475 |
" if (new_offset E<lt> 0)\n" |
| 1476 |
" return -1;\n" |
| 1477 |
"\\&\n" |
| 1478 |
" cookie-E<gt>offset = new_offset;\n" |
| 1479 |
" *offset = new_offset;\n" |
| 1480 |
" return 0;\n" |
| 1481 |
"}\n" |
| 1482 |
"\\&\n" |
| 1483 |
"int\n" |
| 1484 |
"memfile_close(void *c)\n" |
| 1485 |
"{\n" |
| 1486 |
" struct memfile_cookie *cookie = c;\n" |
| 1487 |
"\\&\n" |
| 1488 |
" free(cookie-E<gt>buf);\n" |
| 1489 |
" cookie-E<gt>allocated = 0;\n" |
| 1490 |
" cookie-E<gt>buf = NULL;\n" |
| 1491 |
"\\&\n" |
| 1492 |
" return 0;\n" |
| 1493 |
"}\n" |
| 1494 |
"\\&\n" |
| 1495 |
"int\n" |
| 1496 |
"main(int argc, char *argv[])\n" |
| 1497 |
"{\n" |
| 1498 |
" cookie_io_functions_t memfile_func = {\n" |
| 1499 |
" .read = memfile_read,\n" |
| 1500 |
" .write = memfile_write,\n" |
| 1501 |
" .seek = memfile_seek,\n" |
| 1502 |
" .close = memfile_close\n" |
| 1503 |
" };\n" |
| 1504 |
" FILE *stream;\n" |
| 1505 |
" struct memfile_cookie mycookie;\n" |
| 1506 |
" size_t nread;\n" |
| 1507 |
" char buf[1000];\n" |
| 1508 |
"\\&\n" |
| 1509 |
" /* Définir le cookie avant l'appel de fopencookie(). */\n" |
| 1510 |
"\\&\n" |
| 1511 |
" mycookie.buf = malloc(INIT_BUF_SIZE);\n" |
| 1512 |
" if (mycookie.buf == NULL) {\n" |
| 1513 |
" perror(\"malloc\");\n" |
| 1514 |
" exit(EXIT_FAILURE);\n" |
| 1515 |
" }\n" |
| 1516 |
"\\&\n" |
| 1517 |
" mycookie.allocated = INIT_BUF_SIZE;\n" |
| 1518 |
" mycookie.offset = 0;\n" |
| 1519 |
" mycookie.endpos = 0;\n" |
| 1520 |
"\\&\n" |
| 1521 |
" stream = fopencookie(&mycookie, \"w+\", memfile_func);\n" |
| 1522 |
" if (stream == NULL) {\n" |
| 1523 |
" perror(\"fopencookie\");\n" |
| 1524 |
" exit(EXIT_FAILURE);\n" |
| 1525 |
" }\n" |
| 1526 |
"\\&\n" |
| 1527 |
" /* Écrire les arguments de la ligne de commande sur le fichier. */\n" |
| 1528 |
"\\&\n" |
| 1529 |
" for (size_t j = 1; j E<lt> argc; j++)\n" |
| 1530 |
" if (fputs(argv[j], stream) == EOF) {\n" |
| 1531 |
" perror(\"fputs\");\n" |
| 1532 |
" exit(EXIT_FAILURE);\n" |
| 1533 |
" }\n" |
| 1534 |
"\\&\n" |
| 1535 |
" /* Lire deux octets tous les cinq octets jusqu'à EOF. */\n" |
| 1536 |
"\\&\n" |
| 1537 |
" for (long p = 0; ; p += 5) {\n" |
| 1538 |
" if (fseek(stream, p, SEEK_SET) == -1) {\n" |
| 1539 |
" perror(\"fseek\");\n" |
| 1540 |
" exit(EXIT_FAILURE);\n" |
| 1541 |
" }\n" |
| 1542 |
" nread = fread(buf, 1, 2, stream);\n" |
| 1543 |
" if (nread == 0) {\n" |
| 1544 |
" if (ferror(stream) != 0) {\n" |
| 1545 |
" fprintf(stderr, \"échec fread\\[rs]n\");\n" |
| 1546 |
" exit(EXIT_FAILURE);\n" |
| 1547 |
" }\n" |
| 1548 |
" printf(\"Fin de fichier atteinte\\[rs]n\");\n" |
| 1549 |
" break;\n" |
| 1550 |
" }\n" |
| 1551 |
"\\&\n" |
| 1552 |
" printf(\"/%.*s/\\[rs]n\", (int) nread, buf);\n" |
| 1553 |
" }\n" |
| 1554 |
"\\&\n" |
| 1555 |
" free(mycookie.buf);\n" |
| 1556 |
"\\&\n" |
| 1557 |
" exit(EXIT_SUCCESS);\n" |
| 1558 |
"}\n" |
| 1559 |
|
| 1560 |
#. type: TH |
| 1561 |
#: fedora-44 fedora-rawhide |
| 1562 |
#, no-wrap |
| 1563 |
msgid "2024-07-23" |
| 1564 |
msgstr "23 juillet 2024" |
| 1565 |
|
| 1566 |
#. type: TH |
| 1567 |
#: fedora-44 fedora-rawhide |
| 1568 |
#, no-wrap |
| 1569 |
msgid "Linux man-pages 6.13" |
| 1570 |
msgstr "Pages du manuel de Linux 6.13" |
| 1571 |
|
| 1572 |
#. type: TH |
| 1573 |
#: mageia-cauldron |
| 1574 |
#, no-wrap |
| 1575 |
msgid "Linux man-pages 6.17" |
| 1576 |
msgstr "Pages du manuel de Linux 6.17" |
| 1577 |
|
| 1578 |
#. type: TH |
| 1579 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 1580 |
#, no-wrap |
| 1581 |
msgid "Linux man-pages (unreleased)" |
| 1582 |
msgstr "Pages du manuel de Linux (non publiées)" |