Subversion Repositories planix.SVN

Rev

Rev 113 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 113 Rev 115
Line 14... Line 14...
14
#include "ex_tty.h"
14
#include "ex_tty.h"
15
#include "ex_vis.h"
15
#include "ex_vis.h"
16
 
16
 
17
extern bool	pflag, nflag;		/* mjm: extern; also in ex_cmds.c */
17
extern bool	pflag, nflag;		/* mjm: extern; also in ex_cmds.c */
18
extern int	poffset;		/* mjm: extern; also in ex_cmds.c */
18
extern int	poffset;		/* mjm: extern; also in ex_cmds.c */
19
void vcontin(bool ask);
-
 
20
void resetflav();
-
 
21
void setflav();
-
 
22
void error0();
-
 
23
 
19
 
24
/*
20
/*
25
 * Subroutines for major command loop.
21
 * Subroutines for major command loop.
26
 */
22
 */
27
 
23
 
Line 115... Line 111...
115
 * Guts of the pre-printing error processing.
111
 * Guts of the pre-printing error processing.
116
 * If in visual and catching errors, then we dont mung up the internals,
112
 * If in visual and catching errors, then we dont mung up the internals,
117
 * just fixing up the echo area for the print.
113
 * just fixing up the echo area for the print.
118
 * Otherwise we reset a number of externals, and discard unused input.
114
 * Otherwise we reset a number of externals, and discard unused input.
119
 */
115
 */
120
void
-
 
121
error0()
116
error0()
122
{
117
{
123
 
118
 
124
	if (vcatch) {
119
	if (vcatch) {
125
		if (splitw == 0)
120
		if (splitw == 0)
126
			fixech();
121
			fixech();
127
		if (!SO || !SE)
122
		if (!SO || !SE)
128
			dingdong();
123
			dingdong();
129
		return;
124
		return 0;
130
	}
125
	}
131
	if (input) {
126
	if (input) {
132
		input = strend(input) - 1;
127
		input = strend(input) - 1;
133
		if (*input == '\n')
128
		if (*input == '\n')
134
			setlastchar('\n');
129
			setlastchar('\n');
Line 250... Line 245...
250
	if (argc == 0)
245
	if (argc == 0)
251
		error("No more files@to edit");
246
		error("No more files@to edit");
252
	morargc = argc;
247
	morargc = argc;
253
	isalt = (strcmp(altfile, args)==0) + 1;
248
	isalt = (strcmp(altfile, args)==0) + 1;
254
	if (savedfile[0])
249
	if (savedfile[0])
255
		strcpy(altfile, savedfile);
250
		CP(altfile, savedfile);
256
	strcpy(savedfile, args);
251
	CP(savedfile, args);
257
	argc--;
252
	argc--;
258
	args = argv ? *++argv : strend(args) + 1;
253
	args = argv ? *++argv : strend(args) + 1;
259
}
254
}
260
 
255
 
261
/*
256
/*
262
 * Eat trailing flags and offsets after a command,
257
 * Eat trailing flags and offsets after a command,
263
 * saving for possible later post-command prints.
258
 * saving for possible later post-command prints.
264
 */
259
 */
265
void
-
 
266
newline()
260
newline()
267
{
261
{
268
	register int c;
262
	register int c;
269
 
263
 
270
	resetflav();
264
	resetflav();
Line 298... Line 292...
298
			continue;
292
			continue;
299
 
293
 
300
		case '"':
294
		case '"':
301
			comment();
295
			comment();
302
			setflav();
296
			setflav();
303
			return;
297
			return 0;
304
 
298
 
305
		default:
299
		default:
306
			if (!endcmd(c))
300
			if (!endcmd(c))
307
serror("Extra chars|Extra characters at end of \"%s\" command", Command);
301
serror("Extra chars|Extra characters at end of \"%s\" command", Command);
308
			if (c == EOF)
302
			if (c == EOF)
309
				ungetchar(c);
303
				ungetchar(c);
310
			setflav();
304
			setflav();
311
			return;
305
			return 0;
312
		}
306
		}
313
		pflag++;
307
		pflag++;
314
	}
308
	}
315
}
309
}
316
 
310
 
317
/*
311
/*
318
 * Before quit or respec of arg list, check that there are
312
 * Before quit or respec of arg list, check that there are
319
 * no more files in the arg list.
313
 * no more files in the arg list.
320
 */
314
 */
321
void
-
 
322
nomore()
315
nomore()
323
{
316
{
324
 
317
 
325
	if (argc == 0 || morargc == argc)
318
	if (argc == 0 || morargc == argc)
326
		return;
319
		return 0;
327
	morargc = argc;
320
	morargc = argc;
328
	merror("%d more file", argc);
321
	merror("%d more file", argc);
329
	serror("%s@to edit", plural((long) argc));
322
	serror("%s@to edit", plural((long) argc));
330
}
323
}
331
 
324
 
Line 349... Line 342...
349
}
342
}
350
 
343
 
351
/*
344
/*
352
 * Reset the flavor of the output to print mode with no numbering.
345
 * Reset the flavor of the output to print mode with no numbering.
353
 */
346
 */
354
void
-
 
355
resetflav()
347
resetflav()
356
{
348
{
357
 
349
 
358
	if (inopen)
350
	if (inopen)
359
		return;
351
		return 0;
360
	listf = 0;
352
	listf = 0;
361
	nflag = 0;
353
	nflag = 0;
362
	pflag = 0;
354
	pflag = 0;
363
	poffset = 0;
355
	poffset = 0;
364
	setflav();
356
	setflav();
Line 386... Line 378...
386
 * Set the flavor of the output based on the flags given
378
 * Set the flavor of the output based on the flags given
387
 * and the number and list options to either number or not number lines
379
 * and the number and list options to either number or not number lines
388
 * and either use normally decoded (ARPAnet standard) characters or list mode,
380
 * and either use normally decoded (ARPAnet standard) characters or list mode,
389
 * where end of lines are marked and tabs print as ^I.
381
 * where end of lines are marked and tabs print as ^I.
390
 */
382
 */
391
void
-
 
392
setflav()
383
setflav()
393
{
384
{
394
 
385
 
395
	if (inopen)
386
	if (inopen)
396
		return;
387
		return 0;
397
	setnumb(nflag || value(NUMBER));
388
	setnumb(nflag || value(NUMBER));
398
	setlist(listf || value(LIST));
389
	setlist(listf || value(LIST));
399
	setoutt();
390
	setoutt();
400
}
391
}
401
 
392
 
Line 477... Line 468...
477
}
468
}
478
 
469
 
479
/*
470
/*
480
 * Continue after a : command from open/visual.
471
 * Continue after a : command from open/visual.
481
 */
472
 */
482
void
473
vcontin(ask)
483
vcontin(bool ask)
474
	bool ask;
484
{
475
{
485
 
476
 
486
	if (vcnt > 0)
477
	if (vcnt > 0)
487
		vcnt = -vcnt;
478
		vcnt = -vcnt;
488
	if (inopen) {
479
	if (inopen) {
Line 503... Line 494...
503
			}
494
			}
504
			if (!ask) {
495
			if (!ask) {
505
				putch('\r');
496
				putch('\r');
506
				putch('\n');
497
				putch('\n');
507
			}
498
			}
508
			return;
499
			return 0;
509
		}
500
		}
510
		if (ask) {
501
		if (ask) {
511
			merror("[Hit return to continue] ");
502
			merror("[Hit return to continue] ");
512
			flush();
503
			flush();
513
		}
504
		}