- cleaned up the FTP module, did the API, extracted docs

- regenerated and updated the docs
This commit is contained in:
Daniel Veillard 2000-01-25 19:27:27 +00:00
parent 3a2ebddcf7
commit aeea04f18f
17 changed files with 7157 additions and 181 deletions

View File

@ -1,3 +1,9 @@
Wed Jan 26 18:14:55 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* nanoftp.[ch]: cleanup, comments, API
* debugXML.c : fixed a bug in the cat command
* doc/*: regenerated the docs
Wed Jan 26 16:52:50 CET 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* nanoftp.[ch] parser.c xmlIO.[ch]: added a Nano FTP implementation

View File

@ -673,7 +673,17 @@ xmlShellDir(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
int
xmlShellCat(xmlShellCtxtPtr ctxt, char *arg, xmlNodePtr node,
xmlNodePtr node2) {
xmlElemDump(stdout, ctxt->doc, node);
if (ctxt->doc->type == XML_HTML_DOCUMENT_NODE) {
if (node->type == XML_HTML_DOCUMENT_NODE)
htmlDocDump(stdout, (htmlDocPtr) node);
else
htmlNodeDump(stdout, ctxt->doc, node);
} else {
if (node->type == XML_DOCUMENT_NODE)
xmlDocDump(stdout, (xmlDocPtr) node);
else
xmlElemDump(stdout, ctxt->doc, node);
}
printf("\n");
return(0);
}

View File

@ -13,6 +13,7 @@
<!entity xmlIO SYSTEM "sgml/xmlIO.sgml">
<!entity xmlmemory SYSTEM "sgml/xmlmemory.sgml">
<!entity nanohttp SYSTEM "sgml/nanohttp.sgml">
<!entity nanoftp SYSTEM "sgml/nanoftp.sgml">
<!entity valid SYSTEM "sgml/valid.sgml">
]>
@ -82,6 +83,7 @@
&HTMLtree;
&xpath;
&nanohttp;
&nanoftp;
&xmlIO;
&parserInternals;
&encoding;

View File

@ -163,6 +163,11 @@ HREF="gnome-xml-nanohttp.html"
> &#8212; </DT
><DT
><A
HREF="gnome-xml-nanoftp.html"
>nanoftp</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-xmlio.html"
>xmlIO</A
> &#8212; </DT

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -15,8 +15,8 @@ REL="PREVIOUS"
TITLE="xpath"
HREF="gnome-xml-xpath.html"><LINK
REL="NEXT"
TITLE="xmlIO"
HREF="gnome-xml-xmlio.html"></HEAD
TITLE="nanoftp"
HREF="gnome-xml-nanoftp.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
@ -98,7 +98,7 @@ WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="gnome-xml-xmlio.html"
HREF="gnome-xml-nanoftp.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
@ -953,7 +953,7 @@ WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="gnome-xml-xmlio.html"
HREF="gnome-xml-nanoftp.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
@ -981,7 +981,7 @@ ALIGN="right"
COLOR="#FFFFFF"
SIZE="3"
><B
>xmlIO</B
>nanoftp</B
></FONT
></TD
></TR

View File

@ -115,7 +115,7 @@ SIZE="3"
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN9548"
NAME="AEN10004"
></A
><H2
>Name</H2
@ -123,7 +123,7 @@ NAME="AEN9548"
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN9551"
NAME="AEN10007"
></A
><H2
>Synopsis</H2
@ -882,7 +882,7 @@ HREF="gnome-xml-parser.html#XMLPARSERCTXTPTR"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN9761"
NAME="AEN10217"
></A
><H2
>Description</H2
@ -892,14 +892,14 @@ NAME="AEN9761"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN9764"
NAME="AEN10220"
></A
><H2
>Details</H2
><DIV
CLASS="REFSECT2"
><A
NAME="AEN9766"
NAME="AEN10222"
></A
><H3
><A
@ -925,7 +925,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9771"
NAME="AEN10227"
></A
><H3
><A
@ -938,7 +938,7 @@ NAME="CHARVAL"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9775"
NAME="AEN10231"
></A
><H3
><A
@ -996,7 +996,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9789"
NAME="AEN10245"
></A
><H3
><A
@ -1054,7 +1054,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9803"
NAME="AEN10259"
></A
><H3
><A
@ -1112,7 +1112,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9817"
NAME="AEN10273"
></A
><H3
><A
@ -1170,7 +1170,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9831"
NAME="AEN10287"
></A
><H3
><A
@ -1228,7 +1228,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9845"
NAME="AEN10301"
></A
><H3
><A
@ -1286,7 +1286,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9859"
NAME="AEN10315"
></A
><H3
><A
@ -1344,7 +1344,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9873"
NAME="AEN10329"
></A
><H3
><A
@ -1402,7 +1402,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9887"
NAME="AEN10343"
></A
><H3
><A
@ -1460,7 +1460,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9901"
NAME="AEN10357"
></A
><H3
><A
@ -1518,7 +1518,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9915"
NAME="AEN10371"
></A
><H3
><A
@ -1576,7 +1576,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9929"
NAME="AEN10385"
></A
><H3
><A
@ -1634,7 +1634,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9943"
NAME="AEN10399"
></A
><H3
><A
@ -1692,7 +1692,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9957"
NAME="AEN10413"
></A
><H3
><A
@ -1750,7 +1750,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9971"
NAME="AEN10427"
></A
><H3
><A
@ -1831,7 +1831,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN9992"
NAME="AEN10448"
></A
><H3
><A
@ -1911,7 +1911,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10012"
NAME="AEN10468"
></A
><H3
><A
@ -2007,7 +2007,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10036"
NAME="AEN10492"
></A
><H3
><A
@ -2071,7 +2071,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10052"
NAME="AEN10508"
></A
><H3
><A
@ -2132,7 +2132,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10068"
NAME="AEN10524"
></A
><H3
><A
@ -2217,7 +2217,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10089"
NAME="AEN10545"
></A
><H3
><A
@ -2304,7 +2304,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10111"
NAME="AEN10567"
></A
><H3
><A
@ -2406,7 +2406,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10137"
NAME="AEN10593"
></A
><H3
><A
@ -2491,7 +2491,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10158"
NAME="AEN10614"
></A
><H3
><A
@ -2573,7 +2573,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10179"
NAME="AEN10635"
></A
><H3
><A
@ -2636,7 +2636,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10195"
NAME="AEN10651"
></A
><H3
><A
@ -2735,7 +2735,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10220"
NAME="AEN10676"
></A
><H3
><A
@ -2844,7 +2844,7 @@ to get the Prefix if any.</TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10249"
NAME="AEN10705"
></A
><H3
><A
@ -2930,7 +2930,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10272"
NAME="AEN10728"
></A
><H3
><A
@ -3039,7 +3039,7 @@ to get the Prefix if any.</TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10301"
NAME="AEN10757"
></A
><H3
><A
@ -3124,7 +3124,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10324"
NAME="AEN10780"
></A
><H3
><A
@ -3206,7 +3206,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10345"
NAME="AEN10801"
></A
><H3
><A
@ -3275,7 +3275,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10363"
NAME="AEN10819"
></A
><H3
><A
@ -3364,7 +3364,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10387"
NAME="AEN10843"
></A
><H3
><A
@ -3452,7 +3452,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10411"
NAME="AEN10867"
></A
><H3
><A
@ -3537,7 +3537,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10434"
NAME="AEN10890"
></A
><H3
><A
@ -3642,7 +3642,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10461"
NAME="AEN10917"
></A
><H3
><A
@ -3780,7 +3780,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10495"
NAME="AEN10951"
></A
><H3
><A
@ -3863,7 +3863,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10517"
NAME="AEN10973"
></A
><H3
><A
@ -3946,7 +3946,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10539"
NAME="AEN10995"
></A
><H3
><A
@ -4030,7 +4030,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10560"
NAME="AEN11016"
></A
><H3
><A
@ -4161,7 +4161,7 @@ it is possible to return NULL and have publicID set.</TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10593"
NAME="AEN11049"
></A
><H3
><A
@ -4228,7 +4228,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10610"
NAME="AEN11066"
></A
><H3
><A
@ -4311,7 +4311,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10632"
NAME="AEN11088"
></A
><H3
><A
@ -4378,7 +4378,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10650"
NAME="AEN11106"
></A
><H3
><A
@ -4453,7 +4453,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10670"
NAME="AEN11126"
></A
><H3
><A
@ -4531,7 +4531,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10693"
NAME="AEN11149"
></A
><H3
><A
@ -4670,7 +4670,7 @@ or XML_ATTRIBUTE_FIXED. </TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10730"
NAME="AEN11186"
></A
><H3
><A
@ -4759,7 +4759,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10754"
NAME="AEN11210"
></A
><H3
><A
@ -4846,7 +4846,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10777"
NAME="AEN11233"
></A
><H3
><A
@ -4949,7 +4949,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10804"
NAME="AEN11260"
></A
><H3
><A
@ -5093,7 +5093,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10842"
NAME="AEN11298"
></A
><H3
><A
@ -5160,7 +5160,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10860"
NAME="AEN11316"
></A
><H3
><A
@ -5258,7 +5258,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10886"
NAME="AEN11342"
></A
><H3
><A
@ -5361,7 +5361,7 @@ hierarchy.</TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10912"
NAME="AEN11368"
></A
><H3
><A
@ -5484,7 +5484,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10943"
NAME="AEN11399"
></A
><H3
><A
@ -5567,7 +5567,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10965"
NAME="AEN11421"
></A
><H3
><A
@ -5646,7 +5646,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN10984"
NAME="AEN11440"
></A
><H3
><A
@ -5734,7 +5734,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11007"
NAME="AEN11463"
></A
><H3
><A
@ -5835,7 +5835,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11031"
NAME="AEN11487"
></A
><H3
><A
@ -5909,7 +5909,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11050"
NAME="AEN11506"
></A
><H3
><A
@ -5995,7 +5995,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11071"
NAME="AEN11527"
></A
><H3
><A
@ -6065,7 +6065,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11089"
NAME="AEN11545"
></A
><H3
><A
@ -6190,7 +6190,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11123"
NAME="AEN11579"
></A
><H3
><A
@ -6292,7 +6292,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11152"
NAME="AEN11608"
></A
><H3
><A
@ -6361,7 +6361,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11171"
NAME="AEN11627"
></A
><H3
><A
@ -6432,7 +6432,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11191"
NAME="AEN11647"
></A
><H3
><A
@ -6497,7 +6497,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11208"
NAME="AEN11664"
></A
><H3
><A
@ -6579,7 +6579,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11227"
NAME="AEN11683"
></A
><H3
><A
@ -6662,7 +6662,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11249"
NAME="AEN11705"
></A
><H3
><A
@ -6747,7 +6747,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11272"
NAME="AEN11728"
></A
><H3
><A
@ -6830,7 +6830,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11294"
NAME="AEN11750"
></A
><H3
><A
@ -6915,7 +6915,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11317"
NAME="AEN11773"
></A
><H3
><A
@ -7010,7 +7010,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11339"
NAME="AEN11795"
></A
><H3
><A
@ -7075,7 +7075,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11356"
NAME="AEN11812"
></A
><H3
><A
@ -7140,7 +7140,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11373"
NAME="AEN11829"
></A
><H3
><A
@ -7249,7 +7249,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11401"
NAME="AEN11857"
></A
><H3
><A
@ -7275,7 +7275,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11406"
NAME="AEN11862"
></A
><H3
><A
@ -7301,7 +7301,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11411"
NAME="AEN11867"
></A
><H3
><A
@ -7327,7 +7327,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11416"
NAME="AEN11872"
></A
><H3
><A
@ -7353,7 +7353,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11421"
NAME="AEN11877"
></A
><H3
><A
@ -7536,7 +7536,7 @@ must deallocate it !</TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11466"
NAME="AEN11922"
></A
><H3
><A
@ -7633,7 +7633,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11490"
NAME="AEN11946"
></A
><H3
><A
@ -7712,7 +7712,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11510"
NAME="AEN11966"
></A
><H3
><A
@ -7809,7 +7809,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN11534"
NAME="AEN11990"
></A
><H3
><A

File diff suppressed because it is too large Load Diff

View File

@ -103,7 +103,7 @@ ALIGN="right"
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN12144"
NAME="AEN12600"
></A
><H2
>Name</H2
@ -111,7 +111,7 @@ NAME="AEN12144"
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN12147"
NAME="AEN12603"
></A
><H2
>Synopsis</H2
@ -212,7 +212,7 @@ HREF="gnome-xml-xmlmemory.html#XMLMEMSTRDUPLOC"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN12168"
NAME="AEN12624"
></A
><H2
>Description</H2
@ -222,14 +222,14 @@ NAME="AEN12168"
><DIV
CLASS="REFSECT1"
><A
NAME="AEN12171"
NAME="AEN12627"
></A
><H2
>Details</H2
><DIV
CLASS="REFSECT2"
><A
NAME="AEN12173"
NAME="AEN12629"
></A
><H3
><A
@ -255,7 +255,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12178"
NAME="AEN12634"
></A
><H3
><A
@ -318,7 +318,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12194"
NAME="AEN12650"
></A
><H3
><A
@ -381,7 +381,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12210"
NAME="AEN12666"
></A
><H3
><A
@ -462,7 +462,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12230"
NAME="AEN12686"
></A
><H3
><A
@ -540,7 +540,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12250"
NAME="AEN12706"
></A
><H3
><A
@ -598,7 +598,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12265"
NAME="AEN12721"
></A
><H3
><A
@ -656,7 +656,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12280"
NAME="AEN12736"
></A
><H3
><A
@ -684,7 +684,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12286"
NAME="AEN12742"
></A
><H3
><A
@ -748,7 +748,7 @@ written to the file .memorylist</TD
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12302"
NAME="AEN12758"
></A
><H3
><A
@ -835,7 +835,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12323"
NAME="AEN12779"
></A
><H3
><A
@ -861,7 +861,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12328"
NAME="AEN12784"
></A
><H3
><A
@ -887,7 +887,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12333"
NAME="AEN12789"
></A
><H3
><A
@ -913,7 +913,7 @@ CLASS="PROGRAMLISTING"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12338"
NAME="AEN12794"
></A
><H3
><A
@ -1018,7 +1018,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12363"
NAME="AEN12819"
></A
><H3
><A
@ -1135,7 +1135,7 @@ VALIGN="TOP"
><HR><DIV
CLASS="REFSECT2"
><A
NAME="AEN12391"
NAME="AEN12847"
></A
><H3
><A

View File

@ -444,6 +444,26 @@
<ANCHOR id ="XMLNANOHTTPREAD" href="gnome-xml/gnome-xml-nanohttp.html#XMLNANOHTTPREAD">
<ANCHOR id ="XMLNANOHTTPSAVE" href="gnome-xml/gnome-xml-nanohttp.html#XMLNANOHTTPSAVE">
<ANCHOR id ="XMLNANOHTTPCLOSE" href="gnome-xml/gnome-xml-nanohttp.html#XMLNANOHTTPCLOSE">
<ANCHOR id ="GNOME-XML-NANOFTP" href="gnome-xml/gnome-xml-nanoftp.html">
<ANCHOR id ="FTPLISTCALLBACK" href="gnome-xml/gnome-xml-nanoftp.html#FTPLISTCALLBACK">
<ANCHOR id ="FTPDATACALLBACK" href="gnome-xml/gnome-xml-nanoftp.html#FTPDATACALLBACK">
<ANCHOR id ="XMLNANOFTPINIT" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPINIT">
<ANCHOR id ="XMLNANOFTPNEWCTXT" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPNEWCTXT">
<ANCHOR id ="XMLNANOFTPFREECTXT" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPFREECTXT">
<ANCHOR id ="XMLNANOFTPCONNECTTO" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPCONNECTTO">
<ANCHOR id ="XMLNANOFTPOPEN" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPOPEN">
<ANCHOR id ="XMLNANOFTPCONNECT" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPCONNECT">
<ANCHOR id ="XMLNANOFTPCLOSE" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPCLOSE">
<ANCHOR id ="XMLNANOFTPQUIT" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPQUIT">
<ANCHOR id ="XMLNANOFTPGETRESPONSE" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPGETRESPONSE">
<ANCHOR id ="XMLNANOFTPCHECKRESPONSE" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPCHECKRESPONSE">
<ANCHOR id ="XMLNANOFTPCWD" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPCWD">
<ANCHOR id ="XMLNANOFTPGETCONNECTION" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPGETCONNECTION">
<ANCHOR id ="XMLNANOFTPCLOSECONNECTION" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPCLOSECONNECTION">
<ANCHOR id ="XMLNANOFTPLIST" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPLIST">
<ANCHOR id ="XMLNANOFTPGETSOCKET" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPGETSOCKET">
<ANCHOR id ="XMLNANOFTPGET" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPGET">
<ANCHOR id ="XMLNANOFTPREAD" href="gnome-xml/gnome-xml-nanoftp.html#XMLNANOFTPREAD">
<ANCHOR id ="GNOME-XML-XMLIO" href="gnome-xml/gnome-xml-xmlio.html">
<ANCHOR id ="XMLPARSERINPUTBUFFER" href="gnome-xml/gnome-xml-xmlio.html#XMLPARSERINPUTBUFFER">
<ANCHOR id ="XMLPARSERINPUTBUFFERPTR" href="gnome-xml/gnome-xml-xmlio.html#XMLPARSERINPUTBUFFERPTR">

298
doc/html/libxml-lib.html Normal file
View File

@ -0,0 +1,298 @@
<HTML
><HEAD
><TITLE
>Libxml Library Reference</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.33"><LINK
REL="HOME"
TITLE="Gnome XML Library Reference Manual"
HREF="book1.html"><LINK
REL="PREVIOUS"
TITLE="Libxml Programming Notes"
HREF="libxml-notes.html"><LINK
REL="NEXT"
TITLE="parser"
HREF="gnome-xml-parser.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TH
COLSPAN="4"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="5"
>Gnome XML Library Reference Manual</FONT
></TH
></TR
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="libxml-notes.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&nbsp;</B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="gnome-xml-parser.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="LIBXML-LIB"
>Libxml Library Reference</A
></H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="gnome-xml-parser.html"
>parser</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-sax.html"
>SAX</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-tree.html"
>tree</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-entities.html"
>entities</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-valid.html"
>valid</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-xml-error.html"
>xml-error</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-htmlparser.html"
>HTMLparser</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-htmltree.html"
>HTMLtree</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-xpath.html"
>xpath</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-nanohttp.html"
>nanohttp</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-nanoftp.html"
>nanoftp</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-xmlio.html"
>xmlIO</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-parserinternals.html"
>parserInternals</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-encoding.html"
>encoding</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-debugxml.html"
>debugXML</A
> &#8212; </DT
><DT
><A
HREF="gnome-xml-xmlmemory.html"
>xmlmemory</A
> &#8212; </DT
></DL
></DIV
><P
>This section contains the API reference for libxml. All
the public interfaces are documented here. This reference guide is
build by extracting comments from the code sources. </P
></DIV
><DIV
CLASS="NAVFOOTER"
><BR
CLEAR="all"><BR><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="libxml-notes.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&nbsp;</B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="gnome-xml-parser.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="left"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Libxml Programming Notes</B
></FONT
></TD
><TD
COLSPAN="2"
ALIGN="right"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>parser</B
></FONT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

209
doc/html/libxml-notes.html Normal file
View File

@ -0,0 +1,209 @@
<HTML
><HEAD
><TITLE
>Libxml Programming Notes</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.33"><LINK
REL="HOME"
TITLE="Gnome XML Library Reference Manual"
HREF="book1.html"><LINK
REL="PREVIOUS"
TITLE="Gnome XML Library Reference Manual"
HREF="book1.html"><LINK
REL="NEXT"
TITLE="Libxml Library Reference"
HREF="libxml-lib.html"></HEAD
><BODY
BGCOLOR="#FFFFFF"
TEXT="#000000"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TH
COLSPAN="4"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="5"
>Gnome XML Library Reference Manual</FONT
></TH
></TR
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&nbsp;</B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="libxml-lib.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
></TABLE
></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="LIBXML-NOTES"
>Libxml Programming Notes</A
></H1
><P
>Libxml is an XML toolkit library, it allows to parse, edit
search and write XML documents. There is also an HTML parser front-end
so the same range of tools can be used with HTML input.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><BR
CLEAR="all"><BR><TABLE
WIDTH="100%"
BORDER="0"
BGCOLOR="#000000"
CELLPADDING="1"
CELLSPACING="0"
><TR
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="left"
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&#60;&#60;&#60; Previous Page</B
></FONT
></A
></TD
><TD
WIDTH="25%"
BGCOLOR="#0000C0"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
><A
HREF="book1.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Home</B
></FONT
></A
></B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#00C000"
ALIGN="center"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>&nbsp;</B
></FONT
></TD
><TD
WIDTH="25%"
BGCOLOR="#C00000"
ALIGN="right"
><A
HREF="libxml-lib.html"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Next Page &#62;&#62;&#62;</B
></FONT
></A
></TD
></TR
><TR
><TD
COLSPAN="2"
ALIGN="left"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Gnome XML Library Reference Manual</B
></FONT
></TD
><TD
COLSPAN="2"
ALIGN="right"
><FONT
COLOR="#FFFFFF"
SIZE="3"
><B
>Libxml Library Reference</B
></FONT
></TD
></TR
></TABLE
></DIV
></BODY
></HTML
>

View File

@ -12,24 +12,70 @@
extern "C" {
#endif
/**
* ftpListCallback:
* A callback for the xmlNanoFTPList command
*/
typedef void (*ftpListCallback) (void *userData,
const char *filename, const char* attrib,
const char *owner, const char *group,
unsigned long size, int links, int year,
const char *month, int day, int minute);
/**
* ftpDataCallback:
* A callback for the xmlNanoFTPGet command
*/
typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
/*
* Init
*/
void xmlNanoFTPInit (void);
void * xmlNanoFTPConnectTo (const char *hostname, int port);
/*
* Creating/freeing contexts
*/
void * xmlNanoFTPNewCtxt (const char *URL);
void xmlNanoFTPFreeCtxt (void * ctx);
void * xmlNanoFTPConnectTo (const char *server,
int port);
/*
* Opening/closing session connections
*/
void * xmlNanoFTPOpen (const char *URL);
int xmlNanoFTPConnect (void *ctx);
int xmlNanoFTPClose (void *ctx);
void * xmlNanoFTPOpen (const char *URL);
int xmlNanoFTPFetch (const char *URL,
int xmlNanoFTPQuit (void *ctx);
/*
* Rathern internal commands
*/
int xmlNanoFTPGetResponse (void *ctx);
int xmlNanoFTPCheckResponse (void *ctx);
/*
* CD/DIR/GET handlers
*/
int xmlNanoFTPCwd (void *ctx,
char *directory);
int xmlNanoFTPGetConnection (void *ctx);
int xmlNanoFTPCloseConnection(void *ctx);
int xmlNanoFTPList (void *ctx,
ftpListCallback callback,
void *userData,
char *filename);
int xmlNanoFTPGetSocket (void *ctx,
const char *filename);
int xmlNanoFTPGet (void *ctx,
ftpDataCallback callback,
void *userData,
const char *filename);
int xmlNanoFTPRead (void *ctx,
void *dest,
int len);
int xmlNanoFTPGet (void *ctxt, ftpDataCallback callback,
void *userData, const char *filename);
#ifdef __cplusplus
}
#endif

203
nanoftp.c
View File

@ -1,4 +1,4 @@
/*
/**
* ftp.c: basic handling of an FTP command connection to check for
* directory availability. No transfer is needed.
*
@ -154,7 +154,7 @@ xmlNanoFTPScanURL(void *ctx, const char *URL) {
* Returns an FTP context or NULL in case of error.
*/
xmlNanoFTPCtxtPtr
void *
xmlNanoFTPNewCtxt(const char *URL) {
xmlNanoFTPCtxtPtr ret;
@ -174,13 +174,14 @@ xmlNanoFTPNewCtxt(const char *URL) {
/**
* xmlNanoFTPFreeCtxt:
* @ctxt: an FTP context
* @ctx: an FTP context
*
* Frees the context after closing the connection.
*/
static void
xmlNanoFTPFreeCtxt(xmlNanoFTPCtxtPtr ctxt) {
void
xmlNanoFTPFreeCtxt(void * ctx) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
if (ctxt == NULL) return;
if (ctxt->hostname != NULL) xmlFree(ctxt->hostname);
if (ctxt->protocol != NULL) xmlFree(ctxt->protocol);
@ -191,24 +192,27 @@ xmlNanoFTPFreeCtxt(xmlNanoFTPCtxtPtr ctxt) {
xmlFree(ctxt);
}
/*
/**
* xmlNanoFTPInit:
*
* Initialize the FTP handling.
*/
void xmlNanoFTPInit(void) {
void
xmlNanoFTPInit(void) {
static int done = 0;
if (done) return;
gethostname(hostname, sizeof(hostname));
done = 1;
}
/*
/**
* Parsing of the server answer, we just extract the code.
* return 0 for errors
* +XXX for last line of response
* -XXX for response to be continued
*/
int
static int
xmlNanoFTPParseResponse(void *ctx, char *buf, int len) {
int val = 0;
@ -233,12 +237,16 @@ xmlNanoFTPParseResponse(void *ctx, char *buf, int len) {
return(val);
}
/*
/**
* xmlNanoFTPReadResponse:
* @ctx: an FTP context
* @buf: buffer to read in
* @size: buffer length
*
* Read the response from the FTP server after a command.
* Returns the code number
*
*/
int
static int
xmlNanoFTPReadResponse(void *ctx, char *buf, int size) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char *ptr, *end;
@ -290,11 +298,14 @@ get_more:
return(res / 100);
}
/*
/**
* xmlNanoFTPGetResponse:
* @ctx: an FTP context
*
* Get the response from the FTP server after a command.
* Returns the code number
*
*/
int
xmlNanoFTPGetResponse(void *ctx) {
char buf[16 * 1024 + 1];
@ -315,10 +326,14 @@ xmlNanoFTPGetResponse(void *ctx) {
return(xmlNanoFTPReadResponse(ctx, buf, 16 * 1024));
}
/*
/**
* xmlNanoFTPCheckResponse:
* @ctx: an FTP context
*
* Check if there is a response from the FTP server after a command.
* Returns the code number, or 0
*/
int
xmlNanoFTPCheckResponse(void *ctx) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
@ -344,12 +359,12 @@ xmlNanoFTPCheckResponse(void *ctx) {
return(xmlNanoFTPReadResponse(ctx, buf, 1024));
}
/*
/**
* Send the user authentification
*/
int
sendUser(void *ctx) {
static int
xmlNanoFTPSendUser(void *ctx) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[200];
int len;
@ -367,12 +382,12 @@ sendUser(void *ctx) {
return(0);
}
/*
/**
* Send the password authentification
*/
int
sendPasswd(void *ctx) {
static int
xmlNanoFTPSendPasswd(void *ctx) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[200];
int len;
@ -390,12 +405,18 @@ sendPasswd(void *ctx) {
return(0);
}
/*
* Send a QUIT
/**
* xmlNanoFTPQuit:
* @ctx: an FTP context
*
* Send a QUIT command to the server
*
* Returns -1 in case of error, 0 otherwise
*/
int
sendQuit(void *ctx) {
xmlNanoFTPQuit(void *ctx) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[200];
int len;
@ -409,8 +430,13 @@ sendQuit(void *ctx) {
return(0);
}
/*
* Connecting to the server, port 21 by default.
/**
* xmlNanoFTPConnect:
* @ctx: an FTP context
*
* Tries to open a control connection
*
* Returns -1 in case of error, 0 otherwise
*/
int
@ -496,7 +522,7 @@ xmlNanoFTPConnect(void *ctx) {
* | |---------->| W | 4,5 -------->| F |
* +---+ +---+------------->+---+
*/
res = sendUser(ctxt);
res = xmlNanoFTPSendUser(ctxt);
if (res < 0) {
close(ctxt->controlFd); ctxt->controlFd = -1;
ctxt->controlFd = -1;
@ -517,7 +543,7 @@ xmlNanoFTPConnect(void *ctx) {
ctxt->controlFd = -1;
return(-1);
}
res = sendPasswd(ctxt);
res = xmlNanoFTPSendPasswd(ctxt);
if (res < 0) {
close(ctxt->controlFd); ctxt->controlFd = -1;
ctxt->controlFd = -1;
@ -542,10 +568,17 @@ xmlNanoFTPConnect(void *ctx) {
return(0);
}
/*
* Connecting to a given server server/port
/**
* xmlNanoFTPConnectTo:
* @server: an FTP server name
* @directory: the port (use 21 if 0)
*
* Tries to open a control connection to the given server/port
*
* Returns and fTP context or NULL if it failed
*/
void *
xmlNanoFTPConnectTo(const char *server, int port) {
xmlNanoFTPCtxtPtr ctxt;
@ -566,8 +599,14 @@ xmlNanoFTPConnectTo(const char *server, int port) {
return(ctxt);
}
/*
* Check an FTP directory on the server
/**
* xmlNanoFTPGetConnection:
* @ctx: an FTP context
* @directory: a directory on the server
*
* Tries to change the remote directory
*
* Returns -1 incase of error, 1 if CWD worked, 0 if it failed
*/
int
@ -592,8 +631,6 @@ xmlNanoFTPCwd(void *ctx, char *directory) {
if (res < 0) return(res);
res = xmlNanoFTPGetResponse(ctxt);
if (res == 4) {
close(ctxt->controlFd); ctxt->controlFd = -1;
ctxt->controlFd = -1;
return(-1);
}
if (res == 2) return(1);
@ -603,9 +640,16 @@ xmlNanoFTPCwd(void *ctx, char *directory) {
return(0);
}
/*
* xmlNanoFTPGetConnection
/**
* xmlNanoFTPGetConnection:
* @ctx: an FTP context
*
* Try to open a data connection to the server. Currently only
* passive mode is supported.
*
* Returns -1 incase of error, 0 otherwise
*/
int
xmlNanoFTPGetConnection(void *ctx) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
@ -705,9 +749,15 @@ xmlNanoFTPGetConnection(void *ctx) {
}
/*
* xmlNanoFTPCloseConnection
/**
* xmlNanoFTPCloseConnection:
* @ctx: an FTP context
*
* Close the data connection from the server
*
* Returns -1 incase of error, 0 otherwise
*/
int
xmlNanoFTPCloseConnection(void *ctx) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
@ -716,15 +766,21 @@ xmlNanoFTPCloseConnection(void *ctx) {
close(ctxt->dataFd); ctxt->dataFd = -1;
res = xmlNanoFTPGetResponse(ctxt);
if (res != 2) {
close(ctxt->dataFd); ctxt->dataFd = -1;
close(ctxt->controlFd); ctxt->controlFd = -1;
return(-1);
}
return(0);
}
/*
* xmlNanoFTPParseList
/**
* xmlNanoFTPParseList:
* @list: some data listing received from the server
* @callback: the user callback
* @userData: the user callback data
*
* Parse at most one entry from the listing.
*
* Returns -1 incase of error, the lenght of data parsed otherwise
*/
static int
@ -842,11 +898,22 @@ xmlNanoFTPParseList(const char *list, ftpListCallback callback, void *userData)
return(cur - list);
}
/*
* xmlNanoFTPList
/**
* xmlNanoFTPList:
* @ctx: an FTP context
* @callback: the user callback
* @userData: the user callback data
* @filename: optional files to list
*
* Do a listing on the server. All files info are passed back
* in the callbacks.
*
* Returns -1 incase of error, 0 otherwise
*/
int
xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData) {
xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData,
char *filename) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[4096 + 1];
int len, res;
@ -856,7 +923,10 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData) {
ctxt->dataFd = xmlNanoFTPGetConnection(ctxt);
len = snprintf(buf, sizeof(buf), "LIST -L\r\n");
if (filename != NULL)
len = snprintf(buf, sizeof(buf), "LIST -L %s\r\n", filename);
else
len = snprintf(buf, sizeof(buf), "LIST -L\r\n");
#ifdef DEBUG_FTP
printf(buf);
#endif
@ -927,10 +997,17 @@ xmlNanoFTPList(void *ctx, ftpListCallback callback, void *userData) {
return(0);
}
/*
/**
* xmlNanoFTPGetSocket:
* @ctx: an FTP context
* @filename: the file to retrieve
*
* Initiate fetch of the given file from the server.
*
* Returns the socket for the data connection, or <0 in case of error
*/
int
xmlNanoFTPGetSocket(void *ctx, const char *filename) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
@ -971,11 +1048,22 @@ xmlNanoFTPGetSocket(void *ctx, const char *filename) {
return(ctxt->dataFd);
}
/*
* xmlNanoFTPList
/**
* xmlNanoFTPGet:
* @ctx: an FTP context
* @callback: the user callback
* @userData: the user callback data
* @filename: the file to retrieve
*
* Fetch the given file from the server. All data are passed back
* in the callbacks. The last callback has a size of 0 block.
*
* Returns -1 incase of error, 0 otherwise
*/
int
xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData, const char *filename) {
xmlNanoFTPGet(void *ctx, ftpDataCallback callback, void *userData,
const char *filename) {
xmlNanoFTPCtxtPtr ctxt = (xmlNanoFTPCtxtPtr) ctx;
char buf[4096];
int len = 0, res;
@ -1058,11 +1146,13 @@ xmlNanoFTPRead(void *ctx, void *dest, int len) {
return(len);
}
/*
/**
* xmlNanoFTPOpen:
* @URL: the URL to the resource
*
* Start to fetch the given ftp:// resource
*
* Returns an FTP context, or NULL
*/
void *
@ -1088,8 +1178,13 @@ xmlNanoFTPOpen(const char *URL) {
return(ctxt);
}
/*
* Disconnect from the FTP server.
/**
* xmlNanoFTPClose:
* @ctx: an FTP context
*
* Close the connection and both control and transport
*
* Returns -1 incase of error, 0 otherwise
*/
int
@ -1104,7 +1199,7 @@ xmlNanoFTPClose(void *ctx) {
ctxt->dataFd = -1;
}
if (ctxt->controlFd >= 0) {
sendQuit(ctxt);
xmlNanoFTPQuit(ctxt);
close(ctxt->controlFd);
ctxt->controlFd = -1;
}
@ -1171,7 +1266,7 @@ int main(int argc, char **argv) {
} else {
fprintf(stderr, "/toto : CWD successful\n");
}
xmlNanoFTPList(ctxt, ftpList, NULL);
xmlNanoFTPList(ctxt, ftpList, NULL, NULL);
output = fopen("/tmp/tstdata", "w");
if (output != NULL) {
if (xmlNanoFTPGet(ctxt, ftpData, (void *) output, tstfile) < 0)

View File

@ -12,24 +12,70 @@
extern "C" {
#endif
/**
* ftpListCallback:
* A callback for the xmlNanoFTPList command
*/
typedef void (*ftpListCallback) (void *userData,
const char *filename, const char* attrib,
const char *owner, const char *group,
unsigned long size, int links, int year,
const char *month, int day, int minute);
/**
* ftpDataCallback:
* A callback for the xmlNanoFTPGet command
*/
typedef void (*ftpDataCallback) (void *userData, const char *data, int len);
/*
* Init
*/
void xmlNanoFTPInit (void);
void * xmlNanoFTPConnectTo (const char *hostname, int port);
/*
* Creating/freeing contexts
*/
void * xmlNanoFTPNewCtxt (const char *URL);
void xmlNanoFTPFreeCtxt (void * ctx);
void * xmlNanoFTPConnectTo (const char *server,
int port);
/*
* Opening/closing session connections
*/
void * xmlNanoFTPOpen (const char *URL);
int xmlNanoFTPConnect (void *ctx);
int xmlNanoFTPClose (void *ctx);
void * xmlNanoFTPOpen (const char *URL);
int xmlNanoFTPFetch (const char *URL,
int xmlNanoFTPQuit (void *ctx);
/*
* Rathern internal commands
*/
int xmlNanoFTPGetResponse (void *ctx);
int xmlNanoFTPCheckResponse (void *ctx);
/*
* CD/DIR/GET handlers
*/
int xmlNanoFTPCwd (void *ctx,
char *directory);
int xmlNanoFTPGetConnection (void *ctx);
int xmlNanoFTPCloseConnection(void *ctx);
int xmlNanoFTPList (void *ctx,
ftpListCallback callback,
void *userData,
char *filename);
int xmlNanoFTPGetSocket (void *ctx,
const char *filename);
int xmlNanoFTPGet (void *ctx,
ftpDataCallback callback,
void *userData,
const char *filename);
int xmlNanoFTPRead (void *ctx,
void *dest,
int len);
int xmlNanoFTPGet (void *ctxt, ftpDataCallback callback,
void *userData, const char *filename);
#ifdef __cplusplus
}
#endif