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
/* 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)
{
char *prevanswer = NULL, *save_search = NULL, *save_replace = NULL;
@ -1128,126 +1115,128 @@ int do_int_spell_fix(char *word)
#ifndef NANO_SMALL
/* Integrated spell checking using 'spell' program */
int do_int_speller(void)
int do_int_speller(char *tempfile_name)
{
filestruct *fileptr;
char read_buff[2], *read_buff_ptr;
char curr_word[132], *curr_word_ptr;
int in_fd[2], out_fd[2];
char *read_buff, *read_buff_ptr, *read_buff_word;
long pipe_buff_size;
int in_fd[2], tempfile_fd;
int spell_status;
pid_t pid_spell;
ssize_t bytesread;
/* Input from spell pipe */
/* Create a pipe to spell program */
if (pipe(in_fd) == -1)
return FALSE;
/* Output to spell pipe */
if (pipe(out_fd) == -1) {
close(in_fd[0]);
close(in_fd[1]);
return FALSE;
}
/* A new process to run spell in */
if ( (pid_spell = fork()) == 0) {
/* 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(out_fd[0]);
/* setup spell standard in */
if (dup2(in_fd[0], STDIN_FILENO) != STDIN_FILENO)
{
close(in_fd[0]);
close(out_fd[1]);
return FALSE;
exit(1);
}
close(in_fd[0]);
/* setup spell standard out */
if (dup2(out_fd[1], STDOUT_FILENO) != STDOUT_FILENO)
{
close(out_fd[1]);
return FALSE;
if (dup2(tempfile_fd, STDIN_FILENO) != STDIN_FILENO) {
close(tempfile_fd);
close(in_fd[1]);
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);
/* Should not be reached, if spell is available!!! */
/* Should not be reached, if spell is found!!! */
exit(-1);
exit(1);
}
/* Parent continues here */
close(in_fd[0]); /* close child's input pipe */
close(out_fd[1]); /* close child's output pipe */
if (pid_spell < 0) {
close(in_fd[1]);
/* Child process was not forked successfully */
close(in_fd[1]); /* close parent's output pipe */
close(out_fd[0]); /* close parent's input pipe */
if (pid_spell < 0) {
close(in_fd[0]);
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 )
{
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)
close(in_fd[0]);
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)
{
read_buff[bytesread]=(char) NULL;
read_buff_ptr = read_buff;
while ( (bytesread = read(in_fd[0], read_buff, pipe_buff_size)) > 0) {
read_buff[bytesread] = (char) NULL;
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') {
*curr_word_ptr = (char) NULL;
if (do_int_spell_fix(curr_word) == FALSE)
{
close(out_fd[0]);
*read_buff_ptr = (char) NULL;
if (!do_int_spell_fix(read_buff_word)) {
close(in_fd[0]);
free(read_buff);
replace_abort();
return TRUE;
}
curr_word_ptr = curr_word;
}
else {
*curr_word_ptr = *read_buff_ptr;
curr_word_ptr++;
read_buff_word = read_buff_ptr;
read_buff_word++;
}
read_buff_ptr++;
}
}
close(out_fd[0]);
close(in_fd[0]);
free(read_buff);
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;
}
#endif
@ -1255,21 +1244,46 @@ int do_int_speller(void)
#ifndef NANO_SMALL
/* 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();
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;
refresh();
free_filestruct(fileage);
global_init();
open_file(file_name, 0, 1);
edit_update(fileage, CENTER);
display_main_list();
set_modified();
return TRUE;
@ -1283,10 +1297,8 @@ int do_spell(void)
nano_small_msg();
return (TRUE);
#else
char *temp, *foo;
int size, spell_res;
if (alt_speller) {
char *temp;
int spell_res;
if ((temp = tempnam(0, "nano.")) == NULL) {
statusbar(_("Could not create a temporary filename: %s"),
@ -1297,16 +1309,12 @@ int do_spell(void)
if (write_file(temp, 1) == -1)
return 0;
size = strlen(temp) + strlen(alt_speller) + 2;
foo = nmalloc(size);
snprintf(foo, size, "%s %s", alt_speller, temp);
if (alt_speller)
spell_res = do_alt_speller(temp);
else
spell_res = do_int_speller(temp);
spell_res = do_alt_speller(foo, temp);
exit_spell(temp, foo);
} else
spell_res = do_int_speller();
remove(temp);
if (spell_res)
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},
{"current->data now = \"%s\"\n", 143},
{"After, data = \"%s\"\n", 144},
{"Error deleting tempfile, ack!", 145},
{"Edit a replacement", 146},
{"Could not create a temporary filename: %s", 147},
{"Finished checking spelling", 148},
{"Spell checking failed", 149},
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 150},
{"Cannot resize top win", 151},
{"Cannot move top win", 152},
{"Cannot resize edit win", 153},
{"Cannot move edit win", 154},
{"Cannot resize bottom win", 155},
{"Cannot move bottom win", 156},
{"Justify Complete", 157},
{"%s enable/disable", 158},
{"enabled", 159},
{"disabled", 160},
{"Main: set up windows\n", 161},
{"Main: bottom win\n", 162},
{"Main: open file\n", 163},
{"I got Alt-O-%c! (%d)\n", 164},
{"I got Alt-[-1-%c! (%d)\n", 165},
{"I got Alt-[-2-%c! (%d)\n", 166},
{"I got Alt-[-%c! (%d)\n", 167},
{"I got Alt-%c! (%d)\n", 168},
{"Case Sensitive Regexp Search%s%s", 169},
{"Regexp Search%s%s", 170},
{"Case Sensitive Search%s%s", 171},
{"Search%s%s", 172},
{" (to replace)", 173},
{"Search Cancelled", 174},
{"\"%s...\" not found", 175},
{"Search Wrapped", 176},
{"Replaced %d occurences", 177},
{"Replaced 1 occurence", 178},
{"Replace Cancelled", 179},
{"Replace this instance?", 180},
{"Replace failed: unknown subexpression!", 181},
{"Replace with [%s]", 182},
{"Replace with", 183},
{"Enter line number", 184},
{"Aborted", 185},
{"Come on, be reasonable", 186},
{"Only %d lines available, skipping to last line", 187},
{"actual_x_from_start for xplus=%d returned %d\n", 188},
{"input '%c' (%d)\n", 189},
{"New Buffer", 190},
{" File: ...", 191},
{"Modified", 192},
{"Moved to (%d, %d) in edit buffer\n", 193},
{"current->data = \"%s\"\n", 194},
{"I got \"%s\"\n", 195},
{"Yes", 196},
{"All", 197},
{"No", 198},
{"do_cursorpos: linepct = %f, bytepct = %f\n", 199},
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 200},
{"Dumping file buffer to stderr...\n", 201},
{"Dumping cutbuffer to stderr...\n", 202},
{"Dumping a buffer to stderr...\n", 203},
{"Edit a replacement", 145},
{"Could not create a temporary filename: %s", 146},
{"Finished checking spelling", 147},
{"Spell checking failed", 148},
{"Save modified buffer (ANSWERING \"No\" WILL DESTROY CHANGES) ? ", 149},
{"Cannot resize top win", 150},
{"Cannot move top win", 151},
{"Cannot resize edit win", 152},
{"Cannot move edit win", 153},
{"Cannot resize bottom win", 154},
{"Cannot move bottom win", 155},
{"Justify Complete", 156},
{"%s enable/disable", 157},
{"enabled", 158},
{"disabled", 159},
{"Main: set up windows\n", 160},
{"Main: bottom win\n", 161},
{"Main: open file\n", 162},
{"I got Alt-O-%c! (%d)\n", 163},
{"I got Alt-[-1-%c! (%d)\n", 164},
{"I got Alt-[-2-%c! (%d)\n", 165},
{"I got Alt-[-%c! (%d)\n", 166},
{"I got Alt-%c! (%d)\n", 167},
{"Case Sensitive Regexp Search%s%s", 168},
{"Regexp Search%s%s", 169},
{"Case Sensitive Search%s%s", 170},
{"Search%s%s", 171},
{" (to replace)", 172},
{"Search Cancelled", 173},
{"\"%s...\" not found", 174},
{"Search Wrapped", 175},
{"Replaced %d occurences", 176},
{"Replaced 1 occurence", 177},
{"Replace Cancelled", 178},
{"Replace this instance?", 179},
{"Replace failed: unknown subexpression!", 180},
{"Replace with [%s]", 181},
{"Replace with", 182},
{"Enter line number", 183},
{"Aborted", 184},
{"Come on, be reasonable", 185},
{"Only %d lines available, skipping to last line", 186},
{"actual_x_from_start for xplus=%d returned %d\n", 187},
{"input '%c' (%d)\n", 188},
{"New Buffer", 189},
{" File: ...", 190},
{"Modified", 191},
{"Moved to (%d, %d) in edit buffer\n", 192},
{"current->data = \"%s\"\n", 193},
{"I got \"%s\"\n", 194},
{"Yes", 195},
{"All", 196},
{"No", 197},
{"do_cursorpos: linepct = %f, bytepct = %f\n", 198},
{"line %d of %d (%.0f%%), character %d of %d (%.0f%%)", 199},
{"Dumping file buffer to stderr...\n", 200},
{"Dumping cutbuffer to stderr...\n", 201},
{"Dumping a buffer to stderr...\n", 202},
};
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 ""
msgstr ""
"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"
"Last-Translator: Florian König <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 ""
msgstr ""
"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"
"Last-Translator: Jordi Mallach <jordi@sindominio.net>\n"
"Language-Team: Spanish <es@li.org>\n"

BIN
po/fi.gmo

Binary file not shown.

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"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"
"Last-Translator: Pauli Virtanen <pauli.virtanen@saunalahti.fi>\n"
"Language-Team: Finnish <fi@li.org>\n"

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"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"
"Last-Translator: Clement Laforet <sheep.killer@free.fr>\n"
"Language-Team: French <LL@li.org>\n"

BIN
po/id.gmo

Binary file not shown.

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"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"
"Last-Translator: Tedi Heriyanto <tedi-h@usa.net>\n"
"Language-Team: Indonesian <id@li.org>\n"

BIN
po/it.gmo

Binary file not shown.

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"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"
"Last-Translator: Daniele Medri <madrid@linux.it>\n"
"MIME-Version: 1.0\n"

View File

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