pretty code
This commit is contained in:
parent
a95337ef81
commit
ce8cb2efa5
5 changed files with 25 additions and 44 deletions
|
@ -1158,12 +1158,10 @@ int debug( void ) {
|
|||
exit_x48( 1 );
|
||||
if ( enter_debugger & BREAKPOINT_HIT )
|
||||
if ( verbose )
|
||||
printf( "breakpoint hit at 0x%.5lX ignored\n",
|
||||
saturn.PC );
|
||||
printf( "breakpoint hit at 0x%.5lX ignored\n", saturn.PC );
|
||||
if ( enter_debugger & TRAP_INSTRUCTION )
|
||||
if ( verbose )
|
||||
printf( "trap instruction at 0x%.5lX ignored\n",
|
||||
saturn.PC );
|
||||
printf( "trap instruction at 0x%.5lX ignored\n", saturn.PC );
|
||||
enter_debugger = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -342,8 +342,7 @@ int read_mem_file( char* name, word_4* mem, int size ) {
|
|||
|
||||
if ( st.st_size != size / 2 ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr,
|
||||
"strange size %s, expected %d, found %ld\n",
|
||||
fprintf( stderr, "strange size %s, expected %d, found %ld\n",
|
||||
name, size / 2, st.st_size );
|
||||
fclose( fp );
|
||||
return 0;
|
||||
|
@ -353,8 +352,7 @@ int read_mem_file( char* name, word_4* mem, int size ) {
|
|||
for ( i = 0, j = 0; i < size / 2; i++ ) {
|
||||
if ( 1 != fread( &byte, 1, 1, fp ) ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t read %s\n",
|
||||
name );
|
||||
fprintf( stderr, "can\'t read %s\n", name );
|
||||
fclose( fp );
|
||||
return 0;
|
||||
}
|
||||
|
@ -440,8 +438,7 @@ void get_home_directory( char* path ) {
|
|||
strcat( path, "/" );
|
||||
} else {
|
||||
if ( !quiet )
|
||||
fprintf( stderr,
|
||||
"can\'t figure out your home directory, "
|
||||
fprintf( stderr, "can\'t figure out your home directory, "
|
||||
"trying /tmp\n" );
|
||||
strcpy( path, "/tmp" );
|
||||
}
|
||||
|
@ -539,8 +536,7 @@ int read_files( void ) {
|
|||
saturn.ram = ( word_4* )NULL;
|
||||
if ( NULL == ( saturn.ram = ( word_4* )malloc( ram_size ) ) ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t malloc RAM[%d]\n",
|
||||
ram_size );
|
||||
fprintf( stderr, "can\'t malloc RAM[%d]\n", ram_size );
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
|
@ -568,8 +564,7 @@ int read_files( void ) {
|
|||
if ( ( port1_size == 0x10000 ) || ( port1_size == 0x40000 ) ) {
|
||||
if ( NULL == ( saturn.port1 = ( word_4* )malloc( port1_size ) ) ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t malloc PORT1[%ld]\n",
|
||||
port1_size );
|
||||
fprintf( stderr, "can\'t malloc PORT1[%ld]\n", port1_size );
|
||||
} else if ( !read_mem_file( fnam, saturn.port1, port1_size ) ) {
|
||||
port1_size = 0;
|
||||
port1_is_ram = 0;
|
||||
|
@ -602,8 +597,7 @@ int read_files( void ) {
|
|||
( ( port2_size == 0x10000 ) || ( port2_size == 0x40000 ) ) ) ) {
|
||||
if ( NULL == ( saturn.port2 = ( word_4* )malloc( port2_size ) ) ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t malloc PORT2[%ld]\n",
|
||||
port2_size );
|
||||
fprintf( stderr, "can\'t malloc PORT2[%ld]\n", port2_size );
|
||||
} else if ( !read_mem_file( fnam, saturn.port2, port2_size ) ) {
|
||||
port2_size = 0;
|
||||
port2_is_ram = 0;
|
||||
|
@ -756,15 +750,13 @@ int write_files( void ) {
|
|||
make_dir = 1;
|
||||
} else {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t stat %s, saving to /tmp\n",
|
||||
path );
|
||||
fprintf( stderr, "can\'t stat %s, saving to /tmp\n", path );
|
||||
strcpy( path, "/tmp" );
|
||||
}
|
||||
} else {
|
||||
if ( !S_ISDIR( st.st_mode ) ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "%s is no directory, saving to /tmp\n",
|
||||
path );
|
||||
fprintf( stderr, "%s is no directory, saving to /tmp\n", path );
|
||||
strcpy( path, "/tmp" );
|
||||
}
|
||||
}
|
||||
|
@ -772,8 +764,7 @@ int write_files( void ) {
|
|||
if ( make_dir ) {
|
||||
if ( mkdir( path, 0777 ) == -1 ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t mkdir %s, saving to /tmp\n",
|
||||
path );
|
||||
fprintf( stderr, "can\'t mkdir %s, saving to /tmp\n", path );
|
||||
strcpy( path, "/tmp" );
|
||||
}
|
||||
}
|
||||
|
@ -784,8 +775,7 @@ int write_files( void ) {
|
|||
strcat( fnam, "hp48" );
|
||||
if ( ( fp = fopen( fnam, "w" ) ) == NULL ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t open %s, no saving done\n",
|
||||
fnam );
|
||||
fprintf( stderr, "can\'t open %s, no saving done\n", fnam );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,8 +57,7 @@ int serial_init( void ) {
|
|||
if ( ( ttyp = open( tty_dev_name, O_RDWR | O_NDELAY, 0666 ) ) >=
|
||||
0 ) {
|
||||
if ( verbose )
|
||||
printf( "wire connection on %s\n",
|
||||
tty_dev_name );
|
||||
printf( "wire connection on %s\n", tty_dev_name );
|
||||
wire_name = strdup( tty_dev_name );
|
||||
}
|
||||
}
|
||||
|
@ -74,8 +73,7 @@ int serial_init( void ) {
|
|||
ttyp = wire_fd;
|
||||
sprintf( tty_dev_name, "/dev/tty%c%x", c, n );
|
||||
if ( verbose )
|
||||
printf( "wire connection on %s\n",
|
||||
tty_dev_name );
|
||||
printf( "wire connection on %s\n", tty_dev_name );
|
||||
wire_name = strdup( tty_dev_name );
|
||||
break;
|
||||
}
|
||||
|
@ -288,7 +286,8 @@ void serial_baud( int baud ) {
|
|||
#endif
|
||||
{
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n", errno );
|
||||
fprintf( stderr, "ioctl(IR, TCSETS) failed, errno = %d\n",
|
||||
errno );
|
||||
ir_fd = -1;
|
||||
error = 1;
|
||||
}
|
||||
|
@ -402,8 +401,7 @@ void transmit_char( void ) {
|
|||
}
|
||||
} else {
|
||||
if ( errno != EAGAIN ) {
|
||||
fprintf( stderr, "serial write error: %d\n",
|
||||
errno );
|
||||
fprintf( stderr, "serial write error: %d\n", errno );
|
||||
}
|
||||
saturn.tcs &= 0x0e;
|
||||
if ( saturn.io_ctrl & 0x04 ) {
|
||||
|
@ -419,8 +417,7 @@ void transmit_char( void ) {
|
|||
} else {
|
||||
if ( errno != EAGAIN ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "serial write error: %d\n",
|
||||
errno );
|
||||
fprintf( stderr, "serial write error: %d\n", errno );
|
||||
}
|
||||
saturn.tcs &= 0x0e;
|
||||
if ( saturn.io_ctrl & 0x04 ) {
|
||||
|
|
|
@ -241,8 +241,7 @@ int get_integer_resource( char* name, char* class ) {
|
|||
free( s );
|
||||
return val;
|
||||
}
|
||||
fprintf( stderr, "%s must be an integer, not %s.\n", name,
|
||||
s );
|
||||
fprintf( stderr, "%s must be an integer, not %s.\n", name, s );
|
||||
free( s );
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1441,8 +1441,7 @@ int InitDisplay( int argc, char** argv ) {
|
|||
if ( ( argc == 2 ) && !strcmp( argv[ 1 ], "-help" ) )
|
||||
usage();
|
||||
else if ( argc > 1 ) {
|
||||
fprintf( stderr, "unknown option %s or missing argument\n",
|
||||
argv[ 1 ] );
|
||||
fprintf( stderr, "unknown option %s or missing argument\n", argv[ 1 ] );
|
||||
usage();
|
||||
}
|
||||
|
||||
|
@ -1490,8 +1489,7 @@ int InitDisplay( int argc, char** argv ) {
|
|||
if ( dpy == ( Display* )0 ) {
|
||||
if ( res ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t open display %s\n",
|
||||
res );
|
||||
fprintf( stderr, "can\'t open display %s\n", res );
|
||||
} else {
|
||||
if ( !quiet )
|
||||
fprintf( stderr, "can\'t open display\n" );
|
||||
|
@ -3727,8 +3725,7 @@ void save_command_line( void ) {
|
|||
wm_argv = ( char** )malloc( ( saved_argc + 5 ) * sizeof( char* ) );
|
||||
if ( wm_argv == ( char** )0 ) {
|
||||
if ( !quiet )
|
||||
fprintf( stderr,
|
||||
"warning: malloc failed in wm_save_yourself.\n" );
|
||||
fprintf( stderr, "warning: malloc failed in wm_save_yourself.\n" );
|
||||
XSetCommand( dpy, mainW, saved_argv, saved_argc );
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue