static char sccsid
[] = "@(#)expfile.c 5.2 (Berkeley) %G%";
* expfile(file) expand file name
* return codes: 0 - Ordinary spool area file
* FAIL - no Wrkdir name available
register char *fpart
, *p
;
for (fpart
= file
+ 1, up
= user
; *fpart
!= '\0'
&& *fpart
!= '/' && up
< user
+sizeof(user
)-1; fpart
++)
/* ll1b.105, mn, Mark Nettleingham, defend against
* null login name in /etc/passwd
if (!*user
|| gninfo(user
, &uid
, full
) != 0) {
sprintf(full
, "%s/%s", Wrkdir
, file
);
* isdir(name) check if directory name
* return codes: 0 - not directory | 1 - is directory
ret
= stat(subfile(name
), &s
);
if ((s
.st_mode
& S_IFMT
) == S_IFDIR
)
* mkdirs(name) make all necessary directories
for (p
= dir
+ 1;; p
++) {
if ((p
= index(p
, '/')) == NULL
)
/* rti!trt: add chmod ala 4.1c uucp */
sprintf(cmd
, "mkdir %s;chmod 0777 %s", dir
, dir
);
DEBUG(4, "mkdir - %s\n", dir
);
ret
= shio(cmd
, CNULL
, CNULL
, User
);
* ckexpf - expfile and check return
* print error if it failed.
* return code - 0 - ok; FAIL if expfile failed
if (expfile(file
) != FAIL
)
/* could not expand file name */
/* the gwd routine failed */
fprintf(stderr
, "Can't expand filename (%s). Pwd failed.\n", file
+1);