1
1

-D cmdline flag for DOS formatted files

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@773 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
Chris Allegretta 2001-09-22 00:42:10 +00:00
родитель 6414b40d3d
Коммит 7004c289f8
5 изменённых файлов: 31 добавлений и 12 удалений

Просмотреть файл

@ -11,7 +11,9 @@ CVS code -
open_file_dup_search (arg), new function do_gotopos for -F
(Ravid Lawrence Ramsey).
- Code to read/write dos formatted files. Massive amounts of
new code in read_line and write_file. New flag DOS_FILE.
new code in read_line and write_file. New cmdline flag
(-D --dos) to automatically write the file in DOS format,
regardless of the original format.
- nano.c:
main()
- Added vars oldcurrent and oldcurrent_x to check whether cursor

Просмотреть файл

@ -126,8 +126,8 @@ filestruct *read_line(char *buf, filestruct * prev, int *line1ins)
#ifndef NANO_SMALL
if (buf[strlen(buf) - 1] == '\r') {
SET(DOS_FILE);
fileptr->data[strlen(buf) - 1] = 0;
totsize--;
}
#endif

Просмотреть файл

@ -151,7 +151,7 @@ void toggle_init(void)
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
*toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_case_msg,
*toggle_backwards_msg;
*toggle_backwards_msg, *toggle_dos_msg;
#ifdef ENABLE_MULTIBUFFER
char *toggle_load_msg, *nano_openprev_msg, *nano_opennext_msg;
@ -170,6 +170,7 @@ void toggle_init(void)
toggle_cuttoend_msg = _("Cut to end");
toggle_backwards_msg = _("Backwards Search");
toggle_case_msg = _("Case Sensitive Search");
toggle_dos_msg = _("Writing file in DOS format");
#ifdef HAVE_REGEX_H
toggle_regexp_msg = _("Regular expressions");
#endif
@ -201,13 +202,15 @@ void toggle_init(void)
REVERSE_SEARCH, 0);
toggle_init_one(&toggles[9], TOGGLE_CASE_KEY, toggle_case_msg,
CASE_SENSITIVE, 0);
toggle_init_one(&toggles[10], TOGGLE_DOS_KEY, toggle_dos_msg,
DOS_FILE, 0);
#ifdef ENABLE_MULTIBUFFER
toggle_init_one(&toggles[10], TOGGLE_LOAD_KEY, toggle_load_msg,
toggle_init_one(&toggles[11], TOGGLE_LOAD_KEY, toggle_load_msg,
MULTIBUFFER, 0);
toggle_init_one(&toggles[11], NANO_OPENPREV_KEY, nano_openprev_msg,
toggle_init_one(&toggles[12], NANO_OPENPREV_KEY, nano_openprev_msg,
0, '<');
toggle_init_one(&toggles[12], NANO_OPENNEXT_KEY, nano_opennext_msg,
toggle_init_one(&toggles[13], NANO_OPENNEXT_KEY, nano_opennext_msg,
0, '>');
#endif

23
nano.c
Просмотреть файл

@ -402,18 +402,22 @@ void usage(void)
printf(_("Usage: nano [GNU long option] [option] +LINE <file>\n\n"));
printf(_("Option Long option Meaning\n"));
#ifndef NANO_SMALL
printf
(_
(" -D --dos Write file in DOS format\n"));
#endif
#ifdef ENABLE_MULTIBUFFER
printf
(_
(" -F --multibuffer Enable multiple file buffers\n"));
#endif
printf(_
(" -T [num] --tabsize=[num] Set width of a tab to num\n"));
#ifdef HAVE_REGEX_H
printf(_
(" -R --regexp Use regular expressions for search\n"));
#endif
printf(_
(" -T [num] --tabsize=[num] Set width of a tab to num\n"));
printf
(_
(" -V --version Print version information and exit\n"));
@ -467,6 +471,9 @@ void usage(void)
#else
printf(_("Usage: nano [option] +LINE <file>\n\n"));
printf(_("Option Meaning\n"));
#ifndef NANO_SMALL
printf(_(" -D Write file in DOS format\n"));
#endif
#ifdef ENABLE_MULTIBUFFER
printf(_(" -F Enable multiple file buffers\n"));
#endif
@ -2408,6 +2415,7 @@ int main(int argc, char *argv[])
{"view", 0, 0, 'v'},
#ifndef NANO_SMALL
{"cut", 0, 0, 'k'},
{"dos", 0, 0, 'D'},
{"autoindent", 0, 0, 'i'},
#endif
{"tempfile", 0, 0, 't'},
@ -2450,15 +2458,20 @@ int main(int argc, char *argv[])
#endif /* ENABLE_NANORC */
#ifdef HAVE_GETOPT_LONG
while ((optchr = getopt_long(argc, argv, "h?FT:RVabcefgijklmo:pr:s:tvwxz",
while ((optchr = getopt_long(argc, argv, "h?DFRT:Vabcefgijklmo:pr:s:tvwxz",
long_options, &option_index)) != EOF) {
#else
while ((optchr =
getopt(argc, argv, "h?FT:RVabcefgijklmo:pr:s:tvwxz")) != EOF) {
getopt(argc, argv, "h?DFRT:Vabcefgijklmo:pr:s:tvwxz")) != EOF) {
#endif
switch (optchr) {
#ifndef NANO_SMALL
case 'D':
SET(DOS_FILE);
break;
#endif
#ifdef ENABLE_MULTIBUFFER
case 'F':
SET(MULTIBUFFER);

3
nano.h
Просмотреть файл

@ -274,6 +274,7 @@ know what you're doing */
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
#define TOGGLE_CASE_KEY NANO_ALT_A
#define TOGGLE_LOAD_KEY NANO_ALT_F
#define TOGGLE_DOS_KEY NANO_ALT_D
/* Toggle stuff, these static lengths need to go away RSN */
@ -307,7 +308,7 @@ know what you're doing */
#define WHEREIS_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
#define REPLACE_LIST_LEN (8 - NO_REGEX - NO_TOGGLES)
#define TOGGLE_LEN (11 - NO_REGEX + MULTI_TOGGLES)
#define TOGGLE_LEN (12 - NO_REGEX + MULTI_TOGGLES)
#define WRITEFILE_LIST_LEN (3 - NO_BROWSER)
#define INSERTFILE_LIST_LEN (2 - NO_BROWSER)
#define BROWSER_LIST_LEN 4