GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* Written by David MacKenzie <djm@ai.mit.edu> */
changing the mode of many files, this probably results in a
performance gain. */
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <sys/types.h>
#include <sys/stat.h>
#include "modechange.h"
-#ifdef STDC_HEADERS
-#include <stdlib.h>
+#if STDC_HEADERS
+# include <stdlib.h>
#else
char *malloc ();
#endif
#ifndef NULL
-#define NULL 0
+# define NULL 0
+#endif
+
+#if STAT_MACROS_BROKEN
+# undef S_ISDIR
#endif
-#ifndef S_ISDIR
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
+#if !defined(S_ISDIR) && defined(S_IFDIR)
+# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
/* Return newly allocated memory to hold one element of type TYPE. */
struct mode_change *
mode_compile (mode_string, masked_ops)
- register char *mode_string;
+ const char *mode_string;
unsigned masked_ops;
{
struct mode_change *head; /* First element of the linked list. */
umask (umask_value); /* Restore the old value. */
head = NULL;
+#ifdef lint
+ change = NULL;
+#endif
--mode_string;
/* One loop iteration for each "ugoa...=+-rwxXstugo...[=+-rwxXstugo...]". */
unsigned short
mode_adjust (oldmode, changes)
unsigned oldmode;
- register struct mode_change *changes;
+ const struct mode_change *changes;
{
unsigned short newmode; /* The adjusted mode and one operand. */
unsigned short value; /* The other operand. */