File: edit.c

package info (click to toggle)
euler 1.61.0-12
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 5,164 kB
  • sloc: ansic: 24,761; sh: 8,314; makefile: 141; cpp: 47; php: 1
file content (46 lines) | stat: -rw-r--r-- 692 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <ctype.h>
#include <string.h>

#include "sysdep.h"
#include "output.h"
#include "graphics.h"
#include "mainloop.h"

char fktext [10][64];

extern int outputing;
int nojump;


static void prompt (void)
{	if (!outputing) gprint("\n>");
	if (!udf) output(">");
	else output("$");
}


static char *editline;

/* For external use in notebooks */
void set_editline (char *p)
{   strcpy(editline,p);
}

void edit (char *s)
{	int scan;
	char ch;
	
	editline=s;
	s[0]=0;
	prompt();
	edit_on();
	while (1)
	{	ch=wait_key(&scan);
		if (scan==switch_screen) show_graphics();
		if (scan==enter) break;
	}
	if (outfile) fprintf(outfile,"%s",s);
    edit_off();
	output("\n");
}