{"id":1242,"date":"2018-02-07T11:58:23","date_gmt":"2018-02-07T03:58:23","guid":{"rendered":"http:\/\/www.iooe.cn\/?p=1242"},"modified":"2018-02-07T11:58:23","modified_gmt":"2018-02-07T03:58:23","slug":"centos-realpath%e5%91%bd%e4%bb%a4%e6%b2%a1%e6%9c%89%e8%a2%ab%e5%ae%89%e8%a3%85%e7%9a%84%e8%af%9d","status":"publish","type":"post","link":"http:\/\/www.iooe.cn\/index.php\/2018\/02\/07\/centos-realpath%e5%91%bd%e4%bb%a4%e6%b2%a1%e6%9c%89%e8%a2%ab%e5%ae%89%e8%a3%85%e7%9a%84%e8%af%9d\/","title":{"rendered":"centos realpath\u547d\u4ee4\u6ca1\u6709\u88ab\u5b89\u88c5\u7684\u8bdd"},"content":{"rendered":"<p>\n\t&nbsp;\n<\/p>\n<p>\n\t\u7528\u4e0b\u9762\u7684\u4ee3\u7801\uff0c\u7f16\u8bd1\u751f\u6210\u4e00\u4e2a\uff0c \u540e\u653e\u5230bin\u4e2d\u3002\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\u5373\u53ef\u4ee5<\/p>\n<p>\tcc realpath.c -o realpath.<br \/>\n\tsudo chown root:root realpath<br \/>\n\tsudo chmod 755 realpath<br \/>\n\tsudo cp realpath \/bin<\/p>\n<p>\n\tIf you put it into other directories, you may need to follow up with chmod +s realpath<br \/>\n\tCODE FOLLOWS.\n<\/p>\n<p>\n\t\/********************** temporary version of realpath ***********************<br \/>\n\t* use until a coreutils version is produced.&nbsp; This version does the minimum *<br \/>\n\t* necessary to resolve relative to absolute paths. One argument, the input string to be resolved.<br \/>\n\t*\/&nbsp;<br \/>\n\t#include &lt;stdio.h&gt;<br \/>\n\t#include &lt;stdlib.h&gt;<br \/>\n\t#include&nbsp; &lt;limits.h&gt;<\/p>\n<p>\tint main(int argc,char **argv)<br \/>\n\t{<br \/>\n\t&nbsp; char rlpath[PATH_MAX];<br \/>\n\t&nbsp; char *cp;<br \/>\n\t&nbsp; if (argc==2)<br \/>\n\t&nbsp; {<br \/>\n\t&nbsp; &nbsp; &nbsp;cp= realpath(argv[1],rlpath);<br \/>\n\t&nbsp; &nbsp; &nbsp;fprintf(stdout,&quot;%s\\n&quot;,cp);<br \/>\n\t&nbsp; &nbsp; &nbsp;exit(0);<br \/>\n\t&nbsp; }<br \/>\n\t&nbsp; &nbsp; exit(1);<br \/>\n\t}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; \u7528\u4e0b\u9762\u7684\u4ee3\u7801\uff0c\u7f16\u8bd1\u751f\u6210\u4e00\u4e2a\uff0c \u540e\u653e\u5230bin\u4e2d\u3002\u8fd0\u884c\u5982\u4e0b\u547d\u4ee4\u5373\u53ef\u4ee5 cc realpath.c -o realpath. sudo chown ro&#8230; <\/p>\n<div class='button-mores'><a href='http:\/\/www.iooe.cn\/index.php\/2018\/02\/07\/centos-realpath%e5%91%bd%e4%bb%a4%e6%b2%a1%e6%9c%89%e8%a2%ab%e5%ae%89%e8%a3%85%e7%9a%84%e8%af%9d\/'> \u9605\u8bfb\u66f4\u591a&#8230; <\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/1242"}],"collection":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1242"}],"version-history":[{"count":1,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/1242\/revisions"}],"predecessor-version":[{"id":1243,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/posts\/1242\/revisions\/1243"}],"wp:attachment":[{"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1242"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.iooe.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}