2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: Options.C /main/4 1996/01/25 15:55:11 rswiston $ */
24 /*******************************************************************
26 * (c) Copyright 1993, 1994 Hewlett-Packard Company
27 * (c) Copyright 1993, 1994 International Business Machines Corp.
28 * (c) Copyright 1993, 1994 Sun Microsystems, Inc.
29 * (c) Copyright 1993, 1994 Novell, Inc.
31 ********************************************************************
32 ****************************<+>*************************************/
36 #if defined(linux) || defined(CSRG_BASED)
44 /**************************************************************
46 * Two options are available for dtsearchpath:
48 * -v Verbose - prints the Search Path environment
49 * variables to standard output.
50 * -u Check User - determines the Search Path for a
52 * -a AutoMount - remove the autmounter's mount point
54 * -csh force Csh style environment set commands
56 * -ksh force Ksh style environment set commands
57 **************************************************************/
63 ) : flags(0), user_id(0), home_dir(0), automountpoint(0)
65 CString Usage ("Usage: dtsearchpath [ -v | -T | -o | -a | -csh | -ksh ] "
66 "[ -u <login-name> ]");
69 for (int i = 1; i < argc; i++) {
70 if (strcmp(argv[i],"-v") == 0)
72 else if (strcmp(argv[i],"-T") == 0)
74 else if (strcmp(argv[i],"-o") == 0)
76 else if (strcmp(argv[i],"-a") == 0)
78 else if (strcmp(argv[i],"-csh") == 0)
80 else if (strcmp(argv[i],"-c") == 0) // for bc with sun version
82 else if (strcmp(argv[i],"-ksh") == 0)
84 else if (strcmp(argv[i],"-u") == 0) {
86 if (++i < argc && argv[i][0] != '-') {
87 user_id = new CString(argv[i]);
88 struct passwd * pwd = getpwnam(user_id->data());
89 home_dir = new CString(pwd->pw_dir);
92 fprintf(stderr, "%s\n",Usage.data());
97 fprintf(stderr, "%s\n",Usage.data());
102 #if defined(hpux) || defined(hpV4)
111 delete automountpoint;
116 void Options::setUserID
118 const CString & login
121 user_id = new CString(login);
124 void Options::setAutoMountPoint
126 const CString & mountpoint
129 if (mountpoint.isNull())
130 automountpoint = new CString("/tmp_mnt");
132 automountpoint = new CString(mountpoint);