=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/less/edit.c,v retrieving revision 1.18 retrieving revision 1.19 diff -c -r1.18 -r1.19 *** src/usr.bin/less/edit.c 2015/11/09 16:42:35 1.18 --- src/usr.bin/less/edit.c 2015/11/09 16:46:42 1.19 *************** *** 130,136 **** { struct scrpos scrpos; ! if (curr_ifile == NULL_IFILE) return; /* --- 130,136 ---- { struct scrpos scrpos; ! if (curr_ifile == NULL) return; /* *************** *** 156,162 **** free(curr_altfilename); curr_altfilename = NULL; } ! curr_ifile = NULL_IFILE; curr_ino = curr_dev = 0; } --- 156,162 ---- free(curr_altfilename); curr_altfilename = NULL; } ! curr_ifile = NULL; curr_ino = curr_dev = 0; } *************** *** 169,175 **** edit(char *filename) { if (filename == NULL) ! return (edit_ifile(NULL_IFILE)); return (edit_ifile(get_ifile(filename, curr_ifile))); } --- 169,175 ---- edit(char *filename) { if (filename == NULL) ! return (edit_ifile(NULL)); return (edit_ifile(get_ifile(filename, curr_ifile))); } *************** *** 208,214 **** */ end_logfile(); was_curr_ifile = save_curr_ifile(); ! if (curr_ifile != NULL_IFILE) { chflags = ch_getflags(); close_file(); if ((chflags & CH_HELPFILE) && --- 208,214 ---- */ end_logfile(); was_curr_ifile = save_curr_ifile(); ! if (curr_ifile != NULL) { chflags = ch_getflags(); close_file(); if ((chflags & CH_HELPFILE) && *************** *** 221,227 **** } } ! if (ifile == NULL_IFILE) { /* * No new file to open. * (Don't set old_ifile, because if you call edit_ifile(NULL), --- 221,227 ---- } } ! if (ifile == NULL) { /* * No new file to open. * (Don't set old_ifile, because if you call edit_ifile(NULL), *************** *** 318,324 **** * Get the new ifile. * Get the saved position for the file. */ ! if (was_curr_ifile != NULL_IFILE) { old_ifile = was_curr_ifile; unsave_ifile(was_curr_ifile); } --- 318,324 ---- * Get the new ifile. * Get the saved position for the file. */ ! if (was_curr_ifile != NULL) { old_ifile = was_curr_ifile; unsave_ifile(was_curr_ifile); } *************** *** 439,445 **** int edit_first(void) { ! curr_ifile = NULL_IFILE; return (edit_next(1)); } --- 439,445 ---- int edit_first(void) { ! curr_ifile = NULL; return (edit_next(1)); } *************** *** 449,455 **** int edit_last(void) { ! curr_ifile = NULL_IFILE; return (edit_prev(1)); } --- 449,455 ---- int edit_last(void) { ! curr_ifile = NULL; return (edit_prev(1)); } *************** *** 471,477 **** if (edit_ifile(h) == 0) break; } ! if (next == NULL_IFILE) { /* * Reached end of the ifile list. */ --- 471,477 ---- if (edit_ifile(h) == 0) break; } ! if (next == NULL) { /* * Reached end of the ifile list. */ *************** *** 524,532 **** { IFILE h; ! h = NULL_IFILE; do { ! if ((h = next_ifile(h)) == NULL_IFILE) { /* * Reached end of the list without finding it. */ --- 524,532 ---- { IFILE h; ! h = NULL; do { ! if ((h = next_ifile(h)) == NULL) { /* * Reached end of the list without finding it. */ *************** *** 540,546 **** IFILE save_curr_ifile(void) { ! if (curr_ifile != NULL_IFILE) hold_ifile(curr_ifile, 1); return (curr_ifile); } --- 540,546 ---- IFILE save_curr_ifile(void) { ! if (curr_ifile != NULL) hold_ifile(curr_ifile, 1); return (curr_ifile); } *************** *** 548,554 **** void unsave_ifile(IFILE save_ifile) { ! if (save_ifile != NULL_IFILE) hold_ifile(save_ifile, -1); } --- 548,554 ---- void unsave_ifile(IFILE save_ifile) { ! if (save_ifile != NULL) hold_ifile(save_ifile, -1); } *************** *** 575,586 **** /* * If can't reopen it, open the next input file in the list. */ ! if (next != NULL_IFILE && edit_inext(next, 0) == 0) return; /* * If can't open THAT one, open the previous input file in the list. */ ! if (prev != NULL_IFILE && edit_iprev(prev, 0) == 0) return; /* * If can't even open that, we're stuck. Just quit. --- 575,586 ---- /* * If can't reopen it, open the next input file in the list. */ ! if (next != NULL && edit_inext(next, 0) == 0) return; /* * If can't open THAT one, open the previous input file in the list. */ ! if (prev != NULL && edit_iprev(prev, 0) == 0) return; /* * If can't even open that, we're stuck. Just quit.