Skip site navigation (1)Skip section navigation (2)
Date:      28 May 1999 13:40:45 +0200
From:      Dag-Erling Smorgrav <des@flood.ping.uio.no>
To:        Brian Somers <brian@Awfulhak.org>
Cc:        Dag-Erling Smorgrav <des@flood.ping.uio.no>, Sheldon Hearn <sheldonh@uunet.co.za>, hackers@freebsd.org
Subject:   Re: fetch(1) / fetch(3) patchkit available
Message-ID:  <xzpr9o1o20y.fsf@localhost.ping.uio.no>
In-Reply-To: Brian Somers's message of "Fri, 28 May 1999 11:27:20 %2B0100"
References:  <199905281027.LAA03381@keep.lan.Awfulhak.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Brian Somers <brian@Awfulhak.org> writes:
> What about a non-interactive command for pushing stuff via ftp/http ? 
> This has always been lacking IMHO (``ftp -n <<EOF'' is full of 
> gotchas).
> 
> I haven't actually looked at libfetch, but I would think that the 
> functionality should be there.

Libfetch supports FTP uploads (no HTTP uploads yet, I'm afraid, but
it's on the todo-list). It should be trivial to write a small app
which uploads stdin to a specified URL. The following should work
(modulo error checking):

#include <stdio.h>
#include <fetch.h>

int
main(int argc, char *argv[])
{
    FILE *f;
    int c;

    f = fetchPutURL(argv[1], NULL);
    while ((c = fgetc(stdin)) != EOF)
        fputc(c, f);

    return 0;
}

Needless to say, this works with file: URLs as well.

DES
-- 
Dag-Erling Smorgrav - des@flood.ping.uio.no


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpr9o1o20y.fsf>