char *read_buff, *read_buff_ptr, *read_buff_word, *ptr;
size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
size_t parsesuccess = 0;
- int lint_fd[2];
+ int lint_status, lint_fd[2];
pid_t pid_lint;
- int lint_status;
static int arglen = 3;
static char **lintargs = NULL;
- char *lintcopy;
- char *convendptr = NULL;
+ char *lintcopy, *convendptr = NULL;
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
if (ISSET(RESTRICTED)) {
if (openfile->modified) {
int i = do_yesno_prompt(FALSE, _("Save modified buffer before linting?"));
+
if (i == -1) {
statusbar(_("Cancelled"));
goto exit_from_lint;
- } else if (i == 1) {
- if (do_writeout(FALSE) != TRUE)
- goto exit_from_lint;
- }
+ } else if (i == 1 && (do_writeout(FALSE) != TRUE))
+ goto exit_from_lint;
}
lintcopy = mallocstrcpy(NULL, openfile->syntax->linter);
- /* Create pipe up front. */
+ /* Create a pipe up front. */
if (pipe(lint_fd) == -1) {
statusbar(_("Could not create pipe"));
goto exit_from_lint;
lintargs[0] = strtok(lintcopy, " ");
while ((ptr = strtok(NULL, " ")) != NULL) {
arglen++;
- lintargs = (char **)nrealloc(lintargs, arglen *
- sizeof(char *));
+ lintargs = (char **)nrealloc(lintargs, arglen * sizeof(char *));
lintargs[arglen - 3] = ptr;
}
lintargs[arglen - 1] = NULL;
}
lintargs[arglen - 2] = openfile->filename;
- /* A new process to run the linter in. */
+ /* Start a new process to run the linter in. */
if ((pid_lint = fork()) == 0) {
- /* Child continues (i.e. future linting process). */
+ /* Child continues here (i.e. the future linting process). */
close(lint_fd[0]);
/* Send the linter's standard output + err to the pipe. */
/* Parent continues here. */
close(lint_fd[1]);
- /* The child process was not forked successfully. */
+ /* If the child process was not forked successfully... */
if (pid_lint < 0) {
close(lint_fd[0]);
statusbar(_("Could not fork"));
#endif
read_buff_read += bytesread;
read_buff_size += pipe_buff_size;
- read_buff = read_buff_ptr = charealloc(read_buff,
- read_buff_size);
+ read_buff = read_buff_ptr = charealloc(read_buff, read_buff_size);
read_buff_ptr += read_buff_read;
}
fprintf(stderr, "text.c:do_lint:Raw output: %s\n", read_buff);
#endif
- /* Process the output. */
+ /* Process the linter output. */
read_buff_word = read_buff_ptr = read_buff;
while (*read_buff_ptr != '\0') {
bottombars(MLINTER);
tmplint = NULL;
curlint = lints;
+
while (TRUE) {
ssize_t tmpcol = 1;
int kbinput;
#ifndef NANO_TINY
struct stat lintfileinfo;
- new_lint_loop:
+ new_lint_loop:
if (stat(curlint->filename, &lintfileinfo) != -1) {
if (openfile->current_stat->st_ino != lintfileinfo.st_ino) {
openfilestruct *tmpof = openfile;
if (kbinput == KEY_WINCH)
continue;
#endif
-
func = func_from_key(&kbinput);
tmplint = curlint;
statusbar(_("At first message"));
}
}
+
blank_statusbar();
+
#ifndef NANO_TINY
free_lints_and_return:
#endif
free(tmplint->filename);
free(tmplint);
}
+
exit_from_lint:
display_main_list();
}
{
bool status;
FILE *temp_file;
- char *temp;
int format_status;
+ ssize_t lineno_save = openfile->current->lineno;
+ ssize_t current_y_save = openfile->current_y;
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
- ssize_t current_y_save = openfile->current_y;
- ssize_t lineno_save = openfile->current->lineno;
pid_t pid_format;
- char *ptr;
static int arglen = 3;
static char **formatargs = NULL;
- char *finalstatus = NULL;
+ char *temp, *ptr, *finalstatus = NULL;
if (openfile->totsize == 0) {
statusbar(_("Finished"));
formatargs[0] = strtok(openfile->syntax->formatter, " ");
while ((ptr = strtok(NULL, " ")) != NULL) {
arglen++;
- formatargs = (char **)nrealloc(formatargs, arglen *
- sizeof(char *));
+ formatargs = (char **)nrealloc(formatargs, arglen * sizeof(char *));
formatargs[arglen - 3] = ptr;
}
formatargs[arglen - 1] = NULL;
if (WIFEXITED(format_status) && WEXITSTATUS(format_status) == 2)
sleep(4);
- /* If the formatter printed any error messages onscreen, make
- * sure that they're cleared off. */
+ /* If there were any messages, clear them off. */
total_refresh();
}
#endif /* !DISABLE_SPELLER */