Sophie

Sophie

distrib > Fedora > 17 > i386 > by-pkgid > eb9952e0ae9ee158f30292ed99dc91f2 > files > 59

gfal2-doc-2.1.1-0.fc17.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>CERN GFAL 2.0: gfal_testcreatedir.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">CERN GFAL 2.0
   &#160;<span id="projectnumber">2.0.1</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.1.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">gfal_testcreatedir.c</div>  </div>
</div><!--header-->
<div class="contents">
<p>This exemple show how to create a directory ex : use case with SRM plugin : ./gfal_testdir srm://grid05.lal.in2p3.fr:8446/dpm/lal.in2p3.fr/home/dteam/test_tatooin</p>
<div class="fragment"><div class="line"></div>
<div class="line"><span class="preprocessor">#include &lt;stdio.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="gfal__api_8h.html" title="Main header file for gfal 2.0.">gfal_api.h</a>&quot;</span></div>
<div class="line"></div>
<div class="line">main(<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv)</div>
<div class="line">{</div>
<div class="line">        <span class="keywordtype">char</span> *rootdir;</div>
<div class="line">        <span class="keywordtype">char</span> olddir[1024], newdir[1024];</div>
<div class="line"></div>
<div class="line">        <span class="keywordflow">if</span> (argc != 2) {</div>
<div class="line">                fprintf (stderr, <span class="stringliteral">&quot;usage: %s rootdir\n&quot;</span>, argv[0]);</div>
<div class="line">                exit (1);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        rootdir = argv[1];</div>
<div class="line">        snprintf (olddir, 1024, <span class="stringliteral">&quot;%s/olddir&quot;</span>, rootdir);</div>
<div class="line">        snprintf (newdir, 1024, <span class="stringliteral">&quot;%s/newdir&quot;</span>, rootdir);</div>
<div class="line"></div>
<div class="line">        printf (<span class="stringliteral">&quot;Creating directory &#39;olddir&#39;...\n&quot;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (<a name="a0"></a><a class="code" href="group__posix__group.html#gaa6fce920a24431301bf9eb8876f66f88" title="create a directory">gfal_mkdir</a> (olddir, 0700) &lt; 0) {</div>
<div class="line">                <a name="a1"></a><a class="code" href="group__posix__group.html#gac937c592821b1f2f7686c576e2594cba">gfal_posix_check_error</a>();</div>
<div class="line">                exit (1);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        printf (<span class="stringliteral">&quot;Renaming directory &#39;olddir&#39; to &#39;newdir&#39;...\n&quot;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (<a name="a2"></a><a class="code" href="group__posix__group.html#ga97909aaf76cda4966a019190be091439" title="change the name or location of a file">gfal_rename</a> (olddir, newdir) &lt; 0) {</div>
<div class="line">                <a class="code" href="group__posix__group.html#gac937c592821b1f2f7686c576e2594cba">gfal_posix_check_error</a>();</div>
<div class="line">                exit (1);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        printf (<span class="stringliteral">&quot;Removing directory &#39;newdir&#39;...\n&quot;</span>);</div>
<div class="line">        <span class="keywordflow">if</span> (<a name="a3"></a><a class="code" href="group__posix__group.html#ga06d9c5cfadb171f1ec10c64ff1a5b94a" title="delete a directory">gfal_rmdir</a> (newdir) &lt; 0) {</div>
<div class="line">                <a class="code" href="group__posix__group.html#gac937c592821b1f2f7686c576e2594cba">gfal_posix_check_error</a>();</div>
<div class="line">                exit (1);</div>
<div class="line">        }</div>
<div class="line"></div>
<div class="line">        printf (<span class="stringliteral">&quot;All is ok.\n&quot;</span>);</div>
<div class="line">        exit (0);</div>
<div class="line">}</div>
</div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.1.1
</small></address>
</body>
</html>