#!/bin/sh -
#       @(#) $Id: hosttype,v 2.14 1998/06/18 12:01:38 granboul Rel $
#       Louis Granboulan
######################################################################
export PATH
PATH=/usr/local/bin:/usr/ucb:/bin:/usr/bin:/usr/5bin:\
/etc:/usr/etc:/usr/lib:/sbin:\
/usr/lang:/usr/local/lang/bin:/usr/local/SUNWspro/bin
trap 'rm -f $files' 0
trap 'exit 0' 2
z=/dev/null
#######################################
## Format du resultat
# a. informations generales (communes)
#    type de binaires
#    nom de machine et domaine
# b. microprocesseurs
#    famille, type, nom, cacteristiques
#    frequence
#    memoire
# c. architecture, systeme d'exploitation
#######################################
# Les noms de variables en minuscules correspondent a des donnees
# fournies par le systeme.
# Les autres sont les variables utilisees par ce programme.
#######################################
## Plan du fichier
## 1. Analyse des arguments
## 2. Detection des sh version 7
## 3. Informations de base
## 4. Fabrication du CODE et de CPUFAM
## 5. Recuperation d'informations specifiques
## 6. Description du cpu
## 7. Frequence de l'unite centrale
## 8. Operating System
## 9. Ecran
## 10. Lecteur de CD-ROM/floppy
## 11. Disque/Swap
## 12. Boot Prom/Bios
## 13. Description de l'architecture
#######################################
## 1. Analyse des arguments
test "x$1" = x-h && cat<<EOH
Usage: hosttype [option]
       -h: this help
       -v: verbose
       -a: very verbose
EOH
test "x$1" = x-v && verbose=yep
test "x$1" = x-a && verbose=all
#######################################
## 2. Detection des sh version 7
if /bin/sh -c 'test -x /bin/sh' 2>&-; then x=-x; else x=-f; fi
## Comment faire un echo sans retour a la ligne...
if (echo "testing\c"; echo 1,2,3)| grep c>$z; then
  if (echo -n testing; echo 1,2,3)| sed s/-n/xn/| grep xn>$z; then n= c='
'
  else n=-n c=
  fi
else n= c='\c'
fi
#######################################
## 3. Informations de base
# Machine name
#         domain
# System binary
#        filetype
ma="`(uname -m) 2>&-`"
os="`(uname -s) 2>&-`"
osvers=`(uname -r) 2>&-`
hostname=`hostname`
domainname=`domainname`
ypdomain=`(ypwhich) 2>&-`

if test -z "$BINARY" -o "$BINARY" = UNKNOWN; then
  if test $x $HOME/exe/binary; then
    BINARY=`$HOME/exe/binary`; fi; fi
PATH=$HOME/bin/$BINARY:$PATH

for exec in /bin/sh /bin/cat; do
  EXECTYPE="`(file $exec | sed \
    -e 's,'$exec':[ 	]*,,' \
    -e 's/[ ,]*sharedlibrary=[a-z./]*//' \
    -e 's/[ ,]*sharedlibraryversion=[0-9]*//' \
    -e 's/[ ,]*stripped//' \
    -e 's/[ ,]*demand paged//' \
    -e 's/[ ,]*shared//' \
    -e 's/[ ,]*dynamically linked//' \
    -e 's/[ ,]*or object module//' \
    -e 's/[ ,]*executable//') 2>&-`"
  case "$EXECTYPE" in *'symbolic link'*) ;; *) break ;; esac
done

if test -r /etc/resolv.conf; then
  dnplus=`sed -n 's/^domain[ 	]*\(.*\)/\1/p' /etc/resolv.conf`
  if test -n "$dnplus"; then domainname="$domainname [$dnplus]"; fi
fi

echo "Machine name .......... $hostname"
test -n "$domainname" && echo "        domain ........ $domainname"
test -n "$ypdomain"   && echo "        yp pages ...... $ypdomain"
echo "System binary ......... $BINARY"
echo "       filetype ....... $EXECTYPE"

#######################################
## 4. Fabrication du CODE et de CPUFAM
# Traitement general
case "$os-$ma" in
  SunOS-*)            CODE=sun      ; CPUFAM=$ma ;;
  OSF1-alpha)         CODE=dec      ; CPUFAM=alpha ;;
  ULTRIX-RISC)        CODE=dec      ; CPUFAM=mips ;;
  ULTRIX*-VAX)        CODE=dec      ; CPUFAM=vax ;;
 #HP-UX-9000/5??)     CODE=hp       ; CPUFAM=hp9000 ;;
 #HP-UX-9000/2??)     CODE=hp       ; CPUFAM=m68k+hp98x6 ;;
  HP-UX-9000/[34]??)  CODE=hp       ; CPUFAM=m68k ;;
  HP-UX-9000/[678]??) CODE=hp       ; CPUFAM=hppa ;;
  IRIX-*)             CODE=sgi      ; CPUFAM=mips ;;
 #AIX-i[34]86)        CODE=ibm      ; CPUFAM=ix86 ;;
  AIX-*)              CODE=rs6000   ; CPUFAM=m98k ;; # IBM
 #BOSX-*)             CODE=rs6000   ; CPUFAM=m98k ;; # Bull
  Linux-i?86)         CODE=linux    ; CPUFAM=ix86 ;;
  Linux-*)            CODE=linux    ; CPUFAM=$ma ;;
  *-NeXT*)            CODE=next     ;;
  N[Ee]XTSTEP-*)      CODE=next     ;;
  FreeBSD-i?86)       CODE=freebsd  ; CPUFAM=ix86 ;;
  FreeBSD-*)          CODE=freebsd  ; CPUFAM=$ma ;;
  NetBSD-pmax)        CODE=netbsd   ; CPUFAM=mips ;;
  NetBSD-*)           CODE=netbsd   ; CPUFAM=$ma ;;
 #RISCos-mips)        CODE=riscos   ; CPUFAM=mips ;;
 #R[34]-m88k)         CODE=motorola ; CPUFAM=m88k ;;
  *) case "$EXECTYPE" in
  *Alliant*)          CODE=alliant  ;;
  *Mach*)             CODE=next     ; os=Mach ;;
  *)                  CODE=unknown  ;;
  esac ;;
esac

cc=cc; (gcc -v) 2>&- && cc=gcc
# Cas particuliers
case "$CODE" in
  sun)
    if test "$ma" = sun; then ma=`arch -k`; fi
    case "$ma" in
      sun386)    CPUFAM=ix86 ;;
      sun3*)     CPUFAM=m68k ;;
      sun4*)     CPUFAM=sparc ;;
      *)         CPUFAM=$ma ;;
    esac ;;
  alliant)
    machine=`arch`
    case "$machine" in
    fx2800)      CPUFAM=ix60 ;;
    esac
    ;;
  next)
    cc=cc
    /bin/rm -f /tmp/machine; files="$files /tmp/machine"
    /bin/ln -s /usr/bin/arch /tmp/machine; machine=`/tmp/machine`
    if test "$machine" = next; then
      files="$files /tmp/arch.$$.c /tmp/arch.$$"
      cat<<______EOF>/tmp/arch.$$.c
      #include <mach-o/arch.h>
      main() { printf("%s\n",NXGetLocalArchInfo()->name); }
______EOF
      (cd /tmp; $cc /tmp/arch.$$.c -o /tmp/arch.$$)
      machine=`/tmp/arch.$$`
      if test -z "$machine"; then
      case "$EXECTYPE" in
        *"(for architecture "*")")
        machine=`file /bin/sh | sed 's/.*(for architecture \(.*\))/\1/'` ;;
        *) machine=unknown ;;
      esac
      fi
    fi
    # cf. /usr/include/mach/machine.h
    case "$machine" in
    vax)         CPUFAM=vax ;;
    romp) ;;
    ns32?32) ;;
    m68k|m680?0) CPUFAM=m68k ;;
    i?86*)       CPUFAM=ix86 ;;
    mips)        CPUFAM=mips ;;
    hppa*)       CPUFAM=hppa ;;
    arm) ;; # Acorn Risc Machine
    m88k)        CPUFAM=m88k ;;
    m98k|rs6000) CPUFAM=m98k ;;
    sparc)       CPUFAM=sparc ;;
    i860)        CPUFAM=ix60 ;;
    esac
    if test ! -d /NextApps; then
      echo '       *** Warning: no directory /NextApps ***' 1>&2; fi
    ;;
esac

# Verification de la famille de CPU
# cf. http://www.ee.siue.edu/~mvinant/g_info/cpu_hist.htm
case "$CPUFAM" in
  vax|mips|alpha) ;; # Dec + autres
  m68k|m88k|m98k) ;; # Motorola + autres
  ix86|ix60) ;;      # Intel
  sparc|hppa) ;;     # divers
  *) echo '       *** Unknown cpu family ``'"$CPUFAM'' ***" >&2;
     CPUFAM=unknown ;;
esac
echo "       codename ....... $CODE-$CPUFAM"
echo

#######################################
## 5. Recuperation d'informations specifiques

case "$CODE-$CPUFAM" in
# -------------------------------------
#   prtconf/devinfo
  sun-sparc)
    # Existence de prtconf ou devinfo
    if test $x /etc/prtconf; then
      prtconf=/etc/prtconf
      confprog=prtconf
    elif test $x /usr/etc/devinfo; then
      prtconf=/usr/etc/devinfo
      confprog=devinfo
    fi
    if test -n "$prtconf"; then
      conf=/tmp/prtconf.$$
      files="$files $conf";
      $prtconf -v 2>&- > $conf
      if test ! -s "$conf"; then prtconf= ; fi
    fi
    if test -n "$prtconf"; then
      # awk n'aime pas les lignes trop longues.
      # cut non plus (sous SunOS 4 au moins)
      conf_pv=/tmp/prtconf_pv.$$
      files="$files $conf_pv"; $prtconf -pv 2>&- > $conf_pv;
      if awk '{}' < $conf_pv >&- 2>&-; then :; else
      cut -c1-2559 <$conf_pv>${conf_pv}.0; /bin/mv -f ${conf_pv}.0 $conf_pv
      fi
    fi
    if test -n "$prtconf" -a  -s "$conf_pv"; then
      # creation de quelques variables, decoulant de l'analyse de $conf_pv
      globalinfo=/tmp/globalinfo.$$
      files="$files $globalinfo"
      cat<<'EOF'>$globalinfo; chmod +x $globalinfo
#!/bin/awk -f
          BEGIN { ncpu = 0; ndpy = 0 }
          $1 == "Node" {
            if (idprom != "") { sysfreq = freq; sysname = name }
            if (type == "'cpu'") { ncpu++; cpuname = name; cpufreq = freq;
              cpuver = version }
            if (type == "'display'") { ndpy++; dpytype = name;
              dpywd = width; dpyht = height; }
            if (name == "'memory'") { memory = mem }
            name = ""; freq = ""; type = "" ; idprom = ""; mem = ""
            version = 0
          }
          $1 != "Node" {
            value = $2; hexval = ""
            for (i = 3; i <= NF; i++) value = value " " $i
            for (i = 1; i <= length ($2); i++) {
              c = substr ($2, i, 1);
              if (c == "a") hexval = hexval "A";
              else if (c == "b") hexval = hexval "B";
              else if (c == "c") hexval = hexval "C";
              else if (c == "d") hexval = hexval "D";
              else if (c == "e") hexval = hexval "E";
              else if (c == "f") hexval = hexval "F";
              else if ((c != "0")||(hexval != ""))
                                 hexval = hexval c;
            }
            if ("" == hexval)             { hexval = 0 }
            if ($1 == "name:")            { name = value }
            if ($1 == "banner-name:")     { bannername = value }
            if ($1 == "idprom:")          { idprom = $2 }
            if ($1 == "device_type:")     { type = $2 }
            if ($1 == "device-type:")     { type = $2 }
            if ($1 == "version:")         { version = hexval }
            if ($1 == "sparc-version:")   { sparcv = hexval }
            if ($1 == "clock-frequency:") { freq = hexval }
            if ($1 == "width:")           { width = hexval }
            if ($1 == "height:")          { height = hexval }
            if ($1 == "reg:") {
              count = 0
              mem = "0"
              for (i = 1; i <= length ($2); i++) {
                c = substr ($2, i, 1);
                if (c == ".") {
                  if (count == 2) { mem = mem " " number " +"; count = -1 }
                  count++; number = ""
                }
                else number = number c;
              }
              mem = mem " " number " +"
            }
          }
          END {
            if (ncpu == 0) { ncpu = 1 }
            if (ndpy == 0) { dpytype = "'no screen'" }
            if (sysfreq == "") { sysfreq = 0 }
            if (cpufreq == "") { cpufreq = 0 }
            if (sparcv  == "") { sparcv  = 0 }
            print "sysname=\""    sysname "\""
            print "ncpu=\""       ncpu "\""
            print "cpuname=\""    cpuname "\""
            print "sysfreq=\""    sysfreq "\""
            print "cpufreq=\""    cpufreq "\""
            print "sparcv=\""     sparcv "\""
            print "cpuver=\""     cpuver "\""
            print "ndpy=\""       ndpy "\""
            print "dpytype=\""    dpytype "\""
            print "dpywd=\""      dpywd "\""
            print "dpyht=\""      dpyht "\""
            print "memoryhex=\""  memory "\""
            print "bannername=\"" bannername "\""
          }
EOF
      echo Node >> $conf_pv
      eval `$globalinfo $conf_pv`
      # Hex to decimal
      dpywd=`echo "16 i $dpywd p q" | dc`
      dpyht=`echo "16 i $dpyht p q" | dc`
      # Convert clock frequency from Hex Hz to Decimal MHz
      SYSFREQ=`echo "16 i 1 k $sysfreq F4240 / p q" | dc`
      if test "$cpufreq" -ne 0; then
        CPUFREQ=`echo "16 i 1 k $cpufreq F4240 / p q" | dc`
        if test $SYSFREQ -gt $CPUFREQ; then
          SYSFREQ=`echo "$CPUFREQ 0 k 1 / 1 k 1.0 * p q" | dc`
          echo 'Warning: SYSFREQ > CPUFREQ' 1>&2
        fi
      fi
      # Taille des caches
      eval `sed -n \
        -e 's/.*\([edi]\)cache-\(....\)[-a-z]*:  \(.*\)/\1\2=\3/p' \
        $conf_pv | tr a-z A-Z`
      eval `sed -n \
        -e 's/.* cache-\(....\)[-a-z]*:  \(.*\)/x\1=\2/p' \
        $conf_pv | tr a-z A-Z`
      # Cache unique
      if test -n "$XASSO"; then
        test -z "$XSIZE" && XSIZE="$XNLIN $XLINE *"
        eval `echo "16 i $XSIZE 400 / [XSIZE=] Pp
                         $XLINE [XLINE=] Pp
                         $XASSO [XASSO=] Pp" | dc`
      fi
      # Cache externe
      if test -n "$ELINE"; then
        test -z "$ESIZE" && ESIZE="$ENLIN $ELINE *"
        eval `echo "16 i $ESIZE 400 / [ESIZE=] Pp
                         $ELINE [ELINE=] Pp
                         $EASSO [EASSO=] Pp" | dc`
      fi
      # Cache donnees
      if test -n "$DLINE"; then
        test -z "$DSIZE" && DSIZE="$DNLIN $DLINE *"
        eval `echo "16 i $DSIZE 400 / [DSIZE=] Pp
                         $DLINE [DLINE=] Pp
                         $DASSO [DASSO=] Pp" | dc`
      fi
      # Cache instructions
      if test -n "$ILINE"; then
        test -z "$ISIZE" && ISIZE="$INLIN $ILINE *"
        eval `echo "16 i $ISIZE 400 / [ISIZE=] Pp
                         $ILINE [ILINE=] Pp
                         $IASSO [IASSO=] Pp" | dc`
      fi
    fi
    if test -n "$prtconf" -a ! -s "$conf_pv"; then
      # les memes variables, decoulant de l'analyse de $conf
      sysname=`sed -n 's/.*\(SUNW,S[^,'\'']*\).*/\1/p' $conf`
      if test -n "$sysname"; then sysname="'$sysname'"; fi
      ncpu=`egrep 'TI,|FMI,|SUNW,UltraSPARC' $conf | awk 'END{print NR}'`
      for proc in TI,TMS390Z50 TI,TMS390Z55 TI,TMS390S10 \
                  FMI,MB86904 FMI,MB86907 \
        SUNW,UltraSPARC; do
        if egrep -s $proc $conf>&-;then cpuname="'"$proc"'"; break; fi
      done
      for disp in bwtwo cgthree cgsix SUNW,tcx SUNW,ffb; do
        if egrep -s $disp $conf>&-;then dpytype="'"$disp"'"; break; fi
      done
      globalinfo=/tmp/globalinfo.$$
      files="$files $globalinfo"
      cat<<'______EOF'>$globalinfo; chmod +x $globalinfo
#n
          /Node 'memory'/!b
          i\
0
          :a
          n
          /Node /b
          s/.*Size=\(.*\)/\1 +/p
          ba
______EOF
      memoryhex=`sed -n -f $globalinfo $conf | tr '\012' ' '`
    fi
    ;;
# -------------------------------------
#   sysinfo
  dec-alpha)
    cc='cc -O0'
    files="$files /tmp/getsysinfo.$$.c /tmp/getsysinfo.$$"
    cat<<____EOF>/tmp/getsysinfo.$$.c
#include <sys/sysinfo.h>
#include <machine/hal_sysinfo.h>
    main() { int ret;
    int bufint; char bufstr[1024]; int bufval[128];
    ret = getsysinfo(GSI_CPU        , &bufint,sizeof(int));
    if(ret>0)printf   ("gsi_cpu=%d\n",bufint);
    ret = getsysinfo(GSI_CPUS_IN_BOX, &bufint,sizeof(int));
    if(ret>0)printf   ("gsi_cpus_in_box=%d\n",bufint);
    ret = getsysinfo(GSI_PHYSMEM    , &bufint,sizeof(int));
    if(ret>0)printf   ("gsi_physmem=%d\n",(bufint+512)/1024);
    ret = getsysinfo(GSI_WSD_TYPE   , &bufint,sizeof(int));
    if(ret>0)printf   ("gsi_wsd_type=%d\n",bufint & 0xff);
#ifdef GSI_PLATFORM_NAME
    ret = getsysinfo(GSI_PLATFORM_NAME   , bufstr,1024);
    if(ret>0)printf   ("gsi_platform_name='%s'\n",bufstr);
#endif
#ifdef GSI_PROC_TYPE
    ret = getsysinfo(GSI_PROC_TYPE       , &bufint,sizeof(int));
    if(ret>0)printf   ("gsi_proc_type=%d\n",bufint);
#endif
#ifdef GSI_CPU_INFO
    { struct cpu_info bufcpu;
    ret = getsysinfo(GSI_CPU_INFO        , bufval,16*sizeof(int));
    if(3*sizeof(int)>=sizeof(bufcpu.unused))
    if(ret>0)printf   ("gsi_cpu_freq=%d\n",bufval[12]);
    }
#endif
}
____EOF
    (cd /tmp; $cc /tmp/getsysinfo.$$.c -o /tmp/getsysinfo.$$)
    eval `/tmp/getsysinfo.$$`
    ;;
# -------------------------------------
#   libvga
  linux-*)
    # libvga : SCREEN, CHIPSET, MOUSE
    if test -r /etc/vga/libvga.config; then
      vga=/etc/vga/libvga.config
      # SCREEN
      pattern='^(monitor|HorizSync 31.5)'
      if   egrep -s '^M[0-6]$'              $vga>&-; then
        SCREEN=`sed -n '/^\(m[0-6]\)$/p'    $vga`
      elif egrep -s "$pattern"' 31.5$'      $vga>&-; then SCREEN=M0
      elif egrep -s "$pattern"' 35.1$'      $vga>&-; then SCREEN=M1
      elif egrep -s "$pattern"' 35.5$'      $vga>&-; then SCREEN=M2
      elif egrep -s "$pattern"' 37.9$'      $vga>&-; then SCREEN=M3
      elif egrep -s "$pattern"' 48.3$'      $vga>&-; then SCREEN=M4
      elif egrep -s "$pattern"' 56.0$'      $vga>&-; then SCREEN=M5
      elif egrep -s "$pattern"' xxxx$'      $vga>&-; then SCREEN=M6
      elif egrep -s "$pattern"' 64.3$'      $vga>&-; then SCREEN=M6+
      else SCREEN=
      fi
      case "$SCREEN" in
        M0) SCREEN='Standard VGA monitor, 640x480 @ 60 Hz' ;;
        M1) SCREEN='Old SVGA monitor, 800x600 @ 56 Hz' ;;
        M2) SCREEN='Low-end SVGA, 8514, 1024x768 @ 43 Hz interlaced' ;;
        M3) SCREEN='SVGA monitor, 800x600 @ 60 Hz, 640x480 @ 72 Hz' ;;
        M4) SCREEN='SVGA non-interlaced, 800x600 @ 72 Hz, 1024x768 @ 60 Hz' ;;
        M5) SCREEN='SVGA high frequency, 1024x768 @ 70 Hz' ;;
        M6) SCREEN='SVGA "very high" frequency, 1024x768 @ 72 Hz' ;;
        M6+)SCREEN='1280x1024 @ 60 Hz' ;;
        *)  SCREEN= ;;
      esac
      if   egrep -s '^c0$'        $vga>&-; then SCREEN="$SCREEN (Monochrome)"
      elif egrep -s '^monotext$'  $vga>&-; then SCREEN="$SCREEN (Monochrome)"
      elif egrep -s '^c1$'        $vga>&-; then SCREEN="$SCREEN (Color)"
      elif egrep -s '^colortext$' $vga>&-; then SCREEN="$SCREEN (Color)"
      fi
      # CHIPSET
      if   egrep -s '^C[0-9]*$'             $vga>&-; then
        CHIPSET=`sed -n '/^\(C[0-9]*\)$/p'  $vga`; fi
      case "$CHIPSET" in
        C0)  CHIPSET= ;; # Auto-detect
        C1)  CHIPSET=VGA ;;
        C2)  CHIPSET=ET4000 ;;
        C3)  CHIPSET=CIRRUS ;;
        C4)  CHIPSET=TVGA8900 ;;
        C5)  CHIPSET=OAK ;;
        C6)  CHIPSET=EGA ;;
        C7)  CHIPSET=S3 ;;
        C8)  CHIPSET=ET3000 ;;
        C9)  CHIPSET=MACH32 ;;
        C10) CHIPSET=GVGA6400 ;;
        C11) CHIPSET='ARK Logic' ;;
        C12) CHIPSET='ATI SVGA' ;;
        *)  CHIPSET= ;;
      esac
      # MOUSE
      if   egrep -s '^m[0-9]$'              $vga>&-; then
	MOUSE=`sed -n '/^\(m[0-9]\)$/p'     $vga`
      elif egrep -s '^mouse microsoft'      $vga>&-; then MOUSE=m0
      elif egrep -s '^mouse mousesystems'   $vga>&-; then MOUSE=m1
      elif egrep -s '^mouse mmseries'       $vga>&-; then MOUSE=m2
      elif egrep -s '^mouse logitech'       $vga>&-; then MOUSE=m3
      elif egrep -s '^mouse busmouse'       $vga>&-; then MOUSE=m4
      elif egrep -s '^mouse ps2'            $vga>&-; then MOUSE=m5
      elif egrep -s '^mouse mouseman'       $vga>&-; then MOUSE=m6
      elif egrep -s '^mouse none'           $vga>&-; then MOUSE=m9
      else MOUSE=
      fi
      case "$MOUSE" in
	m0) MOUSE=Microsoft ;;
	m1) MOUSE=MouseSystems ;;
	m2) MOUSE='Logitech MM Series' ;;
	m3) MOUSE='Logitech protocol' ;;
	m4) MOUSE='Bus Mouse' ;;
	m5) MOUSE='PS/2 mouse' ;;
	m6) MOUSE='Logitech MouseMan' ;;
	m9) MOUSE=none ;;
	*)  MOUSE= ;;
      esac
    fi
    ;;
# -------------------------------------
#   uerf
  dec-mips)
    uerf=/tmp/uerfinfo.$$
    files="$files $uerf";
    /etc/uerf -R -r 300 2>&-|awk '/ENTRY *2/{exit}{print}' > $uerf
    if test -r /syserr.capillaire.polytechnique.fr; then
      /etc/uerf -R -r 300 -f /syserr.capillaire.polytechnique.fr 2>&- | \
      awk '/ENTRY *2/{exit}{print}' > $uerf; fi
    ;;
# -------------------------------------
#   sysinfo
  alliant-ix60)
    files="$files /tmp/sysinfo.$$.c /tmp/sysinfo.$$"
    cat<<____EOF>/tmp/sysinfo.$$.c
    #include <stdio.h>
    #include <sys/alliant2800.h>
    #include <machine/sr.h>
    main ()
    {
    /*printf("concentrix_version=%ld\n",concentrix_version); -- inutile*/
      printf("concentrix_release=%s\n",concentrix_release);
      printf("modelnum=%ld\n",modelnum);
      printf("memorysize=%ld\n",memorysize);
      printf("onchip_icachesize=%ld\n",onchip_icachesize/1024);
      printf("onchip_dcachesize=%ld\n",onchip_dcachesize/1024);
      printf("global_cachesize=%ld\n",global_cachesize/1024);
    /*printf("serialnum=%ld\n",serialnum); -- inutile*/
      printf("sys_number_of_cpus=%ld\n",sys_number_of_cpus);
      printf("i860_epsr_type=%ld\n",i860_access_epsr()&EPSR_TYPE);
    }
____EOF
    (cd /tmp; $cc /tmp/sysinfo.$$.c -o /tmp/sysinfo.$$)
    eval `/tmp/sysinfo.$$`
    ;;
# -------------------------------------
#   sched.models
#   sysconf
  hp-*)
    if test "$CPUFAM" = m68k; then if /bin/hp-mc680x0; then :;else
      echo Warning: /bin/hp-mc680x0 is false 1>&2;fi; fi
    if test "$CPUFAM" = hppa; then if /bin/hp-pa; then :;else
      echo Warning: /bin/hp-pa is false 1>&2; fi; fi
    sched=/opt/langtools/lib/sched.models
    if test ! -r $sched; then sched=/usr/lib/sched.models; fi
    if test ! -r $sched; then sched=; fi
    if test -n "$sched"; then
      files="$files /tmp/sched.$$"
      hp9000=`echo $ma | sed s,9000/,,`
      grep '^'$hp9000 $sched > /tmp/sched.$$
      read hp9000 pa_version pa_name < /tmp/sched.$$
    fi
    files="$files /tmp/sysconf.$$.c /tmp/sysconf.$$"
    sed 's/^....//' <<____EOF>/tmp/sysconf.$$.c
    #include <stdio.h>
    #include <unistd.h>
    #include <machine/cpu.h>
    main ()
    {
      printf("cpuversion=%ld\n",sysconf(_SC_CPU_VERSION));
    #ifdef CPU_CACHE_LINE
      printf("cpucacheline=%ld\n",CPU_CACHE_LINE);
    #endif
    }
____EOF
    cc=cc
    (cd /tmp; $cc /tmp/sysconf.$$.c -o /tmp/sysconf.$$)
    eval `/tmp/sysconf.$$`
    ;;
# -------------------------------------
#   sysinfo
  sgi-mips)
    # cf. http://www.mipsabi.org/Tech/BB1.2/chap6.htm
    #     `` sysinfo  Routine ''
  #    files="$files /tmp/getsysinfo.$$.c /tmp/getsysinfo.$$"
  #    cat<<EOF>/tmp/getsysinfo.$$.c
  #include <sys/sysinfo.h>
  #include <machine/hal_sysinfo.h>
  #    main() { int bufint; char bufstr[1024];
  #    getsysinfo(_MIPS_SI_NUM_PROCESSORS, &bufstr);
  #    printf   ("_mips_si_num_processors=%d\n",bufint); /*Ex: 4 */
  #    getsysinfo(_MIPS_SI_HW_NAME,        &bufstr);
  #    printf   ("_mips_si_hw_name=%d\n",bufstr);     /*Ex: IP12 */
  #    getsysinfo(_MIPS_SI_PROCESSORS,     &bufstr);
  #    printf   ("_mips_si_processors=%d\n",bufstr);  /*Ex: R2000A/R3000 3.0 */
  #    }
  #EOF
  #    cc=cc
  #    (cd /tmp; $cc /tmp/getsysinfo.$$.c -o /tmp/getsysinfo.$$)
  #    eval `/tmp/getsysinfo.$$`
    ;;
# -------------------------------------
  sun-m68k|rs6000-m98k|dec-vax) ;;
  next-*|netbsd-*|freebsd-*) ;;
esac

if test "$CODE" = sun; then
  # Sun's hostid (for older machines)
  case "`hostid`" in
  01*) HOSTID="2/1x0" ;;
  02*) HOSTID="2/50" ;;
  11*) HOSTID="3/160" ;;
  12*) HOSTID="3/50" ;;
  13*) HOSTID="3/2x0" ;;
  14*) HOSTID="3/110" ;;
  17*) HOSTID="3/60" ;;
  18*) HOSTID="3/e" ;;
  21*) HOSTID="4/2x0" ;;
  22*) HOSTID="4/1x0" ;;
  23*) HOSTID="4/3x0" ;;
  24*) HOSTID="4/4x0" ;;
  31*) HOSTID="386i" ;;
  41*) HOSTID="3/4x0" ;;
  42*) HOSTID="3/80" ;;
  51*) HOSTID="SPARCstation 1 (4/60)" ;;
  52*) HOSTID="SPARCstation IPC (4/40)" ;;
  53*) HOSTID="SPARCstation 1+ (4/65)" ;;
  54*) HOSTID="SPARCstation SLC (4/20)" ;;
  55*) HOSTID="SPARCstation 2 (4/75)" ;;
  56*) HOSTID="SPARCstation ELC" ;;
  57*) HOSTID="SPARCstation IPX (4/50)" ;;
  61*) HOSTID="4/e" ;;
  71*) HOSTID="4/6x0" ;;
  72*) test -n "$verbose" && HOSTID="SPARCstation 10 or SPARCstation 20" ;;
  80*) test -n "$verbose" && \
       HOSTID="SPARCstation Classic, LX, 4, 5, SS1000, Voyager, Ultra 1" ;;
  esac
fi

# Messages log files
mess=
for xmes in /var/log/messages /usr/adm/messages \
            /var/adm/messages /private/adm/messages; do
for ymes in $xmes $xmes.? $xmes.old; do
  if test ! -r $ymes -o ! -s $ymes; then continue; fi
  mess="$mess $ymes"
done; done

#######################################
## 6. Description du cpu

case "$CODE-$CPUFAM" in
# -------------------------------------
  sun-m68k)
    if   test -f /bin/sun3x && /bin/sun3x; then CPUTYP=m68030
    else                                        CPUTYP=m68020
    fi
    ;;
# -------------------------------------
#   CPUTYP + CPUNAM
#   CACHE
#   NBPROC
#   MEMORY
  sun-sparc)
    case "$sparcv" in
      0|"")
        case "$ma" in
          sun4u)     CPUTYP=v9 ;;
          sun4[md])  CPUTYP=v8 ;;
          *)         CPUTYP=v7 ;;
        esac ;;
      *)             CPUTYP=v$sparcv ;;
    esac
    case "$cpuname" in
      "'TI,TMS390Z55'")      CPUNAMPLUS=" + E.Cache" ;;
      "'FMI,MB86907'")       CPUNAMPLUS=" + E.Cache" ;;
    esac
    if test -n "$ESIZE$DSIZE$ISIZE$XSIZE"; then
      CACHE=""
      test -n "$ISIZE" && CACHE="${CACHE}I $ISIZE/$ILINE/$IASSO   "
      test -n "$DSIZE" && CACHE="${CACHE}D $DSIZE/$DLINE/$DASSO   "
      test -n "$ESIZE" && CACHE="${CACHE}E $ESIZE/$ELINE/$EASSO   "
      test -n "$XSIZE" && CACHE="${CACHE}Total $XSIZE/$XLINE/$XASSO   "
      CACHE="${CACHE}(Ko/Sz/Ass)"
    fi
    # Nombre de processeurs
    NBPROC=$ncpu
    # Memoire
    if test "$prtconf" = /etc/prtconf; then
      MEMORY=`sed -n 's/Memory size: \([0-9]*\) Megabytes/\1/p' $conf`
    elif test -n "$memoryhex"; then
      MEMORY=`echo "16 i" $memoryhex "00100000 / p q" | dc`
    fi
    ;;
# -------------------------------------
#   CPUTYP
#   NBPROC
#   MEMORY
  dec-alpha)
    # cf. /usr/include/machine/hal/cpuconf.h
    # cf. http://www.cs.us.es/pub/Linux/sunsite-mirror/ALPHA/alpha/azstarnet/docs/alpha-sys-3.html
    # cf. http://www.cs.us.es/pub/Linux/sunsite-mirror/ALPHA/alpha/azstarnet/docs/FAQ.txt
    # cf. http://www.partner.digital.com/www-swdev/pages/Home/TECH/documents/Digital_UNIX/V4.0/AA-PS31D-TET1_html/asm4.html
    # TODO : assembleur... implver => 0 ou 1, major impl. of proc.
    if test -x /usr/sbin/psrinfo; then
      case "`/usr/sbin/psrinfo -v`" in
      *'subtype = 13'*) gsi_proc_type=6 ;;  # gsi_cpu=37
      *'alpha EV4.5 '*) gsi_proc_type=6 ;;
      *'subtype = 26'*) gsi_proc_type=7 ;;  # gsi_cpu=46
      *'alpha EV5.6 '*) gsi_proc_type=7 ;;
      esac
    fi
    case "$gsi_proc_type" in
      1) CPUTYP=EV3;   CPUNAM="Dec-21064-AA" ;;  # ??
      2) CPUTYP=EV4;   CPUNAM="Dec-21064" ;;
      4) CPUTYP=LCA4;  CPUNAM="Dec-21066/21068" ;;  # aka. LCA
      5) CPUTYP=EV5;   CPUNAM="Dec-21164" ;;
      6) CPUTYP=EV45;  CPUNAM="Dec-21064A" ;;
      7) CPUTYP=EV56;  CPUNAM="Dec-21164A" ;;
      8) CPUTYP=EV6;   CPUNAM="Dec-21264" ;;
      9) CPUTYP=PCA56; CPUNAM="Dec-21164PC" ;;
      '') ;;
      *) CPUTYP="GSI_PROC_TYPE=$gsi_proc_type" ;;
    esac
    # cf. www.digital.com/info/alphaserver/performance/nt_svr_l_tables.html
   # AlphaServer  400 4/233 => EV4  233
   # AlphaServer 1000 4/266 => EV45 266
    # Nombre de processeurs
    NBPROC=$gsi_cpus_in_box
    # Memoire
    MEMORY=$gsi_physmem
    ;;
# -------------------------------------
#   CPUTYP
#   NBPROC
#   MEMORY
  linux-*)
    case "$ma" in
    i486) CPUTYP=$ma`sed -n 's/model[ 	]*: \(.*\)/\1/p' /proc/cpuinfo` ;;
    i?86) CPUTYP=$ma ;;
    sparc)
      case "`egrep '^type' /proc/cpuinfo`" in
        *sun4u)     CPUTYP=v9 ;;
        *sun4[md])  CPUTYP=v8 ;;
        *)          CPUTYP=v7 ;;
      esac
      cpuname=`egrep '^cpu' /proc/cpuinfo`
      ;;
    alpha)
      case "`egrep '^cpu model' /proc/cpuinfo`" in
        *EV3)   CPUTYP=EV3;   CPUNAM="Dec-21064-AA" ;;  # ??
        *EV4)   CPUTYP=EV4;   CPUNAM="Dec-21064" ;;
        *LCA4)  CPUTYP=LCA4;  CPUNAM="Dec-21066/21068" ;;  # aka. LCA
        *EV45)  CPUTYP=EV45;  CPUNAM="Dec-21064A" ;;
        *EV5)   CPUTYP=EV5;   CPUNAM="Dec-21164" ;;
        *EV56)  CPUTYP=EV56;  CPUNAM="Dec-21164A" ;;
        *PCA56) CPUTYP=PCA56; CPUNAM="Dec-21164PC" ;;
        *EV6)   CPUTYP=EV6;   CPUNAM="Dec-21264" ;;
      esac
      ;;
    esac
    # Nombre de processeurs
    if test -n "`egrep ncpus /proc/cpuinfo`"; then
      NBPROC=`sed -n 's/ncpus probed    : \(.*\)/\1/p' /proc/cpuinfo`
    else
      NBPROC=`egrep processor /proc/cpuinfo | awk 'END{print NR}'`
    fi
    # Memoire
    MEMORY=`sed -n 's/Mem: *\([^ ]*\).*/\1/p' /proc/meminfo`
    eval 'MEMORY=$[$MEMORY/1048576].$[($MEMORY/104857)%10]'
    ;;
# -------------------------------------
#   mess
#   ma
#   CPUTYP
#   MEMORY
  next-*)
    case "$machine" in
      m680?0)           CPUTYP=$machine ;;
      i[3456]86*)       CPUTYP=$machine ;;
      i860)             CPUTYP=$machine ;;
      hppa*)            CPUTYP=`echo $machine|sed s/hppa/PA/` ;;
      sparc)            CPUTYP=v8a; CPUTYPPLUS=-micro2
                        CPUNAM='MicroSparc II'; CPUNAMPLUS=' (Hypothesis)' ;;
    esac
    if test -n "$mess"; then for xmes in $mess; do
      MEMORY=`sed -n -e 's/.* physical memory = \(.*\) megabytes./\1/p' \
            $xmes | tail -1`
      if test -n "$MEMORY"; then break; fi
    done; fi
    ;;
# -------------------------------------
#   CPUTYP
#   MEMORY
  dec-mips)
    CPUTYP=`sed -n 's/.*CPU TYPE: *\([^ ]*\) *.*/\1/p' $uerf`
    case "$CPUTYP" in
      R2000A/R3000) CPUTYP=R3000 ;;
    esac
    MEMORY=`sed -n 's/real mem = \(.*\)/\1/p' $uerf`
    test -n "$MEMORY" &&
      MEMORY=`echo $MEMORY "1048576 / p q" | dc`
    ;;
# -------------------------------------
#   CPUTYP
  hp-m68k)
    case "$cpuversion" in
      524) CPUNAM='Motorola MC68020' ;;
      525) CPUNAM='Motorola MC68030' ;;
      526) CPUNAM='Motorola MC68040' ;;
      *)   echo "Warning: cpuversion has a bad value <$cpuversion>" 1>&2 ;;
    esac
    case "$ma" in
      9000/31?)     CPUTYP=m68020 ;;
      9000/340)     CPUTYP=m68030; CPUFREQ=16.7 ;;
      9000/360)     CPUTYP=m68030; CPUFREQ=25.0 ;;
      9000/370)     CPUTYP=m68030; CPUFREQ=33.0 ;;
      9000/375)     CPUTYP=m68030; CPUFREQ=50.0 ;;
      9000/400[st]) CPUTYP=m68030; CPUFREQ=50.0 ;;
      9000/425[st]) CPUTYP=m68040; CPUFREQ=25.0 ;;
      9000/433)     CPUTYP=m68040; CPUFREQ=33.0 ;;
    esac
    # Normalement, CPUTYP et CPUNAM sont coherents.
    ;;
# -------------------------------------
#   CPUTYP
  hp-hppa)
    case "$cpuversion" in
      523) CPUNAM='HP PA-RISC1.0' ;;
      528) CPUNAM='HP PA-RISC1.1' ;;
      529) CPUNAM='HP PA-RISC1.2' ;;
      532) CPUNAM='HP PA-RISC2.0' ;;
      *)   echo "Warning: cpuversion has a bad value <$cpuversion>" 1>&2 ;;
    esac
    CPUTYP=$pa_name
    CPUTYPPLUS=" ($pa_version)"
    case "$hp9000" in
      # PA1.0  -- Pas de flottant
      815)     CPUFREQ=16.7 ;;
      822)     CPUFREQ=25.0 ;;
      850)     CPUFREQ=27.5 ;;
      855)     CPUFREQ=27.5 ;;
      860)     CPUFREQ=27.5 ;;
      842)     CPUFREQ=28.0 ;;
      832)     CPUFREQ=30.0 ;;
      835)     CPUFREQ=30.0 ;;
      845)     CPUFREQ=30.0 ;;
      852)     CPUFREQ=50.0 ;;
      870)     CPUFREQ=50.0 ;;
      890)     CPUFREQ=60.0 ;;
      # PA1.1a   PA7000, Snake
      807)     CPUFREQ=32.0 ;;
      817)     CPUFREQ=48.0 ;;
      837)     CPUFREQ=48.0 ;;
      877)     CPUFREQ=64.0 ;;
      705)     CPUFREQ=35.0 ;;
      710)     CPUFREQ=50.0 ;;
      720)     CPUFREQ=50.0 ;;
      750)     CPUFREQ=66.0 ;;
      # PA1.1b
      735|755) CPUTYPPLUS="$CPUTYPPLUS [PA7150]" ;;   # 1.1b    PA7100
      715|725) CPUTYPPLUS="$CPUTYPPLUS [PA7100LC]" ;; # 1.1b    PA7100
      # PA1.1c -- PA1.1 + MAX-1
      712)     CPUTYPPLUS="$CPUTYPPLUS [PA7100LC]" ;; # 1.1c    PA7100LC
      # PA2.0  -- 64 bits
    esac
    #if test -n "$ESIZE$DSIZE$ISIZE"; then
    #  CACHE=""
    #  test -n "$ESIZE" && CACHE="${CACHE}E $ESIZE/$cpucacheline/$EASSO   "
    #  CACHE="${CACHE}(Ko/Sz/Ass)"
    #fi
    ;;
# -------------------------------------
#   CPUTYP
#   NBPROC
#   MEMORY
#   CACHE
  alliant-ix60)
    case "$i860_epsr_type" in
      1) CPUTYP=i860XR ;; # N10 processor type
      2) CPUTYP=i860XP ;; # N11 processor type
    esac
    NBPROC=$sys_number_of_cpus
    MEMORY=$memorysize
    CACHE="I $onchip_icachesize Ko  D $onchip_dcachesize Ko"
    CACHE="${CACHE}   E $global_cachesize Ko"
    ;;
# -------------------------------------
#   CPUTYP
  netbsd-mips)
    case "$EXECTYPE" in
      *"MIPS RS3000"*) CPUTYP=R3000 ;;
    esac
    ;;
# -------------------------------------
  sgi-mips|rs6000-m98k|dec-vax) ;;
  netbsd-*|freebsd-*) ;;
esac
case "$CPUFAM" in
  ix86)
  case "$CPUTYP" in
    i[34]86*)  CPUNAM=`echo $CPUTYP | sed 's/^i/Intel /'`;;
    i586)      CPUNAM=Pentium ;;
    i686)      CPUNAM=PentiumPro ;;
    4x86)      CPUNAM='Cyrix/IBM 4x86' ;;
    Nx586)     CPUNAM='Nexgen Nx586' ;;
    5x86/6x86) CPUNAM='Cyrix 5x86/6x86' ;;
    5k86)      CPUNAM='AMD 5k86' ;;
  esac
  ;;
  sparc)
  case "$CPUTYP" in
  v7)
    fpversion=/tmp/fpversion.$$
    ( fpversion >$fpversion )2>&-
    if test ! -s "$fpversion"; then fpversion=; fi
    if test -n "$fpversion"; then
      if egrep -s "TMS390C602A" $fpversion>&-;then FPUNAM="TI TMS390C602A"; fi
      if egrep -s "Weitek 3170" $fpversion>&-;then FPUNAM="Weitek 3170"; fi
      if egrep -s "MB86903"     $fpversion>&-;then
                           FPUNAM="Weitek 8601/8701 or Fujitsu MB86903"; fi
      test -n "$FPUNAM" && CPUNAM="FPU: $FPUNAM"
    fi
    ;;
  v8)
    test -n "$verbose" && CPUNAMPLUS=" [n°$cpuver]$CPUNAMPLUS"
    case "$cpuname" in
    *TMS390Z5[05]*) case "$cpuver" in
        [0134])     CPUNAM="SuperSparc"     ; CPUTYPPLUS=-super   ;
                    CPUNICK=" [TI Viking]"                        ;;
                    # STP1020A
        [8C])       CPUNAM="SuperSparc II"  ; CPUTYPPLUS=-super2  ;
                    CPUNICK=" [TI Viking II]" ;; esac             ;;
                    # STP1021
    *CY605*)        CPUNAM="CY605"          ; CPUTYPPLUS=-cypress ;
                    CPUNICK=" [Cypress 605]"                      ;;
    *RT62[05]*)     CPUNAM="HyperSparc"     ; CPUTYPPLUS=-hyper   ; # n°7
                    CPUNICK=" [Ross RT620+RT625]"                 ;;
    *TMS390S1[05]*) CPUNAM="MicroSparc"     ; CPUTYPPLUS=-micro   ; # n°1
                    CPUNICK=" [TI Tsunami]" ; CPUTYP=v8a          ;;
                    # STP1010
    *MB86934*)      CPUNAM="SparcLite"      ; CPUTYPPLUS=-unknown ;
                    CPUNICK=" [Fujitsu]"    ; CPUTYP=v8lite       ;;
    *MB86904*)      CPUNAM="MicroSparc II"  ; CPUTYPPLUS=-micro2  ; # n°4
                    CPUNICK=" [Fujitsu]"    ; CPUTYP=v8a          ;;
                    # STP1012A ou STP1100 (MicroSparc IIep)
    *MB86907*)      CPUNAM="TurboSparc"     ; CPUTYPPLUS=-turbo   ; # n°5
                    CPUNICK=" [Fujitsu]"    ; CPUTYP=v8a          ;;
    esac
    ;;
    # manque powerup (Weitek)
  v9)
    case "$cpuname" in
    *SPARC64*)        CPUNAM="Sparc64"        ; CPUTYPPLUS=-spc64   ;
                      CPUNICK=" [HAL]"                              ;;
    *UltraSPARC-III*) CPUNAM="UltraSparc III" ; CPUTYPPLUS=-ultra3  ;;
    *UltraSPARC-IIi*) CPUNAM="UltraSparc IIi" ; CPUTYPPLUS=-ultra2i ;
                                                CPUTYP=v9a          ;;
    *UltraSPARC-II*)  CPUNAM="UltraSparc II"  ; CPUTYPPLUS=-ultra2  ;
                                                CPUTYP=v9a          ;;
                      # STP1031LGA
    *UltraSPARC*)     CPUNAM="UltraSparc"     ; CPUTYPPLUS=-ultra   ;
                      CPUNICK=" [TI/Sun]"     ; CPUTYP=v9a          ;;
                      # STP1030ABGA
    esac
    ;;
  esac
  ;;
esac

if test -n "$MEMORY"; then
  echo "Memory Size ........... $MEMORY Megabytes"; fi

if test -z "$NBPROC"; then NBPROC=1; fi
if test "$NBPROC" -gt 1; then MULTICPU=" [$NBPROC cpus]"; fi
                     echo "Cpu Family ............ $CPUFAM$MULTICPU"
test -n "$CPUTYP" && echo "    Type .............. $CPUTYP$CPUTYPPLUS"
test -n "$CPUNAM" && echo "    Name .............. $CPUNAM$CPUNICK$CPUNAMPLUS"
test -n "$CACHE"  && echo "    Cache ............. $CACHE"
test -n "$CPU001" && echo "$CPU001"
test -n "$CPU002" && echo "$CPU002"
test -n "$CPU003" && echo "$CPU003"

#######################################
## 7. Frequence de l'unite centrale
Frequency="Frequency "

#	Renseignements (debut)
# m68k
    # Motorola (m68k)   <cisc>
    # cf. www.mygale.org/07/synapse/Moto.html
    # cf. www.cis.ohio-state.edu/text/faq/usenet/motorola/68k-chips-faq/faq.html
  # m68000     8     [79]    16/32bits
  # m68020    12-33  [84]    32bits+icache128o
  # m68030    12-50  [87]    +dcache256o
  # m68040    25-40          caches4Ko
  # m68060    50-66          caches8Ko
# m98k
    # PowerPC (m98k)    <risc>
    # cf. http://www.mygale.org/07/synapse/Moto.html
    # cf. http://www.chips.ibm.com/products/ppc/DataSheets/techlibsheets.html
    # cf. http://www.ibm.fr/france/aix/technique/data/POWER.html
    # cf. http://www.qedinc.com/rel0_4.html
    # cf. http://www.apple.com/powermac/g3/
  ## Pre-Existe : 32 bits
  # POWER            [fev90] {IBM}
  # RSC3308          [92]    {IBM} RSC: RISC Single Chip
  # RSC4608                  {IBM}
  # POWER2    66-133 [93]    {IBM}     <ex: RS/6000 390, a 66MHz>
  ## 32 bits
  # PPC 601   50-80  [sep93]
  # PPC 603   66-100 [94]    {IBM,Moto} low power, cache 2x8k
  # PPC 604  120-180 [95]    {IBM,Moto} cache 2x16k
  # PPC 602   66     [95]    {IBM,Moto} cache 2x4k
  # PPC 603e 150-240         {IBM,Moto} low power, cache 2x16k
  # PPC 603q 160     [oct96] {QED}
  # PPC 604e 166-225 [96]    {IBM,Moto} cache 2x32k
  # PPC 615        annonce ? {IBM} emulation x86
  # X^704    533     [97]    {XTech, depot de bilan}
  # PPC 750  233-266 [nov97] PPC 604e + cache L2 -- Aussi appelé G3
  ## 64 bits
  # PPC 620  133-200 [95]    {IBM,Moto} 64bits cache 2x32k
  # PPC 630          [97]  ? {IBM,Moto} 64bits
# ix86
    # Intel x86         <cisc>
  # i4004            [71]    (4/8bits)
  # i8080                    (8/16bits)
  ## 16 bits
  # i8086            [78]    (clone: NEC V20)
  # i286
  ## 32 bits
  # i386                     {Intel} +MMU                    {+ AMD, Cyrix}
  # i486             [89]    {Intel} +pipeline, cache, float {+ AMD, Cyrix}
  # i586      90-200 [fin93] {Intel} P5 superscalaire, P54C[S], P55C (MMX)
  # 6x86     100-150 [jui95] {Cyrix} M1
  # 5k86      75-116 [mar96] {AMD}   K5 (AMD) <risc core>
  # Nx586    120-133 [nov95] {Nexgen} <risc core>
  # i686     150-200 [fin95] {Intel} P6 PentiumPro <risc core> (32bits)
  #          180-233 [mar97] {AMD}   K6 (basé sur Nx686)
  #          180-225 [mi97]  {Cyrix} M2
  #          166-233 [     ] {Intel} Pentium MMX
  #          200     [     ] {AMD}   K6 MMX
  #          233     [     ] {Intel} Pentium II
  #          200     [     ] {Cyrix} 6x86L
  #          200     [     ] {Cyrix} 6x86MX
  ##
  # http://www.cyrix.com/process/prodinfo/6x86/faq-6x86.htm
  #   6x86   PR120+  50/100 MHz    PR133+  55/110 MHz    PR150+  60/120 MHz
  #          PR166+  66/133 MHz    PR200+  75/150 MHz
  #   6x86MX PR166+  66/133 MHz    PR200+  75/150 MHz    PR233+  ../... MHz
  ##
  # le P7 est aussi le PA9000 d'HP
# ix60
    # Intel 860/960     <risc>
  # produit mi-80 (64 bits)
  # Deux versions du i860 :
  #   i860XR (N10)
  #   i860XP (N11)
# hppa
    # PA-RISC {HP}      <risc>
    # cf. http://www.dasher.com/pa_risc/
    # cf. /usr/lib/sched.models
  # Precision Architecture RISC
  # 7000      50-66  [91]           [aka. Snake]
  # 7100      100    [92]    (1.1)
  # 7100LC    33-100 [fin92] (1.1c) [low cost]
  # 7150      99-125 [94]    (1.1)  [amelioration 7100]
  # 7200     100-120 [94]    (1.1)  [high powered]
  # 7300LC   132-160 [oct95] (1.1c)
  # 8000     160-180 [mi96]  (2.0)
  # 8200     220     [mi97]  (2.0)
  # 8500     400     [mi98]  (2.0)
  # le PA9000 est aussi le P7 d'Intel
  # HP 712 : PA7100LC 60,80,100 MHz
  # HP 715 : PA7100LC 33,50,64,75,80,100,100XC MHz (XC: Xtended Cache)
  # HP 725 : PA7100LC 50,75,100 MHz
# sparc
    # Sparc             <risc>
    # cf. http://www.sparc.com/sparc.new/certified/v8v9/v8v9-list.html
    # cf. http://www.fmi.fujitsu.com/products/productlist.html
  # v7                [87]    SPARC {Sun}
  # v7                        CY7C611 {Cypress}
  # v7         33             MB86903 {Fujitsu} (ELC)
  # v7         20             L64801 {LSI Logic} (SS1, SLC)
  # v7         25             L64811 {LSI Logic} (SS1+)
  # v7         40             L64831 {LSI Logic} (IPX, SS2)
  # v8-super   33-60  [aou91] SuperSPARC    {TI,Sun} (superscalaire) TMS390Z50
  # v8-hyper   55-200 [avr92] HyperSPARC    {Ross}   CY7C620+CY7C625
  # v8a-micro  50     [oct92] MicroSPARC    {TI,Sun} TMS390S10
  # v8a-micro2 70-85  [mar94] MicroSPARC II
  # v8a-micro2 110            MicroSPARC IIep
  # v8-super2  75-90  [fin94] SuperSPARC II {TI,Sun} (hautes frequences)
  # v9a-ultra 143-200 [fin95] UltraSPARC    {Sun} (64bits)
  # v9-spc64  154     [fin95] Sparc64       {Hal} (fiabilite)
  # v8a-turbo 170     [sep96] TurboSparc
  # v9a-u2    250-300 [jan97] UltraSPARC II
  # v9a-u2i   270-333 [jan98] UltraSPARC IIi
  # v9a-u3    600             UltraSPARC III
  ## [mar98]
  # Ultra  5 WorkStation :    UltraIIi 270MHz256kB +  512MB + PCI33  + PGX
  # Ultra 10 WorkStation :    UltraIIi 300MHz512kB + 1024MB + PCI33  + Elite3Dm3
  # Ultra 30 WorkStation :    UltraII  300MHz2MB   + 2048MB + PCI66  + Elite3Dm6
  # Ultra  2 WorkStation : 2x UltraII  300MHz2MB   + 2048MB + SBus25 + Elite3Dm6
  # Ultra 60 WorkStation : 2x UltraII  300MHz2MB   + 2048MB + PCI66  + Elite3Dm6
  ## [Sun's names]
  # Darwin : Ultra 5 & Ultra 10
  ## SPARClite 930 (http://www.fmi.fujitsu.com/products/embctrl/embctrl.html)
  #            66-100         SPARClite MB86931 {Fujitsu}
  #            20-40          SPARClite MB86930 {Fujitsu}
  #            20-40          SPARClite MB86932 {Fujitsu}
  #            20-25          SPARClite MB86933 {Fujitsu}
  #            25-50          SPARClite MB86934 {Fujitsu}
  #            66-80          SPARClite MB86935 {Fujitsu}
  #            25-50          SPARClite MB86936 {Fujitsu}
# mips
    # MIPS              <risc>
    # cf. http://www.directories.mfi.com/embedded/mips/index.htm
    # cf. http://www.sgi.com/MIPS/products/r4200/
    # cf. http://www.qedinc.com/prod_web.html
  ## 32 bits
  # R2000      8     [85]    (MIPS I)   imp=0,1 {U.Stanford}
  # R3000     12-40  [88]    (MIPS II)  imp=2  +FPU R3010
  # R6000     66     [91]               imp=3  tech.ECL et non CMOS
  # R6000A                              imp=6
  ## 64 bits
  # R4000     50-100 [92]    (MIPS III) imp=4  existent PC, SC, MC
  # R4400     60-250 [93]               imp=4,rev=0x40
  # R4200     80     [aug94]            imp=10
  # R4300i   100     [apr95]            imp=11 low power, low cost
  # R4600    100-133                    imp=32 uniproc
  # R4700     80-175                           variante
  # R8000     75-90  [jun94] (MIPS IV)  imp=16 +FPU R8010
  # R5000    180-250 [jan96]                   compatible R4x00
  # RM52xx   133-150 [mar97]                   base sur R5000
  # RM7000   170-300 [deb98]                   base sur R5000
  # R10000   196-200 [fin95]            imp=9
  #                  [oct96] (MIPS V)
# alpha
    # Alpha {DEC}       <risc>
  # 21064    100-200 [92]    (EV4)
  # 21066    166-200 [93]    (LCA4, cache reduit)
  # 21068            [93]    (LCA4, ...)
  # 21064A   225-300 [oct93] (EV4.5, double cache interne)
  # 21066A   233-297 [nov94] (EV4.5, ...)
  # 21164    250-333 [sep94] (EV5)
  # 21164A   366-600 [oct95] (EV5.6)
#	Renseignements (fin)

case "$CPUFAM" in
m68k)
  case "$CPUTYP" in
  m68020|m68030)     bbase=247  ;;
  m68040)            bbase=691  ;;
  m68060)            bbase=2010 ;;
  esac ;;
m98k)
  case "$CPUTYP" in
  PPC601)            bbase=840  ;;
  esac ;;
ix86)
  case "$CPUTYP" in
  i8088)             bbase=4    ;;
  i386SX)            bbase=140  ;;
  i386)              bbase=194  ; mhzfactor=2 ;;
  i486DX*)           bbase=500  ;;
  i586)              bbase=399  ;;
  i686)              bbase=990  ;;
  4x86)              bbase=340  ;;
  Nx586)             bbase=750  ;;
  5x86/6x86)         bbase=1000 ;;
  5k86)              bbase=2000 ;;
  esac ;;
hppa)
  case "$CPUTYP" in
  PA7150)            bbase=980  ;;
  esac ;;
sparc) # Sparc             <risc>
  case "$CPUTYP$CPUTYPPLUS" in
  v7)                bbase=700  ;;
  v8a-micro)         bbase=640  ;;
  v8a-micro2)        bbase=820  ;;
  esac ;;
mips)
  case "$CPUTYP" in
  R4000|R4400)       bbase=500  ;;
  R4600|R4700)       bbase=1000 ;;
  esac ;;
alpha)
  # gcc sur alpha est vraiment mauvais !
  if test "$cc" = gcc; then 
    if test "$CODE" = linux; then mhzfactor=3; else mhzfactor=2; fi; fi
  case "$CPUTYP" in
  *)                 bbase=990  ;;
  esac ;;
esac

freqprog="............. "
case "$CODE" in
  sun)
    freqprog="[$confprog] .."
      if test -n "$prtconf" -a -s "$conf_pv" -a -n "$SYSFREQ$CPUFREQ"; then
      echo $n "$Frequency$freqprog$c"
      Frequency="          "
      if test -n "$SYSFREQ"; then
        FREQ=$SYSFREQ
        echo $n ". System $SYSFREQ MHz$c"
      fi
      if   test -n "$CPUFREQ"; then
        FREQ=$CPUFREQ
        echo $n ". Cpu $CPUFREQ MHz$c"
      fi
      echo
      fi
    freqprog="[fpversion] "
      if test -n "$verbose" -o "$Frequency" = "Frequency "; then
      CPUFREQ=; SYSFREQ=;
      if test -z "$fpversion"; then
        fpversion=/tmp/fpversion.$$
        files="$files $fpversion"
        ( fpversion >$fpversion )2>&-
        if test ! -s "$fpversion"; then fpversion=; fi
      fi
      if test -n "$fpversion"; then
        CPUFREQ="`sed -n \
     -e 's/^ CPU.s frequency appears to be approximately \(.*\..\) MHz.$/\1/p'\
     -e 's/^ CPU.s frequency appears to be \(.*\..\) MHz.$/\1/p'\
     -e 's/^ CPU.s clock rate appears to be approximately \(.*\..\) MHz.$/\1/p'\
     -e 's/^ Mbus module.s clock rate appears to be approximately \(.*\..\) MHz.$/\1/p'\
        $fpversion`"
        SYSFREQ="`sed -n \
     -e 's/^ Kernel says the CPU.s clock rate should be \(.*\..\) MHz.$/\1/p'\
     -e 's/^ Kernel says main memory.s clock rate is \(.*\..\) MHz.$/\1/p'\
        $fpversion`"
      fi
      if test -n "$SYSFREQ$CPUFREQ"; then
        echo $n "$Frequency$freqprog$c"
        Frequency="          "
        if test -n "$SYSFREQ"; then
          test -n "$FREQ" && FREQ=$SYSFREQ
          echo $n ". System $SYSFREQ MHz$c"
        fi
        if   test -n "$CPUFREQ"; then
          test -n "$FREQ" && FREQ=$CPUFREQ
          echo $n ". Cpu $CPUFREQ MHz$c"
        fi
        echo
      fi
      fi
    ;;
  linux)
    freqprog="[bogomips] .. "
      eval `tr A-Z a-z < /proc/cpuinfo | sed -n \
      -e 's/bogomips[ 	]*: \([0-9]*\)\.\([0-9]*\)/bogomips=\1\2/p' \
      -e /bogomips/q`
      if test -n "$bbase"; then
        eval 'FREQ=$[10*$bogomips/$bbase].$[(100*$bogomips/$bbase)%10]'
        echo "$Frequency$freqprog$FREQ MHz"
        Frequency="          "
      else
        echo "Bogomips .............. ${bogomips}0 Kips"
      fi
    ;;
  hp)
    freqprog="[uname] ..... "
      if test -n "$CPUFREQ"; then
      FREQ=$CPUFREQ
      echo "$Frequency$freqprog$FREQ MHz"
      Frequency="          "
      fi
    ;;
  dec)
    freqprog="[cpu_info] .. "
      if test -n "$gsi_cpu_freq"; then
      FREQ=$gsi_cpu_freq
      echo "$Frequency$freqprog$FREQ MHz"
      Frequency="          "
      fi
    ;;
esac

if test -n "$verbose" -o "$Frequency" = "Frequency "; then
  if test SOL4 = "$BINARY"; then mhzdir=/var/tmp; else mhzdir=/tmp; fi
  files="$files $mhzdir/mhz.$$.c $mhzdir/mhz.$$.o $mhzdir/mhz.$$"
  cat << 'EOF' > $mhzdir/mhz.$$.c
/* taken from lmbench and slightly modified */
#define N	20000000
#if	defined(sparc) || defined(hppa)
#	define	ONE	a >>= 1;
#else
#	define	ONE	a++;
#endif
#if	defined(sun)
#define	USE_GETRUSAGE
#elif	defined(hpux)
#define	USE_TIMES
#elif	defined(NeXT)
#define	USE_GETRUSAGE
#define	USE_TIMES
#define	USE_FTIME
#endif
#ifdef	macintosh
#	include <Events.h>
	long timer() {
	static long oldticks;
	long ticks = TickCount(), delay = ticks - oldticks;
	oldticks = ticks;
	return 1000 * 50 * delay / 3;
	}
#elif	defined(USE_TIMES)
#	include <sys/times.h>
#	include <sys/time.h>
	long timer() {
	static clock_t oldticks;
	clock_t delay; struct tms t;
	times(&t);
	delay = t.tms_utime - oldticks;
	oldticks = t.tms_utime;
	return (long) ( delay * (1000000 / CLK_TCK) );
	}
#elif	defined(USE_GETRUSAGE)
#	include <sys/time.h>
#	include <sys/resource.h>
	extern int getrusage();
	long timer() {
	static long oldmusec, oldsec;
	long delay;
	struct rusage r;
	struct timeval t;
	getrusage(0,&r); t=r.ru_utime;
	delay = 1000000 * (t.tv_sec - oldsec) + (t.tv_usec - oldmusec);
	oldmusec = t.tv_usec; oldsec = t.tv_sec;
	return delay;
	}
#elif	defined(USE_FTIME)
#	include <sys/timeb.h>
	long timer() {
	static long oldmsec, oldsec;
	long delay;
	struct timeb t;
	ftime(&t);
	delay = 1000 * (t.time - oldsec) + (t.millitm - oldmsec);
	oldmsec = t.millitm; oldsec = t.time;
	return 1000 * delay;
	}
#else
#	include <sys/time.h>
#	ifndef	CLOCKS_PER_SEC
#	ifndef	CLK_TCK
#	define	CLOCKS_PER_SEC 1000000
#	else
#	define	CLOCKS_PER_SEC CLK_TCK
#	endif
#	endif
	long timer() {
	static clock_t oldclocks;
	clock_t total = clock();
	clock_t delay = total - oldclocks;
	oldclocks = total;
	return (long) ( delay * ( 1000000 / CLOCKS_PER_SEC ) );
	}
#endif
	main(ac,av) char **av; {
	register a, i; int result = 1024*1024*1024; int tries = 5;
	double mhz;
	for (; tries; --tries) {
	i = N - 1000; a = 1024;
	timer(); while (i) {
#define	FOUR	ONE ONE ONE ONE
#define	TWENTY	FOUR FOUR FOUR FOUR FOUR
#define H	TWENTY TWENTY TWENTY TWENTY TWENTY
		H H H H H
		H H H H H
		i -= 1000;
	}
	i = timer(); if (i < result) result = i;
	}
	mhz = (N * 1.005) / result;
	if (ac == 2) { float f=0.; sscanf(av[1],"%f",&f);
	if (f != 0.) mhz *= f; }
	printf("%.1f\n", mhz);
	return 0;
	}
EOF
  (cd $mhzdir; $cc mhz.$$.c -o mhz.$$)
  mhz=`$mhzdir/mhz.$$ $mhzfactor`
  case "$cc" in
  ??) freqprog="[mhz $cc] .... " ;;
  ???) freqprog="[mhz $cc] ... " ;;
  ????) freqprog="[mhz $cc] .. " ;;
  ?????) freqprog="[mhz $cc] . " ;;
  ??????) freqprog="[mhz $cc]  " ;;
  *)       freqprog="[mhz $cc] " ;;
  esac
  echo "$Frequency$freqprog$mhz MHz"
  Frequency="          "
fi

if false && test -n "$verbose" -o "$Frequency" = "Frequency "; then
  files="$files /tmp/htype.$$.c /tmp/htype.$$"
  echo 'main() { int a,i; a=3; for (i=0;i<20000000;i++) a*=i; }' \
   > /tmp/htype.$$.c
  (cd /tmp; $cc /tmp/htype.$$.c -o /tmp/htype.$$)
  time="`sh -c 'time sh -c exit 2>&1' 2>&1`"
  case "$time" in
    *" real"*[0-9].[0-9]" user "*" sys"*)                    ## SunOS 4, NeXT
      time="`(time /tmp/htype.$$ 2>&1)2>&1 | sed -n \
           's/.*[ 	]\([0-9]*\)\.\([0-9]\) user.*/\1\2/p'`"
      ;;
    *[0-9].[0-9][0-9]"user "*"system "*"elapsed "*)          ## Linux, fmurr
      time="`(time /tmp/htype.$$ 2>&1)2>&1 | sed -n \
           's/^\([0-9]*\)\.\([0-9]\)[0-9]user.*/\1\2/p'`"
      ;;
    *[0-9].[0-9][0-9]"s user "*" s system "*"% cpu "*)
      time="`(time /tmp/htype.$$ 2>&1)2>&1 | sed -n \
           's/.*[ 	]\([0-9]*\)\.\([0-9]\)[0-9]s user.*/\1\2/p'`"
      ;;
    *[0-9].[0-9][0-9][0-9]"s user "*" s system "*"% cpu "*)
      time="`(time /tmp/htype.$$ 2>&1)2>&1 | sed -n \
           's/.*[ 	]\([0-9]*\)\.\([0-9]\)[0-9][0-9]s user.*/\1\2/p'`"
      ;;
    *"
user"*[0-9]m*[0-9].[0-9][0-9][0-9]*)                         ## Linux, quatra
      time="`sh -c 'time /tmp/htype.'"$$"' 2>&1' 2>&1 | sed -n \
      's/user[ 	]*\([0-9]*\)m\([0-9]*\)\.\([0-9]\).*/600 \1 * \2\3 +/p'`"
      time=`echo "$time" p | dc`
      ;;
    *"
"[Uu]"ser "*[0-9].[0-9]*)                                    ## SunOS 5, HPUX
      time="`(time /tmp/htype.$$ 2>&1)2>&1 | sed -n \
           's/[Uu]ser *\([0-9]*\)\.\([0-9]\).*/\1\2/p'`"
      ;;
    *"not found"*)
      time="`tcsh -fc 'time /tmp/htype'.$$ | sed -n \
           's/^\([0-9]*\)\.\([0-9]\)[0-9][0-9]u .*/\1\2/p'`"
      ;;
    *)
# TODO
      echo "time gives :"
      echo "$time"
      echo $n "                      $c"
      basetime=;time=0
      ;;
  esac
  case "$cc" in
  ??) freqprog="[loop $cc] ... " ;;
  *)  freqprog="[loop $cc] .. " ;;
  esac
  if test -n "$basetime"; then
    case "$CODE" in
    linux)
      eval 'FREQ=$[$basetime/$time].$[(10*$basetime/$time)%10]' ;;
    *)
      FREQ=`echo 1 k $basetime $time / p | dc` ;;
    esac
    echo "$Frequency$freqprog$FREQ MHz"
    Frequency="          "
  else
    echo "$freqprog......... time=$time"
  fi
fi

#######################################
## 8. Operating System

if (/bin/stty pass8)2>&-; then ostype="BSD"; else ostype="SYSV"; fi
case "$os" in
  SunOS)
    ostype="BSD"
    case "$os $osvers" in
      'SunOS 5.'*) osname=' (Solaris)'; ostype="SYSV" ;; esac
    ;;
  Mach)
    if test -d /NextDeveloper/Headers/bsd
    then osvers="$osvers v3.x"
    else osvers="$osvers v2.x"
    fi
    ostype="BSD"
    ;;
  N[Ee]XTSTEP)
    if test -d /NextDeveloper/Headers/bsd
    then osvers="v3.x"
    else osvers="v2.x"
    fi
    ostype="BSD"
    ;;
  Linux)
    if egrep -s Jurix  /etc/motd>&/dev/null; then
      osname=" [Jurix]"
    elif test -f /etc/debian_version; then
      osname=" [Debian `cat /etc/debian_version`]"
    elif egrep -s SuSEConfig /etc/rc.config>&/dev/null; then
      osname=" [SuSE]"
    elif test -d /usr/src/redhat; then
      osname=" [RedHat]"
    fi
    ostype="BSD"
    ;;
  '')
    if test -n "$concentrix_release"; then
      os=Concentrix
      osvers=$concentrix_release
    fi
    ;;
esac
if test -z "$os"; then os='OS inconnu'; fi
if test -n "$osvers"; then
  echo "Operating System ...... $os $osvers$osname [$ostype]"
else
  echo "Operating System ...... $os$osname [$ostype]"
fi

#######################################
## 9. Ecran
Screen="Screen "
case "$CODE" in
  sun)
    if test -n "$prtconf"; then
      SCREEN=$dpytype
      if test -n "$dpyht"; then SCREEN="$SCREEN (${dpywd}x${dpyht})"; fi
      if test ${ndpy:-1} -gt 1; then SCREEN="$SCREEN [many screens]"; fi
      if test -n "$SCREEN"; then
        echo "$Screen[$confprog] ...... $SCREEN"
        Screen="       "
      fi
    fi
    if test -n "$verbose" -o -z "$SCREEN"; then
    if test $x /usr/openwin/bin/constype; then
      # Voir aussi fbio.h
      # S'obtient avec un ioctl FBIOGATTR, puis FBIOGTYPE
      CONSTYPE=`/usr/openwin/bin/constype`
      case "$CONSTYPE" in
      ####      FBTYPE
      bw1) ;; #   0  bwone      Multibus monochrome     [Sun/1]
      cg1) ;; #   1  cgone      Multibus color          [Sun/1]
      bw2) ;; #   2 *bwtwo      Memory monochrome       [SS1/ELC]
      cg2) ;; #   3 *cgtwo      Color w/rasterop chips
      gp2) ;; #   4  gpone      GP1/GP2 Optional Graphics Processor board
      bw3) ;; #   5  cgnine?    RoadRunner accelerator (color)
      cg3) ;; #   6 *cgthree    Memory 8-bit            [SparcClassic]
  cg8|bw4) ;; #   7 *cgeight    Memory 24-bit           [Sun-4/110,150,260,280]
      cg4) ;; #   8 *cgfour     Memory 8-bit P4-bus (w/overlay)
      nsA) ;; #   9             Not Sun display
      nsB) ;; #  10             Not Sun display
      nsC) ;; #  11             Not Sun display
      gx)  ;; #  12 *cgsix      Sun GX (cg6) <cg4+GAcc> [SS5/10/20/LX]
      rop) ;; #  13  cgtwelve?  <cg8> with rop h/w
      vid) ;; #  14  vd         Simple video mixing
      res5);; #  15             Medical image (IFB)
      res4);; #  16             Plasma panel
   gs|res3);; #  17             Sun GS (gp3) Graph. Acc. (cg12 w/gpsi microcode)
   gt|res2);; #  18  gt         Sun GT Graph. Acc.
      res1);; #  19  leo        Sun ZX 24-bit SBus
    ..xxx) ;; #  20  cgfourteen Sun SX 24-bit (video SIMM component) <cg3>
    ..tcx) ;; # (21) tcx        TCX 8/24-bit SBus <cg3/cg8> [SS4] (s24)
    ..ffb) ;; #      ffb        Creator 24-bit UPA + Graph. Acc.
      tty) CONSTYPE= ;; # No response, /dev/fb is unreadable.
      unk) CONSTYPE= ;; # Unknown by constype
      esac
      # Solaris
      #   détecter /dev/ffb0 ou /devices/SUNW,ffb*
      #   détecter /dev/sx0  ou /devices/SUNW,sx*
      if test -n "$CONSTYPE"; then
        echo "$Screen[constype] ..... $CONSTYPE"
        Screen="       "
      fi
    fi
    fi
  ;;
  linux)
    if test -n "$SCREEN"; then
      echo "$Screen[libvga] ....... $SCREEN"
      Screen="       "
    fi
    if test -n "$verbose" -o -z "$SCREEN"; then
      for disp in vga+ bwtwo cgthree cgsix SUNW,tcx SUNW,ffb; do
        if egrep -s $disp /proc/ioports>$z;then dpytype="'"$disp"'"; break; fi
      done
      if test -n "$dpytype"; then
        SCREEN=$dpytype
        echo "$Screen[ioports] ...... $dpytype"
        Screen="       "
      fi
    fi
  ;;
  dec)
    if test -n "$gsi_wsd_type"; then
      echo "$Screen[wsd_type] ..... GSI_WSD_TYPE=$gsi_wsd_type"
      Screen="       "
    fi
  ;;
esac
#if test -n "$mess"; then                                # Sun ou NEXT-sparc
if test -n "$mess" -a \( -n "$verbose" -o -z "$SCREEN" \); then
  for xmes in $mess; do
    for disp in bwtwo cgthree cgsix SUNW,tcx SUNW,ffb; do
      if egrep -s $disp $xmes>$z;then dpytype="'"$disp"'"; break; fi
    done
    if test -n "$dpytype"; then break; fi
  done
  if test -n "$dpytype"; then
    SCREEN=$dpytype
    echo "$Screen[messages] ..... $dpytype ($xmes)"
  fi
fi

#######################################
## 10. Lecteur de CD-ROM/floppy
case "$CODE" in
  sun)
    nbfloppy=`$prtconf | egrep fd | egrep -v driver | awk 'END{print NR}'`
    if   test $nbfloppy -gt 1; then
      echo "Floppy ................ $nbfloppy lecteurs"
    elif test $nbfloppy -gt 0; then
      echo "Floppy ................ $nbfloppy lecteur"
    fi
  ;;
esac

#######################################
## 11. Disque/Swap
case "$CODE" in
  sun)
    if test -x /usr/sbin/swap; then
      swap=`/usr/sbin/swap -l | awk '!/swapfile/{a += $4}END{print a/2}'`
    elif test -n "$mess"; then for xmes in $mess; do
      swap=`sed -n -e 's/.* swap .* size \(.*\)K.*/\1/p' \
            $xmes | tail -1`
      if test -n "$swap"; then swapxmes=" ($xmes)"; break; fi
      done
    fi
  ;;
  next)
    swap=`/bin/df | awk '/swapfile/{print $4}'`
  ;;
  linux)
    swap=`awk '/Swap:/{print $2/1024}' /proc/meminfo`
  ;;
  dec)
    # NB: teste uniquement avec OSF1 V4.0
    files="$files /tmp/getswapsize.$$.c /tmp/getswapsize.$$"
    cat<<____EOF>/tmp/getswapsize.$$.c
#include <sys/stat.h>
#include <sys/swap.h>
#include <sys/param.h>
#include <malloc.h>
#define MAXSWAPTABLE 10
    typedef struct  swaptableNEW {
        int     swt_n;                         /*number of swapents following */
        struct  swapent swt_ent[MAXSWAPTABLE]; /* array of swt_n swapents */
    } swaptblNEW_t;
    main() { int swapsize, nbswap, i;
    struct swaptableNEW res;
    res.swt_n = MAXSWAPTABLE;
    for(i=0;i<res.swt_n;i++) res.swt_ent[i].ste_path=(char*)malloc(MAXPATHLEN);
    nbswap = swapctl(SC_LIST, &res);
    if (nbswap==-1) { perror("getswapsize"); return 1; }
    swapsize = 0;
    for (i=0;i<nbswap;i++) swapsize += res.swt_ent[i].ste_length;
    swapsize /= 2;
    printf("%d\n",swapsize);
    return 0;
}
____EOF
    (cd /tmp; cc /tmp/getswapsize.$$.c -o /tmp/getswapsize.$$)
    swap=`/tmp/getswapsize.$$`
  ;;
esac
if test -n "$swap"; then
  echo "Swap .................. `
  echo $swap 1024/p | dc` Megabytes$swapxmes"
 #echo 1k$swap 1024/1024/p | dc` Gigabytes$swapxmes"
fi

#######################################
## 12. Boot Prom/Bios
case "$CODE" in
  sun)
    if test "$prtconf" = /etc/prtconf; then
      echo "PROM .................. `/etc/prtconf -V`"
    fi
  ;;
esac

#######################################
## 13. Description de l'architecture
System="System "

# Screen guess -- Cas des SparcStation 4/5 et SparcClassic
case "$CPUFAM" in
  sparc)
    # Sparc System's name
    case "$CPUTYP$CPUTYPPLUS...$SCREEN" in
    v8a-micro..."'cgthree'") screensys="SparcClassic" ;;
    v8a-*..."'cgsix'")       screensys="SparcStation 5" ;;
    v8a-*...*"tcx'")         screensys="SparcStation 4" ;;
    *)                       screensys= ;;
    esac
    ;;
esac

# Architecture
sysprog="................ "
case "$CODE-$CPUFAM" in
# -------------------------------------
  sun-*)
    sysprog="[hostid] ....... "
      if test -n "$HOSTID"; then
      echo "$System$sysprog$HOSTID"
      System="       "
      fi
    sysprog="[banner] ....... "
      if test -n "$bannername"; then
      if test -n "$verbose" -o "$System" = "System "; then
      echo "$System$sysprog$bannername"
      System="       "
      fi
      fi
    sysprog="[uname] ........ "
      if test "$osname" = ' (Solaris)'; then
      if test -n "$verbose" -o "$System" = "System "; then
      echo "$System$sysprog'`uname -i`'"
      System="       "
      fi
      fi
    sysprog="[$confprog] ...... "
      if test -n "$sysname"; then
      if test -n "$verbose" -o "$System" = "System "; then
      echo "$System$sysprog$sysname"
      System="       "
      fi
      fi
    sysprog="[fpversion] .... "
      if test -z "$fpversion"; then
        fpversion=/tmp/fpversion.$$
        files="$files $fpversion"
        ( fpversion >$fpversion )2>&-
        if test ! -s "$fpversion"; then fpversion=; fi
      fi
      if test -n "$fpversion"; then
      if test -n "$verbose" -o "$System" = "System "; then
      if egrep -s xtarget $fpversion>$z; then
      fparchi=`sed -n \
        's/.*"-xtarget=\(.*\) -xchip=\(.*\)" code.*/\1 [chip=\2]/p'\
        $fpversion`
      test -z "$fparchi" && fparchi=`sed -n \
        's/.*"-xtarget=\(.*\)" code.*/\1/p'\
        $fpversion`
      echo "$System$sysprog$fparchi"
      System="       "
      fi
      fi
      fi
    sysprog="[screen guess] . "
      if test -n "$screensys"; then
      if test -n "$verbose" -o "$System" = "System "; then
      echo "$System$sysprog$screensys"
      System="       "
      fi
      fi
    sysprog="[arch] ......... "
      if test -n "$verbose" -o "$System" = "System "; then
      archi=$ma
      test $x /bin/S4000 && /bin/S4000 && archi='Solbourne S4000'
      echo "$System$sysprog$archi"
      System="       "
      fi
    ;;
# -------------------------------------
  dec-alpha)
    sysprog="[gsi_platform] . "
      if test -n "$gsi_platform_name"; then
      echo "$System$sysprog$gsi_platform_name"
      System="       "
      fi
    sysprog="[gsi_cpu] ...... "
      if test -n "$gsi_cpu"; then
      if test -n "$verbose" -o "$System" = "System "; then
      gsi_cpuplatform=`awk '/UNKN_SYSTEM/{zone=1}/CPU_MAX/{zone=0}
        /#define/{if(zone&&($3=='$gsi_cpu'))
        {if($4=="/*"){printf $2 " (" $5; i=6;
          while((i<=NF)&&($i != "*/")) {printf " " $i; i++} printf ")\n"}
          else{print $2};exit}}' \
        /usr/include/machine/hal/cpuconf.h`
      echo "$System$sysprog$gsi_cpuplatform"
      System="       "
      fi
      fi
    sysprog="[uerf] ......... "
      if test -r /var/adm/binary.errlog; then
      # Ceci est mis au hasard, il faut trouver une machine ou c'est lisible
      if test -n "$verbose" -o "$System" = "System "; then
      archi=`/etc/uerf -R -r 300|\
        sed -n -e 's/.*\(DECstation.*\)/\1/p' -e /DECstation/q`
      echo "$System$sysprog$archi"
      System="       "
      fi
      fi
    sysprog="[messages] ..... "
      if test -n "$mess"; then
      if test -n "$verbose" -o "$System" = "System "; then
      for xmes in $mess; do
        archi=`sed -n -e 's/.*\(Digital.*\)/\1/p' -e /Digital/q $xmes`
        if test -z "$archi"; then continue; fi
        echo "$System$sysprog$archi ($xmes)"
        System="       "
      done
      fi
      fi
    sysprog="................ "
      if test -n "$verbose" -o "$System" = "System "; then
      echo "$System${sysprog}Dec Alpha AXP"
      System="       "
      fi
    ;;
# -------------------------------------
  next-*)
    sysprog="[cpufam] ....... "
      if test "$CPUFAM" = sparc -a -z "$screensys"; then screensys=Sparc; fi
      case "$CPUFAM" in
      ix86)   archi='Compatible PC sous NeXTStep' ;;
      sparc)  archi="$screensys sous NeXTStep" ;;
      hppa)   archi='HP sous NeXTStep' ;;
      m98k)   archi='PowerPC sous NeXTStep' ;;
      m68k)   archi='NeXT' ;;
      esac
      echo "$System$sysprog$archi"
      System="       "
    ;;
# -------------------------------------
  dec-mips)
    sysprog="[uerf] ......... "
      if egrep -s DECstation $uerf>&-;then
      archi=`sed -n 's/.*\(DECstation.*\)/\1/p' $uerf`
      echo "$System$sysprog$archi"
      System="       "
      fi
    sysprog="[cpufreq] ...... "
      if test -n "$verbose" -o "$System" = "System "; then
      archi='DecStation'
      case "$FREQ" in
        12*) archi=$archi" 2100";;
        16*) archi=$archi" 3100";;
        33*) archi=$archi" 5100";;
        *)   sysprog="................ " ;;
      esac
      echo "$System$sysprog$archi"
      System="       "
      fi
    ;;
# -------------------------------------
  *-ix86)
    sysprog="[cpufreq] ...... "
    case "$FREQ" in
      2[3-7].?)            archi=$CPUNAM-25 ;;
      3[1-5].?)            archi=$CPUNAM-33 ;;
      3[7-9].?|4[0-2].?)   archi=$CPUNAM-40 ;;
      4[7-9].?|5[0-2].?)   archi=$CPUNAM-50 ;;
      5[5-9].?|6[0-2].?)   archi=$CPUNAM-60 ;;
      6[3-9].?)            archi=$CPUNAM-66 ;;
      7?.?)                archi=$CPUNAM-75 ;;
      8?.?|9[0-4].?)       archi=$CPUNAM-90 ;;
      9[5-9].?|10?.?)      archi=$CPUNAM-100 ;;
      11?.?|12?.?)         archi=$CPUNAM-120 ;;
      13?.?)               archi=$CPUNAM-133 ;;
      14?.?|15?.?)         archi=$CPUNAM-150 ;;
      16?.?)               archi=$CPUNAM-166 ;;
      17?.?|18?.?)         archi=$CPUNAM-180 ;;
      20?.?)               archi=$CPUNAM-200 ;;
      *)                   archi="$CPUNAM-$FREQ" ;;
    esac
    case $NBPROC in
      1) ;;
      2) archi="Bi $archi" ;;
      *) archi="$NBPROC x $archi" ;;
    esac
    echo "$System$sysprog$archi"
    System="       "
    ;;
# -------------------------------------
  linux-sparc)
    sysprog="[cpuinfo] ...... "
      archi=`sed -n 's/^type[ 	]*: \(.*\)/\1/p' /proc/cpuinfo`
      echo "$System$sysprog$archi"
      System="       "
    ;;
# -------------------------------------
  alliant-ix60)
    sysprog="[motd] ......... "
      if egrep -s 'Alliant FX' /etc/motd>&-;then
      sysmotd=`sed -n 's/.*\(Alliant FX.*\)/\1/p' /etc/motd`
      echo "$System$sysprog$sysmotd"
      System="       "
      fi
    sysprog="[modelnum] ..... "
      # cf. /usr/include/machine/bpb.h
      if test -n "$verbose" -o "$System" = "System "; then
      case "$modelnum" in
      1) archi="Alliant FX 1" ;;
      2) archi="Alliant FX 4" ;;
      3) archi="Alliant FX 40" ;;
      4) archi="Alliant FX 8" ;;
      5) archi="Alliant FX 80" ;;
      6) archi="Alliant FX 2800" ;;
      7) archi="Alliant FX 800" ;;
      *) archi="<$modelnum> (unknown model name)" ;;
      esac
      echo "$System$sysprog$archi"
      System="       "
      fi
    sysprog="[arch] ......... "
      # program /bin/arch
      if test -n "$verbose" -o "$System" = "System "; then
      echo "$System${sysprog}Alliant $machine"
      System="       "
      fi
    ;;
# -------------------------------------
  hp-*)
    sysprog="[uname] ........ "
      echo "$System${sysprog}HP $ma"
      System="       "
    ;;
# -------------------------------------
  sgi-mips)    echo "$System${sysprog}Silicon Graphics" ;;
  rs6000-m98k) echo "$System${sysprog}IBM RISC System/6000" ;;
  dec-vax)     echo "$System${sysprog}Vax" ;;
esac

if test "$CODE" = linux -a -n "$vga"; then
  if test -n "$CHIPSET"; then echo "Chipset [libvga] ...... $CHIPSET"; fi
  if test -n "$MOUSE";   then echo "Mouse [libvga] ........ $MOUSE"; fi
fi

#######################################
## Exit status
test "$CODE" != unknown
