/*
- * $Id: achfile.c,v 1.4 2001-09-05 18:38:23 srittau Exp $
+ * $Id: achfile.c,v 1.7 2009-10-14 01:38:28 didg Exp $
*
afile - determine the MacOS creator/type of files
#include "common.h"
/* Global Variables */
-const char *type = NULL;
-const char *creator = NULL;
+static const char *type = NULL;
+static const char *creator = NULL;
/* Print usage information. */
-void usage(char *prog)
+static void usage(char *prog)
{
fprintf(stderr, "Usage: %s [-t TYPE] [-c CREATOR] 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, "achfile (netatalk " VERSION ")\n");
}
* known long options: --help, --version
*/
#define OPTSTRING "t:c:hv-:"
-const char *get_long_arg(int argc, char *argv[], const char *arg, const char *oa) {
+static const char *get_long_arg(int argc, char *argv[], const char *arg, const char *oa) {
switch (*oa) {
case '=':
return &oa[1];
}
}
-int parse_args(int argc, char *argv[])
+static int parse_args(int argc, char *argv[])
{
int c;
const char *longarg;
/* Change the owner/creator of each file specified on the command line. */
-int handle_file(const char *filename)
+static int handle_file(const char *filename)
{
int fd;
struct stat statbuf;
close(fd);
return -1;
}
- if (ad->ad_magic != AD_MAGIC) {
+ if ( ntohl(ad->ad_magic) != AD_MAGIC) {
fprintf(stderr, "achfile:%s: corrupt resource fork\n", filename);
free(adname);
close(fd);