-/* afile - determine the MacOS creator/type of files
+/*
+ * $Id: afile.c,v 1.7 2009-10-14 01:38:28 didg Exp $
+ *
+ afile - determine the MacOS creator/type of files
Copyright (C) 2001 Sebastian Rittau.
All rights reserved.
SUCH DAMAGE.
*/
-#include <config.h>
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif /* HAVE_UNISTD_H */
#include <atalk/adouble.h>
#include "common.h"
-/* Please change this whenever you change this file. */
-#define AFILE_VERSION "1.0.0"
-
/* Possible return types. These are taken from the original afile for
* compatibility.
*/
/* Global Variables */
-int showall = 0;
+static int showall = 0;
/* Print usage information. */
-void usage(char *prog)
+static void usage(char *prog)
{
fprintf(stderr, "Usage: %s [-a] FILE ...\n", prog);
}
/* Print extensive help. */
-void help(char *prog)
+static void help(char *prog)
{
usage(prog);
fprintf(stderr,
}
/* Print the version. */
-void version()
+static void version(void)
{
- fprintf(stderr, "afile " AFILE_VERSION " (netatalk " VERSION ")\n");
+ fprintf(stderr, "afile (netatalk " VERSION ")\n");
}
/* Argument Handling
* known long options: --show-all, --help, --version
*/
#define OPTSTRING "ahv-:"
-int parse_args(int argc, char *argv[])
+static int parse_args(int argc, char *argv[])
{
int c;
/* Print the creator/type as taken from the supplied character stream, which
* must be a AppleDouble file header.
*/
-void print_type(const char *filename, const char *creator, const char *type)
+static void print_type(const char *filename, const char *creator, const char *type)
{
printf("%4.4s %4.4s %s\n", creator, type, filename);
}
-int handle_ad(struct AFile *rfile)
+static int handle_ad(struct AFile *rfile)
{
int fd;
char *dataname;
}
-int handle_datafile(struct AFile *datafile)
+static int handle_datafile(struct AFile *datafile)
{
int ret;
char *adname;
/* Parse a file and its resource fork. Output the file's creator/type. */
-int parse_file(char *filename)
+static int parse_file(char *filename)
{
int ret;
struct AFile *afile;