Browse Source

Made errors print to stderr so eval wont try to evaluate them

naelstrof 10 years ago
parent
commit
755a6cfa00
3 changed files with 13 additions and 13 deletions
  1. 1
    1
      main.cpp
  2. 10
    10
      options.cpp
  3. 2
    2
      x.cpp

+ 1
- 1
main.cpp View File

@@ -36,7 +36,7 @@ int main( int argc, char** argv ) {
36 36
             printf( "Y=0\n" );
37 37
             printf( "W=0\n" );
38 38
             printf( "H=0\n" );
39
-            printf( "User right-clicked. Canceled selection.\n" );
39
+            fprintf( stderr, "User right-clicked. Canceled selection.\n" );
40 40
             state = -1;
41 41
             running = false;
42 42
         }

+ 10
- 10
options.cpp View File

@@ -61,8 +61,8 @@ int slrn::Options::parseOptions( int argc, char** argv ) {
61 61
             if ( i == 0 ) {
62 62
                 continue;
63 63
             }
64
-            printf( "Error: Unknown argument %s\n", argv[i] );
65
-            printf( "Try -h or --help for help.\n" );
64
+            fprintf( stderr, "Error: Unknown argument %s\n", argv[i] );
65
+            fprintf( stderr, "Try -h or --help for help.\n" );
66 66
             return 1;
67 67
         }
68 68
     }
@@ -79,10 +79,10 @@ int slrn::Options::parseInt( std::string arg, int* returnInt ) {
79 79
     char* x = new char[ arg.size() ];
80 80
     int num = sscanf( copy.c_str(), "%s %i", x, returnInt );
81 81
     if ( num != 2 ) {
82
-        printf( "Error parsing command arguments near %s\n", arg.c_str() );
83
-        printf( "Usage: %s=INT\n", x );
84
-        printf( "Example: %s=10 or %s=-12\n", x, x );
85
-        printf( "Try -h or --help for help.\n" );
82
+        fprintf( stderr, "Error parsing command arguments near %s\n", arg.c_str() );
83
+        fprintf( stderr, "Usage: %s=INT\n", x );
84
+        fprintf( stderr, "Example: %s=10 or %s=-12\n", x, x );
85
+        fprintf( stderr, "Try -h or --help for help.\n" );
86 86
         delete[] x;
87 87
         return 1;
88 88
     }
@@ -109,10 +109,10 @@ int slrn::Options::parseString( std::string arg, std::string* returnString ) {
109 109
     char* y = new char[ arg.size() ];
110 110
     int num = sscanf( copy.c_str(), "%s %s", x, y );
111 111
     if ( num != 2 ) {
112
-        printf( "Error parsing command arguments near %s\n", arg.c_str() );
113
-        printf( "Usage: %s=STRING\n", x );
114
-        printf( "Example: %s=:0 or %s=hostname:0.1\n", x, x );
115
-        printf( "Try -h or --help for help.\n" );
112
+        fprintf( stderr, "Error parsing command arguments near %s\n", arg.c_str() );
113
+        fprintf( stderr, "Usage: %s=STRING\n", x );
114
+        fprintf( stderr, "Example: %s=:0 or %s=hostname:0.1\n", x, x );
115
+        fprintf( stderr, "Try -h or --help for help.\n" );
116 116
         delete[] x;
117 117
         delete[] y;
118 118
         return 1;

+ 2
- 2
x.cpp View File

@@ -53,7 +53,7 @@ int slrn::XEngine::init( std::string display ) {
53 53
     // Initialize display
54 54
     m_display = XOpenDisplay( display.c_str() );
55 55
     if ( !m_display ) {
56
-        printf( "Failed to open X display %s\n", display.c_str() );
56
+        fprintf( stderr, "Error: Failed to open X display %s\n", display.c_str() );
57 57
         return 1;
58 58
     }
59 59
     m_screen    = ScreenOfDisplay( m_display, DefaultScreen( m_display ) );
@@ -74,7 +74,7 @@ int slrn::XEngine::grabCursor( slrn::CursorType type ) {
74 74
                             PointerMotionMask | ButtonPressMask | ButtonReleaseMask,
75 75
                             GrabModeAsync, GrabModeAsync, m_root, xfontcursor, CurrentTime );
76 76
     if ( err != GrabSuccess ) {
77
-        printf( "Failed to grab X cursor.\n" );
77
+        fprintf( stderr, "Error: Failed to grab X cursor.\n" );
78 78
         return 1;
79 79
     }
80 80