File: statf.c

package info (click to toggle)
sn 0.3.8-9.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 916 kB
  • ctags: 852
  • sloc: ansic: 9,260; sh: 466; makefile: 208
file content (33 lines) | stat: -rw-r--r-- 685 bytes parent folder | download | duplicates (6)
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
/*
 * This file is part of the sn package.
 * Distribution of sn is covered by the GNU GPL. See file COPYING.
 * Copyright  1998-2000 Harold Tay.
 * Copyright  2000- Patrik Rdman.
 */

#include <sys/param.h>
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include "format.h"

static const char ver_ctrl_id[] = "$Id: statf.c 29 2004-04-24 23:02:38Z patrik $";

static char buf[MAXPATHLEN + 1];

int statf (struct stat *stp, char *fmt, ...)
{
   int len;
   va_list ap;

   va_start(ap, fmt);
   len = formatv(buf, sizeof (buf) - 1, fmt, ap);
   va_end(ap);

   if (len >= sizeof (buf))
   {
      errno = ENAMETOOLONG;
      return -1;
   }
   return stat(buf, stp);
}