Overview
Comment: | Make utils/ofatalkcfg work on NetBSD |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e27b64556206ef1f83961109c1ca150e |
User & Date: | js on 2023-04-12 06:54:10 |
Other Links: | manifest | tags |
Context
2023-04-12
| ||
07:31 | utils/ofatalkcfg: Recommend "modprobe appletalk" check-in: d6812c8d19 user: js tags: trunk | |
06:54 | Make utils/ofatalkcfg work on NetBSD check-in: e27b645562 user: js tags: trunk | |
2023-04-11
| ||
19:20 | Add utils/ofatalkcfg check-in: 77d211a25a user: js tags: trunk | |
Changes
Modified utils/Makefile from [92a1bc0dd9] to [af0f6dd2b8].
1 | include ../extra.mk | | | 1 2 3 4 5 6 7 8 9 | include ../extra.mk SUBDIRS += ${OBJFW_NEW} \ ${OFARC} \ ${OFATALKCFG} \ ${OFDNS} \ ${OFHASH} \ ${OFHTTP} |
︙ | ︙ |
Modified utils/ofatalkcfg/OFATalkCfg.m from [a520433515] to [af3b7cdc64].
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #ifdef HAVE_NET_IF_H # include <net/if.h> #endif #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif #import "OFApplication.h" #import "OFArray.h" #import "OFOptionsParser.h" #import "OFSocket.h" #import "OFStdIOStream.h" #import "OFInvalidFormatException.h" @interface OFATalkCfg: OFObject <OFApplicationDelegate> @end OF_APPLICATION_DELEGATE(OFATalkCfg) static void configureInterface(OFString *interface, uint16_t network, uint8_t node, uint8_t phase, uint16_t rangeStart, uint16_t rangeEnd) { struct ifreq request = { 0 }; struct sockaddr_at *sat; struct atalk_netrange *nr; int sock; if (interface.UTF8StringLength > IFNAMSIZ) { [OFStdErr writeFormat: @"%@: Interface name too long!\n", [OFApplication programName]]; [OFApplication terminateWithStatus: 1]; } strncpy(request.ifr_name, interface.UTF8String, IFNAMSIZ); sat = (struct sockaddr_at *)&request.ifr_addr; sat->sat_family = AF_APPLETALK; sat->sat_net = OFToBigEndian16(network); sat->sat_node = node; | > > > > > | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | #ifdef HAVE_NET_IF_H # include <net/if.h> #endif #ifdef HAVE_SYS_IOCTL_H # include <sys/ioctl.h> #endif #include "unistd.h" #import "OFApplication.h" #import "OFArray.h" #import "OFOptionsParser.h" #import "OFSocket.h" #import "OFStdIOStream.h" #import "OFInvalidFormatException.h" @interface OFATalkCfg: OFObject <OFApplicationDelegate> @end OF_APPLICATION_DELEGATE(OFATalkCfg) static void configureInterface(OFString *interface, uint16_t network, uint8_t node, uint8_t phase, uint16_t rangeStart, uint16_t rangeEnd) { struct ifreq request = { 0 }; struct sockaddr_at *sat; #ifdef OF_LINUX struct atalk_netrange *nr; #else struct netrange *nr; #endif int sock; if (interface.UTF8StringLength > IFNAMSIZ) { [OFStdErr writeFormat: @"%@: Interface name too long!\n", [OFApplication programName]]; [OFApplication terminateWithStatus: 1]; } strncpy(request.ifr_name, interface.UTF8String, IFNAMSIZ); sat = (struct sockaddr_at *)&request.ifr_addr; sat->sat_family = AF_APPLETALK; sat->sat_net = OFToBigEndian16(network); sat->sat_node = node; nr = (__typeof__(nr))(void *)sat->sat_zero; nr->nr_phase = phase; nr->nr_firstnet = OFToBigEndian16(rangeStart); nr->nr_lastnet = OFToBigEndian16(rangeEnd); if ((sock = socket(AF_APPLETALK, SOCK_DGRAM, 0)) < 0) { [OFStdErr writeFormat: @"%@: Failed to create socket: %@\n", [OFApplication programName], |
︙ | ︙ | |||
137 138 139 140 141 142 143 | [OFStdErr writeFormat: @"%@: More than one interface " @"specified!\n", [OFApplication programName]]; [OFApplication terminateWithStatus: 1]; } if (networkString == nil) { | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | [OFStdErr writeFormat: @"%@: More than one interface " @"specified!\n", [OFApplication programName]]; [OFApplication terminateWithStatus: 1]; } if (networkString == nil) { [OFStdErr writeFormat: @"%@: --network not specified!\n", [OFApplication programName]]; [OFApplication terminateWithStatus: 1]; } @try { network = [networkString unsignedLongLongValueWithBase: 0]; } @catch (OFInvalidFormatException *e) { [OFStdErr writeFormat: @"%@: Invalid format for --network!\n", |
︙ | ︙ |