Ignore:
Timestamp:
Aug 16, 2016, 5:35:07 PM (9 years ago)
Author:
Silvan Scherrer
Message:

samba client: remove tabs in source and beautify it completely

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/src/debug.c

    r957 r959  
    4343int debuglvl(int level)
    4444{
    45         return (level <= debuglevel) ? 1 : 0;
     45        return (level <= debuglevel) ? 1 : 0;
    4646}
    4747
     
    7979        }
    8080        else
    81         {
    8281           strncat(logfile, logfilename, sizeof(logfile) -1);
    83         }
     82       
    8483        // set the samba logging stuff
    8584        do_logging = TRUE;
     
    8887        rc = DosCreateMutexSem(nameMutex, &logMutex, 0, FALSE);
    8988        if (rc == ERROR_DUPLICATE_NAME)
    90         {
    91         rc = DosOpenMutexSem(nameMutex, &logMutex);
    92         }
     89           rc = DosOpenMutexSem(nameMutex, &logMutex);
    9390
    9491        return;
     
    107104        // do we have to log at all
    108105        if (!do_logging)
    109         {
    110                 return;
    111         }
     106           return;
    112107
    113108        // if the sem is created we request it
    114109        if (logMutex)
    115         {
    116110           DosRequestMutexSem(logMutex, (ULONG) SEM_INDEFINITE_WAIT);
    117         }
    118111
    119         do
    120         {
    121                 struct timeval tv;
    122                 char buf[80] = {0};
    123                 va_list args;
    124                 if (logfile[0])
    125                 {
    126                         f = fopen(logfile, "a");
    127                         if (!f)
    128                         {
    129                                 break;
    130                         }
    131                 }
    132                 else
    133                 {
    134                         f = stdout;
    135                 }
     112        do {
     113           struct timeval tv;
     114           char buf[80] = {0};
     115           va_list args;
     116           if (logfile[0])
     117           {
     118              f = fopen(logfile, "a");
     119              if (!f)
     120                 break;
     121           }
     122           else
     123              f = stdout;
    136124
    137                 // in the first log line we write our version of the client
    138                 if (firstLogLine)
    139                 {
    140                    fprintf(f, "Samba client %s build %s based on %s\n", VERSION, BUILD, smbwrp_getVersion());
    141                    fprintf(f, "This build is maintained by %s\n", VENDOR);
    142                    firstLogLine = FALSE;
    143                 }
     125           // in the first log line we write our version of the client
     126           if (firstLogLine)
     127           {
     128              fprintf(f, "Samba client %s build %s based on %s\n", VERSION, BUILD, smbwrp_getVersion());
     129              fprintf(f, "This build is maintained by %s\n", VENDOR);
     130              firstLogLine = FALSE;
     131           }
    144132
    145                 gettimeofday(&tv, NULL);
    146                 strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime((time_t *)&tv.tv_sec));
    147                 fprintf(f, "%s.%d: %d %d: ", buf, tv.tv_usec / 10000, level, (long)_gettid());
    148                 va_start(args, fmt);
    149                 vfprintf(f, fmt, args);
    150                 va_end(args);
    151                 if (logfile)
    152                 {
    153 //                      fflush(f);
    154                         fclose(f);
    155                 }
    156         }
    157         while (0);
     133           gettimeofday(&tv, NULL);
     134           strftime(buf,sizeof(buf)-1,"%Y/%m/%d %H:%M:%S", localtime((time_t *)&tv.tv_sec));
     135           fprintf(f, "%s.%d: %d %d: ", buf, tv.tv_usec / 10000, level, (long)_gettid());
     136           va_start(args, fmt);
     137           vfprintf(f, fmt, args);
     138           va_end(args);
     139           if (logfile)
     140              fclose(f);
     141
     142        } while (0);
    158143
    159144        // if the sem is created we release it
    160145        if (logMutex)
    161         {
    162146           DosReleaseMutexSem(logMutex);
    163         }
    164147
    165148        return;
Note: See TracChangeset for help on using the changeset viewer.