BSD 4_4_Lite2 release
[unix-history] / usr / src / libexec / talkd / announce.c
index e8c9915..7c99ea4 100644 (file)
@@ -32,7 +32,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)announce.c 8.2 (Berkeley) 1/7/94";
+static char sccsid[] = "@(#)announce.c 8.3 (Berkeley) 4/28/95";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -48,6 +48,7 @@ static char sccsid[] = "@(#)announce.c        8.2 (Berkeley) 1/7/94";
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
 #include <stdio.h>
 #include <string.h>
+#include <vis.h>
 #include <paths.h>
 
 extern char hostname[];
 #include <paths.h>
 
 extern char hostname[];
@@ -77,7 +78,7 @@ announce(request, remote_machine)
 
 #define max(a,b) ( (a) > (b) ? (a) : (b) )
 #define N_LINES 5
 
 #define max(a,b) ( (a) > (b) ? (a) : (b) )
 #define N_LINES 5
-#define N_CHARS 120
+#define N_CHARS 256
 
 /*
  * Build a block of characters containing the message. 
 
 /*
  * Build a block of characters containing the message. 
@@ -99,7 +100,7 @@ print_mesg(tty, tf, request, remote_machine)
        char line_buf[N_LINES][N_CHARS];
        int sizes[N_LINES];
        char big_buf[N_LINES*N_CHARS];
        char line_buf[N_LINES][N_CHARS];
        int sizes[N_LINES];
        char big_buf[N_LINES*N_CHARS];
-       char *bptr, *lptr, *ttymsg();
+       char *bptr, *lptr, *vis_user;
        int i, j, max_size;
 
        i = 0;
        int i, j, max_size;
 
        i = 0;
@@ -115,13 +116,15 @@ print_mesg(tty, tf, request, remote_machine)
        sizes[i] = strlen(line_buf[i]);
        max_size = max(max_size, sizes[i]);
        i++;
        sizes[i] = strlen(line_buf[i]);
        max_size = max(max_size, sizes[i]);
        i++;
+       vis_user = (char *) malloc(strlen(request->l_name) * 4 + 1);
+       strvis(vis_user, request->l_name, VIS_CSTYLE);
        (void)sprintf(line_buf[i], "talk: connection requested by %s@%s",
        (void)sprintf(line_buf[i], "talk: connection requested by %s@%s",
-               request->l_name, remote_machine);
+               vis_user, remote_machine);
        sizes[i] = strlen(line_buf[i]);
        max_size = max(max_size, sizes[i]);
        i++;
        (void)sprintf(line_buf[i], "talk: respond with:  talk %s@%s",
        sizes[i] = strlen(line_buf[i]);
        max_size = max(max_size, sizes[i]);
        i++;
        (void)sprintf(line_buf[i], "talk: respond with:  talk %s@%s",
-               request->l_name, remote_machine);
+               vis_user, remote_machine);
        sizes[i] = strlen(line_buf[i]);
        max_size = max(max_size, sizes[i]);
        i++;
        sizes[i] = strlen(line_buf[i]);
        max_size = max(max_size, sizes[i]);
        i++;