Diff

Differences From Artifact [57f3950d21]:

To Artifact [170db08253]:


1944
1945
1946
1947
1948
1949
1950

1951
1952
1953
1954
1955
1956
1957
    }
}

int do_cmdline(int argc, char **argv, int do_everything, Config *cfg)
{
    int err = 0;
    extern char **pty_argv;	       /* declared in pty.c */


    /*
     * Macros to make argument handling easier. Note that because
     * they need to call `continue', they cannot be contained in
     * the usual do {...} while (0) wrapper to make them
     * syntactically single statements; hence it is not legal to
     * use one of these macros as an unbraced statement between







>







1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
    }
}

int do_cmdline(int argc, char **argv, int do_everything, Config *cfg)
{
    int err = 0;
    extern char **pty_argv;	       /* declared in pty.c */
    extern int use_pty_argv;

    /*
     * Macros to make argument handling easier. Note that because
     * they need to call `continue', they cannot be contained in
     * the usual do {...} while (0) wrapper to make them
     * syntactically single statements; hence it is not legal to
     * use one of these macros as an unbraced statement between
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
			 !strcmp(p, "-cbg") ? 5 : -1);
		assert(index != -1);
		cfg->colours[index][0] = col.red / 256;
		cfg->colours[index][1] = col.green / 256;
		cfg->colours[index][2] = col.blue / 256;
	    }

	} else if (!strcmp(p, "-e")) {
	    /* This option swallows all further arguments. */
	    if (!do_everything)
		break;

	    if (--argc > 0) {
		int i;
		pty_argv = snewn(argc+1, char *);







|







2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
			 !strcmp(p, "-cbg") ? 5 : -1);
		assert(index != -1);
		cfg->colours[index][0] = col.red / 256;
		cfg->colours[index][1] = col.green / 256;
		cfg->colours[index][2] = col.blue / 256;
	    }

	} else if (use_pty_argv && !strcmp(p, "-e")) {
	    /* This option swallows all further arguments. */
	    if (!do_everything)
		break;

	    if (--argc > 0) {
		int i;
		pty_argv = snewn(argc+1, char *);
2215
2216
2217
2218
2219
2220
2221
2222
2223

2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248



2249
2250
2251
2252
2253
2254
2255
    return gdk_input_add(fd, flags, fd_input_func, NULL);
}

void uxsel_input_remove(int id) {
    gdk_input_remove(id);
}

int main(int argc, char **argv)
{

    extern void pty_pre_init(void);    /* declared in pty.c */
    struct gui_data *inst;
    int font_charset;

    /* defer any child exit handling until we're ready to deal with
     * it */
    block_signal(SIGCHLD, 1);

    pty_pre_init();

    gtk_init(&argc, &argv);

    /*
     * Create an instance structure and initialise to zeroes
     */
    inst = snew(struct gui_data);
    memset(inst, 0, sizeof(*inst));
    inst->alt_keycode = -1;            /* this one needs _not_ to be zero */

    if (do_cmdline(argc, argv, 0, &inst->cfg))
	exit(1);		       /* pre-defaults pass to get -class */
    do_defaults(NULL, &inst->cfg);
    if (do_cmdline(argc, argv, 1, &inst->cfg))
	exit(1);		       /* post-defaults, do everything */




    inst->fonts[0] = gdk_font_load(inst->cfg.font.name);
    if (!inst->fonts[0]) {
	fprintf(stderr, "pterm: unable to load font \"%s\"\n",
		inst->cfg.font.name);
	exit(1);
    }
    font_charset = set_font_info(inst, 0);







|

>
|







<
<















>
>
>







2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233


2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
    return gdk_input_add(fd, flags, fd_input_func, NULL);
}

void uxsel_input_remove(int id) {
    gdk_input_remove(id);
}

int pt_main(int argc, char **argv)
{
    extern Backend *select_backend(Config *cfg);
    extern int cfgbox(Config *cfg);
    struct gui_data *inst;
    int font_charset;

    /* defer any child exit handling until we're ready to deal with
     * it */
    block_signal(SIGCHLD, 1);



    gtk_init(&argc, &argv);

    /*
     * Create an instance structure and initialise to zeroes
     */
    inst = snew(struct gui_data);
    memset(inst, 0, sizeof(*inst));
    inst->alt_keycode = -1;            /* this one needs _not_ to be zero */

    if (do_cmdline(argc, argv, 0, &inst->cfg))
	exit(1);		       /* pre-defaults pass to get -class */
    do_defaults(NULL, &inst->cfg);
    if (do_cmdline(argc, argv, 1, &inst->cfg))
	exit(1);		       /* post-defaults, do everything */

    if (!cfgbox(&inst->cfg))
	exit(0);		       /* config box hit Cancel */

    inst->fonts[0] = gdk_font_load(inst->cfg.font.name);
    if (!inst->fonts[0]) {
	fprintf(stderr, "pterm: unable to load font \"%s\"\n",
		inst->cfg.font.name);
	exit(1);
    }
    font_charset = set_font_info(inst, 0);
2393
2394
2395
2396
2397
2398
2399
2400


2401

2402

2403
2404
2405
2406
2407
2408
2409

    inst->term = term_init(&inst->cfg, &inst->ucsdata, inst);
    inst->logctx = log_init(inst, &inst->cfg);
    term_provide_logctx(inst->term, inst->logctx);

    uxsel_init();

    inst->back = &pty_backend;


    inst->back->init((void *)inst->term, &inst->backhandle, &inst->cfg,

		     NULL, 0, NULL, 0);

    inst->back->provide_logctx(inst->backhandle, inst->logctx);

    term_provide_resize_fn(inst->term, inst->back->size, inst->backhandle);

    term_size(inst->term, inst->cfg.height, inst->cfg.width, inst->cfg.savelines);

    inst->ldisc =







|
>
>
|
>
|
>







2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416

    inst->term = term_init(&inst->cfg, &inst->ucsdata, inst);
    inst->logctx = log_init(inst, &inst->cfg);
    term_provide_logctx(inst->term, inst->logctx);

    uxsel_init();

    inst->back = select_backend(&inst->cfg);
    {
	char *realhost;		       /* FIXME: don't ignore this! */
	inst->back->init((void *)inst->term, &inst->backhandle, &inst->cfg,
			 inst->cfg.host, inst->cfg.port, &realhost,
			 inst->cfg.tcp_nodelay);
    }
    inst->back->provide_logctx(inst->backhandle, inst->logctx);

    term_provide_resize_fn(inst->term, inst->back->size, inst->backhandle);

    term_size(inst->term, inst->cfg.height, inst->cfg.width, inst->cfg.savelines);

    inst->ldisc =