Require a main program (fix #2785)

This commit is contained in:
Nicolas Williams authored and Nico Williams committed 2023-08-01 23:06:01 -05:00
1 parent 044b38595c
commit 27a4d5757e
7 files changed
+61 -3

No files matched your search

+6
View File
@@ -407,6 +407,12 @@ int load_program(jq_state *jq, struct locfile* src, block *out_block) {
if (nerrors)
return nerrors;
if (!block_has_main(program)) {
jq_report_error(jq, jv_string("jq: error: Top-level program not given (try \".\")"));
block_free(program);
return 1;
}
char* home = getenv("HOME");
if (home) { // silently ignore no $HOME
/* Import ~/.jq as a library named "" found in $HOME */