Exemplo n.º 1
1
static int print_anyway(int ph, FILE *fp)
{
	Widget ow;
	unsigned int width = plugin[ph].width;
	unsigned int height = plugin[ph].height;
	int i;

	ow = XtVaCreatePopupShell("plugin_print",
		overrideShellWidgetClass, topLevel,
		XtNx, 0, XtNy, 0,
		XtNwidth, width, XtNheight, height,
		(char *)0);
	XtPopup(ow, XtGrabNone);
	XSync(XtDisplay(ow), False);
	for (i = 0; i < 1 /*REPARENT_LOOPS*/; i++) {
		XReparentWindow(XtDisplay(topLevel), plugin[ph].victim,
			XtWindow(ow), 0, 0);
		XSync(XtDisplay(topLevel), False);
		XClearWindow(XtDisplay(topLevel), plugin[ph].victim);
		XSync(XtDisplay(topLevel), False);
	}

	/* print */
	prnt(plugin[ph].victim /*pixmap*/, fp);

	/* finished printing */

	for (i = 0; i < 1 /*REPARENT_LOOPS*/; i++) {
		XReparentWindow(XtDisplay(topLevel), plugin[ph].victim,
			XtWindow(plugin[ph].core), 2, 2);
		XSync(XtDisplay(topLevel), False);
	}
	XtDestroyWidget(ow);
	return 0;
}
Exemplo n.º 2
0
void mem_config(const picopass_hdr *hdr)
{
	uint8_t mem = hdr->conf.mem_config;
	if( isset (mem, 0x80)) prnt("	Mem: 16KBits (255 * 8 bytes)");
	else prnt("	Mem: 2 KBits ( 32 * 8 bytes)");

}
Exemplo n.º 3
0
void display_cb(char cb[6][3][3])
{
cout<<"\n";
int i,j=0,y=0,o;
while(y<6)
{
for(i=0;i<3;i++)
for(o=0;o<2;o++)
{
while(y%2==0 || j!=3)
{
if(j==3)
{
cout<<"\t";
j=0;
y++;
}
prnt(cb[y][i][j]);
prnt(cb[y][i][j]);
j++;
}
y--;
j=0;
cout<<"\n";
}
cout<<"\n";
y+=2;
}
textcolor(WHITE);
}
Exemplo n.º 4
0
void TQueue::print() {
#if FAST_LEAST
	if (least_) {
		prnt(least_, 0);
	}
#endif
	spscan(prnt, nil, sptree_);
	for (TQItem* q = fifo_->first(); q; q = fifo_->next(q)) {
		prnt(q, 0);
	}
}
int main() {
	int i,j,N,pi,pj,val;
	scanf("%d",&N);
	for(i=0;i<N;i++) scanf(" %c ",S+i);
	i=0,j=N-1;
	while(i<=j) {
		if(S[i]<S[j])		{prnt(S[i]);i++;}
		else if(S[i]>S[j])	{prnt(S[j]);j--;}
		else {
			pi=i+1;pj=j-1;val=S[i];
			while( pj-pi>1 && S[pi]==S[pj]) {pi++,pj--;}
			if(S[pi]<S[pj]) prnt(S[i]),i++;
			else prnt(S[j]),j--;
		}
	}
	printf("\n");
	return 0;
}
Exemplo n.º 6
0
void TQueue::print() {
#if FAST_LEAST
	if (least_) {
		prnt(least_, 0);
	}
#endif
	spscan(prnt, nil, sptree_);
	spscan(prnt, nil, sptree2_);
}
Exemplo n.º 7
0
// I don't really understand why this works but it does!
// SP193 - FIXME: fix the kprintf() stuff, so that this ugly hack can RIP. :(
int __vsprintf(char * str, const char * format, va_list ap)
{
    int arg1, arg2, arg3, arg4, arg5;
    arg1 = va_arg(ap,int);
    arg2 = va_arg(ap,int);
    arg3 = va_arg(ap,int);
    arg4 = va_arg(ap,int);
    arg5 = va_arg(ap,int);

    return prnt((print_callback_t) sprintf_putchar, &str, format, ap);
}
Exemplo n.º 8
0
Arquivo: stdio.c Projeto: esxgx/uofw
int printf(const char *fmt, ...)
{
    dbg_printf("Calling %s\n", __FUNCTION__);
    va_list ap;
    char sp[164];
    va_start(ap, fmt);
    *(short*)((int)sp + 0) = STDOUT;
    *(short*)((int)sp + 2) = 0;
    int n = prnt(printf_char, sp, fmt, ap);
    va_end(ap);
    return n;
}
Exemplo n.º 9
0
int shprintf(const char *fmt, ...)
{
	struct prnt_ctx ctx;
	va_list opt;

	ctx.len = 0;

	va_start(opt, fmt);

	prnt((prnt_callback) cb, (void*) &ctx, fmt, opt);

	va_end(opt);

	return 0;
}
Exemplo n.º 10
0
int shprintfex(const char *fmt, ...)
{
	char szfmt[1024];
	struct prnt_ctx ctx;
	va_list opt;

	sprintf(szfmt, "\xff %s \xfe", fmt);
	ctx.len = 0;

	va_start(opt, szfmt);

	prnt((prnt_callback) cb, (void*) &ctx, szfmt , opt);

	va_end(opt);

	return 0;
}
Exemplo n.º 11
0
/******************
   cMsgBytes
   Send a byte array message, expect an ACK
*/
int LoRaModem::cMsgBytes(uint8_t * bytes, int16_t length) {

  _LoRaSerial.read();
  _LoRaSerial.print("AT+CMSGHEX=\"");

  do {
    prnt("%02x", *bytes++);
  } while (--length);

  _LoRaSerial.println("\"");

  if (_checkresponse(".+ACK Received.+CMSGHEX: Done"))
  {
    return 1;
  }

  return 0;
};
Exemplo n.º 12
0
/*
 * Perform a call on res_query on the concatenation of name and domain,
 * removing a trailing dot from name if domain is NULL.
 */
static void
nres_querydomain(char *name, char *domain, char *nbuf)
{
	int		n;

	if (domain == NULL) {
		/*
		 * Check for trailing '.'; copy without '.' if present.
		 */
		n = strlen(name) - 1;
		if (name[n] == '.') {
			(void) memcpy(nbuf, name, n);
			nbuf[n] = '\0';
		} else
			(void) strcpy(nbuf, name);
	} else
		(void) sprintf(nbuf, "%.*s.%.*s",
			MAXDNAME, name, MAXDNAME, domain);

	prnt(P_INFO, "nres_querydomain(, %s).\n", nbuf);
}
/* exercise4-5 - Add access to library functions like sin, exp, and pow.
 * See <math.h> in Appendix B, Section 4. 
 * 
 * exercise4-5_main.c - reverse Polish calculator */
int main()
{
	int type;
	double op1, op2;
	char s[MAXOP];
	int ispop;     /* when 0, a value from the stack will not be popped upon newline */
	
	ispop = 1;
	
	while ((type = getop(s)) != EOF)
	{
		switch (type)
		{
			case NUMBER:
				push(atof(s));
				break;
			case '+':
				push(pop() + pop());
				break;
			case '*':
				push(pop() * pop());
				break;
			case '-':
				op2 = pop();
				push(pop() - op2);
				break;
			case '/':
				op2 = pop();
				if (op2 != 0.0)
					push(pop() / op2);
				else
					printf("error: zero divisor\n");
				break;
			case '%':
				op2 = pop();
				if (op2 != 0.0)
					push((long) pop() % (long) op2);
				else
					printf("error: zero divisor\n");
				break;
			case '\n':
				if (ispop == 0)
				{
					ispop = 1;
				}
				else
				{
					printf("\t%.8g\n", pop());
				}
				break;
			case SYMBOL:
				if (strcmp(s, "print") == 0)
				{
					prnt();
					ispop = 0;
				}
				/* stack commands */
				else if (strcmp(s, "duplicate") == 0)
				{
					duplicate();
					ispop = 0;
				}
				else if (strcmp(s, "swap") == 0)
				{
					swap();
					ispop = 0;
				}
				else if (strcmp(s, "clear") == 0)
				{
					clear();
					ispop = 0;
				}
				/* math commands */
				else if (strcmp(s, "sin") == 0)
				{
					push(sin(pop()));
				}
				else if (strcmp(s, "cos") == 0)
				{
					push(cos(pop()));
				}
				else if (strcmp(s, "tan") == 0)
				{
					push(tan(pop()));
				}
				else if (strcmp(s, "exp") == 0)
				{
					push(exp(pop()));
				}
				else if (strcmp(s, "log") == 0)
				{
					push(log(pop()));
				}
				else if (strcmp(s, "pow") == 0)
				{
					op2 = pop();
					op1 = pop();
					if (op1 == 0.0 && op2 <= 0.0)
						printf("error: base is 0 and exponent is 0 or less\n");
					else if (op1 <= 0.0 && floor(op2) != op2)
						printf("error: base is less than 0 and exponent is not an integer\n");
					else
					push(pow(op1, op2));
				}
				else
				{
					printf("error: unknown symbol/command %s\n", s);
				}
				break;
			default:
				printf("error: unknown command %s\n", s);
				break;
		}
	}
	
	return 0;
}
Exemplo n.º 14
0
void fuse_config(const picopass_hdr *hdr)
{
	uint8_t fuses = hdr->conf.fuses;

	if (isset(fuses,FUSE_FPERS))prnt("	Mode: Personalization [Programmable]");
	else prnt("	Mode: Application [Locked]");

	if (isset(fuses, FUSE_CODING1))
		prnt("	Coding: RFU");
	else
	{
		if( isset( fuses , FUSE_CODING0)) prnt("	Coding: ISO 14443-2 B/ISO 15693");
		else prnt("	Coding: ISO 14443B only");
	}
	if( isset (fuses,FUSE_CRYPT1 | FUSE_CRYPT0 )) prnt("	Crypt: Secured page, keys not locked");
	if( isset (fuses,FUSE_CRYPT1) && notset( fuses, FUSE_CRYPT0 )) prnt("	Crypt: Secured page, keys not locked");
	if( notset (fuses,FUSE_CRYPT1) && isset( fuses, FUSE_CRYPT0 )) prnt("	Crypt: Non secured page");
	if( notset (fuses,FUSE_CRYPT1) && notset( fuses, FUSE_CRYPT0 )) prnt("	Crypt: No auth possible. Read only if RA is enabled");

	if( isset( fuses, FUSE_RA)) prnt("	RA: Read access enabled");
	else prnt("	RA: Read access not enabled");
}
Exemplo n.º 15
0
void applimit_config(const picopass_hdr *hdr)
{
	uint8_t applimit = hdr->conf.app_limit;
	prnt("	AA1: blocks 6-%d", applimit);
	prnt("	AA2: blocks %d-", (applimit+1));
}
/* exercise4-7 - Write a routine ungets(s) that will push back an entire
 * string onto the input.  Should ungets know about buf and bufp, or
 * should it just use ungetch?
 * 
 * exercise4-7_main.c - reverse Polish calculator */
int main()
{
	int type;
	double op1, op2;
	double ans;    /* most recently printed value */
	char s[MAXOP];
	int ispop;     /* when 0, a value from the stack will not be popped upon newline */
	int varindex;  /* index of variable name and value for variable operations */
	int i;
	
	ispop = 1;
	
	while ((type = getop(s)) != EOF)
	{
		switch (type)
		{
			case NUMBER:
				push(atof(s));
				break;
			case ERROR:
				printf("%s", s);
				break;
			case '+':
				push(pop() + pop());
				break;
			case '*':
				push(pop() * pop());
				break;
			case '-':
				op2 = pop();
				push(pop() - op2);
				break;
			case '/':
				op2 = pop();
				if (op2 != 0.0)
					push(pop() / op2);
				else
					printf("error: zero divisor\n");
				break;
			case '%':
				op2 = pop();
				if (op2 != 0.0)
					push((long) pop() % (long) op2);
				else
					printf("error: zero divisor\n");
				break;
			case '\n':
				if (ispop == 0)
				{
					ispop = 1;
				}
				else
				{
					printf("\t%.8g\n", (ans = pop()));
				}
				break;
			case SYMBOL:
				/* stack commands */
				if (strcmp(s, "print") == 0)
				{
					prnt();
					ispop = 0;
				}
				else if (strcmp(s, "duplicate") == 0)
				{
					duplicate();
					ispop = 0;
				}
				else if (strcmp(s, "swap") == 0)
				{
					swap();
					ispop = 0;
				}
				else if (strcmp(s, "clear") == 0)
				{
					clear();
					ispop = 0;
				}
				/* math commands */
				else if (strcmp(s, "sin") == 0)
				{
					push(sin(pop()));
				}
				else if (strcmp(s, "cos") == 0)
				{
					push(cos(pop()));
				}
				else if (strcmp(s, "tan") == 0)
				{
					push(tan(pop()));
				}
				else if (strcmp(s, "exp") == 0)
				{
					push(exp(pop()));
				}
				else if (strcmp(s, "log") == 0)
				{
					push(log(pop()));
				}
				else if (strcmp(s, "pow") == 0)
				{
					op2 = pop();
					op1 = pop();
					if (op1 == 0.0 && op2 <= 0.0)
						printf("error: base is 0 and exponent is 0 or less\n");
					else if (op1 <= 0.0 && floor(op2) != op2)
						printf("error: base is less than 0 and exponent is not an integer\n");
					else
					push(pow(op1, op2));
				}
				else if (strcmp(s, "ans") == 0)
				{
					push(ans);
				}
				/* set variable */
				else if (strncmp(s, "assignto:", 9) == 0)
				{
					for (i = 0; s[i+9] != '\0'; i++)
						s[i] = s[i+9];
					s[i] = '\0';
					if (strcmp(s, "") != 0)
						setvar(s, pop());
					else
						printf("error: cannot assign variable with no variable name\n");
				}
				else if (strncmp(s, "delvar:", 7) == 0)
				{
					for (i = 0; s[i+7] != '\0'; i++)
						s[i] = s[i+7];
					s[i] = '\0';
					delvar(s);
				}
				/* variable recall and default */
				else
				{
					if ((varindex = getvarindex(s)) >= 0)
						push(getvar(varindex));
					else
						printf("error: unknown symbol/command %s\n", s);
				}
				break;
			default:
				printf("error: unknown command %s\n", s);
				break;
		}
	}
	
	return 0;
}
Exemplo n.º 17
0
Arquivo: main.c Projeto: pt300/paSpec
int main(void) {
    struct winsize w;
    static pa_simple *server;

    ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); //get info on size of screen

    if(w.ws_col < 5 | w.ws_row < 5) {
        puts("Fix your terminal m9.");
        exit(1);
    }

    float read_buffer[N]; //buffer into which data will be read
    double end_buffer[N]; //buffer used as input to fftw
    fftw_complex out[N]; //buffer for output from fftw
#ifdef SMOOTHING
    unsigned int avg[SMOOTHING][w.ws_col];
#endif
    char current = 0;
    unsigned int col;
    long unsigned int i;
#ifdef SMOOTHING
    i = SMOOTHING;
    while(i--)
        memset(avg[i], 0, sizeof(unsigned int) * w.ws_col);
#endif

    server = pulseaudio_begin();

    setup_screen();

    printf("\e[1;1HAttempting search for most efficient DFT algorithm... FFTW_PATIENT");
    fflush(stdout);

    fftw_plan p = fftw_plan_dft_r2c_1d(N, end_buffer, out, FFTW_PATIENT);

    while(run) {

        pulseaudio_read(server, read_buffer, N);

        for(i = 0; i < N; i++) {
            end_buffer[i] = (read_buffer[i] * (0.5f * (1 - cos(2 * PI * i / (N - 1))))) * INPUT_AMPLIFY; //apply hann window
        }

        fftw_execute(p);

        printf("\e[f");
#ifdef LOG
        unsigned int last = 0;
#endif
        for(i = 1; i < w.ws_col + 1; i++) {
            double freq_logvalue;
#ifdef LOG
            unsigned long int pos = i * i * ((N - TOP_FREQ_SUB) / 2) / (w.ws_col*w.ws_col);

            if(pos<=last)
                pos = last + 1;

            if(pos >= N/2)
                pos = N/2 - 1;

            last = (unsigned int) pos;

            freq_logvalue = log10(cabs(out[pos]) / (N / 2)) * AMPLIFY; //normalize
#else
            freq_logvalue = log10(cabs(out[i * ((N - TOP_FREQ_SUB) / 2) / w.ws_col]) / (N / 2)) * AMPLIFY;
#endif
            freq_logvalue = 1 - (freq_logvalue > -CUTOFF ? freq_logvalue : -CUTOFF) / -CUTOFF; //cut out at -80
            col = (unsigned int) ((freq_logvalue > 1 ? 1 : freq_logvalue) * w.ws_row);
#ifdef SMOOTHING
            avg[current][i - 1] = col;
        }

        current++;
        if(current == SMOOTHING)
            current = 0;

        for(i = 1; i < w.ws_col + 1; i++) {

            //col = (avg[0][i - 1] + avg[1][i - 1]) / 2;
            unsigned char sm = SMOOTHING;
            col = 0;

            while(sm--) {
                col += avg[sm][i - 1];
            }
            col /= SMOOTHING;
#endif
            puts("\e[1;1H");

            if(col > (unsigned int) (0.75 * w.ws_row))
                puts("\e[31m");
            else if(col > (unsigned int) (0.55 * w.ws_row))
                puts("\e[33m");
            else
                puts("\e[32m");

            prnt('|', col, (unsigned int) i, w.ws_row);
            prnt(' ', w.ws_row - col, (unsigned int) i, w.ws_row - col);
        }
        fflush(stdout);
        //gotta go faster than that TODO: add some timing functions to cap framerate
    }

    clean_screen();

    pulseaudio_end(server);

    return EXIT_SUCCESS;
}
Exemplo n.º 18
0
int KReportItemText::renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset,
                                       const QVariant &data, KReportScriptHandler *script)

{
    Q_UNUSED(script);

    QString qstrValue;

    QString cs = itemDataSource();

    if (!cs.isEmpty()) {
        if (cs.left(1) == QLatin1String("$")) { //Everything past $ is treated as a string
            qstrValue = cs.mid(1);
        } else {
            qstrValue = data.toString();
        }
    } else {
        qstrValue = m_itemValue->value().toString();
    }

    QPointF pos = m_pos.toScene();
    QSizeF size = m_size.toScene();
    pos += offset;

    QRectF trf(pos, size);
    qreal intStretch = trf.top() - offset.y();

    if (qstrValue.length()) {
        QRectF rect = trf;

        int pos = 0;
        QChar separator;
        QRegExp re(QLatin1String("\\s"));
        QPrinter prnt(QPrinter::HighResolution);
        QFontMetrics fm(font(), &prnt);

        // int   intRectWidth    = (int)(trf.width() * prnt.resolution()) - 10;
        int     intRectWidth    = (int)((m_size.toPoint().width() / 72) * prnt.resolution());
        int     intLineCounter  = 0;
        qreal   intBaseTop      = trf.top();
        qreal   intRectHeight   = trf.height();

        while (qstrValue.length()) {
            int idx = re.indexIn(qstrValue, pos);
            if (idx == -1) {
                idx = qstrValue.length();
                separator = QLatin1Char('\n');
            } else
                separator = qstrValue.at(idx);

            if (fm.boundingRect(qstrValue.left(idx)).width() < intRectWidth || pos == 0) {
                pos = idx + 1;
                if (separator == QLatin1Char('\n')) {
                    QString line = qstrValue.left(idx);

                    qstrValue.remove(0, idx + 1);

                    pos = 0;

                    rect.setTop(intBaseTop + (intLineCounter * intRectHeight));
                    rect.setBottom(rect.top() + intRectHeight);

                    OROTextBox * tb = new OROTextBox();
                    tb->setPosition(rect.topLeft());
                    tb->setSize(rect.size());
                    tb->setFont(font());
                    tb->setText(line);
                    tb->setFlags(textFlags());
                    tb->setTextStyle(textStyle());
                    tb->setLineStyle(lineStyle());

                    if (page) {
                        page->addPrimitive(tb);
                    }

                    if (section) {
                        OROTextBox *tb2 = dynamic_cast<OROTextBox*>(tb->clone());
                        tb2->setPosition(m_pos.toPoint());
                        section->addPrimitive(tb2);
                    }

                    if (!page) {
                        delete tb;
                    }

                    intStretch += intRectHeight;
                    intLineCounter++;
                }
            } else {
                QString line = qstrValue.left(pos - 1);
                qstrValue.remove(0, pos);
                pos = 0;

                rect.setTop(intBaseTop + (intLineCounter * intRectHeight));
                rect.setBottom(rect.top() + intRectHeight);

                OROTextBox * tb = new OROTextBox();
                tb->setPosition(rect.topLeft());
                tb->setSize(rect.size());
                tb->setFont(font());
                tb->setText(line);
                tb->setFlags(textFlags());
                tb->setTextStyle(textStyle());
                tb->setLineStyle(lineStyle());
                if (page) page->addPrimitive(tb);

                intStretch += intRectHeight;
                intLineCounter++;
            }
        }

        intStretch += (m_bottomPadding / 100.0);
    }

    return intStretch; //Item returns its required section height
}
Exemplo n.º 19
0
int exec_cmd(int under_glob, int under_until)
	{
	register int status;
	register char *p;
	int n;

	if((status = getrange()) <= ERROR)
		return( status );
	status = ERROR9;

	switch( *lp++ ) {

	case 'i':
		laddr2 = prevln(laddr2);

	case 'a':
		status = append(laddr2, under_glob);
		break;

	case 'b':
			if(!under_glob  &&  !under_until)
				status = branch();
		break;

	case 'c':
		if((status = delete(laddr1, laddr2, SAVE)) == OK)
			status = append(prevln(laddr1), under_glob);
		break;

	case 'd':
		if((status = delete(laddr1, laddr2, SAVE)) == OK && nextln(curln) != 0)
			curln = nextln(curln);
		break;

	case 'e':
		if(lastln  &&  dirty  &&  *lp != 'e') {
			status = ERROR4;
			break;
			}

		if(*lp == 'e')
			++lp;

		if(nladdrs == 0  &&  !under_glob  &&  !under_until  &&
			(status = getfn()) == OK) {
			set_fn(curfile, lp);
			if(lastln != 0)
				delete(1, lastln, NOSAVE);
			num_delete_lines = 0;
			if((status = _read( lp, 0, 0)) == OK) {
				dirty = 0;
				if(lastln)
					curln = 1;
				}
			}
		lp = "\n";
		break;

	case 'f':
		if(nladdrs == 0  &&  (status = getfn()) == OK) {
			set_fn(curfile, lp);
			putmsg(curfile);
			lp = "\n";
			}
		change_state(CMD);
		break;

	case 'g':
		if(!under_glob) {
			if(*lp == '^') {
				++lp;
				n = 0;
				}
			else
				n = 1;
			status = exec_glob(n, under_until);
			}
		break;

	case 'h':
		n = getint();
#ifndef __STDC__
		while(n--)
			for(n1 = 0; n1 < 10; ++n1)
				time_slice();
#endif
		status = OK;
		break;

	case 'j':
		status = join(laddr2);
		break;

	case 'k':
		if((status = get_laddr_expr(&n)) == OK)
			status = kopy(n);
		break;

	case 'l':
		if(nladdrs == 0)
			status = learn();
		break;

	case 'm':
		if((status = get_laddr_expr(&n)) == OK)
			status = move(n);
		break;

	case 'o':
		status = option();
		break;

	case 'p':
	case 'P':
		status = prnt(laddr1, laddr2);
		break;

	case 'q':
		if(nladdrs==0 && !under_glob) {
			if((*lp=='\n' && !dirty) || *lp=='q'  ||  lastln == 0)
				status = EOF;
			else
				status = ERROR4;
		}
		break;

	case 'r':
		if(!under_glob  &&  !under_until  &&  (status = getfn()) == OK)
			status = _read(lp, laddr2, 0);
		lp = "\n";
		break;

	case 's':
		n = getint(); /* read occurance if present */
		if((status=getpat()) == OK  &&  (status=getsubst_str(tbuff)) == OK)
			status = substitute(tbuff, under_glob, n);
		break;

	case 't':
	case 'T':
		if(nladdrs == 0)
			status = translate(*(lp - 1) == 't');
		break;

	case 'u':
		status = until(laddr1, laddr2, under_glob);
		break;

	case 'v':
		if(nladdrs <= 1)
			status = view(laddr1);
		break;

	case 'w':
		n = 0;
		if(*lp == 'w') {
			n |= 2;
			++lp;
			}
		if(*lp == 'a') {
			n |= 1;
			++lp;
			}

		if((status = getfn()) == OK) {
			if(nladdrs == 0) {
				if(curfile[0] == '\0')
					set_fn(curfile, lp);
				else {
					if((n & 2) == 0  &&  strcmp(curfile, lp) != 0) {
						for(p = lp ; *p ; ++p)
							if(*p == '$')
								goto ok;
						puterr(-19);
						lp = "\n";
						break;
						}
					}
				ok:
				if((status = _write(lp, 1, lastln, n & 1, 0)) == OK)
					dirty = 0;
				}
			} else {
				status = _write(lp, laddr1, laddr2, n & 1, 0);
			}
		lp = "\n";
		break;

    case 'x':
		if(!under_glob  &&  !under_until  &&  (status = getfn()) == OK)
			if(nladdrs == 0)
				status = exec_file(lp, under_glob, under_until);
		lp = "\n";
		break;

	case 'y':
		status = yut();
		break;

	case 'z':
		status = zap();
		break;

	case '\n':
		--lp; /* put back newline for main */
		if(laddr2 < 0  ||  laddr2 > lastln)
			status = lastln ? ERROR5 : OK;
		else {
			curln = laddr2;
			status = OK;
			}
		break;

	case ' ':
	case '\t':
	case CMD_CHAR:
		status = OK;
		break;

	case '=':
		dtoc(rbuff, laddr2);
		if(under_glob)
			prnt_screen(rbuff, 1);
		else
			putmsg(rbuff);
		status = OK;
		break;

	case '"':
		lp = "\n";	/* Ignore rest of line */
		status = OK;
		break;

	case '!':
		if(escape_char == 0  ||  restrict_flag) {
			putmsg("Escape from ED inhibited");
			status = NOTHING;
			}
		else
			status = exec_sys_cmd(under_glob, under_until);
		break;

	default:
		status = ERROR2;
		}
	return(status);
	}