Exemple #1
0
void main()
{       int n ;

	s:
	clrscr();

	printf("Implementation of doubly linked list :\n\n");
	printf("Select your choice :\n");
	printf("1. Insertion from first :\n") ;
	printf("2. Insertion from last :\n")  ;
	printf("3. Deletion from first :\n");
	printf("4. Deletion from last :\n");
	printf("5. Deletion from middle :\n") ;
	printf("6. Display :\n");
	printf("7. Exit :") ;
	scanf("%d",&n) ;
	switch(n)
	{
	  case 1:	inf();  getch();goto s;
	  case 2:       inl();  getch();goto s;
	  case 3:       delf(); getch();goto s;
	  case 4:       dell(); getch();goto s;
	  case 5:       delm(); getch();goto s;
	  case 6:      	display(); getch(); goto s;
	  case 7:	       break;

	}



    }
Exemple #2
0
int main(int argc, char *argv[]) {
    char buf[NET_BUF];
    int s, len, port;
    char *server_name;

    if(argc != 3) {
        printf("usage: ./myftp <server> <port>\n");
        return 0;
    }
    server_name = argv[1];
    port = atoi(argv[2]);

    s = get_client_socket(argv[1], port);    

    char line[BUF_SIZE];
    help();
    while(1) {
        printf("myftp>>> ");
        read_line(line);

        if (strcmp(line, "DWLD") == 0) {
            dwld(s);
        } else if (strcmp(line, "UPLD") == 0) {
            upld(s);
        } else if (strcmp(line, "LIST") == 0) {
            list(s);
        } else if (strcmp(line, "MDIR") == 0) {
            mdir(s);
        } else if (strcmp(line, "RDIR") == 0) {
            rdir(s);
        } else if (strcmp(line, "CDIR") == 0) {
            cdir(s);
        } else if (strcmp(line, "DELF") == 0) {
            delf(s);
        } else if (strcmp(line, "HELP") == 0) {
            help();
        } else if (strcmp(line, "QUIT") == 0) {
            printf("goodbye\n");
            quit(s);
            close(s);
            break;
        } else {
            printf("Unrecognized command: %s\n", line);
        }
        
    }
    return 0;
}