+ /*
+ * The following is a work around for vhangup interactions
+ * which cause great problems getting window systems started.
+ * If the tty line is "-", we do the old style getty presuming
+ * that the file descriptors are already set up for us.
+ * J. Gettys - MIT Project Athena.
+ */
+ if (argc <= 2 || strcmp(argv[2], "-") == 0)
+ strcpy(ttyn, ttyname(0));
+ else {
+ int i;
+
+ strcpy(ttyn, dev);
+ strncat(ttyn, argv[2], sizeof(ttyn)-sizeof(dev));
+ if (strcmp(argv[0], "+") != 0) {
+ chown(ttyn, 0, 0);
+ chmod(ttyn, 0600);
+ revoke(ttyn);
+ /*
+ * Delay the open so DTR stays down long enough to be detected.
+ */
+ sleep(2);
+ while ((i = open(ttyn, O_RDWR)) == -1) {
+ if (repcnt % 10 == 0) {
+ syslog(LOG_ERR, "%s: %m", ttyn);
+ closelog();
+ }
+ repcnt++;
+ sleep(60);
+ }
+ login_tty(i);
+ }
+ }
+