Rocco's changes

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@279 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2000-11-10 18:15:43 +00:00
parent a60e02c950
commit 271e972ff0
14 changed files with 211 additions and 208 deletions

210
nano.c
View File

@ -1053,19 +1053,6 @@ void wrap_reset(void)
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* Stuff we want to do when we exit the spell program one of its many ways */
void exit_spell(char *tmpfilename, char *foo)
{
free(foo);
if (remove(tmpfilename) == -1)
statusbar(_("Error deleting tempfile, ack!"));
display_main_list();
}
#endif
#ifndef NANO_SMALL
int do_int_spell_fix(char *word) int do_int_spell_fix(char *word)
{ {
char *prevanswer = NULL, *save_search = NULL, *save_replace = NULL; char *prevanswer = NULL, *save_search = NULL, *save_replace = NULL;
@ -1128,126 +1115,128 @@ int do_int_spell_fix(char *word)
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* Integrated spell checking using 'spell' program */ /* Integrated spell checking using 'spell' program */
int do_int_speller(void) int do_int_speller(char *tempfile_name)
{ {
char *read_buff, *read_buff_ptr, *read_buff_word;
filestruct *fileptr; long pipe_buff_size;
char read_buff[2], *read_buff_ptr; int in_fd[2], tempfile_fd;
char curr_word[132], *curr_word_ptr;
int in_fd[2], out_fd[2];
int spell_status; int spell_status;
pid_t pid_spell; pid_t pid_spell;
ssize_t bytesread; ssize_t bytesread;
/* Input from spell pipe */ /* Create a pipe to spell program */
if (pipe(in_fd) == -1) if (pipe(in_fd) == -1)
return FALSE; return FALSE;
/* Output to spell pipe */ /* A new process to run spell in */
if (pipe(out_fd) == -1) {
close(in_fd[0]);
close(in_fd[1]);
return FALSE;
}
if ( (pid_spell = fork()) == 0) { if ( (pid_spell = fork()) == 0) {
/* Child continues, (i.e. future spell process) */ /* Child continues, (i.e. future spell process) */
close(in_fd[0]);
/* replace the standard in with the tempfile */
if ( (tempfile_fd = open(tempfile_name, O_RDONLY)) == -1) {
close(in_fd[1]); close(in_fd[1]);
close(out_fd[0]); exit(1);
/* setup spell standard in */
if (dup2(in_fd[0], STDIN_FILENO) != STDIN_FILENO)
{
close(in_fd[0]);
close(out_fd[1]);
return FALSE;
} }
close(in_fd[0]);
/* setup spell standard out */ if (dup2(tempfile_fd, STDIN_FILENO) != STDIN_FILENO) {
if (dup2(out_fd[1], STDOUT_FILENO) != STDOUT_FILENO)
{ close(tempfile_fd);
close(out_fd[1]); close(in_fd[1]);
return FALSE; exit(1);
} }
close(out_fd[1]); close(tempfile_fd);
/* Start spell program */ /* send spell's standard out to the pipe */
if (dup2(in_fd[1], STDOUT_FILENO) != STDOUT_FILENO) {
close(in_fd[1]);
exit(1);
}
close(in_fd[1]);
/* Start spell program, we are using the PATH here!?!? */
execlp("spell", "spell", NULL); execlp("spell", "spell", NULL);
/* Should not be reached, if spell is available!!! */ /* Should not be reached, if spell is found!!! */
exit(-1); exit(1);
} }
/* Parent continues here */ /* Parent continues here */
close(in_fd[0]); /* close child's input pipe */ close(in_fd[1]);
close(out_fd[1]); /* close child's output pipe */
if (pid_spell < 0) {
/* Child process was not forked successfully */ /* Child process was not forked successfully */
close(in_fd[1]); /* close parent's output pipe */ if (pid_spell < 0) {
close(out_fd[0]); /* close parent's input pipe */
close(in_fd[0]);
return FALSE; return FALSE;
} }
/* Send out the file content to spell program */ /* Get system pipe buffer size */
fileptr = fileage; if ( (pipe_buff_size = fpathconf(in_fd[0], _PC_PIPE_BUF)) < 1) {
while ( fileptr != NULL ) close(in_fd[0]);
{
write(in_fd[1], fileptr->data, strlen(fileptr->data));
write(in_fd[1], "\n", 1);
fileptr = fileptr->next;
}
close(in_fd[1]);
/* Let spell process the file */
wait(&spell_status);
if (spell_status != 0)
return FALSE; return FALSE;
}
/* Read spelling errors from spell */ read_buff = nmalloc( pipe_buff_size + 1 );
curr_word_ptr = curr_word; /* Process the returned spelling errors */
while ( (bytesread = read(out_fd[0], read_buff, sizeof(read_buff) - 1)) > 0) while ( (bytesread = read(in_fd[0], read_buff, pipe_buff_size)) > 0) {
{
read_buff[bytesread]=(char) NULL; read_buff[bytesread] = (char) NULL;
read_buff_ptr = read_buff; read_buff_word = read_buff_ptr = read_buff;
while (*read_buff_ptr != (char) NULL) {
/* Windows version may need to process additional char '\r' */
/* Possible problem here if last word not followed by '\n' */
while (*read_buff_ptr != (char) NULL)
{
if (*read_buff_ptr == '\n') { if (*read_buff_ptr == '\n') {
*curr_word_ptr = (char) NULL; *read_buff_ptr = (char) NULL;
if (do_int_spell_fix(curr_word) == FALSE) if (!do_int_spell_fix(read_buff_word)) {
{
close(out_fd[0]); close(in_fd[0]);
free(read_buff);
replace_abort();
return TRUE; return TRUE;
} }
curr_word_ptr = curr_word; read_buff_word = read_buff_ptr;
} read_buff_word++;
else {
*curr_word_ptr = *read_buff_ptr;
curr_word_ptr++;
} }
read_buff_ptr++; read_buff_ptr++;
} }
} }
close(out_fd[0]);
close(in_fd[0]);
free(read_buff);
replace_abort(); replace_abort();
/* Process end of spell process */
wait(&spell_status);
if (WIFEXITED(spell_status)) {
if (WEXITSTATUS(spell_status) != 0)
return FALSE;
}
else
return FALSE;
return TRUE; return TRUE;
} }
#endif #endif
@ -1255,21 +1244,46 @@ int do_int_speller(void)
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* External spell checking */ /* External spell checking */
int do_alt_speller(char *command_line, char *file_name) int do_alt_speller(char *file_name)
{ {
int i; int alt_spell_status;
pid_t pid_spell;
endwin(); endwin();
if ( (i = system(command_line) == -1) || (i == 32512)) /* Start a new process for the alternate speller */
if ( (pid_spell = fork()) == 0) {
/* Start alternate spell program, we are using the PATH here!?!? */
execlp(alt_speller, alt_speller, file_name, NULL);
/* Should not be reached, if alternate speller is found!!! */
exit(1);
}
/* Could not fork?? */
if (pid_spell < 0)
return FALSE;
/* Wait for alternate speller to complete */
wait(&alt_spell_status);
if (WIFEXITED(alt_spell_status)) {
if (WEXITSTATUS(alt_spell_status) != 0)
return FALSE;
}
else
return FALSE; return FALSE;
refresh(); refresh();
free_filestruct(fileage); free_filestruct(fileage);
global_init(); global_init();
open_file(file_name, 0, 1); open_file(file_name, 0, 1);
edit_update(fileage, CENTER); edit_update(fileage, CENTER);
display_main_list();
set_modified(); set_modified();
return TRUE; return TRUE;
@ -1283,10 +1297,8 @@ int do_spell(void)
nano_small_msg(); nano_small_msg();
return (TRUE); return (TRUE);
#else #else
char *temp, *foo; char *temp;
int size, spell_res; int spell_res;
if (alt_speller) {
if ((temp = tempnam(0, "nano.")) == NULL) { if ((temp = tempnam(0, "nano.")) == NULL) {
statusbar(_("Could not create a temporary filename: %s"), statusbar(_("Could not create a temporary filename: %s"),
@ -1297,16 +1309,12 @@ int do_spell(void)
if (write_file(temp, 1) == -1) if (write_file(temp, 1) == -1)
return 0; return 0;
size = strlen(temp) + strlen(alt_speller) + 2; if (alt_speller)
foo = nmalloc(size); spell_res = do_alt_speller(temp);
snprintf(foo, size, "%s %s", alt_speller, temp); else
spell_res = do_int_speller(temp);
spell_res = do_alt_speller(foo, temp); remove(temp);
exit_spell(temp, foo);
} else
spell_res = do_int_speller();
if (spell_res) if (spell_res)
statusbar(_("Finished checking spelling")); statusbar(_("Finished checking spelling"));

View File

@ -175,65 +175,64 @@ Usage: nano [option] +LINE <file>\n\
{"check_wrap called with inptr->data=\"%s\"\n", 142}, {"check_wrap called with inptr->data=\"%s\"\n", 142},
{"current->data now = \"%s\"\n", 143}, {"current->data now = \"%s\"\n", 143},
{"After, data = \"%s\"\n", 144}, {"After, data = \"%s\"\n", 144},
{"Error deleting tempfile, ack!", 145}, {"Edit a replacement", 145},
{"Edit a replacement", 146}, {"Could not create a temporary filename: %s", 146},
{"Could not create a temporary filename: %s", 147}, {"Finished checking spelling", 147},
{"Finished checking spelling", 148}, {"Spell checking failed", 148},
{"Spell checking failed", 149}, {"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 149},
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 150}, {"Cannot resize top win", 150},
{"Cannot resize top win", 151}, {"Cannot move top win", 151},
{"Cannot move top win", 152}, {"Cannot resize edit win", 152},
{"Cannot resize edit win", 153}, {"Cannot move edit win", 153},
{"Cannot move edit win", 154}, {"Cannot resize bottom win", 154},
{"Cannot resize bottom win", 155}, {"Cannot move bottom win", 155},
{"Cannot move bottom win", 156}, {"Justify Complete", 156},
{"Justify Complete", 157}, {"%s enable/disable", 157},
{"%s enable/disable", 158}, {"enabled", 158},
{"enabled", 159}, {"disabled", 159},
{"disabled", 160}, {"Main: set up windows\n", 160},
{"Main: set up windows\n", 161}, {"Main: bottom win\n", 161},
{"Main: bottom win\n", 162}, {"Main: open file\n", 162},
{"Main: open file\n", 163}, {"I got Alt-O-%c! (%d)\n", 163},
{"I got Alt-O-%c! (%d)\n", 164}, {"I got Alt-[-1-%c! (%d)\n", 164},
{"I got Alt-[-1-%c! (%d)\n", 165}, {"I got Alt-[-2-%c! (%d)\n", 165},
{"I got Alt-[-2-%c! (%d)\n", 166}, {"I got Alt-[-%c! (%d)\n", 166},
{"I got Alt-[-%c! (%d)\n", 167}, {"I got Alt-%c! (%d)\n", 167},
{"I got Alt-%c! (%d)\n", 168}, {"Case Sensitive Regexp Search%s%s", 168},
{"Case Sensitive Regexp Search%s%s", 169}, {"Regexp Search%s%s", 169},
{"Regexp Search%s%s", 170}, {"Case Sensitive Search%s%s", 170},
{"Case Sensitive Search%s%s", 171}, {"Search%s%s", 171},
{"Search%s%s", 172}, {" (to replace)", 172},
{" (to replace)", 173}, {"Search Cancelled", 173},
{"Search Cancelled", 174}, {"\"%s...\" not found", 174},
{"\"%s...\" not found", 175}, {"Search Wrapped", 175},
{"Search Wrapped", 176}, {"Replaced %d occurences", 176},
{"Replaced %d occurences", 177}, {"Replaced 1 occurence", 177},
{"Replaced 1 occurence", 178}, {"Replace Cancelled", 178},
{"Replace Cancelled", 179}, {"Replace this instance?", 179},
{"Replace this instance?", 180}, {"Replace failed: unknown subexpression!", 180},
{"Replace failed: unknown subexpression!", 181}, {"Replace with [%s]", 181},
{"Replace with [%s]", 182}, {"Replace with", 182},
{"Replace with", 183}, {"Enter line number", 183},
{"Enter line number", 184}, {"Aborted", 184},
{"Aborted", 185}, {"Come on, be reasonable", 185},
{"Come on, be reasonable", 186}, {"Only %d lines available, skipping to last line", 186},
{"Only %d lines available, skipping to last line", 187}, {"actual_x_from_start for xplus=%d returned %d\n", 187},
{"actual_x_from_start for xplus=%d returned %d\n", 188}, {"input '%c' (%d)\n", 188},
{"input '%c' (%d)\n", 189}, {"New Buffer", 189},
{"New Buffer", 190}, {" File: ...", 190},
{" File: ...", 191}, {"Modified", 191},
{"Modified", 192}, {"Moved to (%d, %d) in edit buffer\n", 192},
{"Moved to (%d, %d) in edit buffer\n", 193}, {"current->data = \"%s\"\n", 193},
{"current->data = \"%s\"\n", 194}, {"I got \"%s\"\n", 194},
{"I got \"%s\"\n", 195}, {"Yes", 195},
{"Yes", 196}, {"All", 196},
{"All", 197}, {"No", 197},
{"No", 198}, {"do_cursorpos: linepct = %f, bytepct = %f\n", 198},
{"do_cursorpos: linepct = %f, bytepct = %f\n", 199}, {"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 199},
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 200}, {"Dumping file buffer to stderr...\n", 200},
{"Dumping file buffer to stderr...\n", 201}, {"Dumping cutbuffer to stderr...\n", 201},
{"Dumping cutbuffer to stderr...\n", 202}, {"Dumping a buffer to stderr...\n", 202},
{"Dumping a buffer to stderr...\n", 203},
}; };
int _msg_tbl_length = 203; int _msg_tbl_length = 202;

BIN
po/de.gmo

Binary file not shown.

View File

@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: nano 0.9.17\n" "Project-Id-Version: nano 0.9.17\n"
"POT-Creation-Date: 2000-11-06 00:50-0500\n" "POT-Creation-Date: 2000-11-06 08:19-0500\n"
"PO-Revision-Date: 2000-09-09 11:55+0200\n" "PO-Revision-Date: 2000-09-09 11:55+0200\n"
"Last-Translator: Florian König <floki@bigfoot.com>\n" "Last-Translator: Florian König <floki@bigfoot.com>\n"
"Language-Team: German <floki@bigfoot.com>\n" "Language-Team: German <floki@bigfoot.com>\n"

BIN
po/es.gmo

Binary file not shown.

View File

@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 0.9.19+CVS\n" "Project-Id-Version: 0.9.19+CVS\n"
"POT-Creation-Date: 2000-11-06 00:50-0500\n" "POT-Creation-Date: 2000-11-06 08:19-0500\n"
"PO-Revision-Date: 2000-11-01 17:55+0100\n" "PO-Revision-Date: 2000-11-01 17:55+0100\n"
"Last-Translator: Jordi Mallach <jordi@sindominio.net>\n" "Last-Translator: Jordi Mallach <jordi@sindominio.net>\n"
"Language-Team: Spanish <es@li.org>\n" "Language-Team: Spanish <es@li.org>\n"

BIN
po/fi.gmo

Binary file not shown.

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: nano 0.9.11\n" "Project-Id-Version: nano 0.9.11\n"
"POT-Creation-Date: 2000-11-06 00:50-0500\n" "POT-Creation-Date: 2000-11-06 08:19-0500\n"
"PO-Revision-Date: 2000-06-21 23:08+03:00\n" "PO-Revision-Date: 2000-06-21 23:08+03:00\n"
"Last-Translator: Pauli Virtanen <pauli.virtanen@saunalahti.fi>\n" "Last-Translator: Pauli Virtanen <pauli.virtanen@saunalahti.fi>\n"
"Language-Team: Finnish <fi@li.org>\n" "Language-Team: Finnish <fi@li.org>\n"

View File

@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 0.8.9\n" "Project-Id-Version: 0.8.9\n"
"POT-Creation-Date: 2000-11-06 00:50-0500\n" "POT-Creation-Date: 2000-11-06 08:19-0500\n"
"PO-Revision-Date: 2000-07-09 01:32+0100\n" "PO-Revision-Date: 2000-07-09 01:32+0100\n"
"Last-Translator: Clement Laforet <sheep.killer@free.fr>\n" "Last-Translator: Clement Laforet <sheep.killer@free.fr>\n"
"Language-Team: French <LL@li.org>\n" "Language-Team: French <LL@li.org>\n"

BIN
po/id.gmo

Binary file not shown.

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: nano-0.9.10\n" "Project-Id-Version: nano-0.9.10\n"
"POT-Creation-Date: 2000-11-06 00:50-0500\n" "POT-Creation-Date: 2000-11-06 08:19-0500\n"
"PO-Revision-Date: 2000-06-08 20:56+07:00\n" "PO-Revision-Date: 2000-06-08 20:56+07:00\n"
"Last-Translator: Tedi Heriyanto <tedi-h@usa.net>\n" "Last-Translator: Tedi Heriyanto <tedi-h@usa.net>\n"
"Language-Team: Indonesian <id@li.org>\n" "Language-Team: Indonesian <id@li.org>\n"

BIN
po/it.gmo

Binary file not shown.

View File

@ -7,7 +7,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: 0.8.7\n" "Project-Id-Version: 0.8.7\n"
"POT-Creation-Date: 2000-11-06 00:50-0500\n" "POT-Creation-Date: 2000-11-06 08:19-0500\n"
"PO-Revision-Date: 2000-03-03 04:57+0100\n" "PO-Revision-Date: 2000-03-03 04:57+0100\n"
"Last-Translator: Daniele Medri <madrid@linux.it>\n" "Last-Translator: Daniele Medri <madrid@linux.it>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"

View File

@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2000-11-06 08:18-0500\n" "POT-Creation-Date: 2000-11-09 23:23-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -55,7 +55,7 @@ msgstr ""
msgid "File to insert [from ./] " msgid "File to insert [from ./] "
msgstr "" msgstr ""
#: files.c:276 files.c:300 files.c:488 nano.c:1347 #: files.c:276 files.c:300 files.c:488 nano.c:1355
msgid "Cancelled" msgid "Cancelled"
msgstr "" msgstr ""
@ -628,105 +628,101 @@ msgstr ""
msgid "After, data = \"%s\"\n" msgid "After, data = \"%s\"\n"
msgstr "" msgstr ""
#: nano.c:1062 #: nano.c:1093
msgid "Error deleting tempfile, ack!"
msgstr ""
#: nano.c:1106
msgid "Edit a replacement" msgid "Edit a replacement"
msgstr "" msgstr ""
#: nano.c:1292 #: nano.c:1304
#, c-format #, c-format
msgid "Could not create a temporary filename: %s" msgid "Could not create a temporary filename: %s"
msgstr "" msgstr ""
#: nano.c:1312 #: nano.c:1320
msgid "Finished checking spelling" msgid "Finished checking spelling"
msgstr "" msgstr ""
#: nano.c:1314 #: nano.c:1322
msgid "Spell checking failed" msgid "Spell checking failed"
msgstr "" msgstr ""
#: nano.c:1334 #: nano.c:1342
msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? " msgid "Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? "
msgstr "" msgstr ""
#: nano.c:1497 #: nano.c:1505
msgid "Cannot resize top win" msgid "Cannot resize top win"
msgstr "" msgstr ""
#: nano.c:1499 #: nano.c:1507
msgid "Cannot move top win" msgid "Cannot move top win"
msgstr "" msgstr ""
#: nano.c:1501 #: nano.c:1509
msgid "Cannot resize edit win" msgid "Cannot resize edit win"
msgstr "" msgstr ""
#: nano.c:1503 #: nano.c:1511
msgid "Cannot move edit win" msgid "Cannot move edit win"
msgstr "" msgstr ""
#: nano.c:1505 #: nano.c:1513
msgid "Cannot resize bottom win" msgid "Cannot resize bottom win"
msgstr "" msgstr ""
#: nano.c:1507 #: nano.c:1515
msgid "Cannot move bottom win" msgid "Cannot move bottom win"
msgstr "" msgstr ""
#: nano.c:1778 #: nano.c:1786
msgid "Justify Complete" msgid "Justify Complete"
msgstr "" msgstr ""
#: nano.c:1846 #: nano.c:1854
#, c-format #, c-format
msgid "%s enable/disable" msgid "%s enable/disable"
msgstr "" msgstr ""
#: nano.c:1858 #: nano.c:1866
msgid "enabled" msgid "enabled"
msgstr "" msgstr ""
#: nano.c:1859 #: nano.c:1867
msgid "disabled" msgid "disabled"
msgstr "" msgstr ""
#: nano.c:2089 #: nano.c:2097
msgid "Main: set up windows\n" msgid "Main: set up windows\n"
msgstr "" msgstr ""
#: nano.c:2102 #: nano.c:2110
msgid "Main: bottom win\n" msgid "Main: bottom win\n"
msgstr "" msgstr ""
#: nano.c:2108 #: nano.c:2116
msgid "Main: open file\n" msgid "Main: open file\n"
msgstr "" msgstr ""
#: nano.c:2142 #: nano.c:2150
#, c-format #, c-format
msgid "I got Alt-O-%c! (%d)\n" msgid "I got Alt-O-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:2164 #: nano.c:2172
#, c-format #, c-format
msgid "I got Alt-[-1-%c! (%d)\n" msgid "I got Alt-[-1-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:2197 #: nano.c:2205
#, c-format #, c-format
msgid "I got Alt-[-2-%c! (%d)\n" msgid "I got Alt-[-2-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:2245 #: nano.c:2253
#, c-format #, c-format
msgid "I got Alt-[-%c! (%d)\n" msgid "I got Alt-[-%c! (%d)\n"
msgstr "" msgstr ""
#: nano.c:2271 #: nano.c:2279
#, c-format #, c-format
msgid "I got Alt-%c! (%d)\n" msgid "I got Alt-%c! (%d)\n"
msgstr "" msgstr ""