mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
97 lines
1.7 KiB
C
97 lines
1.7 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <termios.h>
|
|
#include <unistd.h>
|
|
|
|
#include <openssl/ssl.h>
|
|
|
|
#include "mfshell.h"
|
|
#include "console.h"
|
|
#include "private.h"
|
|
#include "cfile.h"
|
|
#include "strings.h"
|
|
#include "signals.h"
|
|
|
|
static void
|
|
mfshell_run(mfshell_t *mfshell);
|
|
|
|
int term_resized = 0;
|
|
int term_height = 0;
|
|
int term_width = 0;
|
|
|
|
int main(int argc,char **argv)
|
|
{
|
|
extern int term_height;
|
|
extern int term_width;
|
|
mfshell_t *mfshell;
|
|
char *server = "www.mediafire.com";
|
|
size_t len;
|
|
int retval;
|
|
|
|
SSL_library_init();
|
|
|
|
retval = console_get_metrics(&term_height,&term_width);
|
|
if(retval != 0)
|
|
{
|
|
// maybe the system doesn't support it. we'll guess at it.
|
|
term_height = 25;
|
|
term_width = 80;
|
|
}
|
|
|
|
sig_install_SIGWINCH();
|
|
|
|
if(argc > 1)
|
|
{
|
|
if(argv[1] != NULL) server = argv[1];
|
|
}
|
|
|
|
mfshell = mfshell_create(35860,
|
|
"2c6dq0gb2sr8rgsue5a347lzpjnaay46yjazjcjg",server);
|
|
|
|
printf("\n\r");
|
|
mfshell->auth(mfshell);
|
|
|
|
// begin shell mode
|
|
mfshell_run(mfshell);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static void
|
|
mfshell_run(mfshell_t *mfshell)
|
|
{
|
|
char *cmd = NULL;
|
|
size_t len;
|
|
int abort = 0;
|
|
int retval;
|
|
|
|
do
|
|
{
|
|
printf("\n\rmfshell > ");
|
|
|
|
getline(&cmd,&len,stdin);
|
|
string_chomp(cmd);
|
|
|
|
printf("\n\r");
|
|
|
|
if(strcmp(cmd,"exit") == 0)
|
|
{
|
|
abort = 1;
|
|
continue;
|
|
}
|
|
|
|
if(strcmp(cmd,"quit") == 0)
|
|
{
|
|
abort = 1;
|
|
continue;
|
|
}
|
|
|
|
retval = mfshell->exec(mfshell,cmd);
|
|
free(cmd);
|
|
cmd = NULL;
|
|
}
|
|
while(abort == 0);
|
|
|
|
return;
|
|
}
|