1 /* Print working directory. */
2 /* Copyright (C) 2004-2005, 2007-2009, 2011, 2020 R. Bernstein
3 <rocky@gnu.org>
4 This file is part of GNU Make (remake variant).
5 
6 GNU Make is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU Make is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU Make; see the file COPYING.  If not, write to
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA.  */
20 static debug_return_t
dbg_cmd_pwd(char * psz_args)21 dbg_cmd_pwd(char *psz_args)
22 {
23   if (!psz_args || 0==strlen(psz_args)) {
24     char wd[300];
25     if (NULL == getcwd (wd, sizeof(wd))) {
26       printf (_("cannot get current directory %s\n"), strerror(errno));
27     } else {
28       printf (_("Working directory %s.\n"), wd);
29     }
30   } else {
31     printf(_("The \"pwd\" command does not take an argument: %s\n"), psz_args);
32   }
33 
34   return debug_readloop;
35 }
36 
37 static void
dbg_cmd_pwd_init(unsigned int c)38 dbg_cmd_pwd_init(unsigned int c)
39 {
40   short_command[c].func = &dbg_cmd_pwd;
41   short_command[c].use = _("pwd");
42 }
43 
44 /*
45  * Local variables:
46  * eval: (c-set-style "gnu")
47  * indent-tabs-mode: nil
48  * End:
49  */
50