コード例 #1
0
ファイル: gretlcli.c プロジェクト: aylusltd/gretl
static void maybe_save_session_output (const char *cmdfile)
{
    char outfile[FILENAME_MAX];

    printf(_("type a filename to store output (enter to quit): "));

    *outfile = '\0';

    if (fgets(outfile, sizeof outfile, stdin) != NULL) {
	top_n_tail(outfile, 0, NULL);
    }

    if (*outfile != '\0' && *outfile != '\n' && *outfile != '\r' 
	&& strcmp(outfile, "q")) {
	const char *udir = gretl_workdir();
	char *syscmd;

	printf(_("writing session output to %s%s\n"), udir, outfile);
#ifdef WIN32
	syscmd = gretl_strdup_printf("\"%sgretlcli\" -b \"%s\" > \"%s%s\"", 
				     gretl_home(), cmdfile, udir, outfile);
	system(syscmd);
#else
	syscmd = gretl_strdup_printf("gretlcli -b \"%s\" > \"%s%s\"", 
				     cmdfile, udir, outfile);
	gretl_spawn(syscmd);
#endif
	printf("%s\n", syscmd);
	free(syscmd);
    }
}
コード例 #2
0
ファイル: gretl_utils.c プロジェクト: agaurav/QT-GRETL
static void maybe_fix_daily_start (long *ed, int pd)
{
    int wday = weekday_from_epoch_day(*ed);
    int fix = 0;

    if (wday == 0) {
	/* 5- or 6-day data: sunday not valid */
	fix = 1;
    } else if (wday == 6 && pd == 5) {
	/* 5-day data: saturday not valid */
	fix = 2;
    }
    
    if (fix) {
	char *fixed, *msg;

	*ed += fix;
	fixed = ymd_extended_from_epoch_day(*ed, NULL);
	msg = gretl_strdup_printf("the starting date was corrected to Monday %s",
				  fixed);
	gretl_warnmsg_set(msg);
	free(msg);
	free(fixed);
    }
}