chiark / gitweb /
@@@ much mess, mostly manpages
[mLib] / sys / fwatch.3.in
1 .\" -*-nroff-*-
2 .\"
3 .\" Manual for watching for file changes
4 .\"
5 .\" (c) 2001, 2005, 2009, 2023, 2024 Straylight/Edgeware
6 .\"
7 .
8 .\"----- Licensing notice ---------------------------------------------------
9 .\"
10 .\" This file is part of the mLib utilities library.
11 .\"
12 .\" mLib is free software: you can redistribute it and/or modify it under
13 .\" the terms of the GNU Library General Public License as published by
14 .\" the Free Software Foundation; either version 2 of the License, or (at
15 .\" your option) any later version.
16 .\"
17 .\" mLib is distributed in the hope that it will be useful, but WITHOUT
18 .\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 .\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
20 .\" License for more details.
21 .\"
22 .\" You should have received a copy of the GNU Library General Public
23 .\" License along with mLib.  If not, write to the Free Software
24 .\" Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
25 .\" USA.
26 .
27 .\"--------------------------------------------------------------------------
28 .so ../defs.man \" @@@PRE@@@
29 .
30 .\"--------------------------------------------------------------------------
31 .TH fwatch 3mLib "3 February 2001" "Straylight/Edgeware" "mLib utilities library"
32 .\" @fwatch_init
33 .\" @fwatch_initfd
34 .\" @fwatch_update
35 .\" @fwatch_updatefd
36 .
37 .\"--------------------------------------------------------------------------
38 .SH NAME
39 fwatch \- watch a file for changes
40 .
41 .\"--------------------------------------------------------------------------
42 .SH SYNOPSIS
43 .
44 .nf
45 .B "#include <mLib/fwatch.h>"
46 .PP
47 .B "typedef struct { ...\& } fwatch;"
48 .PP
49 .BI "void fwatch_init(fwatch *" f ", const char *" name );
50 .BI "void fwatch_initfd(fwatch *" f ", int " fd );
51 .BI "int fwatch_update(fwatch *" f ", const char *" name );
52 .BI "int fwatch_updatefd(fwatch *" f ", int " fd );
53 .fi
54 .
55 .\"--------------------------------------------------------------------------
56 .SH DESCRIPTION
57 .
58 These functions watch a file for changes.  Use
59 .B fwatch_init
60 or
61 .B fwatch_initfd
62 to initialize a
63 .B fwatch
64 block with information about a file; then later, the functions
65 .B fwatch_update
66 and
67 .B fwatch_updatefd
68 will update the information in the structure and inform you whether the
69 file changed.
70 .PP
71 The
72 .B fwatch
73 functions can't return errors: they remember errors as part of the file
74 state instead.  The
75 .B update
76 functions return zero if the file has not changed or nonzero if it has.
77 .
78 .\"--------------------------------------------------------------------------
79 .SH SEE ALSO
80 .
81 .BR mLib (3).
82 .
83 .\"--------------------------------------------------------------------------
84 .SH AUTHOR
85 .
86 Mark Wooding, <mdw@distorted.org.uk>
87 .
88 .\"----- That's all, folks --------------------------------------------------