Beispiel #1
0
int main (int argc, char *argv[])
{
    int index;

    set_program_name (argv[0]);
    iu_argp_init ("talk", program_authors);
    argp_parse (&argp, argc, argv, 0, &index, NULL);

    argc -= index;
    argv += index;

    if (argc == 0)
    {
        printf ("Usage: talk user [ttyname]\n");
        exit (-1);
    }
    if (!isatty (0))
    {
        printf ("Standard input must be a tty, not a pipe or a file\n");
        exit (-1);
    }

    get_names (argc, argv);
    init_display ();
    open_ctl ();
    open_sockt ();
    start_msgs ();
    if (!check_local ())
        invite_remote ();
    end_msgs ();
    set_edit_chars ();
    talk ();
}
Beispiel #2
0
int
main(int argc, char *argv[])
{
	if (pledge("stdio rpath inet dns getpw tty", NULL) == -1)
		err(1, "pledge");

	get_names(argc, argv);
	init_display();
	open_ctl();
	open_sockt();
	start_msgs();
	if (!check_local())
		invite_remote();
	end_msgs();
	set_edit_chars();

	if (his_machine_addr.s_addr == my_machine_addr.s_addr) {
		if (pledge("stdio tty", NULL) == -1)
			err(1, "pledge");
	} else {
		if (pledge("stdio inet tty", NULL) == -1)
			err(1, "pledge");
	}

	talk();
	return (0);
}
Beispiel #3
0
int
main(int argc, char **argv)
{
	(void) setlocale(LC_CTYPE, "");

	get_names(argc, argv);
	check_writeable();
	init_display();
	open_ctl();
	open_sockt();
	start_msgs();
	if (!check_local())
		invite_remote();
	end_msgs();
	set_edit_chars();
	talk();
	return 0;
}