summaryrefslogtreecommitdiffstats
path: root/ldap/cm/newinst/ux-guesses.cc
blob: 3323a0a1934c5d76570d2115e4d271f5b402ee13 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/** BEGIN COPYRIGHT BLOCK
 * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
 * Copyright (C) 2005 Red Hat, Inc.
 * All rights reserved.
 * END COPYRIGHT BLOCK **/

/* Print guesses of host and domain name as made by the setup SDK. */



/* $RCSfile: ux-guesses.cc,v $ $Revision: 1.2 $ $Date: 2005/02/28 23:37:49 $ $State: Exp $ */
/*
 * $Log: ux-guesses.cc,v $
 * Revision 1.2  2005/02/28 23:37:49  nkinder
 * 149951 - Updated source code copyrights
 *
 * Revision 1.1.1.1  2005/01/21 00:40:49  cvsadm
 * Moving NSCP Directory Server from DirectoryBranch to TRUNK, initial drop. (foxworth)
 *
 * Revision 1.1.2.4  2004/07/14 01:39:20  dboreham
 * changes to make newer C++ compilers happy
 *
 * Revision 1.1.1.1  2004/06/03 22:32:45  telackey
 * Initial import Thu Jun  3 15:32:43 PDT 2004
 *
 * Revision 1.1.2.3  2003/09/22 19:38:52  ulfw
 * Update copyright years from 2001 to 2001-2003
 *
 * Revision 1.1.2.2  2001/11/02 23:33:04  richm
 * XXX use new copyright XXX
 *
 * Revision 1.1.2.1  2000/08/07 15:14:28  mwahl
 * rename functions
 *
 *
 */

#include "dialog.h"

extern "C" {
#if defined(__sun) || defined(__hppa) || defined(__osf__) || defined(__linux__) || defined(linux)
#include <netdb.h>
#endif
}


class PrintGuessPreInstall:public DialogManager
{
public:

        PrintGuessPreInstall(int, char **);
        ~PrintGuessPreInstall();

    int init();

    int  start();


  void setParent(void *) { }
  void *parent() const { return 0;}
  void resetLast() { }
  void add (Dialog *) { }
  void addLast(Dialog *) { }
  void clear() { }
  int  cont() { return -1;}


private:
  Bool _reconfig;
  Bool _configured;
};

PrintGuessPreInstall::PrintGuessPreInstall(int argc, char **argv) : _reconfig(False)
{
   setInstallMode(Interactive);
   setInstallType(Typical);
   _configured = False;

   /* getOptions(argc, argv); */

}

PrintGuessPreInstall::~PrintGuessPreInstall()
{
  
}

int PrintGuessPreInstall::init()
{
  return 0;
}

int PrintGuessPreInstall::start()
{
  const char *hno = InstUtil::guessHostname();
  printf("hostname: %s\n",hno ? hno : "<unknown>");
  if (hno) {
#if defined(__sun) || defined(__hppa) || defined(__osf__) || defined(__linux__) || defined(linux)
	static char test_host[BIG_BUF] = {0};
	struct hostent *hp;
	
	strcpy(test_host,hno);
	hp = gethostbyname(test_host);
	if (hp == NULL) {
	  printf("addressable: no\n");
	} else {
	  printf("addressable: yes\n");
	}
#endif
  }
  const char *dno = InstUtil::guessDomain();
  printf("domain: %s\n",dno ? dno : "<unknown>");
  return 0;
}



int main(int argc,char **argv)
{
  PrintGuessPreInstall program(argc,argv);

  int err = program.init();
  if (!err) {
    err = program.start();
  } 
  return err;
  
}