~emersion/mrsh

ref: 7fc12bb30d0b7a92c219a603919bfb43f72e27d7 mrsh/builtin/unspecified.c -rw-r--r-- 566 bytes View raw
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <mrsh/shell.h>
#include <stdlib.h>
#include <stdio.h>
#include "builtin.h"

int builtin_unspecified(struct mrsh_state *state, int argc, char *argv[]) {
	// Ref: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_01_01
	if (state->interactive) {
		fprintf(stderr,
				"%s: The behavior of this command is undefined.", argv[0]);
	} else {
		fprintf(stderr, "%s: The behavior of this command is undefined. "
				"This is an error in your script. Aborting.\n", argv[0]);
		state->exit = EXIT_FAILURE;
	}

	return EXIT_FAILURE;
}