SCCS-vsn: usr.sbin/lpr/common_source/common.c 4.4
SCCS-vsn: usr.sbin/lpr/common_source/startdaemon.c 4.4
-/* common.c 4.3 83/05/18 */
+/* common.c 4.4 83/05/27 */
/*
* Routines and data common to all the line printer functions.
*/
/*
* Routines and data common to all the line printer functions.
*/
putchar('\n');
exit(1);
}
putchar('\n');
exit(1);
}
-
-fatalerror(msg)
- char *msg;
-{
- extern int sys_nerr;
- extern char *sys_errlist[];
-
- printf("%s: ", name);
- if (*msg)
- printf("%s: ", msg);
- fputs(errno < sys_nerr ? sys_errlist[errno] : "Unknown error" , stdout);
- putchar('\n');
- exit(1);
-}
-/* startdaemon.c 4.3 83/05/18 */
+/* startdaemon.c 4.4 83/05/27 */
/*
* Tell the printer daemon that there are new files in the spool directory.
*/
/*
* Tell the printer daemon that there are new files in the spool directory.
*/
char buf[BUFSIZ];
rem = getport(host);
char buf[BUFSIZ];
rem = getport(host);
+ if (rem < 0) {
+ perr();
(void) sprintf(buf, "\1%s\n", printer);
i = strlen(buf);
if (write(rem, buf, i) != i) {
(void) sprintf(buf, "\1%s\n", printer);
i = strlen(buf);
if (write(rem, buf, i) != i) {
(void) close(rem);
return(0);
}
(void) close(rem);
return(0);
}
(void) fwrite(buf, 1, i, stdout);
err++;
}
(void) fwrite(buf, 1, i, stdout);
err++;
}
(void) close(rem);
return(i == 0 && err == 0);
}
(void) close(rem);
return(i == 0 && err == 0);
}
+
+static
+perr()
+{
+ extern int sys_nerr;
+ extern char *sys_errlist[];
+
+ printf("%s: ", name);
+ fputs(errno < sys_nerr ? sys_errlist[errno] : "Unknown error" , stdout);
+ putchar('\n');
+}