📄 main.c
字号:
/*************************************************************************** file : main.c begin : Sat Dec 25 21:51:55 CET 1999 copyright : (C) 1999 by Henrik Witt-Hansen email : bean@daisy.net ***************************************************************************//*************************************************************************** * * * 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. * * * ***************************************************************************//*base configuration*/#ifdef HAVE_CONFIG_H#include <config.h>#endif/*standard includes*/#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>/*local headers*/#include "sitback.h"/*global error code, defined extern in sitback.h*/int errcode=0;int test( int argc, char **argv );extern void __dbg(char *p,...);/******************************************************************** int main(int argc,char **argv) Main entry function arguments: Standard main() arguments return: 0 on success error code on error. See sitback.h to get the course of error********************************************************************/int main(int argc, char *argv[]){ int rc; /* Preamble */ fprintf(stdout,"Sitback %s, build %s %s\n",VERSION,__DATE__,__TIME__); /*Initialize. Read command-line and backup/restore script*/ if(Init(argc,argv)) { log("Error reported during initialization. Error %d",errcode); Shutdown(); return errcode; } /*what to do*/ switch(conf__operation) { case BACKUP: rc=Backup(); break; case RESTORE: rc=Restore(); break; case LIST: rc=List(); break; default: printf("Try sitback --help\n"); Shutdown(); exit(254); } /*check if there were any errors. errcode contains the error-code and will be returned to the shell*/ if(rc!=0) { if(conf__mode!=DAEMON) UI__OkDlg("\nUnable to continue.."); log("Error %d reported from operation.",errcode); Shutdown(); } else { /* normal cleanup. */ if(conf__mode!=DAEMON) UI__OkDlg("\nOperation complete.."); Shutdown(); } /*Sitback shutdown. The final daemon procees dont exit this way, but parent process before the daemon process does..*/ if(conf__mode!=DAEMON) { fprintf(stdout,"Thank you for using Sitback %s\n\n",VERSION); fprintf(stdout," Newest version of Sitback is available from the sitback website\n\n"); fprintf(stdout," http://www.mrbean.dk\n\n"); fprintf(stdout," Send bugs, comments or ideas to bean@mrbean.dk\n\n"); } /*return the error-code to the shell.. Error codes and their meanings is listed in sitback.h*/ return errcode;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -