home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.sys.sun.misc:5855 alt.sources:2787
- Path: sparky!uunet!usc!sdd.hp.com!cs.utexas.edu!sun-barr!olivea!spool.mu.edu!umn.edu!lynx!nmsu.edu!opus!emoreno
- From: emoreno@scheria.NMSU.Edu (Elena M. Castruita)
- Newsgroups: comp.sys.sun.misc,alt.sources
- Subject: Re: Automated FTP?
- Message-ID: <EMORENO.92Dec15101907@scheria.NMSU.Edu>
- Date: 15 Dec 92 17:19:07 GMT
- References: <1992Dec8.220145.5713@spang.Camosun.BC.CA>
- <NICKEL.92Dec9200738@desaster.cs.tu-berlin.de>
- <1g7shpINN9pa@atlpyr.ga.pyramid.com>
- <1992Dec11.194130.14879@elroy.jpl.nasa.gov>
- <1992Dec14.020745.15321@maths.tcd.ie>
- Sender: usenet@nmsu.edu
- Organization: New Mexico State University, Department of Computer Science
- Lines: 66
- In-Reply-To: tim@maths.tcd.ie's message of Mon, 14 Dec 1992 02:07:45 GMT
-
-
-
- Try using the .netrc file a little more. For example (using the
- previous example from tim@maths.tcd.ie (Timothy Murphy)):
- -----------------------------.netrc------------------------------------
- machine mac.archive.umich.edu login anonymous password tim@maths.tcd.ie
-
- machine ftp.apple.com login anonymous password tim@maths.tcd.ie
- macdef init
- cd mac/game/arcade
- get bricklesplus2.0.sit.hqx
- get brickwell.sit.hqx
- quit
-
-
- --------------------------------------end----------------------------------
-
-
- When you ftp to ftp.apple.com, init ( the macro defined by macdef init )
- is automatically run. No need for extra files.
-
- Also, here is a little program to help ftp'ing...
-
-
- ___________________________________cut here________________________________
- #include <stdio.h>
- #define BUF_SIZE 255
- #define LINES 20
- main(){
-
- char a, line[LINES][BUF_SIZE];
- int i,choice;
- FILE *pipe;
- char *home=(char *)getenv("HOME");
- char *command1="grep machine ";
- char *command2="/.netrc|cut -d\" \" -f2";
- char command[BUF_SIZE];
-
- (void)strcat(command,command1);
- (void)strcat(command,home);
- (void)strcat(command,command2);
-
- if((pipe=popen(command, "r")) == NULL){
- printf("Error opening pipe.\n");
- exit(0);
- }
-
- for(i=0;i < LINES && fgets(line[i],BUF_SIZE,pipe) != NULL;i++) {
- line[i][strlen(line[i])-1]='\0';
- printf("%2d...%s\n",i+1,line[i]);
- }
- do{
- printf("\nEnter your choice: ");
- scanf("%d",&choice);
- }while ( choice - 1 < 0 || choice > i );
-
- execl("/usr/ucb/ftp","ftp","-i",line[choice-1],(char *)NULL);
- }
-
-
- ________________________________CUT HERE_________________________________
- --
-
- "I know what I want out of life.
- I just don't know what I want to put into it."
- Copyright @ 1991, Fitzgerald Enterprizes
-