djm@mordor.eng.umd.edu (David J. MacKenzie) (10/17/89)
Three recent changes to mv caused problems when I tried to compile it: 1. It erroneously called 'getopt' instead of 'getopt_long', so the long option names weren't recognized. 2. Initialization of automatic structures is not supported by many C compilers. 3. EACCESS is called EACCES on at least some System V-derived systems. Below are fixes for these problems. Also, perhaps the usage message should mention the long option names. *** mv-old.c Mon Oct 16 15:31:29 1989 --- mv.c Tue Oct 17 00:36:54 1989 *************** *** 47,52 **** --- 47,55 ---- #include <stdio.h> #include <errno.h> + #ifdef EACCES + #define EACCESS EACCES + #endif #include <sys/types.h> #include "system.h" *************** *** 96,102 **** { int c; extern int optind; ! struct option long_options[] = {{"interactive", 0, &interactive, 1}, {"force", 0, &force, 1}}; --- 99,105 ---- { int c; extern int optind; ! static struct option long_options[] = {{"interactive", 0, &interactive, 1}, {"force", 0, &force, 1}}; *************** *** 105,111 **** pgm = av[0]; ! while ((c = getopt (ac, av, "if", long_options, &ind)) != EOF) switch (c) { case 0 : --- 108,114 ---- pgm = av[0]; ! while ((c = getopt_long (ac, av, "if", long_options, &ind)) != EOF) switch (c) { case 0 : -- David J. MacKenzie <djm@wam.umd.edu>