File:  [MW Coherent from dump] / coherent / d / usr / src / examples / goto.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:38 2019 UTC (7 years, 2 months ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

#include <stdio.h>

main()
{
	char line[80];

	getline:
		printf("Enter line: ");
		fflush(stdout);
		gets(line);

/* a series of tests often is best done with goto's */
	if (*line == 'x') {
		printf("Bad line\n");
		goto getline;
	} else 
		if (*line == 'y') {
			printf("Try again\n");
			goto getline;
		} else 
			if (*line == 'q')
				goto goodbye;
			else
				goto getline;

	goodbye:
		printf("Goodbye.\n");
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.