📄 main.c
字号:
/* * Copyright (C) 2008 dhewg, #wiidev efnet * based on code by: * Copyright (C) 2006 Mike Melanson (mike at multimedia.cx) * Copyright (C) 2005 Janusz Dziemidowicz (rraptorr@nails.eu.org) * * this file is part of wiifuse * http://wiibrew.org/index.php?title=Wiifuse * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <fuse.h>#include "global.h"#include "shared.h"#include "io.h"#include "fs_tree.h"#include "fs_client.h"#include "image.h"#include "client.h"int main (int argc, char **argv) { int i, ret; struct stat st; struct image_file *image = NULL; char *id = NULL; int startarg, nargc; char **nargv; struct fuse_operations fs_ops; verbose_level = 0; if (sizeof (off_t) != 8) { LOG_ERR ("epic fail"); exit (EXIT_FAILURE); } if (argc < 3) { fprintf (stderr, "wiifuse " WIIFUSE_VERSION "\n" "coded by dhewg, #wiidev efnet/blitzed\n\n" "usage: %s [-v] <image file> <mount point> " "[<FUSE options>]\n" " or\n" " %s [-v] -i <identity> <tty device> " "<mount_point> [<FUSE options>]\n\n", argv[0], argv[0]); exit (EXIT_FAILURE); } startarg = 1; for (i = 1; i < argc - 1; ++i) { if (!strcmp (argv[i], "-v")) { verbose_level++; startarg++; continue; } if (!strcmp (argv[i], "-i")) { id = argv[i + 1]; startarg += 2; i++; continue; } break; } if (stat (argv[startarg], &st)) { perror ("stat"); exit (EXIT_FAILURE); } LOG (1, "wiifuse " WIIFUSE_VERSION " - initializing"); if (S_ISCHR (st.st_mode)) { if (id == NULL) { LOG_ERR ("you have to specify an identity"); exit (EXIT_FAILURE); } if (client_init (argv[startarg], id)) exit (EXIT_FAILURE); fs_client_get_ops (&fs_ops); } else { image = image_init (argv[startarg]); if (image == NULL) exit (EXIT_FAILURE); if (image_parse (image)) exit (EXIT_FAILURE); fs_tree_get_ops (&fs_ops); } nargc = argc - startarg; nargv = (char **) malloc (nargc * sizeof (char *)); if (!nargv) { fclose (image->fp); free (image); LOG_ERR ("out of memory"); exit (EXIT_FAILURE); } nargv[0] = argv[0]; for (i = 1; i < nargc; i++) nargv[i] = argv[i + startarg]; LOG (1, "wiifuse " WIIFUSE_VERSION " - running"); ret = fuse_main (nargc, nargv, &fs_ops, image); LOG (1, "wiifuse " WIIFUSE_VERSION " - exiting"); free (nargv); image_deinit (image); client_deinit (); return ret;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -