|
Lines 5-10
Link Here
|
| 5 |
* mms://193.159.244.12/n24_wmt_mid |
5 |
* mms://193.159.244.12/n24_wmt_mid |
| 6 |
*/ |
6 |
*/ |
| 7 |
|
7 |
|
|
|
8 |
#define HELPINFO "Usage: mmsclient mms://<url>\n -v --version\n\tPrint version information\n -h --help\n\tPrint this page\nhttp://www.geocities.com/majormms/\n" |
| 9 |
|
| 10 |
|
| 8 |
#include <unistd.h> |
11 |
#include <unistd.h> |
| 9 |
#include <stdio.h> |
12 |
#include <stdio.h> |
| 10 |
#include <assert.h> |
13 |
#include <assert.h> |
|
Lines 475-497
Link Here
|
| 475 |
char *path, *url, *file, *cp; |
478 |
char *path, *url, *file, *cp; |
| 476 |
|
479 |
|
| 477 |
if (argc != 2) { |
480 |
if (argc != 2) { |
| 478 |
printf ("usage: %s url\n", argv[0]); |
481 |
printf ("Usage: %s URL\n", argv[0]); |
| 479 |
exit(1); |
482 |
exit(1); |
| 480 |
} |
483 |
} |
| 481 |
|
484 |
|
|
|
485 |
/* check for non-url arguments (version or help ...) */ |
| 486 |
if (strncmp(argv[1], "mms://", 6) == 0 && argv[1][6] == 0){ /* Just typed "mms://" with no URL */ |
| 487 |
printf("Error: No URL\n"); |
| 488 |
exit(1); |
| 489 |
} |
| 490 |
if (strncmp(argv[1], "mms://", 6) != 0){ /* haven't typed a url */ |
| 491 |
|
| 492 |
if (strncmp(argv[1], "--version", 9) == 0 || strncmp(argv[1], "-v", 9) == 0){ |
| 493 |
printf("%s\n", VERSION); |
| 494 |
}else if (strncmp(argv[1], "--help", 9) == 0 || strncmp(argv[1], "-h", 9) == 0){ |
| 495 |
printf("%s\n", HELPINFO); |
| 496 |
}else{ |
| 497 |
printf("Error: unrecognized command %s\n", argv[1]); |
| 498 |
} |
| 499 |
exit(1); |
| 500 |
} |
| 501 |
|
| 482 |
/* parse url */ |
502 |
/* parse url */ |
| 483 |
|
503 |
|
| 484 |
url = argv[1]; |
504 |
url = argv[1]; |
| 485 |
strncpy (host, &url[6], 255); |
505 |
strncpy (host, &url[6], 255); |
| 486 |
cp = strchr(host,'/'); |
506 |
cp = strchr(host,'/'); |
| 487 |
*cp= 0; |
507 |
if(cp == 0){ /* If they just typed a top level domain name */ |
|
|
508 |
printf("Error: Incomplete URL '%s'\n", &url[6]); |
| 509 |
exit(1); |
| 510 |
} |
| 511 |
*cp= 0; /* Make the '/' a null */ |
| 488 |
|
512 |
|
| 489 |
printf ("host : >%s<\n", host); |
513 |
printf ("host : >%s<\n", host); |
| 490 |
|
514 |
|
| 491 |
path = strchr(&url[6], '/') +1; |
515 |
path = strchr(&url[6], '/') +1; |
| 492 |
|
516 |
|
| 493 |
printf ("path : >%s<\n", path); |
517 |
printf ("path : >%s<\n", path); |
| 494 |
|
518 |
|
| 495 |
file = strrchr (url, '/'); |
519 |
file = strrchr (url, '/'); |
| 496 |
|
520 |
|
| 497 |
printf ("file : >%s<\n", file); |
521 |
printf ("file : >%s<\n", file); |