mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
initial commit - import mediafire-shell sources
This commit is contained in:
34
cmd_lcd.c
Normal file
34
cmd_lcd.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "command.h"
|
||||
#include "private.h"
|
||||
#include "mfshell.h"
|
||||
|
||||
int
|
||||
mfshell_cmd_lcd(mfshell_t *mfshell,const char *dir)
|
||||
{
|
||||
int retval;
|
||||
|
||||
if(mfshell == NULL) return -1;
|
||||
if(dir == NULL) return -1;
|
||||
|
||||
if(strlen(dir) < 1) return -1;
|
||||
|
||||
retval = chdir(dir);
|
||||
if(retval == 0)
|
||||
{
|
||||
if(mfshell->local_working_dir != NULL)
|
||||
{
|
||||
free(mfshell->local_working_dir);
|
||||
mfshell->local_working_dir = NULL;
|
||||
}
|
||||
|
||||
mfshell->local_working_dir = strdup(dir);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user