1: /*
   2:  * sysconfig -- Program to auto configure a kernel to the devices which
   3:  * are present.  Needs the ucall() system call and special kernel to work.
   4:  *
   5:  * Michael Toy -- Italy 1983
   6:  *
   7:  * added internal, user-level probe facilities,
   8:  * Michael Karels -- Berkeley 1983
   9:  */
  10: 
  11: #include    <stdio.h>
  12: #include    <sys/autoconfig.h>
  13: #include    "args.h"
  14: 
  15: char        *dtab_name = "/etc/dtab";
  16: char        *nlist_name = "/unix";
  17: char        *kmem_name = "/dev/kmem";
  18: int     kmem;
  19: int     verbose;
  20: int     debug;
  21: int     complain;
  22: FILE        *dtab_fp;
  23: FILE        *fopen();
  24: 
  25: main(argc, argv)
  26: int argc;
  27: char **argv;
  28: {
  29:     setbuf(stdout, NULL);
  30: 
  31:     parse_args(argc, argv, "cdvP", "ink");
  32: 
  33:     /* -c -- Complain about bad vectors */
  34:     complain = bools('c');
  35: 
  36:     /* -v -- Verbose output */
  37:     verbose = bools('v');
  38: 
  39:     /* -d -- Debugging run */
  40:     debug = bools('d');
  41: 
  42:     /* -i file -- Read in file instead of "dtab" */
  43:     if (strings('i'))
  44:         dtab_name = strings('i');
  45:     if ((dtab_fp = fopen(dtab_name, "r")) == NULL) {
  46:         perror(dtab_name);
  47:         exit(AC_SETUP);
  48:     }
  49: 
  50:     /* -k file -- use file instead of "/dev/kmem" */
  51:     if (! debug) {
  52:         if (strings('k'))
  53:             kmem_name = strings('k');
  54:         if ((kmem = open(kmem_name, 2)) < 0) {
  55:             perror(kmem_name);
  56:             exit(AC_SETUP);
  57:         }
  58:     }
  59: 
  60:     /* -n file -- Namelist is in file instead of /unix */
  61:     if (strings('n'))
  62:         nlist_name = strings('n');
  63: 
  64:     /* Read the dtab into internal tables so we can play with it */
  65:     read_dtab();
  66: 
  67:     /* Now set up for and call nlist so we can get kernel symbols */
  68:     read_nlist();
  69: 
  70:     /* And at last change the kernel to suit ourselves */
  71:     auto_config();
  72: 
  73:     /* All done go bye bye now */
  74:     exit(AC_OK);
  75: }
  76: 
  77: char *strsave(cp)
  78: {
  79:     return strcpy(malloc(strlen(cp) + 1), cp);
  80: }

Defined functions

main defined in line 25; never used
strsave defined in line 77; used 2 times

Defined variables

complain defined in line 21; used 4 times
dtab_name defined in line 15; used 3 times
kmem defined in line 18; used 7 times
kmem_name defined in line 17; used 3 times
nlist_name defined in line 16; used 6 times
verbose defined in line 19; used 5 times
Last modified: 1983-10-16
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 804
Valid CSS Valid XHTML 1.0 Strict