static char sccsid
[] = "@(#)alterfile.c 4.4 (Melbourne) 82/02/27";
* userprivs file conversion program
* This utility converts the userprivs file
* from one form to another, after a modification to
* the basic structure definition
* put the new structure in "./udata.h"
* and the old defn in "/usr/include/udata.h"
* add/remove code below so that all fields in the old structure
* that still exist in the new one are copied
if ((fd
= open(UPRIVFILE
, 0)) < 0) {
if (link(UPRIVFILE
, "/usr/adm/oldprivs") < 0) {
perror("/usr/adm/oldprivs");
if (unlink(UPRIVFILE
) < 0) {
if ((nfd
= creat(UPRIVFILE
, 0444)) < 0) {
link("/usr/adm/oldprivs", UPRIVFILE
);
while (read(fd
, &old
, sizeof old
) == sizeof old
) {
if (allzero(&old
, sizeof old
)) {
lseek(nfd
, (long)sizeof old
, 1);
new = zero
; /* not necessary, but it doesn't hurt either */
for (i
= 0; i
< elmts(old
.ud_flags
); i
++)
if (i
< elmts(new.ud_flags
))
new.ud_flags
[i
] = old
.ud_flags
[i
];
new.ud_maxrss
= old
.ud_maxrss
;
new.ud_maxfile
= old
.ud_maxfile
;
new.ud_maxcore
= old
.ud_maxcore
;
new.ud_maxstack
= old
.ud_maxstack
;
new.ud_maxdata
= old
.ud_maxdata
;
new.ud_maxcpu
= old
.ud_maxcpu
;
new.ud_raise
= old
.ud_raise
;
new.ud_ttys
= old
.ud_ttys
;
new.ud_maxlogin
= old
.ud_maxlogin
;
new.ud_umask
= old
.ud_umask
;
new.ud_expires
= old
.ud_expires
;
new.ud_logon
[0].tr_low
.xt_ok
= 0;
new.ud_logon
[0].tr_high
.xt_ok
= 0;
if (write(nfd
, &new, sizeof new) != sizeof new) {