Deleted Added
full compact
setmode.c (8870) setmode.c (11659)
1/*
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Dave Borman at Cray Research, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 53 unchanged lines hidden (view full) ---

62
63#define CMD2_CLR 0x01
64#define CMD2_SET 0x02
65#define CMD2_GBITS 0x04
66#define CMD2_OBITS 0x08
67#define CMD2_UBITS 0x10
68
69static BITCMD *addcmd __P((BITCMD *, int, int, int, u_int));
1/*
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Dave Borman at Cray Research, Inc.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 53 unchanged lines hidden (view full) ---

62
63#define CMD2_CLR 0x01
64#define CMD2_SET 0x02
65#define CMD2_GBITS 0x04
66#define CMD2_OBITS 0x08
67#define CMD2_UBITS 0x10
68
69static BITCMD *addcmd __P((BITCMD *, int, int, int, u_int));
70static int compress_mode __P((BITCMD *));
70static void compress_mode __P((BITCMD *));
71#ifdef SETMODE_DEBUG
72static void dumpmode __P((BITCMD *));
73#endif
74
75/*
76 * Given the old mode and an array of bitcmd structures, apply the operations
77 * described in the bitcmd structures to the old mode, and return the new mode.
78 * Note that there is no '=' command; a strict assignment is just a '-' (clear

--- 88 unchanged lines hidden (view full) ---

167setmode(p)
168 register char *p;
169{
170 register int perm, who;
171 register char op;
172 BITCMD *set, *saveset, *endset;
173 sigset_t sigset, sigoset;
174 mode_t mask;
71#ifdef SETMODE_DEBUG
72static void dumpmode __P((BITCMD *));
73#endif
74
75/*
76 * Given the old mode and an array of bitcmd structures, apply the operations
77 * described in the bitcmd structures to the old mode, and return the new mode.
78 * Note that there is no '=' command; a strict assignment is just a '-' (clear

--- 88 unchanged lines hidden (view full) ---

167setmode(p)
168 register char *p;
169{
170 register int perm, who;
171 register char op;
172 BITCMD *set, *saveset, *endset;
173 sigset_t sigset, sigoset;
174 mode_t mask;
175 int equalopdone, permXbits, setlen;
175 int equalopdone=0, permXbits, setlen;
176
177 if (!*p)
178 return (NULL);
179
180 /*
181 * Get a copy of the mask for the permissions that are mask relative.
182 * Flip the bits, we want what's not set. Since it's possible that
183 * the caller is opening files inside a signal handler, protect them

--- 213 unchanged lines hidden (view full) ---

397#endif
398
399/*
400 * Given an array of bitcmd structures, compress by compacting consecutive
401 * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
402 * 'g' and 'o' commands continue to be separate. They could probably be
403 * compacted, but it's not worth the effort.
404 */
176
177 if (!*p)
178 return (NULL);
179
180 /*
181 * Get a copy of the mask for the permissions that are mask relative.
182 * Flip the bits, we want what's not set. Since it's possible that
183 * the caller is opening files inside a signal handler, protect them

--- 213 unchanged lines hidden (view full) ---

397#endif
398
399/*
400 * Given an array of bitcmd structures, compress by compacting consecutive
401 * '+', '-' and 'X' commands into at most 3 commands, one of each. The 'u',
402 * 'g' and 'o' commands continue to be separate. They could probably be
403 * compacted, but it's not worth the effort.
404 */
405static int
405static void
406compress_mode(set)
407 register BITCMD *set;
408{
409 register BITCMD *nset;
410 register int setbits, clrbits, Xbits, op;
411
412 for (nset = set;;) {
413 /* Copy over any 'u', 'g' and 'o' commands. */

--- 40 unchanged lines hidden ---
406compress_mode(set)
407 register BITCMD *set;
408{
409 register BITCMD *nset;
410 register int setbits, clrbits, Xbits, op;
411
412 for (nset = set;;) {
413 /* Copy over any 'u', 'g' and 'o' commands. */

--- 40 unchanged lines hidden ---