| | 726 | | | | parsehost(buf, hp) | | | 727 | | | | char *buf; | | | 728 | | | | struct hostd *hp; | | | 729 | | | | { | | | 730 | | | | char *av[10]; | | | 731 | | | | int ac; | | | 732 | | | | int err = 0; | | | 733 | | | | | | | 734 | | | | ac = sizeof(av)/sizeof(av[0]); | | | 735 | | | | if (acav(buf, &ac, av)) { | | | 736 | | | | pvmlogprintf("parsehost(): line too long\n"); | | | 737 | | | | goto bad; | | | 738 | | | | } | | | 739 | | | | if (!ac) | | | 740 | | | | goto bad; | | | 741 | | | | | | | 742 | | | | | | | 743 | | | | | | | 744 | | | | while (--ac > 0) { | | | 745 | | | | if (!strncmp(av[ac], "lo=", 3)) { | | | 746 | | | | if (hp->hd_login) | | | 747 | | | | PVM_FREE(hp->hd_login);
| | | 748 | | | | hp->hd_login = STRALLOC(av[ac] + 3);
| | | 749 | | | | continue; | | | 750 | | | | } | | | 751 | | | | if (!strncmp(av[ac], "dx=", 3)) { | | | 752 | | | | if (hp->hd_dpath) | | | 753 | | | | PVM_FREE(hp->hd_dpath);
| | | 754 | | | | hp->hd_dpath = STRALLOC(av[ac] + 3);
| | | | | | | ... | | | 791 | | | | } | | | 792 | | | | if (!strncmp(av[ac], "id=", 3)) { | | | 793 | | | | if (hp->hd_vmid) | | | 794 | | | | PVM_FREE(hp->hd_vmid);
| | | 795 | | | | hp->hd_vmid = STRALLOC(av[ac] + 3);
| | | 796 | | | | continue; | | | 797 | | | | } | | | 798 | | | | pvmlogprintf("parsehost(): unknown option \"%s\"\n", av[ac]); | | | 799 | | | | err++; | | | 800 | | | | } | | | 801 | | | | if (err) | | | 802 | | | | goto bad; | | | 803 | | | | | | hp <= 4095 | 804 | | | | if (hp->hd_name) |
| | 879 | | pvmlogprintf("readhostfile() %s %d: errors\n", fn, lnum); | | | 880 | | err++; | | | 881 | | goto badline; | | | 882 | | } | | | 883 | | | | | 884 | | | | | 885 | | | | | 886 | | | | | 887 | | | | | 888 | | | | | 889 | | if (!strcmp(hp->hd_name, "*")) { | | | 890 | | if (defaults) | | | 891 | | hd_unref(defaults); | | | 892 | | defaults = hp; | | | 893 | | continue; | | | 894 | | } | | | 895 | | | | | 896 | | | | | 897 | | | | | 898 | | if (defaults) | | | 899 | | applydefaults(hp, defaults); | | | 900 | | | | | 901 | | | | | 902 | | | | | 903 | | if (!(he = gethostbyname(hp->hd_aname ? hp->hd_aname : hp->hd_name))) { | | | 904 | | pvmlogprintf("readhostfile() %s %d: %s: can't gethostbyname\n", | | | 905 | | fn, lnum, hp->hd_name); | | | 906 | | err++; | | | 907 | | goto badline; | | | 908 | | } | | | 909 | | BCOPY(he->h_addr_list[0], (char*)&hp->hd_sad.sin_addr,
| | | 910 | | sizeof(struct in_addr)); | | | 911 | | | | | 912 | | | | | 913 | | | | | 914 | | if (!(hp->hd_flag & HF_OVERLOAD))
| | | 915 | | for (i = num_addrs; i-- > 0; ) { | | | 916 | | if (BCMP((char*)&my_in_addrs[i], (char*)&hp->hd_sad.sin_addr,
| | | 917 | | sizeof(struct in_addr)) == 0) { | | | 918 | | hp->hd_flag |= HF_NOSTART;
| | | 919 | | break; | | | 920 | | } | | | 921 | | } | | | 922 | | | | | 923 | | ht_insert(htp, hp); | | | 924 | | hd_unref(hp); | | | 925 | | continue; | | | 926 | | | | | 927 | | badline: | | | 928 | | hd_unref(hp); |
|