File: older.c

package info (click to toggle)
icmake 6.22-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,148 kB
  • ctags: 1,042
  • sloc: ansic: 9,241; makefile: 1,134; sh: 235; asm: 126
file content (46 lines) | stat: -rw-r--r-- 895 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/*                              O L D E R . C

    % 1 name
\funcref {older}
    % 2 declaration
{int \fname (\params\ )}
    % 3 arguments
{
    {char *}{lval}{name of a file}
    {char *}{rval}{name of a file}
}
    % 4 return value
{
 1: the file \Var{lval} is older than \Var{rval} or \Var{rval} does't exist.
    \Var{lval} exists.
 0: the reversed condition: the file \Var{lval} is younger or as old as
    \Var{rval} (\Var{rval} exists), or \Var{lval} doesn't exist
}
    % 5 functions used
{}
    % 6 see also
{}
    % 7 source file
{older.c}
    % 8 description
{See the return value description}
*/

#include "icrssdef.h"

int older(lval, rval)
    char
        *lval,
        *rval;
{
    struct stat
        lbuf,
        rbuf;

    if (stat(lval, &lbuf))
        lbuf.st_mtime = 0;
    if (stat(rval, &rbuf))
        rbuf.st_mtime = 0;

   return (lbuf.st_mtime < rbuf.st_mtime);
}