From: Ben Gras Date: Fri, 17 Mar 2006 09:27:26 +0000 (+0000) Subject: readlink command implementation + manpage X-Git-Tag: v3.1.2a~204 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/static/d3.min.js?a=commitdiff_plain;h=96783ed1f732a1ccdbe77948df7b2e5c5ebe9d16;p=minix.git readlink command implementation + manpage --- diff --git a/commands/simple/Makefile b/commands/simple/Makefile index 143f6991e..cae4860fd 100755 --- a/commands/simple/Makefile +++ b/commands/simple/Makefile @@ -154,6 +154,7 @@ ALL = \ rdate \ readall \ rev \ + readlink \ readfs \ remsync \ rget \ @@ -1044,6 +1045,7 @@ install: \ /usr/bin/rawspeed \ /usr/bin/rdate \ /usr/bin/readall \ + /usr/bin/readlink \ /usr/bin/readfs \ /usr/bin/remsync \ /usr/bin/rget \ @@ -1501,6 +1503,9 @@ install: \ /usr/bin/readall: readall install -cs -o bin $? $@ +/usr/bin/readlink: /usr/bin/stat + install -l $? $@ + /usr/bin/readfs: readfs install -cs -o bin $? $@ diff --git a/commands/simple/stat.c b/commands/simple/stat.c index 29e4c5a2c..be4d70d72 100755 --- a/commands/simple/stat.c +++ b/commands/simple/stat.c @@ -25,6 +25,7 @@ # include # include # include +# include # include # include # include @@ -87,6 +88,8 @@ void printit(struct stat* sb, struct field* f, int n); void rwx(mode_t mode, char *bit); void usage(void); +int do_readlink=0; + int main(int ac, char** av) { int i, j, nprint = 0, files = 0; @@ -98,6 +101,7 @@ int main(int ac, char** av) if ((arg0 = strrchr(av[0], '/')) == NULL) arg0 = av[0]; else arg0++; #ifdef S_IFLNK if (equal(arg0, "lstat")) sym = 1; + if (equal(arg0, "readlink")) do_readlink = 1; #endif if (ac > 1 && equal(av[i = 1], "-")) @@ -155,6 +159,7 @@ int main(int ac, char** av) files++; /* We don't know how many files come from stdin. */ if (files == 0) { /* Stat all file descriptors. */ + if(do_readlink) return 0; for (i= 0; i