git » fp-git.git » commit 1946e49

English language support for new version texts. Moved some defines.

author ecalot
2005-12-22 01:51:55 UTC
committer ecalot
2005-12-22 01:51:55 UTC
parent 72044e50b364f35caf816d4bc928d6473d5e32c0

English language support for new version texts. Moved some defines.

PR/src/console/main.c +10 -8
PR/src/include/common.h +1 -0
PR/src/include/en.lang.pr.h +23 -13
PR/src/lib/xml/tree.c +1 -2
PR/src/lib/xml/unknown.c +1 -2

diff --git a/PR/src/console/main.c b/PR/src/console/main.c
index 5ea64ee..6680af0 100644
--- a/PR/src/console/main.c
+++ b/PR/src/console/main.c
@@ -180,16 +180,18 @@ int main (int argc, char **argv) {
 
 		switch (c) {
 		case -20: /* import from more than one directory */
-			fprintf(stderr,"You may select one directory to export all dat files or specifiy dat files.\nBoth actions are not allowed.\n");
+			fprintf(stderr,PR_TEXT_ERROR_ONE_DIR);
 			break;
 		case -21: /* import with recursive flag */
-			fprintf(stderr,"Recursive flag must not be set when you import files\n");
+			fprintf(stderr,PR_TEXT_ERROR_IMPORT_NORECURSE);
 			break;
 		case -22: /* no files selected */
-			fprintf(stderr,"No files selected\n");
+			fprintf(stderr,PR_TEXT_ERROR_NO_FILES_SEL);
 			break;
-		case 0:
-			unknownLogStart(NULL,optionflag,extension);
+		case 0: {
+			char  unknownFile[MAX_FILENAME_SIZE];
+			sprintf(unknownFile,"%s/" RES_XML_UNKNOWN_PATH "/" RES_XML_UNKNOWN_XML,dirName);
+			unknownLogStart(unknownFile,optionflag,extension);
 			while ((file=fileDirGetFile(&files,&datfile))) {
 				const char* dat;
 				if (datFileName)
@@ -220,7 +222,7 @@ int main (int argc, char **argv) {
 					fprintf(outputStream,PR_TEXT_TASK_CLASSIFY,file);
 					result=prClassifyDat(file);
 					if (result>0) {
-						fprintf(outputStream,"Result: Detected as %s (%d)\n",types[result],result);
+						fprintf(outputStream,PR_TEXT_RESULT_DETECTED,types[result],result);
 					} else {
 						fprintf(outputStream,PR_TEXT_RESULT,errors[-result],result);
 					}
@@ -230,9 +232,9 @@ int main (int argc, char **argv) {
 			}
 			fprintf(outputStream,"\n");
 			unknownLogStop();
-			break;
+			} break;
 		default:
-			fprintf(stderr,"Error, check the xml file\n");
+			fprintf(stderr,PR_TEXT_ERROR_XML_FILE);
 			break;
 		}
 	}
diff --git a/PR/src/include/common.h b/PR/src/include/common.h
index be7a227..418326b 100644
--- a/PR/src/include/common.h
+++ b/PR/src/include/common.h
@@ -75,6 +75,7 @@ common.h: Princed Resources : Defines and prototypes common to all PR code
 /* Default Files */
 #define RES_XML_UNKNOWN_XML      "unknown.xml"
 #define RES_XML_RESOURC_XML      "resources.xml"
+#define RES_XML_UNKNOWN_PATH     "unknown"
 
 #define DEFAULT_BACKUP_EXTENSION "bak"
 
diff --git a/PR/src/include/en.lang.pr.h b/PR/src/include/en.lang.pr.h
index be4655c..bd6c756 100644
--- a/PR/src/include/en.lang.pr.h
+++ b/PR/src/include/en.lang.pr.h
@@ -37,13 +37,14 @@ pr.h: Princed Resources : English language strings
 |                           Text Defines                        |
 \***************************************************************/
 
-#define PR_ABOUT                  "Princed resources (PR) "PR_VERSION" "OS"\n"PR_COPY"\n"PR_URL"\n\n"
+#define PR_ABOUT                  "Princed resources (PR) " PR_VERSION " " OS "\n" PR_COPY "\n" PR_URL "\n\n"
 
 #define PR_CGI_TEXT1              "Content-Type:text/html\n\nRunning as a cgi\n"
 #define PR_CGI_TEXT2              "Result: %02d type\n"
 
 #define PR_TEXT_RESULT            "Result: %s (%d)\n"
 #define PR_TEXT_RESULT_ERR        "Result: %d files with errors (%d)\n"
+#define PR_TEXT_RESULT_DETECTED   "Result: Detected as %s (%d)\n"
 
 #define PR_TEXT_FILE_NOT_FOUND    "Result: File or directory '%s' not found\n"
 
@@ -73,23 +74,32 @@ pr.h: Princed Resources : English language strings
 #define PR_TEXT_EXPORT_ERROR      "'%s' has errors, aborting...\n"
 #define PR_TEXT_EXPORT_BMP_WARN   "Warning: Extracted file may be corrupt\n"
 
+#define PR_TEXT_ERROR_IMPORT_NORECURSE "Recursive flag must not be set when you import files\n"
+#define PR_TEXT_ERROR_NO_FILES_SEL "No files selected\n"
+#define PR_TEXT_ERROR_ONE_DIR     "You may select one directory to export all dat files or specifiy dat files.\nBoth actions are not allowed.\n"
+#define PR_TEXT_ERROR_XML_FILE    "Error, check the xml file\n"
+
 /***************************************************************\
 |                        Text Output Arrays                     |
 \***************************************************************/
 
 #define PR_TEXT_ERRORS {\
-"Success",\
-"-1","-2","-3","-4","-5","-6","-7","-8","-9","-10",\
-"-11","-12","-13","-14","-15","-16","-17","-18","-19","-20"}
-
-				/*
-"Error accessing a file",\
-"Memory error in extraction",\
-"Invalid DAT file",\
-"XML Parsing error",\
-"Memory error in parsing",\
-"XML Attribute not recognized",\
-"XML File not found"}*/
+	"Success",\
+	"Extraction error",\
+	"Dat file not found",\
+	"Expected dat file, but a directory was given",\
+	"DAT file reading permission denied",\
+	"DAT file writing permission denied",\
+	"File not found",\
+	"Expected file, but a directory was given",\
+	"File reading permission denied",\
+	"File writing permission denied",\
+	"Invalid DAT file",\
+	"Memory error",\
+	"XML parsing attribute error",\
+	"Cannot open XML file",\
+	"XML parsing error",\
+	"-15","-16","-17","-18","-19","-20"}
 
 #define PR_TEXT_TYPES {\
 NULL,\
diff --git a/PR/src/lib/xml/tree.c b/PR/src/lib/xml/tree.c
index d503099..4fd934a 100644
--- a/PR/src/lib/xml/tree.c
+++ b/PR/src/lib/xml/tree.c
@@ -51,7 +51,6 @@ unknown.c: Princed Resources : Unknown resources handler
 
 /* XML generation defines */
 
-#define RES_XML_UNKNOWN_PATH  "%s/unknown/%s/"
 #define RES_XML_UNKNOWN_FILES "%t%03n.%e"
 
 static struct {
@@ -173,7 +172,7 @@ void getFileName(char* vFileext,const char* vDirExt,const tResource* r,const cha
 		if (!format) format=RES_XML_UNKNOWN_FILES;
 		filename=parseformat(format,r->id.value,r->id.index,getExtDesc(pos),extarray[pos],unknownFile.typeCount[pos],r->id.order,r->desc);
 
-		sprintf(vFileext,RES_XML_UNKNOWN_PATH"%s",vDirExt,vDatFileName,filename);
+		sprintf(vFileext,"%s/"RES_XML_UNKNOWN_PATH"/%s/%s",vDirExt,vDatFileName,filename);
 		unknownLogAppend(vDatFileName,r->id,extarray[pos],r->type,vDirExt,r->palette,vFiledat,optionflag,unknownFile.typeCount[pos],r->flags,filename);
 	} else {
 		/* set filename */
diff --git a/PR/src/lib/xml/unknown.c b/PR/src/lib/xml/unknown.c
index d503099..4fd934a 100644
--- a/PR/src/lib/xml/unknown.c
+++ b/PR/src/lib/xml/unknown.c
@@ -51,7 +51,6 @@ unknown.c: Princed Resources : Unknown resources handler
 
 /* XML generation defines */
 
-#define RES_XML_UNKNOWN_PATH  "%s/unknown/%s/"
 #define RES_XML_UNKNOWN_FILES "%t%03n.%e"
 
 static struct {
@@ -173,7 +172,7 @@ void getFileName(char* vFileext,const char* vDirExt,const tResource* r,const cha
 		if (!format) format=RES_XML_UNKNOWN_FILES;
 		filename=parseformat(format,r->id.value,r->id.index,getExtDesc(pos),extarray[pos],unknownFile.typeCount[pos],r->id.order,r->desc);
 
-		sprintf(vFileext,RES_XML_UNKNOWN_PATH"%s",vDirExt,vDatFileName,filename);
+		sprintf(vFileext,"%s/"RES_XML_UNKNOWN_PATH"/%s/%s",vDirExt,vDatFileName,filename);
 		unknownLogAppend(vDatFileName,r->id,extarray[pos],r->type,vDirExt,r->palette,vFiledat,optionflag,unknownFile.typeCount[pos],r->flags,filename);
 	} else {
 		/* set filename */