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
#ifndef NANO_SMALL
if (buf[strlen(buf) - 1] == '\r') {
- SET(DOS_FILE);
fileptr->data[strlen(buf) - 1] = 0;
+ totsize--;
}
#endif
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;
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
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
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"));
#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
{"view", 0, 0, 'v'},
#ifndef NANO_SMALL
{"cut", 0, 0, 'k'},
+ {"dos", 0, 0, 'D'},
{"autoindent", 0, 0, 'i'},
#endif
{"tempfile", 0, 0, 't'},
#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);
#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 */
#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