Index: kiss/mkiss.c =================================================================== RCS file: /home/ax25-cvs/ax25-tools/kiss/mkiss.c,v retrieving revision 1.7 diff -u -r1.7 mkiss.c --- kiss/mkiss.c 13 Apr 2010 08:36:00 -0000 1.7 +++ kiss/mkiss.c 25 Sep 2010 00:25:25 -0000 @@ -82,7 +82,7 @@ static int invalid_ports = 0; static int return_polls = 0; -static char *usage_string = "usage: mkiss [-p interval] [-c] [-f] [-h] [-l] [-s speed] [-v] [-x ] ttyinterface pty ..\n"; +static char *usage_string = "usage: mkiss [-p interval] [-c] [-f] [-h] [-l] [-s speed] [-v] [-x ] [-L] ttyinterface pty ..\n"; static int dump_report = FALSE; @@ -112,6 +112,7 @@ unsigned long txbytes; /* TX bytes count */ char namepts[PATH_MAX]; /* name of the unix98 pts slaves, which * the client has to use */ + char link[PATH_MAX]; /* The link (if any) to namepts */ }; static struct iface *tty = NULL; @@ -363,8 +364,10 @@ for (i = 0; i < numptys; i++) { if (pty[i]->fd == -1) continue; - if (pty[i]->namepts[0] != '\0') + if (pty[i]->namepts[0] != '\0') { + unlink(pty[i]->link); continue; + } tty_unlock(pty[i]->name); close(pty[i]->fd); free(pty[i]); @@ -432,8 +435,9 @@ int ptmxdevices = 0; char *npts; int wrote_info = 0; + int link_pty = 0; - while ((size = getopt(argc, argv, "cfhlp:s:vx:")) != -1) { + while ((size = getopt(argc, argv, "cfhlp:s:vx:L")) != -1) { switch (size) { case 'c': crcflag = G8BPQ_CRC; @@ -462,6 +466,9 @@ return 1; } break; + case 'L': + link_pty = 1; + break; case 'v': printf("mkiss: %s\n", VERSION); return 1; @@ -585,8 +592,28 @@ printf("\nAwaiting client connects on:\n"); else printf(" "); - printf("%s", pty[i]->namepts); wrote_info = 1; + + if (link_pty) { + int ret; + + ret = snprintf(pty[i]->link, PATH_MAX, + "%s.%i", tty->name, i); + if (ret == -1) { + perror("symlink"); + return 1; + } + + unlink(pty[i]->link); + ret = symlink(pty[i]->namepts, pty[i]->link); + if (ret) { + perror("symlink"); + return 1; + } + printf("%s", pty[i]->link); + } else + printf("%s", pty[i]->namepts); + } } @@ -720,8 +747,10 @@ for (i = 0; i < numptys; i++) { if (pty[i]->fd == -1) continue; - if (pty[i]->namepts[0] != '\0') + if (pty[i]->namepts[0] != '\0') { + unlink(pty[i]->link); continue; + } tty_unlock(pty[i]->name); close(pty[i]->fd); free(pty[i]);