Esempio n. 1
0
/*
 * Application entry point.
 */
int main(void) {
	/* HAL&RTOS init */
	halInit();
	chSysInit();

	/* SD/FATFS init */
	sdcStart(&SDCD1, NULL );
	wf_init(NORMALPRIO);

	/* POSIX compatibility layer initialization */
	posix_init();
	posix_init_chstream(STDIN_FILENO, (BaseSequentialStream *) &SDU1);
	posix_init_chstream(STDOUT_FILENO, (BaseSequentialStream *) &SDU1);
	posix_init_chstream(STDERR_FILENO, (BaseSequentialStream *) &SDU1);

	/* Initializes a serial-over-USB CDC driver */
	sduObjectInit(&SDU1);
	sduStart(&SDU1, &serusbcfg);

	usbDisconnectBus(serusbcfg.usbp);
	chThdSleepMilliseconds(1000);
	usbStart(serusbcfg.usbp, &usbcfg);
	usbConnectBus(serusbcfg.usbp);

	ngshell_init(&sh1, sh1_wa, SHELL_WA_SIZE, NORMALPRIO);

	while (TRUE)
		chThdSleepMilliseconds(500);
}
Esempio n. 2
0
void Engine::init() {
	signal(SIGINT,SIGINT_handler);
	//	signal(SIGHUP,SIGINT_handler);

	if (so.parallel) master.initMPI();

	// Get the vars ready

	for (int i = 0; i < vars.size(); i++) {
		IntVar *v = vars[i];
		if (v->pinfo.size() == 0) v->in_queue = true;
		else v->pushInQueue();
	}

	if (so.lazy) {
		for (int i = 0; i < vars.size(); i++) {
			if (vars[i]->getMax() - vars[i]->getMin() <= so.eager_limit) {
				vars[i]->specialiseToEL();
			} else {
                            std::cerr << "using lazy literal\n";
				vars[i]->specialiseToLL();
			}
		}
	} else {
		for (int i = 0; i < vars.size(); i++) vars[i]->initVals(true);
	}

	// Get the propagators ready

	process_ircs();

	// Get well founded propagators ready

	wf_init();

	// Get MIP propagator ready

	if (so.mip) mip->init();

	// Get SAT propagator ready

	sat.init();

	// Set lits allowed to be in learnt clauses
	problem->restrict_learnable();

	// Get LDSB ready

	if (so.ldsb) ldsb.init();

	// Do MIP presolve

	if (so.mip) mip->presolve();

	// Ready

	finished_init = true;
}
Esempio n. 3
0
void Mrf24w::begin() {
  pinMode(m_intPin, INPUT_PULLUP);
  attachInterrupt(m_intPin, wf_isr, FALLING);

  pinMode(m_csPin, OUTPUT);
  digitalWrite(m_csPin, HIGH);

  Serial1.println("wf_init");
  //  wf_hook_on_connected = Mrf24w_wf_hook_on_connected;
  //  wf_hook_on_connected_user_data = this;
  wf_init();

  stack_init();

  Serial1.println("begin end");
}
Esempio n. 4
0
struct pico_device * pico_eth_create(char *name, uint8_t *mac)
{
    struct pico_device * mrf24wg = PICO_ZALLOC(sizeof(struct pico_device));
    if (!mrf24wg)
        return NULL;

    /*          SPI             CS,               RESET            INTERRUPT   */
    printf("mrf24w> init\n");
    mrf24w_init(SPI2, GPIOB, GPIO_PIN_12, GPIOB, GPIO_PIN_10, GPIOB, GPIO_PIN_11);
    wf_init();

    mrf24wg->poll = pico_mrf24_poll;
    mrf24wg->send = pico_mrf24_send;

    /* Get MAC address */
    wf_getMacAddress(mac);
    printf("mrf24w> mac: %x:%x:%x:%x:%x:%x\n", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);

    if(0 != pico_device_init(mrf24wg, name, mac)) {
        dbg("mrf24w> init failed.\r\n");
        return NULL;
    }

    /* start with a scan */
    {
        uint8_t connectionProfileId;
        uint8_t channelList[] = {};

        //connectionProfileId = wf_cpCreate();
        //ASSERT(connectionProfileId != 0xff);
        //wf_cpSetSsid(connectionProfileId, (uint8_t*) m_ssid, strlen(m_ssid));
        //wf_cpSetNetworkType(connectionProfileId, m_wirelessMode);
        //wf_caSetScanType(WF_ACTIVE_SCAN);
        //wf_caSetChannelList(channelList, sizeof (channelList));
        //wf_caSetListRetryCount(10);
        //wf_caSetBeaconTimeout(40);
        //wf_cpSetSecurity(connectionProfileId, m_securityType, 0, m_securityPassphrase, m_securityPassphraseLen);
        //wf_cmConnect(connectionProfileId);
        wf_scan(0xFF); // Scan using default filter
    }

    return mrf24wg;
}
Esempio n. 5
0
static int do_wf_decode(struct dab_state_t* dab, int frequency)
{
  struct wavefinder_t *wf = dab->device_state;
  int displayed_lock = 0;

  wf_init(wf);
  wf_tune(wf, (frequency+500)/1000);  /* Round frequency to the nearest KHz */

  fprintf(stderr,"Waiting for sync...");

  /* Read (and discard) the first frame - we know it is missing the FIC symbols */
  wf_read_frame(wf,&dab->tfs[0]);
  if ((wf->sync_locked) && (!displayed_lock)) {
    fprintf(stderr,"LOCKED\n");
    displayed_lock = 1;
  }

  while (1) {
    wf_read_frame(wf,&dab->tfs[dab->tfidx]);
    dab_process_frame(dab);
  }
}
Esempio n. 6
0
int
main(int argc, char **argv)
{
	const char *to = 0;
	u_char print_version = 0;
	u_char first;
	DCC_PATH tmp;
	WHITE_INX inx, inx2;
	const char *nm;
	DCC_SUM sum;
	struct stat ht_sb, ascii_sb, inc_sb;
	char tgts_buf[20];
	char range_buf[INET6_ADDRSTRLEN+1+INET6_ADDRSTRLEN+1];
	int col;
	u_char heading;
	DCC_TGTS tgts;
	WHITE_LISTING listing;
	DCC_CK_TYPES type;
	int i;

	dcc_syslog_init(0, argv[0], 0);
	dcc_clnt_debug = 99;

	wf_init(&cmn_wf, WF_WLIST | WF_EITHER);

	while ((i = getopt(argc, argv, "VPQqh:t:")) != EOF) {
		switch (i) {
		case 'V':
			dcc_version_print();
			print_version = 1;
			break;

		case 'P':		/* parse or rebuild hash table */
			cmn_wf.wf_flags &= ~WF_WLIST_RO;
			cmn_wf.wf_flags |= WF_WLIST_RW;
			break;

		case 'Q':		/* query; don't rebuild hash table */
			cmn_wf.wf_flags &= ~WF_WLIST_RW;
			cmn_wf.wf_flags |= WF_WLIST_RO;
			break;

		case 'q':
			quiet = 1;
			break;

		case 'h':
			homedir = optarg;
			break;

		case 't':
			to = optarg;
			break;

		default:
			usage();
		}
	}
	argc -= optind;
	argv += optind;
	if (argc == 0) {
		if (print_version)
			exit(EX_OK);
		usage();
	}

	if (!dcc_cdhome(0, homedir, 1) && homedir)
		dcc_cdhome(0, homedir = 0, 1);

	first = 1;
	while ((nm = *argv++) != 0) {
		if (first) {
			first = 0;
		} else {
			printf("\n\n--------------------------------\n");
		}

		if (cmn_wf.wf_flags & WF_WLIST_RO)
			cmn_wf.wf_flags |= WF_RO;
		else
			cmn_wf.wf_flags &= ~WF_RO;

		if (!dcc_new_white_nm(dcc_emsg, &cmn_wf, nm)) {
			dcc_error_msg("%s", dcc_emsg);
			exit(EX_DATAERR);
		}
		printf("%s\n", dcc_fnm2abs_msg(tmp, cmn_wf.ascii_nm));

		/* try to force re-parsing */
		if (cmn_wf.wf_flags & WF_WLIST_RW) {
			if (!new_ht_nm(dcc_emsg, &cmn_wf, 0)
			    || 0 > unlink_white_ht(dcc_emsg, &cmn_wf, time(0))) {
				dcc_error_msg("-P failed to force re-parsing;"
					      " %s",
					      dcc_emsg);
				exit(EX_DATAERR);
			}
			if (!dcc_new_white_nm(dcc_emsg, &cmn_wf, nm)) {
				dcc_error_msg("%s", dcc_emsg);
				exit(EX_DATAERR);
			}
		}

		switch (wf_rdy(dcc_emsg, &cmn_wf, &cmn_tmp_wf)) {
		case WHITE_OK:
			break;
		case WHITE_NOFILE:
			dcc_error_msg("does %s exist?", nm);
			exit(EX_DATAERR);
			break;
		case WHITE_CONTINUE:
			dcc_error_msg("%s", dcc_emsg);
			break;
		case WHITE_SILENT:
		case WHITE_COMPLAIN:
			dcc_error_msg("%s", dcc_emsg);
			exit(EX_DATAERR);
			break;
		}
		printf("%s\n", cmn_wf.wtbl->magic);

		if (to) {
			str2ck(&sum, 0, 0, to);
			printf("%s\n%8s %s\t",
			       to,
			       type2str_err(DCC_CK_ENV_TO, 0, 0, 0),
			       ck2str_err(DCC_CK_ENV_TO, &sum, 0));
			if (WHITE_OK != wf_sum(dcc_emsg, &cmn_wf,
					       DCC_CK_ENV_TO, &sum,
					       &tgts, &listing)) {
				dcc_error_msg("%s", dcc_emsg);
			}
			if (listing == WHITE_UNLISTED) {
				printf("unlisted\n");
			} else {
				printf("%s\n",
				       tgts2str(tgts_buf, sizeof(tgts_buf),
						tgts, 0));
			}
			continue;
		}

		printf("  %s whitelist  %d entries\n",
		       (cmn_wf.wtbl_fgs & WHITE_FG_PER_USER)
		       ? "per-user" : "global",
		       cmn_wf.wtbl->hdr.entries);

		if (0 > fstat(cmn_wf.ht_fd, &ht_sb)) {
			dcc_error_msg("stat(%s): %s",
				      cmn_wf.ht_nm, ERROR_STR());
			exit(EX_DATAERR);
		}

		if (0 > stat(cmn_wf.ascii_nm, &ascii_sb)) {
			dcc_error_msg("stat(%s): %s",
				      cmn_wf.ascii_nm, ERROR_STR());
		} else if (ht_sb.st_mtime < ascii_sb.st_mtime) {
			printf("    %s is older than %s\n",
			       cmn_wf.ht_nm, cmn_wf.ascii_nm);
		}

		if (cmn_wf.wtbl->hdr.ascii_mtime == 0) {
			printf("    %s broken\n", cmn_wf.ht_nm);
		} else if (cmn_wf.wtbl->hdr.ascii_mtime != ascii_sb.st_mtime) {
			printf("    %s has timestamp %s\n"
			       "\tfor %s which has mtime %s\n",
			       cmn_wf.ht_nm,
			       ts2buf(cmn_wf.wtbl->hdr.ascii_mtime),
			       cmn_wf.ascii_nm,
			       ts2buf(ascii_sb.st_mtime));
		}

		if (cmn_wf.wtbl->hdr.broken != 0)
			printf("    %s broken until %s\n",
			       cmn_wf.ht_nm,
			       ts2buf(cmn_wf.wtbl->hdr.broken));
		if (cmn_wf.wtbl->hdr.reparse != 0)
			printf("    re-parse %s for errors after %s\n",
			       cmn_wf.ascii_nm,
			       ts2buf(cmn_wf.wtbl->hdr.reparse));

		if (cmn_wf.wtbl->hdr.fgs & WHITE_FG_HOSTNAMES) {
			printf("    resolve host names after %s\n",
			       ts2buf(ht_sb.st_mtime + DCC_WHITECLNT_RESOLVE));
		} else if (!(cmn_wf.wtbl->hdr.fgs & WHITE_FG_PER_USER)) {
			printf("    contains no host names\n");
		}

		for (i = 0; i < DIM(cmn_wf.wtbl->hdr.white_incs); ++i) {
			if (cmn_wf.wtbl->hdr.white_incs[i].nm[0] == '\0')
				break;
			if (!i)
				printf("    includes\n");
			printf("      %s\n",
			       dcc_fnm2abs_msg(tmp,
					       cmn_wf.wtbl ->hdr.white_incs[
							i].nm));
			if (0 > stat(cmn_wf.wtbl->hdr.white_incs[i].nm,
				     &inc_sb)) {
				dcc_error_msg("stat(%s): %s",
					      cmn_wf.ascii_nm, ERROR_STR());
			} else if (ht_sb.st_mtime < inc_sb.st_mtime) {
				printf("    %s is older than %s"
				       " and needs rebuilding\n",
				       cmn_wf.ht_nm,
				       dcc_path2fnm(cmn_wf.wtbl->hdr.white_incs[i
							].nm));
			}
		}
		if (cmn_wf.wtbl_sws & WHITE_SW_DCC_ON)
			printf("    option DCC-on\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_DCC_OFF)
			printf("    option DCC-off\n");

		if (cmn_wf.wtbl_sws & WHITE_SW_REP_ON)
			printf("    option dcc-rep-on\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_REP_OFF)
			printf("    option dcc-rep-off\n");

		if (cmn_wf.wtbl_sws & WHITE_SW_GREY_ON)
			printf("    option greylist-on\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_GREY_OFF)
			printf("    option greylist-off\n");

		if (cmn_wf.wtbl_sws & WHITE_SW_GREY_SPAM_ON)
			printf("    option greylist-ignore-spam-on\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_GREY_SPAM_OFF)
			printf("    option greylist-ignore-spam-off\n");

		if (cmn_wf.wtbl_sws & WHITE_SW_LOG_ALL)
			printf("    option log-all\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_LOG_NORMAL)
			printf("    option log-normal\n");

		if (cmn_wf.wtbl_sws & WHITE_SW_LOG_D)
			printf("    option log-subdirectory-day\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_LOG_H)
			printf("    option log-subdirectory-hour\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_LOG_M)
			printf("    option log-subdirectory-minute\n");


		if (cmn_wf.wtbl_sws & WHITE_SW_GREY_LOG_ON)
			printf("    option greylist-log-on\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_GREY_LOG_OFF)
			printf("    option greylist-log-off\n");

		if (cmn_wf.wtbl_sws & WHITE_SW_MTA_FIRST)
			printf("    option MTA-first\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_MTA_LAST)
			printf("    option MTA-last\n");

		for (i = 0; i < NUM_DNSBL_GROUPS; ++i) {
			if (cmn_wf.wtbl_sws & WHITE_SW_DNSBL_ON(i))
				printf("    option DNSBL%d-on\n", i+1);
			if (cmn_wf.wtbl_sws & WHITE_SW_DNSBL_OFF(i))
				printf("    option DNSBL%d-off\n", i+1);
		}

		if (cmn_wf.wtbl_sws & WHITE_SW_DISCARD_OK)
			printf("    option forced-discard-ok\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_DISCARD_NO)
			printf("    option no-forced-discard\n");

		if (cmn_wf.wtbl_sws & WHITE_SW_TRAP_NOT)
			printf("    option "DCC_XHDR_TRAP_NOT"\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_TRAP_DIS)
			printf("    option "DCC_XHDR_TRAP_DIS"\n");
		if (cmn_wf.wtbl_sws & WHITE_SW_TRAP_REJ)
			printf("    option "DCC_XHDR_TRAP_REJ"\n");

		for (type = DCC_CK_TYPE_FIRST;
		     type <= DCC_CK_TYPE_LAST;
		     ++type) {
			tgts = cmn_wf.wtbl->hdr.tholds_rej.t[type];
			if (tgts == THOLD_UNSET)
				continue;
			printf("    option threshold %s,%s\n",
			       type2str_err(type, 0, 0, 0),
			       thold2str(tgts_buf, sizeof(tgts_buf),
					 type, tgts));
		}

		printf("\n    file checksum %s\n",
		       ck2str_err(0, &cmn_wf.wtbl->hdr.ck_sum, 0));

		if (quiet)
			continue;

		/* display ranges of IP addresses */
		heading = 0;
		for (i = 0; i < cmn_wf.wtbl->hdr.ranges.len; ++i) {
			WHITE_IP_RANGE *r;

			if (!heading) {
				heading = 1;
				fputs("\n IP address blocks\n", stdout);
			}
			r = &cmn_wf.wtbl->hdr.ranges.rs[i];
			printf("%6s  %s\n",
			       tgts2str(tgts_buf, sizeof(tgts_buf), r->tgts, 0),
			       range2str(range_buf, sizeof(range_buf),
					 &r->range));
		}
		if (heading)
			putchar('\n');

		/* first the hash table */
		fputs("\n hash table\n", stdout);
		col = 0;
		for (inx = 0; inx < DIM(cmn_wf.wtbl->bins); ++inx) {
			if (!cmn_wf.wtbl->bins[inx]
			    && col == 0
			    && inx != 0) {
				inx2 = inx;
				while (inx2 < DIM(cmn_wf.wtbl->bins)
				       && !cmn_wf.wtbl->bins[inx2])
					++inx2;
				i = inx2 - inx;
				i -= i % 4;
				if (i != 0) {
					printf(" ...\n");
					inx += i;
				}
			}
			printf("%4d:", inx);
			if (cmn_wf.wtbl->bins[inx]) {
				printf("%-4d", cmn_wf.wtbl->bins[inx]);
			} else {
				printf("    ");
			}
			col = (col + 1) % 4;
			putchar(col == 0 ? '\n' : '\t');
		}

		/* then the entries */
		printf("\n\n%4s->%-4s  %12s  %6s\n",
		       "slot", "next", "type", "count");
		for (inx = 0; inx < cmn_wf.wtbl_entries; ++inx) {
			WHITE_ENTRY *e = &cmn_wf.wtbl->tbl[inx];
			if (e->type == DCC_CK_INVALID)
				continue;
			printf("%4d->%-4d  %12s  %6s  %s\n",
			       inx, e->fwd,
			       type2str_err(e->type, 0, 0, 0),
			       tgts2str(tgts_buf, sizeof(tgts_buf), e->tgts, 0),
			       ck2str_err(e->type, &e->sum, 0));
		}
	}
	exit(EX_OK);
}
Esempio n. 7
0
File: wf.c Progetto: ashh87/opendab
int main (int argc, char **argv)
{
	struct selsrv sel_srv;
        char outfile[80] = "";
	char devname[80] = "/dev/wavefinder0";
	char ficfile[80] = "fic.dat";
	unsigned char *prsbuf, *symstr;
	/* Select all symbols by default */
	unsigned char selstr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
	/* Use this before changing the symbol selection */
 	unsigned char chgstr[] = {0x00, 0xf0, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11};
        const char usage[] = " is part of OpenDAB. Distributed under the GPL V.3\nUsage: wf [-f] [-d outfile] [-w devname][freq]\n-d dumps ensemble to outfile caution - huge!\n-w uses Wavefinder devname\n-f generates FIC file 'fic.dat' (ignored if '-d' specified)\nfreq defaults to 225.648MHz (BBC National DAB)";	
	int fd, k, nargs, sym;
        int l = 0, gen_fic = 0, gen_dump = 0;
	int slock = 0, enslistvisible = 0;
	int synccnt = 0, selected = 0;

	/* double freq = 218.640;*/ /* DRg */
	/* double freq = 222.064;*/ /* Digital 1 */
	/* double freq = 223.936;*/
	double freq = 225.648; /* BBC */
	/* double freq = 227.360;*/

	
        nargs = argc;
        while (nargs-- > 1) {
                if (*argv[argc-nargs] == '-') {
                        switch (*(argv[argc-nargs]+1)) {
                        case 'd':
                                /* Set output filename */
                                if (strcmp(argv[argc-nargs], "-d") == 0) {
					if (--nargs) {
						strcpy(outfile, argv[argc-(nargs)]);
						gen_dump = 1;
					} else {
						fprintf(stderr,"Please supply a filename for -d\n");
						fprintf(stderr,"%s %s\n", argv[0], usage);
						exit(EXIT_FAILURE);
					}
					 break;	
				}
                                break;
			case 'w':
				/* Set device name */
				if (strcmp(argv[argc-nargs], "-w") == 0) {
					if (--nargs) {
						strcpy(devname, argv[argc-(nargs)]);
					} else {
						fprintf(stderr,"Please supply a device name for -w\n");
						fprintf(stderr,"%s %s\n", argv[0], usage);
						exit(EXIT_FAILURE);
					}
					 break;	
				}
                                break;
                        case 'f':
                                if (strcmp(argv[argc-nargs], "-f") == 0)
                                        gen_fic = 1;
                                break;
                        case 'h':
                                printf("%s %s\n", argv[0], usage);
                                exit(EXIT_SUCCESS);
                                break;
			};
		} else
			sscanf(argv[argc-nargs],"%le",&freq);
	}
	/* Open WaveFinder */	
	fd = open(devname,O_RDWR);
	if (fd == -1) {
		perror(devname);
		exit(EXIT_FAILURE);
	}

	wfcatch(fd);   /* Install handler to catch SIGTERM */

	if (gen_dump) {
		if ((of = fopen(outfile,"w")) == NULL) {
			perror("Output file open failed");
			wf_close(fd);
		}
	} else if (gen_fic)
		if ((ffp = fopen(ficfile,"w")) == NULL) {
			perror("FIC output file open failed");
			wf_close(fd);
		}

	
	/* Initialize synchronization system - PRS data, storage etc */
	wfsyncinit(fd);

	/* Initialize read buffer storage */
	if ((rdbuf = calloc(PIPESIZE, sizeof(unsigned char))) == NULL) {
		fprintf(stderr,"main: calloc failed for rdbuf");
		wf_close(fd);
	}

	if ((prsbuf = calloc(0x800, sizeof(unsigned char))) == NULL) {
		fprintf(stderr,"main: calloc failed for prsbuf");
		wf_close(fd);
	}

	/* Allocate storage for symbols 2, 3 and 4 which comprise the FIC */
	if ((fsyms = calloc(384 * 3, sizeof(unsigned char))) == NULL) {
		fprintf(stderr,"main: calloc failed for fsyms");
		wf_close(fd);
	}

	/* Allocate storage for decoded, but "unparsed" FIC
	   - allow for 16 FIBs, each minus its CRC
	*/
	if ((rfibs = calloc(360*16, sizeof(unsigned char))) == NULL) {
		fprintf(stderr,"main: calloc failed for rfibs");
		wf_close(fd);
	}

	if (!gen_dump) {
		sel_srv.sch = (struct subch *)NULL;
		ficinit(&einf);
	}

	/* Initalize Wavefinder */
	fprintf(stderr,"Initialization ");
	wf_init(fd, freq);
	fprintf(stderr,"complete.\n");

	symstr = selstr;

	fprintf(stderr,"Sync ");
	for (;;) {
		wf_read(fd, rdbuf, &l);
		for (k=0; k < l; k+=524) {
			if (*(rdbuf+9+k) == 0x02) {
				if (synccnt > 0) {
					symstr = chgstr;
					synccnt--;
				} else
					symstr = selstr;	
				prs_assemble(fd, rdbuf, prsbuf, symstr, k); /* Sync */
			}
			if (sync_locked && !slock) {
				slock = 1;
				fprintf(stderr,"locked.\n");
			}
			if (gen_dump && (*(rdbuf+9+k) == 0x01))
				fwrite(rdbuf+k, sizeof(unsigned char), 524, of);
			else
				/* Wait for sync to lock or things might get slowed down too much */
				if (sync_locked) {
					if ((fibcnt < MAXFIBS) && !labelled(&einf)) {
						sym = *(rdbuf+2+k);
						if ((sym == 2)||(sym == 3)||(sym == 4))
							fic_assemble(rdbuf+k, fsyms, rfibs, ffp);
					} else {
						if (!enslistvisible) {
							disp_ensemble(&einf);
							enslistvisible = 1;
						}
						if (sel_srv.sch == NULL)
							user_select_service(&einf, &sel_srv);
						else {
							if (!selected && (sel_srv.sch->subchid < 64)) {
								startsym(&sel_srv.sr, sel_srv.sch);
								wfsymsel(selstr, &sel_srv.sr);
								selected = 1;
								synccnt = 6;
								fprintf(stderr,"Type ctrl-c to quit\n");
							}
							if ((synccnt == 0) && (*(rdbuf+2+k) > 4))
                                                          msc_assemble(rdbuf+k, sel_srv.sch, &sel_srv.sr);
						}
					}
				}
		}
	}
	exit(EXIT_SUCCESS);	
}