Added mac file support too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@774 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
7004c289f8
commit
8fa1e28681
|
@ -14,6 +14,8 @@ CVS code -
|
||||||
new code in read_line and write_file. New cmdline flag
|
new code in read_line and write_file. New cmdline flag
|
||||||
(-D --dos) to automatically write the file in DOS format,
|
(-D --dos) to automatically write the file in DOS format,
|
||||||
regardless of the original format.
|
regardless of the original format.
|
||||||
|
- Mac file writing supported too. Flag -M, --mac. No toggle
|
||||||
|
as of yet.
|
||||||
- nano.c:
|
- nano.c:
|
||||||
main()
|
main()
|
||||||
- Added vars oldcurrent and oldcurrent_x to check whether cursor
|
- Added vars oldcurrent and oldcurrent_x to check whether cursor
|
||||||
|
|
10
Makefile.in
10
Makefile.in
|
@ -1,4 +1,4 @@
|
||||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
|
@ -155,7 +155,7 @@ all: all-redirect
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi
|
.SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi
|
||||||
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||||
cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile
|
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps Makefile
|
||||||
|
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
cd $(top_builddir) \
|
cd $(top_builddir) \
|
||||||
|
@ -164,7 +164,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
$(ACLOCAL_M4): configure.in
|
$(ACLOCAL_M4): configure.in
|
||||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||||
|
|
||||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
$(SHELL) ./config.status --recheck
|
$(SHELL) ./config.status --recheck
|
||||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||||
cd $(srcdir) && $(AUTOCONF)
|
cd $(srcdir) && $(AUTOCONF)
|
||||||
|
@ -324,7 +324,7 @@ uninstall-info:
|
||||||
else ii=; fi; \
|
else ii=; fi; \
|
||||||
list='$(INFO_DEPS)'; \
|
list='$(INFO_DEPS)'; \
|
||||||
for file in $$list; do \
|
for file in $$list; do \
|
||||||
test -z "$ii" \
|
test -z "$$ii" \
|
||||||
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
||||||
done
|
done
|
||||||
@$(NORMAL_UNINSTALL)
|
@$(NORMAL_UNINSTALL)
|
||||||
|
@ -531,7 +531,7 @@ distdir: $(DISTFILES)
|
||||||
@for file in $(DISTFILES); do \
|
@for file in $(DISTFILES); do \
|
||||||
d=$(srcdir); \
|
d=$(srcdir); \
|
||||||
if test -d $$d/$$file; then \
|
if test -d $$d/$$file; then \
|
||||||
cp -pr $$/$$file $(distdir)/$$file; \
|
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||||
else \
|
else \
|
||||||
test -f $(distdir)/$$file \
|
test -f $(distdir)/$$file \
|
||||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p4
|
||||||
|
|
||||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||||
dnl This file is free software; the Free Software Foundation
|
dnl This file is free software; the Free Software Foundation
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
|
/* config.h.in. Generated automatically from configure.in by autoheader. */
|
||||||
|
|
||||||
/* Define if using alloca.c. */
|
/* Define if using alloca.c. */
|
||||||
#undef C_ALLOCA
|
#undef C_ALLOCA
|
||||||
|
|
14
files.c
14
files.c
|
@ -184,7 +184,11 @@ int read_file(int fd, char *filename, int quiet)
|
||||||
/* Read the entire file into file struct */
|
/* Read the entire file into file struct */
|
||||||
while ((size = read_byte(fd, filename, input)) > 0) {
|
while ((size = read_byte(fd, filename, input)) > 0) {
|
||||||
linetemp = 0;
|
linetemp = 0;
|
||||||
if (input[0] == '\n') {
|
if (input[0] == '\n'
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
|| (ISSET(MAC_FILE) && input[0] == '\r')
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
fileptr = read_line(buf, fileptr, &line1ins);
|
fileptr = read_line(buf, fileptr, &line1ins);
|
||||||
num_lines++;
|
num_lines++;
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
|
@ -1125,8 +1129,10 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
if (ISSET(DOS_FILE))
|
if (ISSET(DOS_FILE) || ISSET(MAC_FILE))
|
||||||
write(fd, "\r", 1);
|
write(fd, "\r", 1);
|
||||||
|
|
||||||
|
if (!ISSET(MAC_FILE))
|
||||||
#endif
|
#endif
|
||||||
write(fd, "\n", 1);
|
write(fd, "\n", 1);
|
||||||
|
|
||||||
|
@ -1151,7 +1157,10 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ISSET(MAC_FILE))
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
size = write(fd, "\n", 1);
|
size = write(fd, "\n", 1);
|
||||||
lineswritten++;
|
lineswritten++;
|
||||||
if (size == -1) {
|
if (size == -1) {
|
||||||
|
@ -1161,6 +1170,7 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (close(fd) == -1) {
|
if (close(fd) == -1) {
|
||||||
|
|
19
nano.c
19
nano.c
|
@ -412,6 +412,11 @@ void usage(void)
|
||||||
(_
|
(_
|
||||||
(" -F --multibuffer Enable multiple file buffers\n"));
|
(" -F --multibuffer Enable multiple file buffers\n"));
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
printf
|
||||||
|
(_
|
||||||
|
(" -M --mac Write file in Mac format\n"));
|
||||||
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
printf(_
|
printf(_
|
||||||
(" -R --regexp Use regular expressions for search\n"));
|
(" -R --regexp Use regular expressions for search\n"));
|
||||||
|
@ -476,6 +481,9 @@ void usage(void)
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
printf(_(" -F Enable multiple file buffers\n"));
|
printf(_(" -F Enable multiple file buffers\n"));
|
||||||
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
printf(_(" -M Write file in Mac format\n"));
|
||||||
#endif
|
#endif
|
||||||
printf(_(" -T [num] Set width of a tab to num\n"));
|
printf(_(" -T [num] Set width of a tab to num\n"));
|
||||||
printf(_(" -R Use regular expressions for search\n"));
|
printf(_(" -R Use regular expressions for search\n"));
|
||||||
|
@ -2416,6 +2424,7 @@ int main(int argc, char *argv[])
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
{"cut", 0, 0, 'k'},
|
{"cut", 0, 0, 'k'},
|
||||||
{"dos", 0, 0, 'D'},
|
{"dos", 0, 0, 'D'},
|
||||||
|
{"mac", 0, 0, 'M'},
|
||||||
{"autoindent", 0, 0, 'i'},
|
{"autoindent", 0, 0, 'i'},
|
||||||
#endif
|
#endif
|
||||||
{"tempfile", 0, 0, 't'},
|
{"tempfile", 0, 0, 't'},
|
||||||
|
@ -2458,11 +2467,11 @@ int main(int argc, char *argv[])
|
||||||
#endif /* ENABLE_NANORC */
|
#endif /* ENABLE_NANORC */
|
||||||
|
|
||||||
#ifdef HAVE_GETOPT_LONG
|
#ifdef HAVE_GETOPT_LONG
|
||||||
while ((optchr = getopt_long(argc, argv, "h?DFRT:Vabcefgijklmo:pr:s:tvwxz",
|
while ((optchr = getopt_long(argc, argv, "h?DFMRT:Vabcefgijklmo:pr:s:tvwxz",
|
||||||
long_options, &option_index)) != EOF) {
|
long_options, &option_index)) != EOF) {
|
||||||
#else
|
#else
|
||||||
while ((optchr =
|
while ((optchr =
|
||||||
getopt(argc, argv, "h?DFRT:Vabcefgijklmo:pr:s:tvwxz")) != EOF) {
|
getopt(argc, argv, "h?DFMRT:Vabcefgijklmo:pr:s:tvwxz")) != EOF) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (optchr) {
|
switch (optchr) {
|
||||||
|
@ -2477,7 +2486,11 @@ int main(int argc, char *argv[])
|
||||||
SET(MULTIBUFFER);
|
SET(MULTIBUFFER);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef NANO_SMALL
|
||||||
|
case 'M':
|
||||||
|
SET(MAC_FILE);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
case 'T':
|
case 'T':
|
||||||
tabsize = atoi(optarg);
|
tabsize = atoi(optarg);
|
||||||
if (tabsize <= 0) {
|
if (tabsize <= 0) {
|
||||||
|
|
1
nano.h
1
nano.h
|
@ -141,6 +141,7 @@ typedef struct rcoption {
|
||||||
#define MULTIBUFFER (1<<19)
|
#define MULTIBUFFER (1<<19)
|
||||||
#define CLEAR_BACKUPSTRING (1<<20)
|
#define CLEAR_BACKUPSTRING (1<<20)
|
||||||
#define DOS_FILE (1<<21)
|
#define DOS_FILE (1<<21)
|
||||||
|
#define MAC_FILE (1<<22)
|
||||||
|
|
||||||
/* Control key sequences, changing these would be very very bad */
|
/* Control key sequences, changing these would be very very bad */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue