Note: "permalinks" may not be as permanent as we would like,
direct links of old sources may well be a few messages off.
On Wed, 2004-04-28 at 13:54, Lars Ellenberg wrote: > > >>Why not use 'which' to check if 'ip' is installed, and then if > > >>'ifconfig' is installed... as a side benefit this approach also caters > > >>for non-standard installation locations. Eg. > > > > > > > > >everyone happy with this? > > > > > > > please use `type -p' not `which'. `type' is a builtin while `which' > > on my system is a shell script. > > $ type -a which > which is aliased to `type -p' > which is /usr/bin/which > > :) 'type' and 'which' are apparently "cross-hacks" of csh/posix sh/BSD. BTW as long as the project is Linux only, you might look at this: /usr/include/ifaddrs.h: ... /* The `getifaddrs' function generates a linked list of these structures. Each element of the list describes one network interface. */ struct ifaddrs { struct ifaddrs *ifa_next; /* Pointer to the next structure. */ char *ifa_name; /* Name of this network interface. */ unsigned int ifa_flags; /* Flags as from SIOCGIFFLAGS ioctl. */ struct sockaddr *ifa_addr; /* Network address of this interface. */ struct sockaddr *ifa_netmask; /* Netmask of this interface. */ ... } /* Create a linked list of `struct ifaddrs' structures, one for each network interface on the host machine. If successful, store the list in *IFAP and return 0. On errors, return -1 and set `errno'. The storage returned in *IFAP is allocated dynamically and can only be properly freed by passing it to `freeifaddrs'. */ extern int getifaddrs (struct ifaddrs **__ifap) __THROW; /* Reclaim the storage allocated by a previous `getifaddrs' call. */ extern void freeifaddrs (struct ifaddrs *__ifa) __THROW; -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.linbit.com/pipermail/drbd-user/attachments/20040428/16d6edcb/attachment.pgp>