Changeset 17782

Show
Ignore:
Timestamp:
07.11.2008 13:38:22 (11 years ago)
Author:
ak19
Message:

(Minor changes, defensive programming.) Dr Bainbridge corrected all newlines chars printed out to stderr and stdout to endl as this may produce more consistent results across operating systems.

Location:
gsdl/trunk/common-src/src/gdbmedit
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/common-src/src/gdbmedit/db2txt/db2txt.cpp

    r15694 r17782  
    5555 
    5656void print_usage (char *program_name) { 
    57   cerr << "usage: " << program_name << " database-name\n\n"; 
     57  cerr << "usage: " << program_name << " database-name" << endl << endl; 
    5858} 
    5959 
     
    7777#endif 
    7878  if (dbf == NULL) { 
    79     cerr << "couldn't open " << argv[1] << "\n"; 
     79    cerr << "couldn't open " << argv[1] << endl; 
    8080    exit (0); 
    8181  } 
     
    8686    for (i = 0; i < key.dsize; ++i) 
    8787      cout << key.dptr[i]; 
    88     cout << "]\n"; 
     88    cout << "]" << endl; 
    8989    value = gdbm_fetch (dbf, key); 
    9090    for (i = 0; i < value.dsize; ++i) 
    9191      cout << value.dptr[i]; 
    92     cout << "\n----------------------------------------------------------------------\n"; 
     92    cout << endl << "----------------------------------------------------------------------" << endl; 
    9393    free(value.dptr); 
    9494 
  • gsdl/trunk/common-src/src/gdbmedit/gdbmget/gdbmget.cpp

    r17091 r17782  
    8383  if (dbf == NULL)  
    8484    { 
    85       cerr << "couldn't create " << argv[1] << "\n"; 
     85      cerr << "couldn't create " << argv[1] << endl; 
    8686      exit (-1); 
    8787    } 
     
    9696          cout << value.dptr[i]; 
    9797        } 
    98       printf("\n"); 
     98      cout << endl; // used to be printf("\n"); 
    9999      // ?? free(value.dptri); 
    100100    }  
    101101  else  
    102102    { 
    103       printf("\n"); 
     103      cout << endl; // used to be printf("\n"); 
    104104    } 
    105105   
  • gsdl/trunk/common-src/src/gdbmedit/gdbmset/gdbmset.cpp

    r17091 r17782  
    8585  if (dbf == NULL)  
    8686    { 
    87       cerr << "couldn't open database connection to " << argv[1] << "\n"; 
     87      cerr << "couldn't open database connection to " << argv[1] << endl; 
    8888      exit (-1); 
    8989    } 
     
    9797      datum orig_content,concat_content; 
    9898 
    99       //cerr << "Appending [" << argv[2] << "] to '" << argv[3] << "' (length " << strlen(argv[3]) << ")\n"; 
     99      //cerr << "Appending [" << argv[2] << "] to '" << argv[3] << "' (length " << strlen(argv[3]) << ")" << endl; 
    100100      // get old value, then top up 
    101101 
     
    117117      if(gdbm_store(dbf, key, concat_content, GDBM_REPLACE) != 0) 
    118118        { 
    119           cerr << "failed to set [" << argv[2] << "] to '" << concat_data << "'\n"; 
     119          cerr << "failed to set [" << argv[2] << "] to '" << concat_data << "'" << endl; 
    120120        } 
    121121      delete [] concat_data; 
     
    130130      datum content; 
    131131 
    132       //cerr << "Setting [" << argv[2] << "] to '" << argv[3] << "' (length " << strlen(argv[3]) << ")\n"; 
     132      //cerr << "Setting [" << argv[2] << "] to '" << argv[3] << "' (length " << strlen(argv[3]) << ")" << endl; 
    133133      content.dsize = strlen(argv[3]); 
    134134      content.dptr = argv[3]; 
    135135      if(gdbm_store(dbf, key, content, GDBM_REPLACE) != 0) 
    136136        { 
    137           cerr << "failed to set [" << argv[2] << "] to '" << argv[3] << "'\n"; 
     137          cerr << "failed to set [" << argv[2] << "] to '" << argv[3] << "'" << endl; 
    138138        } 
    139139    } 
     
    142142      if(gdbm_delete(dbf, key) != 0) 
    143143        { 
    144           cerr << "failed to remove [" << argv[2] << "]\n"; 
     144          cerr << "failed to remove [" << argv[2] << "]" << endl; 
    145145        } 
    146146    }