2 * client cmdline interface command "lcd" for libcaptive
3 * Copyright (C) 2003 Jan Kratochvil <project-captive@jankratochvil.net>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; exactly version 2 of June 1991 is required
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <glib/gmessages.h>
23 #include <glib/gerror.h>
25 #include <glib/gprintf.h>
28 #include <glib/gstrfuncs.h>
29 #include <glib/gutils.h>
30 #include <glib/gmem.h>
32 #include "cmd_lcd.h" /* self */
35 const gchar *cmdline_cwd;
38 GQuark cmdline_cmd_lcd_error_quark(void)
43 r=g_quark_from_static_string("cmdline-cmd-lcd");
49 const struct poptOption cmd_lcd_table[]={
55 void cmd_lcd(const char **cmd_argv,GError **errp)
59 g_return_if_fail(!errp || !*errp);
62 if (chdir(cmd_argv[0])) {
63 g_set_error(errp,CMDLINE_CMD_LCD_ERROR,CMDLINE_CMD_LCD_ERROR_CANNOT_CHANGE_HOSTOS_DIRECTORY,
64 _("Cannot change Host-OS directory to '%s': %s"),cmd_argv[0],g_strerror(errno));
69 currentdir=g_get_current_dir();
70 g_printf("Host-OS CWD: %s\n",currentdir);