syntaxfile_regexp and synfilematches. Global flag -Y ,--syntax
to specify the type on the command line, if there's no good
filename regex to use. Global variable syntaxstr.
+ - Changed many strcmp()s and strcpy()s to their equivalent
+ '\0' conterparts (David Lawrence Ramsey).
+ - Many chanes to allow marked cutting to work with multiple
+ file buffers: changes to openfilestruct type in nano.h and
+ files.c (David Lawrence Ramsey).
- configure.ac:
- Define NDEBUG to silence asserts (David Benbennick).
- files.c:
- nano.spec.in:
- Don't put Chris' name as the Packager in the distribution
by default (Im an idiot).
+ - Fixed Source line (David Lawrence Ramsey).
- nano.1:
- Changed references to Debian GNU/Linux to Debian GNU (Jordi).
+- nano.1.html:
+ - Updated for -Y option (David Lawrence Ramsey).
- rcfile.c
- Made some rc file errors less fatal.
+ - Added in my patch for getpwent instead of relying on $HOME
+ (David Lawrence Ramsey).
- winio.c:
edit_add()
- Changed some syntax hilight computations for the sake of COLS.
#endif
/* Load file into edit buffer - takes data from file struct */
-void load_file(int quiet)
+void load_file(int update)
{
current = fileage;
#ifdef ENABLE_MULTIBUFFER
- /* if quiet is zero, add a new entry to the open_files structure;
+ /* if update is zero, add a new entry to the open_files structure;
otherwise, update the current entry (the latter is needed in the
case of the alternate spell checker) */
- add_open_file(quiet);
+ add_open_file(update);
#endif
#ifdef ENABLE_COLOR
{
fileage = nmalloc(sizeof(filestruct));
fileage->data = charalloc(1);
- strcpy(fileage->data, "");
+ fileage->data[0] = '\0';
fileage->prev = NULL;
fileage->next = NULL;
fileage->lineno = 1;
/* if there aren't any entries in open_files, create the entry for
this new file; without this, if nano is started without a filename
on the command line, a new file will be created, but it will be
- given no open_files entry, leading to problems later on */
+ given no open_files entry */
if (!open_files) {
add_open_file(0);
/* turn off view mode in this case; this is for consistency
}
-filestruct *read_line(char *buf, filestruct * prev, int *line1ins)
+filestruct *read_line(char *buf, filestruct *prev, int *line1ins)
{
filestruct *fileptr;
return fileptr;
}
-int read_file(FILE *f, char *filename, int quiet)
+int read_file(FILE *f, const char *filename, int quiet)
{
int num_lines = 0;
- char input; /* current input character */
+ signed char input; /* current input character */
char *buf;
long i = 0, bufx = 128;
filestruct *fileptr = current, *tmp = NULL;
new_magicline();
totsize--;
- /* Update the edit buffer */
+ /* Update the edit buffer; note that if using multibuffers, a
+ quiet load will update the current open_files entry, while a
+ noisy load will add a new open_files entry */
load_file(quiet);
}
return 1;
}
-
/* Open the file (and decide if it exists) */
-int open_file(char *filename, int insert, int quiet)
+int open_file(const char *filename, int insert, int quiet)
{
int fd;
FILE *f;
struct stat fileinfo;
- if (!strcmp(filename, "") || stat(filename, &fileinfo) == -1) {
+ if (filename[0] == '\0' || stat(filename, &fileinfo) == -1) {
if (insert && !quiet) {
statusbar(_("\"%s\" not found"), filename);
return -1;
/* Don't open character or block files. Sorry, /dev/sndstat! */
statusbar(_("File \"%s\" is a device file"), filename);
-
if (!insert)
new_file();
return -1;
return 1;
}
-
/* This function will return the name of the first available extension
of a filename (starting with the filename, then filename.1, etc).
Memory is allocated for the return value. If no writable extension
int do_insertfile(int loading_file)
{
- int i;
+ int i, old_current_x = current_x;
char *realname = NULL;
wrap_reset();
if (i == NANO_EXTCMD_KEY) {
int ts;
ts = statusq(1, extcmd_list, "", _("Command to execute "));
- if (ts == -1 || answer == NULL || !strcmp(answer,"")) {
+ if (ts == -1 || answer == NULL || answer[0] == '\0') {
statusbar(_("Cancelled"));
UNSET(KEEP_CUTBUFFER);
display_main_list();
new_file();
UNSET(MODIFIED);
+#ifndef NANO_SMALL
+ UNSET(MARK_ISSET);
+#endif
}
#endif
}
#endif
+#ifdef ENABLE_MULTIBUFFER
+ if (!loading_file) {
+#endif
+
+ /* Restore the old x-coordinate position */
+ current_x = old_current_x;
+
+#ifdef ENABLE_MULTIBUFFER
+ }
+#endif
+
/* If we've gone off the bottom, recenter; otherwise, just redraw */
if (current->lineno > editbot->lineno)
edit_update(current, CENTER);
/* save current line number */
open_files->file_lineno = current->lineno;
+ /* if we're updating, save current modification status (and marking
+ status, if available) */
+ if (update) {
+#ifndef NANO_SMALL
+ open_files->file_flags = (MODIFIED & ISSET(MODIFIED)) | (MARK_ISSET & ISSET(MARK_ISSET));
+ if (ISSET(MARK_ISSET)) {
+ open_files->file_mark_beginbuf = mark_beginbuf;
+ open_files->file_mark_beginx = mark_beginx;
+ }
+#else
+ open_files->file_flags = (MODIFIED & ISSET(MODIFIED));
+#endif
+ }
+
/* if we're in view mode and updating, the file contents won't
have changed, so we won't bother resaving the filestruct
then; otherwise, we will */
if (!(ISSET(VIEW_MODE) && !update)) {
- /* save current filestruct and restore full file position
- afterward */
- open_files->fileage = fileage;
- do_gotopos(open_files->file_lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
+ /* save current file buffer */
+ open_files->fileage = fileage;
+ open_files->filebot = filebot;
}
- /* save current modification status */
- open_files->file_modified = ISSET(MODIFIED);
-
#ifdef DEBUG
fprintf(stderr, _("filename is %s"), open_files->filename);
#endif
return 0;
}
-/*
- * Update only the filename stored in the current entry. Return 0 on
- * success or 1 on error.
- */
-int open_file_change_name(void)
-{
- if (!open_files || !filename)
- return 1;
-
- /* save current filename */
- open_files->filename = mallocstrcpy(open_files->filename, filename);
-
- return 0;
-}
-
/*
* Read the current entry in the open_files structure and set up the
* currently open file using that entry's information. Return 0 on
*/
int load_open_file(void)
{
-
if (!open_files)
return 1;
filename = mallocstrcpy(filename, open_files->filename);
fileage = open_files->fileage;
current = fileage;
+ filebot = open_files->filebot;
totlines = open_files->file_totlines;
totsize = open_files->file_totsize;
- /* Unset the marker because nano can't (yet) handle marked text
- flipping between open files */
- UNSET(MARK_ISSET);
+ /* restore modification status */
+ if (open_files->file_flags & MODIFIED)
+ SET(MODIFIED);
+ else
+ UNSET(MODIFIED);
+
+#ifndef NANO_SMALL
+ /* restore marking status */
+ if (open_files->file_flags & MARK_ISSET) {
+ mark_beginbuf = open_files->file_mark_beginbuf;
+ mark_beginx = open_files->file_mark_beginx;
+ SET(MARK_ISSET);
+ } else
+ UNSET(MARK_ISSET);
+#endif
/* restore full file position: line number, x-coordinate, y-
coordinate, place we want */
do_gotopos(open_files->file_lineno, open_files->file_current_x, open_files->file_current_y, open_files->file_placewewant);
- /* restore the bottom of the file */
- filebot = current;
- while (filebot->next)
- filebot = filebot->next;
-
- /* set up modification status and update the titlebar */
- if (open_files->file_modified)
- SET(MODIFIED);
- else
- UNSET(MODIFIED);
+ /* update the titlebar */
clearok(topwin, FALSE);
titlebar(NULL);
if (!open_files)
return 1;
+ /* make sure open_files->fileage and fileage, and open_files->filebot
+ and filebot, are in sync; they might not be if lines have been cut
+ from the top or bottom of the file */
open_files->fileage = fileage;
+ open_files->filebot = filebot;
tmp = open_files;
if (open_nextfile(1)) {
struct stat st, lst;
char *realname = NULL;
- if (!strcmp(name, "")) {
+ if (name[0] == '\0') {
statusbar(_("Cancelled"));
return -1;
}
#ifndef DISABLE_OPERATINGDIR
if (!tmp && operating_dir) {
- /* if we're writing a temporary file, we're going outside the
- operating directory, so skip the operating directory test */
+ /* if we're writing a temporary file, we're probably going
+ outside the operating directory, so skip the operating
+ directory test */
if (check_operating_dir(realname, 0)) {
statusbar(_("Can't write outside of %s"), operating_dir);
#ifdef ENABLE_MULTIBUFFER
/* if we're not about to exit, update the current entry in
the open_files structure */
- if (!exiting) {
-
- /* first, if the filename was changed during the save,
- update the filename stored in the current entry, and
- then update the current entry */
- if (strcmp(open_files->filename, filename)) {
- open_file_change_name();
- add_open_file(1);
- }
- else {
-
- /* otherwise, just update the current entry */
- add_open_file(1);
- }
- }
+ if (!exiting)
+ add_open_file(1);
#endif
display_main_list();
strcat(buf, "*");
/* Okie, if there's a / in the buffer, strip out the directory part */
- if (strcmp(buf, "") && strstr(buf, "/")) {
+ if (buf[0] != '\0' && strstr(buf, "/")) {
dirName = charalloc(strlen(buf) + 1);
tmp = buf + strlen(buf);
while (*tmp != '/' && tmp != buf)
buf = nrealloc(buf, strlen(buf) + strlen(matches[0]) + 1);
- if (strcmp(buf, "") && strstr(buf, "/")) {
+ if (buf[0] != '\0' && strstr(buf, "/")) {
for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf;
tmp--);
tmp++;
/* Check to see if all matches share a beginning, and, if so,
tack it onto buf and then beep */
- if (strcmp(buf, "") && strstr(buf, "/")) {
+ if (buf[0] != '\0' && strstr(buf, "/")) {
for (tmp = buf + strlen(buf); *tmp != '/' && tmp != buf;
tmp--);
tmp++;
} while ((kbinput = wgetch(edit)) != NANO_EXIT_KEY);
curs_set(1);
blank_edit();
- titlebar(NULL);
+ titlebar(NULL);
edit_refresh();
kb = keypad_on(edit, kb);
wrap_reset();
if (current->next != NULL) {
update_line(current->prev, 0);
-
if (placewewant > 0)
current_x = actual_x(current->next, placewewant);
-
- if (current_x > strlen(current->next->data))
- current_x = strlen(current->next->data);
} else {
UNSET(KEEP_CUTBUFFER);
check_statblank();
if (current->prev != NULL) {
if (placewewant > 0)
current_x = actual_x(current->prev, placewewant);
-
- if (current_x > strlen(current->prev->data))
- current_x = strlen(current->prev->data);
}
if (current_y > 0)
current_y--;
Mainly, this will happen if Nano receives a SIGHUP or runs out of
memory, when it will write the buffer into a file named "nano.save" if the
buffer didn't have a name already, or will add a ".save" suffix to the
-current filename. In multibuffer mode, nano will write all the open buffers to
-the respective emergency files. Nano will \fBnot\fP write this file if a
-previous one exists in the current directory.
+current filename. If an emergency file with that name already exists in
+the current directory, ".save" and a number (e.g. ".save.1") will be
+suffixed to the current filename in order to make it unique. In
+multibuffer mode, nano will write all the open buffers to the respective
+emergency files.
.SH BUGS
Please send any comments or bug reports to
.br
<DD>
Show the current version number and author.
+<DT><B>-Y (--syntax=[str])</B>
+
+<DD>
+Specify a specific syntax hilighting from the .nanorc to use (if available).
<DT><B>-c (--const)</B>
<DD>
Mainly, this will happen if Nano receives a SIGHUP or runs out of
memory, when it will write the buffer into a file named "nano.save" if the
buffer didn't have a name already, or will add a ".save" suffix to the
-current filename. In multibuffer mode, nano will write all the open buffers to
-the respective emergency files. Nano will <B>not</B> write this file if a
-previous one exists in the current directory.
+current filename. If an emergency file with that name already exists in
+the current directory, ".save" and a number (e.g. ".save.1") will be
+suffixed to the current filename in order to make it unique. In
+multibuffer mode, nano will write all the open buffers to the respective
+emergency files.
<A NAME="lbAG"> </A>
<H2>BUGS</H2>
Chris Allegretta <<A HREF="mailto:chrisa@asty.org">chrisa@asty.org</A>>, et al (see AUTHORS and THANKS for
details).
This manual page was originally written by Jordi Mallach
-<<A HREF="mailto:jordi@sindominio.net">jordi@sindominio.net</A>>, for the Debian GNU/Linux system (but may be
+<<A HREF="mailto:jordi@sindominio.net">jordi@sindominio.net</A>>, for the Debian GNU system (but may be
used by others).
<P>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
-Time: 12:14:20 GMT, March 04, 2002
+Time: 19:17:30 GMT, May 08, 2002
</BODY>
</HTML>
/* if we already saved the file above (i. e. if it was the
currently loaded file), don't save it again */
if (tmp != open_files) {
+ /* make sure open_files->fileage and fileage, and
+ open_files->filebot and filebot, are in sync; they
+ might not be if lines have been cut from the top or
+ bottom of the file */
fileage = open_files->fileage;
+ filebot = open_files->filebot;
/* save the file if it's been modified */
- if (open_files->file_modified)
+ if (open_files->file_flags & MODIFIED)
die_save_file(open_files->filename);
}
if (die_filename[0] == '\0') {
name = "nano.save";
ret = get_next_filename(name);
- if (strcmp(ret, ""))
+ if (ret[0] != '\0')
i = write_file(ret, 1, 0, 0);
name = ret;
}
strcpy(buf, die_filename);
strcat(buf, ".save");
ret = get_next_filename(buf);
- if (strcmp(ret, ""))
+ if (ret[0] != '\0')
i = write_file(ret, 1, 0, 0);
name = ret;
free(buf);
newnode = nmalloc(sizeof(openfilestruct));
newnode->filename = NULL;
newnode->fileage = NULL;
+ newnode->filebot = NULL;
newnode->prev = prevnode;
newnode->next = NULL;
line we're on now is NOT blank. if it is blank we
can just use IT for the magic line. This is how Pico
appears to do it, in any case */
- if (strcmp(current->data, "")) {
+ if (current->data[0] != '\0') {
new_magicline();
fix_editbot();
}
/* blbf -> blank line before filebot (see below) */
int blbf = 0;
- if (current->next == filebot && !strcmp(current->data, ""))
+ if (current->next == filebot && current->data[0] == '\0')
blbf = 1;
if (current_x != strlen(current->data)) {
/* Please see the comment in do_backspace if you don't understand
this test */
- if (current == filebot && strcmp(current->data, "")) {
+ if (current == filebot && current->data[0] != '\0') {
new_magicline();
fix_editbot();
totsize++;
search_last_line = FALSE;
- if (strcmp(prevanswer,answer) != 0) {
+ if (strcmp(prevanswer, answer)) {
j = i;
do_replace_loop(prevanswer, fileage, &beginx_top, TRUE, &j);
}
}
close(tempfile_fd);
-
/* send spell's standard out to the pipe */
if (dup2(in_fd[1], STDOUT_FILENO) != STDOUT_FILENO) {
#ifdef ENABLE_MULTIBUFFER
/* update the current open_files entry before spell-checking, in case
- any problems occur; the case of there being no open_files entries
- is handled elsewhere (before we reach this point) */
+ any problems occur */
add_open_file(1);
#endif
fprintf(stderr, _("Main: open file\n"));
#endif
- titlebar(NULL);
-
/* Now we check to see if argv[optind] is non-null to determine if
we're dealing with a new file or not, not argc == 1... */
if (argv[optind] == NULL)
else
open_file(filename, 0, 0);
+ titlebar(NULL);
+
if (startline > 0)
do_gotoline(startline, 0);
else
struct openfilestruct *next; /* Next node */
struct openfilestruct *prev; /* Previous node */
struct filestruct *fileage; /* Current file */
+ struct filestruct *filebot; /* Current file's last line */
+#ifndef NANO_SMALL
+ struct filestruct *file_mark_beginbuf;
+ /* Current file's beginning marked line */
+ int file_mark_beginx; /* Current file's beginning marked line's
+ x-coordinate position */
+#endif
int file_current_x; /* Current file's x-coordinate position */
int file_current_y; /* Current file's y-coordinate position */
- int file_modified; /* Current file's modification status */
+ int file_flags; /* Current file's flags: modification
+ status (and marking status, if
+ available) */
int file_placewewant; /* Current file's place we want */
int file_totlines; /* Current file's total number of lines */
long file_totsize; /* Current file's total size */
Copyright : GPL
Group : Console/Editors
URL : http://www.nano-editor.org
-Source : http://www.nano-editor.org/dist/v1.1/%{name}/%{name}-%{ver}.tar.gz
+Source : http://www.nano-editor.org/dist/v1.1/%{name}-%{ver}.tar.gz
BuildRoot : /var/tmp/%{name}-buildroot
Requires : ncurses
int do_uncut_text(void);
int no_help(void);
int renumber_all(void);
-int open_file(char *filename, int insert, int quiet);
+int open_file(const char *filename, int insert, int quiet);
int do_insertfile(int loading_file);
int num_of_digits(int n);
int open_pipe(char *command);
-int read_file(FILE *f, char *filename, int quiet);
+int read_file(FILE *f, const char *filename, int quiet);
#ifdef ENABLE_MULTIBUFFER
int add_open_file(int update);
#include <string.h>
#include <stdio.h>
#include <errno.h>
+#include <unistd.h>
+#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
char *unable = _("Unable to open ~/.nanorc file, %s");
struct stat fileinfo;
FILE *rcstream;
-
- if (getenv("HOME") == NULL)
- return;
+ struct passwd *userage;
nanorc = charalloc(strlen(SYSCONFDIR) + 10);
sprintf(nanorc, "%s/nanorc", SYSCONFDIR);
fclose(rcstream);
}
- nanorc = charalloc(strlen(getenv("HOME")) + 10);
- sprintf(nanorc, "%s/.nanorc", getenv("HOME"));
-
lineno = 0;
+
+ /* Determine home directory using getpwent(), don't rely on $HOME */
+ for (userage = getpwent(); userage != NULL
+ && userage->pw_uid != geteuid(); userage = getpwent())
+ ;
+
+ if (userage == NULL) {
+ rcfile_error(_("I can't find my home directory! Wah!"));
+ return;
+ }
+
+ nanorc = charalloc(strlen(userage->pw_dir) + 10);
+ sprintf(nanorc, "%s/.nanorc", userage->pw_dir);
+
if (stat(nanorc, &fileinfo) == -1) {
/* Abort if the file doesn't exist and there's some other kind
{
if (last_search == NULL) {
last_search = charalloc(1);
- last_search[0] = 0;
+ last_search[0] = '\0';
}
if (last_replace == NULL) {
last_replace = charalloc(1);
- last_replace[0] = 0;
+ last_replace[0] = '\0';
}
}
search_init_globals();
buf = charalloc(strlen(last_search) + 5);
- buf[0] = 0;
+ buf[0] = '\0';
/* Clear the backupstring if we've changed from Pico mode to regular
}
}
else
- strcpy(buf, "");
+ buf[0] = '\0';
/* This is now one simple call. It just does a lot */
i = statusq(0, replacing ? replace_list : whereis_list, backupstring,
filestruct *findnextstr(int quiet, int bracket_mode, filestruct * begin, int beginx,
char *needle)
{
- filestruct *fileptr;
+ filestruct *fileptr = current;
char *searchstr, *rev_start = NULL, *found = NULL;
int current_x_find = 0;
- fileptr = current;
past_editbuff = 0;
return NULL;
}
+ update_line(fileptr, 0);
fileptr = fileptr->next;
if (fileptr == editbot)
/* EOF reached ?, wrap around once */
if (fileptr == NULL) {
if (bracket_mode) /* don't wrap if looking for bracket match */
- return NULL;
+ return NULL;
fileptr = fileage;
past_editbuff = 1;
if (!quiet) {
- statusbar(_("Search Wrapped"));
- SET(DISABLE_CURPOS);
+ statusbar(_("Search Wrapped"));
+ SET(DISABLE_CURPOS);
}
}
return NULL;
}
+ update_line(fileptr, 0);
fileptr = fileptr->prev;
if (fileptr == edittop->prev)
}
/* The sneaky user deleted the previous search string */
- if (!ISSET(PICO_MODE) && !strcmp(answer, "")) {
+ if (!ISSET(PICO_MODE) && answer[0] == '\0') {
statusbar(_("Search Cancelled"));
search_abort();
return 0;
/* If answer is now == "", then PICO_MODE is set. So, copy
last_search into answer... */
- if (!strcmp(answer, ""))
+ if (answer[0] == '\0')
answer = mallocstrcpy(answer, last_search);
else
last_search = mallocstrcpy(last_search, answer);
switch (*i) {
case -1: /* Aborted enter */
- if (strcmp(last_replace, ""))
+ if (last_replace[0] != '\0')
answer = mallocstrcpy(answer, last_replace);
statusbar(_("Replace Cancelled"));
replace_abort();
}
}
- if (ISSET(PICO_MODE) && !strcmp(answer, ""))
+ if (ISSET(PICO_MODE) && answer[0] == '\0')
answer = mallocstrcpy(answer, last_replace);
last_replace = mallocstrcpy(last_replace, answer);
}
/* Again, there was a previous string, but they deleted it and hit enter */
- if (!ISSET(PICO_MODE) && !strcmp(answer, "")) {
+ if (!ISSET(PICO_MODE) && answer[0] == '\0') {
statusbar(_("Replace Cancelled"));
replace_abort();
return 0;
/* If answer is now == "", then PICO_MODE is set. So, copy
last_search into answer (and prevanswer)... */
- if (!strcmp(answer, "")) {
+ if (answer[0] == '\0') {
answer = mallocstrcpy(answer, last_search);
prevanswer = mallocstrcpy(prevanswer, last_search);
} else {
if (ISSET(PICO_MODE)) {
buf = charalloc(strlen(last_replace) + 5);
- if (strcmp(last_replace, "")) {
+ if (last_replace[0] != '\0') {
if (strlen(last_replace) > (COLS / 3)) {
strncpy(buf, last_replace, COLS / 3);
sprintf(&buf[COLS / 3 - 1], "...");
#if (defined ENABLE_MULTIBUFFER || !defined DISABLE_SPELLER)
void do_gotopos(int line, int pos_x, int pos_y, int pos_placewewant)
{
-
/* since do_gotoline() resets the x-coordinate but not the
y-coordinate, set the coordinates up this way */
current_y = pos_y;
#endif
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
-
int do_find_bracket(void)
{
char ch_under_cursor, wanted_ch;
return tabs;
}
-
/* Return the actual place on the screen of current->data[current_x], which
should always be > current_x */
int xplustabs(void)
return xpt(current, current_x);
}
-
/* Return what current_x should be, given xplustabs() for the line,
* given a start position in the filestruct's data */
int actual_x_from_start(filestruct * fileptr, int xplus, int start)
for (i = start; tot <= xplus && fileptr->data[i] != 0; i++, tot++)
if (fileptr->data[i] == NANO_CONTROL_I) {
- if (tot % tabsize == 0)
- tot++;
- else
+ if (tot % tabsize != 0)
tot += tabsize - (tot % tabsize);
} else if (fileptr->data[i] & 0x80)
tot++; /* Make 8 bit chars only 1 column (again) */
- else if (fileptr->data[i] < 32)
+ else if (fileptr->data[i] < 32 || fileptr->data[i] == 127) {
+ i++;
tot += 2;
+ }
#ifdef DEBUG
fprintf(stderr, _("actual_x_from_start for xplus=%d returned %d\n"),
xplus, i);
#endif
+
return i - start;
}
} else if (buf[i] & 0x80)
/* Make 8 bit chars only 1 column! */
;
- else if (buf[i] < 32)
+ else if (buf[i] < 32 || buf[i] == 127)
tabs++;
}
return strnlenpt(buf, strlen(buf));
}
-
/* resets current_y, based on the position of current, and puts the cursor at
(current_y, current_x) */
void reset_cursor(void)
free(inputbuf);
/* In pico mode, just check for a blank answer here */
- if (((ISSET(PICO_MODE)) && !strcmp(answer, "")))
+ if (ISSET(PICO_MODE) && answer[0] == '\0')
return -2;
else
return 0;
namelen = strlen(what);
- if (!strcmp(what, ""))
+ if (what[0] == '\0')
mvwaddstr(topwin, 0, COLS / 2 - 6, _("New Buffer"));
else {
if (namelen > space) {
}
if (ISSET(MODIFIED))
mvwaddstr(topwin, 0, COLS - 10, _("Modified"));
-
+ else if (ISSET(VIEW_MODE))
+ mvwaddstr(topwin, 0, COLS - 10, _("View"));
#ifdef ENABLE_COLOR
color_off(topwin, COLOR_TITLEBAR);
fileptr->data[pos] = '\0';
- /* Now, Paint the line */
+ /* Now, paint the line */
if (current == fileptr && index > COLS - 2) {
/* This handles when the current line is beyond COLS */
/* It requires figuring out what page we're on */