Some little improvements
authorChristian Muck <christian.muck@bmw.de>
Fri, 13 Jan 2012 08:46:57 +0000 (09:46 +0100)
committerChristian Muck <christian.muck@bmw.de>
Fri, 13 Jan 2012 08:46:57 +0000 (09:46 +0100)
src/lib/dlt_filetransfer.c

index 7377cb6..c11db67 100644 (file)
@@ -54,31 +54,20 @@ time_t getFileCreationDate(const char* file){
        stat(file, &st);
        return st.st_ctime;
 }
+
+//!Returns the creation date of a file
+/** Format of the creation date is Day Mon dd hh:mm:ss yyyy
+ * @param file Absolute file path
+ * @return Returns the creation date of a file
+*/
 char* getFileCreationDate2(const char* file){
        struct stat st;
        stat(file, &st);
        
        struct tm  *ts= localtime(&st.st_ctime);
-       //char       buf[80];
-       /* Format and print the time, "ddd yyyy-mm-dd hh:mm:ss zzz" */
-       //strftime(buf, sizeof(buf), "%a %Y-%m-%d %H:%M:%S %Z", ts);
        return asctime(ts);
 }
 
-
-
-
-//void sighandler(int sig)
-//{
-//     
-//     fprintf(stderr, "Signal handler called with %d\n", sig);
-//     signal(sig, &sighandler);
-//     exit(1); 
-//     
-//}
-
-
-
 //!Checks if the file exists
 /**@param file Absolute file path
  * @return Returns 1 if the file exists, 0 if the file does not exist
@@ -126,7 +115,7 @@ int doRemoveFile(const char*filename){
 
 void dlt_user_log_file_errorMessage(DltContext *fileContext, const char *filename, int errorCode){
 
-       if(-errno != -2)
+       if(errno != ENOENT)
        {
                DLT_LOG(*fileContext,DLT_LOG_ERROR,
                        DLT_STRING("FLER"),
@@ -174,7 +163,6 @@ int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename){
                );
                return 0;
        } else {
-       
                dlt_user_log_file_errorMessage(fileContext,filename,ERROR_INFO_ABOUT);
                return ERROR_INFO_ABOUT;
        }
@@ -194,19 +182,12 @@ int dlt_user_log_file_infoAbout(DltContext *fileContext, const char *filename){
  */
 int dlt_user_log_file_complete(DltContext *fileContext, const char *filename, int deleteFlag, int timeout)
 {      
-       //No signal handling in library - part of the main program!
-       //signal(SIGABRT, &sighandler);
-       //signal(SIGTERM, &sighandler);
-       //signal(SIGINT, &sighandler);
-
        if(!isFile(filename))
        {
                dlt_user_log_file_errorMessage(fileContext,filename, ERROR_FILE_COMPLETE);
                return ERROR_FILE_COMPLETE;
        }
        
-       //dlt_user_log_file_infoAbout(fileContext,filename);
-       
        if(dlt_user_log_file_header(fileContext,filename) != 0)
        {
                return ERROR_FILE_COMPLETE1;