Ignore:
Timestamp:
03/08/2007 00:29:31 (5 years ago)
Author:
chris
Message:

Convert most printf() and fprintf() calls to use logging framework
instead. (merges [1789])

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/general/bin/bbackupquery/BackupQueries.cpp

    r1784 r1790  
    182182                                GetConsoleCP())) 
    183183                        { 
    184                                 printf("Failed to convert encoding"); 
     184                                BOX_ERROR("Failed to convert encoding"); 
    185185                                return; 
    186186                        } 
     
    256256                if(alias[a] == 0) 
    257257                { 
    258                         printf("Unrecognised command: %s\n", Command); 
     258                        BOX_ERROR("Unrecognised command: " << Command); 
    259259                        return; 
    260260                } 
     
    276276                        if(::strchr(commands[cmd].opts, *c) == NULL) 
    277277                        { 
    278                                 printf("Invalid option '%c' for command %s\n",  
    279                                         *c, commands[cmd].name); 
     278                                BOX_ERROR("Invalid option '" << *c << "' for " 
     279                                        "command " << commands[cmd].name); 
    280280                                return; 
    281281                        } 
     
    306306                { 
    307307                        // Simple implementation, so do it here 
    308                         printf("%s (%08llx)\n",  
    309                                 GetCurrentDirectoryName().c_str(),  
    310                                 (long long)GetCurrentDirectoryID()); 
     308                        BOX_INFO(GetCurrentDirectoryName() << " (" << 
     309                                BOX_FORMAT_OBJECTID(GetCurrentDirectoryID())); 
    311310                } 
    312311                break; 
     
    321320                 
    322321        case COMMAND_sh: 
    323                 printf("The command to run must be specified as an argument.\n"); 
     322                BOX_ERROR("The command to run must be specified as an argument."); 
    324323                break; 
    325324                 
     
    402401                if(rootDir == 0) 
    403402                { 
    404                         printf("Directory '%s' not found on store\n", 
    405                                 args[0].c_str()); 
     403                        BOX_ERROR("Directory '" << args[0] << "' not found " 
     404                                "on store."); 
    406405                        return; 
    407406                } 
     
    748747        if(args.size() != 1 || args[0].size() == 0) 
    749748        { 
    750                 printf("Incorrect usage.\ncd [-o] [-d] <directory>\n"); 
     749                BOX_ERROR("Incorrect usage. cd [-o] [-d] <directory>"); 
    751750                return; 
    752751        } 
     
    765764        if(id == 0) 
    766765        { 
    767                 printf("Directory '%s' not found\n", args[0].c_str()); 
     766                BOX_ERROR("Directory '" << args[0] << "' not found."); 
    768767                return; 
    769768        } 
     
    786785        if(args.size() != 1 || args[0].size() == 0) 
    787786        { 
    788                 printf("Incorrect usage.\nlcd <local-directory>\n"); 
     787                BOX_ERROR("Incorrect usage. lcd <local-directory>"); 
    789788                SetReturnCode(COMMAND_RETURN_ERROR); 
    790789                return; 
     
    796795        if(!ConvertConsoleToUtf8(args[0].c_str(), dirName)) 
    797796        { 
    798                 printf("Failed to convert path from console encoding.\n"); 
     797                BOX_ERROR("Failed to convert path from console encoding."); 
    799798                SetReturnCode(COMMAND_RETURN_ERROR); 
    800799                return; 
     
    806805        if(result != 0) 
    807806        { 
    808                 printf((errno == ENOENT || errno == ENOTDIR)?"Directory '%s' does not exist\n":"Error changing dir to '%s'\n", 
    809                         args[0].c_str()); 
     807                if(errno == ENOENT || errno == ENOTDIR) 
     808                { 
     809                        BOX_ERROR("Directory '" << args[0] << "' does not exist."); 
     810                } 
     811                else 
     812                { 
     813                        BOX_ERROR("Error changing to directory '" << 
     814                                args[0] << ": " << strerror(errno)); 
     815                } 
     816 
    810817                SetReturnCode(COMMAND_RETURN_ERROR); 
    811818                return; 
     
    816823        if(::getcwd(wd, PATH_MAX) == 0) 
    817824        { 
    818                 printf("Error getting current directory\n"); 
     825                BOX_ERROR("Error getting current directory: " << 
     826                        strerror(errno)); 
    819827                SetReturnCode(COMMAND_RETURN_ERROR); 
    820828                return; 
     
    824832        if(!ConvertUtf8ToConsole(wd, dirName)) 
    825833        { 
    826                 printf("Failed to convert new path from console encoding.\n"); 
     834                BOX_ERROR("Failed to convert new path from console encoding."); 
    827835                SetReturnCode(COMMAND_RETURN_ERROR); 
    828836                return; 
    829837        } 
    830         printf("Local current directory is now '%s'\n", dirName.c_str()); 
     838        BOX_INFO("Local current directory is now '" << dirName << "'."); 
    831839#else 
    832         printf("Local current directory is now '%s'\n", wd); 
     840        BOX_INFO("Local current directory is now '" << wd << "'."); 
    833841#endif 
    834842} 
     
    848856        if(args.size() != 2) 
    849857        { 
    850                 printf("Incorrect usage.\ngetobject <object-id> <local-filename>\n"); 
     858                BOX_ERROR("Incorrect usage. getobject <object-id> " 
     859                        "<local-filename>"); 
    851860                return; 
    852861        } 
     
    855864        if(id == std::numeric_limits<long long>::min() || id == std::numeric_limits<long long>::max() || id == 0) 
    856865        { 
    857                 printf("Not a valid object ID (specified in hex)\n"); 
     866                BOX_ERROR("Not a valid object ID (specified in hex)."); 
    858867                return; 
    859868        } 
     
    863872        if(::stat(args[1].c_str(), &st) == 0 || errno != ENOENT) 
    864873        { 
    865                 printf("The local file %s already exists\n", args[1].c_str()); 
     874                BOX_ERROR("The local file '" << args[1] << " already exists."); 
    866875                return; 
    867876        } 
     
    881890                        objectStream->CopyStreamTo(out); 
    882891                         
    883                         printf("Object ID %08llx fetched successfully.\n", id); 
     892                        BOX_INFO("Object ID " << BOX_FORMAT_OBJECTID(id) << 
     893                                " fetched successfully."); 
    884894                } 
    885895                else 
    886896                { 
    887                         printf("Object does not exist on store.\n"); 
     897                        BOX_ERROR("Object ID " << BOX_FORMAT_OBJECTID(id) << 
     898                                " does not exist on store."); 
    888899                        ::unlink(args[1].c_str()); 
    889900                } 
     
    892903        { 
    893904                ::unlink(args[1].c_str()); 
    894                 printf("Error occured fetching object.\n"); 
     905                BOX_ERROR("Error occured fetching object."); 
    895906        } 
    896907} 
     
    912923        if(args.size() < 1 || (opts['i'] && args.size() != 2) || args.size() > 2) 
    913924        { 
    914                 printf("Incorrect usage.\n" 
     925                BOX_ERROR("Incorrect usage.\n" 
    915926                        "get <remote-filename> [<local-filename>] or\n" 
    916                         "get -i <object-id> <local-filename>\n"); 
     927                        "get -i <object-id> <local-filename>"); 
    917928                return; 
    918929        } 
     
    932943                        if(!ConvertConsoleToUtf8(i->c_str(), out)) 
    933944                        { 
    934                                 fprintf(stderr, "failed to convert encoding\n"); 
     945                                BOX_ERROR("Failed to convert encoding."); 
    935946                                return; 
    936947                        } 
     
    953964                                if(dirId == 0) 
    954965                                { 
    955                                         printf("Directory '%s' not found\n",  
    956                                                 dirName.c_str()); 
     966                                        BOX_ERROR("Directory '" << dirName << 
     967                                                "' not found."); 
    957968                                        return; 
    958969                                } 
     
    982993                                fileId == 0) 
    983994                        { 
    984                                 printf("Not a valid object ID (specified in hex)\n"); 
     995                                BOX_ERROR("Not a valid object ID (specified in hex)."); 
    985996                                return; 
    986997                        } 
     
    9891000                        if(dir.FindEntryByID(fileId) == 0) 
    9901001                        { 
    991                                 printf("ID '%08llx' not found in current " 
     1002                                BOX_ERROR("File ID " <<  
     1003                                        BOX_FORMAT_OBJECTID(fileId) << 
     1004                                        " not found in current " 
    9921005                                        "directory on store.\n" 
    993                                         "(You can only download objects by ID " 
    994                                         "from the current directory.)\n",  
    995                                         fileId); 
     1006                                        "(You can only download files by ID " 
     1007                                        "from the current directory.)"); 
    9961008                                return; 
    9971009                        } 
     
    10081020                        if(en == 0) 
    10091021                        { 
    1010                                 printf("Filename '%s' not found in current " 
     1022                                BOX_ERROR("Filename '" << args[0] << "' " 
     1023                                        "not found in current " 
    10111024                                        "directory on store.\n" 
    10121025                                        "(Subdirectories in path not " 
    1013                                         "searched.)\n", args[0].c_str()); 
     1026                                        "searched.)"); 
    10141027                                return; 
    10151028                        } 
     
    10281041        if(::stat(localName.c_str(), &st) == 0 || errno != ENOENT) 
    10291042        { 
    1030                 printf("The local file %s already exists, will not " 
    1031                         "overwrite it.\n", localName.c_str()); 
     1043                BOX_ERROR("The local file " << localName << " already exists, " 
     1044                        "will not overwrite it."); 
    10321045                SetReturnCode(COMMAND_RETURN_ERROR); 
    10331046                return; 
     
    10471060 
    10481061                // Done. 
    1049                 printf("Object ID %08llx fetched sucessfully.\n", fileId); 
     1062                BOX_INFO("Object ID " << BOX_FORMAT_OBJECTID(fileId) << 
     1063                        " fetched successfully."); 
    10501064        } 
    10511065        catch (BoxException &e) 
     
    11611175                else 
    11621176                { 
    1163                         printf("Warning: couldn't determine the time of the last synchronisation -- checks not performed.\n"); 
     1177                        BOX_WARNING("Failed to determine the time of the last " 
     1178                                "synchronisation -- checks not performed."); 
    11641179                } 
    11651180        } 
     
    11681183        if(params.mQuickCompare) 
    11691184        { 
    1170                 printf("WARNING: Quick compare used -- file attributes are not checked.\n"); 
     1185                BOX_WARNING("Quick compare used -- file attributes are not " 
     1186                        "checked."); 
    11711187        } 
    11721188         
     
    11931209                if(!params.mIgnoreExcludes) 
    11941210                { 
    1195                         printf("Cannot use excludes on directory to directory comparison -- use -E flag to specify ignored excludes\n"); 
     1211                        BOX_ERROR("Cannot use excludes on directory to directory comparison -- use -E flag to specify ignored excludes."); 
    11961212                        return; 
    11971213                } 
     
    12041220        else 
    12051221        { 
    1206                 printf("Incorrect usage.\ncompare -a\n or compare -l <location-name>\n or compare <store-dir-name> <local-dir-name>\n"); 
     1222                BOX_ERROR("Incorrect usage.\ncompare -a\n or compare -l <location-name>\n or compare <store-dir-name> <local-dir-name>"); 
    12071223                return; 
    12081224        } 
     
    12101226        if (!params.mQuietCompare) 
    12111227        {        
    1212                 printf("\n[ %d (of %d) differences probably due to file " 
    1213                         "modifications after the last upload ]\n", 
    1214                         params.mDifferencesExplainedByModTime,  
    1215                         params.mDifferences); 
    1216         } 
    1217  
    1218         printf("Differences: %d (%d dirs excluded, %d files excluded, " 
    1219                 "%d files not checked)\n", 
    1220                 params.mDifferences, params.mExcludedDirs,  
    1221                 params.mExcludedFiles, params.mUncheckedFiles); 
     1228                BOX_INFO("[ " << 
     1229                        params.mDifferencesExplainedByModTime << " (of " << 
     1230                        params.mDifferences << ") differences probably " 
     1231                        "due to file modifications after the last upload ]"); 
     1232        } 
     1233 
     1234        BOX_INFO("Differences: " << params.mDifferences << " (" << 
     1235                params.mExcludedDirs   << " dirs excluded, " << 
     1236                params.mExcludedFiles  << " files excluded, " << 
     1237                params.mUncheckedFiles << " files not checked)"); 
    12221238         
    12231239        // Set return code? 
     
    12541270        if(!locations.SubConfigurationExists(rLocation.c_str())) 
    12551271        { 
    1256                 printf("Location %s does not exist.\n", rLocation.c_str()); 
     1272                BOX_ERROR("Location " << rLocation << " does not exist."); 
    12571273                return; 
    12581274        } 
     
    12651281                        DIRECTORY_SEPARATOR_ASCHAR) 
    12661282                { 
    1267                         fprintf(stderr, "Warning: location '%s' path ends " 
    1268                                 "with '%s', compare may fail!", 
    1269                                 rLocation.c_str(), DIRECTORY_SEPARATOR); 
     1283                        BOX_WARNING("Location '" << rLocation << "' path ends " 
     1284                                "with '" DIRECTORY_SEPARATOR "', " 
     1285                                "compare may fail!"); 
    12701286                } 
    12711287        } 
     
    13201336        if(dirID == 0) 
    13211337        { 
    1322                 printf("Local directory '%s' exists, but " 
    1323                         "server directory '%s' does not exist\n",  
    1324                         rLocalDir.c_str(), rStoreDir.c_str());           
     1338                BOX_WARNING("Local directory '" << rLocalDir << "' exists, " 
     1339                        "but server directory '" << rStoreDir << "' does not " 
     1340                        "exist."); 
    13251341                rParams.mDifferences ++; 
    13261342                return; 
     
    13701386                if(errno == ENOTDIR) 
    13711387                { 
    1372                         printf("Local object '%s' is a file, " 
    1373                                 "server object '%s' is a directory\n",  
    1374                                 localDirDisplay.c_str(),  
    1375                                 storeDirDisplay.c_str()); 
     1388                        BOX_WARNING("Local object '" << localDirDisplay << "' " 
     1389                                "is a file, server object '" <<  
     1390                                storeDirDisplay << "' is a directory."); 
    13761391                        rParams.mDifferences ++; 
    13771392                } 
    13781393                else if(errno == ENOENT) 
    13791394                { 
    1380                         printf("Local directory '%s' does not exist " 
    1381                                 "(compared to server directory '%s')\n", 
    1382                                 localDirDisplay.c_str(),  
    1383                                 storeDirDisplay.c_str()); 
     1395                        BOX_WARNING("Local directory '" << localDirDisplay << 
     1396                                "' does not exist (compared to server " 
     1397                                "directory '" << storeDirDisplay << "')."); 
    13841398                        rParams.mDifferences ++; 
    13851399                } 
    13861400                else 
    13871401                { 
    1388                         printf("ERROR: stat on local dir '%s'\n",  
    1389                                 localDirDisplay.c_str()); 
     1402                        BOX_WARNING("Failed to access local directory '" << 
     1403                                localDirDisplay << ": " << strerror(errno) << 
     1404                                "'."); 
    13901405                        rParams.mUncheckedFiles ++; 
    13911406                } 
     
    14081423        if(!dir.HasAttributes()) 
    14091424        { 
    1410                 printf("Store directory '%s' doesn't have attributes.\n",  
    1411                         storeDirDisplay.c_str()); 
     1425                BOX_WARNING("Store directory '" << storeDirDisplay << "' " 
     1426                        "doesn't have attributes."); 
    14121427        } 
    14131428        else 
     
    14241439                if(!(attr.Compare(localAttr, true, true /* ignore modification times */))) 
    14251440                { 
    1426                         printf("Local directory '%s' has different attributes " 
    1427                                 "to store directory '%s'.\n", 
    1428                                 localDirDisplay.c_str(),  
    1429                                 storeDirDisplay.c_str()); 
     1441                        BOX_WARNING("Local directory '" << localDirDisplay << 
     1442                                "' has different attributes to store " 
     1443                                "directory '" << storeDirDisplay << "'."); 
    14301444                        rParams.mDifferences ++; 
    14311445                } 
     
    14361450        if(dirhandle == 0) 
    14371451        { 
    1438                 printf("ERROR: opendir on local dir '%s'\n",  
    1439                         localDirDisplay.c_str()); 
     1452                BOX_WARNING("Failed to open local directory '" <<  
     1453                        localDirDisplay << "': " << strerror(errno)); 
    14401454                rParams.mUncheckedFiles ++; 
    14411455                return; 
     
    14581472                                if (localDirEn->d_type != DT_DIR) 
    14591473                                { 
    1460                                         fprintf(stderr, "ERROR: d_type does " 
    1461                                                 "not really work on your " 
    1462                                                 "platform. Reconfigure Box!\n"); 
     1474                                        BOX_ERROR("d_type does not really " 
     1475                                                "work on your platform. " 
     1476                                                "Reconfigure Box!"); 
    14631477                                        return; 
    14641478                                } 
     
    15051519                if(::closedir(dirhandle) != 0) 
    15061520                { 
    1507                         printf("ERROR: closedir on local dir '%s'\n",  
    1508                                 localDirDisplay.c_str()); 
     1521                        BOX_ERROR("Failed to close local directory '" << 
     1522                                localDirDisplay << "': " << strerror(errno)); 
    15091523                } 
    15101524                dirhandle = 0; 
     
    15661580                        { 
    15671581                                // Not found -- report 
    1568                                 printf("Local file '%s' does not exist, " 
    1569                                         "but store file '%s' does.\n", 
    1570                                         localPathDisplay.c_str(), 
    1571                                         storePathDisplay.c_str()); 
     1582                                BOX_WARNING("Local file '" <<  
     1583                                        localDirDisplay << "' does not exist, " 
     1584                                        "but store file '" << 
     1585                                        storePathDisplay << "' does."); 
    15721586                                rParams.mDifferences ++; 
    15731587                        } 
     
    16441658                                                                fileOnServerStream->IsSymLink() /* ignore modification time if it's a symlink */)) 
    16451659                                                { 
    1646                                                         printf("Local file '%s' " 
    1647                                                                 "has different attributes " 
    1648                                                                 "to store file '%s'.\n", 
    1649                                                                 localPathDisplay.c_str(),  
    1650                                                                 storePathDisplay.c_str());                                               
     1660                                                        BOX_WARNING("Local file '" << 
     1661                                                                localPathDisplay << 
     1662                                                                "' has different attributes " 
     1663                                                                "to store file '" << 
     1664                                                                storePathDisplay << 
     1665                                                                "'."); 
    16511666                                                        rParams.mDifferences ++; 
    16521667                                                        if(modifiedAfterLastSync) 
    16531668                                                        { 
    16541669                                                                rParams.mDifferencesExplainedByModTime ++; 
    1655                                                                 printf("(the file above was modified after the last sync time -- might be reason for difference)\n"); 
     1670                                                                BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); 
    16561671                                                        } 
    16571672                                                        else if(i->second->HasAttributes()) 
    16581673                                                        { 
    1659                                                                 printf("(the file above has had new attributes applied)\n"); 
     1674                                                                BOX_INFO("(the file above has had new attributes applied)\n"); 
    16601675                                                        } 
    16611676                                                } 
     
    17231738                                        if(!equal) 
    17241739                                        { 
    1725                                                 printf("Local file '%s' " 
     1740                                                BOX_WARNING("Local file '" << 
     1741                                                        localPathDisplay << "' " 
    17261742                                                        "has different contents " 
    1727                                                         "to store file '%s'.\n", 
    1728                                                         localPathDisplay.c_str(),  
    1729                                                         storePathDisplay.c_str()); 
     1743                                                        "to store file '" << 
     1744                                                        storePathDisplay << 
     1745                                                        "'."); 
    17301746                                                rParams.mDifferences ++; 
    17311747                                                if(modifiedAfterLastSync) 
    17321748                                                { 
    17331749                                                        rParams.mDifferencesExplainedByModTime ++; 
    1734                                                         printf("(the file above was modified after the last sync time -- might be reason for difference)\n"); 
     1750                                                        BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); 
    17351751                                                } 
    17361752                                                else if(i->second->HasAttributes()) 
    17371753                                                { 
    1738                                                         printf("(the file above has had new attributes applied)\n"); 
     1754                                                        BOX_INFO("(the file above has had new attributes applied)\n"); 
    17391755                                                } 
    17401756                                        } 
     
    17951811                                !(rParams.mpExcludeFiles->IsExcluded(localPath))) 
    17961812                        { 
    1797                                 printf("Local file '%s' exists, " 
    1798                                         "but store file '%s' " 
    1799                                         "does not exist.\n", 
    1800                                         localPathDisplay.c_str(), 
    1801                                         storePathDisplay.c_str()); 
     1813                                BOX_WARNING("Local file '" <<  
     1814                                        localPathDisplay << 
     1815                                        "' exists, but store file '" << 
     1816                                        storePathDisplay << 
     1817                                        "' does not."); 
    18021818                                rParams.mDifferences ++; 
    18031819                                 
     
    18101826                                                { 
    18111827                                                        rParams.mDifferencesExplainedByModTime ++; 
    1812                                                         printf("(the file above was modified after the last sync time -- might be reason for difference)\n"); 
     1828                                                        BOX_INFO("(the file above was modified after the last sync time -- might be reason for difference)"); 
    18131829                                                } 
    18141830                                        } 
     
    18531869                        { 
    18541870                                // Not found -- report 
    1855                                 printf("Local directory '%s' is excluded, but " 
    1856                                         "store directory '%s' still exists.\n", 
    1857                                         localPathDisplay.c_str(), 
    1858                                         storePathDisplay.c_str()); 
     1871                                BOX_WARNING("Local directory '" << 
     1872                                        localPathDisplay << "' is excluded, " 
     1873                                        "but store directory '" << 
     1874                                        storePathDisplay << "' still exists."); 
    18591875                                rParams.mDifferences ++; 
    18601876                        } 
     
    18621878                        { 
    18631879                                // Not found -- report 
    1864                                 printf("Local directory '%s' does not exist, " 
    1865                                         "but store directory '%s' does.\n", 
    1866                                         localPathDisplay.c_str(), 
    1867                                         storePathDisplay.c_str()); 
     1880                                BOX_WARNING("Local directory '" << 
     1881                                        localPathDisplay << "' does not exist, " 
     1882                                        "but store directory '" << 
     1883                                        storePathDisplay << "' does."); 
    18681884                                rParams.mDifferences ++; 
    18691885                        } 
     
    19091925                        if(rParams.mpExcludeDirs == 0 || !(rParams.mpExcludeDirs->IsExcluded(localPath))) 
    19101926                        { 
    1911                                 printf("Local directory '%s' exists, but " 
    1912                                         "store directory '%s' does not exist.\n", 
    1913                                         localPathDisplay.c_str(), 
    1914                                         storePathDisplay.c_str()); 
     1927                                BOX_WARNING("Local directory '" << 
     1928                                        localPathDisplay << "' exists, but " 
     1929                                        "store directory '" << 
     1930                                        storePathDisplay << "' does not."); 
    19151931                                rParams.mDifferences ++; 
    19161932                        } 
     
    19451961        if(args.size() != 2) 
    19461962        { 
    1947                 printf("Incorrect usage.\nrestore [-d] [-r] [-i] <directory-name> <local-directory-name>\n"); 
     1963                BOX_ERROR("Incorrect usage. restore [-d] [-r] [-i] <remote-name> <local-name>"); 
    19481964                return; 
    19491965        } 
     
    19601976                if(dirID == std::numeric_limits<long long>::min() || dirID == std::numeric_limits<long long>::max() || dirID == 0) 
    19611977                { 
    1962                         printf("Not a valid object ID (specified in hex)\n"); 
     1978                        BOX_ERROR("Not a valid object ID (specified in hex)"); 
    19631979                        return; 
    19641980                } 
     
    19831999        if(dirID == 0) 
    19842000        { 
    1985                 printf("Directory '%s' not found on server\n", args[0].c_str()); 
     2001                BOX_ERROR("Directory '" << args[0] << "' not found on server"); 
    19862002                return; 
    19872003        } 
    19882004        if(dirID == BackupProtocolClientListDirectory::RootDirectory) 
    19892005        { 
    1990                 printf("Cannot restore the root directory -- restore locations individually.\n"); 
     2006                BOX_ERROR("Cannot restore the root directory -- restore locations individually."); 
    19912007                return; 
    19922008        } 
     
    20242040        { 
    20252041        case Restore_Complete: 
    2026                 printf("Restore complete\n"); 
     2042                BOX_INFO("Restore complete."); 
    20272043                break; 
    20282044         
    20292045        case Restore_ResumePossible: 
    2030                 printf("Resume possible -- repeat command with -r flag to resume\n"); 
     2046                BOX_ERROR("Resume possible -- repeat command with -r flag to resume"); 
    20312047                break; 
    20322048         
    20332049        case Restore_TargetExists: 
    2034                 printf("The target directory exists. You cannot restore over an existing directory.\n"); 
     2050                BOX_ERROR("The target directory exists. You cannot restore over an existing directory."); 
    20352051                break; 
    20362052                 
    20372053        #ifdef WIN32 
    20382054        case Restore_TargetPathNotFound: 
    2039                 printf("The target directory path does not exist.\n" 
     2055                BOX_ERROR("The target directory path does not exist.\n" 
    20402056                        "To restore to a directory whose parent " 
    2041                         "does not exist, create the parent first.\n"); 
     2057                        "does not exist, create the parent first."); 
    20422058                break; 
    20432059        #endif 
    20442060 
    20452061        case Restore_UnknownError: 
    2046                 printf("Unknown error during restore.\n"); 
     2062                BOX_ERROR("Unknown error during restore."); 
    20472063                break; 
    20482064 
    20492065        default: 
    2050                 printf("ERROR: Unknown restore result %d.\n", result); 
     2066                BOX_ERROR("Unknown restore result " << result << "."); 
    20512067                break; 
    20522068        } 
     
    21682184        if(args.size() != 1) 
    21692185        { 
    2170                 printf("Incorrect usage.\nundelete <directory-name>\n"); 
     2186                BOX_ERROR("Incorrect usage. undelete <directory-name>"); 
    21712187                return; 
    21722188        } 
     
    21862202        if(dirID == 0) 
    21872203        { 
    2188                 printf("Directory '%s' not found on server\n", args[0].c_str()); 
     2204                BOX_ERROR("Directory '" << args[0] << "' not found on server."); 
    21892205                return; 
    21902206        } 
    21912207        if(dirID == BackupProtocolClientListDirectory::RootDirectory) 
    21922208        { 
    2193                 printf("Cannot undelete the root directory.\n"); 
     2209                BOX_ERROR("Cannot undelete the root directory."); 
    21942210                return; 
    21952211        } 
Note: See TracChangeset for help on using the changeset viewer.