From f257a554d387eae1e8a99262eb478200138970de Mon Sep 17 00:00:00 2001 From: Bob Zieman Date: Wed, 20 Oct 1993 10:41:31 +0000 Subject: [PATCH] next version --- src/util/apCreateShadow.c | 13 +++++++++---- src/util/apStatusSync.c | 30 +++++++++++++++++++++--------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/util/apCreateShadow.c b/src/util/apCreateShadow.c index b253e1eb9..17c94f73f 100644 --- a/src/util/apCreateShadow.c +++ b/src/util/apCreateShadow.c @@ -1,11 +1,13 @@ /* * apCreateShadow.c - * + * todo - if symbolic link is relative + * - it should be the same as the one in the source area */ #include #include #include +#include #include #include #include @@ -103,6 +105,7 @@ createLink() the symbolic link). Either name may be an arbitrary path name; the files need not be on the same file system. */ +if ( access(dpath,R_OK|F_OK)) { if ((symlink(spath, dpath)) != 0) { printf("\n####################################################\n"); printf("createLink: symlink failure: errno=%d\nspath=%s\n\tdpath=%s\n" @@ -110,6 +113,7 @@ createLink() printf("####################################################\n"); } } +} /**************************************************************************** DIRWALK applies a function to each file in a directory ****************************************************************************/ @@ -142,7 +146,7 @@ dirwalk(dir, fcn) static void Usage() { - printf("\nUsage:\t%s \n", progName); + printf("\nUsage:\t%s \n", progName); } /**************************************************************************** @@ -332,12 +336,13 @@ procDirEntries(name) strcpy(dpath, dest_base); strcat(dpath, "/"); strcat(dpath, name); +if ( access(dpath,R_OK|F_OK)) { if ((mkdir(dpath, 0755)) != 0) { printf("####################################################\n"); - printf("procDirEntries: Can't mkdir %s\n", dpath); + printf("procDirEntries: Can't mkdir %s - errno=%d\n", dpath,errno); printf("####################################################\n"); - exit(1); } +} dirwalk(name, procDirEntries); } return; diff --git a/src/util/apStatusSync.c b/src/util/apStatusSync.c index b8bea851e..899bc3bdf 100644 --- a/src/util/apStatusSync.c +++ b/src/util/apStatusSync.c @@ -1,7 +1,11 @@ + /* +TODO +change to execute permissions on apRemoveScript + TODO - if the apRemoveScript is empty - skip the postamble - add directions for redoing apCreateShadow + * APSTATUSSYNC.C * @@ -61,6 +65,7 @@ main(argc, argv) else verbose = FALSE; +fprintf(stdout, "\n\napStatusSync: Status Started ==>> ==>> ==>> ==>> ==>>\n"); if ((initScriptFile()) != 0) return (-1); if ((processTopDir()) != 0) @@ -318,7 +323,7 @@ dirwalk(dir, fcn) strcat(name, "/"); strcat(name, dir); if ((stat(name, &sb) != 0)) { - sprintf(buffer, "\t#/bin/rm -fr ./%s\t#private directory\n", dir); + sprintf(buffer, "#/bin/rm -fr ./%s\t#private directory\n", dir); if ((appendToScriptFile(buffer)) < 0) return (-1); } @@ -391,7 +396,7 @@ initScriptFile() } if ((stat(pScriptFileName, &sb) == 0)) { fprintf(stderr, - "\napStatusSync: - file: '%s' already exists\n", pScriptFileName); + "\napStatusSync: - The previous output file '%s' still exists\n", pScriptFileName); fprintf(stderr, "Please remove the file and try again\n"); fprintf(stderr, @@ -414,6 +419,8 @@ closeScriptFile() fprintf(stderr, "apStatusSync: closeScriptFile() - %s not open\n", pScriptFileName); return (-1); } +chmod("apRemoveScript",0755); +close (apRemoveScriptFp); return(0); } /**************************************************************************** @@ -452,11 +459,16 @@ wrt_buf(fp, pstring, pfile) } postAmble() { -fprintf(stdout,"\napStatusSync completed\n"); -fprintf(stdout,"Please review the 'apRemoveScript' remove script.\n"); -fprintf(stdout,"Enable the appropriate unix commands by\n"); -fprintf(stdout,"removing the leading '#' character from the line\n"); -fprintf(stdout,"Then invoke the following unix command:\n"); +fprintf(stdout,"\n\napStatusSync: ============>> ==>> ==>> ==>> Status Completed \n"); +fprintf(stdout,"When you are satisfied with the above status - continue\n"); +fprintf(stdout," else - correct the situation and run apStatusSync again\n"); +fprintf(stdout,"\ncontinue below\n"); +fprintf(stdout,"\nNow please review the contents of the remove script file 'apRemoveScript'.\n"); +fprintf(stdout,"Enable each appropriate unix command by removing the leading '#'\n"); +fprintf(stdout,"character from the line\n"); +fprintf(stdout,"Then invoke the following unix commands:\n"); fprintf(stdout,"\n"); -fprintf(stdout,"%%\tsh apRemoveScript\n"); +fprintf(stdout,"%%\tapRemoveScript\n"); +fprintf(stdout,"\tfollowed by\n"); +fprintf(stdout,"%%\tapCreateShadow\n"); }