# 2.11BSD#431 - /usr/src/sys/autoconfig/main.c

##### Functions

    main              X

##### Variables

    kmem              X
    nlist_name        X
    verbose           X

       1: /*
       2:  * Copyright (c) 1986 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  *
       6:  *	@(#)main.c	1.1 (2.10BSD Berkeley) 12/1/86
       7:  */
       8:
       9: /*
      10:  * sysconfig -- Program to auto configure a kernel to the devices which
      11:  * are present.  Needs the ucall() system call and special kernel to work.
      12:  */
      13:
      14: #include <machine/autoconfig.h>
      15: #include <stdio.h>
      16:
      17: char    *nlist_name = "/unix",      /* kernel */
      18:     *dtab_name = "/etc/dtab",   /* dtab file */
      19:     *myname;            /* program name */
      20: int kmem,
      21:     verbose = NO,
      22:     debug = NO,
      23:     complain = NO,
      24:     pflag = NO;
      25:
      26: main(argc,argv)
      27: int argc;
      28: char    **argv;
      29: {
      30:     extern char *optarg;
      31:     static char *kmem_name = "/dev/kmem";
      32:     int c;
      33:     char    *C,
      34:         *rindex();
      35:
      36:     setbuf(stdout, NULL);
      37:     myname = (C = rindex(*argv,'/')) ? ++C : *argv;
      38:     while((c = getopt(argc,argv,"Pcdi:k:n:v")) != EOF)
      39:         switch((char)c) {
      40:             case 'P':   /* pflag, ask Mike */
      41:                 pflag = YES;
      42:                 break;
      43:             case 'c':   /* complain about bad vectors */
      44:                 complain = YES;
      45:                 break;
      46:             case 'd':   /* debugging run */
      47:                 debug = YES;
      48:                 break;
      49:             case 'i':   /* not dtab, different file */
      50:                 dtab_name = optarg;
      51:                 break;
      52:             case 'k':   /* not /dev/kmem, different file */
      53:                 kmem_name = optarg;
      54:                 break;
      55:             case 'n':   /* not /unix, different file */
      56:                 nlist_name = optarg;
      57:                 break;
      58:             case 'v':   /* verbose output */
      59:                 verbose = YES;
      60:                 break;
      61:             default:
      62:                 fputs("usage: ",stderr);
      63:                 fputs(myname,stderr);
      64:                 fputs(" [-c] [-d] [-v] [-i file] [-k file] [-n file]\n",stderr);
      65:                 exit(AC_SETUP);
      66:         }
      67:
      68:     if ((kmem = open(kmem_name, 2)) < 0) {
      69:         perror(kmem_name);
      70:         exit(AC_SETUP);
      71:     }
      72:
      73:     /* Read the dtab into internal tables so we can play with it */
      74:     read_dtab();
      75:
      76:     /* Now set up for and call nlist so we can get kernel symbols */
      77:     read_nlist();
      78:
      79:     /* And at last change the kernel to suit ourselves */
      80:     auto_config();
      81:
      82:     /* All done go bye bye now */
      83:     exit(AC_OK);
      84: }

#### Defined functions

main defined in line 26; never used

#### Defined variables

kmem defined in line 20; used 7 times

- in line 68
- in /usr/src/sys/autoconfig/do_config.c line 34-35(2), 50-51(2)
- in /usr/src/sys/autoconfig/read_nlist.c line 116-117(2)

nlist_name defined in line 17; used 6 times

- in line 56
- in /usr/src/sys/autoconfig/read_nlist.c line 86-90(3), 96, 120

verbose defined in line 21; used 5 times

- in line 59
- in /usr/src/sys/autoconfig/do_config.c line 101, 112, 129, 137

Last modified: 1987-02-27 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 580 |