2011-03-04 13:07 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* debian/control
  * debian/compat
  * debian/rules
    - add all build-depends
    - create detached debug symbol package
    - various small bits
    ; [Tamas Tevesz]

  * contrib/hbpost.hbm
    * Removed soversion from dynlib name for cygwin targets.
      (untested)

  * contrib/hbtip/tests/httpadv.prg
  * contrib/hbtip/tests/dnldftp.prg
  * contrib/hbtip/tests/tipmmail.prg
  * contrib/hbtip/tests/tiptest.prg
  * contrib/hbtip/tests/dbtohtml.prg
  * contrib/hbtip/tests/upld_ftp.prg
  * contrib/hbtip/tests/tipmail.prg
  * contrib/hbtip/tests/base64.prg
  * contrib/hbtip/tests/ftpadv.prg
  * contrib/hbtip/tests/loadhtml.prg
  * contrib/hbtip/tests/tipmime.prg
    ! inside is one real fix (unused var in base64.prg), the rest is
      generous use of hbformat + some manual editing (weed out funky chars,
      reduce eye bleeding caused by comment blocks, throw away c++-style
      comments, and the like).
    ; [Tamas Tevesz]
This commit is contained in:
Viktor Szakats
2011-03-04 12:09:57 +00:00
parent e03dbb75d6
commit c4ce99ef18
16 changed files with 358 additions and 278 deletions

View File

@@ -16,6 +16,36 @@
The license applies to all entries newer than 2009-04-28.
*/
2011-03-04 13:07 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* debian/control
* debian/compat
* debian/rules
- add all build-depends
- create detached debug symbol package
- various small bits
; [Tamas Tevesz]
* contrib/hbpost.hbm
* Removed soversion from dynlib name for cygwin targets.
(untested)
* contrib/hbtip/tests/httpadv.prg
* contrib/hbtip/tests/dnldftp.prg
* contrib/hbtip/tests/tipmmail.prg
* contrib/hbtip/tests/tiptest.prg
* contrib/hbtip/tests/dbtohtml.prg
* contrib/hbtip/tests/upld_ftp.prg
* contrib/hbtip/tests/tipmail.prg
* contrib/hbtip/tests/base64.prg
* contrib/hbtip/tests/ftpadv.prg
* contrib/hbtip/tests/loadhtml.prg
* contrib/hbtip/tests/tipmime.prg
! inside is one real fix (unused var in base64.prg), the rest is
generous use of hbformat + some manual editing (weed out funky chars,
reduce eye bleeding caused by comment blocks, throw away c++-style
comments, and the like).
; [Tamas Tevesz]
2011-03-04 11:31 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/src/pp/pplib.c
* updated function description

View File

@@ -56,8 +56,9 @@
# output name tweaks for dynamic libs
# NOTE: We're altering previously set output name value here
{hbdyn&unix&!darwin}-o${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor}.${hb_release}
{hbdyn&unix&!darwin&!cygwin}-o${hb_outputname}${hb_dynext}.${hb_major}.${hb_minor}.${hb_release}
{hbdyn&unix&darwin}-o${hb_outputname}.${hb_major}.${hb_minor}.${hb_release}${hb_dynext}
{hbdyn&unix&cygwin}-o${hb_outputname}${hb_dynext}
{hbdyn&!unix&allwin}-o${hb_outputname}-${hb_major}${hb_minor}${hb_dynsuffix}
{hbdyn&!unix&!allwin}-o${hb_outputname}${hb_dynsuffix}

View File

@@ -17,45 +17,46 @@
* base64test -u [-d] to use url encoding/decoding.
*****/
#Define hSTDIN 0
#Define hSTDOUT 1
#define hSTDIN 0
#define hSTDOUT 1
PROCEDURE MAIN( ... )
LOCAL oEncoder
LOCAL cData
LOCAL cBuffer := Space( 1024 )
LOCAL nLen
LOCAL cOption, lHelp := .F.,lDecode := .F., lQp := .F., lUrl := .F.
LOCAL hInpu := hSTDIN
LOCAL hOutpu := hSTDOUT
LOCAL lHelp := .F. , lDecode := .F. , lQp := .F. , lUrl := .F.
LOCAL hInput := hSTDIN
LOCAL hOutput := hSTDOUT
/* Parameter parsing */
FOR nLen := 1 TO PCount()
cData := Lower( hb_PValue( nLen ) )
DO CASE
CASE cData == '-h'
lHelp := .T.
CASE cData == '-h'
lHelp := .T.
CASE cData == '-d'
lDecode := .T.
CASE cData == '-d'
lDecode := .T.
CASE cData == '-q'
lQp := .T.
CASE cData == '-q'
lQp := .T.
CASE cData == '-u'
lUrl := .T.
CASE cData == '-u'
lUrl := .T.
OTHERWISE
IF File(cData) .and. hInpu = hSTDIN
hInpu = FOpen(cData)
ELSEIF hOutpu = hSTDOUT
hOutpu = FCreate(cData)
ELSE
? "Wrong parameter", cData
?
lHelp := .T.
EXIT
ENDIF
IF File( cData ) .AND. hInput = hSTDIN
hInput = FOpen( cData )
ELSEIF hOutput = hSTDOUT
hOutput = FCreate( cData )
ELSE
? "Wrong parameter", cData
?
lHelp := .T.
EXIT
ENDIF
ENDCASE
NEXT
@@ -82,17 +83,17 @@ PROCEDURE MAIN( ... )
/* Reading input stream */
cData := ""
nLen := FRead( hInpu, @cBuffer, 1024 )
nLen := FRead( hInput, @cBuffer, 1024 )
DO WHILE nLen > 0
IF nLen < 1024
cData += Substr( cBuffer, 1, nLen )
cData += SubStr( cBuffer, 1, nLen )
ELSE
cData += cBuffer
ENDIF
nLen := FRead( hInpu, @cBuffer, 1024 )
nLen := FRead( hInput, @cBuffer, 1024 )
ENDDO
IF hInpu <> hSTDIN
FClose(hInpu)
IF hInput <> hSTDIN
FClose( hInput )
ENDIF
/* Encoding/decoding */
@@ -103,8 +104,9 @@ PROCEDURE MAIN( ... )
ENDIF
/* Writing stream */
FWrite( hOutpu, cData )
IF hOutpu <> hSTDOUT
FClose(hOutpu)
FWrite( hOutput, cData )
IF hOutput <> hSTDOUT
FClose( hOutput )
ENDIF
RETURN
RETURN

View File

@@ -2,18 +2,21 @@
* $Id$
*/
// This example demonstrates operator overloading for
// creating a HTML document.
/*
* This example demonstrates operator overloading for
* creating a HTML document.
*/
PROCEDURE Main
LOCAL oDoc, oNode, oTable, oRow, oCell
LOCAL i, j
CLS
BEGIN SEQUENCE
USE ( hb_DirBase() + ".." + hb_ps() + ".." + hb_ps() + ".." + hb_ps() + "tests" + hb_ps() +;
"test.dbf" )
USE ( hb_DirBase() + ".." + hb_ps() + ".." + hb_ps() + ".." + hb_ps() + "tests" + hb_ps() + ;
"test.dbf" )
RECOVER
? "Error: Database not found test.dbf"
QUIT
@@ -21,65 +24,65 @@ PROCEDURE Main
oDoc := THtmlDocument():new()
// Operator "+" creates a new node
/* Operator "+" creates a new node */
oNode := oDoc:head + "meta"
oNode:name := "Generator"
oNode:content := "THtmlDocument"
// Operator ":" returns first "h1" from body (creates if not existent)
/* Operator ":" returns first "h1" from body (creates if not existent) */
oNode := oDoc:body:h1
oNode:text := "My address book"
// Operator "+" creates a new <p> node
/* Operator "+" creates a new <p> node */
oNode := oDoc:body + "p"
// Operator "+" creates a new <font> node with attribute
/* Operator "+" creates a new <font> node with attribute */
oNode := oNode + 'font size="5"'
oNode:text := "This is a "
// Operator "+" creates a new <b> node
/* Operator "+" creates a new <b> node */
oNode := oNode + "b"
// Operator "+" creates a new <font> node with attribute
/* Operator "+" creates a new <font> node with attribute */
oNode := oNode + "font color='blue'"
oNode:text := "sample "
// Operator "-" closes 2nd <font>, result is <b> node
/* Operator "-" closes 2nd <font>, result is <b> node */
oNode := oNode - "font"
// Operator "-" closes <b> node, result is 1st <font> node
/* Operator "-" closes <b> node, result is 1st <font> node */
oNode := oNode - "b"
oNode:text := "database!"
// Operator "-" closes 1st <font> node, result is <p> node
/* Operator "-" closes 1st <font> node, result is <p> node */
oNode := oNode - "font"
oNode := oNode + "hr"
HB_SYMBOL_UNUSED( oNode )
// Operator ":" returns first "table" from body (creates if not existent)
/* Operator ":" returns first "table" from body (creates if not existent) */
oTable := oDoc:body:table
oTable:attr := 'border="0" width="100%" cellspacing="0" cellpadding="0"'
oRow := oTable + 'tr bgcolor="lightcyan"'
FOR i:=1 TO FCount()
oCell := oRow + "th"
oCell:text:= FieldName(i)
oCell := oCell - "th"
HB_SYMBOL_UNUSED( oCell )
FOR i := 1 TO FCount()
oCell := oRow + "th"
oCell:text := FieldName( i )
oCell := oCell - "th"
HB_SYMBOL_UNUSED( oCell )
NEXT
oRow := oRow - "tr"
HB_SYMBOL_UNUSED( oRow )
FOR i:=1 TO 10
FOR i := 1 TO 10
oRow := oTable + "tr"
oRow:bgColor := IIf( Recno() % 2 == 0, "lightgrey", "white" )
oRow:bgColor := iif( RecNo() % 2 == 0, "lightgrey", "white" )
FOR j:=1 TO FCount()
FOR j := 1 TO FCount()
oCell := oRow + "td"
oCell:text := FieldGet(j)
oCell:text := FieldGet( j )
oCell := oCell - "td"
HB_SYMBOL_UNUSED( oCell )
NEXT
@@ -94,9 +97,9 @@ PROCEDURE Main
HB_SYMBOL_UNUSED( oNode )
oNode := oDoc:body + "p"
oNode:text := "10 records from database " + ALias() + ".dbf"
oNode:text := "10 records from database " + Alias() + ".dbf"
DbCloseArea()
dbCloseArea()
IF oDoc:writeFile( "address.html" )
? "File created: address.html"
@@ -107,7 +110,7 @@ PROCEDURE Main
WAIT
? HtmlToOem( oDoc:body:getText() )
// DllCall( "shell32.dll", NIL, "ShellExecute", 0, "open", "address.html", NIL, "", 1 )
/* DllCall( "shell32.dll", NIL, "ShellExecute", 0, "open", "address.html", NIL, "", 1 ) */
hb_run( "address.html" )
RETURN
RETURN

View File

@@ -3,23 +3,23 @@
*/
/*
Download an file from an ftp server
*/
* Download an file from an ftp server
*/
#include "common.ch"
PROCEDURE MAIN( cFile)
PROCEDURE MAIN( cFile )
? TRP20FTPEnv( cFile )
RETURN
RETURN
/**********************************************************************
*
* Static Function TRP20FTPEnv()
*
**********************************************************************/
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
*+ Static Function TRP20FTPEnv()
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
STATIC FUNCTION TRP20FTPEnv( cCarpeta )
LOCAL aFiles
@@ -33,14 +33,14 @@ STATIC FUNCTION TRP20FTPEnv( cCarpeta )
LOCAL cPassword
LOCAL cFile := ""
cServer := "ftpserver" //change ftpserver to the real name or ip of your ftp server
cUser := "ftpuser" // change ftpuser to an valid user on ftpserer
cPassword := "ftppass" // change ftppass to an valid password for ftpuser
cServer := "ftpserver" /* change ftpserver to the real name or ip of your ftp server */
cUser := "ftpuser" /* change ftpuser to an valid user on ftpserer */
cPassword := "ftppass" /* change ftppass to an valid password for ftpuser */
cUrl := "ftp://" + cUser + ":" + cPassword + "@" + cServer
// Leemos ficheros a enviar
/* Leemos ficheros a enviar */
aFiles := { { cCarpeta, 1, 2, 3 } }
// aFiles := Directory( cCarpeta )
/* aFiles := Directory( cCarpeta ) */
IF Len( aFiles ) > 0
@@ -49,7 +49,7 @@ STATIC FUNCTION TRP20FTPEnv( cCarpeta )
oFTP:nConnTimeout := 20000
oFTP:bUsePasv := .T.
// Comprobamos si el usuario contiene una @ para forzar el userid
/* Comprobamos si el usuario contiene una @ para forzar el userid */
IF At( "@", cUser ) > 0
oFTP:oUrl:cServer := cServer
oFTP:oUrl:cUserID := cUser
@@ -57,12 +57,12 @@ STATIC FUNCTION TRP20FTPEnv( cCarpeta )
ENDIF
IF oFTP:Open( cUrl )
FOR each cFile IN afiles
FOR EACH cFile IN afiles
IF !oFtp:DownloadFile( cFile[ 1 ] )
lRetorno := .F.
EXIT
ELSE
lRetorno := .t.
lRetorno := .T.
ENDIF
NEXT
oFTP:Close()
@@ -79,4 +79,5 @@ STATIC FUNCTION TRP20FTPEnv( cCarpeta )
lRetorno := .F.
ENDIF
ENDIF
RETURN lRetorno
RETURN lRetorno

View File

@@ -3,11 +3,12 @@
*/
/******************************************
* TIP test
* FTP Advanced operations Test
*****/
* TIP test
* FTP Advanced operations Test
******************************************/
PROCEDURE MAIN( cUrl )
LOCAL oCon, oUrl
oUrl := tURL():New( cUrl )
@@ -55,4 +56,5 @@ PROCEDURE MAIN( cUrl )
? "Done"
?
RETURN
RETURN

View File

@@ -3,11 +3,12 @@
*/
/******************************************
* TIP test
* HTTP Advanced operations Test
*****/
* TIP test
* HTTP Advanced operations Test
******************************************/
PROCEDURE MAIN( cUrl )
LOCAL oCon, oUrl, i
oUrl := tURL():New( cUrl )
@@ -33,8 +34,8 @@ PROCEDURE MAIN( cUrl )
IF oCon:Get( oUrl:cPath )
? "Get Sucessful"
FOR i := 1 to Len( oCon:hHeaders )
? hb_HKeyAt( oCon:hHeaders, i ) +":", hb_HValueAt( oCon:hHeaders, i )
FOR i := 1 TO Len( oCon:hHeaders )
? hb_HKeyAt( oCon:hHeaders, i ) + ":", hb_HValueAt( oCon:hHeaders, i )
NEXT
ELSE
? "Get failure (server reply:", oCon:cReply , ")"
@@ -54,4 +55,6 @@ PROCEDURE MAIN( cUrl )
? "Done"
?
RETURN
RETURN

View File

@@ -2,14 +2,17 @@
* $Id$
*/
// Sends a query to Google and displays the Links from the response HTML page
/*
* Sends a query to Google and displays the Links from the response HTML page
*/
PROCEDURE Main
LOCAL oHttp, cHtml, hQuery, aLink, oNode, oDoc
oHttp:= TIpClientHttp():new( "http://www.google.de/search" )
oHttp := TIpClientHttp():new( "http://www.google.de/search" )
// build the Google query
/* build the Google query */
hQUery := hb_Hash()
hb_hSetCaseMatch( hQuery, .F. )
@@ -17,35 +20,36 @@ PROCEDURE Main
hQuery["hl"] := "en"
hQuery["btnG"] := "Google+Search"
// add query data to the TUrl object
/* add query data to the TUrl object */
oHttp:oUrl:addGetForm( hQuery )
// Connect to the HTTP server
/* Connect to the HTTP server */
IF ! oHttp:open()
? "Connection error:", oHttp:lastErrorMessage()
QUIT
ENDIF
// download the Google response
/* download the Google response */
cHtml := oHttp:readAll()
oHttp:close()
? Len(cHtml), "bytes received "
? Len( cHtml ), "bytes received "
oDoc := THtmlDocument():new( cHtml )
oDoc:writeFile( "Google.html" )
// ":a" retrieves the first <a href="url"> text </a> tag
/* ":a" retrieves the first <a href="url"> text </a> tag */
oNode := oDoc:body:a
? oNode:getText(""), oNode:href
? oNode:getText( "" ), oNode:href
// ":divs(5)" returns the 5th <div> tag
oNode := oDoc:body:divs(5)
/* ":divs(5)" returns the 5th <div> tag */
oNode := oDoc:body:divs( 5 )
// "aS" is the plural of "a" and returns all <a href="url"> tags
/* "aS" is the plural of "a" and returns all <a href="url"> tags */
aLink := oNode:aS
FOR EACH oNode IN aLink
? HtmlToOem( oNode:getText("") ), oNode:href
? HtmlToOem( oNode:getText( "" ) ), oNode:href
NEXT
RETURN
RETURN

View File

@@ -3,23 +3,24 @@
*/
/******************************************
* TIP test
* Mail - reading and writing multipart mails
*
* Test for reading a multipart message (that must already
* be in its canonical form, that is, line terminator is
* CRLF and it must have no headers other than SMTP/Mime).
*
* This test writes data to standard output, and is
* compiled only under GTCGI;
*****/
* TIP test
* Mail - reading and writing multipart mails
*
* Test for reading a multipart message (that must already
* be in its canonical form, that is, line terminator is
* CRLF and it must have no headers other than SMTP/Mime).
*
* This test writes data to standard output, and is
* compiled only under GTCGI;
******************************************/
PROCEDURE MAIN( cFileName )
LOCAL oMail, cData, i
IF cFileName != NIL
cData := MemoRead(cFileName)
IF Ferror() > 0
cData := MemoRead( cFileName )
IF FError() > 0
? "Can't open", cFileName
QUIT
ENDIF
@@ -54,5 +55,6 @@ PROCEDURE MAIN( cFileName )
? "DONE"
?
/* Writing stream */
//FWrite( 1, oMail:ToString() )
RETURN
/* FWrite( 1, oMail:ToString() ) */
RETURN

View File

@@ -3,14 +3,15 @@
*/
/******************************************
* TIP test
* MIME type test
*
* This test tries to detect the mime type of a give file.
*
* Usage:
* mimetest filename
*****/
* TIP test
* MIME type test
*
* This test tries to detect the mime type of a give file.
*
* Usage:
* mimetest filename
******************************************/
PROCEDURE MAIN( cFileName )
@@ -21,7 +22,7 @@ PROCEDURE MAIN( cFileName )
QUIT
ENDIF
IF ( ! file( cFileName ) )
IF ( ! File( cFileName ) )
?
? "File", cFileName, "is not valid"
?
@@ -31,4 +32,4 @@ PROCEDURE MAIN( cFileName )
? cFileName + ":", Tip_FileMimeType( cFileName )
?
RETURN
RETURN

View File

@@ -3,29 +3,30 @@
*/
/******************************************
* TIP test
* Mail - reading and writing multipart mails
*
* Creating a mail message.
* This will create a valid mail message, using
* the set of files given in the command line.
*
* Usage:
* testmmail [options] attachment1, attachment2...
* options:
* -h Help
* -f "from" Set "mail from" field
* -t "to" Set "mail to" field
* -s "subject" Set mail subject
* -b "body" Set mail body (or message)
* -m "bodyfile" Set mail body using a file
*
*
* This test writes data to standard output, and is
* compiled only under GTCGI;
*****/
* TIP test
* Mail - reading and writing multipart mails
*
* Creating a mail message.
* This will create a valid mail message, using
* the set of files given in the command line.
*
* Usage:
* testmmail [options] attachment1, attachment2...
* options:
* -h Help
* -f "from" Set "mail from" field
* -t "to" Set "mail to" field
* -s "subject" Set mail subject
* -b "body" Set mail body (or message)
* -m "bodyfile" Set mail body using a file
*
*
* This test writes data to standard output, and is
* compiled only under GTCGI;
******************************************/
PROCEDURE MAIN( ... )
LOCAL oMail, cData, i, oAttach
LOCAL cFname, cFExt
@@ -40,80 +41,81 @@ PROCEDURE MAIN( ... )
i := 1
DO WHILE i < PCount()
cData := hb_PValue(i)
cData := hb_PValue( i )
IF lower( cData ) == "-h"
IF Lower( cData ) == "-h"
Usage()
QUIT
ENDIF
IF lower( cData ) == "-f"
i++
cData := hb_PValue(i)
IF Lower( cData ) == "-f"
i ++
cData := hb_PValue( i )
IF cData != NIL
oMail:hHeaders[ "From" ] := cData
ENDIF
ELSEIF lower( cData ) == "-t"
i++
cData := hb_PValue(i)
ELSEIF Lower( cData ) == "-t"
i ++
cData := hb_PValue( i )
IF cData != NIL
oMail:hHeaders[ "To" ] := cData
ENDIF
ELSEIF lower( cData ) == "-s"
i++
cData := hb_PValue(i)
ELSEIF Lower( cData ) == "-s"
i ++
cData := hb_PValue( i )
IF cData != NIL
oMail:hHeaders[ "Subject" ] := cData
ENDIF
ELSEIF lower( cData ) == "-b"
i++
cData := hb_PValue(i)
ELSEIF Lower( cData ) == "-b"
i ++
cData := hb_PValue( i )
IF cData != NIL
oMail:SetBody( cData + e"\r\n" )
ENDIF
ELSEIF lower( cData ) == "-m"
i++
cData := hb_PValue(i)
ELSEIF Lower( cData ) == "-m"
i ++
cData := hb_PValue( i )
IF cData != NIL
cData := Memoread( cData )
IF Empty(cData)
? "FATAL: Can't read", hb_PValue(i)
cData := MemoRead( cData )
IF Empty( cData )
? "FATAL: Can't read", hb_PValue( i )
QUIT
ENDIF
oMail:SetBody( cData + e"\r\n")
oMail:SetBody( cData + e"\r\n" )
ENDIF
ELSE // it is an attachment file
cData := Memoread( cData )
IF Empty(cData)
? "FATAL: Can't read attachment", hb_PValue(i)
cData := MemoRead( cData )
IF Empty( cData )
? "FATAL: Can't read attachment", hb_PValue( i )
QUIT
ENDIF
oAttach := TipMail():New()
oAttach:SetEncoder( "base64" )
//TODO: mime type magic auto-finder
HB_FNameSplit( hb_PValue(i),,@cFname, @cFext )
HB_FNameSplit( hb_PValue( i ), , @cFname, @cFext )
// Some EMAIL readers use Content-Type to check for filename
oAttach:hHeaders[ "Content-Type" ] := ;
"application/X-TIP-Attachment; filename=";
+ cFname + cFext
"application/X-TIP-Attachment; filename=";
+ cFname + cFext
// But usually, original filename is set here
oAttach:hHeaders[ "Content-Disposition" ] := ;
"attachment; filename=" + cFname + cFext
"attachment; filename=" + cFname + cFext
oAttach:SetBody( cData )
oMail:Attach( oAttach )
ENDIF
i++
i ++
ENDDO
/* Writing stream */
FWrite( 1, oMail:ToString() )
RETURN
RETURN
PROCEDURE Usage()
? "Usage:"
? "testmmail [options] attachment1, attachment2..."
? " options:"
@@ -125,4 +127,5 @@ PROCEDURE Usage()
? ' -m "bodyfile" Set mail body using a file'
?
?
RETURN
RETURN

View File

@@ -3,70 +3,71 @@
*/
/*****************************************************
* TEST of TIP libs (for higher level URI interface)
*
* Usage: This file is similar to a wget command
*
* tiptest <URI> [filename]
*
* Without the filename, tiptest will be in demo mode,
* just demostrating it is working
*
* With the filename, data will be stored to the file or
* retrieved from the file and sent to internet.
*
* Usage of URI.
* HTTP Protocol
* http://<sitename>/<path>?<query>
* - at the moment HTTP URI is not able to send data,
* (e.g. a form)
*
* POP Protocol
* pop://<username>:<password>@<popserver>/[-][MsgNum]
* - Witout MsgNum, you get the list of messages
* - With MsgNum get Message MsgNum
* - With -MsgNum deletes message MsgNum
*
* SMTP Protocol
* smtp://<mail-from>@<server>/RCPT
* - (You have to provide a filename)
* - use &at; in mail-from message
* - Send the letter in filename (that must include
* headers) to RCPT e.f.
* stmp://user&at;myprovider.com@smtp.myprovider.com/gian@niccolai.ws
*
* NOTE: IN UNIX, to use & from command line you have to surround
* the url with "", eg "smtp://...&at;...@server/dest"
*
* FTP Protocol
* ftp://user:passwd@<ftpserver>/[<path>]
* - without path, get the list of files (use path/ to get the list of
* files in a dir.
* - with path, get a file. If the target file (second param) starts with '+'
* it will be sent instead of being retrieved.
*/
* TEST of TIP libs (for higher level URI interface)
*
* Usage: This file is similar to a wget command
*
* tiptest <URI> [filename]
*
* Without the filename, tiptest will be in demo mode,
* just demostrating it is working
*
* With the filename, data will be stored to the file or
* retrieved from the file and sent to internet.
*
* Usage of URI.
* HTTP Protocol
* http://<sitename>/<path>?<query>
* - at the moment HTTP URI is not able to send data,
* (e.g. a form)
*
* POP Protocol
* pop://<username>:<password>@<popserver>/[-][MsgNum]
* - Witout MsgNum, you get the list of messages
* - With MsgNum get Message MsgNum
* - With -MsgNum deletes message MsgNum
*
* SMTP Protocol
* smtp://<mail-from>@<server>/RCPT
* - (You have to provide a filename)
* - use &at; in mail-from message
* - Send the letter in filename (that must include
* headers) to RCPT e.f.
* stmp://user&at;myprovider.com@smtp.myprovider.com/gian@niccolai.ws
*
* NOTE: IN UNIX, to use & from command line you have to surround
* the url with "", eg "smtp://...&at;...@server/dest"
*
* FTP Protocol
* ftp://user:passwd@<ftpserver>/[<path>]
* - without path, get the list of files (use path/ to get the list of
* files in a dir.
* - with path, get a file. If the target file (second param) starts with '+'
* it will be sent instead of being retrieved.
*****************************************************/
#include "hbclass.ch"
#include "tip.ch"
PROCEDURE MAIN( cUrl, cFile )
LOCAL bWrite := .F.
LOCAL oUrl, oClient
LOCAL cData
Set Color to w+/b
SET COLOR TO w +/ b
CLEAR SCREEN
@1,6 SAY "X H A R B O U R - TIP (class based internet client protocol) test"
@1, 6 SAY "X H A R B O U R - TIP (class based internet client protocol) test"
IF Empty( cUrl )
@4,5 SAY "USAGE: tipTest <URI> [dumpToOrFromFileName]"
@4, 5 SAY "USAGE: tipTest <URI> [dumpToOrFromFileName]"
Terminate()
ENDIF
oUrl := tURL():New( cUrl )
IF Empty( oUrl )
@4,5 SAY "Invalid url " + cUrl
@4, 5 SAY "Invalid url " + cUrl
Terminate()
ENDIF
@@ -86,52 +87,52 @@ PROCEDURE MAIN( cUrl, cFile )
ENDCASE
IF Empty( oClient )
@4,5 SAY "Invalid url " + cUrl
@4, 5 SAY "Invalid url " + cUrl
Terminate()
ENDIF
oClient:nConnTimeout := 2000 //:= 20000
oClient:nConnTimeout := 2000 /* := 20000 */
oUrl:cUserid := STRTRAN(oUrl:cUserid, "&at;", "@")
oUrl:cUserid := StrTran( oUrl:cUserid, "&at;", "@" )
@4,5 SAY "Connecting to " + oUrl:cProto + "://" + oUrl:cServer
@4, 5 SAY "Connecting to " + oUrl:cProto + "://" + oUrl:cServer
IF oClient:Open()
IF Empty( oClient:cReply )
@5,5 SAY "Connection status: <connected>"
@5, 5 SAY "Connection status: <connected>"
ELSE
@5,5 SAY "Connection status: " + oClient:cReply
@5, 5 SAY "Connection status: " + oClient:cReply
ENDIF
IF ! Empty( cFile ) .and. Left( cFile, 1 ) == '+'
cFile := Substr( cFile, 2 )
IF ! Empty( cFile ) .AND. Left( cFile, 1 ) == '+'
cFile := SubStr( cFile, 2 )
bWrite := .T.
ENDIF
IF oClient:nAccessMode == TIP_WO .or. ( oClient:nAccessMode == TIP_RW .and. bWrite )
oClient:exGauge := { | done, size| ShowGauge(done, size ) }
IF oClient:nAccessMode == TIP_WO .OR. ( oClient:nAccessMode == TIP_RW .AND. bWrite )
oClient:exGauge := { | done, size| ShowGauge( done, size ) }
/* Can be also:
oClient:exGauge := {| done, size, oConnection | dothing( done, size, oConnection) }
*/
IF oClient:WriteFromFile( cFile )
@7,5 SAY "Data sucessfully sent"
@7, 5 SAY "Data sucessfully sent"
ELSE
@7,5 SAY "ERROR: Data not sent " + oClient:lastErrorMessage()
@7, 5 SAY "ERROR: Data not sent " + oClient:lastErrorMessage()
ENDIF
ELSE
IF Empty( cFile )
cData := oClient:Read()
IF ! Empty( cData )
@7,5 SAY "First 80 characters:"
? Trim(SubStr( cData, 1, 80 ))
@7, 5 SAY "First 80 characters:"
? Trim( SubStr( cData, 1, 80 ) )
ELSE
@7,5 SAY "ERROR - file can't be retrieved " + oClient:lastErrorMessage()
@7, 5 SAY "ERROR - file can't be retrieved " + oClient:lastErrorMessage()
ENDIF
ELSE
IF oClient:ReadToFile( cFile )
@7,5 SAY "File "+ cFile + " written."
@8,5 SAY "Server replied " + oClient:cReply
@7, 5 SAY "File " + cFile + " written."
@8, 5 SAY "Server replied " + oClient:cReply
ELSE
@7,5 SAY "Generic error in writing." + cFile
@7, 5 SAY "Generic error in writing." + cFile
ENDIF
ENDIF
ENDIF
@@ -143,27 +144,31 @@ PROCEDURE MAIN( cUrl, cFile )
@22, 5 SAY "Done: " + oClient:cReply
ENDIF
ELSE
@5,5 SAY "Can't open URI " + cUrl
@5, 5 SAY "Can't open URI " + cUrl
IF ! Empty( oClient:cReply )
@6,5 SAY oClient:cReply
@6, 5 SAY oClient:cReply
ENDIF
ENDIF
Terminate()
RETURN
RETURN
PROCEDURE Terminate()
@23,18 SAY "Program done - Press a key to terminate"
@23, 18 SAY "Program done - Press a key to terminate"
Inkey( 0 )
@24,0
@24, 0
QUIT
RETURN
RETURN
PROCEDURE ShowGauge( nSent, nSize )
@6,5 SAY "Sending: " + Replicate( Chr(176), 60 )
// nSent may be zero
@6, 5 SAY "Sending: " + Replicate( Chr( 176 ), 60 )
/* nSent may be zero */
IF nSent > 0
@6,14 SAY Replicate( Chr(219), 60 * nSent/nSize )
@6, 14 SAY Replicate( Chr( 219 ), 60 * nSent/nSize )
ENDIF
RETURN
RETURN

View File

@@ -2,9 +2,10 @@
* $Id$
*/
/* Uploadftp.prg
Send an file or list of files to ftp server
*/
/*
* Uploadftp.prg
* Send an file or list of files to ftp server
*/
#include "common.ch"
#include "directry.ch"
@@ -16,14 +17,14 @@ FUNCTION MAIN( cMask )
lRet := TRP20FTPEnv( cMask )
? lRet
RETURN nil
RETURN nil
/**********************************************************************
*
* Static Function TRP20FTPEnv()
*
**********************************************************************/
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
*+ Static Function TRP20FTPEnv()
*+
*+±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±±
*+
STATIC FUNCTION TRP20FTPEnv( cCarpeta )
LOCAL aFiles
@@ -37,12 +38,12 @@ STATIC FUNCTION TRP20FTPEnv( cCarpeta )
LOCAL cPassword
LOCAL cFile := ""
cServer := "ftpserver" //change ftpserver to the real name or ip of your ftp server
cUser := "ftpuser" // change ftpuser to an valid user on ftpserer
cPassword := "ftppass" // change ftppass to an valid password for ftpuser
cServer := "ftpserver" /* change ftpserver to the real name or ip of your ftp server */
cUser := "ftpuser" /* change ftpuser to an valid user on ftpserer */
cPassword := "ftppass" /* change ftppass to an valid password for ftpuser */
cUrl := "ftp://" + cUser + ":" + cPassword + "@" + cServer
// Leemos ficheros a enviar
/* Leemos ficheros a enviar */
aFiles := Directory( cCarpeta )
IF Len( aFiles ) > 0
@@ -52,7 +53,7 @@ STATIC FUNCTION TRP20FTPEnv( cCarpeta )
oFTP:nConnTimeout := 20000
oFTP:bUsePasv := .T.
// Comprobamos si el usuario contiene una @ para forzar el userid
/* Comprobamos si el usuario contiene una @ para forzar el userid */
IF At( "@", cUser ) > 0
oFTP:oUrl:cServer := cServer
oFTP:oUrl:cUserID := cUser
@@ -60,13 +61,13 @@ STATIC FUNCTION TRP20FTPEnv( cCarpeta )
ENDIF
IF oFTP:Open( cUrl )
FOR each cFile IN afiles
FOR EACH cFile IN afiles
? "arquivo : " + cFile[ F_NAME ]
IF !oFtp:UploadFile( cFile[ F_NAME ] )
lRetorno := .F.
EXIT
ELSE
lRetorno := .t.
lRetorno := .T.
ENDIF
NEXT
@@ -84,4 +85,5 @@ STATIC FUNCTION TRP20FTPEnv( cCarpeta )
lRetorno := .F.
ENDIF
ENDIF
RETURN lRetorno
RETURN lRetorno

View File

@@ -1 +1 @@
4
5

View File

@@ -2,7 +2,12 @@ Source: harbour
Section: devel
Priority: optional
Maintainer: Luis Mayoral <mayoral@linuxadicto.org>
Build-Depends: debhelper (>= 4.0.0), binutils, bash, gcc
Build-Depends: debhelper (>= 4.0.0), libsqlite3-dev, liballegro4.2-dev,
libbz2-dev, libcairo2-dev, libcups2-dev, libexpat1-dev, libfreeimage-dev,
libcurl4-openssl-dev | libcurl4-gnutls-dev, firebird2.0-dev | firebird2.1-dev,
libgd2-noxpm-dev | libgd2-xpm-dev, libmagic-dev, libmysqlclient-dev,
unixodbc-dev, libpq-dev, libqt4-dev, qt4-dev-tools, libssl-dev,
libslang2-dev, libncurses5-dev | libncursesw5-dev, libslang2-dev, libx11-dev
Standards-Version: 3.6.2
Package: harbour
@@ -21,3 +26,13 @@ Description: Compiler for the xBase superset language often referred to as Clipp
is free software. Harbour also attempts to remove some of the limits
imposed by the base implementation but the extent of this will depend on
your chosen platform.
Package: harbour-dbg
Architecture: any
Depends: harbour (=${binary:Version}), ${misc:Depends}
Description: Debugging symbols for Harbour
Harbour is a free software compiler for the xBase superset language
often referred to as Clipper (the language that is implemented by the
compiler CA-Cl*pper).
.
This package contains debugging symbols for the libraries and the utilities.

View File

@@ -4,7 +4,11 @@
# GNU copyright 1997 to 1999 by Joey Hess.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE := 1
export DH_VERBOSE := 1
ifeq ($(DH_VERBOSE),1)
export HB_BUILD_VERBOSE := yes
endif
export HB_INSTALL_PKG_ROOT := $(CURDIR)/debian/harbour
export HB_INSTALL_BIN := $(HB_INSTALL_PKG_ROOT)/usr/bin
@@ -24,6 +28,8 @@ endif
export HB_SYSLOC := yes
export HB_BUILD_PKG := no
export HB_BUILD_SHARED := yes
export HB_BUILD_CONTRIB_DYN := yes
export HB_BUILD_DEBUG := yes
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
export HB_BUILD_OPTIM := no
endif
@@ -33,7 +39,7 @@ build: build-stamp
build-stamp:
dh_testdir
make
$(MAKE)
touch build-stamp
@@ -42,7 +48,7 @@ clean:
dh_testroot
rm -f build-stamp configure-stamp
-make clean
-$(MAKE) clean
dh_clean
@@ -52,7 +58,7 @@ install: build
dh_clean -k
dh_installdirs
make install
$(MAKE) install
# Build architecture-independent files here.
@@ -69,7 +75,7 @@ binary-arch: build install
# dh_install
dh_installman
dh_link
dh_strip
dh_strip --dbg-package=harbour-dbg
dh_compress
dh_fixperms
# dh_makeshlibs