Changeset 1265 for TI05-delivery


Ignore:
Timestamp:
03/07/06 13:47:32 (13 years ago)
Author:
spascoe
Message:

Messages from the client that were previously printed to stdout/stderr are now returned
in a list from python functions bbftpc.connect() and bbftpc.docommand().

Location:
TI05-delivery/trunk
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp.c

    r1238 r1265  
    352352    cmd_list *newCommand = NULL; 
    353353    if ((newCommand  = (cmd_list *)malloc(sizeof(cmd_list))) == NULL) { 
    354            printmessage(stderr,CASE_FATAL_ERROR,23,timestamp,"Unable to malloc memory for command list : %s\n",strerror(errno)) ; 
     354           PRINTMESSAGE(stderr,CASE_FATAL_ERROR,23,timestamp,"Unable to malloc memory for command list : %s\n",strerror(errno)) ; 
    355355    } 
    356356    if ((newCommand->cmd = (char *) malloc( strlen(newcmd) + 1)) == NULL) { 
    357            printmessage(stderr,CASE_FATAL_ERROR,23,timestamp,"Unable to malloc memory for command : %s\n",strerror(errno)) ; 
     357           PRINTMESSAGE(stderr,CASE_FATAL_ERROR,23,timestamp,"Unable to malloc memory for command : %s\n",strerror(errno)) ; 
    358358    } 
    359359    strcpy(newCommand->cmd, newcmd); 
     
    550550        switch (j) { 
    551551            case 'v' :{ 
    552                 printmessage(stdout,CASE_NORMAL,0,timestamp,"bbftp version %s\n",VERSION) ; 
    553                 printmessage(stdout,CASE_NORMAL,0,timestamp,"Compiled with  :   default port %d\n",CONTROLPORT) ; 
     552                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"bbftp version %s\n",VERSION) ; 
     553                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Compiled with  :   default port %d\n",CONTROLPORT) ; 
    554554#ifdef PORT_RANGE 
    555                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   data ports range = %s \n", PORT_RANGE) ; 
     555                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   data ports range = %s \n", PORT_RANGE) ; 
    556556#endif 
    557557#ifdef WITH_GZIP 
    558                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   compression with Zlib-%s\n", zlibVersion()) ; 
     558                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   compression with Zlib-%s\n", zlibVersion()) ; 
    559559#endif 
    560560#ifdef WITH_SSL 
    561                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   encryption with %s \n",SSLeay_version(SSLEAY_VERSION)) ; 
     561                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   encryption with %s \n",SSLeay_version(SSLEAY_VERSION)) ; 
    562562#endif 
    563563#ifdef WITH_RFIO 
    564564# ifdef CASTOR 
    565                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   CASTOR support (RFIO)\n") ; 
     565                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   CASTOR support (RFIO)\n") ; 
    566566# else 
    567                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   HPSS support (RFIO)\n") ; 
     567                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   HPSS support (RFIO)\n") ; 
    568568# endif 
    569569#endif 
    570570#ifdef WITH_RFIO64 
    571571# ifdef CASTOR 
    572                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   CASTOR support (RFIO64)\n") ; 
     572                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   CASTOR support (RFIO64)\n") ; 
    573573# else 
    574                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   HPSS support (RFIO64)\n") ; 
     574                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   HPSS support (RFIO64)\n") ; 
    575575# endif 
    576576#endif 
    577577#ifdef AFS 
    578                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   AFS authentication \n") ; 
     578                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   AFS authentication \n") ; 
    579579#endif 
    580580#ifdef PRIVATE_AUTH 
    581                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   private authentication \n") ; 
     581                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   private authentication \n") ; 
    582582#else 
    583                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   default ssh command = %s \n",SSHCMD) ; 
    584                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   default ssh remote command = %s \n",SSHREMOTECMD) ; 
     583                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   default ssh command = %s \n",SSHCMD) ; 
     584                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   default ssh remote command = %s \n",SSHREMOTECMD) ; 
    585585# ifdef CERTIFICATE_AUTH 
    586                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   GSI authentication\n") ; 
     586                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   GSI authentication\n") ; 
    587587# endif 
    588588#endif 
    589589#ifdef NDG_PYTHON_EMBED 
    590                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   Embedded in Python interpreter\n") ; 
     590                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   Embedded in Python interpreter\n") ; 
    591591#endif // NDG_PYTHON_EMBED 
    592592 
    593                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   default number of tries = %d  \n",NBTRYMAX) ; 
    594                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   default sendwinsize = %d Kbytes\n",sendwinsize) ; 
    595                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   default recvwinsize = %d Kbytes\n",recvwinsize) ; 
    596                 printmessage(stdout,CASE_NORMAL,0,timestamp,"                   default number of stream = %d \n",nbport) ; 
     593                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   default number of tries = %d  \n",NBTRYMAX) ; 
     594                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   default sendwinsize = %d Kbytes\n",sendwinsize) ; 
     595                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   default recvwinsize = %d Kbytes\n",recvwinsize) ; 
     596                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"                   default number of stream = %d \n",nbport) ; 
    597597                exit(0) ; 
    598598            } 
     
    620620        if ( (stderrfd = open(errorfile,O_CREAT|O_WRONLY|O_SYNC|O_TRUNC,0777)) < 0 ) { 
    621621#endif 
    622                 printmessage(stderr,CASE_FATAL_ERROR,10,timestamp,"Error openning error file (%s) : %s\n",errorfile,strerror(errno)) ; 
     622                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,10,timestamp,"Error openning error file (%s) : %s\n",errorfile,strerror(errno)) ; 
    623623        } 
    624624        close(STDERR_FILENO); 
    625625        if ( fcntl(stderrfd,F_DUPFD,STDERR_FILENO) != STDERR_FILENO ) { 
    626             printmessage(stderr,CASE_FATAL_ERROR,11,timestamp,"Error dup on error file (%s) : %s\n",errorfile,strerror(errno)) ; 
     626            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,11,timestamp,"Error dup on error file (%s) : %s\n",errorfile,strerror(errno)) ; 
    627627        } 
    628628    } 
     
    646646        if ( (stdoutfd = open(outputfile,O_CREAT|O_WRONLY|O_SYNC|O_TRUNC,0777)) < 0 ) { 
    647647#endif 
    648                 printmessage(stderr,CASE_FATAL_ERROR,12,timestamp,"Error openning output file (%s) : %s\n",outputfile,strerror(errno)) ; 
     648                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,12,timestamp,"Error openning output file (%s) : %s\n",outputfile,strerror(errno)) ; 
    649649        } 
    650650        close(STDOUT_FILENO); 
    651651        if ( fcntl(stdoutfd,F_DUPFD,STDOUT_FILENO) != STDOUT_FILENO ) { 
    652             printmessage(stderr,CASE_FATAL_ERROR,13,timestamp,"Error dup on output file (%s) : %s\n",outputfile,strerror(errno)) ; 
     652            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,13,timestamp,"Error dup on output file (%s) : %s\n",outputfile,strerror(errno)) ; 
    653653        } 
    654654    } 
     
    676676                transferoption = transferoption | TROPT_GZIP ; 
    677677#else 
    678                 printmessage(stderr,CASE_FATAL_ERROR,7,timestamp,"option -c is not available: bbftp was built without compression utility\n") ; 
     678                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,7,timestamp,"option -c is not available: bbftp was built without compression utility\n") ; 
    679679#endif                 
    680680                break ; 
     
    689689                        pasvport_min = i; pasvport_max = k; 
    690690                    } else { 
    691                         printmessage(stderr,CASE_FATAL_ERROR,4,timestamp,"Invalid port range : %s\n",optarg) ; 
     691                        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,4,timestamp,"Invalid port range : %s\n",optarg) ; 
    692692                    } 
    693693                } else { 
     
    725725                inputfile = optarg ; 
    726726                if ( stat (inputfile,&statbuf) < 0 ) { 
    727                     printmessage(stderr,CASE_FATAL_ERROR,7,timestamp,"Input file (%s) cannot be stated\n",inputfile) ; 
     727                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,7,timestamp,"Input file (%s) cannot be stated\n",inputfile) ; 
    728728                } 
    729729                if ( (resultfile = (char *) malloc (strlen(inputfile) + 5 )) == NULL ) { 
    730                     printmessage(stderr,CASE_FATAL_ERROR,1,timestamp,"Cannot malloc space for result file name\n") ; 
     730                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,1,timestamp,"Cannot malloc space for result file name\n") ; 
    731731                } 
    732732                strcpy(resultfile,inputfile) ; 
     
    741741                */ 
    742742                if ( stat (sshidentityfile,&statbuf) < 0 ) { 
    743                     printmessage(stderr,CASE_FATAL_ERROR,5,timestamp,"SSH identity file (%s) cannot be stated\n",sshidentityfile) ; 
     743                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,5,timestamp,"SSH identity file (%s) cannot be stated\n",sshidentityfile) ; 
    744744                } 
    745745                break ; 
     
    773773                retcode = sscanf(optarg,"%d",&alluse) ; 
    774774                if ( retcode != 1 || alluse < 0) { 
    775                     printmessage(stderr,CASE_FATAL_ERROR,3,timestamp,"Number of streams must be numeric and > 0\n") ; 
     775                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,3,timestamp,"Number of streams must be numeric and > 0\n") ; 
    776776                } 
    777777                nbport = alluse ; 
     
    781781                retcode = sscanf(optarg,"%d",&alluse) ; 
    782782                if ( retcode != 1 || alluse <= 0) { 
    783                     printmessage(stderr,CASE_FATAL_ERROR,4,timestamp,"Number of tries must be numeric > 0\n") ; 
     783                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,4,timestamp,"Number of tries must be numeric > 0\n") ; 
    784784                } 
    785785                globaltrymax = alluse ; 
     
    814814                retcode = sscanf(optarg,"%d",&alluse) ; 
    815815                if ( retcode != 1 || alluse <= 0) { 
    816                     printmessage(stderr,CASE_FATAL_ERROR,4,timestamp,"Control port must be numeric\n") ; 
     816                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,4,timestamp,"Control port must be numeric\n") ; 
    817817                } 
    818818                newcontrolport = alluse ; 
     
    825825            default : { 
    826826                Usage() ; 
    827                 printmessage(stderr,CASE_FATAL_ERROR,6,timestamp,"Error on command line (unsupported option -%c)\n",optopt) ; 
     827                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,6,timestamp,"Error on command line (unsupported option -%c)\n",optopt) ; 
    828828            } 
    829829        } 
     
    838838        ** Starting badly if we are unable to malloc 5K 
    839839        */ 
    840         printmessage(stderr,CASE_FATAL_ERROR,10,timestamp,"No memory for CASTOR : %s\n",strerror(errno)) ; 
     840        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,10,timestamp,"No memory for CASTOR : %s\n",strerror(errno)) ; 
    841841    } 
    842842#endif 
     
    873873            */ 
    874874            if ( (sshremotecmd = (char *) malloc (strlen(SSHREMOTECMD)+1) ) == NULL ) { 
    875                 printmessage(stderr,CASE_FATAL_ERROR,8,timestamp,"Cannot malloc space for ssh remote cmd\n") ; 
     875                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,8,timestamp,"Cannot malloc space for ssh remote cmd\n") ; 
    876876            } 
    877877            strcpy(sshremotecmd,SSHREMOTECMD) ; 
     
    883883            if ( strstr(sshremotecmd," -s") == NULL ) { 
    884884                if ( ( tmpsshremotecmd = (char *) malloc (strlen(sshremotecmd) + 4) ) == NULL ) { 
    885                     printmessage(stderr,CASE_FATAL_ERROR,8,timestamp,"Cannot malloc space for ssh remote cmd\n") ; 
     885                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,8,timestamp,"Cannot malloc space for ssh remote cmd\n") ; 
    886886                } 
    887887                sprintf(tmpsshremotecmd,"%s -s",sshremotecmd) ; 
     
    891891        if ( sshcmd == NULL ) { 
    892892            if ( (sshcmd = (char *) malloc (strlen(SSHCMD)+1) ) == NULL ) { 
    893                   printmessage(stderr,CASE_FATAL_ERROR,9,timestamp,"Cannot malloc space for ssh cmd\n") ; 
     893                  PRINTMESSAGE(stderr,CASE_FATAL_ERROR,9,timestamp,"Cannot malloc space for ssh cmd\n") ; 
    894894            } 
    895895            strcpy(sshcmd,SSHCMD) ; 
     
    906906        */ 
    907907        if ( (mypasswd = getpwuid(getuid())) == NULL ) { 
    908             if ( warning ) printmessage(stderr,CASE_WARNING,6,timestamp,"Unable to get passwd entry, using %s\n", BBFTP_CONF) ; 
     908            if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,6,timestamp,"Unable to get passwd entry, using %s\n", BBFTP_CONF) ; 
    909909            if ( (bbftprcfile = (char *) malloc (strlen(BBFTP_CONF)+1) ) != NULL ) { 
    910910              strcpy(bbftprcfile,BBFTP_CONF); 
    911911            } 
    912912        } else if ( mypasswd->pw_dir == NULL ) { 
    913             if ( warning ) printmessage(stderr,CASE_WARNING,7,timestamp,"No home directory, using %s\n", BBFTP_CONF) ; 
     913            if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,7,timestamp,"No home directory, using %s\n", BBFTP_CONF) ; 
    914914            if ( (bbftprcfile = (char *) malloc (strlen(BBFTP_CONF)+1) ) != NULL ) { 
    915915              strcpy(bbftprcfile,BBFTP_CONF); 
    916916            } 
    917917        } else if ( (bbftprcfile = (char *) malloc (strlen(mypasswd->pw_dir)+10) ) == NULL ) { 
    918             if ( warning ) printmessage(stderr,CASE_WARNING,8,timestamp,"Error allocationg space for bbftprc file name, .bbftprc will not be used\n") ; 
     918            if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,8,timestamp,"Error allocationg space for bbftprc file name, .bbftprc will not be used\n") ; 
    919919        } else { 
    920920            strcpy(bbftprcfile,mypasswd->pw_dir) ; 
     
    934934            */ 
    935935            if ( stat(bbftprcfile,&statbuf) < 0  ) { 
    936                 if ( warning ) printmessage(stderr,CASE_WARNING,9,timestamp,"Error stating bbftprc file (%s)\n",bbftprcfile) ; 
     936                if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,9,timestamp,"Error stating bbftprc file (%s)\n",bbftprcfile) ; 
    937937            } else if ( statbuf.st_size == 0 ) { 
    938938                /* 
     
    940940                */ 
    941941            } else if ( (bbftprc = (char *) malloc (statbuf.st_size + 1 ) ) == NULL ) { 
    942                 if ( warning ) printmessage(stderr,CASE_WARNING,10,timestamp,"Error allocation memory for bbftprc, .bbftprc will not be used\n") ; 
     942                if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,10,timestamp,"Error allocation memory for bbftprc, .bbftprc will not be used\n") ; 
    943943            } else if ( ( fd  = open (bbftprcfile,O_RDONLY) )  < 0 ) { 
    944                 if ( warning ) printmessage(stderr,CASE_WARNING,11,timestamp,"Error openning .bbftprc file (%s) : %s \n",bbftprcfile,strerror(errno)) ; 
     944                if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,11,timestamp,"Error openning .bbftprc file (%s) : %s \n",bbftprcfile,strerror(errno)) ; 
    945945            } else if ( ( j = read( fd, bbftprc , statbuf.st_size )) != statbuf.st_size ) { 
    946                 if ( warning ) printmessage(stderr,CASE_WARNING,12,timestamp,"Error reading .bbftprc file (%s)\n",bbftprcfile) ; 
     946                if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,12,timestamp,"Error reading .bbftprc file (%s)\n",bbftprcfile) ; 
    947947            } else { 
    948948                bbftprc[j] = '\0' ; 
     
    979979                retcode = sscanf(startcmd,"setbuffersize %d",&alluse) ; 
    980980                if ( retcode != 1 || alluse < 0 ) { 
    981                     if ( warning ) printmessage(stderr,CASE_WARNING,5,timestamp,"Buffersize in bbftprc file must be numeric > 0\n") ; 
     981                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,5,timestamp,"Buffersize in bbftprc file must be numeric > 0\n") ; 
    982982                } else { 
    983983                    buffersizeperstream = alluse ; 
     
    987987                retcode = sscanf(startcmd,"setlocalcos %d",&alluse) ; 
    988988                if ( retcode != 1 /*|| alluse < 0*/) { 
    989                     if ( warning ) printmessage(stderr,CASE_WARNING,14,timestamp,"Local COS in bbftprc file must be numeric\n") ; 
     989                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,14,timestamp,"Local COS in bbftprc file must be numeric\n") ; 
    990990                } else { 
    991991                    localcos = alluse ; 
     
    995995                retcode = sscanf(startcmd,"setremotecos %d",&alluse) ; 
    996996                if ( retcode != 1 /*|| alluse < 0*/) { 
    997                     if ( warning ) printmessage(stderr,CASE_WARNING,15,timestamp,"Remote COS in bbftprc file must be numeric\n") ; 
     997                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,15,timestamp,"Remote COS in bbftprc file must be numeric\n") ; 
    998998                }else { 
    999999                    remotecos = alluse ; 
     
    10021002                retcode = sscanf(startcmd,"setlocalumask %o",&alluse) ; 
    10031003                if ( retcode != 1 || alluse < 0) { 
    1004                     if ( warning ) printmessage(stderr,CASE_WARNING,16,timestamp,"Local umask in bbftprc file must be numeric\n") ; 
     1004                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,16,timestamp,"Local umask in bbftprc file must be numeric\n") ; 
    10051005                } else { 
    10061006                    localumask = alluse ; 
     
    10101010                retcode = sscanf(startcmd,"setremoteumask %o",&alluse) ; 
    10111011                if ( retcode != 1  || alluse < 0) { 
    1012                     if ( warning ) printmessage(stderr,CASE_WARNING,17,timestamp,"Remote umask in bbftprc file must be numeric\n") ; 
     1012                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,17,timestamp,"Remote umask in bbftprc file must be numeric\n") ; 
    10131013                }else { 
    10141014                    remoteumask = alluse ; 
     
    10181018                retcode = sscanf(startcmd,"setsendwinsize %d",&alluse) ; 
    10191019                if ( retcode != 1 || alluse < 0 ) { 
    1020                     if ( warning ) printmessage(stderr,CASE_WARNING,18,timestamp,"Send window size in bbftprc file must be numeric\n") ; 
     1020                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,18,timestamp,"Send window size in bbftprc file must be numeric\n") ; 
    10211021                } else { 
    10221022                    sendwinsize = alluse ; 
     
    10251025                retcode = sscanf(startcmd,"setrecvwinsize %d",&alluse) ; 
    10261026                if ( retcode != 1 || alluse < 0  ) { 
    1027                     if ( warning ) printmessage(stderr,CASE_WARNING,19,timestamp,"Receive window size in bbftprc file must be numeric\n") ; 
     1027                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,19,timestamp,"Receive window size in bbftprc file must be numeric\n") ; 
    10281028                }else { 
    10291029                    recvwinsize = alluse ; 
     
    10321032                retcode = sscanf(startcmd,"setnbstream %d",&alluse) ; 
    10331033                if ( retcode != 1  || alluse <= 0 ) { 
    1034                     if ( warning ) printmessage(stderr,CASE_WARNING,19,timestamp,"Number of streams in bbftprc file must be numeric and > 0\n") ; 
     1034                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,19,timestamp,"Number of streams in bbftprc file must be numeric and > 0\n") ; 
    10351035                } else { 
    10361036                    nbport = alluse ; 
     
    10391039                retcode = sscanf(startcmd,"setackto %d",&alluse) ; 
    10401040                if ( retcode != 1  || alluse <= 0 ) { 
    1041                     if ( warning ) printmessage(stderr,CASE_WARNING,19,timestamp,"Acknowledge timeout must be numeric and > 0\n") ; 
     1041                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,19,timestamp,"Acknowledge timeout must be numeric and > 0\n") ; 
    10421042                } else { 
    10431043                    ackto = alluse ; 
     
    10461046                retcode = sscanf(startcmd,"setrecvcontrolto %d",&alluse) ; 
    10471047                if ( retcode != 1  || alluse <= 0 ) { 
    1048                     if ( warning ) printmessage(stderr,CASE_WARNING,19,timestamp,"Input control timeout must be numeric and > 0\n") ; 
     1048                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,19,timestamp,"Input control timeout must be numeric and > 0\n") ; 
    10491049                } else { 
    10501050                    recvcontrolto = alluse ; 
     
    10531053                retcode = sscanf(startcmd,"setsendcontrolto %d",&alluse) ; 
    10541054                if ( retcode != 1  || alluse <= 0 ) { 
    1055                     if ( warning ) printmessage(stderr,CASE_WARNING,19,timestamp,"Output control timeout must be numeric and > 0\n") ; 
     1055                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,19,timestamp,"Output control timeout must be numeric and > 0\n") ; 
    10561056                } else { 
    10571057                    sendcontrolto = alluse ; 
     
    10601060                retcode = sscanf(startcmd,"setdatato %d",&alluse) ; 
    10611061                if ( retcode != 1  || alluse <= 0 ) { 
    1062                     if ( warning ) printmessage(stderr,CASE_WARNING,19,timestamp,"Data timeout must be numeric and > 0\n") ; 
     1062                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,19,timestamp,"Data timeout must be numeric and > 0\n") ; 
    10631063                } else { 
    10641064                    datato = alluse ; 
     
    11021102                        transferoption = transferoption | TROPT_RFIO_O ; 
    11031103#else 
    1104                         if (warning) printmessage(stderr,CASE_WARNING,20,timestamp,"Incorrect command : setoption localrfio (RFIO not supported)\n",buffercmd) ; 
     1104                        if (warning) PRINTMESSAGE(stderr,CASE_WARNING,20,timestamp,"Incorrect command : setoption localrfio (RFIO not supported)\n",buffercmd) ; 
    11051105#endif 
    11061106                    } 
     
    11241124                        transferoption = transferoption | TROPT_GZIP ; 
    11251125#else 
    1126                         printmessage(stderr,CASE_FATAL_ERROR,7,timestamp,"gzip option is not available: bbftp was built without compression support\n") ; 
     1126                        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,7,timestamp,"gzip option is not available: bbftp was built without compression support\n") ; 
    11271127#endif                         
    11281128                    } 
     
    11341134                    } 
    11351135                } else { 
    1136                     if ( warning ) printmessage(stderr,CASE_WARNING,20,timestamp,"Unkown option in .bbftprc file (%s)\n",startcmd) ; 
     1136                    if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,20,timestamp,"Unkown option in .bbftprc file (%s)\n",startcmd) ; 
    11371137                } 
    11381138            } else { 
    1139                 if ( warning ) printmessage(stderr,CASE_WARNING,13,timestamp,"Unkown command in .bbftprc file (%s)\n",startcmd) ; 
     1139                if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,13,timestamp,"Unkown command in .bbftprc file (%s)\n",startcmd) ; 
    11401140            } 
    11411141            carret++ ; 
     
    11481148*/ 
    11491149    if ( inputfile == NULL && bbftpcmd == NULL ) { 
    1150         printmessage(stderr,CASE_FATAL_ERROR,20,timestamp,"Error on command line (-i or -e option are mandatory)\n") ; 
     1150        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,20,timestamp,"Error on command line (-i or -e option are mandatory)\n") ; 
    11511151    } 
    11521152/* 
     
    11551155    if ( inputfile != NULL ) { 
    11561156        if ( (infd = open(inputfile,O_RDONLY)) < 0 ) { 
    1157             printmessage(stderr,CASE_FATAL_ERROR,21,timestamp,"Error opening input file (%s) : %s\n",inputfile,strerror(errno)) ; 
     1157            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,21,timestamp,"Error opening input file (%s) : %s\n",inputfile,strerror(errno)) ; 
    11581158        } 
    11591159#ifdef DARWIN 
     
    11621162        if ( (resfd = open(resultfile,O_CREAT|O_WRONLY|O_SYNC|O_TRUNC,0777)) < 0 ) { 
    11631163#endif 
    1164                 printmessage(stderr,CASE_FATAL_ERROR,22,timestamp,"Error opening result file (%s) : %s\n",resultfile,strerror(errno)) ; 
     1164                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,22,timestamp,"Error opening result file (%s) : %s\n",resultfile,strerror(errno)) ; 
    11651165        } 
    11661166        /* 
     
    11811181        } 
    11821182        if ( lengthread < 0 ) { 
    1183             printmessage(stderr,CASE_FATAL_ERROR,24,timestamp,"Error reading input file (%s) : %s\n",inputfile,strerror(errno)) ; 
     1183            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,24,timestamp,"Error reading input file (%s) : %s\n",inputfile,strerror(errno)) ; 
    11841184        } else if ( lengthread == 0 ) { 
    11851185            if ( j > maxlen ) { 
     
    11921192        lseek(infd,0,SEEK_SET) ; 
    11931193        if ( (buffercmd = (char *) malloc (maxlen+2) ) == NULL ) { 
    1194             printmessage(stderr,CASE_FATAL_ERROR,23,timestamp,"Unable to malloc memory for command : %s\n",strerror(errno)) ; 
     1194            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,23,timestamp,"Unable to malloc memory for command : %s\n",strerror(errno)) ; 
    11951195        } 
    11961196    } else { 
    11971197        if ( (buffercmd = (char *) malloc (strlen(bbftpcmd)+1)) == NULL ) { 
    1198              printmessage(stderr,CASE_FATAL_ERROR,23,timestamp,"Unable to malloc memory for command : %s\n",strerror(errno)) ; 
     1198             PRINTMESSAGE(stderr,CASE_FATAL_ERROR,23,timestamp,"Unable to malloc memory for command : %s\n",strerror(errno)) ; 
    11991199         } 
    12001200    } 
     
    12231223                } 
    12241224                if ( lengthread < 0 ) { 
    1225                     printmessage(stderr,CASE_FATAL_ERROR,24,timestamp,"Error reading input file (%s) : %s\n",inputfile,strerror(errno)) ; 
     1225                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,24,timestamp,"Error reading input file (%s) : %s\n",inputfile,strerror(errno)) ; 
    12261226                } else if ( lengthread == 0 ) { 
    12271227                    if ( j == 0 ) { 
     
    12651265                    addCommand(newcmd); 
    12661266            } else { 
    1267                     printmessage(stderr,CASE_FATAL_ERROR,24,timestamp,"Unable to parse command  : %s\n",buffercmd) ; 
     1267                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,24,timestamp,"Unable to parse command  : %s\n",buffercmd) ; 
    12681268            } 
    12691269        } 
     
    12721272    if (hostname == NULL || strlen(hostname) == 0) { 
    12731273        Usage() ; 
    1274         printmessage(stderr,CASE_FATAL_ERROR,14,timestamp,"No hostname on command line\n") ; 
     1274        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,14,timestamp,"No hostname on command line\n") ; 
    12751275    }     
    12761276/* 
     
    12871287        } else if ( hostname[j] == '.' ) { 
    12881288        } else { 
    1289             printmessage(stderr,CASE_FATAL_ERROR,15,timestamp,"Invalid hostname (%s)\n",hostname) ; 
     1289            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,15,timestamp,"Invalid hostname (%s)\n",hostname) ; 
    12901290        } 
    12911291    } 
     
    12971297        hisctladdr.sin_addr.s_addr = inet_addr(hostname) ; 
    12981298        if (hisctladdr.sin_addr.s_addr == -1 ) { 
    1299             printmessage(stderr,CASE_FATAL_ERROR,16,timestamp,"Invalid IP address (%s)\n",hostname) ; 
     1299            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,16,timestamp,"Invalid IP address (%s)\n",hostname) ; 
    13001300        } 
    13011301        calchostname = (char *)inet_ntoa(hisctladdr.sin_addr) ; 
    13021302        if ( strcmp(hostname,calchostname) ) { 
    1303             printmessage(stderr,CASE_FATAL_ERROR,16,timestamp,"Invalid IP address (%s)\n",hostname) ; 
     1303            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,16,timestamp,"Invalid IP address (%s)\n",hostname) ; 
    13041304        } 
    13051305    } else { 
     
    13081308       */ 
    13091309        if ( (hp = gethostbyname((char *)hostname) ) == NULL ) { 
    1310             printmessage(stderr,CASE_FATAL_ERROR,17,timestamp,"Hostname no found (%s)\n",hostname) ; 
     1310            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,17,timestamp,"Hostname no found (%s)\n",hostname) ; 
    13111311        } else { 
    13121312            if (hp->h_length > (int)sizeof(hisctladdr.sin_addr)) { 
     
    13231323        if (usessh) { 
    13241324/*            Usage() ; 
    1325             printmessage(stderr,CASE_FATAL_ERROR,18,timestamp,"No username given\n") ;*/ 
     1325            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,18,timestamp,"No username given\n") ;*/ 
    13261326        } else { 
    13271327            usecert = SETTOONE; 
     
    13301330        if (!usessh) { 
    13311331            Usage() ; 
    1332             printmessage(stderr,CASE_FATAL_ERROR,18,timestamp,"No username given\n") ; 
     1332            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,18,timestamp,"No username given\n") ; 
    13331333        } 
    13341334#endif 
     
    13361336    if ( debug ) { 
    13371337        if (simulation_mode) { 
    1338             printmessage(stdout,CASE_NORMAL,0,timestamp,"** SIMULATION MODE: No data written **\n") ; 
    1339         } 
    1340         printmessage(stdout,CASE_NORMAL,0,timestamp,"Starting parameters -----------------\n") ; 
    1341         printmessage(stdout,CASE_NORMAL,0,timestamp,"number of tries   = %d\n",globaltrymax) ; 
    1342         printmessage(stdout,CASE_NORMAL,0,timestamp,"number of streams = %d\n",nbport) ; 
    1343         printmessage(stdout,CASE_NORMAL,0,timestamp,"localumask        = %03o\n",localumask) ; 
    1344         printmessage(stdout,CASE_NORMAL,0,timestamp,"remoteumask       = %03o\n",remoteumask) ; 
     1338            PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"** SIMULATION MODE: No data written **\n") ; 
     1339        } 
     1340        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Starting parameters -----------------\n") ; 
     1341        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"number of tries   = %d\n",globaltrymax) ; 
     1342        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"number of streams = %d\n",nbport) ; 
     1343        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"localumask        = %03o\n",localumask) ; 
     1344        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"remoteumask       = %03o\n",remoteumask) ; 
    13451345#if defined(WITH_RFIO) || defined(WITH_RFIO64) 
    1346         printmessage(stdout,CASE_NORMAL,0,timestamp,"localcos          = %d\n",localcos) ; 
    1347 #endif 
    1348         printmessage(stdout,CASE_NORMAL,0,timestamp,"remotecos         = %d\n",remotecos) ; 
    1349         printmessage(stdout,CASE_NORMAL,0,timestamp,"buffersize        = %d KB\n",buffersizeperstream) ; 
    1350         printmessage(stdout,CASE_NORMAL,0,timestamp,"sendwinsize       = %d KB\n",sendwinsize) ; 
    1351         printmessage(stdout,CASE_NORMAL,0,timestamp,"recvwinsize       = %d KB\n",recvwinsize) ; 
    1352         printmessage(stdout,CASE_NORMAL,0,timestamp,"ackto                         = %d s\n",ackto) ; 
    1353         printmessage(stdout,CASE_NORMAL,0,timestamp,"recvcontrolto     = %d s\n",recvcontrolto) ; 
    1354         printmessage(stdout,CASE_NORMAL,0,timestamp,"sendcontrolto     = %d s\n",sendcontrolto) ; 
    1355         printmessage(stdout,CASE_NORMAL,0,timestamp,"datato     = %d s\n",datato) ; 
    1356                 printmessage(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_DIR ) == TROPT_DIR) ? "createdir" : "nocreatedir") ; 
    1357                 printmessage(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_TMP ) == TROPT_TMP) ? "tmpfile" : "notmpfile") ; 
    1358                 printmessage(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_RFIO ) == TROPT_RFIO) ? "remoterfio" : "noremoterfio") ; 
     1346        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"localcos          = %d\n",localcos) ; 
     1347#endif 
     1348        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"remotecos         = %d\n",remotecos) ; 
     1349        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"buffersize        = %d KB\n",buffersizeperstream) ; 
     1350        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"sendwinsize       = %d KB\n",sendwinsize) ; 
     1351        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"recvwinsize       = %d KB\n",recvwinsize) ; 
     1352        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"ackto                         = %d s\n",ackto) ; 
     1353        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"recvcontrolto     = %d s\n",recvcontrolto) ; 
     1354        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"sendcontrolto     = %d s\n",sendcontrolto) ; 
     1355        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"datato     = %d s\n",datato) ; 
     1356                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_DIR ) == TROPT_DIR) ? "createdir" : "nocreatedir") ; 
     1357                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_TMP ) == TROPT_TMP) ? "tmpfile" : "notmpfile") ; 
     1358                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_RFIO ) == TROPT_RFIO) ? "remoterfio" : "noremoterfio") ; 
    13591359#if defined(WITH_RFIO) || defined(WITH_RFIO64) 
    1360                 printmessage(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_RFIO_O ) == TROPT_RFIO_O) ? "localrfio" : "nolocalrfio") ; 
    1361 #endif 
    1362                 printmessage(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_MODE ) == TROPT_MODE) ? "keepmode" : "nokeepmode") ; 
    1363                 printmessage(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_ACC ) == TROPT_ACC) ? "keepaccess" : "nokeepaccess") ; 
     1360                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_RFIO_O ) == TROPT_RFIO_O) ? "localrfio" : "nolocalrfio") ; 
     1361#endif 
     1362                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_MODE ) == TROPT_MODE) ? "keepmode" : "nokeepmode") ; 
     1363                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_ACC ) == TROPT_ACC) ? "keepaccess" : "nokeepaccess") ; 
    13641364#ifdef WITH_GZIP 
    1365                 printmessage(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_GZIP ) == TROPT_GZIP) ? "gzip" : "nogzip") ; 
     1365                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_GZIP ) == TROPT_GZIP) ? "gzip" : "nogzip") ; 
    13661366#endif         
    1367                 printmessage(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_QBSS ) == TROPT_QBSS) ? "qbss" : "noqbss") ; 
    1368         printmessage(stdout,CASE_NORMAL,0,timestamp,"-------------------------------------\n") ; 
    1369         printmessage(stdout,CASE_NORMAL,0,timestamp,"Connection mode ---------------------\n") ; 
     1367                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"option %s\n", ((transferoption & TROPT_QBSS ) == TROPT_QBSS) ? "qbss" : "noqbss") ; 
     1368        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"-------------------------------------\n") ; 
     1369        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Connection mode ---------------------\n") ; 
    13701370        if ( usecert ) { 
    13711371/*                      if ( username == NULL ) {*/ 
    1372                                 printmessage(stdout,CASE_NORMAL,0,timestamp,"Using certificate authentication\n") ; 
     1372                                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Using certificate authentication\n") ; 
    13731373/*                      } else { 
    1374                                 printmessage(stdout,CASE_NORMAL,0,timestamp,"Using standard bbftp mode\n") ; 
     1374                                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Using standard bbftp mode\n") ; 
    13751375                        }*/ 
    13761376        } else if ( useprivate ) { 
    1377             printmessage(stdout,CASE_NORMAL,0,timestamp,"Using private authentication\n") ; 
     1377            PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Using private authentication\n") ; 
    13781378        } else if ( usessh) { 
    1379             printmessage(stdout,CASE_NORMAL,0,timestamp,"Using ssh mode\n") ; 
    1380             printmessage(stdout,CASE_NORMAL,0,timestamp,"     ssh command        = %s \n",sshcmd) ; 
    1381             printmessage(stdout,CASE_NORMAL,0,timestamp,"     ssh remote command = %s \n",sshremotecmd) ; 
     1379            PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Using ssh mode\n") ; 
     1380            PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"     ssh command        = %s \n",sshcmd) ; 
     1381            PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"     ssh remote command = %s \n",sshremotecmd) ; 
    13821382        } else { 
    1383             printmessage(stdout,CASE_NORMAL,0,timestamp,"Using standard bbftp mode\n",localumask) ; 
    1384         } 
    1385         printmessage(stdout,CASE_NORMAL,0,timestamp,"-------------------------------------\n") ; 
     1383            PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Using standard bbftp mode\n",localumask) ; 
     1384        } 
     1385        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"-------------------------------------\n") ; 
    13861386   } 
    13871387 
     
    13911391#ifdef PRIVATE_AUTH 
    13921392    if ( bbftp_private_getargs(logmessage) < 0 ) { 
    1393         printmessage(stderr,CASE_FATAL_ERROR,19,timestamp,"Error while private authentication : %s\n",logmessage) ; 
     1393        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,19,timestamp,"Error while private authentication : %s\n",logmessage) ; 
    13941394    }      
    13951395#else 
     
    13991399        long code ; 
    14001400        if ( (code = ka_UserReadPassword("Password: ", passwordBuffer, sizeof(passwordBuffer), &reasonString)) ) { 
    1401             printmessage(stderr,CASE_FATAL_ERROR,19,timestamp,"Error while entering password\n") ; 
     1401            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,19,timestamp,"Error while entering password\n") ; 
    14021402        } 
    14031403        if ( ( password = (char *) malloc (strlen(passwordBuffer) + 1) ) == NULL ) { 
    1404             printmessage(stderr,CASE_FATAL_ERROR,54,timestamp,"Unable to store password : malloc failed (%s)\n",strerror(errno)) ; 
     1404            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,54,timestamp,"Unable to store password : malloc failed (%s)\n",strerror(errno)) ; 
    14051405            return -1 ; 
    14061406        } 
     
    14101410        password = (char *) getpassphrase("Password: ") ; 
    14111411        if ( strlen(password) == 0 ) { 
    1412             printmessage(stderr,CASE_FATAL_ERROR,19,timestamp,"Password is mandatory\n") ; 
     1412            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,19,timestamp,"Password is mandatory\n") ; 
    14131413        } 
    14141414#  else 
    1415         printmessage(stdout,CASE_NORMAL,0,0,"Password: ") ; 
     1415        PRINTMESSAGE(stdout,CASE_NORMAL,0,0,"Password: ") ; 
    14161416        password = (char *) getpass("") ; 
    14171417#  endif /* USE_GETPASSPHRASE */ 
     
    14241424    if ( background ) { 
    14251425        retcode = fork() ;  
    1426         if ( retcode < 0 ) printmessage(stderr,CASE_FATAL_ERROR,31,timestamp,"Error forking while setting in background\n") ; 
     1426        if ( retcode < 0 ) PRINTMESSAGE(stderr,CASE_FATAL_ERROR,31,timestamp,"Error forking while setting in background\n") ; 
    14271427        if ( retcode > 0 ) exit(0) ; 
    14281428        setsid() ; 
    1429         if ( verbose ) printmessage(stdout,CASE_NORMAL,0,timestamp,"Starting under pid %d\n",getpid()); 
     1429        if ( verbose ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Starting under pid %d\n",getpid()); 
    14301430    } 
    14311431 
     
    14531453            } 
    14541454            if ( lengthread < 0 ) { 
    1455                 printmessage(stderr,CASE_FATAL_ERROR,24,timestamp,"Error reading input file (%s) : %s\n",inputfile,strerror(errno)) ; 
     1455                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,24,timestamp,"Error reading input file (%s) : %s\n",inputfile,strerror(errno)) ; 
    14561456            } else if ( lengthread == 0 ) { 
    14571457                if ( j == 0 ) { 
     
    14891489 
    14901490    if ( debug ) 
    1491         printmessage(stdout,CASE_NORMAL,0,timestamp,"Connecting to server ----------------\n",localumask) ; 
     1491        PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Connecting to server ----------------\n",localumask) ; 
    14921492    reconnecttoserver() ; 
    14931493    if ( debug ) 
    1494          printmessage(stdout,CASE_NORMAL,0,timestamp,"Connecting end ---------------------\n",localumask) ; 
     1494         PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Connecting end ---------------------\n",localumask) ; 
    14951495    
    14961496/* 
     
    15061506                write(resfd," OK\n",4) ; 
    15071507            } else { 
    1508                 if (!verbose && !statoutput) printmessage(stdout,CASE_NORMAL,0,timestamp,"%s OK\n",iterator->cmd); 
     1508                if (!verbose && !statoutput) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"%s OK\n",iterator->cmd); 
    15091509            } 
    15101510        } else { 
     
    15131513                write(resfd," FAILED\n",8) ; 
    15141514            } else { 
    1515                 if (!verbose && !statoutput) printmessage(stdout,CASE_NORMAL,0,timestamp,"%s FAILED\n",iterator->cmd); 
     1515                if (!verbose && !statoutput) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"%s FAILED\n",iterator->cmd); 
    15161516            } 
    15171517        } 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_cd.c

    r773 r1265  
    8484    struct  mess_integer *msg_integer ; 
    8585    
    86     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : cd %s\n",dirpath) ; 
     86    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : cd %s\n",dirpath) ; 
    8787     
    8888    msg = (struct message *)minbuffer ; 
     
    9999        ** tell the calling program to restart a connection 
    100100        */ 
    101         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHDIR_V2"); 
     101        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHDIR_V2"); 
    102102        *errcode = 64 ; 
    103103        bbftp_close_control() ; 
     
    110110    msg_integer->myint = transferoption ; 
    111111    if ( writemessage(outcontrolsock,minbuffer,sizeof(int),sendcontrolto,0) < 0 ) { 
    112         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHDIR_V2 (transferoption)"); 
     112        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHDIR_V2 (transferoption)"); 
    113113        *errcode = 64 ; 
    114114        bbftp_close_control() ; 
     
    119119    */ 
    120120    if ( writemessage(outcontrolsock,dirpath,strlen(dirpath),sendcontrolto,0) < 0 ) { 
    121         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHDIR_V2 (directory name)"); 
     121        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHDIR_V2 (directory name)"); 
    122122        *errcode = 64 ; 
    123123        bbftp_close_control() ; 
     
    142142            ** and restart 
    143143            */ 
    144             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     144            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    145145            *errcode = 66 ; 
    146146            bbftp_close_control() ; 
     
    166166        */ 
    167167        if ( readmessage(incontrolsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    168             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_CHDIR_V2)"); 
     168            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_CHDIR_V2)"); 
    169169            *errcode = 61 ; 
    170170            bbftp_close_control() ; 
     
    182182#endif 
    183183            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    184                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_cd)",strerror(errno)) ; 
     184                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_cd)",strerror(errno)) ; 
    185185                *errcode = 35 ; 
    186186                bbftp_close_control() ; 
     
    188188            } 
    189189            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    190                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_CHDIR_V2)"); 
     190                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_CHDIR_V2)"); 
    191191                *errcode = 67 ; 
    192192                bbftp_close_control() ; 
     
    199199            } else { 
    200200                buffer[msglen] = '\0' ; 
    201                 printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    202                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     201                PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     202                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    203203                free(buffer) ; 
    204204                if ( code == MSG_BAD ) { 
     
    230230#endif 
    231231            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    232                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_cd)",strerror(errno)) ; 
     232                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_cd)",strerror(errno)) ; 
    233233                *errcode = 35 ; 
    234234                bbftp_close_control() ; 
     
    236236            } 
    237237            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0) { 
    238                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_CHDIR_V2)"); 
     238                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_CHDIR_V2)"); 
    239239                *errcode = 67 ; 
    240240                bbftp_close_control() ; 
     
    248248                remotedir = buffer ; 
    249249            } 
    250             if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK : Current remote directory is %s\n",remotedir) ; 
     250            if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK : Current remote directory is %s\n",remotedir) ; 
    251251            return BB_RET_OK ; 
    252252        } else { 
     
    256256            ** and restart 
    257257            */ 
    258             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
     258            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
    259259            *errcode = 62 ; 
    260260            bbftp_close_control() ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_cert.c

    r773 r1265  
    112112    hisctladdr.sin_port = htons(newcontrolport); 
    113113    if ( (tmpctrlsock = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 ) { 
    114         printmessage(stderr,CASE_ERROR,51,timestamp, "Cannot create control socket : %s\n",strerror(errno)); 
     114        PRINTMESSAGE(stderr,CASE_ERROR,51,timestamp, "Cannot create control socket : %s\n",strerror(errno)); 
    115115        return -1 ; 
    116116    } 
     
    121121    if ( connect(tmpctrlsock,(struct sockaddr*)&hisctladdr,addrlen) < 0 ) { 
    122122        close(tmpctrlsock) ; 
    123         printmessage(stderr,CASE_ERROR,52,timestamp, "Cannot connect to control socket: %s\n",strerror(errno)); 
     123        PRINTMESSAGE(stderr,CASE_ERROR,52,timestamp, "Cannot connect to control socket: %s\n",strerror(errno)); 
    124124        return -1 ; 
    125125    } 
     
    130130    if (getsockname(tmpctrlsock,(struct sockaddr*) &myctladdr, &addrlen) < 0) { 
    131131        close(tmpctrlsock) ; 
    132         printmessage(stderr,CASE_ERROR,53,timestamp,"Error getsockname on control socket: %s\n",strerror(errno)) ; 
     132        PRINTMESSAGE(stderr,CASE_ERROR,53,timestamp,"Error getsockname on control socket: %s\n",strerror(errno)) ; 
    133133        return -1 ; 
    134134    } 
     
    137137    */ 
    138138 
    139         if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Connection established\n") ; 
     139        if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Connection established\n") ; 
    140140    /* 
    141141    **    Read the encryption supported 
     
    143143    if ( readmessage(tmpctrlsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    144144        close(tmpctrlsock) ; 
    145         printmessage(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message\n") ; 
     145        PRINTMESSAGE(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message\n") ; 
    146146        return -1 ; 
    147147    } 
     
    149149    if ( msg->code != MSG_CRYPT) { 
    150150        close(tmpctrlsock) ; 
    151         printmessage(stderr,CASE_ERROR,55,timestamp,"No encryption message \n") ; 
     151        PRINTMESSAGE(stderr,CASE_ERROR,55,timestamp,"No encryption message \n") ; 
    152152        return -1 ; 
    153153    } 
     
    159159    if ( ( readbuffer = (char *) malloc (msglen + 1) ) == NULL ) { 
    160160        close(tmpctrlsock) ; 
    161         printmessage(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message : malloc failed (%s)\n",strerror(errno)) ; 
     161        PRINTMESSAGE(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message : malloc failed (%s)\n",strerror(errno)) ; 
    162162        return -1 ; 
    163163    } 
     
    165165        free(readbuffer) ; 
    166166        close(tmpctrlsock) ; 
    167         printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s\n","type") ; 
     167        PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s\n","type") ; 
    168168        return -1 ; 
    169169    } 
     
    178178            free(readbuffer) ; 
    179179            close(tmpctrlsock) ; 
    180             printmessage(stderr,CASE_ERROR,58,timestamp,"Error sending CERT_LOG message : %s\n",strerror(errno)) ; 
     180            PRINTMESSAGE(stderr,CASE_ERROR,58,timestamp,"Error sending CERT_LOG message : %s\n",strerror(errno)) ; 
    181181            return -1 ; 
    182182        } 
     
    195195            if (verbose) { 
    196196                while (messages != NULL) { 
    197                     printmessage(stderr,CASE_ERROR,27,timestamp,"%s\n", messages->msg); 
     197                    PRINTMESSAGE(stderr,CASE_ERROR,27,timestamp,"%s\n", messages->msg); 
    198198                    messages = messages->next; 
    199199                } 
    200200            } else { 
    201                 printmessage(stderr,CASE_ERROR,27,timestamp,"%s\n", messages->msg); 
     201                PRINTMESSAGE(stderr,CASE_ERROR,27,timestamp,"%s\n", messages->msg); 
    202202            } 
    203203            return -1 ; 
     
    207207            ** message 
    208208            */ 
    209             if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Client certificate authentication OK\n") ; 
    210             if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Waiting for server answer\n") ; 
     209            if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Client certificate authentication OK\n") ; 
     210            if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Waiting for server answer\n") ; 
    211211            if ( readmessage(tmpctrlsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    212212                close(tmpctrlsock) ; 
    213213                free(readbuffer) ; 
    214                 printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","") ; 
     214                PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","") ; 
    215215                return -1 ; 
    216216            } 
     
    224224#endif 
    225225                if ( ( readbuffer = (char *) malloc(msglen + 1) ) == NULL ) { 
    226                     printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : malloc failed (%s)\n",strerror(errno)) ; 
     226                    PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : malloc failed (%s)\n",strerror(errno)) ; 
    227227                    return -1 ; 
    228228                } 
     
    231231                    free(readbuffer) ; 
    232232                    if ( code == MSG_BAD ) { 
    233                         printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","BAD message") ; 
     233                        PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","BAD message") ; 
    234234                        return -1 ; 
    235235                    } else { 
    236                         printmessage(stderr,CASE_FATAL_ERROR,59,timestamp,"Error reading login message answer : %s\n","BAD NO RETRY message") ; 
     236                        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,59,timestamp,"Error reading login message answer : %s\n","BAD NO RETRY message") ; 
    237237                    } 
    238238                } else { 
     
    240240                    readbuffer[msglen] = '\0' ; 
    241241                    if ( code == MSG_BAD ) { 
    242                         printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",readbuffer) ; 
     242                        PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",readbuffer) ; 
    243243                        free(readbuffer) ; 
    244244                        return -1 ; 
    245245                    } else { 
    246                         printmessage(stderr,CASE_FATAL_ERROR,100,timestamp,"%s\n",readbuffer) ; 
     246                        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,100,timestamp,"%s\n",readbuffer) ; 
    247247                    } 
    248248                } 
     
    254254#endif 
    255255                if ( ( readbuffer = (char *) malloc(msglen + 1) ) == NULL ) { 
    256                     printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : OK message : malloc failed (%s)\n",strerror(errno)) ; 
     256                    PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : OK message : malloc failed (%s)\n",strerror(errno)) ; 
    257257                    return -1 ; 
    258258                } 
     
    260260                    free(readbuffer) ; 
    261261                    close(tmpctrlsock) ; 
    262                     printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","OK message") ; 
     262                    PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","OK message") ; 
    263263                    return -1 ; 
    264264                } else { 
    265265                    readbuffer[msglen] = '\0' ; 
    266266                    if ( code == MSG_OK ) { 
    267                         if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",readbuffer) ; 
     267                        if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",readbuffer) ; 
    268268                    } else { 
    269                         if ( warning) printmessage(stdout,CASE_WARNING,100,timestamp," %s\n",readbuffer) ; 
     269                        if ( warning) PRINTMESSAGE(stdout,CASE_WARNING,100,timestamp," %s\n",readbuffer) ; 
    270270                    } 
    271271                } 
     
    273273                free(readbuffer) ; 
    274274                close(tmpctrlsock) ; 
    275                 printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","Unkown answer message") ; 
     275                PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","Unkown answer message") ; 
    276276                return -1 ; 
    277277            } 
    278             if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Server answer : OK\n") ; 
     278            if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Server answer : OK\n") ; 
    279279            free(readbuffer) ; 
    280280            incontrolsock  = tmpctrlsock ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_dir.c

    r773 r1265  
    5757    char    *tmpfile, *tmpchar, *tmpremotefile ; 
    5858     
    59     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : dir %s \n",remotefile) ; 
     59    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : dir %s \n",remotefile) ; 
    6060    filelist = NULL ; 
    6161    filelistlen = 0 ; 
     
    6666    strcat(tmpremotefile, "/*"); 
    6767    if ( (retcode = bbftp_list(tmpremotefile,&filelist,&filelistlen,errcode) ) != BB_RET_OK) { 
    68         if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< FAILED\n") ; 
     68        if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< FAILED\n") ; 
    6969        return retcode ; 
    7070    } 
    7171    if ( statoutput ) { 
    72         printmessage(stdout,CASE_NORMAL,0,0,"dir %s\n", remotefile) ; 
     72        PRINTMESSAGE(stdout,CASE_NORMAL,0,0,"dir %s\n", remotefile) ; 
    7373    } 
    7474    if ( filelistlen == 0 ) { 
    75         if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     75        if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    7676        return BB_RET_OK ; 
    7777    } 
     
    9292        filelistlen = filelistlen - strlen(tmpfile) - 1 - strlen(tmpchar) - 1; 
    9393        if ( statoutput ) { 
    94             printmessage(stdout,CASE_NORMAL,0,0,"%s %s\n", tmpchar, tmpfile) ; 
     94            PRINTMESSAGE(stdout,CASE_NORMAL,0,0,"%s %s\n", tmpchar, tmpfile) ; 
    9595        } 
    9696        tmpfile = tmpchar + strlen(tmpchar) + 1 ; 
    9797    } 
    98     if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     98    if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    9999    free(filelist) ; 
    100100    return BB_RET_OK ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_get.c

    r773 r1265  
    124124    extern  int simulation_mode ; 
    125125 
    126     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : get %s %s\n",remotefilename,curfilename) ; 
     126    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : get %s %s\n",remotefilename,curfilename) ; 
    127127    /* 
    128128    ** Check if file is correct  
    129129    */ 
    130130    if ( (retcode = bbftp_storecheckfile(realfilename,logmessage,errcode)) < 0 ) { 
    131         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     131        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    132132        bbftp_free_all_var() ; 
    133133        return  BB_RET_FT_NR ; 
    134134    } else if ( retcode > 0 ) { 
    135         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     135        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    136136        bbftp_free_all_var() ; 
    137137        return BB_RET_ERROR ; 
     
    150150        ** tell the calling program to restart a connection 
    151151        */ 
    152         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RETR_V2"); 
     152        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RETR_V2"); 
    153153        *errcode = 64 ; 
    154154        bbftp_free_all_var() ; 
     
    160160    ** Set up the parameters 
    161161    */ 
    162     if ( debug ) printmessage(stdout,CASE_NORMAL,0,timestamp,"Requested stream number = %d\n",nbport) ; 
     162    if ( debug ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Requested stream number = %d\n",nbport) ; 
    163163    msg_store_v2->transferoption = transferoption ; 
    164164#ifndef WORDS_BIGENDIAN 
     
    187187        ** tell the calling program to restart a connection 
    188188        */ 
    189         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RETR_V2 (data)"); 
     189        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RETR_V2 (data)"); 
    190190        *errcode = 64 ; 
    191191        bbftp_free_all_var() ; 
     
    204204#endif 
    205205    if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    206         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_FILENAME"); 
     206        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_FILENAME"); 
    207207        *errcode = 64 ; 
    208208        bbftp_free_all_var() ; 
     
    211211    } 
    212212    if ( writemessage(outcontrolsock,remotefilename,strlen(remotefilename),sendcontrolto,0) < 0 ) { 
    213         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_FILENAME (filename)"); 
     213        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_FILENAME (filename)"); 
    214214        *errcode = 64 ; 
    215215        bbftp_free_all_var() ; 
     
    239239            ** and restart 
    240240            */ 
    241             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     241            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    242242            *errcode = 66 ; 
    243243            bbftp_free_all_var() ; 
     
    259259        */ 
    260260        if ( readmessage(incontrolsock,sendbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    261             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_RETR_V2)"); 
     261            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_RETR_V2)"); 
    262262            *errcode = 61 ; 
    263263            bbftp_free_all_var() ; 
     
    277277#endif 
    278278            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    279                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 1 (bbftp_get)",strerror(errno)) ; 
     279                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 1 (bbftp_get)",strerror(errno)) ; 
    280280                *errcode = 35 ; 
    281281                bbftp_free_all_var() ; 
     
    284284            } 
    285285            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    286                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_RETR_V2)"); 
     286                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_RETR_V2)"); 
    287287                *errcode = 67 ; 
    288288                bbftp_free_all_var() ; 
     
    296296            } else { 
    297297                buffer[msglen] = '\0' ; 
    298                  printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    299                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     298                 PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     299                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    300300                free(buffer) ; 
    301301                *errcode = 100 ; 
     
    324324#endif 
    325325            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    326                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 2 (bbftp_get)",strerror(errno)) ; 
     326                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 2 (bbftp_get)",strerror(errno)) ; 
    327327                *errcode = 35 ; 
    328328                bbftp_free_all_var() ; 
     
    331331            } 
    332332            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    333                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_TRANS_OK_V2"); 
     333                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_TRANS_OK_V2"); 
    334334                *errcode = 67 ; 
    335335                bbftp_free_all_var() ; 
     
    359359            if (msg->code == MSG_TRANS_OK_V3 ) { /* PASSIVE MODE: get the ports */ 
    360360                if ( (myports = (int *) malloc (requestedstreamnumber*sizeof(int)) ) == NULL ) { 
    361                     printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","ports buffer",strerror(errno)) ; 
     361                    PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","ports buffer",strerror(errno)) ; 
    362362                    *errcode = 35 ; 
    363363                    bbftp_free_all_var() ; 
     
    367367                } 
    368368                if ( readmessage(incontrolsock,(char *) myports,requestedstreamnumber*sizeof(int),recvcontrolto,0) < 0 ) { 
    369                     printmessage(stderr,CASE_ERROR,68,timestamp,"Error reading ports for %s message\n","MSG_TRANS_OK_V3"); 
     369                    PRINTMESSAGE(stderr,CASE_ERROR,68,timestamp,"Error reading ports for %s message\n","MSG_TRANS_OK_V3"); 
    370370                    *errcode = 68 ; 
    371371                    bbftp_free_all_var() ; 
     
    379379                        *portfree = ntohl(*portfree) ; 
    380380#endif 
    381                         if ( debug ) printmessage(stdout,CASE_NORMAL,0,timestamp,"Reading port:%d\n",*portfree); 
     381                        if ( debug ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Reading port:%d\n",*portfree); 
    382382                        portfree++ ; 
    383383                    } 
     
    391391            ** and restart 
    392392            */ 
    393             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_TRANS_OK_V2"); 
     393            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_TRANS_OK_V2"); 
    394394            *errcode = 62 ; 
    395395            bbftp_free_all_var() ; 
     
    398398        }  
    399399    } 
    400     if ( debug ) printmessage(stdout,CASE_NORMAL,0,timestamp,"Accepted stream number = %d\n",requestedstreamnumber) ; 
     400    if ( debug ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Accepted stream number = %d\n",requestedstreamnumber) ; 
    401401    if ( (transferoption & TROPT_GZIP ) == TROPT_GZIP  
    402402        && (msg_store_v2->transferoption & TROPT_GZIP) != TROPT_GZIP ) { 
    403         if (warning) printmessage(stderr,CASE_WARNING,27,timestamp,"The server cannot handle compression: option ignored\n"); 
     403        if (warning) PRINTMESSAGE(stderr,CASE_WARNING,27,timestamp,"The server cannot handle compression: option ignored\n"); 
    404404        transferoption = transferoption & ~TROPT_GZIP ; 
    405405    } 
     
    408408        ** Error creating file (fatal error) 
    409409        */ 
    410         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     410        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    411411        msg = (struct message *)sendbuffer ; 
    412412        msg->code = MSG_ABORT ; 
     
    417417#endif 
    418418        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    419             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     419            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    420420            *errcode = 64 ; 
    421421            bbftp_free_all_var() ; 
     
    431431        ** Error creating file (non fatal error) 
    432432        */ 
    433         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     433        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    434434        msg = (struct message *)sendbuffer ; 
    435435        msg->code = MSG_ABORT ; 
     
    440440#endif 
    441441        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    442             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     442            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    443443            *errcode = 64 ; 
    444444            bbftp_free_all_var() ; 
     
    462462                sscanf(lastmodif,"%08x",&ftime.modtime) ; 
    463463                if ( utime(realfilename,&ftime) < 0 ) { 
    464                     printmessage(stderr,CASE_ERROR,84,timestamp,"Error changing access time : %s\n",strerror(errno)); 
     464                    PRINTMESSAGE(stderr,CASE_ERROR,84,timestamp,"Error changing access time : %s\n",strerror(errno)); 
    465465                    *errcode = 84 ; 
    466466                    unlink(realfilename) ; 
     
    478478        if ( (transferoption & TROPT_MODE ) == TROPT_MODE ) { 
    479479            if ( bbftp_storechmod(realfilename,filemode,logmessage,errcode) < 0 ) { 
    480                 printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     480                PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    481481                bbftp_storeunlink(realfilename) ; 
    482482                bbftp_clean_child() ; 
     
    493493            } else { 
    494494                if ( bbftp_storerename(realfilename,curfilename,logmessage,errcode) < 0 ) { 
    495                     printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     495                    PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    496496                    bbftp_storeunlink(realfilename) ; 
    497497                    msg = (struct message *)sendbuffer ; 
     
    503503#endif 
    504504                    if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    505                         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     505                        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    506506                        *errcode = 64 ; 
    507507                        bbftp_free_all_var() ; 
     
    517517#else  
    518518            if ( bbftp_storerename(realfilename,curfilename,logmessage,errcode) < 0 ) { 
    519                 printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     519                PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    520520                bbftp_storeunlink(realfilename) ; 
    521521                msg = (struct message *)sendbuffer ; 
     
    527527#endif 
    528528                if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    529                     printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     529                    PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    530530                    *errcode = 64 ; 
    531531                    bbftp_free_all_var() ; 
     
    548548#endif 
    549549        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    550             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CREATE_ZERO"); 
     550            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CREATE_ZERO"); 
    551551            *errcode = 64 ; 
    552552            bbftp_free_all_var() ; 
     
    555555            return BB_RET_CONN_BROKEN ; /* restart connection */ 
    556556        } 
    557         if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     557        if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    558558        bbftp_free_all_var() ; 
    559559        free(buffer) ; 
     
    566566    */ 
    567567    if ( (buffer = (char *) malloc (requestedstreamnumber*sizeof(int))) == NULL) { 
    568         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 3 (bbftp_get)",strerror(errno)); 
     568        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 3 (bbftp_get)",strerror(errno)); 
    569569        *errcode = 35 ; 
    570570        msg = (struct message *)sendbuffer ; 
     
    576576#endif 
    577577        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    578             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     578            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    579579            *errcode = 64 ; 
    580580            bbftp_storeunlink(realfilename) ; 
     
    591591    */ 
    592592    if ( (mychildren = (int *) malloc (requestedstreamnumber*sizeof(int))) == NULL) { 
    593         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","mychildren (bbftp_get)",strerror(errno)); 
     593        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","mychildren (bbftp_get)",strerror(errno)); 
    594594        *errcode = 35 ; 
    595595        msg = (struct message *)sendbuffer ; 
     
    601601#endif 
    602602        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    603             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     603            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    604604            *errcode = 64 ; 
    605605            bbftp_storeunlink(realfilename) ; 
     
    625625    */ 
    626626    if ( (readbuffer = (char *) malloc (buffersizeperstream*1024)) == NULL) { 
    627         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","readbuffer (bbftp_get)",strerror(errno)); 
     627        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","readbuffer (bbftp_get)",strerror(errno)); 
    628628        *errcode = 35 ; 
    629629        msg = (struct message *)sendbuffer ; 
     
    635635#endif 
    636636        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    637             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     637            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    638638            *errcode = 64 ; 
    639639            bbftp_storeunlink(realfilename) ; 
     
    655655    if ( (transferoption & TROPT_GZIP ) == TROPT_GZIP ) { 
    656656        if ( (compbuffer = (char *) malloc (buffersizeperstream*1024)) == NULL) { 
    657             printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","compbuffer (bbftp_get)",strerror(errno)); 
     657            PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","compbuffer (bbftp_get)",strerror(errno)); 
    658658            *errcode = 35 ; 
    659659            msg = (struct message *)sendbuffer ; 
     
    665665#endif 
    666666            if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    667                 printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     667                PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    668668                *errcode = 64 ; 
    669669                bbftp_storeunlink(realfilename) ; 
     
    685685    if ( protocol == 2 ) { /* ACTIVE MODE */ 
    686686      if ( (myports = (int *) malloc (requestedstreamnumber*sizeof(int)) ) == NULL ) { 
    687         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","myports (bbftp_get)",strerror(errno)); 
     687        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","myports (bbftp_get)",strerror(errno)); 
    688688        *errcode = 35 ; 
    689689        msg = (struct message *)sendbuffer ; 
     
    695695#endif 
    696696        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    697             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     697            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    698698            *errcode = 64 ; 
    699699            bbftp_free_all_var() ; 
     
    710710    } 
    711711    if ( (mysockets = (int *) malloc (requestedstreamnumber*sizeof(int)) ) == NULL ) { 
    712         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","mysockets (bbftp_get)",strerror(errno)); 
     712        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","mysockets (bbftp_get)",strerror(errno)); 
    713713        *errcode = 35 ; 
    714714        msg = (struct message *)sendbuffer ; 
     
    720720#endif 
    721721        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    722             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     722            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    723723            *errcode = 64 ; 
    724724            bbftp_storeunlink(realfilename) ; 
     
    758758#endif 
    759759        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    760             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     760            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    761761            *errcode = 64 ; 
    762762            bbftp_storeunlink(realfilename) ; 
     
    784784            mysockfree++ ; 
    785785        } 
    786         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s",logmessage); 
     786        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s",logmessage); 
    787787        bbftp_free_all_var() ; 
    788788        free(buffer) ; 
     
    818818        ** tell the calling program to restart a connection 
    819819        */ 
    820         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V2"); 
     820        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V2"); 
    821821        *errcode = 64 ; 
    822822        /* 
     
    843843      } 
    844844      if ( writemessage(outcontrolsock,buffer,requestedstreamnumber*sizeof(int),sendcontrolto,0) < 0) { 
    845         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V2 (ports)"); 
     845        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V2 (ports)"); 
    846846        *errcode = 64 ; 
    847847        /* 
     
    870870            mysockfree++ ; 
    871871        } 
    872         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s",logmessage); 
     872        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s",logmessage); 
    873873        bbftp_free_all_var() ; 
    874874        free(buffer) ; 
     
    904904        ** tell the calling program to restart a connection 
    905905        */ 
    906         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V3"); 
     906        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V3"); 
    907907        *errcode = 64 ; 
    908908        /* 
     
    939939            ** and restart 
    940940            */ 
    941             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno) ); 
     941            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno) ); 
    942942            *errcode = 66 ; 
    943943            /* 
     
    998998        ** Bad thing so abort  
    999999        */ 
    1000         printmessage(stderr,CASE_ERROR,37,timestamp,"No more child\n"); 
     1000        PRINTMESSAGE(stderr,CASE_ERROR,37,timestamp,"No more child\n"); 
    10011001        *errcode = 37 ; 
    10021002        bbftp_storeunlink(realfilename) ; 
     
    10091009        */ 
    10101010        if ( readmessage(incontrolsock,sendbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    1011             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_TRANS_START_V2)"); 
     1011            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_TRANS_START_V2)"); 
    10121012            *errcode = 61 ; 
    10131013            /* 
     
    10311031            msglen = msg->msglen ; 
    10321032#endif 
    1033             if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"BAD message length = %d\n",msglen) ; 
     1033            if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"BAD message length = %d\n",msglen) ; 
    10341034            if ( ( buffer = (char *) malloc (msglen+1) ) == NULL ) { 
    1035                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 4 (bbftp_get)",strerror(errno)); 
     1035                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 4 (bbftp_get)",strerror(errno)); 
    10361036                *errcode = 35 ; 
    10371037                pidfree = mychildren ; 
     
    10471047            } 
    10481048            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    1049                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_TRANS_START_V2)"); 
     1049                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_TRANS_START_V2)"); 
    10501050                *errcode = 67 ; 
    10511051                /* 
     
    10641064                bbftp_clean_child() ; 
    10651065                buffer[msglen] = '\0' ; 
    1066                  printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    1067                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     1066                 PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     1067                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    10681068                bbftp_storeunlink(realfilename) ; 
    10691069                bbftp_free_all_var() ; 
     
    10791079            if ( bbftp_storeclosecastfile(realfilename,logmessage) < 0 ) { 
    10801080                bbftp_storeunlink(realfilename) ; 
    1081                 printmessage(stderr,CASE_ERROR,80,timestamp,"Error closing file : %s\n",logmessage); 
     1081                PRINTMESSAGE(stderr,CASE_ERROR,80,timestamp,"Error closing file : %s\n",logmessage); 
    10821082                bbftp_clean_child() ; 
    10831083                bbftp_free_all_var() ; 
     
    10901090                    sscanf(lastmodif,"%08x",&ftime.modtime) ; 
    10911091                    if ( utime(realfilename,&ftime) < 0 ) { 
    1092                         printmessage(stderr,CASE_ERROR,84,timestamp,"Error changing access time : %s\n",strerror(errno)); 
     1092                        PRINTMESSAGE(stderr,CASE_ERROR,84,timestamp,"Error changing access time : %s\n",strerror(errno)); 
    10931093                        *errcode = 84 ; 
    10941094                        bbftp_storeunlink(realfilename) ; 
     
    11061106            if ( (transferoption & TROPT_MODE ) == TROPT_MODE ) { 
    11071107                if ( bbftp_storechmod(realfilename,filemode,logmessage,errcode) < 0 ) { 
    1108                     printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     1108                    PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    11091109                    bbftp_storeunlink(realfilename) ; 
    11101110                    bbftp_clean_child() ; 
     
    11211121                } else { 
    11221122                    if ( bbftp_storerename(realfilename,curfilename,logmessage,errcode) < 0 ) { 
    1123                         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     1123                        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    11241124                        bbftp_storeunlink(realfilename) ; 
    11251125                        bbftp_clean_child() ; 
     
    11301130#else  
    11311131                if ( bbftp_storerename(realfilename,curfilename,logmessage,errcode) < 0 ) { 
    1132                     printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     1132                    PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    11331133                    bbftp_storeunlink(realfilename) ; 
    11341134                    bbftp_clean_child() ; 
     
    11501150#endif 
    11511151            discardmessage(incontrolsock,msglen,recvcontrolto,0) ; 
    1152             if ( verbose ) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     1152            if ( verbose ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    11531153            (void) gettimeofday(&tend, (struct timezone *)0); 
    11541154            tdiff.tv_sec = tend.tv_sec - tstart.tv_sec ; 
     
    11591159            bs = filesize / nz(s); 
    11601160            if (!simulation_mode) { 
    1161                 if ( verbose ) printmessage(stdout,CASE_NORMAL,0,timestamp,"%" LONG_LONG_FORMAT" bytes got in %.3g secs (%.3g Kbytes/sec or %.3g Mbits/s)\n", filesize, s, bs / 1024.0,(8.0*bs) / (1024.0 * 1024.0)); 
     1161                if ( verbose ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"%" LONG_LONG_FORMAT" bytes got in %.3g secs (%.3g Kbytes/sec or %.3g Mbits/s)\n", filesize, s, bs / 1024.0,(8.0*bs) / (1024.0 * 1024.0)); 
    11621162            } 
    11631163            if ( statoutput ) { 
    1164                 printmessage(stdout,CASE_NORMAL,0,0,"get %" LONG_LONG_FORMAT" %.3f %d %d %d %d %s\n" 
     1164                PRINTMESSAGE(stdout,CASE_NORMAL,0,0,"get %" LONG_LONG_FORMAT" %.3f %d %d %d %d %s\n" 
    11651165                            , filesize, s, buffersizeperstream, sendwinsize, recvwinsize, requestedstreamnumber 
    11661166                            , ((transferoption & TROPT_GZIP ) == TROPT_GZIP) ? "gzip" : "nogzip" ); 
     
    11791179#endif 
    11801180            if ( ( buffer = (char *) malloc (msglen+1) ) == NULL ) { 
    1181                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 5 (bbftp_get)",strerror(errno)); 
     1181                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 5 (bbftp_get)",strerror(errno)); 
    11821182                *errcode = 35 ; 
    11831183                bbftp_clean_child() ; 
     
    11881188            } 
    11891189            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    1190                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_INFO (on MSG_TRANS_START_V2)"); 
     1190                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_INFO (on MSG_TRANS_START_V2)"); 
    11911191                /* 
    11921192                ** Kill all child  
     
    12011201            } 
    12021202            buffer[msglen] = '\0' ; 
    1203             if (warning) printmessage(stderr,CASE_WARNING,100,timestamp,"%s\n",buffer); 
     1203            if (warning) PRINTMESSAGE(stderr,CASE_WARNING,100,timestamp,"%s\n",buffer); 
    12041204            free(buffer) ; 
    12051205            goto waitcontrol ; 
     
    12101210            ** and restart 
    12111211            */ 
    1212             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_TRANS_START_V2)"); 
     1212            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_TRANS_START_V2)"); 
    12131213            *errcode = 62 ; 
    12141214            /* 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_lcd.c

    r773 r1265  
    5757    int     savederrno ; 
    5858 
    59     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : lcd %s\n",dirpath) ; 
     59    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : lcd %s\n",dirpath) ; 
    6060 
    6161#if defined(WITH_RFIO) || defined(WITH_RFIO64) 
    6262    if ( (transferoption & TROPT_RFIO_O) == TROPT_RFIO_O ) { 
    63         printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n","lcd not supported under RFIO") ; 
     63        PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n","lcd not supported under RFIO") ; 
    6464        *errcode = 26 ; 
    6565        return BB_RET_FT_NR ; 
     
    7676                savederrno == ENOTDIR || 
    7777                savederrno == ENOENT ) { 
    78             printmessage(stderr,CASE_ERROR,71,timestamp,"Error changing directory %s (%s)\n",dirpath,strerror(savederrno)) ; 
     78            PRINTMESSAGE(stderr,CASE_ERROR,71,timestamp,"Error changing directory %s (%s)\n",dirpath,strerror(savederrno)) ; 
    7979            *errcode = 71 ; 
    8080            return BB_RET_FT_NR ; 
    8181        } else { 
    82             printmessage(stderr,CASE_ERROR,71,timestamp,"Error changing directory %s (%s)\n",dirpath,strerror(savederrno)) ; 
     82            PRINTMESSAGE(stderr,CASE_ERROR,71,timestamp,"Error changing directory %s (%s)\n",dirpath,strerror(savederrno)) ; 
    8383            *errcode = 71 ; 
    8484            return BB_RET_ERROR ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_list.c

    r773 r1265  
    7676    int     retcode ; 
    7777     
    78     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : list %s\n",line) ; 
     78    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : list %s\n",line) ; 
    7979 
    8080    msg = (struct message *)minbuffer ; 
     
    9292        ** tell the calling program to restart a connection 
    9393        */ 
    94         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_LIST_V2"); 
     94        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_LIST_V2"); 
    9595        *errcode = 64 ; 
    9696        bbftp_free_all_var() ; 
     
    104104    msg_integer->myint =  transferoption ; 
    105105    if ( writemessage(outcontrolsock,minbuffer,sizeof(int),sendcontrolto,0) < 0 ) { 
    106         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_LIST_V2 (transferoption)"); 
     106        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_LIST_V2 (transferoption)"); 
    107107        *errcode = 64 ; 
    108108        bbftp_close_control() ; 
     
    113113    */ 
    114114    if ( writemessage(outcontrolsock,line,strlen(line),sendcontrolto,0) < 0 ) { 
    115         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_LIST_V2 (directory name)"); 
     115        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_LIST_V2 (directory name)"); 
    116116        *errcode = 64 ; 
    117117        bbftp_close_control() ; 
     
    136136            ** and restart 
    137137            */ 
    138             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     138            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    139139            *errcode = 66 ; 
    140140            bbftp_close_control() ; 
     
    160160        */ 
    161161        if ( readmessage(incontrolsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    162             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_LIST_V2)"); 
     162            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_LIST_V2)"); 
    163163            *errcode = 61 ; 
    164164            bbftp_close_control() ; 
     
    176176#endif 
    177177            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    178                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_list)",strerror(errno)) ; 
     178                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_list)",strerror(errno)) ; 
    179179                *errcode = 35 ; 
    180180                bbftp_close_control() ; 
     
    182182            } 
    183183            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    184                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_LIST_V2)"); 
     184                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_LIST_V2)"); 
    185185                *errcode = 67 ; 
    186186                bbftp_close_control() ; 
     
    193193            } else { 
    194194                buffer[msglen] = '\0' ; 
    195                 printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    196                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     195                PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     196                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    197197                free(buffer) ; 
    198198                if ( code == MSG_BAD ) { 
     
    227227                ** There was no file corresponding 
    228228                */ 
    229                 if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK : no file\n") ; 
     229                if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK : no file\n") ; 
    230230                *filelistlen = 0 ;  
    231231                return BB_RET_OK ; 
    232232            } else { 
    233233                if ( ((*filelist) = (char *) malloc(msglen+1) ) == NULL) { 
    234                     printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","filelist (bbftp_list)",strerror(errno)) ; 
     234                    PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","filelist (bbftp_list)",strerror(errno)) ; 
    235235                    *errcode = 35 ; 
    236236                    bbftp_close_control() ; 
     
    238238                } 
    239239                if ( readmessage(incontrolsock,*filelist,msglen,recvcontrolto,0) < 0) { 
    240                     printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_LIST_REPL_V2 (on MSG_LIST_V2)"); 
     240                    PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_LIST_REPL_V2 (on MSG_LIST_V2)"); 
    241241                    *errcode = 67 ; 
    242242                    bbftp_close_control() ; 
     
    246246                (*filelist)[msglen] = '\0' ; 
    247247                *filelistlen = msglen ;  
    248                 if ( verbose ) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     248                if ( verbose ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    249249                return BB_RET_OK ; 
    250250            } 
     
    255255            ** and restart 
    256256            */ 
    257             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
     257            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
    258258            *errcode = 62 ; 
    259259            bbftp_close_control() ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_mget.c

    r773 r1265  
    6666    int     nbtry ; 
    6767     
    68     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : mget %s %s\n",remotefile,localdir) ; 
     68    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : mget %s %s\n",remotefile,localdir) ; 
    6969    /* 
    7070    ** First look at the local directory 
     
    7676#if defined(WITH_RFIO) || defined(WITH_RFIO64) 
    7777        if ( (transferoption & TROPT_RFIO_O) == TROPT_RFIO_O ) { 
    78             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : local rfio and localdir equal ./ are imcompatible in mget\n") ; 
     78            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : local rfio and localdir equal ./ are imcompatible in mget\n") ; 
    7979            *errcode = 26 ; 
    8080            return  BB_RET_FT_NR ; 
     
    8686        */ 
    8787        if ( (retcode = bbftp_retrcheckdir(localdir,logmessage,errcode)) < 0 ) { 
    88             printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage) ; 
     88            PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage) ; 
    8989            return BB_RET_FT_NR ; 
    9090        } else if ( retcode > 0 ) { 
    91             printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage) ; 
     91            PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage) ; 
    9292            return BB_RET_ERROR ; 
    9393        } 
     
    9696    filelistlen = 0 ; 
    9797    if ( (retcode = bbftp_list(remotefile,&filelist,&filelistlen,errcode) ) != BB_RET_OK) { 
    98         if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< FAILED\n") ; 
     98        if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< FAILED\n") ; 
    9999        return retcode ; 
    100100    } 
    101101    if ( filelistlen == 0 ) { 
    102         if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     102        if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    103103        return BB_RET_OK ; 
    104104    } 
     
    133133                */ 
    134134                if ( (curfilename = (char *) malloc (strlen(localdir)+strlen(slash)+2) ) == NULL ) { 
    135                     printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","curfilename",strerror(errno)) ; 
     135                    PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","curfilename",strerror(errno)) ; 
    136136                    *errcode = 35 ; 
    137137                    free(*filelist) ; 
     
    139139                } 
    140140                if ( (realfilename = (char *) malloc (strlen(localdir)+strlen(slash)+30)) == NULL ) { 
    141                     printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","realfilename",strerror(errno)) ; 
     141                    PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","realfilename",strerror(errno)) ; 
    142142                    *errcode = 35 ; 
    143143                    free(curfilename) ; 
     
    218218                myexitcode = *errcode ; 
    219219                if ( resfd < 0 ) { 
    220                     if (!verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"get %s %s/%s FAILED\n",tmpfile,localdir,slash)        ; 
     220                    if (!verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"get %s %s/%s FAILED\n",tmpfile,localdir,slash)        ; 
    221221                } else { 
    222222                    write(resfd,"get ",4) ; 
     
    230230            } else if ( retcode == BB_RET_OK) {         
    231231                if ( resfd < 0 ) { 
    232                     if (!verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"get %s %s/%s OK\n",tmpfile,localdir,slash)        ; 
     232                    if (!verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"get %s %s/%s OK\n",tmpfile,localdir,slash)        ; 
    233233                } else { 
    234234                    write(resfd,"get ",4) ; 
     
    243243                myexitcode = *errcode ; 
    244244                if ( resfd < 0 ) { 
    245                     if (!verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"get %s %s/%s FAILED\n",tmpfile,localdir,slash)        ; 
     245                    if (!verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"get %s %s/%s FAILED\n",tmpfile,localdir,slash)        ; 
    246246                } else { 
    247247                    write(resfd,"get ",4) ; 
     
    257257        } 
    258258    } 
    259     if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     259    if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    260260    free(filelist) ; 
    261261    return BB_RET_OK ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_mkdir.c

    r773 r1265  
    8484    struct  mess_integer *msg_integer ; 
    8585    
    86     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : mkdir %s\n",dirpath) ; 
     86    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : mkdir %s\n",dirpath) ; 
    8787     
    8888    msg = (struct message *)minbuffer ; 
     
    9999        ** tell the calling program to restart a connection 
    100100        */ 
    101         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_MKDIR_V2"); 
     101        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_MKDIR_V2"); 
    102102        *errcode = 64 ; 
    103103        bbftp_close_control() ; 
     
    110110    msg_integer->myint = transferoption ; 
    111111    if ( writemessage(outcontrolsock,minbuffer,sizeof(int),sendcontrolto,0) < 0 ) { 
    112         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_MKDIR_V2 (transferoption)"); 
     112        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_MKDIR_V2 (transferoption)"); 
    113113        *errcode = 64 ; 
    114114        bbftp_close_control() ; 
     
    119119    */ 
    120120    if ( writemessage(outcontrolsock,dirpath,strlen(dirpath),sendcontrolto,0) < 0 ) { 
    121         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_MKDIR_V2 (directory name)"); 
     121        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_MKDIR_V2 (directory name)"); 
    122122        *errcode = 64 ; 
    123123        bbftp_close_control() ; 
     
    142142            ** and restart 
    143143            */ 
    144             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     144            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    145145            *errcode = 66 ; 
    146146            bbftp_close_control() ; 
     
    166166        */ 
    167167        if ( readmessage(incontrolsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    168             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
     168            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
    169169            *errcode = 61 ; 
    170170            bbftp_close_control() ; 
     
    182182#endif 
    183183            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    184                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_mkdir)",strerror(errno)) ; 
     184                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_mkdir)",strerror(errno)) ; 
    185185                *errcode = 35 ; 
    186186                bbftp_close_control() ; 
     
    188188            } 
    189189            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    190                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_MKDIR_V2)"); 
     190                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_MKDIR_V2)"); 
    191191                *errcode = 67 ; 
    192192                bbftp_close_control() ; 
     
    199199            } else { 
    200200                buffer[msglen] = '\0' ; 
    201                 printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    202                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     201                PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     202                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    203203                free(buffer) ; 
    204204                if ( code == MSG_BAD ) { 
     
    230230#endif 
    231231            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    232                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_mkdir)",strerror(errno)) ; 
     232                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_mkdir)",strerror(errno)) ; 
    233233                *errcode = 35 ; 
    234234                bbftp_close_control() ; 
     
    236236            } 
    237237            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0) { 
    238                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
     238                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
    239239                *errcode = 67 ; 
    240240                bbftp_close_control() ; 
     
    243243            }  
    244244            buffer[msglen] = '\0' ; 
    245             if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
     245            if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
    246246            free(buffer) ; 
    247247            return BB_RET_OK ; 
     
    252252            ** and restart 
    253253            */ 
    254             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
     254            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_MKDIR_V2)"); 
    255255            *errcode = 62 ; 
    256256            bbftp_close_control() ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_mput.c

    r773 r1265  
    6464     
    6565     
    66     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : mput %s %s\n",localfile,remotedir) ; 
     66    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : mput %s %s\n",localfile,remotedir) ; 
    6767 
    6868    if ( (retcode = bbftp_retrlistdir(localfile,&filelist,&filelistlen,logmessage,errcode) ) < 0 ) { 
    69         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage) ; 
     69        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage) ; 
    7070        return BB_RET_FT_NR ; 
    7171    } 
    7272    if ( filelistlen == 0 ) { 
    73         if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     73        if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    7474        return BB_RET_OK ; 
    7575    } 
     
    104104                */ 
    105105                if ( (remotefilename = (char *) malloc (strlen(remotedir)+strlen(slash)+2)) == NULL ) { 
    106                     printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","remotefilename",strerror(errno)) ; 
     106                    PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","remotefilename",strerror(errno)) ; 
    107107                    *errcode = 35 ; 
    108108                    free(*filelist) ; 
     
    115115                */ 
    116116                if ( (curfilename = (char *) malloc (strlen(tmpfile)+1)) == NULL ) { 
    117                     printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","curfilename",strerror(errno)) ; 
     117                    PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","curfilename",strerror(errno)) ; 
    118118                    *errcode = 35 ; 
    119119                    free(remotefilename) ; 
     
    122122                } 
    123123                if ( (realfilename = (char *) malloc (strlen(tmpfile)+1)) == NULL ) { 
    124                     printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","realfilename",strerror(errno)) ; 
     124                    PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","realfilename",strerror(errno)) ; 
    125125                    *errcode = 35 ; 
    126126                    free(remotefilename) ; 
     
    184184                myexitcode = *errcode ; 
    185185                if ( resfd < 0 ) { 
    186                     if (!verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"put %s %s/%s FAILED\n",tmpfile,remotedir,slash)        ; 
     186                    if (!verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"put %s %s/%s FAILED\n",tmpfile,remotedir,slash)        ; 
    187187                } else { 
    188188                    write(resfd,"put ",4) ; 
     
    196196            } else if ( retcode == BB_RET_OK) {         
    197197                if ( resfd < 0 ) { 
    198                     if (!verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"put %s %s/%s OK\n",tmpfile,remotedir,slash)        ; 
     198                    if (!verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"put %s %s/%s OK\n",tmpfile,remotedir,slash)        ; 
    199199                } else { 
    200200                    write(resfd,"put ",4) ; 
     
    209209                myexitcode = *errcode ; 
    210210                if ( resfd < 0 ) { 
    211                     if (!verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"put %s %s/%s FAILED\n",tmpfile,remotedir,slash)        ; 
     211                    if (!verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"put %s %s/%s FAILED\n",tmpfile,remotedir,slash)        ; 
    212212                } else { 
    213213                    write(resfd,"put ",4) ; 
     
    223223        } 
    224224    } 
    225     if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     225    if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    226226    free(filelist) ; 
    227227    return BB_RET_OK ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_private.c

    r773 r1265  
    120120    hisctladdr.sin_port = htons(newcontrolport); 
    121121    if ( (prv_ctrlsock = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 ) { 
    122         printmessage(stderr,CASE_ERROR,51,timestamp, "Cannot create control socket : %s\n",strerror(errno)); 
     122        PRINTMESSAGE(stderr,CASE_ERROR,51,timestamp, "Cannot create control socket : %s\n",strerror(errno)); 
    123123        return -1 ; 
    124124    } 
     
    129129    if ( connect(prv_ctrlsock,(struct sockaddr*)&hisctladdr,addrlen) < 0 ) { 
    130130        close(prv_ctrlsock) ; 
    131         printmessage(stderr,CASE_ERROR,52,timestamp, "Cannot connect to control socket: %s\n",strerror(errno)); 
     131        PRINTMESSAGE(stderr,CASE_ERROR,52,timestamp, "Cannot connect to control socket: %s\n",strerror(errno)); 
    132132        return -1 ; 
    133133    } 
     
    138138    if (getsockname(prv_ctrlsock,(struct sockaddr*) &myctladdr, &addrlen) < 0) { 
    139139        close(prv_ctrlsock) ; 
    140         printmessage(stderr,CASE_ERROR,53,timestamp,"Error getsockname on control socket: %s\n",strerror(errno)) ; 
     140        PRINTMESSAGE(stderr,CASE_ERROR,53,timestamp,"Error getsockname on control socket: %s\n",strerror(errno)) ; 
    141141        return -1 ; 
    142142    } 
     
    150150    if ( readmessage(prv_ctrlsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    151151        close(prv_ctrlsock) ; 
    152         printmessage(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message\n") ; 
     152        PRINTMESSAGE(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message\n") ; 
    153153        return -1 ; 
    154154    } 
     
    156156    if ( msg->code != MSG_CRYPT) { 
    157157        close(prv_ctrlsock) ; 
    158         printmessage(stderr,CASE_ERROR,55,timestamp,"No encryption message \n") ; 
     158        PRINTMESSAGE(stderr,CASE_ERROR,55,timestamp,"No encryption message \n") ; 
    159159        return -1 ; 
    160160    } 
     
    169169    if ( ( readbuffer = (char *) malloc (msglen + 1) ) == NULL ) { 
    170170        close(prv_ctrlsock) ; 
    171         printmessage(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message : malloc failed (%s)\n",strerror(errno)) ; 
     171        PRINTMESSAGE(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message : malloc failed (%s)\n",strerror(errno)) ; 
    172172        return -1 ; 
    173173    } 
     
    175175        free(readbuffer) ; 
    176176        close(prv_ctrlsock) ; 
    177         printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s\n","type") ; 
     177        PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s\n","type") ; 
    178178        return -1 ; 
    179179    } 
     
    217217            free(readbuffer) ; 
    218218            close(prv_ctrlsock) ; 
    219             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting RSA",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     219            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting RSA",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    220220            return -1 ; 
    221221        } 
     
    226226            free(readbuffer) ; 
    227227            close(prv_ctrlsock) ; 
    228             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     228            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    229229            return -1 ; 
    230230        } 
     
    232232            free(readbuffer) ; 
    233233            close(prv_ctrlsock) ; 
    234             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     234            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    235235            return -1 ; 
    236236        } 
     
    241241            free(readbuffer) ; 
    242242            close(prv_ctrlsock) ; 
    243             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubkey",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     243            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubkey",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    244244            return -1 ; 
    245245        } 
     
    247247            free(readbuffer) ; 
    248248            close(prv_ctrlsock) ; 
    249             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubexponent",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    250             return -1 ; 
    251         } 
    252         if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Public daemon RSA key received\n") ; 
     249            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubexponent",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     250            return -1 ; 
     251        } 
     252        if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Public daemon RSA key received\n") ; 
    253253        /* 
    254254        ** Ask for the private and public Key 
     
    257257            free(readbuffer) ; 
    258258            close(prv_ctrlsock) ; 
    259             printmessage(stderr,CASE_ERROR,27,timestamp,"Error while private authentication : cannot generate keys : %s\n",ERR_error_string(ERR_get_error(),NULL) ) ; 
     259            PRINTMESSAGE(stderr,CASE_ERROR,27,timestamp,"Error while private authentication : cannot generate keys : %s\n",ERR_error_string(ERR_get_error(),NULL) ) ; 
    260260            return -1 ; 
    261261        } 
     
    275275            free(readbuffer) ; 
    276276            close(prv_ctrlsock) ; 
    277             printmessage(stderr,CASE_ERROR,58,timestamp,"Error sending LOG message : %s\n",strerror(errno)) ; 
     277            PRINTMESSAGE(stderr,CASE_ERROR,58,timestamp,"Error sending LOG message : %s\n",strerror(errno)) ; 
    278278            return -1 ; 
    279279        } 
     
    290290            free(readbuffer) ; 
    291291            close(prv_ctrlsock) ; 
    292             printmessage(stderr,CASE_ERROR,58,timestamp,"Error sending LOG message : %s\n",strerror(errno)) ; 
     292            PRINTMESSAGE(stderr,CASE_ERROR,58,timestamp,"Error sending LOG message : %s\n",strerror(errno)) ; 
    293293            return -1 ; 
    294294        } 
     
    299299            free(readbuffer) ; 
    300300            close(prv_ctrlsock) ; 
    301             printmessage(stderr,CASE_ERROR,58,timestamp,"Error sending LOG message : %s\n",strerror(errno)) ; 
     301            PRINTMESSAGE(stderr,CASE_ERROR,58,timestamp,"Error sending LOG message : %s\n",strerror(errno)) ; 
    302302            return -1 ; 
    303303        } 
     
    305305            free(readbuffer) ; 
    306306            close(prv_ctrlsock) ; 
    307             printmessage(stderr,CASE_ERROR,58,timestamp,"Error sending LOG message : %s\n",strerror(errno)) ; 
    308             return -1 ; 
    309         } 
    310         if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Public client RSA key sent\n") ; 
     307            PRINTMESSAGE(stderr,CASE_ERROR,58,timestamp,"Error sending LOG message : %s\n",strerror(errno)) ; 
     308            return -1 ; 
     309        } 
     310        if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Public client RSA key sent\n") ; 
    311311        free(readbuffer) ; 
    312312        /* 
     
    316316        if ( bbftp_private_auth(logmessage) < 0 ) { 
    317317            close(prv_ctrlsock) ; 
    318             printmessage(stderr,CASE_ERROR,27,timestamp,"Error while private authentication : %s\n",logmessage) ; 
     318            PRINTMESSAGE(stderr,CASE_ERROR,27,timestamp,"Error while private authentication : %s\n",logmessage) ; 
    319319            return -1 ; 
    320320        } else { 
     
    323323            ** message 
    324324            */ 
    325             if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Client private authentication OK\n") ; 
    326             if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Waiting for server answer\n") ; 
     325            if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Client private authentication OK\n") ; 
     326            if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Waiting for server answer\n") ; 
    327327            if ( readmessage(prv_ctrlsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    328328                close(prv_ctrlsock) ; 
    329329                free(readbuffer) ; 
    330                 printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","") ; 
     330                PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","") ; 
    331331                return -1 ; 
    332332            } 
     
    340340#endif 
    341341                if ( ( readbuffer = (char *) malloc(msglen + 1) ) == NULL ) { 
    342                     printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : malloc failed (%s)\n",strerror(errno)) ; 
     342                    PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : malloc failed (%s)\n",strerror(errno)) ; 
    343343                    return -1 ; 
    344344                } 
     
    347347                    free(readbuffer) ; 
    348348                    if ( code == MSG_BAD ) { 
    349                         printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","BAD message") ; 
     349                        PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","BAD message") ; 
    350350                        return -1 ; 
    351351                    } else { 
    352                         printmessage(stderr,CASE_FATAL_ERROR,59,timestamp,"Error reading login message answer : %s\n","BAD NO RETRY message") ; 
     352                        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,59,timestamp,"Error reading login message answer : %s\n","BAD NO RETRY message") ; 
    353353                    } 
    354354                } else { 
     
    356356                    readbuffer[msglen] = '\0' ; 
    357357                    if ( code == MSG_BAD ) { 
    358                         printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",readbuffer) ; 
     358                        PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",readbuffer) ; 
    359359                        free(readbuffer) ; 
    360360                        return -1 ; 
    361361                    } else { 
    362                         printmessage(stderr,CASE_FATAL_ERROR,100,timestamp,"%s\n",readbuffer) ; 
     362                        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,100,timestamp,"%s\n",readbuffer) ; 
    363363                    } 
    364364                } 
     
    370370#endif 
    371371                if ( ( readbuffer = (char *) malloc(msglen + 1) ) == NULL ) { 
    372                     printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : OK message : malloc failed (%s)\n",strerror(errno)) ; 
     372                    PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : OK message : malloc failed (%s)\n",strerror(errno)) ; 
    373373                    return -1 ; 
    374374                } 
     
    376376                    free(readbuffer) ; 
    377377                    close(prv_ctrlsock) ; 
    378                     printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","OK message") ; 
     378                    PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","OK message") ; 
    379379                    return -1 ; 
    380380                } else { 
    381381                    readbuffer[msglen] = '\0' ; 
    382                     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",readbuffer) ; 
     382                    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",readbuffer) ; 
    383383                } 
    384384            } else { 
    385385                free(readbuffer) ; 
    386386                close(prv_ctrlsock) ; 
    387                 printmessage(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","Unkown answer message") ; 
     387                PRINTMESSAGE(stderr,CASE_ERROR,59,timestamp,"Error reading login message answer : %s\n","Unkown answer message") ; 
    388388                return -1 ; 
    389389            } 
    390             if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Server answer : OK\n") ; 
     390            if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Server answer : OK\n") ; 
    391391            free(readbuffer) ; 
    392392            incontrolsock  = prv_ctrlsock ; 
     
    397397        free(readbuffer) ; 
    398398        close(prv_ctrlsock) ; 
    399         printmessage(stderr,CASE_ERROR,57,timestamp,"Unkown encryption method \n") ; 
     399        PRINTMESSAGE(stderr,CASE_ERROR,57,timestamp,"Unkown encryption method \n") ; 
    400400        return -1  ; 
    401401    } 
     
    436436        return -1 ; 
    437437    } 
    438     if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Going to send %d Bytes\n",buffertosendlength) ; 
     438    if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Going to send %d Bytes\n",buffertosendlength) ; 
    439439 
    440440    /* 
     
    448448    nbpackets = buffertosendlength/(lenrsa - 42) ; 
    449449    if (  buffertosendlength - (nbpackets*(lenrsa - 42)) != 0 ) nbpackets++ ; 
    450     if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Number of encrypted packet(s) : %d\n",nbpackets) ; 
     450    if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Number of encrypted packet(s) : %d\n",nbpackets) ; 
    451451    /* 
    452452    ** So the total length to send is nbpackets*PRIVRSAMESSLEN+MINMESSLEN 
     
    473473            lentocrypt = buffertosendlength - ((nbpackets-1)*(lenrsa - 42)) ; 
    474474        } 
    475         if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Crypting %d Bytes\n",lentocrypt) ; 
     475        if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Crypting %d Bytes\n",lentocrypt) ; 
    476476        if ( (msg_private->lengthdata = RSA_public_encrypt(lentocrypt,(unsigned char *)strtocrypt,msg_private->cryptdata,hisrsa,RSA_PKCS1_OAEP_PADDING)) < 0 ) { 
    477477            sprintf(logmessage,"Error crypting message : %s ",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     
    487487        strtocrypt = strtocrypt + lentocrypt ; 
    488488    } 
    489     if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"%d encrypted packet(s) sent\n",nbpackets) ; 
     489    if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"%d encrypted packet(s) sent\n",nbpackets) ; 
    490490    return 0 ; 
    491491} 
     
    561561        return -1 ; 
    562562    } 
    563     if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Going to receive %d encrypted packet(s)\n",expectedpackets) ; 
     563    if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Going to receive %d encrypted packet(s)\n",expectedpackets) ; 
    564564    msg_private = (struct  mess_private *) privatebuffer ; 
    565565    for ( i = 1 ; i <= expectedpackets ; i++ ) { 
     
    583583    } 
    584584    buffertorecv[totallendecrypted] = '\0' ; 
    585     if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Received %d Bytes\n",totallendecrypted) ; 
     585    if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Received %d Bytes\n",totallendecrypted) ; 
    586586    return totallendecrypted ; 
    587587} 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_private_user.c

    r1264 r1265  
    4949 
    5050/* From bbftp_util.c */ 
    51 void printmessage(FILE *strm , int flag, int errcode, int tok, char *fmt, ...); 
     51void PRINTMESSAGE(FILE *strm , int flag, int errcode, int tok, char *fmt, ...); 
    5252 
    5353 
     
    153153   
    154154  if (debug) { 
    155     printmessage(stdout,CASE_NORMAL,0,0,"Received Auth handshake: %s\n", msg) ; 
     155    PRINTMESSAGE(stdout,CASE_NORMAL,0,0,"Received Auth handshake: %s\n", msg) ; 
    156156  } 
    157157  free(msg); 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_put.c

    r773 r1265  
    122122    pid_t   pid ; 
    123123   
    124     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : put %s %s\n",curfilename,remotefilename) ; 
     124    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : put %s %s\n",curfilename,remotefilename) ; 
    125125    /* 
    126126    ** Check if file is correct  
    127127    */ 
    128128    if ( (retcode = bbftp_retrcheckfile(realfilename,logmessage,errcode)) < 0 ) { 
    129         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     129        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    130130        bbftp_free_all_var() ; 
    131131        return  BB_RET_FT_NR ; 
    132132    } else if ( retcode > 0 ) { 
    133         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     133        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    134134        bbftp_free_all_var() ; 
    135135        return BB_RET_ERROR ; 
     
    148148        ** tell the calling program to restart a connection 
    149149        */ 
    150         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STORE_V2"); 
     150        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STORE_V2"); 
    151151        *errcode = 64 ; 
    152152        bbftp_free_all_var() ; 
     
    158158    ** Set up the parameters 
    159159    */ 
    160     if ( debug ) printmessage(stdout,CASE_NORMAL,0,timestamp,"Accepted stream number = %d\n",requestedstreamnumber) ; 
     160    if ( debug ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Accepted stream number = %d\n",requestedstreamnumber) ; 
    161161    msg_store_v2->transferoption = transferoption ; 
    162162    sprintf(msg_store_v2->lastaccess,"%s",lastaccess) ; 
     
    183183        ** tell the calling program to restart a connection 
    184184        */ 
    185         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STORE_V2 (data)"); 
     185        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STORE_V2 (data)"); 
    186186        *errcode = 64 ; 
    187187        bbftp_free_all_var() ; 
     
    200200#endif 
    201201    if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    202         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_FILENAME"); 
     202        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_FILENAME"); 
    203203        *errcode = 64 ; 
    204204        bbftp_free_all_var() ; 
     
    207207    } 
    208208    if ( writemessage(outcontrolsock,remotefilename,strlen(remotefilename),sendcontrolto,0) < 0 ) { 
    209         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_FILENAME (filename)"); 
     209        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_FILENAME (filename)"); 
    210210        *errcode = 64 ; 
    211211        bbftp_free_all_var() ; 
     
    233233            ** and restart 
    234234            */ 
    235             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     235            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    236236            *errcode = 66 ; 
    237237            bbftp_free_all_var() ; 
     
    254254        msg = (struct message *)sendbuffer ; 
    255255        if ( readmessage(incontrolsock,sendbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    256             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_STORE_V2)"); 
     256            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_STORE_V2)"); 
    257257            *errcode = 61 ; 
    258258            bbftp_free_all_var() ; 
     
    272272#endif 
    273273            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    274                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 1 (bbftp_put)",strerror(errno)) ; 
     274                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 1 (bbftp_put)",strerror(errno)) ; 
    275275                *errcode = 35 ; 
    276276                bbftp_free_all_var() ; 
     
    279279            } 
    280280            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    281                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_STORE_V2)"); 
     281                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_STORE_V2)"); 
    282282                *errcode = 67 ; 
    283283                bbftp_free_all_var() ; 
     
    291291            } else { 
    292292                buffer[msglen] = '\0' ; 
    293                  printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    294                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     293                 PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     294                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    295295                free(buffer) ; 
    296296                *errcode = 100 ; 
     
    318318#endif 
    319319            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    320                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 2 (bbftp_put)",strerror(errno)) ; 
     320                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 2 (bbftp_put)",strerror(errno)) ; 
    321321                *errcode = 35 ; 
    322322                bbftp_free_all_var() ; 
     
    325325            } 
    326326            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    327                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_TRANS_OK_V2"); 
     327                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_TRANS_OK_V2"); 
    328328                *errcode = 67 ; 
    329329                bbftp_free_all_var() ; 
     
    340340#endif 
    341341                if ( (myports = (int *) malloc (requestedstreamnumber*sizeof(int)) ) == NULL ) { 
    342                     printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","ports buffer",strerror(errno)) ; 
     342                    PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","ports buffer",strerror(errno)) ; 
    343343                    *errcode = 35 ; 
    344344                    bbftp_free_all_var() ; 
     
    348348                } 
    349349                if ( readmessage(incontrolsock,(char *) myports,requestedstreamnumber*sizeof(int),recvcontrolto,0) < 0 ) { 
    350                     printmessage(stderr,CASE_ERROR,68,timestamp,"Error reading ports for %s message\n","MSG_TRANS_OK_V3"); 
     350                    PRINTMESSAGE(stderr,CASE_ERROR,68,timestamp,"Error reading ports for %s message\n","MSG_TRANS_OK_V3"); 
    351351                    *errcode = 68 ; 
    352352                    bbftp_free_all_var() ; 
     
    360360                        *portfree = ntohl(*portfree) ; 
    361361#endif 
    362                         if ( debug ) printmessage(stdout,CASE_NORMAL,0,timestamp,"Reading port:%d\n",*portfree); 
     362                        if ( debug ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Reading port:%d\n",*portfree); 
    363363                        portfree++ ; 
    364364                    } 
     
    375375#endif 
    376376            discardmessage(incontrolsock,msglen,recvcontrolto,0) ; 
    377             if ( verbose ) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     377            if ( verbose ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    378378            bbftp_free_all_var() ; 
    379379            return BB_RET_OK ; 
     
    389389            msglen = msg->msglen ; 
    390390#endif 
    391             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message (%d,%d) while waiting for %s message\n",code,msglen,"MSG_TRANS_OK_V2"); 
     391            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message (%d,%d) while waiting for %s message\n",code,msglen,"MSG_TRANS_OK_V2"); 
    392392            *errcode = 62 ; 
    393393            bbftp_free_all_var() ; 
     
    408408    if ( (transferoption & TROPT_GZIP ) == TROPT_GZIP  
    409409        && (msg_store_v2->transferoption & TROPT_GZIP) != TROPT_GZIP ) { 
    410         if (warning) printmessage(stderr,CASE_WARNING,27,timestamp,"The server cannot handle compression: option ignored\n"); 
     410        if (warning) PRINTMESSAGE(stderr,CASE_WARNING,27,timestamp,"The server cannot handle compression: option ignored\n"); 
    411411        transferoption = transferoption & ~TROPT_GZIP ; 
    412412    } 
     
    417417    */ 
    418418    if ( (buffer = (char *) malloc (requestedstreamnumber*sizeof(int))) == NULL) { 
    419         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 3 (bbftp_put)",strerror(errno)); 
     419        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 3 (bbftp_put)",strerror(errno)); 
    420420        *errcode = 35 ; 
    421421        msg = (struct message *)sendbuffer ; 
     
    427427#endif 
    428428        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    429             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     429            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    430430            *errcode = 64 ; 
    431431            bbftp_free_all_var() ; 
     
    440440    */ 
    441441    if ( (mychildren = (int *) malloc (requestedstreamnumber*sizeof(int))) == NULL) { 
    442         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","mychildren (bbftp_get)",strerror(errno)); 
     442        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","mychildren (bbftp_get)",strerror(errno)); 
    443443        *errcode = 35 ; 
    444444        msg = (struct message *)sendbuffer ; 
     
    450450#endif 
    451451        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    452             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     452            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    453453            *errcode = 64 ; 
    454454            bbftp_free_all_var() ; 
     
    472472    */ 
    473473    if ( (readbuffer = (char *) malloc (buffersizeperstream*1024)) == NULL) { 
    474         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","readbuffer (bbftp_get)",strerror(errno)); 
     474        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","readbuffer (bbftp_get)",strerror(errno)); 
    475475        *errcode = 35 ; 
    476476        msg = (struct message *)sendbuffer ; 
     
    482482#endif 
    483483        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    484             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     484            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    485485            *errcode = 64 ; 
    486486            bbftp_free_all_var() ; 
     
    500500    if ( (transferoption & TROPT_GZIP ) == TROPT_GZIP ) { 
    501501        if ( (compbuffer = (char *) malloc (buffersizeperstream*1024)) == NULL) { 
    502             printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","compbuffer (bbftp_get)",strerror(errno)); 
     502            PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","compbuffer (bbftp_get)",strerror(errno)); 
    503503            *errcode = 35 ; 
    504504            msg = (struct message *)sendbuffer ; 
     
    510510#endif 
    511511            if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    512                 printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     512                PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    513513                *errcode = 64 ; 
    514514                bbftp_free_all_var() ; 
     
    528528    if ( protocol == 2 ) { /* ACTIVE MODE */ 
    529529      if ( (myports = (int *) malloc (requestedstreamnumber*sizeof(int)) ) == NULL ) { 
    530         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","myports (bbftp_get)",strerror(errno)); 
     530        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","myports (bbftp_get)",strerror(errno)); 
    531531        *errcode = 35 ; 
    532532        msg = (struct message *)sendbuffer ; 
     
    538538#endif 
    539539        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    540             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     540            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    541541            *errcode = 64 ; 
    542542            bbftp_free_all_var() ; 
     
    551551        } 
    552552    if ( (mysockets = (int *) malloc (requestedstreamnumber*sizeof(int)) ) == NULL ) { 
    553         printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","mysockets (bbftp_get)",strerror(errno)); 
     553        PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","mysockets (bbftp_get)",strerror(errno)); 
    554554        *errcode = 35 ; 
    555555        msg = (struct message *)sendbuffer ; 
     
    561561#endif 
    562562        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    563             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     563            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    564564            *errcode = 64 ; 
    565565            bbftp_free_all_var() ; 
     
    597597#endif 
    598598        if ( writemessage(outcontrolsock,sendbuffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    599             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
     599            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_ABORT"); 
    600600            *errcode = 64 ; 
    601601            bbftp_free_all_var() ; 
     
    621621            mysockfree++ ; 
    622622        } 
    623         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     623        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    624624        bbftp_free_all_var() ; 
    625625        free(buffer) ; 
     
    655655        ** tell the calling program to restart a connection 
    656656        */ 
    657         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V2"); 
     657        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V2"); 
    658658        *errcode = 64 ; 
    659659        /* 
     
    680680 
    681681      if ( writemessage(outcontrolsock,buffer,requestedstreamnumber*sizeof(int),sendcontrolto,0) < 0) { 
    682         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V2 (ports)"); 
     682        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V2 (ports)"); 
    683683        *errcode = 64 ; 
    684684        /* 
     
    706706            mysockfree++ ; 
    707707        } 
    708         printmessage(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
     708        PRINTMESSAGE(stderr,CASE_ERROR,*errcode,timestamp,"%s\n",logmessage); 
    709709        bbftp_free_all_var() ; 
    710710        free(buffer) ; 
     
    740740        ** tell the calling program to restart a connection 
    741741        */ 
    742         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V3"); 
     742        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_TRANS_START_V3"); 
    743743        *errcode = 64 ; 
    744744        /* 
     
    774774            ** and restart 
    775775            */ 
    776             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno) ); 
     776            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno) ); 
    777777            *errcode = 66 ; 
    778778            /* 
     
    832832        ** Bad thing so abort  
    833833        */ 
    834         printmessage(stderr,CASE_ERROR,37,timestamp,"No more child\n"); 
     834        PRINTMESSAGE(stderr,CASE_ERROR,37,timestamp,"No more child\n"); 
    835835        *errcode = 37 ; 
    836836        bbftp_free_all_var() ; 
     
    842842        */ 
    843843        if ( readmessage(incontrolsock,sendbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    844             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_TRANS_START_V2)"); 
     844            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_TRANS_START_V2)"); 
    845845            *errcode = 61 ; 
    846846            /* 
     
    863863            msglen = msg->msglen ; 
    864864#endif 
    865             if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"BAD message length = %d\n",msglen) ; 
     865            if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"BAD message length = %d\n",msglen) ; 
    866866            if ( ( buffer = (char *) malloc (msglen+1) ) == NULL ) { 
    867                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 4 (bbftp_get)",strerror(errno)); 
     867                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 4 (bbftp_get)",strerror(errno)); 
    868868                *errcode = 35 ; 
    869869                pidfree = mychildren ; 
     
    878878            } 
    879879            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    880                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_TRANS_START_V2)"); 
     880                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_TRANS_START_V2)"); 
    881881                *errcode = 67 ; 
    882882                /* 
     
    894894                bbftp_clean_child() ; 
    895895                buffer[msglen] = '\0' ; 
    896                  printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    897                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     896                 PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     897                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    898898                bbftp_free_all_var() ; 
    899899                free(buffer) ; 
     
    912912#endif 
    913913            discardmessage(incontrolsock,msglen,recvcontrolto,0) ; 
    914             if ( verbose ) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
     914            if ( verbose ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK\n") ; 
    915915            (void) gettimeofday(&tend, (struct timezone *)0); 
    916916            tdiff.tv_sec = tend.tv_sec - tstart.tv_sec ; 
     
    921921            bs = filesize / nz(s); 
    922922            if (!simulation_mode) { 
    923                 if ( verbose ) printmessage(stdout,CASE_NORMAL,0,timestamp,"%" LONG_LONG_FORMAT" bytes send in %.3g secs (%.3g Kbytes/sec or %.3g Mbits/s)\n", filesize, s, bs / 1024.0,(8.0*bs) / (1024.0 * 1024.0)); 
     923                if ( verbose ) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"%" LONG_LONG_FORMAT" bytes send in %.3g secs (%.3g Kbytes/sec or %.3g Mbits/s)\n", filesize, s, bs / 1024.0,(8.0*bs) / (1024.0 * 1024.0)); 
    924924            } 
    925925            if ( statoutput ) { 
    926                 printmessage(stdout,CASE_NORMAL,0,0,"put %" LONG_LONG_FORMAT" %.3f %d %d %d %d %s\n" 
     926                PRINTMESSAGE(stdout,CASE_NORMAL,0,0,"put %" LONG_LONG_FORMAT" %.3f %d %d %d %d %s\n" 
    927927                            , filesize, s, buffersizeperstream, sendwinsize, recvwinsize, requestedstreamnumber 
    928928                            , ((transferoption & TROPT_GZIP ) == TROPT_GZIP) ? "gzip" : "nogzip" ); 
     
    941941#endif 
    942942            if ( ( buffer = (char *) malloc (msglen+1) ) == NULL ) { 
    943                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 5 (bbftp_get)",strerror(errno)); 
     943                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer 5 (bbftp_get)",strerror(errno)); 
    944944                *errcode = 35 ; 
    945945                bbftp_clean_child() ; 
     
    949949            } 
    950950            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    951                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_INFO (on MSG_TRANS_START_V2)"); 
     951                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_INFO (on MSG_TRANS_START_V2)"); 
    952952                *errcode = 67 ; 
    953953                /* 
     
    961961            } 
    962962            buffer[msglen] = '\0' ; 
    963             if (warning) printmessage(stderr,CASE_WARNING,100,timestamp,"%s\n",buffer); 
     963            if (warning) PRINTMESSAGE(stderr,CASE_WARNING,100,timestamp,"%s\n",buffer); 
    964964            free(buffer) ; 
    965965            goto waitcontrol ; 
     
    970970            ** and restart 
    971971            */ 
    972             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_TRANS_START_V2)"); 
     972            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_TRANS_START_V2)"); 
    973973            *errcode = 62 ; 
    974974            /* 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_rm.c

    r773 r1265  
    8080    struct  mess_integer *msg_integer ; 
    8181    
    82     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : rm %s\n",filename) ; 
     82    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : rm %s\n",filename) ; 
    8383     
    8484    msg = (struct message *)minbuffer ; 
     
    9595        ** tell the calling program to restart a connection 
    9696        */ 
    97         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RM"); 
     97        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RM"); 
    9898        *errcode = 64 ; 
    9999        bbftp_close_control() ; 
     
    106106    msg_integer->myint = transferoption ; 
    107107    if ( writemessage(outcontrolsock,minbuffer,sizeof(int),sendcontrolto,0) < 0 ) { 
    108         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RM (transferoption)"); 
     108        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RM (transferoption)"); 
    109109        *errcode = 64 ; 
    110110        bbftp_close_control() ; 
     
    115115    */ 
    116116    if ( writemessage(outcontrolsock,filename,strlen(filename),sendcontrolto,0) < 0 ) { 
    117         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RM (file name)"); 
     117        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_RM (file name)"); 
    118118        *errcode = 64 ; 
    119119        bbftp_close_control() ; 
     
    138138            ** and restart 
    139139            */ 
    140             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     140            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    141141            *errcode = 66 ; 
    142142            bbftp_close_control() ; 
     
    162162        */ 
    163163        if ( readmessage(incontrolsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    164             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_RM)"); 
     164            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_RM)"); 
    165165            *errcode = 61 ; 
    166166            bbftp_close_control() ; 
     
    178178#endif 
    179179            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    180                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
     180                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
    181181                *errcode = 35 ; 
    182182                bbftp_close_control() ; 
     
    184184            } 
    185185            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    186                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_RM)"); 
     186                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_RM)"); 
    187187                *errcode = 67 ; 
    188188                bbftp_close_control() ; 
     
    195195            } else { 
    196196                buffer[msglen] = '\0' ; 
    197                 printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    198                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     197                PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     198                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    199199                free(buffer) ; 
    200200                if ( code == MSG_BAD ) { 
     
    226226#endif 
    227227            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    228                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
     228                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
    229229                *errcode = 35 ; 
    230230                bbftp_close_control() ; 
     
    232232            } 
    233233            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0) { 
    234                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_RM)"); 
     234                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_RM)"); 
    235235                *errcode = 67 ; 
    236236                bbftp_close_control() ; 
     
    239239            }  
    240240            buffer[msglen] = '\0' ; 
    241             if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
     241            if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
    242242            free(buffer) ; 
    243243            return BB_RET_OK ; 
     
    248248            ** and restart 
    249249            */ 
    250             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_RM)"); 
     250            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_RM)"); 
    251251            *errcode = 62 ; 
    252252            bbftp_close_control() ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_setremotecos.c

    r773 r1265  
    8080    struct  mess_integer *msg_integer ; 
    8181    
    82     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : setremotecos %d\n",cos) ; 
     82    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : setremotecos %d\n",cos) ; 
    8383     
    8484    msg = (struct message *)minbuffer ; 
     
    9595        ** tell the calling program to restart a connection 
    9696        */ 
    97         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHCOS"); 
     97        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHCOS"); 
    9898        *errcode = 64 ; 
    9999        bbftp_close_control() ; 
     
    110110#endif 
    111111    if ( writemessage(outcontrolsock,minbuffer,sizeof(int),sendcontrolto,0) < 0 ) { 
    112         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHCOS (cos)"); 
     112        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHCOS (cos)"); 
    113113        *errcode = 64 ; 
    114114        bbftp_close_control() ; 
     
    133133            ** and restart 
    134134            */ 
    135             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     135            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    136136            *errcode = 66 ; 
    137137            bbftp_close_control() ; 
     
    157157        */ 
    158158        if ( readmessage(incontrolsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    159             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_CHCOS)"); 
     159            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_CHCOS)"); 
    160160            *errcode = 61 ; 
    161161            bbftp_close_control() ; 
     
    173173#endif 
    174174            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    175                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_setremotecos)",strerror(errno)) ; 
     175                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_setremotecos)",strerror(errno)) ; 
    176176                *errcode = 35 ; 
    177177                bbftp_close_control() ; 
     
    179179            } 
    180180            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    181                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_CHCOS)"); 
     181                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_CHCOS)"); 
    182182                *errcode = 67 ; 
    183183                bbftp_close_control() ; 
     
    190190            } else { 
    191191                buffer[msglen] = '\0' ; 
    192                 printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    193                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     192                PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     193                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    194194                free(buffer) ; 
    195195                if ( code == MSG_BAD ) { 
     
    221221#endif 
    222222            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    223                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_setremotecos)",strerror(errno)) ; 
     223                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_setremotecos)",strerror(errno)) ; 
    224224                *errcode = 35 ; 
    225225                bbftp_close_control() ; 
     
    227227            } 
    228228            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0) { 
    229                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_CHCOS)"); 
     229                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_CHCOS)"); 
    230230                *errcode = 67 ; 
    231231                bbftp_close_control() ; 
     
    234234            } 
    235235            buffer[msglen] = '\0' ; 
    236             if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
     236            if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
    237237            free(buffer) ; 
    238238            return BB_RET_OK ; 
     
    243243            ** and restart 
    244244            */ 
    245             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_CHCOS)"); 
     245            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_CHCOS)"); 
    246246            *errcode = 62 ; 
    247247            bbftp_close_control() ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_setremoteumask.c

    r773 r1265  
    8181    struct  mess_integer *msg_integer ; 
    8282    
    83     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : setremoteumask %o\n",mask) ; 
     83    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : setremoteumask %o\n",mask) ; 
    8484     
    8585    msg = (struct message *)minbuffer ; 
     
    9696        ** tell the calling program to restart a connection 
    9797        */ 
    98         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHUMASK"); 
     98        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHUMASK"); 
    9999        *errcode = 64 ; 
    100100        bbftp_close_control() ; 
     
    111111#endif 
    112112    if ( writemessage(outcontrolsock,minbuffer,sizeof(int),sendcontrolto,0) < 0 ) { 
    113         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHUMASK (umask)"); 
     113        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_CHUMASK (umask)"); 
    114114        *errcode = 64 ; 
    115115        bbftp_close_control() ; 
     
    134134            ** and restart 
    135135            */ 
    136             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     136            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    137137            *errcode = 66 ; 
    138138            bbftp_close_control() ; 
     
    158158        */ 
    159159        if ( readmessage(incontrolsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    160             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSH_CHUMASK)"); 
     160            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSH_CHUMASK)"); 
    161161            *errcode = 61 ; 
    162162            bbftp_close_control() ; 
     
    174174#endif 
    175175            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    176                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_setremoteumask)",strerror(errno)) ; 
     176                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_setremoteumask)",strerror(errno)) ; 
    177177                *errcode = 35 ; 
    178178                bbftp_close_control() ; 
     
    180180            } 
    181181            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    182                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSH_CHUMASK)"); 
     182                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSH_CHUMASK)"); 
    183183                *errcode = 67 ; 
    184184                bbftp_close_control() ; 
     
    191191            } else { 
    192192                buffer[msglen] = '\0' ; 
    193                 printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    194                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     193                PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     194                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    195195                free(buffer) ; 
    196196                if ( code == MSG_BAD ) { 
     
    222222#endif 
    223223            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    224                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_setremoteumask)",strerror(errno)) ; 
     224                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_setremoteumask)",strerror(errno)) ; 
    225225                *errcode = 35 ; 
    226226                bbftp_close_control() ; 
     
    228228            } 
    229229            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0) { 
    230                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_CHUMASK)"); 
     230                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_CHUMASK)"); 
    231231                *errcode = 67 ; 
    232232                bbftp_close_control() ; 
     
    235235            } 
    236236            buffer[msglen] = '\0' ; 
    237             if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
     237            if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
    238238            free(buffer) ; 
    239239            return BB_RET_OK ; 
     
    244244            ** and restart 
    245245            */ 
    246             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_CHUMASK)"); 
     246            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_CHUMASK)"); 
    247247            *errcode = 62 ; 
    248248            bbftp_close_control() ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_socket.c

    r773 r1265  
    9393    sock = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP ) ; 
    9494    if ( sock < 0 ) { 
    95         printmessage(stderr,CASE_ERROR,91,timestamp,"Cannot create data socket: %s\n",strerror(errno)); 
     95        PRINTMESSAGE(stderr,CASE_ERROR,91,timestamp,"Cannot create data socket: %s\n",strerror(errno)); 
    9696        return (-1) ; 
    9797    } 
    9898    if ( setsockopt(sock,SOL_SOCKET, SO_REUSEADDR,(char *)&on,sizeof(on)) < 0 ) { 
    9999        close(sock) ; 
    100         if (warning) printmessage(stderr,CASE_ERROR,92,timestamp,"Cannot set SO_REUSEADDR on data socket : %s\n",strerror(errno)); 
     100        if (warning) PRINTMESSAGE(stderr,CASE_ERROR,92,timestamp,"Cannot set SO_REUSEADDR on data socket : %s\n",strerror(errno)); 
    101101        return (-1) ; 
    102102    } 
     
    106106        ** In this case we are going to log a message 
    107107        */ 
    108         if ( warning ) printmessage(stderr,CASE_WARNING,23,timestamp,"Cannot set SO_RCVBUF on data socket : %s\n",strerror(errno)); 
     108        if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,23,timestamp,"Cannot set SO_RCVBUF on data socket : %s\n",strerror(errno)); 
    109109    } 
    110110    addrlen = sizeof(tcpwinsize) ; 
    111111    if ( getsockopt(sock,SOL_SOCKET,SO_RCVBUF,(char *)&tcpwinsize,&addrlen) < 0 ) { 
    112112        close(sock) ; 
    113         printmessage(stderr,CASE_ERROR,93,timestamp,"Cannot get SO_RCVBUF on data socket : %s\n",strerror(errno)); 
     113        PRINTMESSAGE(stderr,CASE_ERROR,93,timestamp,"Cannot get SO_RCVBUF on data socket : %s\n",strerror(errno)); 
    114114        return (-1) ; 
    115115    } 
    116116    if ( tcpwinsize < 1024 * recvwinsize ) { 
    117         if ( warning ) printmessage(stderr,CASE_WARNING,24,timestamp,"Receive buffer on port %d cannot be set to %d Bytes, Value is %d Bytes",portnumber,1024*recvwinsize,tcpwinsize) ; 
     117        if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,24,timestamp,"Receive buffer on port %d cannot be set to %d Bytes, Value is %d Bytes",portnumber,1024*recvwinsize,tcpwinsize) ; 
    118118    } 
    119119    tcpwinsize = 1024 * sendwinsize ; 
     
    122122        ** In this case we just log an error 
    123123        */ 
    124         if ( warning ) printmessage(stderr,CASE_WARNING,25,timestamp,"Cannot set SO_SNDBUF on data socket : %s\n",strerror(errno)); 
     124        if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,25,timestamp,"Cannot set SO_SNDBUF on data socket : %s\n",strerror(errno)); 
    125125    } 
    126126    addrlen = sizeof(tcpwinsize) ; 
    127127    if ( getsockopt(sock,SOL_SOCKET, SO_SNDBUF,(char *)&tcpwinsize,&addrlen) < 0 ) { 
    128128        close(sock) ; 
    129         printmessage(stderr,CASE_ERROR,93,timestamp,"Cannot get SO_SNDBUF on data socket : %s\n",strerror(errno)); 
     129        PRINTMESSAGE(stderr,CASE_ERROR,93,timestamp,"Cannot get SO_SNDBUF on data socket : %s\n",strerror(errno)); 
    130130        return (-1) ; 
    131131    } 
    132132    if ( tcpwinsize < 1024 * sendwinsize ) { 
    133         if ( warning ) printmessage(stderr,CASE_WARNING,26,timestamp ,"Send buffer on port %d cannot be set to %d Bytes, Value is %d Bytes",portnumber,1024*sendwinsize,tcpwinsize) ; 
     133        if ( warning ) PRINTMESSAGE(stderr,CASE_WARNING,26,timestamp ,"Send buffer on port %d cannot be set to %d Bytes, Value is %d Bytes",portnumber,1024*sendwinsize,tcpwinsize) ; 
    134134    } 
    135135    if ( setsockopt(sock,IPPROTO_TCP, TCP_NODELAY,(char *)&on,sizeof(on)) < 0 ) { 
    136136        close(sock) ; 
    137         printmessage(stderr,CASE_ERROR,94,timestamp,"Cannot set TCP_NODELAY on data socket : %s\n",strerror(errno)); 
     137        PRINTMESSAGE(stderr,CASE_ERROR,94,timestamp,"Cannot set TCP_NODELAY on data socket : %s\n",strerror(errno)); 
    138138        return (-1) ; 
    139139    } 
     
    142142                if ( setsockopt(sock,IPPROTO_IP, IP_TOS, (char *)&qbss_value, sizeof(qbss_value)) < 0 ) { 
    143143                    close(sock) ; 
    144                         printmessage(stderr,CASE_ERROR,95,timestamp, "Cannot set IP_TOS on data socket : %s\n", strerror(errno)); 
     144                        PRINTMESSAGE(stderr,CASE_ERROR,95,timestamp, "Cannot set IP_TOS on data socket : %s\n", strerror(errno)); 
    145145                        return (-1) ; 
    146146                } 
     
    157157    if ( bind(sock, (struct sockaddr *) &data_source,sizeof(data_source)) < 0) { 
    158158        close(sock) ; 
    159         printmessage(stderr,CASE_ERROR,95,timestamp,"Cannot bind on data socket on port %d: %s\n",portnumber,strerror(errno)); 
     159        PRINTMESSAGE(stderr,CASE_ERROR,95,timestamp,"Cannot bind on data socket on port %d: %s\n",portnumber,strerror(errno)); 
    160160        return (-1) ; 
    161161    } 
     
    167167    if ( retcode < 0 ) { 
    168168        close(sock) ; 
    169         printmessage(stderr,CASE_ERROR,96,timestamp,"Cannot connect to data socket on port %d: %s\n",portnumber,strerror(errno)); 
     169        PRINTMESSAGE(stderr,CASE_ERROR,96,timestamp,"Cannot connect to data socket on port %d: %s\n",portnumber,strerror(errno)); 
    170170        if ( errno == EINTR || errno == ETIMEDOUT ) { 
    171171            /* 
     
    177177        } else { 
    178178            if ( errno == EPERM || errno == EACCES) { 
    179                 printmessage(stderr,CASE_ERROR,96,timestamp,"This is probably caused by a firewall rule on the server"); 
     179                PRINTMESSAGE(stderr,CASE_ERROR,96,timestamp,"This is probably caused by a firewall rule on the server"); 
    180180            } 
    181181            return (-1) ; 
    182182        } 
    183183    } 
    184         if ( debug ) printmessage(stdout,CASE_NORMAL,91,timestamp,"Connected to port: %d\n",portnumber); 
     184        if ( debug ) PRINTMESSAGE(stdout,CASE_NORMAL,91,timestamp,"Connected to port: %d\n",portnumber); 
    185185    return sock ; 
    186186} 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_stat.c

    r773 r1265  
    8080    struct  mess_integer *msg_integer ; 
    8181    
    82     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : stat %s\n",filename) ; 
     82    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : stat %s\n",filename) ; 
    8383     
    8484    msg = (struct message *)minbuffer ; 
     
    9595        ** tell the calling program to restart a connection 
    9696        */ 
    97         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STAT"); 
     97        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STAT"); 
    9898        *errcode = 64 ; 
    9999        bbftp_close_control() ; 
     
    106106    msg_integer->myint = transferoption ; 
    107107    if ( writemessage(outcontrolsock,minbuffer,sizeof(int),sendcontrolto,0) < 0 ) { 
    108         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STAT (transferoption)"); 
     108        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STAT (transferoption)"); 
    109109        *errcode = 64 ; 
    110110        bbftp_close_control() ; 
     
    115115    */ 
    116116    if ( writemessage(outcontrolsock,filename,strlen(filename),sendcontrolto,0) < 0 ) { 
    117         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STAT (file name)"); 
     117        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_STAT (file name)"); 
    118118        *errcode = 64 ; 
    119119        bbftp_close_control() ; 
     
    138138            ** and restart 
    139139            */ 
    140             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     140            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    141141            *errcode = 66 ; 
    142142            bbftp_close_control() ; 
     
    162162        */ 
    163163        if ( readmessage(incontrolsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    164             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_STAT)"); 
     164            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_STAT)"); 
    165165            *errcode = 61 ; 
    166166            bbftp_close_control() ; 
     
    178178#endif 
    179179            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    180                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
     180                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
    181181                *errcode = 35 ; 
    182182                bbftp_close_control() ; 
     
    184184            } 
    185185            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    186                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_STAT)"); 
     186                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_STAT)"); 
    187187                *errcode = 67 ; 
    188188                bbftp_close_control() ; 
     
    195195            } else { 
    196196                buffer[msglen] = '\0' ; 
    197                 printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    198                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     197                PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     198                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    199199                free(buffer) ; 
    200200                if ( code == MSG_BAD ) { 
     
    226226#endif 
    227227            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    228                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
     228                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
    229229                *errcode = 35 ; 
    230230                bbftp_close_control() ; 
     
    232232            } 
    233233            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0) { 
    234                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_STAT)"); 
     234                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_STAT)"); 
    235235                *errcode = 67 ; 
    236236                bbftp_close_control() ; 
     
    239239            }  
    240240            buffer[msglen] = '\0' ; 
    241             if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
     241            if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
    242242            if ( statoutput ) { 
    243                 printmessage(stdout,CASE_NORMAL,0,0,"stat %s\n", buffer) ; 
     243                PRINTMESSAGE(stdout,CASE_NORMAL,0,0,"stat %s\n", buffer) ; 
    244244            } 
    245245            free(buffer) ; 
     
    251251            ** and restart 
    252252            */ 
    253             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_STAT)"); 
     253            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_STAT)"); 
    254254            *errcode = 62 ; 
    255255            bbftp_close_control() ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_statfs.c

    r773 r1265  
    8080    struct  mess_integer *msg_integer ; 
    8181    
    82     if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : df %s\n",filename) ; 
     82    if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,">> COMMAND : df %s\n",filename) ; 
    8383     
    8484    msg = (struct message *)minbuffer ; 
     
    9595        ** tell the calling program to restart a connection 
    9696        */ 
    97         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_DF"); 
     97        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_DF"); 
    9898        *errcode = 64 ; 
    9999        bbftp_close_control() ; 
     
    106106    msg_integer->myint = transferoption ; 
    107107    if ( writemessage(outcontrolsock,minbuffer,sizeof(int),sendcontrolto,0) < 0 ) { 
    108         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_DF (transferoption)"); 
     108        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_DF (transferoption)"); 
    109109        *errcode = 64 ; 
    110110        bbftp_close_control() ; 
     
    115115    */ 
    116116    if ( writemessage(outcontrolsock,filename,strlen(filename),sendcontrolto,0) < 0 ) { 
    117         printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_DF (file name)"); 
     117        PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_DF (file name)"); 
    118118        *errcode = 64 ; 
    119119        bbftp_close_control() ; 
     
    138138            ** and restart 
    139139            */ 
    140             printmessage(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
     140            PRINTMESSAGE(stderr,CASE_ERROR,66,timestamp,"Error select on control connection : %s\n",strerror(errno)); 
    141141            *errcode = 66 ; 
    142142            bbftp_close_control() ; 
     
    162162        */ 
    163163        if ( readmessage(incontrolsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    164             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_DF)"); 
     164            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_OK (on MSG_DF)"); 
    165165            *errcode = 61 ; 
    166166            bbftp_close_control() ; 
     
    178178#endif 
    179179            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    180                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
     180                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_rm)",strerror(errno)) ; 
    181181                *errcode = 35 ; 
    182182                bbftp_close_control() ; 
     
    184184            } 
    185185            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0 ) { 
    186                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_DF)"); 
     186                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_BAD (on MSG_DF)"); 
    187187                *errcode = 67 ; 
    188188                bbftp_close_control() ; 
     
    195195            } else { 
    196196                buffer[msglen] = '\0' ; 
    197                 printmessage(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
    198                 if (verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
     197                PRINTMESSAGE(stderr,CASE_ERROR,100,timestamp,"%s\n",buffer) ; 
     198                if (verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< %s\n",buffer) ; 
    199199                free(buffer) ; 
    200200                if ( code == MSG_BAD ) { 
     
    226226#endif 
    227227            if ( (buffer = (char *) malloc(msglen+1) ) == NULL) { 
    228                 printmessage(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_statfs)",strerror(errno)) ; 
     228                PRINTMESSAGE(stderr,CASE_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","buffer (bbftp_statfs)",strerror(errno)) ; 
    229229                *errcode = 35 ; 
    230230                bbftp_close_control() ; 
     
    232232            } 
    233233            if ( readmessage(incontrolsock,buffer,msglen,recvcontrolto,0) < 0) { 
    234                 printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_DF)"); 
     234                PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_OK (on MSG_DF)"); 
    235235                *errcode = 67 ; 
    236236                bbftp_close_control() ; 
     
    239239            }  
    240240            buffer[msglen] = '\0' ; 
    241             if ( verbose) printmessage(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
     241            if ( verbose) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"<< OK : %s\n",buffer) ; 
    242242            if ( statoutput ) { 
    243                 printmessage(stdout,CASE_NORMAL,0,0,"df %s\n", buffer) ; 
     243                PRINTMESSAGE(stdout,CASE_NORMAL,0,0,"df %s\n", buffer) ; 
    244244            } 
    245245            free(buffer) ; 
     
    251251            ** and restart 
    252252            */ 
    253             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_DF)"); 
     253            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_OK (on MSG_DF)"); 
    254254            *errcode = 62 ; 
    255255            bbftp_close_control() ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_turl.c

    r773 r1265  
    6161    if ( oTURL == NULL ) return -1; 
    6262    if ( (turlbuffer = (char *) malloc (strlen(oTURL)+1) ) == NULL ) { 
    63         printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","turlbuffer",strerror(errno)) ; 
     63        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","turlbuffer",strerror(errno)) ; 
    6464    } 
    6565    strcpy (turlbuffer, oTURL); 
     
    7474        if (index(turlbuffer, '/') == NULL) return -1; 
    7575        if ( (host = (char *) malloc (strlen(turlbuffer)+1) ) == NULL ) { 
    76             printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","host",strerror(errno)) ; 
     76            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","host",strerror(errno)) ; 
    7777        } 
    7878        strcpy( host, turlbuffer); 
     
    107107    } 
    108108    if ( ((*dTURL) = (struct decodedTURL *) malloc (sizeof(struct decodedTURL)) ) == NULL ) { 
    109         printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","dTURL",strerror(errno)) ; 
     109        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","dTURL",strerror(errno)) ; 
    110110        return -1; 
    111111    } 
     
    147147 
    148148    if ( (dupbuffercmd = (char *) malloc (strlen(buffercmd)+1) ) == NULL ) { 
    149         printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","dupbuffercmd",strerror(errno)) ; 
     149        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","dupbuffercmd",strerror(errno)) ; 
    150150    } 
    151151    strcpy (dupbuffercmd, buffercmd); 
     
    187187    /* 
    188188    if ( (*translatedcmd = (char *) malloc (strlen(buffercmd)+1) ) == NULL ) { 
    189         printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","translatedcmd",strerror(errno)) ; 
     189        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","translatedcmd",strerror(errno)) ; 
    190190        return -1 ; 
    191191    } 
     
    205205        mybuffercmd += 2; 
    206206        if (decodeTURL(mybuffercmd, &dRemoteTurl) == -1) { 
    207             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     207            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    208208            myexitcode = 26 ; 
    209209            free(dupbuffercmd) ; 
     
    218218        } 
    219219        if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+3) ) == NULL ) { 
    220             printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","*tempbuf",strerror(errno)) ; 
     220            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","*tempbuf",strerror(errno)) ; 
    221221            return -1 ; 
    222222        } 
     
    232232        mybuffercmd += 3; 
    233233        if (decodeTURL(mybuffercmd, &dRemoteTurl) == -1) { 
    234             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     234            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    235235            myexitcode = 26 ; 
    236236            free(dupbuffercmd) ; 
     
    244244        } 
    245245        if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+4) ) == NULL ) { 
    246             printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","*tempbuf",strerror(errno)) ; 
     246            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","*tempbuf",strerror(errno)) ; 
    247247            return -1 ; 
    248248        } 
     
    258258        mybuffercmd += 3; 
    259259        if ( action == NULL ) { 
    260             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     260            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    261261            myexitcode = 26 ; 
    262262            free(dupbuffercmd) ; 
     
    265265        while (*action == ' ') action++ ; 
    266266        if ( *action == '\0' ) { 
    267             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     267            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    268268            myexitcode = 26 ; 
    269269            free(dupbuffercmd) ; 
     
    277277            */ 
    278278            if (decodeTURL(action, &dRemoteTurl) == -1) { 
    279                 printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     279                PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    280280                myexitcode = 26 ; 
    281281                free(dupbuffercmd) ; 
     
    288288            } 
    289289            if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+4) ) == NULL ) { 
    290                 printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     290                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    291291                return -1 ; 
    292292            } 
     
    302302                */ 
    303303                if (decodeTURL(action, &dRemoteTurl) == -1) { 
    304                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     304                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    305305                    myexitcode = 26 ; 
    306306                    free(dupbuffercmd) ; 
     
    313313                } 
    314314                if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+4) ) == NULL ) { 
    315                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     315                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    316316                    return -1 ; 
    317317                } 
     
    327327                char *remotefile; 
    328328                if ( (remotefile = (char *) malloc (strlen(action)+1)) == NULL ) { 
    329                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","remotefile",strerror(errno)) ; 
     329                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","remotefile",strerror(errno)) ; 
    330330                    return -1 ; 
    331331                } 
    332332                if ( (localfile = (char *) malloc (strlen(action)+1)) == NULL ) { 
    333                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","localfile",strerror(errno)) ; 
     333                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","localfile",strerror(errno)) ; 
    334334                    return -1 ; 
    335335                } 
    336336                sscanf(action,"%s %s", remotefile, localfile); 
    337337                if (decodeTURL(localfile, &dLocalTurl) == -1) { 
    338                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     338                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    339339                    myexitcode = 26 ; 
    340340                    free(dupbuffercmd) ; 
     
    343343                if (dLocalTurl == NULL) goto end; 
    344344                if (dLocalTurl->hostname[0] != '\0') { 
    345                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     345                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    346346                    myexitcode = 26 ; 
    347347                    free(dupbuffercmd) ; 
     
    349349                } 
    350350                if (decodeTURL(remotefile, &dRemoteTurl) == -1) { 
    351                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     351                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    352352                    myexitcode = 26 ; 
    353353                    free(dupbuffercmd) ; 
     
    360360                } 
    361361                if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+strlen(dLocalTurl->filename)+1+5) ) == NULL ) { 
    362                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     362                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    363363                    return -1 ; 
    364364                } 
     
    382382        ** get needs one or two parameters 
    383383        */ 
    384             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     384            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    385385            myexitcode = 26 ; 
    386386            free(dupbuffercmd) ; 
     
    392392            ** get needs one or two parameters 
    393393            */ 
    394             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     394            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    395395            myexitcode = 26 ; 
    396396            free(dupbuffercmd) ; 
     
    404404            */ 
    405405            if (decodeTURL(action, &dRemoteTurl) == -1) { 
    406                 printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     406                PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    407407                myexitcode = 26 ; 
    408408                free(dupbuffercmd) ; 
     
    415415            } 
    416416            if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+5) ) == NULL ) { 
    417                 printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     417                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    418418                return -1 ; 
    419419            } 
     
    429429                */ 
    430430                if (decodeTURL(action, &dRemoteTurl) == -1) { 
    431                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     431                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    432432                    myexitcode = 26 ; 
    433433                    free(dupbuffercmd) ; 
     
    440440                } 
    441441                if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+5) ) == NULL ) { 
    442                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     442                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    443443                    return -1 ; 
    444444                } 
     
    454454                char *remotefile; 
    455455                if ( (remotefile = (char *) malloc (strlen(action)+1)) == NULL ) { 
    456                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","remotefile",strerror(errno)) ; 
     456                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","remotefile",strerror(errno)) ; 
    457457                    return -1 ; 
    458458                } 
    459459                if ( (localfile = (char *) malloc (strlen(action)+1)) == NULL ) { 
    460                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","localfile",strerror(errno)) ; 
     460                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","localfile",strerror(errno)) ; 
    461461                    return -1 ; 
    462462                } 
    463463                sscanf(action,"%s %s", remotefile, localfile); 
    464464                if (decodeTURL(localfile, &dLocalTurl) == -1) { 
    465                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     465                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    466466                    myexitcode = 26 ; 
    467467                    free(dupbuffercmd) ; 
     
    471471                /*if (dLocalTurl->hostname[0] != '\0') {*/ 
    472472                if (dLocalTurl->hostname[0] != '\0') { 
    473                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     473                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    474474                    myexitcode = 26 ; 
    475475                    free(dupbuffercmd) ; 
     
    477477                } 
    478478                if (decodeTURL(remotefile, &dRemoteTurl) == -1) { 
    479                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     479                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    480480                    myexitcode = 26 ; 
    481481                    free(dupbuffercmd) ; 
     
    488488                } 
    489489                if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+strlen(dLocalTurl->filename)+1+6) ) == NULL ) { 
    490                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     490                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    491491                    return -1 ; 
    492492                } 
     
    507507        mybuffercmd += 5; 
    508508        if (decodeTURL(mybuffercmd, &dRemoteTurl) == -1) { 
    509             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     509            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    510510            myexitcode = 26 ; 
    511511            free(dupbuffercmd) ; 
     
    520520        } 
    521521        if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+6) ) == NULL ) { 
    522             printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","tempbuf",strerror(errno)) ; 
     522            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","tempbuf",strerror(errno)) ; 
    523523            return -1 ; 
    524524        } 
     
    534534        mybuffercmd += 4; 
    535535        if ( action == NULL ) { 
    536             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     536            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    537537            myexitcode = 26 ; 
    538538            free(dupbuffercmd) ; 
     
    541541        while (*action == ' ') action++ ; 
    542542        if ( *action == '\0' ) { 
    543             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     543            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    544544            myexitcode = 26 ; 
    545545            free(dupbuffercmd) ; 
     
    550550        if ( startfn == NULL ) { 
    551551            if (decodeTURL(action, &dLocalTurl) == -1) { 
    552                 printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     552                PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    553553                myexitcode = 26 ; 
    554554                free(dupbuffercmd) ; 
     
    557557            if (dLocalTurl == NULL) goto end; 
    558558            if (dLocalTurl->hostname[0] != '\0') { 
    559                 printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     559                PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    560560                myexitcode = 26 ; 
    561561                free(dupbuffercmd) ; 
     
    563563            } 
    564564            if ( (tempbuf = (char *) malloc (strlen(dLocalTurl->filename)+1+5) ) == NULL ) { 
    565                 printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     565                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    566566                return -1 ; 
    567567            } 
     
    574574            if ( *startfn == '\0' ) { 
    575575                if (decodeTURL(action, &dLocalTurl) == -1) { 
    576                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     576                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    577577                    myexitcode = 26 ; 
    578578                    free(dupbuffercmd) ; 
     
    581581                if (dLocalTurl == NULL) goto end; 
    582582                if (dLocalTurl->hostname[0] != '\0') { 
    583                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     583                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    584584                    myexitcode = 26 ; 
    585585                    free(dupbuffercmd) ; 
     
    587587                } 
    588588                if ( (tempbuf = (char *) malloc (strlen(dLocalTurl->filename)+1+5) ) == NULL ) { 
    589                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     589                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    590590                    return -1 ; 
    591591                } 
     
    598598                char *remotefile; 
    599599                if ( (remotefile = (char *) malloc (strlen(action)+1)) == NULL ) { 
    600                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","remotefile",strerror(errno)) ; 
     600                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","remotefile",strerror(errno)) ; 
    601601                    return -1 ; 
    602602                } 
    603603                if ( (localfile = (char *) malloc (strlen(action)+1)) == NULL ) { 
    604                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","localfile",strerror(errno)) ; 
     604                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","localfile",strerror(errno)) ; 
    605605                    return -1 ; 
    606606                } 
    607607                sscanf(action,"%s %s", localfile, remotefile); 
    608608                if (decodeTURL(localfile, &dLocalTurl) == -1) { 
    609                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     609                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    610610                    myexitcode = 26 ; 
    611611                    free(dupbuffercmd) ; 
     
    614614                if (dLocalTurl == NULL) goto end; 
    615615                if (dLocalTurl->hostname[0] != '\0') { 
    616                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     616                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    617617                    myexitcode = 26 ; 
    618618                    free(dupbuffercmd) ; 
     
    620620                } 
    621621                if (decodeTURL(remotefile, &dRemoteTurl) == -1) { 
    622                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     622                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    623623                    myexitcode = 26 ; 
    624624                    free(dupbuffercmd) ; 
     
    631631                } 
    632632                if ( (tempbuf = (char *) malloc (strlen(dLocalTurl->filename)+strlen(dRemoteTurl->filename)+1+6) ) == NULL ) { 
    633                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     633                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    634634                    return -1 ; 
    635635                } 
     
    650650        mybuffercmd += 3; 
    651651        if ( action == NULL ) { 
    652             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     652            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    653653            myexitcode = 26 ; 
    654654            free(dupbuffercmd) ; 
     
    657657        while (*action == ' ') action++ ; 
    658658        if ( *action == '\0' ) { 
    659             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     659            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    660660            myexitcode = 26 ; 
    661661            free(dupbuffercmd) ; 
     
    666666        if ( startfn == NULL ) { 
    667667            if (decodeTURL(action, &dLocalTurl) == -1) { 
    668                 printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     668                PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    669669                myexitcode = 26 ; 
    670670                free(dupbuffercmd) ; 
     
    673673            if (dLocalTurl == NULL) goto end; 
    674674            if (dLocalTurl->hostname[0] != '\0') { 
    675                 printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     675                PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    676676                myexitcode = 26 ; 
    677677                free(dupbuffercmd) ; 
     
    679679            } 
    680680            if ( (tempbuf = (char *) malloc (strlen(dLocalTurl->filename)+1+4) ) == NULL ) { 
    681                 printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     681                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    682682                return -1 ; 
    683683            } 
     
    693693                */ 
    694694                if (decodeTURL(action, &dLocalTurl) == -1) { 
    695                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     695                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    696696                    myexitcode = 26 ; 
    697697                    free(dupbuffercmd) ; 
     
    700700                if (dLocalTurl == NULL) goto end; 
    701701                if (dLocalTurl->hostname[0] != '\0') { 
    702                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     702                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    703703                    myexitcode = 26 ; 
    704704                    free(dupbuffercmd) ; 
     
    706706                } 
    707707                if ( (tempbuf = (char *) malloc (strlen(dLocalTurl->filename)+1+4) ) == NULL ) { 
    708                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     708                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    709709                    return -1 ; 
    710710                } 
     
    720720                char *remotefile; 
    721721                if ( (remotefile = (char *) malloc (strlen(action)+1)) == NULL ) { 
    722                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","remotefile",strerror(errno)) ; 
     722                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","remotefile",strerror(errno)) ; 
    723723                    return -1 ; 
    724724                } 
    725725                if ( (localfile = (char *) malloc (strlen(action)+1)) == NULL ) { 
    726                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","localfile",strerror(errno)) ; 
     726                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","localfile",strerror(errno)) ; 
    727727                    return -1 ; 
    728728                } 
    729729                sscanf(action,"%s %s", localfile, remotefile); 
    730730                if (decodeTURL(localfile, &dLocalTurl) == -1) { 
    731                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     731                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    732732                    myexitcode = 26 ; 
    733733                    free(dupbuffercmd) ; 
     
    736736                if (dLocalTurl == NULL) goto end; 
    737737                if (dLocalTurl->hostname[0] != '\0') { 
    738                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     738                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    739739                    myexitcode = 26 ; 
    740740                    free(dupbuffercmd) ; 
     
    742742                } 
    743743                if (decodeTURL(remotefile, &dRemoteTurl) == -1) { 
    744                     printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
     744                    PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",action) ; 
    745745                    myexitcode = 26 ; 
    746746                    free(dupbuffercmd) ; 
     
    753753                } 
    754754                if ( (tempbuf = (char *) malloc (strlen(dLocalTurl->filename)+strlen(dRemoteTurl->filename)+1+5) ) == NULL ) { 
    755                     printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
     755                    PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s: %s\n","tempbuf",strerror(errno)) ; 
    756756                    return -1 ; 
    757757                } 
     
    772772        mybuffercmd += 2; 
    773773        if (decodeTURL(mybuffercmd, &dRemoteTurl) == -1) { 
    774             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     774            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    775775            myexitcode = 26 ; 
    776776            free(dupbuffercmd) ; 
     
    784784        } 
    785785        if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+3) ) == NULL ) { 
    786             printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","tempbuf",strerror(errno)) ; 
     786            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","tempbuf",strerror(errno)) ; 
    787787            return -1 ; 
    788788        } 
     
    798798        mybuffercmd += 4; 
    799799        if (decodeTURL(mybuffercmd, &dRemoteTurl) == -1) { 
    800             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     800            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    801801            myexitcode = 26 ; 
    802802            free(dupbuffercmd) ; 
     
    810810        } 
    811811        if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+5) ) == NULL ) { 
    812             printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","tempbuf",strerror(errno)) ; 
     812            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","tempbuf",strerror(errno)) ; 
    813813            return -1 ; 
    814814        } 
     
    824824        mybuffercmd += 2; 
    825825        if (decodeTURL(mybuffercmd, &dRemoteTurl) == -1) { 
    826             printmessage(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
     826            PRINTMESSAGE(stderr,CASE_ERROR,26,timestamp,"Incorrect command : %s\n",buffercmd) ; 
    827827            myexitcode = 26 ; 
    828828            free(dupbuffercmd) ; 
     
    836836        } 
    837837        if ( (tempbuf = (char *) malloc (strlen(dRemoteTurl->filename)+1+3) ) == NULL ) { 
    838             printmessage(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","tempbuf",strerror(errno)) ; 
     838            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,35,timestamp,"Error allocating memory for %s : %s\n","tempbuf",strerror(errno)) ; 
    839839            return -1 ; 
    840840        } 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftp_utils.c

    r773 r1265  
    9292#endif 
    9393 
    94 void printmessage(FILE *strm , int flag, int errcode, int tok, char *fmt, ...)  
     94#ifndef NDG_PYTHON_EMBED 
     95void PRINTMESSAGE(FILE *strm , int flag, int errcode, int tok, char *fmt, ...)  
    9596{ 
    9697    va_list ap; 
     
    148149    va_end(ap); 
    149150} 
     151#endif // NDG_PYTHON_EMBED 
    150152 
    151153void Usage()  
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/bbftpstatus.c

    r773 r1265  
    100100int             sendcontrolto   = SENDCONTROLTO; 
    101101 
    102 void printmessage(FILE *strm , int flag, int errcode, int tok, char *fmt, ...)  
     102void PRINTMESSAGE(FILE *strm , int flag, int errcode, int tok, char *fmt, ...)  
    103103{ 
    104104    va_list ap; 
     
    344344    hisctladdr.sin_port = htons(newcontrolport); 
    345345    if ( (tmpctrlsock = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 ) { 
    346         printmessage(stderr,CASE_ERROR,51,timestamp, "Cannot create control socket : %s\n",strerror(errno)); 
     346        PRINTMESSAGE(stderr,CASE_ERROR,51,timestamp, "Cannot create control socket : %s\n",strerror(errno)); 
    347347        return -1 ; 
    348348    } 
     
    353353    if ( connect(tmpctrlsock,(struct sockaddr*)&hisctladdr,addrlen) < 0 ) { 
    354354        close(tmpctrlsock) ; 
    355         printmessage(stderr,CASE_ERROR,52,timestamp, "Cannot connect to control socket: %s\n",strerror(errno)); 
     355        PRINTMESSAGE(stderr,CASE_ERROR,52,timestamp, "Cannot connect to control socket: %s\n",strerror(errno)); 
    356356        return -1 ; 
    357357    } 
     
    362362    if (getsockname(tmpctrlsock,(struct sockaddr*) &myctladdr, &addrlen) < 0) { 
    363363        close(tmpctrlsock) ; 
    364         printmessage(stderr,CASE_ERROR,53,timestamp,"Error getsockname on control socket: %s\n",strerror(errno)) ; 
     364        PRINTMESSAGE(stderr,CASE_ERROR,53,timestamp,"Error getsockname on control socket: %s\n",strerror(errno)) ; 
    365365        return -1 ; 
    366366    } 
     
    369369    */ 
    370370 
    371         if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Connection established\n") ; 
     371        if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Connection established\n") ; 
    372372    /* 
    373373    **    Read the encryption supported 
     
    375375    if ( readmessage(tmpctrlsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    376376        close(tmpctrlsock) ; 
    377         printmessage(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message\n") ; 
     377        PRINTMESSAGE(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message\n") ; 
    378378        return -1 ; 
    379379    } 
     
    381381    if ( msg->code != MSG_CRYPT) { 
    382382        close(tmpctrlsock) ; 
    383         printmessage(stderr,CASE_ERROR,55,timestamp,"No encryption message \n") ; 
    384         return -1 ; 
    385     } 
    386         if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Received message 1\n") ; 
     383        PRINTMESSAGE(stderr,CASE_ERROR,55,timestamp,"No encryption message \n") ; 
     384        return -1 ; 
     385    } 
     386        if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Received message 1\n") ; 
    387387#ifndef WORDS_BIGENDIAN 
    388388    msglen = ntohl(msg->msglen) ; 
     
    392392    if ( ( readbuffer = (char *) malloc (msglen + 1) ) == NULL ) { 
    393393        close(tmpctrlsock) ; 
    394         printmessage(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message : malloc failed (%s)\n",strerror(errno)) ; 
     394        PRINTMESSAGE(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message : malloc failed (%s)\n",strerror(errno)) ; 
    395395        return -1 ; 
    396396    } 
     
    398398        free(readbuffer) ; 
    399399        close(tmpctrlsock) ; 
    400         printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s\n","type") ; 
    401         return -1 ; 
    402     } 
    403         if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Received message 2\n") ; 
     400        PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s\n","type") ; 
     401        return -1 ; 
     402    } 
     403        if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Received message 2\n") ; 
    404404    msg = (struct message *)minbuffer ; 
    405405    msg->code = MSG_SERVER_STATUS ; 
     
    419419        return -1 ; 
    420420    } 
    421         if (debug) printmessage(stdout,CASE_NORMAL,0,timestamp,"Sent message \n") ; 
     421        if (debug) PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Sent message \n") ; 
    422422    /* 
    423423    ** Now we are going to wait for the message on the control  
     
    452452            }  
    453453            buffer[msglen] = '\0' ; 
    454             printmessage(stdout,CASE_NORMAL,0,timestamp,"%s\n", buffer) ; 
     454            PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"%s\n", buffer) ; 
    455455            free(buffer) ; 
    456456            close(tmpctrlsock) ; 
  • TI05-delivery/trunk/src/bbftp-client-3.2.0/bbftpc/connecttoserver.c

    r773 r1265  
    230230*/ 
    231231    if (pipe(pin) < 0) 
    232         printmessage(stderr,CASE_FATAL_ERROR,41,timestamp,"Pipe for ssh failed : %s", strerror(errno)) ; 
     232        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,41,timestamp,"Pipe for ssh failed : %s", strerror(errno)) ; 
    233233 
    234234    if (pipe(pout) < 0) 
    235         printmessage(stderr,CASE_FATAL_ERROR,41,timestamp,"Pipe for ssh failed : %s", strerror(errno)) ; 
     235        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,41,timestamp,"Pipe for ssh failed : %s", strerror(errno)) ; 
    236236 
    237237/* 
     
    265265        ntok= splitargs(sshcmd,args,250,argbuf,largbuf); 
    266266        if (ntok<0) 
    267             printmessage(stderr,CASE_FATAL_ERROR,42,timestamp,"Too many arguments in ssh command :%s \n",sshcmd) ; 
     267            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,42,timestamp,"Too many arguments in ssh command :%s \n",sshcmd) ; 
    268268        if (ntok==0) 
    269             printmessage(stderr,CASE_FATAL_ERROR,43,timestamp,"No ssh command specified\n") ; 
     269            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,43,timestamp,"No ssh command specified\n") ; 
    270270        i += ntok; 
    271271 
     
    274274            args[i++] = ssh_options[j]; 
    275275            if (i > 250) 
    276                 printmessage(stderr,CASE_FATAL_ERROR,44,timestamp,"Too many -o options (total number of arguments is more than 256)"); 
     276                PRINTMESSAGE(stderr,CASE_FATAL_ERROR,44,timestamp,"Too many -o options (total number of arguments is more than 256)"); 
    277277        } 
    278278        args[i++] = "-x"; 
     
    307307            ** stdout will cause problem on the contrlo connection 
    308308            */ 
    309             printmessage(stderr,CASE_NORMAL,0,timestamp,"Executing :%s",args[0]) ; 
    310             for (j= 1; args[j]; j++)  printmessage(stderr,CASE_NORMAL,0,timestamp," %s", args[j]); 
    311             printmessage(stderr,CASE_NORMAL,0,timestamp,"\n"); 
     309            PRINTMESSAGE(stderr,CASE_NORMAL,0,timestamp,"Executing :%s",args[0]) ; 
     310            for (j= 1; args[j]; j++)  PRINTMESSAGE(stderr,CASE_NORMAL,0,timestamp," %s", args[j]); 
     311            PRINTMESSAGE(stderr,CASE_NORMAL,0,timestamp,"\n"); 
    312312        } 
    313313             
    314314        execvp(args[0], args); 
    315         printmessage(stderr,CASE_FATAL_ERROR,46,timestamp,"Error while execvp ssh command (%s) : %s\n",sshcmd,strerror(errno)) ; 
     315        PRINTMESSAGE(stderr,CASE_FATAL_ERROR,46,timestamp,"Error while execvp ssh command (%s) : %s\n",sshcmd,strerror(errno)) ; 
    316316    } else if ( retcode < 0 ) { 
    317317        /* 
    318318        ** fork error 
    319319        */ 
    320         printmessage(stderr,CASE_ERROR,45,timestamp,"Fork for ssh command failed\n"); 
     320        PRINTMESSAGE(stderr,CASE_ERROR,45,timestamp,"Fork for ssh command failed\n"); 
    321321        return -1 ; 
    322322    } else { 
     
    333333        */ 
    334334        if ( readmessage(incontrolsock,buffer,MINMESSLEN,2 * recvcontrolto,0) < 0 ) { 
    335             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_LOGGED_STDIN"); 
     335            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_LOGGED_STDIN"); 
    336336            kill(sshchildpid,SIGKILL) ; 
    337337            close(incontrolsock) ; 
     
    341341        msg = (struct message *)buffer ; 
    342342        if ( msg->code != MSG_LOGGED_STDIN) { 
    343             printmessage(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_LOGGED_STDIN"); 
     343            PRINTMESSAGE(stderr,CASE_ERROR,62,timestamp,"Unknown message while waiting for %s message\n","MSG_LOGGED_STDIN"); 
    344344            if ( debug ) { 
    345                 printmessage(stdout,CASE_NORMAL,0,timestamp,"Incorrect message is : ") ; 
     345                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"Incorrect message is : ") ; 
    346346                buffer[MINMESSLEN] = '\0' ; 
    347                 printmessage(stdout,CASE_NORMAL,0,timestamp,"%s",buffer) ; 
     347                PRINTMESSAGE(stdout,CASE_NORMAL,0,timestamp,"%s",buffer) ; 
    348348                discardandprintmessage(incontrolsock,recvcontrolto,0) ; 
    349349            } 
     
    357357#endif 
    358358        if ( msg->msglen != 4) { 
    359             printmessage(stderr,CASE_ERROR,63,timestamp,"Unexpected message length while waiting for %s message\n","MSG_LOGGED_STDIN"); 
     359            PRINTMESSAGE(stderr,CASE_ERROR,63,timestamp,"Unexpected message length while waiting for %s message\n","MSG_LOGGED_STDIN"); 
    360360            kill(sshchildpid,SIGKILL) ; 
    361361            close(incontrolsock) ; 
     
    367367        */ 
    368368        if ( readmessage(incontrolsock,buffer,4,recvcontrolto,0) < 0 ) { 
    369             printmessage(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_LOGGED_STDIN"); 
     369            PRINTMESSAGE(stderr,CASE_ERROR,67,timestamp,"Error reading data for %s message\n","MSG_LOGGED_STDIN"); 
    370370            kill(sshchildpid,SIGKILL) ; 
    371371            close(incontrolsock) ; 
     
    377377#endif 
    378378        if (debug)  
    379             printmessage(stderr,CASE_NORMAL,0,timestamp,"Port number = %d\n",msg->code) ; 
     379            PRINTMESSAGE(stderr,CASE_NORMAL,0,timestamp,"Port number = %d\n",msg->code) ; 
    380380        while (1) { 
    381381           if ( (tmpctrlsock = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 ) { 
    382                printmessage(stderr,CASE_ERROR,47,timestamp,"Cannot get socket for MSG_IPADDR message : %s\n",strerror(errno)); 
     382               PRINTMESSAGE(stderr,CASE_ERROR,47,timestamp,"Cannot get socket for MSG_IPADDR message : %s\n",strerror(errno)); 
    383383               kill(sshchildpid,SIGKILL) ; 
    384384               close(incontrolsock) ; 
     
    388388           if ( setsockopt(tmpctrlsock,SOL_SOCKET, SO_REUSEADDR,(char *)&on,sizeof(on)) < 0 ) { 
    389389               close(tmpctrlsock) ; 
    390                printmessage(stderr,CASE_ERROR,47,timestamp,"Cannot set SO_REUSEADDR on socket for MSG_IPADDR message : %s\n",strerror(errno)); 
     390               PRINTMESSAGE(stderr,CASE_ERROR,47,timestamp,"Cannot set SO_REUSEADDR on socket for MSG_IPADDR message : %s\n",strerror(errno)); 
    391391               kill(sshchildpid,SIGKILL) ; 
    392392               close(incontrolsock) ; 
     
    401401           data_source.sin_port = 0; 
    402402           if ( bind(tmpctrlsock, (struct sockaddr *) &data_source,sizeof(data_source)) < 0) { 
    403                printmessage(stderr,CASE_ERROR,49,timestamp,"Cannot bind socket for MSG_IPADDR message : %s\n",strerror(errno)); 
     403               PRINTMESSAGE(stderr,CASE_ERROR,49,timestamp,"Cannot bind socket for MSG_IPADDR message : %s\n",strerror(errno)); 
    404404               close(tmpctrlsock) ; 
    405405               kill(sshchildpid,SIGKILL) ; 
     
    407407               close(outcontrolsock) ; 
    408408           } 
    409            if (debug) printmessage(stderr,CASE_NORMAL,0,timestamp,"connect control to address %s\n", inet_ntoa(hisctladdr.sin_addr)) ; 
     409           if (debug) PRINTMESSAGE(stderr,CASE_NORMAL,0,timestamp,"connect control to address %s\n", inet_ntoa(hisctladdr.sin_addr)) ; 
    410410           hisctladdr.sin_family = AF_INET ; 
    411411           hisctladdr.sin_port = htons(msg->code); 
     
    425425                   } 
    426426               } 
    427                printmessage(stderr,CASE_ERROR,48,timestamp,"Cannot connect socket for MSG_IPADDR message : %s\n",strerror(errno)); 
     427               PRINTMESSAGE(stderr,CASE_ERROR,48,timestamp,"Cannot connect socket for MSG_IPADDR message : %s\n",strerror(errno)); 
    428428               close(tmpctrlsock) ; 
    429429               kill(sshchildpid,SIGKILL) ; 
     
    440440        */ 
    441441        if ( writemessage(tmpctrlsock,buffer,MINMESSLEN,sendcontrolto,0) < 0 ) { 
    442             printmessage(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_IPADDR"); 
     442            PRINTMESSAGE(stderr,CASE_ERROR,64,timestamp,"Error sending %s message\n","MSG_IPADDR"); 
    443443            kill(sshchildpid,SIGKILL) ; 
    444444            close(tmpctrlsock) ; 
     
    451451        */ 
    452452        if ( readmessage(tmpctrlsock,buffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    453             printmessage(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_IPADDR_OK"); 
     453            PRINTMESSAGE(stderr,CASE_ERROR,61,timestamp,"Error waiting %s message\n","MSG_IPADDR_OK"); 
    454454            kill(sshchildpid,SIGKILL) ; 
    455455            close(tmpctrlsock) ; 
     
    459459        } 
    460460        if ( msg->code != MSG_IPADDR_OK) { 
    461             printmessage(stderr,CASE_ERROR,65,timestamp,"Unknown message while waiting for %s message\n","MSG_IPADDR_OK"); 
     461            PRINTMESSAGE(stderr,CASE_ERROR,65,timestamp,"Unknown message while waiting for %s message\n","MSG_IPADDR_OK"); 
    462462            close(tmpctrlsock) ; 
    463463            kill(sshchildpid,SIGKILL) ; 
     
    519519    hisctladdr.sin_port = htons(newcontrolport); 
    520520    if ( (tmpctrlsock = socket ( AF_INET, SOCK_STREAM, IPPROTO_TCP )) < 0 ) { 
    521         printmessage(stderr,CASE_ERROR,51,timestamp, "Cannot create control socket : %s\n",strerror(errno)); 
     521        PRINTMESSAGE(stderr,CASE_ERROR,51,timestamp, "Cannot create control socket : %s\n",strerror(errno)); 
    522522        return -1 ; 
    523523    } 
     
    528528    if ( connect(tmpctrlsock,(struct sockaddr*)&hisctladdr,addrlen) < 0 ) { 
    529529        close(tmpctrlsock) ; 
    530         printmessage(stderr,CASE_ERROR,52,timestamp, "Cannot connect to control socket: %s\n",strerror(errno)); 
     530        PRINTMESSAGE(stderr,CASE_ERROR,52,timestamp, "Cannot connect to control socket: %s\n",strerror(errno)); 
    531531        return -1 ; 
    532532    } 
     
    537537    if (getsockname(tmpctrlsock,(struct sockaddr*) &myctladdr, &addrlen) < 0) { 
    538538        close(tmpctrlsock) ; 
    539         printmessage(stderr,CASE_ERROR,53,timestamp,"Error getsockname on control socket: %s\n",strerror(errno)) ; 
     539        PRINTMESSAGE(stderr,CASE_ERROR,53,timestamp,"Error getsockname on control socket: %s\n",strerror(errno)) ; 
    540540        return -1 ; 
    541541    } 
     
    548548    if ( readmessage(tmpctrlsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0 ) { 
    549549        close(tmpctrlsock) ; 
    550         printmessage(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message\n") ; 
     550        PRINTMESSAGE(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message\n") ; 
    551551        return -1 ; 
    552552    } 
     
    554554    if ( msg->code != MSG_CRYPT) { 
    555555        close(tmpctrlsock) ; 
    556         printmessage(stderr,CASE_ERROR,55,timestamp,"No encryption message \n") ; 
     556        PRINTMESSAGE(stderr,CASE_ERROR,55,timestamp,"No encryption message \n") ; 
    557557        return -1 ; 
    558558    } 
     
    567567    if ( ( readbuffer = (char *) malloc (msglen + 1) ) == NULL ) { 
    568568        close(tmpctrlsock) ; 
    569         printmessage(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message : malloc failed (%s)\n",strerror(errno)) ; 
     569        PRINTMESSAGE(stderr,CASE_ERROR,54,timestamp,"Error reading encryption message : malloc failed (%s)\n",strerror(errno)) ; 
    570570        return -1 ; 
    571571    } 
     
    573573        free(readbuffer) ; 
    574574        close(tmpctrlsock) ; 
    575         printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s\n","type") ; 
     575        PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s\n","type") ; 
    576576        return -1 ; 
    577577    } 
     
    617617            free(readbuffer) ; 
    618618            close(tmpctrlsock) ; 
    619             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting RSA",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     619            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting RSA",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    620620            return -1 ; 
    621621        } 
     
    626626            free(readbuffer) ; 
    627627            close(tmpctrlsock) ; 
    628             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     628            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    629629            return -1 ; 
    630630        } 
     
    632632            free(readbuffer) ; 
    633633            close(tmpctrlsock) ; 
    634             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     634            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","getting BIGNUM",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    635635            return -1 ; 
    636636        } 
     
    641641            free(readbuffer) ; 
    642642            close(tmpctrlsock) ; 
    643             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubkey",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     643            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubkey",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    644644            return -1 ; 
    645645        } 
     
    647647            free(readbuffer) ; 
    648648            close(tmpctrlsock) ; 
    649             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubexponent",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     649            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","copying pubexponent",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    650650            return -1 ; 
    651651        } 
     
    655655            free(readbuffer) ; 
    656656            close(tmpctrlsock) ; 
    657             printmessage(stderr,CASE_FATAL_ERROR,56,timestamp,"Error reading encrypted message : %s (%d/%d)\n","username too long",strlen(username),lenrsa-41) ; 
     657            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,56,timestamp,"Error reading encrypted message : %s (%d/%d)\n","username too long",strlen(username),lenrsa-41) ; 
    658658        } 
    659659        if (strlen(password) > lenrsa - 41 ) { 
    660660            free(readbuffer) ; 
    661661            close(tmpctrlsock) ; 
    662             printmessage(stderr,CASE_FATAL_ERROR,56,timestamp,"Error reading encrypted message : %s (%d/%d)\n","password too long",strlen(password),lenrsa-41) ; 
     662            PRINTMESSAGE(stderr,CASE_FATAL_ERROR,56,timestamp,"Error reading encrypted message : %s (%d/%d)\n","password too long",strlen(password),lenrsa-41) ; 
    663663            return -2 ; 
    664664        } 
     
    667667            free(readbuffer) ; 
    668668            close(tmpctrlsock) ; 
    669             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","RSA_public_encrypt username",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     669            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","RSA_public_encrypt username",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    670670            return -1 ; 
    671671        } 
     
    676676            free(readbuffer) ; 
    677677            close(tmpctrlsock) ; 
    678             printmessage(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","RSA_public_encrypt password",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
     678            PRINTMESSAGE(stderr,CASE_ERROR,56,timestamp,"Error reading encrypted message : %s (%s)\n","RSA_public_encrypt password",(char *) ERR_error_string(ERR_get_error(),NULL)) ; 
    679679            return -1 ; 
    680680        } 
     
    686686        free(readbuffer) ; 
    687687        close(tmpctrlsock) ; 
    688         printmessage(stderr,CASE_ERROR,57,timestamp,"Unkown encryption method \n") ; 
     688        PRINTMESSAGE(stderr,CASE_ERROR,57,timestamp,"Unkown encryption method \n") ; 
    689689        return -1  ; 
    690690    } 
     
    705705    if ( writemessage(tmpctrlsock,minbuffer,MINMESSLEN,recvcontrolto,0) < 0) { 
    706706        close(tmpctrlsock) ; 
    707         printmessage(stderr,CASE_ERROR,58,timestamp,"Error sending username : %s\n",strerror(errno)) ; 
     707        PRINTMESSAGE(stderr,CASE_ERROR,58,timestamp,"Error sending username : %s\n",strerror(errno)) ; 
    708708        return -1 ; 
    709709    } 
     
    715715    if ( writemessage(tmpctrlsock,cryptbuffer,CRYPTMESSLEN,recvcontrolto,0) < 0 ) { 
    716716        close(tmpctrlsock) ; 
    717         printmessage(stderr,CASE_ERROR,58,timestamp,"Error sending username : %s\n",strerror(errno)) ; 
     717        PRINTMESSAGE(stderr,CASE_ERROR,58,timestamp,"Error sending username : %s\n",strerror(errno)) ; 
    718718        return -1 ; 
    719719    } 
     
    723723    if ( writemessage(tmpctrlsock,rsabu