Skip to content

Commit

Permalink
Open non-existent file
Browse files Browse the repository at this point in the history
Previously, typing
	neoleo yuk.oleo
where yuk.oleo is a non-existent file, produced an error.

This commit now allows you to start a spreadsheet using that
filename.
  • Loading branch information
Mark Carter committed Mar 30, 2017
1 parent 19154ec commit cf1255c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
===== neoleo NEXT =====
BACKWARD COMPATABILITY BREAK - THEREFORE MAJOR VERSION UPDATE REQUIRED

* neoleo now opens a non-existent file

* falls back to terminal automatically if X11 display not detected

* decimals are used instead of floats. This should greatly improve
Expand Down
1 change: 1 addition & 0 deletions src/io-term.cc
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ void _io_update_width_nothing(int col, int wid) {};
void
InitializeGlobals(void)
{
Global->FileName = NULL;
Global->display_opened = 0;
Global->return_from_error = 0;

Expand Down
13 changes: 3 additions & 10 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,25 +163,18 @@ main(int argc, char **argv)
if (option_filter) {
read_file_and_run_hooks(stdin, 0, "stdin");
} else if (argc - optind == 1) {
FILE * fp;
/* fixme: record file name */

if ((fp = fopen (argv[optind], "r"))) {
if (FILE *fp = fopen (argv[optind], "r")) {
try {
read_file_and_run_hooks (fp, 0, argv[optind]);
} catch (OleoJmp& e) {
//if (setjmp (Global->error_exception)) {
fprintf (stderr, _(", error occured reading '%s'\n"), argv[optind]);
io_info_msg(_(", error occured reading '%s'\n"), argv[optind]);
}
fclose (fp);
command_line_file = 1;
FileSetCurrentFileName(argv[optind]);
} else {
fprintf (stderr, _("Can't open %s: %s\n"), argv[optind], err_msg ());
io_info_msg(_("Can't open %s: %s\n"), argv[optind], err_msg ());
}

command_line_file = 1;
FileSetCurrentFileName(argv[optind]);
optind++;
}

Expand Down

0 comments on commit cf1255c

Please sign in to comment.