Added mac file support too
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@774 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
7004c289f8
Коммит
8fa1e28681
@ -14,6 +14,8 @@ CVS code -
|
||||
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.
|
||||
- Mac file writing supported too. Flag -M, --mac. No toggle
|
||||
as of yet.
|
||||
- nano.c:
|
||||
main()
|
||||
- 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.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
@ -155,7 +155,7 @@ all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi
|
||||
$(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
|
||||
cd $(top_builddir) \
|
||||
@ -164,7 +164,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
$(ACLOCAL_M4): configure.in
|
||||
cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
||||
|
||||
config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
config.status: $(srcdir)/configure.in $(CONFIG_STATUS_DEPENDENCIES)
|
||||
$(SHELL) ./config.status --recheck
|
||||
$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
|
||||
cd $(srcdir) && $(AUTOCONF)
|
||||
@ -324,7 +324,7 @@ uninstall-info:
|
||||
else ii=; fi; \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
test -z "$ii" \
|
||||
test -z "$$ii" \
|
||||
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
||||
done
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@ -531,7 +531,7 @@ distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
d=$(srcdir); \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$/$$file $(distdir)/$$file; \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|
2
aclocal.m4
поставляемый
2
aclocal.m4
поставляемый
@ -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 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. */
|
||||
#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 */
|
||||
while ((size = read_byte(fd, filename, input)) > 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);
|
||||
num_lines++;
|
||||
buf[0] = 0;
|
||||
@ -1125,8 +1129,10 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||
#endif
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(DOS_FILE))
|
||||
if (ISSET(DOS_FILE) || ISSET(MAC_FILE))
|
||||
write(fd, "\r", 1);
|
||||
|
||||
if (!ISSET(MAC_FILE))
|
||||
#endif
|
||||
write(fd, "\n", 1);
|
||||
|
||||
@ -1151,7 +1157,10 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ISSET(MAC_FILE))
|
||||
#endif
|
||||
{
|
||||
size = write(fd, "\n", 1);
|
||||
lineswritten++;
|
||||
if (size == -1) {
|
||||
@ -1161,6 +1170,7 @@ int write_file(char *name, int tmp, int append, int nonamechange)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (close(fd) == -1) {
|
||||
|
19
nano.c
19
nano.c
@ -412,6 +412,11 @@ void usage(void)
|
||||
(_
|
||||
(" -F --multibuffer Enable multiple file buffers\n"));
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
printf
|
||||
(_
|
||||
(" -M --mac Write file in Mac format\n"));
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
printf(_
|
||||
(" -R --regexp Use regular expressions for search\n"));
|
||||
@ -476,6 +481,9 @@ void usage(void)
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
printf(_(" -F Enable multiple file buffers\n"));
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
printf(_(" -M Write file in Mac format\n"));
|
||||
#endif
|
||||
printf(_(" -T [num] Set width of a tab to num\n"));
|
||||
printf(_(" -R Use regular expressions for search\n"));
|
||||
@ -2416,6 +2424,7 @@ int main(int argc, char *argv[])
|
||||
#ifndef NANO_SMALL
|
||||
{"cut", 0, 0, 'k'},
|
||||
{"dos", 0, 0, 'D'},
|
||||
{"mac", 0, 0, 'M'},
|
||||
{"autoindent", 0, 0, 'i'},
|
||||
#endif
|
||||
{"tempfile", 0, 0, 't'},
|
||||
@ -2458,11 +2467,11 @@ int main(int argc, char *argv[])
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
#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) {
|
||||
#else
|
||||
while ((optchr =
|
||||
getopt(argc, argv, "h?DFRT:Vabcefgijklmo:pr:s:tvwxz")) != EOF) {
|
||||
getopt(argc, argv, "h?DFMRT:Vabcefgijklmo:pr:s:tvwxz")) != EOF) {
|
||||
#endif
|
||||
|
||||
switch (optchr) {
|
||||
@ -2477,7 +2486,11 @@ int main(int argc, char *argv[])
|
||||
SET(MULTIBUFFER);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
case 'M':
|
||||
SET(MAC_FILE);
|
||||
break;
|
||||
#endif
|
||||
case 'T':
|
||||
tabsize = atoi(optarg);
|
||||
if (tabsize <= 0) {
|
||||
|
1
nano.h
1
nano.h
@ -141,6 +141,7 @@ typedef struct rcoption {
|
||||
#define MULTIBUFFER (1<<19)
|
||||
#define CLEAR_BACKUPSTRING (1<<20)
|
||||
#define DOS_FILE (1<<21)
|
||||
#define MAC_FILE (1<<22)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad */
|
||||
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user