SCCS-vsn: usr.bin/talk/get_names.c 5.3
SCCS-vsn: usr.bin/talk/msgs.c 5.2
SCCS-vsn: usr.bin/talk/talk.c 5.2
SCCS-vsn: usr.bin/talk/talk.h 5.2
-static char sccsid[] = "@(#)get_names.c 5.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)get_names.c 5.3 (Berkeley) %G%";
#endif not lint
#include "talk.h"
#include <sys/param.h>
#include <protocols/talkd.h>
#endif not lint
#include "talk.h"
#include <sys/param.h>
#include <protocols/talkd.h>
char *getlogin();
char *ttyname();
char *rindex();
char *getlogin();
char *ttyname();
char *rindex();
printf("Standard input must be a tty, not a pipe or a file\n");
exit(-1);
}
printf("Standard input must be a tty, not a pipe or a file\n");
exit(-1);
}
- my_name = getlogin();
- if (my_name == NULL) {
- printf("You don't exist. Go away.\n");
- exit(-1);
+ if ((my_name = getlogin()) == NULL) {
+ struct passwd *pw;
+
+ if ((pw = getpwuid(getuid())) == NULL) {
+ printf("You don't exist. Go away.\n");
+ exit(-1);
+ }
+ my_name = pw->pw_name;
}
gethostname(hostname, sizeof (hostname));
my_machine_name = hostname;
}
gethostname(hostname, sizeof (hostname));
my_machine_name = hostname;
- my_tty = rindex(ttyname(0), '/') + 1;
/* check for, and strip out, the machine name of the target */
for (cp = argv[1]; *cp && !any(*cp, "@:!."); cp++)
;
/* check for, and strip out, the machine name of the target */
for (cp = argv[1]; *cp && !any(*cp, "@:!."); cp++)
;
-static char sccsid[] = "@(#)msgs.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)msgs.c 5.2 (Berkeley) %G%";
#include "talk.h"
#define MSG_INTERVAL 4
#include "talk.h"
#define MSG_INTERVAL 4
-#define LONG_TIME 100000
char *current_state;
int current_line = 0;
char *current_state;
int current_line = 0;
-static struct itimerval itimer;
-static struct timeval wait = { MSG_INTERVAL , 0};
-static struct timeval undo = { LONG_TIME, 0};
-
+ struct itimerval itimer;
message(current_state);
signal(SIGALRM, disp_msg);
message(current_state);
signal(SIGALRM, disp_msg);
- itimer.it_value = itimer.it_interval = wait;
+ itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
+ itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
}
end_msgs()
{
setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
}
end_msgs()
{
+ struct itimerval itimer;
- signal(SIGALRM, SIG_IGN);
timerclear(&itimer.it_value);
timerclear(&itimer.it_interval);
setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
timerclear(&itimer.it_value);
timerclear(&itimer.it_interval);
setitimer(ITIMER_REAL, &itimer, (struct timerval *)0);
+ signal(SIGALRM, SIG_DFL);
#endif not lint
#ifndef lint
#endif not lint
#ifndef lint
-static char sccsid[] = "@(#)talk.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)talk.c 5.2 (Berkeley) %G%";
#endif not lint
#include "talk.h"
#endif not lint
#include "talk.h"
int argc;
char *argv[];
{
int argc;
char *argv[];
{
get_names(argc, argv);
init_display();
open_ctl();
open_sockt();
start_msgs();
get_names(argc, argv);
init_display();
open_ctl();
open_sockt();
start_msgs();
invite_remote();
end_msgs();
set_edit_chars();
invite_remote();
end_msgs();
set_edit_chars();
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)talk.h 5.1 (Berkeley) %G%
+ * @(#)talk.h 5.2 (Berkeley) %G%
-#define BUF_SIZE 512
-
-FILE *popen();
extern int sockt;
extern int curses_initialized;
extern int sockt;
extern int curses_initialized;