4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
28 /* All Rights Reserved */
31 #pragma ident "%Z%%M% %I% %E% SMI"
41 DIR *machdir
, *spooldir
;
42 char machname
[MAXFULLNAME
];
43 char file1
[NAMESIZE
+1], file2
[NAMESIZE
+1];
44 struct cs_struct svdcfile
;
47 (void) strcpy(Progname
, "bnuconvert");
52 (void) setuid(UUCPUID
);
54 while ((c
= getopt(argc
, argv
, "x:")) != EOF
)
62 (void) fprintf(stderr
, "usage: bnuconvert [-xLEVEL]\n");
66 DEBUG(5, "Progname (%s): STARTED\n", Progname
);
68 /* find the default directory to queue to */
70 if (eaccess(GRADES
, 04) != -1)
71 svdcfile
.grade
= fdgrade();
73 svdcfile
.grade
= D_QUEUE
;
75 DEBUG(5, "All jobs will be placed in directory (%c) ", svdcfile
.grade
);
76 DEBUG(5, "under each remote name in the spool area.%c\n", NULLCHAR
);
78 if ((spooldir
= opendir(SPOOL
)) == NULL
) {
79 (void) fprintf(stderr
, "CAN'T OPEN (%s): errno (%d)\n",
84 while (gdirf(spooldir
, file1
, SPOOL
)) {
86 (void) sprintf(Rmtname
, "%s", file1
);
87 (void) sprintf(machname
, "%s/%s", SPOOL
, file1
);
88 DEBUG(9, "File1 is (%s)\n", file1
);
89 DEBUG(9, "Rmtname is (%s)\n", Rmtname
);
90 DEBUG(9, "Machname is (%s)\n", machname
);
92 if (chdir(machname
) != 0) {
93 (void) fprintf(stderr
, "CAN'T CHDIR (%s): errno (%d)\n",
98 if ((machdir
= opendir(machname
)) == NULL
) {
99 (void) fprintf(stderr
, "CAN'T OPEN (%s): errno (%d)\n",
104 DEBUG(7, "Directory: %s\n", machname
);
106 while (gnamef(machdir
, file2
) == TRUE
) {
108 DEBUG(9, "File read from (%s) ", machname
);
109 DEBUG(9, "is (%s)\n", file2
);
111 if (!EQUALSN(file2
, "C.",2))
114 /* build a saved C. file structure */
116 (void) strncpy(svdcfile
.file
, file2
, NAMESIZE
-1);
117 (void) sprintf(svdcfile
.sys
, "%s/%c", Rmtname
, svdcfile
.grade
);
119 DEBUG(9, "Rmtname is (%s)\n", Rmtname
);
120 DEBUG(9, "Default directory to queue to is (%c)\n", svdcfile
.grade
);
121 DEBUG(7, "Directory to queue to is (%s)\n", svdcfile
.sys
);
123 /* place any and all D. files related to the
124 ** C. file in the proper spool area.
129 /* Now queue the C. file */
131 wfcommit(svdcfile
.file
, svdcfile
.file
, svdcfile
.sys
);
138 /* a dummy cleanup function to satisfy a .o file */