]> arthur.barton.de Git - netatalk.git/blobdiff - bin/afile/afile.c
Enhanced machine type
[netatalk.git] / bin / afile / afile.c
index 72e5bd07ac464875ee6658c2f9ad56b6b0f6870b..e70c850090675c6013b37ef0c3c8245490ffff35 100644 (file)
@@ -1,4 +1,7 @@
-/*  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.
@@ -31,7 +34,9 @@
     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,
@@ -88,9 +92,9 @@ void help(char *prog)
 }
 
 /* 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
@@ -98,7 +102,7 @@ void version()
  * 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;
 
@@ -145,13 +149,13 @@ int parse_args(int argc, char *argv[])
 /* 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;
@@ -175,7 +179,7 @@ int handle_ad(struct AFile *rfile)
 }
 
 
-int handle_datafile(struct AFile *datafile)
+static int handle_datafile(struct AFile *datafile)
 {
   int ret;
   char *adname;
@@ -214,7 +218,7 @@ int handle_datafile(struct AFile *datafile)
 
 
 /* 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;