Ignore:
Timestamp:
Jan 6, 2007, 7:03:56 PM (19 years ago)
Author:
dmik
Message:

Psi: OpenPGP: replaced printf() debug statements with qDebug() to redirect debug logs to stderr; added some minor OS/2-related corrections.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • psi/trunk/src/tools/openpgp/gpgproc/gpgproc.cpp

    r11 r86  
    106106        if(!d->pipeAux.open()) {
    107107#ifdef GPG_DEBUG
    108                 printf("Error creating pipeAux\n");
     108                qDebug("### Error creating pipeAux");
    109109#endif
    110110                closePipes();
     
    113113        if(!d->pipeCommand.open()) {
    114114#ifdef GPG_DEBUG
    115                 printf("Error creating pipeCommand\n");
     115                qDebug("### Error creating pipeCommand");
    116116#endif
    117117                closePipes();
     
    120120        if(!d->pipeStatus.open()) {
    121121#ifdef GPG_DEBUG
    122                 printf("Error creating pipeStatus\n");
     122                qDebug("### Error creating pipeStatus");
    123123#endif
    124124                closePipes();
     
    130130        if(!d->pipeAux.writeEnd().winDupHandle()) {
    131131#ifdef GPG_DEBUG
    132                 printf("Error dup'ing pipeAux\n");
     132                qDebug("### Error dup'ing pipeAux");
    133133#endif
    134134                closePipes();
     
    137137        if(!d->pipeCommand.writeEnd().winDupHandle()) {
    138138#ifdef GPG_DEBUG
    139                 printf("Error dup'ing pipeCommand\n");
     139                qDebug("### Error dup'ing pipeCommand");
    140140#endif
    141141                closePipes();
     
    144144        if(!d->pipeStatus.readEnd().winDupHandle()) {
    145145#ifdef GPG_DEBUG
    146                 printf("Error dup'ing pipeStatus\n");
     146                qDebug("### Error dup'ing pipeStatus");
    147147#endif
    148148                closePipes();
     
    168168                QCString cs2 = buf.data();
    169169                if(cs != cs2)
    170                         printf("Pipe test failed.\n");
     170                        qDebug("### Pipe test failed.");
    171171                else
    172                         printf("Pipe test succeeded.\n");
     172                        qDebug("### Pipe test succeeded.");
    173173        }*/
    174174
     
    180180
    181181#ifdef GPG_DEBUG
    182         printf("Pipe setup complete.\n");
     182        qDebug("### Pipe setup complete.");
    183183#endif
    184184
     
    188188
    189189        if(useExtra) {
    190                 fullargs += "--enable-special-filenames";
    191 
    192190                fullargs += "--status-fd";
    193191                fullargs += d->pipeStatus.writeEnd().toString();
     
    197195        }
    198196
     197        bool seen_special_filenames = false;       
    199198        for(QStringList::ConstIterator it = args.begin(); it != args.end(); ++it) {
    200199                const QString &a = (*it);
    201                 if(a == "-&?")
    202                         fullargs += (QString("-&") + d->pipeAux.readEnd().toString());
    203                 else
     200                if(a == "-&?") {
     201                        seen_special_filenames = true;
     202                        fullargs += (QString("\"-&") + d->pipeAux.readEnd().toString() + "\"");
     203                } else {
    204204                        fullargs += a;
    205         }
     205                }
     206        }
     207        // insert --enable-special-filenames after --no-tty
     208        if(seen_special_filenames)
     209                fullargs.insert(fullargs.at(2), "--enable-special-filenames");
    206210
    207211        // show full command
    208212#ifdef GPG_DEBUG
    209         printf("GPGProc: ");
    210         for(QStringList::ConstIterator it2 = fullargs.begin(); it2 != fullargs.end(); ++it2) {
    211                 printf("%s ", (*it2).latin1());
    212         }
    213         printf("\n");
     213        qDebug("### GPGProc: %s", fullargs.join(" ").latin1());
    214214#endif
    215215
     
    223223        d->proc->setClosePipeList(plist);
    224224#endif
    225         /// @todo (dmik)
    226         //  On Unix, it is done when SProcess is destructed. On OS/2 as well as on
    227         //  Win32, SProcess is not used, but we use the same QPipe implelentation
    228         //  on OS/2 as Unix does, so we need to use the similar technuque to close
    229         //  them... Need to investigate this file (i.e. usage) in detail.
    230225
    231226        connect(d->proc, SIGNAL(readyReadStdout()), SLOT(proc_readyReadStdout()));
     
    327322#endif
    328323        processExited();
     324
     325#if defined(Q_OS_OS2)
     326        closePipes();
     327#endif
    329328}
    330329
Note: See TracChangeset for help on using the changeset viewer.