🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Chris Fourroux Fri, 02 Feb 2024 17:51
Re: Web transmission spec
#1
Author: Chris Fourroux
Date: Fri, 02 Feb 2024 17:51
75 lines
3118 bytes
On Monday, September 30, 1996 at 12:00:00 AM UTC-7, Chris Fourroux wrote:
> Jack Kilday wrote:
> >
> > The companion program to which Norman refers is not yet available, but
> And for those of you that can't wait:
> /*
> 9/30/96 -Chris Fourroux (op...@opie.com)
> Utility to extract multiple binary image files
> from one text file of new NCIT "url" type.
> Used Turbo C to compile and test on DOS system.
> I tried to keep this as portable as I could, But I don't claim
> to be a programmer.
> */
> #include <string.h>
> #include <stdio.h>
> #include <stdarg.h>
> int main(int argv,char *argc[])
> {
> FILE *stream,*out;
> char msg[81],*ptr;
> char string[4][80];
> char fn[21];
> unsigned long size=0,l=0;
> int i;
> char buf[2048];
> if (argv<2){
> printf("format \"GETIMAGE FILENAME\"\r\n");
> return 1;
> }
> if ((stream = fopen(argc[1], "r+b"))
> == NULL)
> {
> fprintf(stderr, "Cannot open input file.\n");
> return 1;
> }
> while (!feof(stream)){
> fgets(msg, 80, stream);
> if (!feof(stream)){
> sscanf(msg,"%s %lu", &string[1], &size);
> if (strncmp(string[1],"http",4)!=0){
> printf("Invalid input file\r\n");
> fclose(stream);
> return 1;
> }
> ptr = strrchr(string[1],'/');
> sprintf(fn,"%s",&string[1][ptr-string[1]+1]);
> if ((out=fopen(fn,"w+b"))== NULL){
> fprintf(stderr, "Cannot open %s .\n",fn);
> return 1;
> }
> i=0;
> l=0;
> while (l<size){
> if ((l+2048)<size)
> i=2048;
> else
> i=(size-l);
> fread(buf,1,i,stream);
> fwrite(buf,1, i,out);
> l+=i;
> }
> fclose(out);
> printf("%s\r\n",string[1]);
> printf("%lu Bytes written\r\n",size);
> }
> }
> fclose(stream);
> return 0;
> }


28 years later, near the end of usenet (google will no longer allow new posts to usenet groups as of 2/22/2024)
I do , in fact, now claim to be a programmer.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads