+/*
+ * Merge current contents of ttys file
+ * into in-core table of configured tty lines.
+ * Entered as signal handler for SIGHUP.
+ */
+#define FOUND 1
+#define CHANGE 2
+
+merge()
+{
+ register struct tab *p;
+
+ fi = open(ifile, 0);
+ if (fi < 0)
+ return;
+ for (ALL)
+ p->xflag = 0;
+ while (rline()) {
+ for (ALL) {
+ if (SCMPN(p->line, line.line))
+ continue;
+ p->xflag |= FOUND;
+ if (line.comn != p->comn) {
+ p->xflag |= CHANGE;
+ p->comn = line.comn;
+ }
+ goto contin1;
+ }
+ for (ALL) {
+ if (p->line[0] != 0)
+ continue;
+ SCPYN(p->line, line.line);
+ p->xflag |= FOUND|CHANGE;
+ p->comn = line.comn;
+ goto contin1;
+ }
+ contin1:
+ ;
+ }
+ close(fi);
+ for (ALL) {
+ if ((p->xflag&FOUND) == 0) {
+ term(p);
+ p->line[0] = 0;
+ }
+ if (p->xflag&CHANGE) {
+ term(p);
+ dfork(p);
+ }
+ }
+}
+