version 1.97, 2015/03/25 12:25:36 |
version 1.98, 2015/09/29 08:53:53 |
|
|
|
|
size_t xdirname(char *, const char *, size_t); |
size_t xdirname(char *, const char *, size_t); |
|
|
|
static int do_dired(char *); |
|
|
/* |
/* |
* Insert a file into the current buffer. Real easy - just call the |
* Insert a file into the current buffer. Real easy - just call the |
* insertfile routine with the file name. |
* insertfile routine with the file name. |
|
|
} |
} |
|
|
/* |
/* |
* Select a file for editing. Look around to see if you can find the file |
* Select a file for editing. If the file is a directory, invoke dired. |
* in another buffer; if you can find it, just switch to the buffer. If |
* Otherwise, look around to see if you can find the file in another buffer; |
* you cannot find the file, create a new buffer, read in the text, and |
* if you can find it, just switch to the buffer. If you cannot find the |
* switch to the new buffer. |
* file, create a new buffer, read in the text, and switch to the new buffer. |
*/ |
*/ |
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
|
|
adjf = adjustname(fname, TRUE); |
adjf = adjustname(fname, TRUE); |
if (adjf == NULL) |
if (adjf == NULL) |
return (FALSE); |
return (FALSE); |
|
if (fisdir(adjf) == TRUE) |
|
return (do_dired(adjf)); |
if ((bp = findbuffer(adjf)) == NULL) |
if ((bp = findbuffer(adjf)) == NULL) |
return (FALSE); |
return (FALSE); |
curbp = bp; |
curbp = bp; |
|
|
adjf = adjustname(fname, TRUE); |
adjf = adjustname(fname, TRUE); |
if (adjf == NULL) |
if (adjf == NULL) |
return (FALSE); |
return (FALSE); |
|
if (fisdir(adjf) == TRUE) |
|
return (do_dired(adjf)); |
if ((bp = findbuffer(adjf)) == NULL) |
if ((bp = findbuffer(adjf)) == NULL) |
return (FALSE); |
return (FALSE); |
curbp = bp; |
curbp = bp; |
|
|
adjf = adjustname(fname, TRUE); |
adjf = adjustname(fname, TRUE); |
if (adjf == NULL) |
if (adjf == NULL) |
return (FALSE); |
return (FALSE); |
|
if (fisdir(adjf) == TRUE) |
|
return (do_dired(adjf)); |
if ((bp = findbuffer(adjf)) == NULL) |
if ((bp = findbuffer(adjf)) == NULL) |
return (FALSE); |
return (FALSE); |
if (bp == curbp) |
if (bp == curbp) |
|
|
|
|
(void)strlcpy(ts, path, NFILEN); |
(void)strlcpy(ts, path, NFILEN); |
return (strlcpy(bp, basename(ts), bplen)); |
return (strlcpy(bp, basename(ts), bplen)); |
|
} |
|
|
|
/* |
|
* The adjusted file name refers to a directory, so open dired mode. |
|
*/ |
|
int |
|
do_dired(char *adjf) |
|
{ |
|
struct buffer *bp; |
|
|
|
if ((bp = dired_(adjf)) == FALSE) |
|
return (FALSE); |
|
curbp = bp; |
|
return (showbuffer(bp, curwp, WFFULL | WFMODE)); |
} |
} |