This file is indexed.

/usr/share/doc/libmtp-doc/html/sendfile_8c-example.html is in libmtp-doc 1.1.6-20-g1b9f164-1ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!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"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>libmtp: sendfile.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">libmtp
   &#160;<span id="projectnumber">1.1.6</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</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">sendfile.c</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"></div>
<div class="line"><span class="preprocessor">#include &quot;config.h&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#include &lt;stdlib.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;string.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;libgen.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;sys/stat.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;sys/types.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;fcntl.h&gt;</span></div>
<div class="line"><span class="preprocessor">#include &quot;common.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;<a class="code" href="libmtp_8h.html">libmtp.h</a>&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;pathutils.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;util.h&quot;</span></div>
<div class="line"><span class="preprocessor">#include &quot;connect.h&quot;</span></div>
<div class="line"></div>
<div class="line"><span class="keyword">extern</span> <a name="_a0"></a><a class="code" href="structLIBMTP__folder__struct.html">LIBMTP_folder_t</a> *folders;</div>
<div class="line"><span class="keyword">extern</span> <a name="_a1"></a><a class="code" href="structLIBMTP__file__struct.html">LIBMTP_file_t</a> *files;</div>
<div class="line"><span class="keyword">extern</span> <a name="_a2"></a><a class="code" href="structLIBMTP__mtpdevice__struct.html">LIBMTP_mtpdevice_t</a> *device;</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> sendfile_usage(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line">  fprintf(stderr, <span class="stringliteral">&quot;usage: sendfile &lt;local filename&gt; &lt;remote filename&gt;\n&quot;</span>);</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> sendfile_function(<span class="keywordtype">char</span> * from_path, <span class="keywordtype">char</span> *to_path)</div>
<div class="line">{</div>
<div class="line">  printf(<span class="stringliteral">&quot;Sending %s to %s\n&quot;</span>,from_path,to_path);</div>
<div class="line">  <span class="keywordtype">char</span> *filename;</div>
<div class="line">  uint64_t filesize;</div>
<div class="line">  <span class="keyword">struct </span>stat sb;</div>
<div class="line">  <a class="code" href="structLIBMTP__file__struct.html">LIBMTP_file_t</a> *genfile;</div>
<div class="line">  <span class="keywordtype">int</span> ret;</div>
<div class="line">  uint32_t parent_id = 0;</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">if</span> ( stat(from_path, &amp;sb) == -1 ) {</div>
<div class="line">    fprintf(stderr, <span class="stringliteral">&quot;%s: &quot;</span>, from_path);</div>
<div class="line">    perror(<span class="stringliteral">&quot;stat&quot;</span>);</div>
<div class="line">    <span class="keywordflow">return</span> 1;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  filesize = sb.st_size;</div>
<div class="line">  filename = basename(from_path);</div>
<div class="line">  parent_id = parse_path (to_path,files,folders);</div>
<div class="line">  <span class="keywordflow">if</span> (parent_id == -1) {</div>
<div class="line">    printf(<span class="stringliteral">&quot;Parent folder could not be found, skipping\n&quot;</span>);</div>
<div class="line">    <span class="keywordflow">return</span> 0;</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  genfile = <a name="a3"></a><a class="code" href="group__files.html#ga731f7260b77aec5b77c72dd9dd8165ce">LIBMTP_new_file_t</a>();</div>
<div class="line">  genfile-&gt;filesize = filesize;</div>
<div class="line">  genfile-&gt;filename = strdup(filename);</div>
<div class="line">  genfile-&gt;filetype = find_filetype (filename);</div>
<div class="line">  genfile-&gt;parent_id = parent_id;</div>
<div class="line">  genfile-&gt;storage_id = 0;</div>
<div class="line"></div>
<div class="line">  printf(<span class="stringliteral">&quot;Sending file...\n&quot;</span>);</div>
<div class="line">  ret = <a name="a4"></a><a class="code" href="group__files.html#ga552e760a429b0e47a593b8ade20bb763">LIBMTP_Send_File_From_File</a>(device, from_path, genfile, progress, NULL);</div>
<div class="line">  printf(<span class="stringliteral">&quot;\n&quot;</span>);</div>
<div class="line">  <span class="keywordflow">if</span> (ret != 0) {</div>
<div class="line">    printf(<span class="stringliteral">&quot;Error sending file.\n&quot;</span>);</div>
<div class="line">    <a name="a5"></a><a class="code" href="group__basic.html#ga682c81a83fa04b2caf5c962db1eaff82">LIBMTP_Dump_Errorstack</a>(device);</div>
<div class="line">    <a name="a6"></a><a class="code" href="group__basic.html#ga6c05b927310ac830c149ae3eeae94047">LIBMTP_Clear_Errorstack</a>(device);</div>
<div class="line">    ret = 1;</div>
<div class="line">  } <span class="keywordflow">else</span> {</div>
<div class="line">    printf(<span class="stringliteral">&quot;New file ID: %d\n&quot;</span>, genfile-&gt;item_id);</div>
<div class="line">  }</div>
<div class="line"></div>
<div class="line">  <a name="a7"></a><a class="code" href="group__files.html#ga0fed9e491256fb80b323bdd030b162e9">LIBMTP_destroy_file_t</a>(genfile);</div>
<div class="line"></div>
<div class="line">  <span class="keywordflow">return</span> ret;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> sendfile_command (<span class="keywordtype">int</span> argc, <span class="keywordtype">char</span> **argv) {</div>
<div class="line">  <span class="keywordflow">if</span> (argc &lt; 3) {</div>
<div class="line">    sendfile_usage();</div>
<div class="line">    <span class="keywordflow">return</span> 0;</div>
<div class="line">  }</div>
<div class="line">  checklang();</div>
<div class="line">  <span class="keywordflow">return</span> sendfile_function(argv[1],argv[2]);</div>
<div class="line">}</div>
</div><!-- fragment --> </div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Tue Oct 22 2013 12:54:17 for libmtp by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.4
</small></address>
</body>
</html>