1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
3 <!-- SECTION: Programming -->
5 <title>File and Directory APIs
</title>
6 <meta name=
"keywords" content=
"Programming">
7 <meta name=
"creator" content=
"Mini-XML v2.6">
8 <style type=
"text/css"><!--
10 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
13 H1, H2, H3, H4, H5, H6, P, TD, TH {
14 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
18 font-family: monaco, courier, monospace;
23 font-family: monaco, courier, monospace;
37 border: dotted thin #999999;
42 PRE.command EM, PRE.example EM {
43 font-family: lucida grande, geneva, helvetica, arial, sans-serif;
47 font-family: monaco, courier, monospace;
58 border: solid thin #999999;
69 -moz-border-radius: 10px;
74 text-decoration: none;
77 A:link:hover, A:visited:hover, A:active {
78 text-decoration: underline;
85 TR.data, TD.data, TR.data TD {
88 border-bottom: solid 1pt #999999;
92 border-bottom: solid 1pt #999999;
99 border: solid thin #999999;
100 border-collapse: collapse;
116 border: solid thin #cccccc;
123 border-bottom: solid thin #999999;
132 caption-side: bottom;
156 border: thin solid black;
164 H2 SPAN.info, H3 SPAN.info, H4 SPAN.info {
170 border-bottom: solid 2pt #000000;
173 DIV.indent, TABLE.indent {
181 border-collapse: collapse;
184 TABLE.indent TD, TABLE.indent TH {
189 border-collapse: collapse;
197 border-bottom: solid thin #cccccc;
202 vertical-align: bottom;
211 border-bottom: solid thin #eeeeee;
216 TABLE.list TR:nth-child(even) {
220 TABLE.list TR:nth-child(odd) {
239 font-family: monaco, courier, monospace;
243 border: solid thin #999999;
244 border-collapse: collapse;
249 DIV.summary TABLE TD, DIV.summary TABLE TH {
250 border: solid thin #999999;
256 DIV.summary TABLE THEAD TH {
260 /* API documentation styles... */
267 div.body h3, div.body h4, div.body h5 {
268 margin-bottom: 0.5em;
271 .class, .enumeration, .function, .struct, .typedef, .union {
272 border-bottom: solid thin #999999;
279 code, p.code, pre, ul.code li {
280 font-family: monaco, courier, monospace;
283 ul.code, ul.contents, ul.subcontents {
284 list-style-type: none;
294 ul.contents li ul.code, ul.contents li ul.subcontents {
307 margin-bottom: 0.5em;
310 /* This is just for the HTML files generated with the framedhelp target */
313 border: solid thin black;
322 div.contents ul.contents {
325 div.contents ul.subcontents li {
334 "$Id: api-filedir.header 8087 2008-10-27 21:37:05Z mike $"
336 File and Directory API header for the Common UNIX Printing System (CUPS).
338 Copyright 2008 by Apple Inc.
340 These coded instructions, statements, and computer programs are the
341 property of Apple Inc. and are protected by Federal copyright
342 law. Distribution and use rights are outlined in the file "LICENSE.txt"
343 which should have been included with this file. If this file is
344 file is missing or damaged, see the license at "http://www.cups.org/".
347 <div class='summary'
><table summary='General Information'
>
362 <td>Programming:
<a href='api-overview.html' target='_top'
>Introduction to CUPS Programming
</a><br>
363 Programming:
<a href='api-cups.html' target='_top'
>CUPS API
</a></td>
367 <h2 class=
"title">Contents
</h2>
368 <ul class=
"contents">
369 <li><a href=
"#OVERVIEW">Overview
</a></li>
370 <li><a href=
"#FUNCTIONS">Functions
</a><ul class=
"code">
371 <li><a href=
"#cupsDirClose" title=
"Close a directory.">cupsDirClose
</a></li>
372 <li><a href=
"#cupsDirOpen" title=
"Open a directory.">cupsDirOpen
</a></li>
373 <li><a href=
"#cupsDirRead" title=
"Read the next directory entry.">cupsDirRead
</a></li>
374 <li><a href=
"#cupsDirRewind" title=
"Rewind to the start of the directory.">cupsDirRewind
</a></li>
375 <li><a href=
"#cupsFileClose" title=
"Close a CUPS file.">cupsFileClose
</a></li>
376 <li><a href=
"#cupsFileCompression" title=
"Return whether a file is compressed.">cupsFileCompression
</a></li>
377 <li><a href=
"#cupsFileEOF" title=
"Return the end-of-file status.">cupsFileEOF
</a></li>
378 <li><a href=
"#cupsFileFind" title=
"Find a file using the specified path.">cupsFileFind
</a></li>
379 <li><a href=
"#cupsFileFlush" title=
"Flush pending output.">cupsFileFlush
</a></li>
380 <li><a href=
"#cupsFileGetChar" title=
"Get a single character from a file.">cupsFileGetChar
</a></li>
381 <li><a href=
"#cupsFileGetConf" title=
"Get a line from a configuration file...">cupsFileGetConf
</a></li>
382 <li><a href=
"#cupsFileGetLine" title=
"Get a CR and/or LF-terminated line that may
383 contain binary data.">cupsFileGetLine
</a></li>
384 <li><a href=
"#cupsFileGets" title=
"Get a CR and/or LF-terminated line.">cupsFileGets
</a></li>
385 <li><a href=
"#cupsFileLock" title=
"Temporarily lock access to a file.">cupsFileLock
</a></li>
386 <li><a href=
"#cupsFileNumber" title=
"Return the file descriptor associated with a CUPS file.">cupsFileNumber
</a></li>
387 <li><a href=
"#cupsFileOpen" title=
"Open a CUPS file.">cupsFileOpen
</a></li>
388 <li><a href=
"#cupsFileOpenFd" title=
"Open a CUPS file using a file descriptor.">cupsFileOpenFd
</a></li>
389 <li><a href=
"#cupsFilePeekChar" title=
"Peek at the next character from a file.">cupsFilePeekChar
</a></li>
390 <li><a href=
"#cupsFilePrintf" title=
"Write a formatted string.">cupsFilePrintf
</a></li>
391 <li><a href=
"#cupsFilePutChar" title=
"Write a character.">cupsFilePutChar
</a></li>
392 <li><a href=
"#cupsFilePutConf" title=
"Write a configuration line.">cupsFilePutConf
</a></li>
393 <li><a href=
"#cupsFilePuts" title=
"Write a string.">cupsFilePuts
</a></li>
394 <li><a href=
"#cupsFileRead" title=
"Read from a file.">cupsFileRead
</a></li>
395 <li><a href=
"#cupsFileRewind" title=
"Set the current file position to the beginning of the
396 file.">cupsFileRewind
</a></li>
397 <li><a href=
"#cupsFileSeek" title=
"Seek in a file.">cupsFileSeek
</a></li>
398 <li><a href=
"#cupsFileStderr" title=
"Return a CUPS file associated with stderr.">cupsFileStderr
</a></li>
399 <li><a href=
"#cupsFileStdin" title=
"Return a CUPS file associated with stdin.">cupsFileStdin
</a></li>
400 <li><a href=
"#cupsFileStdout" title=
"Return a CUPS file associated with stdout.">cupsFileStdout
</a></li>
401 <li><a href=
"#cupsFileTell" title=
"Return the current file position.">cupsFileTell
</a></li>
402 <li><a href=
"#cupsFileUnlock" title=
"Unlock access to a file.">cupsFileUnlock
</a></li>
403 <li><a href=
"#cupsFileWrite" title=
"Write to a file.">cupsFileWrite
</a></li>
405 <li><a href=
"#TYPES">Data Types
</a><ul class=
"code">
406 <li><a href=
"#cups_dentry_t" title=
"Directory entry type">cups_dentry_t
</a></li>
407 <li><a href=
"#cups_dir_t" title=
"Directory type">cups_dir_t
</a></li>
408 <li><a href=
"#cups_file_t" title=
"CUPS file type">cups_file_t
</a></li>
410 <li><a href=
"#STRUCTURES">Structures
</a><ul class=
"code">
411 <li><a href=
"#cups_dentry_s" title=
"Directory entry type">cups_dentry_s
</a></li>
415 "$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
417 File and directory API introduction for the Common UNIX Printing System (CUPS).
419 Copyright 2007-2008 by Apple Inc.
420 Copyright 1997-2005 by Easy Software Products, all rights reserved.
422 These coded instructions, statements, and computer programs are the
423 property of Apple Inc. and are protected by Federal copyright
424 law. Distribution and use rights are outlined in the file "LICENSE.txt"
425 which should have been included with this file. If this file is
426 file is missing or damaged, see the license at "http://www.cups.org/".
429 <h2 class='title'
><a name=
"OVERVIEW">Overview
</a></h2>
431 <p>The CUPS file and directory APIs provide portable interfaces
432 for manipulating files and listing files and directories. Unlike
433 stdio
<code>FILE
</code> streams, the
<code>cupsFile
</code> functions
434 allow you to open more than
256 files at any given time. They
435 also manage the platform-specific details of locking, large file
436 support, line endings (CR, LF, or CR LF), and reading and writing
437 files using Flate (
"gzip") compression. Finally, you can also
438 connect, read from, and write to network connections using the
439 <code>cupsFile
</code> functions.
</p>
441 <p>The
<code>cupsDir
</code> functions manage the platform-specific
442 details of directory access/listing and provide a convenient way
443 to get both a list of files and the information (permissions,
444 size, timestamp, etc.) for each of those files.
</p>
445 <h2 class=
"title"><a name=
"FUNCTIONS">Functions
</a></h2>
446 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsDirClose">cupsDirClose
</a></h3>
447 <p class=
"description">Close a directory.
</p>
449 void cupsDirClose (
<br>
450 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
452 <h4 class=
"parameters">Parameters
</h4>
455 <dd class=
"description">Directory pointer
</dd>
457 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsDirOpen">cupsDirOpen
</a></h3>
458 <p class=
"description">Open a directory.
</p>
460 <a href=
"#cups_dir_t">cups_dir_t
</a> *cupsDirOpen (
<br>
461 const char *directory
<br>
463 <h4 class=
"parameters">Parameters
</h4>
466 <dd class=
"description">Directory name
</dd>
468 <h4 class=
"returnvalue">Return Value
</h4>
469 <p class=
"description">Directory pointer or
<code>NULL
</code> if the directory could not be opened.
</p>
470 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsDirRead">cupsDirRead
</a></h3>
471 <p class=
"description">Read the next directory entry.
</p>
473 <a href=
"#cups_dentry_t">cups_dentry_t
</a> *cupsDirRead (
<br>
474 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
476 <h4 class=
"parameters">Parameters
</h4>
479 <dd class=
"description">Directory pointer
</dd>
481 <h4 class=
"returnvalue">Return Value
</h4>
482 <p class=
"description">Directory entry or
<code>NULL
</code> when there are no more
</p>
483 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsDirRewind">cupsDirRewind
</a></h3>
484 <p class=
"description">Rewind to the start of the directory.
</p>
486 void cupsDirRewind (
<br>
487 <a href=
"#cups_dir_t">cups_dir_t
</a> *dp
<br>
489 <h4 class=
"parameters">Parameters
</h4>
492 <dd class=
"description">Directory pointer
</dd>
494 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileClose">cupsFileClose
</a></h3>
495 <p class=
"description">Close a CUPS file.
</p>
497 int cupsFileClose (
<br>
498 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
500 <h4 class=
"parameters">Parameters
</h4>
503 <dd class=
"description">CUPS file
</dd>
505 <h4 class=
"returnvalue">Return Value
</h4>
506 <p class=
"description">0 on success, -
1 on error
</p>
507 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileCompression">cupsFileCompression
</a></h3>
508 <p class=
"description">Return whether a file is compressed.
</p>
510 int cupsFileCompression (
<br>
511 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
513 <h4 class=
"parameters">Parameters
</h4>
516 <dd class=
"description">CUPS file
</dd>
518 <h4 class=
"returnvalue">Return Value
</h4>
519 <p class=
"description"><code>CUPS_FILE_NONE
</code> or
<code>CUPS_FILE_GZIP
</code></p>
520 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileEOF">cupsFileEOF
</a></h3>
521 <p class=
"description">Return the end-of-file status.
</p>
523 int cupsFileEOF (
<br>
524 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
526 <h4 class=
"parameters">Parameters
</h4>
529 <dd class=
"description">CUPS file
</dd>
531 <h4 class=
"returnvalue">Return Value
</h4>
532 <p class=
"description">1 on end of file,
0 otherwise
</p>
533 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileFind">cupsFileFind
</a></h3>
534 <p class=
"description">Find a file using the specified path.
</p>
536 const char *cupsFileFind (
<br>
537 const char *filename,
<br>
538 const char *path,
<br>
539 int executable,
<br>
540 char *buffer,
<br>
541 int bufsize
<br>
543 <h4 class=
"parameters">Parameters
</h4>
546 <dd class=
"description">File to find
</dd>
548 <dd class=
"description">Colon/semicolon-separated path
</dd>
550 <dd class=
"description">1 = executable files,
0 = any file/dir
</dd>
552 <dd class=
"description">Filename buffer
</dd>
554 <dd class=
"description">Size of filename buffer
</dd>
556 <h4 class=
"returnvalue">Return Value
</h4>
557 <p class=
"description">Full path to file or
<code>NULL
</code> if not found
</p>
558 <h4 class=
"discussion">Discussion
</h4>
559 <p class=
"discussion">This function allows the paths in the path string to be separated by
560 colons (UNIX standard) or semicolons (Windows standard) and stores the
561 result in the buffer supplied. If the file cannot be found in any of
562 the supplied paths,
<code>NULL
</code> is returned. A
<code>NULL
</code> path only
563 matches the current directory.
566 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileFlush">cupsFileFlush
</a></h3>
567 <p class=
"description">Flush pending output.
</p>
569 int cupsFileFlush (
<br>
570 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
572 <h4 class=
"parameters">Parameters
</h4>
575 <dd class=
"description">CUPS file
</dd>
577 <h4 class=
"returnvalue">Return Value
</h4>
578 <p class=
"description">0 on success, -
1 on error
</p>
579 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileGetChar">cupsFileGetChar
</a></h3>
580 <p class=
"description">Get a single character from a file.
</p>
582 int cupsFileGetChar (
<br>
583 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
585 <h4 class=
"parameters">Parameters
</h4>
588 <dd class=
"description">CUPS file
</dd>
590 <h4 class=
"returnvalue">Return Value
</h4>
591 <p class=
"description">Character or -
1 on end of file
</p>
592 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileGetConf">cupsFileGetConf
</a></h3>
593 <p class=
"description">Get a line from a configuration file...
</p>
595 char *cupsFileGetConf (
<br>
596 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
597 char *buf,
<br>
598 size_t buflen,
<br>
599 char **value,
<br>
600 int *linenum
<br>
602 <h4 class=
"parameters">Parameters
</h4>
605 <dd class=
"description">CUPS file
</dd>
607 <dd class=
"description">String buffer
</dd>
609 <dd class=
"description">Size of string buffer
</dd>
611 <dd class=
"description">Pointer to value
</dd>
613 <dd class=
"description">Current line number
</dd>
615 <h4 class=
"returnvalue">Return Value
</h4>
616 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
617 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileGetLine">cupsFileGetLine
</a></h3>
618 <p class=
"description">Get a CR and/or LF-terminated line that may
619 contain binary data.
</p>
621 size_t cupsFileGetLine (
<br>
622 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
623 char *buf,
<br>
624 size_t buflen
<br>
626 <h4 class=
"parameters">Parameters
</h4>
629 <dd class=
"description">File to read from
</dd>
631 <dd class=
"description">Buffer
</dd>
633 <dd class=
"description">Size of buffer
</dd>
635 <h4 class=
"returnvalue">Return Value
</h4>
636 <p class=
"description">Number of bytes on line or
0 on end of file
</p>
637 <h4 class=
"discussion">Discussion
</h4>
638 <p class=
"discussion">This function differs from
<a href=
"#cupsFileGets"><code>cupsFileGets
</code></a> in that the trailing CR
639 and LF are preserved, as is any binary data on the line. The buffer is
640 nul-terminated, however you should use the returned length to determine
641 the number of bytes on the line.
644 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileGets">cupsFileGets
</a></h3>
645 <p class=
"description">Get a CR and/or LF-terminated line.
</p>
647 char *cupsFileGets (
<br>
648 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
649 char *buf,
<br>
650 size_t buflen
<br>
652 <h4 class=
"parameters">Parameters
</h4>
655 <dd class=
"description">CUPS file
</dd>
657 <dd class=
"description">String buffer
</dd>
659 <dd class=
"description">Size of string buffer
</dd>
661 <h4 class=
"returnvalue">Return Value
</h4>
662 <p class=
"description">Line read or
<code>NULL
</code> on end of file or error
</p>
663 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileLock">cupsFileLock
</a></h3>
664 <p class=
"description">Temporarily lock access to a file.
</p>
666 int cupsFileLock (
<br>
667 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
668 int block
<br>
670 <h4 class=
"parameters">Parameters
</h4>
673 <dd class=
"description">CUPS file
</dd>
675 <dd class=
"description">1 to wait for the lock,
0 to fail right away
</dd>
677 <h4 class=
"returnvalue">Return Value
</h4>
678 <p class=
"description">0 on success, -
1 on error
</p>
679 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileNumber">cupsFileNumber
</a></h3>
680 <p class=
"description">Return the file descriptor associated with a CUPS file.
</p>
682 int cupsFileNumber (
<br>
683 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
685 <h4 class=
"parameters">Parameters
</h4>
688 <dd class=
"description">CUPS file
</dd>
690 <h4 class=
"returnvalue">Return Value
</h4>
691 <p class=
"description">File descriptor
</p>
692 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileOpen">cupsFileOpen
</a></h3>
693 <p class=
"description">Open a CUPS file.
</p>
695 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpen (
<br>
696 const char *filename,
<br>
697 const char *mode
<br>
699 <h4 class=
"parameters">Parameters
</h4>
702 <dd class=
"description">Name of file
</dd>
704 <dd class=
"description">Open mode
</dd>
706 <h4 class=
"returnvalue">Return Value
</h4>
707 <p class=
"description">CUPS file or
<code>NULL
</code> if the file or socket cannot be opened
</p>
708 <h4 class=
"discussion">Discussion
</h4>
709 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write, overwriting any
710 existing file,
"a
" to append to an existing file or create a new file,
711 or
"s
" to open a socket connection.
<br>
713 When opening for writing (
"w
"), an optional number from
1 to
9 can be
714 supplied which enables Flate compression of the file. Compression is
715 not supported for the
"a
" (append) mode.
<br>
717 When opening a socket connection, the filename is a string of the form
718 "address:port
" or
"hostname:port
". The socket will make an IPv4 or IPv6
719 connection as needed, generally preferring IPv6 connections when there is
723 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileOpenFd">cupsFileOpenFd
</a></h3>
724 <p class=
"description">Open a CUPS file using a file descriptor.
</p>
726 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileOpenFd (
<br>
727 int fd,
<br>
728 const char *mode
<br>
730 <h4 class=
"parameters">Parameters
</h4>
733 <dd class=
"description">File descriptor
</dd>
735 <dd class=
"description">Open mode
</dd>
737 <h4 class=
"returnvalue">Return Value
</h4>
738 <p class=
"description">CUPS file or
<code>NULL
</code> if the file could not be opened
</p>
739 <h4 class=
"discussion">Discussion
</h4>
740 <p class=
"discussion">The
"mode
" parameter can be
"r
" to read,
"w
" to write,
"a
" to append,
741 or
"s
" to treat the file descriptor as a bidirectional socket connection.
<br>
743 When opening for writing (
"w
"), an optional number from
1 to
9 can be
744 supplied which enables Flate compression of the file. Compression is
745 not supported for the
"a
" (append) mode.
748 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFilePeekChar">cupsFilePeekChar
</a></h3>
749 <p class=
"description">Peek at the next character from a file.
</p>
751 int cupsFilePeekChar (
<br>
752 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
754 <h4 class=
"parameters">Parameters
</h4>
757 <dd class=
"description">CUPS file
</dd>
759 <h4 class=
"returnvalue">Return Value
</h4>
760 <p class=
"description">Character or -
1 on end of file
</p>
761 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFilePrintf">cupsFilePrintf
</a></h3>
762 <p class=
"description">Write a formatted string.
</p>
764 int cupsFilePrintf (
<br>
765 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
766 const char *format,
<br>
767 ...
<br>
769 <h4 class=
"parameters">Parameters
</h4>
772 <dd class=
"description">CUPS file
</dd>
774 <dd class=
"description">Printf-style format string
</dd>
776 <dd class=
"description">Additional args as necessary
</dd>
778 <h4 class=
"returnvalue">Return Value
</h4>
779 <p class=
"description">Number of bytes written or -
1 on error
</p>
780 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFilePutChar">cupsFilePutChar
</a></h3>
781 <p class=
"description">Write a character.
</p>
783 int cupsFilePutChar (
<br>
784 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
785 int c
<br>
787 <h4 class=
"parameters">Parameters
</h4>
790 <dd class=
"description">CUPS file
</dd>
792 <dd class=
"description">Character to write
</dd>
794 <h4 class=
"returnvalue">Return Value
</h4>
795 <p class=
"description">0 on success, -
1 on error
</p>
796 <h3 class=
"function"><span class=
"info"> CUPS
1.4 </span><a name=
"cupsFilePutConf">cupsFilePutConf
</a></h3>
797 <p class=
"description">Write a configuration line.
</p>
799 ssize_t cupsFilePutConf (
<br>
800 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
801 const char *directive,
<br>
802 const char *value
<br>
804 <h4 class=
"parameters">Parameters
</h4>
807 <dd class=
"description">CUPS file
</dd>
809 <dd class=
"description">Directive
</dd>
811 <dd class=
"description">Value
</dd>
813 <h4 class=
"returnvalue">Return Value
</h4>
814 <p class=
"description">Number of bytes written or -
1 on error
</p>
815 <h4 class=
"discussion">Discussion
</h4>
816 <p class=
"discussion">This function handles any comment escaping of the value.
819 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFilePuts">cupsFilePuts
</a></h3>
820 <p class=
"description">Write a string.
</p>
822 int cupsFilePuts (
<br>
823 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
824 const char *s
<br>
826 <h4 class=
"parameters">Parameters
</h4>
829 <dd class=
"description">CUPS file
</dd>
831 <dd class=
"description">String to write
</dd>
833 <h4 class=
"returnvalue">Return Value
</h4>
834 <p class=
"description">Number of bytes written or -
1 on error
</p>
835 <h4 class=
"discussion">Discussion
</h4>
836 <p class=
"discussion">Like the
<code>fputs
</code> function, no newline is appended to the string.
839 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileRead">cupsFileRead
</a></h3>
840 <p class=
"description">Read from a file.
</p>
842 ssize_t cupsFileRead (
<br>
843 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
844 char *buf,
<br>
845 size_t bytes
<br>
847 <h4 class=
"parameters">Parameters
</h4>
850 <dd class=
"description">CUPS file
</dd>
852 <dd class=
"description">Buffer
</dd>
854 <dd class=
"description">Number of bytes to read
</dd>
856 <h4 class=
"returnvalue">Return Value
</h4>
857 <p class=
"description">Number of bytes read or -
1 on error
</p>
858 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileRewind">cupsFileRewind
</a></h3>
859 <p class=
"description">Set the current file position to the beginning of the
862 off_t cupsFileRewind (
<br>
863 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
865 <h4 class=
"parameters">Parameters
</h4>
868 <dd class=
"description">CUPS file
</dd>
870 <h4 class=
"returnvalue">Return Value
</h4>
871 <p class=
"description">New file position or -
1 on error
</p>
872 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileSeek">cupsFileSeek
</a></h3>
873 <p class=
"description">Seek in a file.
</p>
875 off_t cupsFileSeek (
<br>
876 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
877 off_t pos
<br>
879 <h4 class=
"parameters">Parameters
</h4>
882 <dd class=
"description">CUPS file
</dd>
884 <dd class=
"description">Position in file
</dd>
886 <h4 class=
"returnvalue">Return Value
</h4>
887 <p class=
"description">New file position or -
1 on error
</p>
888 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileStderr">cupsFileStderr
</a></h3>
889 <p class=
"description">Return a CUPS file associated with stderr.
</p>
891 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStderr (void);
</p>
892 <h4 class=
"returnvalue">Return Value
</h4>
893 <p class=
"description">CUPS file
</p>
894 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileStdin">cupsFileStdin
</a></h3>
895 <p class=
"description">Return a CUPS file associated with stdin.
</p>
897 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdin (void);
</p>
898 <h4 class=
"returnvalue">Return Value
</h4>
899 <p class=
"description">CUPS file
</p>
900 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileStdout">cupsFileStdout
</a></h3>
901 <p class=
"description">Return a CUPS file associated with stdout.
</p>
903 <a href=
"#cups_file_t">cups_file_t
</a> *cupsFileStdout (void);
</p>
904 <h4 class=
"returnvalue">Return Value
</h4>
905 <p class=
"description">CUPS file
</p>
906 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileTell">cupsFileTell
</a></h3>
907 <p class=
"description">Return the current file position.
</p>
909 off_t cupsFileTell (
<br>
910 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
912 <h4 class=
"parameters">Parameters
</h4>
915 <dd class=
"description">CUPS file
</dd>
917 <h4 class=
"returnvalue">Return Value
</h4>
918 <p class=
"description">File position
</p>
919 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileUnlock">cupsFileUnlock
</a></h3>
920 <p class=
"description">Unlock access to a file.
</p>
922 int cupsFileUnlock (
<br>
923 <a href=
"#cups_file_t">cups_file_t
</a> *fp
<br>
925 <h4 class=
"parameters">Parameters
</h4>
928 <dd class=
"description">CUPS file
</dd>
930 <h4 class=
"returnvalue">Return Value
</h4>
931 <p class=
"description">0 on success, -
1 on error
</p>
932 <h3 class=
"function"><span class=
"info"> CUPS
1.2 </span><a name=
"cupsFileWrite">cupsFileWrite
</a></h3>
933 <p class=
"description">Write to a file.
</p>
935 ssize_t cupsFileWrite (
<br>
936 <a href=
"#cups_file_t">cups_file_t
</a> *fp,
<br>
937 const char *buf,
<br>
938 size_t bytes
<br>
940 <h4 class=
"parameters">Parameters
</h4>
943 <dd class=
"description">CUPS file
</dd>
945 <dd class=
"description">Buffer
</dd>
947 <dd class=
"description">Number of bytes to write
</dd>
949 <h4 class=
"returnvalue">Return Value
</h4>
950 <p class=
"description">Number of bytes written or -
1 on error
</p>
951 <h2 class=
"title"><a name=
"TYPES">Data Types
</a></h2>
952 <h3 class=
"typedef"><a name=
"cups_dentry_t">cups_dentry_t
</a></h3>
953 <p class=
"description">Directory entry type
</p>
955 typedef struct
<a href=
"#cups_dentry_s">cups_dentry_s
</a> cups_dentry_t;
957 <h3 class=
"typedef"><a name=
"cups_dir_t">cups_dir_t
</a></h3>
958 <p class=
"description">Directory type
</p>
960 typedef struct _cups_dir_s cups_dir_t;
962 <h3 class=
"typedef"><a name=
"cups_file_t">cups_file_t
</a></h3>
963 <p class=
"description">CUPS file type
</p>
965 typedef struct _cups_file_s cups_file_t;
967 <h2 class=
"title"><a name=
"STRUCTURES">Structures
</a></h2>
968 <h3 class=
"struct"><a name=
"cups_dentry_s">cups_dentry_s
</a></h3>
969 <p class=
"description">Directory entry type
</p>
970 <p class=
"code">struct cups_dentry_s {
<br>
971 struct stat fileinfo;
<br>
972 char filename[
260];
<br>
974 <h4 class=
"members">Members
</h4>
977 <dd class=
"description">File information
</dd>
978 <dt>filename[
260]
</dt>
979 <dd class=
"description">File name
</dd>