1 /***************************************************************************
2  * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
3  * is provided to you without charge, and with no warranty.  You may give  *
4  * away copies of JOVE, including sources, provided that this notice is    *
5  * included in all the files.                                              *
6  ***************************************************************************/
7 
8 extern char
9 /* proc.c */
10 	*MakeName proto((char *command)),
11 
12 /* ask.c */
13 	*ask_file proto((const char *prmt, char *def, char *buf)),
14 	*ask proto((char *, char *, ...)),
15 	*do_ask proto((char *, bool (*) proto((int)), char *, const char *, ...));
16 
17 extern int
18 	yes_or_no_p proto((char *, ...));
19 
20 extern void
21 	minib_add proto((char *str, bool movedown));
22 
23 extern void
24 	isprocbuf proto((char *bufname)),
25 	DoAutoExec proto((char *new, char *old));
26 
27 extern void
28 	/* extend.c */
29 	vpr_aux proto((const struct variable *, char *, size_t)),
30 
31 	/* proc.c */
32 #ifndef	MSDOS
33 	dowait proto((int pid, int *status)),
34 #endif
35 	get_FL_info proto((char *, char *)),
36 	ChkErrorLines proto((void)),
37 	ErrFree proto((void));
38 
39 extern SIGRESULT
40 /* jove.c */
41 	finish proto((int code));	/* doesn't return at all! */
42 
43 extern int
44 /* ctype.h */
45 	ismword proto((int c)),
46 
47 /* proc.c */
48 	UnixToBuf proto((char *, char *, bool, int, bool, ...)),
49 
50 /* extend.c */
51 	addgetc proto((void)),
52 	ask_int proto((char *prompt, int base)),
53 	chr_to_int proto((char *cp, int base, int allints, int *result)),
54 	complete proto((char **possible, const char *prompt, int flags)),
55 
56 /* jove.c */
57 #ifdef	MAC
58 	win_reshape proto((int /*junk*/)),
59 #endif
60 	charp proto((void)),
61 	getch proto((void)),
62 	jgetchar proto((void)),
63 	getrawinchar proto((void));
64 
65 #ifdef	LOAD_AV
66 extern int
67 	get_la proto((void));	/* integer, units of .01 */
68 
69 extern void
70 	closekmem proto((void));
71 #endif	/* LOAD_AV */
72 
73 extern bool
74 	joverc proto((char *file));
75 
76 extern void
77 	raw_scream proto((const char *)),
78 	error proto((const char *, ...)),
79 	complain proto((const char *, ...)),
80 	raw_complain proto((const char *, ...)),
81 	confirm proto((const char *, ...)),
82 	ttyset proto((bool n)),
83 	tty_reset proto ((void)),
84 	Ungetc proto((int c));
85 
86 
87 #ifdef	IBMPC
88 extern bool
89 	rawkey_ready proto((void));
90 extern char
91 	switchar proto((void));
92 #endif
93 
94 extern Bufpos
95 /* insert.c */
96 	*DoYank proto((struct line *fline, int fchar, struct line *tline, int tchar, struct line *atline, int atchar, struct buffer *whatbuf));
97 
98 extern void
99 	LineInsert proto((int num));
100 
101 /* c.c */
102 extern Bufpos
103 	*c_indent proto((int brace)),
104 	*m_paren proto((int p_type, int dir, int can_mismatch, int can_stop));
105 
106 extern void
107 	mp_error proto((void));
108 
109 extern unsigned char
110 	chpl proto((void)),
111 	lpp proto((void));
112 
113 extern void
114 	DoJustify proto((struct line *l1, int c1, struct line *l2, int c2, bool scrunch, int indent)),
115 
116 	/* abbrev.c */
117 #ifdef	ABBREV
118 	AbbrevExpand proto((void)),
119 #endif
120 
121 	/* disp.c */
122 	message proto((char *)),
123 
124 	/* insert.c */
125 #ifdef	ABBREV
126 	MaybeAbbrevExpand proto((void)),
127 #endif
128 	GCchunks proto((void)),
129 
130 	/* fmt.c */
131 	format proto((char *buf, size_t len, const char *fmt, char *ap)),
132 	add_mess proto((const char *, ...)),
133 	f_mess proto((const char *, ...)),
134 	fwritef proto((struct FileStruct *, const char *, ...)),
135 	writef proto((const char *, ...)),
136 	s_mess proto((const char *, ...)),
137 	swritef proto((char *, size_t, const char *, ...)),
138 
139 	/* keymaps.c */
140 	InitKeymaps proto((void)),
141 
142 	/* paragraph.c */
143 	do_rfill proto((bool ulm)),
144 
145 	/* macros.c */
146 	mac_init proto((void)),
147 
148 	/* misc.c */
149 	skip_wht_space proto((void)),
150 	put_bufs proto((bool askp)),
151 
152 	/* term.c */
153 #ifndef	IBMPC
154 	getTERM proto((void)),
155 #endif
156 	putpad proto((char *str, int lines)),
157 	putargpad proto((char *str, int arg, int lines)),
158 	settout proto((char *ttbuf));
159 
160 #ifdef	IBMPC
161 extern void
162 	write_em proto((char *s)),
163 	write_emc proto((char *s, int n)),
164 	write_emif proto((char *s));
165 #endif
166 
167 #ifdef	MAC
168 
169 extern int
170 	creat proto((char *, int)),
171 	open proto((const char *, int, ...)),
172 	close proto((int)),
173 	read proto((int, const char *, unsigned)),
174 	write proto((int, const char *, unsigned)),
175 	unlink proto((const char *)),
176 	chdir proto((const char *)),
177 	getArgs proto((char ***));
178 
179 extern bool
180 	rawchkc proto((void));
181 
182 extern long
183 	lseek proto((int, long, unsigned));
184 
185 extern time_t
186 	time proto((time_t *));
187 
188 #endif	/* MAC */
189 
190 extern char
191 	*pwd proto((void)),
192 #ifdef	MAC
193 	*getwd proto((void)),	/* OOPS: same name, different type! */
194 #else
195 	*getwd proto((char *)),
196 #endif
197 	*pfile proto((char *)),
198 	*gfile proto((char *));
199 
200 #ifdef	MAC
201 extern void
202 	MacInit proto((void)),
203 	InitBinds proto((void)),
204 	NPlacur proto((int, int)),
205 	i_lines proto((int, int, int)),
206 	d_lines proto((int, int, int)),
207 	clr_page proto((void)),
208 	clr_eoln proto((void)),
209 	docontrols proto((void)),
210 	RemoveScrollBar proto((Window *)),
211 	InitEvents proto((void)),
212 	menus_on proto((void)),
213 	menus_off proto((void));
214 #endif
215 
216 /* Wired Commands */
217 
218 extern void
219 	UnbindC proto((void)),
220 	ShowVersion proto((void)),
221 	WVisSpace proto((void)),
222 	AppReg proto((void)),
223 	Apropos proto((void)),
224 	BackChar proto((void)),
225 	BList proto((void)),
226 	FList proto((void)),
227 	BUpList proto((void)),
228 	FDownList proto((void)),
229 	BSexpr proto((void)),
230 	BackWord proto((void)),
231 	Bof proto((void)),
232 	Bol proto((void)),
233 	Bos proto((void)),
234 	Bow proto((void)),
235 	BindAKey proto((void)),
236 	BindMac proto((void)),
237 	BufPos proto((void)),
238 #ifdef	MSDOS
239 	Buf0Select proto((void)),
240 	Buf1Select proto((void)),
241 	Buf2Select proto((void)),
242 	Buf3Select proto((void)),
243 	Buf4Select proto((void)),
244 	Buf5Select proto((void)),
245 	Buf6Select proto((void)),
246 	Buf7Select proto((void)),
247 	Buf8Select proto((void)),
248 	Buf9Select proto((void)),
249 	Buf10Select proto((void)),
250 #endif	/* MSDOS */
251 	CasRegLower proto((void)),
252 	CasRegUpper proto((void)),
253 	CapChar proto((void)),
254 	CapWord proto((void)),
255 	LowWord proto((void)),
256 	UppWord proto((void)),
257 	Chdir proto((void)),
258 	prCWD proto((void)),
259 	prDIRS proto((void)),
260 	Pushd proto((void)),
261 	Popd proto((void)),
262 	prCTIME proto((void)),
263 	ChrToOct proto((void)),
264 	ClAndRedraw proto((void)),
265 #ifndef	MAC
266 	MakeErrors proto((void)),
267 	ErrParse proto((void)),
268 #endif
269 	CopyRegion proto((void)),
270 	BufSelect proto((void)),
271 	DelBlnkLines proto((void)),
272 	DelNChar proto((void)),
273 	DelNWord proto((void)),
274 	OneWindow proto((void)),
275 	DelPChar proto((void)),
276 	DelPWord proto((void)),
277 	DelReg proto((void)),
278 	KillSome proto((void)),
279 	DelWtSpace proto((void)),
280 	DelCurWindow proto((void)),
281 	KeyDesc proto((void)),
282 	Digit proto((void)),
283 	Digit0 proto((void)),
284 	Digit1 proto((void)),
285 	Digit2 proto((void)),
286 	Digit3 proto((void)),
287 	Digit4 proto((void)),
288 	Digit5 proto((void)),
289 	Digit6 proto((void)),
290 	Digit7 proto((void)),
291 	Digit8 proto((void)),
292 	Digit9 proto((void)),
293 	DescBindings proto((void)),
294 	DescCom proto((void)),
295 	Eof proto((void)),
296 	Eol proto((void)),
297 	Eos proto((void)),
298 	Eow proto((void)),
299 	ForPara proto((void)),
300 	BackPara proto((void)),
301 	BufErase proto((void)),
302 	PtToMark proto((void)),
303 	Extend proto((void)),
304 	ExecMacro proto((void)),
305 	RunMacro proto((void)),
306 	Leave proto((void)),
307 	FindFile proto((void)),
308 	WindFind proto((void)),
309 	FindTag proto((void)),
310 	FDotTag proto((void)),
311 	ToIndent proto((void)),
312 	ForChar proto((void)),
313 	FSexpr proto((void)),
314 	ForWord proto((void)),
315 	TimesFour proto((void)),
316 	GoLine proto((void)),
317 	GrowWindowCmd proto((void)),
318 	IncFSearch proto((void)),
319 	IncRSearch proto((void)),
320 	InsFile proto((void)),
321 	Justify proto((void)),
322 	RegJustify proto((void)),
323 	SetLMargin proto((void)),
324 	SetRMargin proto((void)),
325 	LRShift proto((void)),
326 	RRShift proto((void)),
327 	BufKill proto((void)),
328 	KillBos proto((void)),
329 	KillEos proto((void)),
330 	KillEOL proto((void)),
331 	KillExpr proto((void)),
332 	BufList proto((void)),
333 	NotModified proto((void)),
334 	NameMac proto((void)),
335 	DelMacro proto((void)),
336 	Newline proto((void)),
337 	OpenLine proto((void)),
338 	LineAI proto((void)),
339 #ifndef	MAC
340 	ShowErr proto((void)),
341 	NextError proto((void)),
342 	PrevError proto((void)),
343 	ParseAll proto((void)),
344 #endif	/* MAC */
345 #ifdef	MSDOS
346 	PageScrollUp proto((void)),
347 	PageScrollDown proto((void)),
348 #endif	/* MSDOS */
349 	NextLine proto((void)),
350 	NextPage proto((void)),
351 	NextWindow proto((void)),
352 	Recur proto((void)),
353 	PopMark proto((void)),
354 	PageNWind proto((void)),
355 	Tab proto((void)),
356 	DoParen proto((void)),
357 #ifdef	SPELL
358 	SpelWords proto((void)),
359 #endif
360 #ifdef	JOB_CONTROL
361 	PauseJove proto((void)),
362 #endif
363 	PrevLine proto((void)),
364 	PrevPage proto((void)),
365 	PrevWindow proto((void)),
366 #ifndef	MAC
367 	jcloseall proto((void)),
368 	Push proto((void)),
369 #endif
370 	RegReplace proto((void)),
371 	QRepSearch proto((void)),
372 	QuotChar proto((void)),
373 	ReadFile proto((void)),
374 	DefKBDMac proto((void)),
375 	RedrawDisplay proto((void)),
376 	ReNamBuf proto((void)),
377 	RepSearch proto((void)),
378 	DownScroll proto((void)),
379 	UpScroll proto((void)),
380 	ForSearch proto((void)),
381 	FSrchND proto((void)),
382 	RevSearch proto((void)),
383 	RSrchND proto((void)),
384 	SelfInsert proto((void)),
385 	SetVar proto((void)),
386 	SetMark proto((void)),
387 #ifndef	MAC
388 	ShellCom proto((void)),
389 	ShNoBuf proto((void)),
390 	Shtypeout proto((void)),
391 	ShToBuf proto((void)),
392 	FilterRegion proto((void)),
393 #endif
394 	ShrWindow proto((void)),
395 	Source proto((void)),
396 #ifdef	SPELL
397 	SpelBuffer proto((void)),
398 #endif
399 	SplitWind proto((void)),
400 	GotoWind proto((void)),
401 	Remember proto((void)),
402 	Forget proto((void)),
403 	StrLength proto((void)),
404 	TransChar proto((void)),
405 	TransLines proto((void)),
406 	SaveFile proto((void)),
407 	WtModBuf proto((void)),
408 	WriteMacs proto((void)),
409 	XtermMouse proto((void)),
410 	WrtReg proto((void)),
411 	Yank proto((void)),
412 	YankPop proto((void)),
413 	PrVar proto((void)),
414 	WNumLines proto((void)),
415 #ifdef	IPROCS
416 	ShellProc proto((void)),
417 	ProcInt proto((void)),
418 	ProcQuit proto((void)),
419 	ProcKill proto((void)),
420 #  ifdef	PTYPROCS
421 	ProcEof proto((void)),
422 	ProcStop proto((void)),
423 	ProcCont proto((void)),
424 	ProcDStop proto((void)),
425 #  endif
426 	ProcSendData proto((void)),
427 	ProcNewline proto((void)),
428 	ProcList proto((void)),
429 	ProcBind proto((void)),
430 	Iprocess proto((void)),
431 	DBXpoutput proto((void)),
432 #endif
433 
434 #ifdef	LISP
435 	GSexpr proto((void)),	/* Grind S Expression. */
436 	AddSpecial proto((void)),	/* add lisp special form */
437 #endif
438 	CAutoExec proto((void)),
439 	MAutoExec proto((void)),
440 
441 	DefMAbbrev proto((void)),
442 	DefGAbbrev proto((void)),
443 	SaveAbbrevs proto((void)),
444 	RestAbbrevs proto((void)),
445 	EditAbbrevs proto((void)),
446 	BindMtoW proto((void)),
447 
448 #ifdef	CMT_FMT
449 	Comment proto((void)),
450 #endif
451 
452 	ScrollLeft proto((void)),
453 	ScrollRight proto((void)),
454 
455 	MakeKMap proto((void)),
456 	KmBind proto((void)),
457 	ProcKmBind proto((void)),
458 
459 	MacInter proto((void));		/* This is the last one. */
460 
461 /*==== Declarations of Library/System Routines ====*/
462 
463 extern int	errno;	/* Redundant if declared in <errno.h> -- DHR */
464 extern char *strerror proto((int));	/* errno.h or string.h? */
465 
466 /* General Utilities: <stdlib.h> */
467 
468 extern int	abs proto((int));
469 
470 extern void	abort proto((void));
471 extern void	exit proto((int));
472 
473 extern int	atoi proto((const char */*nptr*/));
474 
475 extern void	qsort proto((UnivPtr /*base*/, size_t /*nmemb*/,
476 	size_t /*size*/, int (*/*compar*/)(UnivConstPtr, UnivConstPtr)));
477 
478 extern char	*getenv proto((const char *));
479 extern int	system proto((const char *));
480 
481 extern void
482 	free proto((UnivPtr));
483 
484 extern UnivPtr
485 	calloc proto((unsigned int, unsigned int)),
486 	malloc proto((size_t)),
487 	realloc proto((UnivPtr, size_t));
488 
489 /* Date and Time <time.h> */
490 
491 extern time_t	time proto((time_t */*tloc*/));
492 extern char	*ctime proto((const time_t *));
493 
494 /* UNIX */
495 
496 #ifdef	IBMPC
497 #define const	/* the const's in the following defs conflict with MSC 5.1 */
498 #endif
499 
500 #ifdef	POSIX_UNISTD
501 # include <unistd.h>
502 #else	/* !POSIX_UNISTD */
503 extern int	chdir proto((const char */*path*/));
504 extern int	access proto((const char */*path*/, int /*mode*/));
505 extern int	creat proto((const char */*path*/, int /*mode*/));
506 	/* Open may have an optional third argument, int mode */
507 extern int	open proto((const char */*path*/, int /*flags*/, ...));
508 
509 
510 #ifdef	IBMPC
511 extern int	read proto((int /*fd*/, char * /*buf*/, size_t /*nbytes*/));
512 extern int	write proto((int /*fd*/, const char * /*buf*/, size_t /*nbytes*/));
513 #else
514 extern int	read proto((int /*fd*/, UnivPtr /*buf*/, size_t /*nbytes*/));
515 extern int	write proto((int /*fd*/, UnivConstPtr /*buf*/, size_t /*nbytes*/));
516 #endif
517 
518 extern int	execl proto((const char */*name*/, const char */*arg0*/, ...));
519 extern int	execlp proto((const char */*name*/, const char */*arg0*/, ...));
520 extern int	execv proto((const char */*name*/, const char */*argv*/[]));
521 extern int	execvp proto((const char */*name*/, const char */*argv*/[]));
522 
523 #ifdef	IBMPC
524 #undef const
525 #endif
526 
527 extern void	_exit proto((int));	/* exit(), without flush, etc */
528 
529 extern unsigned	alarm proto((unsigned /*seconds*/));
530 
531 extern int	pipe proto((int *));
532 extern int	close proto((int));
533 extern int	dup proto((int));
534 extern int	dup2 proto((int /*old_fd*/, int /*new_fd*/));
535 extern long	lseek proto((int /*fd*/, long /*offset*/, int /*whence*/));
536 extern int	fchmod proto((int /*fd*/, int /*mode*/));
537 extern int	fork proto((void));
538 
539 extern int	getpid proto((void));
540 extern int	getuid proto((void));
541 
542 extern int	setuid proto((int));
543 extern int	chown proto((const char *, int, int));
544 
545 extern int	kill proto((int /*pid*/, int /*sig*/));
546 extern void	perror proto((const char *));
547 
548 #endif	/* POSIX_UNISTD */
549 
550 extern int	unlink proto((const char */*path*/));
551 extern int	fsync proto((int));
552 
553 
554 extern char	*mktemp proto((char *));
555 
556 
557 /* BSD UNIX
558  *
559  * Note: in most systems, declaration of a non-existant function is
560  * OK if the function is never actually called.  The parentheses around
561  * the name prevent any macro expansion.
562  */
563 
564 extern pid_t	UNMACRO(vfork) proto((void));
565 
566 #ifdef	BSD_SIGS
567 #ifndef BSD386
568 extern int	UNMACRO(killpg) proto((int /*pgrp*/, int /*sig*/));
569 #endif
570 #endif
571 
572 #ifndef BSD386
573 extern int	UNMACRO(setpgrp) proto((int /*pid*/, int /*pgrp*/));	/* Sys V takes no arg */
574 #endif
575 
576 #ifdef	REALSTDC
577 struct timeval;	/* forward declaration preventing prototype scoping */
578 #endif
579 
580 #ifndef BSD386
581 extern int	UNMACRO(select) proto((int /*width*/, fd_set */*readfds*/, fd_set */*writefds*/,
582 	fd_set */*exceptfds*/, struct timeval */*timeout*/));
583 #endif
584 
585 extern void	UNMACRO(bcopy) proto((UnivConstPtr, UnivPtr, size_t));
586 extern void	UNMACRO(bzero) proto((UnivPtr, size_t));
587 
588 /* termcap */
589 
590 extern int	UNMACRO(tgetent) proto((char */*buf*/, const char */*name*/));
591 extern int	UNMACRO(tgetflag) proto((const char */*id*/));
592 extern int	UNMACRO(tgetnum) proto((const char */*id*/));
593 extern char	*UNMACRO(tgetstr) proto((const char */*id*/, char **/*area*/));
594 extern void	UNMACRO(tputs) proto((const char *, int, void (*) proto((int))));
595 extern char	*UNMACRO(tgoto) proto((const char *, int /*destcol*/, int /*destline*/));
596