ifconfig.c (77217) | ifconfig.c (77385) |
---|---|
1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; 43#endif 44static const char rcsid[] = | 1/* 2 * Copyright (c) 1983, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 28 unchanged lines hidden (view full) --- 37 The Regents of the University of California. All rights reserved.\n"; 38#endif /* not lint */ 39 40#ifndef lint 41#if 0 42static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94"; 43#endif 44static const char rcsid[] = |
45 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 77217 2001-05-26 09:27:08Z phk $"; | 45 "$FreeBSD: head/sbin/ifconfig/ifconfig.c 77385 2001-05-29 09:13:44Z phk $"; |
46#endif /* not lint */ 47 48#include <sys/param.h> 49#include <sys/ioctl.h> 50#include <sys/socket.h> 51#include <sys/sysctl.h> 52#include <sys/time.h> 53#include <sys/module.h> --- 75 unchanged lines hidden (view full) --- 129int clearaddr; 130int newaddr = 1; 131#ifdef INET6 132static int ip6lifetime; 133#endif 134 135struct afswtch; 136 | 46#endif /* not lint */ 47 48#include <sys/param.h> 49#include <sys/ioctl.h> 50#include <sys/socket.h> 51#include <sys/sysctl.h> 52#include <sys/time.h> 53#include <sys/module.h> --- 75 unchanged lines hidden (view full) --- 129int clearaddr; 130int newaddr = 1; 131#ifdef INET6 132static int ip6lifetime; 133#endif 134 135struct afswtch; 136 |
137int supmedia = 0; 138 |
|
137#ifdef INET6 138char addr_buf[MAXHOSTNAMELEN *2 + 1]; /*for getnameinfo()*/ 139#endif 140 141void Perror __P((const char *cmd)); 142void checkatrange __P((struct sockaddr_at *)); 143int ifconfig __P((int argc, char *const *argv, const struct afswtch *afp)); 144void notealias __P((const char *, int, int, const struct afswtch *afp)); --- 201 unchanged lines hidden (view full) --- 346 347void 348usage() 349{ 350#ifndef INET6 351 fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", 352 "usage: ifconfig interface address_family [address [dest_address]]", 353 " [parameters]", | 139#ifdef INET6 140char addr_buf[MAXHOSTNAMELEN *2 + 1]; /*for getnameinfo()*/ 141#endif 142 143void Perror __P((const char *cmd)); 144void checkatrange __P((struct sockaddr_at *)); 145int ifconfig __P((int argc, char *const *argv, const struct afswtch *afp)); 146void notealias __P((const char *, int, int, const struct afswtch *afp)); --- 201 unchanged lines hidden (view full) --- 348 349void 350usage() 351{ 352#ifndef INET6 353 fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", 354 "usage: ifconfig interface address_family [address [dest_address]]", 355 " [parameters]", |
354 " ifconfig -a [-d] [-u] [address_family]", | 356 " ifconfig -a [-d] [-m] [-u] [address_family]", |
355 " ifconfig -l [-d] [-u] [address_family]", | 357 " ifconfig -l [-d] [-u] [address_family]", |
356 " ifconfig [-d] [-u]"); | 358 " ifconfig [-d] [-m] [-u]"); |
357#else 358 fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", 359 "usage: ifconfig [-L] interface address_family [address [dest_address]]", 360 " [parameters]", | 359#else 360 fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", 361 "usage: ifconfig [-L] interface address_family [address [dest_address]]", 362 " [parameters]", |
361 " ifconfig -a [-L] [-d] [-u] [address_family]", | 363 " ifconfig -a [-L] [-d] [-m] [-u] [address_family]", |
362 " ifconfig -l [-d] [-u] [address_family]", | 364 " ifconfig -l [-d] [-u] [address_family]", |
363 " ifconfig [-L] [-d] [-u]"); | 365 " ifconfig [-L] [-d] [-m] [-u]"); |
364#endif 365 exit(1); 366} 367 368int 369main(argc, argv) 370 int argc; 371 char *const *argv; --- 33 unchanged lines hidden (view full) --- 405 break; 406 case 'd': /* restrict scan to "down" interfaces */ 407 downonly++; 408 break; 409 case 'u': /* restrict scan to "up" interfaces */ 410 uponly++; 411 break; 412 case 'm': /* show media choices in status */ | 366#endif 367 exit(1); 368} 369 370int 371main(argc, argv) 372 int argc; 373 char *const *argv; --- 33 unchanged lines hidden (view full) --- 407 break; 408 case 'd': /* restrict scan to "down" interfaces */ 409 downonly++; 410 break; 411 case 'u': /* restrict scan to "up" interfaces */ 412 uponly++; 413 break; 414 case 'm': /* show media choices in status */ |
413 /* ignored for compatibility */ | 415 supmedia = 1; |
414 break; 415 default: 416 usage(); 417 break; 418 } 419 } 420 argc -= optind; 421 argv += optind; 422 423 /* -l cannot be used with -a or -m */ | 416 break; 417 default: 418 usage(); 419 break; 420 } 421 } 422 argc -= optind; 423 argv += optind; 424 425 /* -l cannot be used with -a or -m */ |
424 if (namesonly && all) | 426 if (namesonly && (all || supmedia)) |
425 usage(); 426 427 /* nonsense.. */ 428 if (uponly && downonly) 429 usage(); 430 431 /* no arguments is equivalent to '-a' */ 432 if (!namesonly && argc < 1) --- 1249 unchanged lines hidden --- | 427 usage(); 428 429 /* nonsense.. */ 430 if (uponly && downonly) 431 usage(); 432 433 /* no arguments is equivalent to '-a' */ 434 if (!namesonly && argc < 1) --- 1249 unchanged lines hidden --- |