static void Main2(char *tmplProject, char *tmplDir, int utFlag, int m2Flag) { char *project = nextArg(); errorCase(!existDir(tmplDir)); // 2bs ? errorCase_m(!lineExp("<1,30,__09AZaz>", project), "不正なプロジェクト名です。"); errorCase_m(existPath(project), "既に存在します。"); createDir(project); copyDir(tmplDir, project); addCwd(project); { coExecute("qq -f"); RenamePaths(tmplProject, project); addCwd(existDir(TESTER_PROJ_LDIR) ? TESTER_PROJ_LDIR : project); { ChangeAppIdent("Program.cs"); if(utFlag) { char *csprojFile = xcout("%s.csproj", project); if(existFile(csprojFile)) { ResolveRelHintPath(csprojFile); } memFree(csprojFile); } } unaddCwd(); removeFileIfExist("C:\\Factory\\tmp\\Sections.txt"); // 意図しない検索結果を trep しないように、念のため検索結果をクリア coExecute_x(xcout("Search.exe %s", tmplProject)); coExecute_x(xcout("trep.exe /F %s", project)); // execute("START ."); execute_x(xcout("%s.sln", project)); if(m2Flag) execute("START C:\\Dev\\CSharp\\Module2\\Module2"); } unaddCwd(); }
static void RenamePaths(char *fromPtn, char *toPtn) { autoList_t *paths = ls("."); char *path; char *nPath; uint dirCount; uint index; eraseParents(paths); dirCount = lastDirCount; foreach(paths, path, index) { if(index < dirCount) { addCwd(path); { RenamePaths(fromPtn, toPtn); } unaddCwd(); } nPath = replaceLine(strx(path), fromPtn, toPtn, 1); if(replaceLine_getLastReplacedCount()) { coExecute_x(xcout("REN \"%s\" \"%s\"", path, nPath)); } memFree(nPath); } releaseDim(paths, 1); }
int main(int argc, char **argv) { char *sosuFile = makeTempFile("sosu"); uint64 value; uint64 max = toValue64(nextArg()); errorCase(max < 11); errorCase(max == UINT64MAX); SosuFp = fileOpen(sosuFile, "a+b"); SosuCnt = 0; for(value = 11; value <= max; value += 2) { if((value & 0x3ffe) == 0) cmdTitle_x(xcout("Prime2tox - %I64u", value)); if( value % 3 != 0 && value % 5 != 0 && value % 7 != 0 && IsSosu(value) ) AddSosu(value); } cmdTitle("Prime2tox - Completed"); DispSosu(); fileClose(SosuFp); removeFile(sosuFile); memFree(sosuFile); }
XCTRL_API uchar* get_selection(Display* dpy, char kind, Bool utf8) { uchar *sel_buf=NULL; /* buffer for selection data */ ulong sel_len = 0; /* length of sel_buf */ XEvent evt; /* X Event Structures */ uint context = XCLIB_XCOUT_NONE; Window win = make_selection_window(dpy); Atom seltype = selarg_to_seltype(dpy,kind); Atom target = utf8 ? XA_UTF8_STRING(dpy) : XA_STRING; if (seltype == XA_STRING) { sel_buf = (uchar*) XFetchBuffer(dpy, (int *) &sel_len, 0); } else { while (1) { if (context != XCLIB_XCOUT_NONE) { XNextEvent(dpy, &evt); } xcout(dpy, win, evt, seltype, target, &sel_buf, &sel_len, &context); if (context == XCLIB_XCOUT_FALLBACK) { context = XCLIB_XCOUT_NONE; target = XA_STRING; continue; } if (context == XCLIB_XCOUT_NONE) { break; } } } if (sel_len) { if (seltype == XA_STRING) { uchar*tmp=(uchar*)calloc(sel_len+1,1); strncpy((char*)tmp, (char*)sel_buf, sel_len); XFree(sel_buf); sel_buf=tmp; } sel_buf[sel_len]='\0'; } XDestroyWindow(dpy,win); return sel_buf; }
/* Returns contents of X Selection Buffer * * This code was gratuitously stoled from xclip and modified a wee bit * * n is the size of the clipboard contents * * NOTE: user must free return value!! */ char *xorg_get_buffer(unsigned long *n) { unsigned char *sel_buf; /* buffer for selection data */ unsigned long sel_len = 0; /* length of sel_buf */ unsigned long sel_all = 0; /* allocated size of sel_buf */ Window win; /* Window */ XEvent evt; /* X Event Structures */ unsigned int context = XCLIB_XCOUT_NONE; Atom sseln = XA_PRIMARY; Display *dpy = XOpenDisplay(NULL); win = XCreateSimpleWindow( dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, 0, 0 ); XSelectInput(dpy, win, PropertyChangeMask); do { /* only get an event if xcout() is doing something */ /* We have an if here because it context == XCLIB_XCOUT_NONE * first time through */ if (context != XCLIB_XCOUT_NONE) XNextEvent(dpy, &evt); /* fetch the selection, or part of it */ xcout( dpy, win, evt, sseln, &sel_buf, &sel_len, &context ); /* only continue if xcout() is doing something if (context == XCLIB_XCOUT_NONE) break; */ } while (context != XCLIB_XCOUT_NONE); if (sel_len == 0) { sel_buf = NULL; } *n = sel_len; XCloseDisplay(dpy); return sel_buf; }
int main(int argc, char **argv) { ServerDomain = nextArg(); ServerPort = toValue(nextArg()); MutexName = nextArg(); StartEventName = nextArg(); AnswerEventName = nextArg(); ParamsFile = nextArg(); AnswerFile = nextArg(); errorCase(isEmptyJTkn(ServerDomain)); errorCase(ServerPort < 1 || 0xffff < ServerPort); errorCase(isEmptyJTkn(MutexName)); errorCase(isEmptyJTkn(StartEventName)); errorCase(isEmptyJTkn(AnswerEventName)); errorCase(isEmptyJTkn(ParamsFile)); errorCase(isEmptyJTkn(AnswerFile)); MutexHandle = mutexOpen(MutexName); StartEventHandle = eventOpen(StartEventName); AnswerEventHandle = eventOpen(AnswerEventName); StopAppEventHandle = eventOpen_x(xcout("cerulean.charlotte Factory Requester stop app event object %s %u", c_md5_makeHexHashLine(ServerDomain), ServerPort)); if(argIs("/T")) { Serializer = TextFltr; Deserializer = TextFltr; } if(argIs("/TS") || argIs("/TP")) { Serializer = TextFltr; } if(argIs("/TD") || argIs("/TA")) { Deserializer = TextFltr; } if(argIs("/S")) { eventSet(StopAppEventHandle); } else if(argIs("/1")) { error(); // todo: request at once } else { MainLoop(); } handleClose(MutexHandle); handleClose(StartEventHandle); handleClose(AnswerEventHandle); handleClose(StopAppEventHandle); }
static int doOut(Window win) { Atom sel_type = None; unsigned char *sel_buf; /* buffer for selection data */ unsigned long sel_len = 0; /* length of sel_buf */ XEvent evt; /* X Event Structures */ unsigned int context = XCLIB_XCOUT_NONE; if (sseln == XA_STRING) sel_buf = (unsigned char *) XFetchBuffer(dpy, (int *) &sel_len, 0); else { while (1) { /* only get an event if xcout() is doing something */ if (context != XCLIB_XCOUT_NONE) XNextEvent(dpy, &evt); /* fetch the selection, or part of it */ xcout(dpy, win, evt, sseln, target, &sel_type, &sel_buf, &sel_len, &context); if (context == XCLIB_XCOUT_BAD_TARGET) { if (target == XA_UTF8_STRING(dpy)) { /* fallback is needed. set XA_STRING to target and restart the loop. */ context = XCLIB_XCOUT_NONE; target = XA_STRING; continue; } else { /* no fallback available, exit with failure */ char *atom_name = XGetAtomName(dpy, target); fprintf(stderr, "Error: target %s not available\n", atom_name); XFree(atom_name); return EXIT_FAILURE; } } /* only continue if xcout() is doing something */ if (context == XCLIB_XCOUT_NONE) break; } } if (sel_len) { /* only print the buffer out, and free it, if it's not * empty */ printSelBuf(stdout, sel_type, sel_buf, sel_len); if (sseln == XA_STRING) XFree(sel_buf); else free(sel_buf); } return EXIT_SUCCESS; }
static void OutputSaveData(void) { char *fileText = strx(SIGNATURE NEW_LINE); autoBlock_t *fileData; fileText = addLine_x(fileText, xcout("%u,%u", StageNo, HiScore)); if(ExtraOpened) fileText = addLine(fileText, NEW_LINE EXTRA_OPENED); fileData = ab_makeBlockLine_x(fileText); DoMask(fileData); writeBinary_xx(GetSaveDataFile(), fileData); }
static void AddModule(char *module) { char *projFile; char *srcFile; char *hdrFile; autoList_t *lines; char *line; uint index; errorCase(!lineExp("<__09AZaz>", module)); projFile = GetProjFile(); srcFile = changeExt(module, "cpp"); hdrFile = changeExt(module, "h"); errorCase(existPath(srcFile)); errorCase(existPath(hdrFile)); lines = readLines(projFile); index = FindIndex(lines, 0, "<\t\t >Name=\"ソース ファイル\""); index = FindIndex(lines, index + 1, "<\t\t >>"); insertElement(lines, index + 1, (uint)xcout("<File RelativePath=\".\\%s\"></File>", srcFile)); index = FindIndex(lines, 0, "<\t\t >Name=\"ヘッダー ファイル\""); index = FindIndex(lines, index + 1, "<\t\t >>"); insertElement(lines, index + 1, (uint)xcout("<File RelativePath=\".\\%s\"></File>", hdrFile)); writeLines_xx(projFile, lines); addLine2File_cx("all.h", xcout("#include \"%s\"", hdrFile)); writeOneLine(srcFile, "#include \"all.h\""); createFile(hdrFile); // "all" ならここで all.h は空のファイルになる。 memFree(srcFile); memFree(hdrFile); }
static void ChangeColor(int color) { #if 1 cout("extinct: COLOR %02x\n", color); #else // ”pŽ~ @ 2018.2.28 errorCase(!m_isRange(color, 0x00, 0xff)); if(isFactoryDirEnabled()) { execute_x(xcout("COLOR %02x\n", color)); } else { cout("blocked: COLOR %02x\n", color); } #endif }
int main(int argc, char **argv) { FILE *fp = fileOpen(c_getOutFile("IsJChar_Java.txt"), "wb"); int chr; uint index; MakeEdges(); for(index = 0; index < getCount(Edges); index += 2) { int bgn = (int)getElement(Edges, index); int end = (int)getElement(Edges, index + 1); writeLine_x(fp, xcout("this.add(0x%04x, 0x%04x);", bgn, end)); } fileClose(fp); openOutDir(); }
static void AntiSVN(char *targetDir) { targetDir = makeFullPath(targetDir); if(!ForceMode) { cout("%s\n", targetDir); cout("ANTI-SVN PROCEED? [Any/ESC]\n"); if(clearGetKey() == 0x1b) termination(1); cout("GO!\n"); } for(; ; ) { autoList_t *dirs = lssDirs(targetDir); char *dir; uint index; int found = 0; foreach(dirs, dir, index) { if( !_stricmp(".svn", getLocal(dir)) || !_stricmp("_svn", getLocal(dir)) ) { coExecute_x(xcout("RD /S /Q \"%s\"", dir)); found = 1; } } releaseDim(dirs, 1); if(!found) break; coSleep(1000); } memFree(targetDir); }
static void doOut(Window win) { unsigned char *sel_buf; /* buffer for selection data */ unsigned long sel_len = 0; /* length of sel_buf */ XEvent evt; /* X Event Structures */ unsigned int context = XCLIB_XCOUT_NONE; if (sseln == XA_STRING) sel_buf = (unsigned char *) XFetchBuffer(dpy, (int *) &sel_len, 0); else { while (1) { /* only get an event if xcout() is doing something */ if (context != XCLIB_XCOUT_NONE) XNextEvent(dpy, &evt); /* fetch the selection, or part of it */ xcout(dpy, win, evt, sseln, &sel_buf, &sel_len, &context); /* only continue if xcout() is doing something */ if (context == XCLIB_XCOUT_NONE) break; } } if (sel_len) { /* only print the buffer out, and free it, if it's not * empty */ fwrite(sel_buf, sizeof(char), sel_len, stdout); if (sseln == XA_STRING) XFree(sel_buf); else free(sel_buf); } }
int main (int argc, char *argv[]) { /* Declare variables */ char *seltxt; /* selection text string */ unsigned long stelems = 0; /* number of used elements in seltxt */ unsigned long stalloc = 0; /* size of seltxt */ Window win; /* Window */ XEvent evt; /* X Event Structures */ int dloop = 0; /* done loops counter */ pid_t pid; /* child pid if forking */ /* parse command line options */ doOptMain(argc, argv); /* Connect to the X server. */ if ( (dpy = XOpenDisplay(sdisp)) ) { /* successful */ if (fverb == OVERBOSE) fprintf(stderr, "Connected to X server.\n"); } else { /* couldn't connect to X server. Print error and exit */ errxdisplay(sdisp); } /* parse selection command line option */ doOptSel(argc, argv); /* Create a window to trap events */ win = XCreateSimpleWindow( dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, 0, 0 ); /* get events about property changes */ XSelectInput(dpy, win, PropertyChangeMask); if (fdiri) { /* in mode */ stalloc = 16; /* Reasonable ballpark figure */ seltxt = xcmalloc(stalloc); /* Put chars into inc from stdin or files until we hit EOF */ do { if (fil_number == 0) { /* read from stdin if no files specified */ fil_handle = stdin; } else { /* open the current file for reading */ if ( (fil_handle = fopen( fil_names[fil_current], "r" )) == NULL ) { errperror( argv[0], ": ", fil_names[fil_current] ); exit(EXIT_FAILURE); } else { /* file opened successfully. Print * message (verbose mode only). */ if (fverb == OVERBOSE) fprintf( stderr, "Reading %s...\n", fil_names[fil_current] ); } } fil_current++; while (!feof(fil_handle)) { int n = 0; /* If in is full (used elems = * allocated elems) */ if (stelems == stalloc) { /* double the number of * allocated elements */ stalloc *= 2 + 1; seltxt = (char *)xcrealloc( seltxt, stalloc * sizeof(char) ); } n = fread( seltxt + stelems, 1, stalloc - stelems, fil_handle ); stelems += n; seltxt[stelems] = '\0'; } } while (fil_current < fil_number); /* if there are no files being read from (i.e., input * is from stdin not files, and we are in filter mode, * spit all the input back out to stdout */ if ((fil_number == 0) && ffilt) printf(seltxt); /* take control of the selection so that we receive * SelectionRequest events from other windows */ XSetSelectionOwner(dpy, sseln, win, CurrentTime); /* fork into the background, exit parent process if we * are in silent mode */ if (fverb == OSILENT) { pid = fork(); /* exit the parent process; */ if (pid) exit(EXIT_SUCCESS); } /* print a message saying what we're waiting for */ if (fverb > OSILENT) { if (sloop == 1) fprintf( stderr, "Waiting for one selection request.\n" ); if (sloop < 1) fprintf( stderr, "Waiting for selection requests, Control-C to quit\n" ); if (sloop > 1) fprintf( stderr, "Waiting for %i selection requests, Control-C to quit\n", sloop ); } /* loop and wait for the expected number of * SelectionRequest events */ while (dloop < sloop || sloop < 1) { /* print messages about what we're waiting for * if not in silent mode */ if (fverb > OSILENT) { if (sloop > 1) fprintf( stderr, " Waiting for selection request %i of %i.\n", dloop + 1, sloop ); if (sloop == 1) fprintf( stderr, " Waiting for a selection request.\n" ); if (sloop < 1) fprintf( stderr, " Waiting for selection request number %i\n", dloop + 1 ); } /* wait for a SelectionRequest event */ while (1) { XNextEvent(dpy, &evt); /* request for selection, process * with xcin() */ if (evt.type == SelectionRequest) break; /* lost ownership of selection, exit */ if (evt.type == SelectionClear) exit(EXIT_SUCCESS); } /* recieved request, send response with xcin(). * xcin() will return a true value if it * received a SelectionClear, in which case * xclip should exit */ if (xcin(dpy, win, evt, seltxt)) exit(EXIT_SUCCESS); dloop++; /* increment loop counter */ } } else { /* out mode - get selection, print it, free the memory */ seltxt = xcout(dpy, win, sseln); printf(seltxt); free(seltxt); } /* Disconnect from the X server */ XCloseDisplay(dpy); /* exit */ return(EXIT_SUCCESS); }
int main (int argc, char *argv[]) { /* Declare variables */ unsigned char *sel_buf; /* buffer for selection data */ unsigned long sel_len = 0; /* length of sel_buf */ unsigned long sel_all = 0; /* allocated size of sel_buf */ Window win; /* Window */ XEvent evt; /* X Event Structures */ int dloop = 0; /* done loops counter */ pid_t pid; /* child pid if forking */ /* set up option table. I can't figure out a better way than this to * do it while sticking to pure ANSI C. The option and specifier * members have a type of volatile char *, so they need to be allocated * by strdup or malloc, you can't set them to a string constant at * declare time, this is note pure ANSI C apparently, although it does * work with gcc */ /* loop option entry */ opt_tab[0].option = xcstrdup("-loops"); opt_tab[0].specifier = xcstrdup(".loops"); opt_tab[0].argKind = XrmoptionSepArg; opt_tab[0].value = (XPointer) NULL; /* display option entry */ opt_tab[1].option = xcstrdup("-display"); opt_tab[1].specifier = xcstrdup(".display"); opt_tab[1].argKind = XrmoptionSepArg; opt_tab[1].value = (XPointer) NULL; /* selection option entry */ opt_tab[2].option = xcstrdup("-selection"); opt_tab[2].specifier = xcstrdup(".selection"); opt_tab[2].argKind = XrmoptionSepArg; opt_tab[2].value = (XPointer) NULL; /* filter option entry */ opt_tab[3].option = xcstrdup("-filter"); opt_tab[3].specifier = xcstrdup(".filter"); opt_tab[3].argKind = XrmoptionNoArg; opt_tab[3].value = (XPointer) xcstrdup(ST); /* in option entry */ opt_tab[4].option = xcstrdup("-in"); opt_tab[4].specifier = xcstrdup(".direction"); opt_tab[4].argKind = XrmoptionNoArg; opt_tab[4].value = (XPointer) xcstrdup("I"); /* out option entry */ opt_tab[5].option = xcstrdup("-out"); opt_tab[5].specifier = xcstrdup(".direction"); opt_tab[5].argKind = XrmoptionNoArg; opt_tab[5].value = (XPointer) xcstrdup("O"); /* version option entry */ opt_tab[6].option = xcstrdup("-version"); opt_tab[6].specifier = xcstrdup(".print"); opt_tab[6].argKind = XrmoptionNoArg; opt_tab[6].value = (XPointer) xcstrdup("V"); /* help option entry */ opt_tab[7].option = xcstrdup("-help"); opt_tab[7].specifier = xcstrdup(".print"); opt_tab[7].argKind = XrmoptionNoArg; opt_tab[7].value = (XPointer) xcstrdup("H"); /* silent option entry */ opt_tab[8].option = xcstrdup("-silent"); opt_tab[8].specifier = xcstrdup(".olevel"); opt_tab[8].argKind = XrmoptionNoArg; opt_tab[8].value = (XPointer) xcstrdup("S"); /* quiet option entry */ opt_tab[9].option = xcstrdup("-quiet"); opt_tab[9].specifier = xcstrdup(".olevel"); opt_tab[9].argKind = XrmoptionNoArg; opt_tab[9].value = (XPointer) xcstrdup("Q"); /* verbose option entry */ opt_tab[10].option = xcstrdup("-verbose"); opt_tab[10].specifier = xcstrdup(".olevel"); opt_tab[10].argKind = XrmoptionNoArg; opt_tab[10].value = (XPointer) xcstrdup("V"); /* parse command line options */ doOptMain(argc, argv); /* Connect to the X server. */ if ( (dpy = XOpenDisplay(sdisp)) ) { /* successful */ if (fverb == OVERBOSE) fprintf(stderr, "Connected to X server.\n"); } else { /* couldn't connect to X server. Print error and exit */ errxdisplay(sdisp); } /* parse selection command line option */ doOptSel(); /* Create a window to trap events */ win = XCreateSimpleWindow( dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, 0, 0 ); /* get events about property changes */ XSelectInput(dpy, win, PropertyChangeMask); if (fdiri) { /* in mode */ sel_all = 16; /* Reasonable ballpark figure */ sel_buf = xcmalloc(sel_all * sizeof(char)); /* Put chars into inc from stdin or files until we hit EOF */ do { if (fil_number == 0) { /* read from stdin if no files specified */ fil_handle = stdin; } else { if ( (fil_handle = fopen( fil_names[fil_current], "r" )) == NULL ) { errperror( 3, argv[0], ": ", fil_names[fil_current] ); exit(EXIT_FAILURE); } else { /* file opened successfully. Print * message (verbose mode only). */ if (fverb == OVERBOSE) fprintf( stderr, "Reading %s...\n", fil_names[fil_current] ); } } fil_current++; while (!feof(fil_handle)) { /* If sel_buf is full (used elems = * allocated elems) */ if (sel_len == sel_all) { /* double the number of * allocated elements */ sel_all *= 2; sel_buf = (unsigned char *)xcrealloc( sel_buf, sel_all * sizeof(char) ); } sel_len += fread( sel_buf + sel_len, sizeof(char), sel_all - sel_len, fil_handle ); } } while (fil_current < fil_number); /* if there are no files being read from (i.e., input * is from stdin not files, and we are in filter mode, * spit all the input back out to stdout */ if ((fil_number == 0) && ffilt) fwrite(sel_buf, sizeof(char), sel_len, stdout); /* take control of the selection so that we receive * SelectionRequest events from other windows */ XSetSelectionOwner(dpy, sseln, win, CurrentTime); /* fork into the background, exit parent process if we * are in silent mode */ if (fverb == OSILENT) { pid = fork(); /* exit the parent process; */ if (pid) exit(EXIT_SUCCESS); } /* print a message saying what we're waiting for */ if (fverb > OSILENT) { if (sloop == 1) fprintf( stderr, "Waiting for one selection request.\n" ); if (sloop < 1) fprintf( stderr, "Waiting for selection requests, Control-C to quit\n" ); if (sloop > 1) fprintf( stderr, "Waiting for %i selection requests, Control-C to quit\n", sloop ); } /* loop and wait for the expected number of * SelectionRequest events */ while (dloop < sloop || sloop < 1) { /* print messages about what we're waiting for * if not in silent mode */ if (fverb > OSILENT) { if (sloop > 1) fprintf( stderr, " Waiting for selection request %i of %i.\n", dloop + 1, sloop ); if (sloop == 1) fprintf( stderr, " Waiting for a selection request.\n" ); if (sloop < 1) fprintf( stderr, " Waiting for selection request number %i\n", dloop + 1 ); } /* wait for a SelectionRequest event */ while (1) { XNextEvent(dpy, &evt); /* request for selection, process * with xcin() */ if (evt.type == SelectionRequest) break; /* lost ownership of selection, exit */ if (evt.type == SelectionClear) exit(EXIT_SUCCESS); } /* recieved request, send response with xcin(). * xcin() will return a true value if it * received a SelectionClear, in which case * xclip should exit */ if (xcin(dpy, evt, sel_buf, sel_len)) exit(EXIT_SUCCESS); dloop++; /* increment loop counter */ } } else { /* out mode - get selection, print it, free the memory */ xcout(dpy, win, sseln, &sel_buf, &sel_len); if (sel_len) { /* only print the buffer out, and free it, if it's not * empty */ fwrite(sel_buf, sizeof(char), sel_len, stdout); free(sel_buf); } } /* Disconnect from the X server */ XCloseDisplay(dpy); /* exit */ return(EXIT_SUCCESS); }
#include "C:\Factory\Common\all.h" int main(int argc, char **argv) { autoList_t *paths = readLines(FOUNDLISTFILE); char *path; uint index; char *outDir = makeFreeDir(); foreach(paths, path, index) { char *outPath = toCreatablePath(combine(outDir, getLocal(path)), getCount(paths) + 10); cout("< %s\n", path); cout("> %s\n", outPath); copyPath(path, outPath); memFree(outPath); } execute_x(xcout("START %s", outDir)); memFree(outDir); }
int main(int argc, char **argv) { int correctAddDelete = 0; if(argIs("/CAD")) // Correct Add Delete { correctAddDelete = 1; } if(argIs("/M")) // Make sabun { char *beforeDir; char *afterDir; char *outDir; char *sabunFile; cout("+----------------------------+\n"); cout("| 変更前のフォルダをドロップ |\n"); cout("+----------------------------+\n"); beforeDir = dropDir(); cout("+----------------------------+\n"); cout("| 変更後のフォルダをドロップ |\n"); cout("+----------------------------+\n"); afterDir = dropDir(); outDir = makeTempDir(NULL); sabunFile = combine(outDir, "Sabun.bin"); makeSabun(sabunFile, beforeDir, afterDir, correctAddDelete); execute_x(xcout("START %s", outDir)); memFree(beforeDir); memFree(afterDir); memFree(outDir); memFree(sabunFile); } else // 差分適用 { char *targetDir; char *sabunFile; cout("+----------------------------------+\n"); cout("| 対象フォルダをドロップ |\n"); cout("| * このフォルダの中身を更新します |\n"); cout("+----------------------------------+\n"); targetDir = dropDir(); cout("+------------------------+\n"); cout("| 差分ファイルをドロップ |\n"); cout("+------------------------+\n"); sabunFile = dropFile(); cout("\n"); cout("対象フォルダを変更します。\n"); cout("処理を開始してからはキャンセル出来ません。\n"); cout("続行するにはエンターキーを押してね。\n"); if(clearGetKey() == 0x0d) { cout("\n"); cout("アップデートしています..."); if(sabunUpdate(sabunFile, targetDir) == 0) // ? アップデート対象外だった。 { cout("\r"); cout("+----------------------------+\n"); cout("| エラー/アップデート対象外 |\n"); cout("+----------------------------+\n"); } else cout("\rアップデートは完了しました。\n"); clearWaitKey(5000); // 見えるように } memFree(targetDir); memFree(sabunFile); } }