int32_t screen_start(void)
{
  self = &badgeScreen;
  int32_t okay = 0;
  // Start SPI Engine - starts a cog
  // returns false if no cog available
  screen_stop();
  okay = (self->cog = cognew((int32_t)(&(*(int32_t *)&oleddat[1024])), (int32_t)(&self->command)) + 1);
  screenLock = locknew();
  lockclr(screenLock);
  return okay;
}
示例#2
0
文件: ftnsetup.c 项目: ftnapps/FTNd
static void die(int onsig)
{
    FILE    *fp;
    char    *temp;
    int	    i;

    signal(onsig, SIG_IGN);
    if ((!init) && (onsig != FTNERR_NO_PROGLOCK))
	screen_stop(); 

    if (exp_golded && (config_read() != -1)) {
	temp = calloc(PATH_MAX, sizeof(char));

	/*
	 * Export ~/etc/msg.txt for MsgEd.
	 */
	snprintf(temp, PATH_MAX, "%s/etc/msg.txt", getenv("FTND_ROOT"));
	if ((fp = fopen(temp, "w")) != NULL) {
	    fprintf(fp, "; msg.txt -- Automatic created by ftnsetup %s -- Do not edit!\n;\n", VERSION);
	    fprintf(fp, "; Mail areas for MsgEd.\n;\n");
	    msged_areas(fp);
	    fclose(fp);
	    Syslog('+', "Created new %s", temp);
	} else {
	    WriteError("$Could not create %s", temp);
	}

	/*
	 * Export ~/etc/golded.inc for GoldED
	 */
	snprintf(temp, PATH_MAX, "%s/etc/golded.inc", getenv("FTND_ROOT"));
	if ((fp = fopen(temp, "w")) != NULL) {
	    fprintf(fp, "; GoldED.inc -- Automatic created by ftnsetup %s -- Do not edit!\n\n", VERSION);
	    fprintf(fp, "; Basic information.\n;\n");
	    if (strlen(CFG.sysop_name) && CFG.akavalid[0] && CFG.aka[0].zone) {
		fprintf(fp, "USERNAME %s\n\n", CFG.sysop_name);
		fprintf(fp, "ADDRESS %s\n", aka2str(CFG.aka[0]));
		for (i = 1; i < 40; i++)
		    if (CFG.akavalid[i])
			fprintf(fp, "AKA     %s\n", aka2str(CFG.aka[i]));
		    fprintf(fp, "\n");

		gold_akamatch(fp);
		fprintf(fp, "; JAM MessageBase Setup\n;\n");
		fprintf(fp, "JAMPATH %s/tmp/\n", getenv("FTND_ROOT"));
		fprintf(fp, "JAMHARDDELETE NO\n\n");

		fprintf(fp, "; Semaphore files\n;\n");
		fprintf(fp, "SEMAPHORE NETSCAN    %s/var/sema/mailout\n", getenv("FTND_ROOT"));
		fprintf(fp, "SEMAPHORE ECHOSCAN   %s/var/sema/mailout\n\n", getenv("FTND_ROOT"));

		gold_areas(fp);
	    }
	    fclose(fp);
	    Syslog('+', "Created new %s", temp);
	} else {
	    WriteError("$Could not create %s", temp);
	}

	free(temp);
    }

    ulockprogram((char *)"ftnsetup");
    umask(oldmask);
    if (onsig && (onsig <= NSIG))
	WriteError("FTNSETUP finished on signal %s", SigName[onsig]);
    else
	Syslog(' ', "FTNSETUP finished");
    ExitClient(onsig);
}