mirror of
https://github.com/troglobit/editline.git
synced 2025-05-05 20:11:12 +08:00
More build fixes, some code cleanup and untabify.
This commit is contained in:
parent
77d483da02
commit
6d8d857dd4
@ -4,8 +4,8 @@
|
||||
|
||||
/* Assign these to get command completion, see cli.c for
|
||||
* example usage. */
|
||||
char *(*rl_complete)(char *token, int *match);
|
||||
int (*rl_list_possib)(char *token, char ***av);
|
||||
extern char *(*rl_complete)(char *token, int *match);
|
||||
extern int (*rl_list_possib)(char *token, char ***av);
|
||||
|
||||
/*
|
||||
** For compatibility with FSF readline.
|
||||
|
274
src/complete.c
274
src/complete.c
@ -5,32 +5,32 @@
|
||||
#include "editline.h"
|
||||
|
||||
|
||||
#if defined(NEED_STRDUP)
|
||||
#if defined(NEED_STRDUP)
|
||||
/*
|
||||
** Return an allocated copy of a string.
|
||||
*/
|
||||
char *
|
||||
strdup(p)
|
||||
char *p;
|
||||
char *p;
|
||||
{
|
||||
char *new;
|
||||
char *new;
|
||||
|
||||
if ((new = NEW(char, strlen(p) + 1)) != NULL)
|
||||
(void)strcpy(new, p);
|
||||
(void)strcpy(new, p);
|
||||
return new;
|
||||
}
|
||||
#endif /* defined(NEED_STRDUP) */
|
||||
#endif /* defined(NEED_STRDUP) */
|
||||
|
||||
/*
|
||||
** strcmp-like sorting predicate for qsort.
|
||||
*/
|
||||
STATIC int
|
||||
static int
|
||||
compare(p1, p2)
|
||||
CONST void *p1;
|
||||
CONST void *p2;
|
||||
CONST void *p1;
|
||||
CONST void *p2;
|
||||
{
|
||||
CONST char **v1;
|
||||
CONST char **v2;
|
||||
CONST char **v1;
|
||||
CONST char **v2;
|
||||
|
||||
v1 = (CONST char **)p1;
|
||||
v2 = (CONST char **)p2;
|
||||
@ -41,25 +41,25 @@ compare(p1, p2)
|
||||
** Fill in *avp with an array of names that match file, up to its length.
|
||||
** Ignore . and .. .
|
||||
*/
|
||||
STATIC int
|
||||
static int
|
||||
FindMatches(dir, file, avp)
|
||||
char *dir;
|
||||
char *file;
|
||||
char ***avp;
|
||||
char *dir;
|
||||
char *file;
|
||||
char ***avp;
|
||||
{
|
||||
char **av;
|
||||
char **new;
|
||||
char *p;
|
||||
DIR *dp;
|
||||
DIRENTRY *ep;
|
||||
SIZE_T ac;
|
||||
SIZE_T len;
|
||||
SIZE_T choices;
|
||||
SIZE_T total;
|
||||
#define MAX_TOTAL (256 << sizeof(char *))
|
||||
char **av;
|
||||
char **new;
|
||||
char *p;
|
||||
DIR *dp;
|
||||
DIRENTRY *ep;
|
||||
SIZE_T ac;
|
||||
SIZE_T len;
|
||||
SIZE_T choices;
|
||||
SIZE_T total;
|
||||
#define MAX_TOTAL (256 << sizeof(char *))
|
||||
|
||||
if ((dp = opendir(dir)) == NULL)
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
av = NULL;
|
||||
ac = 0;
|
||||
@ -67,56 +67,56 @@ FindMatches(dir, file, avp)
|
||||
choices = 0;
|
||||
total = 0;
|
||||
while ((ep = readdir(dp)) != NULL) {
|
||||
p = ep->d_name;
|
||||
if (p[0] == '.' && (p[1] == '\0' || (p[1] == '.' && p[2] == '\0')))
|
||||
continue;
|
||||
if (len && strncmp(p, file, len) != 0)
|
||||
continue;
|
||||
p = ep->d_name;
|
||||
if (p[0] == '.' && (p[1] == '\0' || (p[1] == '.' && p[2] == '\0')))
|
||||
continue;
|
||||
if (len && strncmp(p, file, len) != 0)
|
||||
continue;
|
||||
|
||||
choices++;
|
||||
if ((total += strlen(p)) > MAX_TOTAL) {
|
||||
/* This is a bit too much. */
|
||||
while (ac > 0) DISPOSE(av[--ac]);
|
||||
continue;
|
||||
}
|
||||
choices++;
|
||||
if ((total += strlen(p)) > MAX_TOTAL) {
|
||||
/* This is a bit too much. */
|
||||
while (ac > 0) DISPOSE(av[--ac]);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((ac % MEM_INC) == 0) {
|
||||
if ((new = NEW(char*, ac + MEM_INC)) == NULL) {
|
||||
total = 0;
|
||||
break;
|
||||
}
|
||||
if (ac) {
|
||||
COPYFROMTO(new, av, ac * sizeof (char **));
|
||||
DISPOSE(av);
|
||||
}
|
||||
*avp = av = new;
|
||||
}
|
||||
if ((ac % MEM_INC) == 0) {
|
||||
if ((new = NEW(char*, ac + MEM_INC)) == NULL) {
|
||||
total = 0;
|
||||
break;
|
||||
}
|
||||
if (ac) {
|
||||
COPYFROMTO(new, av, ac * sizeof (char **));
|
||||
DISPOSE(av);
|
||||
}
|
||||
*avp = av = new;
|
||||
}
|
||||
|
||||
if ((av[ac] = strdup(p)) == NULL) {
|
||||
if (ac == 0)
|
||||
DISPOSE(av);
|
||||
total = 0;
|
||||
break;
|
||||
}
|
||||
ac++;
|
||||
if ((av[ac] = strdup(p)) == NULL) {
|
||||
if (ac == 0)
|
||||
DISPOSE(av);
|
||||
total = 0;
|
||||
break;
|
||||
}
|
||||
ac++;
|
||||
}
|
||||
|
||||
/* Clean up and return. */
|
||||
(void)closedir(dp);
|
||||
if (total > MAX_TOTAL) {
|
||||
char many[sizeof(total) * 3];
|
||||
p = many + sizeof(many);
|
||||
*--p = '\0';
|
||||
while (choices > 0) {
|
||||
*--p = '0' + choices % 10;
|
||||
choices /= 10;
|
||||
}
|
||||
while (p > many + sizeof(many) - 8) *--p = ' ';
|
||||
if ((p = strdup(p)) != NULL) av[ac++] = p;
|
||||
if ((p = strdup("choices")) != NULL) av[ac++] = p;
|
||||
char many[sizeof(total) * 3];
|
||||
p = many + sizeof(many);
|
||||
*--p = '\0';
|
||||
while (choices > 0) {
|
||||
*--p = '0' + choices % 10;
|
||||
choices /= 10;
|
||||
}
|
||||
while (p > many + sizeof(many) - 8) *--p = ' ';
|
||||
if ((p = strdup(p)) != NULL) av[ac++] = p;
|
||||
if ((p = strdup("choices")) != NULL) av[ac++] = p;
|
||||
} else {
|
||||
if (ac)
|
||||
qsort(av, ac, sizeof (char **), compare);
|
||||
if (ac)
|
||||
qsort(av, ac, sizeof (char **), compare);
|
||||
}
|
||||
return ac;
|
||||
}
|
||||
@ -124,32 +124,32 @@ FindMatches(dir, file, avp)
|
||||
/*
|
||||
** Split a pathname into allocated directory and trailing filename parts.
|
||||
*/
|
||||
STATIC int
|
||||
static int
|
||||
SplitPath(path, dirpart, filepart)
|
||||
char *path;
|
||||
char **dirpart;
|
||||
char **filepart;
|
||||
char *path;
|
||||
char **dirpart;
|
||||
char **filepart;
|
||||
{
|
||||
static char DOT[] = ".";
|
||||
char *dpart;
|
||||
char *fpart;
|
||||
static char DOT[] = ".";
|
||||
char *dpart;
|
||||
char *fpart;
|
||||
|
||||
if ((fpart = strrchr(path, '/')) == NULL) {
|
||||
if ((dpart = strdup(DOT)) == NULL)
|
||||
return -1;
|
||||
if ((fpart = strdup(path)) == NULL) {
|
||||
DISPOSE(dpart);
|
||||
return -1;
|
||||
}
|
||||
if ((dpart = strdup(DOT)) == NULL)
|
||||
return -1;
|
||||
if ((fpart = strdup(path)) == NULL) {
|
||||
DISPOSE(dpart);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((dpart = strdup(path)) == NULL)
|
||||
return -1;
|
||||
dpart[fpart - path + 1] = '\0';
|
||||
if ((fpart = strdup(++fpart)) == NULL) {
|
||||
DISPOSE(dpart);
|
||||
return -1;
|
||||
}
|
||||
if ((dpart = strdup(path)) == NULL)
|
||||
return -1;
|
||||
dpart[fpart - path + 1] = '\0';
|
||||
if ((fpart = strdup(++fpart)) == NULL) {
|
||||
DISPOSE(dpart);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
*dirpart = dpart;
|
||||
*filepart = fpart;
|
||||
@ -162,69 +162,69 @@ SplitPath(path, dirpart, filepart)
|
||||
*/
|
||||
char *
|
||||
default_rl_complete(pathname, unique)
|
||||
char *pathname;
|
||||
int *unique;
|
||||
char *pathname;
|
||||
int *unique;
|
||||
{
|
||||
char **av;
|
||||
char *dir;
|
||||
char *file;
|
||||
char *new;
|
||||
char *p;
|
||||
SIZE_T ac;
|
||||
SIZE_T end;
|
||||
SIZE_T i;
|
||||
SIZE_T j;
|
||||
SIZE_T len;
|
||||
char **av;
|
||||
char *dir;
|
||||
char *file;
|
||||
char *new;
|
||||
char *p;
|
||||
SIZE_T ac;
|
||||
SIZE_T end;
|
||||
SIZE_T i;
|
||||
SIZE_T j;
|
||||
SIZE_T len;
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return NULL;
|
||||
return NULL;
|
||||
if ((ac = FindMatches(dir, file, &av)) == 0) {
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
return NULL;
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = NULL;
|
||||
len = strlen(file);
|
||||
if (ac == 1) {
|
||||
/* Exactly one match -- finish it off. */
|
||||
*unique = 1;
|
||||
j = strlen(av[0]) - len + 2;
|
||||
if ((p = NEW(char, j + 1)) != NULL) {
|
||||
COPYFROMTO(p, av[0] + len, j);
|
||||
if ((new = NEW(char, strlen(dir) + strlen(av[0]) + 2)) != NULL) {
|
||||
(void)strcpy(new, dir);
|
||||
(void)strcat(new, "/");
|
||||
(void)strcat(new, av[0]);
|
||||
rl_add_slash(new, p);
|
||||
DISPOSE(new);
|
||||
}
|
||||
}
|
||||
/* Exactly one match -- finish it off. */
|
||||
*unique = 1;
|
||||
j = strlen(av[0]) - len + 2;
|
||||
if ((p = NEW(char, j + 1)) != NULL) {
|
||||
COPYFROMTO(p, av[0] + len, j);
|
||||
if ((new = NEW(char, strlen(dir) + strlen(av[0]) + 2)) != NULL) {
|
||||
(void)strcpy(new, dir);
|
||||
(void)strcat(new, "/");
|
||||
(void)strcat(new, av[0]);
|
||||
rl_add_slash(new, p);
|
||||
DISPOSE(new);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
*unique = 0;
|
||||
if (len) {
|
||||
/* Find largest matching substring. */
|
||||
for (i = len, end = strlen(av[0]); i < end; i++)
|
||||
for (j = 1; j < ac; j++)
|
||||
if (av[0][i] != av[j][i])
|
||||
goto breakout;
|
||||
*unique = 0;
|
||||
if (len) {
|
||||
/* Find largest matching substring. */
|
||||
for (i = len, end = strlen(av[0]); i < end; i++)
|
||||
for (j = 1; j < ac; j++)
|
||||
if (av[0][i] != av[j][i])
|
||||
goto breakout;
|
||||
breakout:
|
||||
if (i > len) {
|
||||
j = i - len + 1;
|
||||
if ((p = NEW(char, j)) != NULL) {
|
||||
COPYFROMTO(p, av[0] + len, j);
|
||||
p[j - 1] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i > len) {
|
||||
j = i - len + 1;
|
||||
if ((p = NEW(char, j)) != NULL) {
|
||||
COPYFROMTO(p, av[0] + len, j);
|
||||
p[j - 1] = '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up and return. */
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
for (i = 0; i < ac; i++)
|
||||
DISPOSE(av[i]);
|
||||
DISPOSE(av[i]);
|
||||
DISPOSE(av);
|
||||
return p;
|
||||
}
|
||||
@ -234,15 +234,15 @@ default_rl_complete(pathname, unique)
|
||||
*/
|
||||
int
|
||||
default_rl_list_possib(pathname, avp)
|
||||
char *pathname;
|
||||
char ***avp;
|
||||
char *pathname;
|
||||
char ***avp;
|
||||
{
|
||||
char *dir;
|
||||
char *file;
|
||||
int ac;
|
||||
char *dir;
|
||||
char *file;
|
||||
int ac;
|
||||
|
||||
if (SplitPath(pathname, &dir, &file) < 0)
|
||||
return 0;
|
||||
return 0;
|
||||
ac = FindMatches(dir, file, avp);
|
||||
DISPOSE(dir);
|
||||
DISPOSE(file);
|
||||
|
1545
src/editline.c
1545
src/editline.c
File diff suppressed because it is too large
Load Diff
@ -35,21 +35,6 @@
|
||||
|
||||
typedef unsigned char CHAR;
|
||||
|
||||
#if defined(HIDE)
|
||||
#define STATIC static
|
||||
#else
|
||||
#define STATIC /* NULL */
|
||||
#endif /* !defined(HIDE) */
|
||||
|
||||
#if !defined(CONST)
|
||||
#if defined(__STDC__)
|
||||
#define CONST const
|
||||
#else
|
||||
#define CONST
|
||||
#endif /* defined(__STDC__) */
|
||||
#endif /* !defined(CONST) */
|
||||
|
||||
|
||||
#define MEM_INC 64
|
||||
#define SCREEN_INC 256
|
||||
|
||||
|
156
src/sysunix.c
156
src/sysunix.c
@ -4,69 +4,69 @@
|
||||
*/
|
||||
#include "editline.h"
|
||||
|
||||
#if defined(HAVE_TCGETATTR)
|
||||
#if defined(HAVE_TCGETATTR)
|
||||
#include <termios.h>
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
int Reset;
|
||||
{
|
||||
static struct termios old;
|
||||
struct termios new;
|
||||
static struct termios old;
|
||||
struct termios new;
|
||||
|
||||
if (Reset == 0) {
|
||||
if (tcgetattr(0, &old) < 0) perror("tcgetattr");
|
||||
rl_erase = old.c_cc[VERASE];
|
||||
rl_kill = old.c_cc[VKILL];
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
#if defined(DO_SIGTSTP)
|
||||
rl_susp = old.c_cc[VSUSP];
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
if (tcgetattr(0, &old) < 0) perror("tcgetattr");
|
||||
rl_erase = old.c_cc[VERASE];
|
||||
rl_kill = old.c_cc[VKILL];
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
#if defined(DO_SIGTSTP)
|
||||
rl_susp = old.c_cc[VSUSP];
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
|
||||
new = old;
|
||||
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||
new.c_iflag &= ~(ISTRIP | INPCK);
|
||||
new.c_cc[VMIN] = 1;
|
||||
new.c_cc[VTIME] = 0;
|
||||
if (tcsetattr(0, TCSADRAIN, &new) < 0) perror("tcsetattr");
|
||||
new = old;
|
||||
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||
new.c_iflag &= ~(ISTRIP | INPCK);
|
||||
new.c_cc[VMIN] = 1;
|
||||
new.c_cc[VTIME] = 0;
|
||||
if (tcsetattr(0, TCSADRAIN, &new) < 0) perror("tcsetattr");
|
||||
}
|
||||
else
|
||||
(void)tcsetattr(0, TCSADRAIN, &old);
|
||||
(void)tcsetattr(0, TCSADRAIN, &old);
|
||||
}
|
||||
|
||||
#else
|
||||
#if defined(HAVE_TERMIO_H)
|
||||
#if defined(HAVE_TERMIO_H)
|
||||
#include <termio.h>
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
int Reset;
|
||||
{
|
||||
static struct termio old;
|
||||
struct termio new;
|
||||
static struct termio old;
|
||||
struct termio new;
|
||||
|
||||
if (Reset == 0) {
|
||||
(void)ioctl(0, TCGETA, &old);
|
||||
rl_erase = old.c_cc[VERASE];
|
||||
rl_kill = old.c_cc[VKILL];
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
#if defined(DO_SIGTSTP)
|
||||
rl_susp = old.c_cc[VSUSP];
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
(void)ioctl(0, TCGETA, &old);
|
||||
rl_erase = old.c_cc[VERASE];
|
||||
rl_kill = old.c_cc[VKILL];
|
||||
rl_eof = old.c_cc[VEOF];
|
||||
rl_intr = old.c_cc[VINTR];
|
||||
rl_quit = old.c_cc[VQUIT];
|
||||
#if defined(DO_SIGTSTP)
|
||||
rl_susp = old.c_cc[VSUSP];
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
|
||||
new = old;
|
||||
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||
new.c_iflag &= ~(ISTRIP | INPCK);
|
||||
new.c_cc[VMIN] = 1;
|
||||
new.c_cc[VTIME] = 0;
|
||||
(void)ioctl(0, TCSETAW, &new);
|
||||
new = old;
|
||||
new.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||
new.c_iflag &= ~(ISTRIP | INPCK);
|
||||
new.c_cc[VMIN] = 1;
|
||||
new.c_cc[VTIME] = 0;
|
||||
(void)ioctl(0, TCSETAW, &new);
|
||||
}
|
||||
else
|
||||
(void)ioctl(0, TCSETAW, &old);
|
||||
(void)ioctl(0, TCSETAW, &old);
|
||||
}
|
||||
|
||||
#else
|
||||
@ -74,61 +74,61 @@ rl_ttyset(Reset)
|
||||
|
||||
void
|
||||
rl_ttyset(Reset)
|
||||
int Reset;
|
||||
int Reset;
|
||||
{
|
||||
static struct sgttyb old_sgttyb;
|
||||
static struct tchars old_tchars;
|
||||
struct sgttyb new_sgttyb;
|
||||
struct tchars new_tchars;
|
||||
#if defined(DO_SIGTSTP)
|
||||
struct ltchars old_ltchars;
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
static struct sgttyb old_sgttyb;
|
||||
static struct tchars old_tchars;
|
||||
struct sgttyb new_sgttyb;
|
||||
struct tchars new_tchars;
|
||||
#if defined(DO_SIGTSTP)
|
||||
struct ltchars old_ltchars;
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
|
||||
if (Reset == 0) {
|
||||
(void)ioctl(0, TIOCGETP, &old_sgttyb);
|
||||
rl_erase = old_sgttyb.sg_erase;
|
||||
rl_kill = old_sgttyb.sg_kill;
|
||||
(void)ioctl(0, TIOCGETP, &old_sgttyb);
|
||||
rl_erase = old_sgttyb.sg_erase;
|
||||
rl_kill = old_sgttyb.sg_kill;
|
||||
|
||||
(void)ioctl(0, TIOCGETC, &old_tchars);
|
||||
rl_eof = old_tchars.t_eofc;
|
||||
rl_intr = old_tchars.t_intrc;
|
||||
rl_quit = old_tchars.t_quitc;
|
||||
(void)ioctl(0, TIOCGETC, &old_tchars);
|
||||
rl_eof = old_tchars.t_eofc;
|
||||
rl_intr = old_tchars.t_intrc;
|
||||
rl_quit = old_tchars.t_quitc;
|
||||
|
||||
#if defined(DO_SIGTSTP)
|
||||
(void)ioctl(0, TIOCGLTC, &old_ltchars);
|
||||
rl_susp = old_ltchars.t_suspc;
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
#if defined(DO_SIGTSTP)
|
||||
(void)ioctl(0, TIOCGLTC, &old_ltchars);
|
||||
rl_susp = old_ltchars.t_suspc;
|
||||
#endif /* defined(DO_SIGTSTP) */
|
||||
|
||||
new_sgttyb = old_sgttyb;
|
||||
new_sgttyb.sg_flags &= ~ECHO;
|
||||
new_sgttyb.sg_flags |= RAW;
|
||||
#if defined(PASS8)
|
||||
new_sgttyb.sg_flags |= PASS8;
|
||||
#endif /* defined(PASS8) */
|
||||
(void)ioctl(0, TIOCSETP, &new_sgttyb);
|
||||
new_sgttyb = old_sgttyb;
|
||||
new_sgttyb.sg_flags &= ~ECHO;
|
||||
new_sgttyb.sg_flags |= RAW;
|
||||
#if defined(PASS8)
|
||||
new_sgttyb.sg_flags |= PASS8;
|
||||
#endif /* defined(PASS8) */
|
||||
(void)ioctl(0, TIOCSETP, &new_sgttyb);
|
||||
|
||||
new_tchars = old_tchars;
|
||||
new_tchars.t_intrc = -1;
|
||||
new_tchars.t_quitc = -1;
|
||||
(void)ioctl(0, TIOCSETC, &new_tchars);
|
||||
new_tchars = old_tchars;
|
||||
new_tchars.t_intrc = -1;
|
||||
new_tchars.t_quitc = -1;
|
||||
(void)ioctl(0, TIOCSETC, &new_tchars);
|
||||
}
|
||||
else {
|
||||
(void)ioctl(0, TIOCSETP, &old_sgttyb);
|
||||
(void)ioctl(0, TIOCSETC, &old_tchars);
|
||||
(void)ioctl(0, TIOCSETP, &old_sgttyb);
|
||||
(void)ioctl(0, TIOCSETC, &old_tchars);
|
||||
}
|
||||
}
|
||||
#endif /* defined(HAVE_TERMIO_H) */
|
||||
#endif /* defined(HAVE_TCGETATTR) */
|
||||
#endif /* defined(HAVE_TERMIO_H) */
|
||||
#endif /* defined(HAVE_TCGETATTR) */
|
||||
|
||||
void
|
||||
rl_add_slash(path, p)
|
||||
char *path;
|
||||
char *p;
|
||||
char *path;
|
||||
char *p;
|
||||
{
|
||||
struct stat Sb;
|
||||
struct stat Sb;
|
||||
|
||||
if (stat(path, &Sb) >= 0)
|
||||
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
|
||||
(void)strcat(p, S_ISDIR(Sb.st_mode) ? "/" : " ");
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user