Skip to content

Commit

Permalink
clang-format run
Browse files Browse the repository at this point in the history
  • Loading branch information
boeckmann committed Feb 7, 2024
1 parent ac4c980 commit ab00c0c
Show file tree
Hide file tree
Showing 20 changed files with 1,768 additions and 1,707 deletions.
910 changes: 467 additions & 443 deletions source/fdisk/ansicon.c

Large diffs are not rendered by default.

17 changes: 7 additions & 10 deletions source/fdisk/ansicon.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
* DEALINGS IN THE SOFTWARE.
*/


/* This library supports the interpretation of a minimal subset of ANSI
* escape sequences for display output. The supported sequences as of now are:
Expand Down Expand Up @@ -130,15 +129,14 @@
47 White backgound (ISO 6429 standard)
*/


/* some ESC strings as preprocessor definition */
#define ESC_ATTR_OFF "\33[0m"
#define ESC_BOLD_ON "\33[1m"
#define ESC_BOLD_OFF "\33[22m"
#define ESC_ATTR_OFF "\33[0m"
#define ESC_BOLD_ON "\33[1m"
#define ESC_BOLD_OFF "\33[22m"
#define ESC_BLINK_ON
#define ESC_BLINK_OFF
#define ESC_CLRSCR "\33[2J"
#define ESC_CLREOL "\33[K"
#define ESC_CLRSCR "\33[2J"
#define ESC_CLREOL "\33[K"

#ifdef __cplusplus
extern "C" {
Expand All @@ -148,7 +146,6 @@ extern "C" {
* Variable must be reset to zero by user of the lib */
extern int con_error;


/* Initialize the console output routines.
* interpret_esc = 0 : interpretation of escape sequences disabled
* interpret_esc = 1 : interpretation of escape sequences enabled */
Expand All @@ -164,10 +161,10 @@ int con_readkey( void );

/* Display output routines. The functions interpret ANSI escape sequences
* if enabled via con_init(). */
void con_putc( char c );
void con_putc( char c );
void con_print( const char *s );
void con_print_at( int x, int y, const char *s );
void con_puts( const char *s ); /* like con_print with trailing new-line */
void con_puts( const char *s ); /* like con_print with trailing new-line */

/* Clear screen and move cursor to home position. */
void con_clrscr( void );
Expand Down
12 changes: 6 additions & 6 deletions source/fdisk/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
#include <stdlib.h>
#include <string.h>

#include "ansicon.h"
#include "cmd.h"
#include "compat.h"
#include "fdiskio.h"
#include "main.h"
#include "pcompute.h"
#include "pdiskio.h"
#include "userint0.h"
#include "ansicon.h"
#include "printf.h"
#include "svarlang/svarlang.h"
#include "userint0.h"

#ifndef FDISKLITE
#include "userint1.h"
Expand Down Expand Up @@ -494,12 +494,14 @@ void Command_Line_Test_Flag( void )

if ( flag == arg[0].extra_value ) {
/* NLS:Flag %d is set to %d. */
con_printf( svarlang_str( 8, 31 ), arg[0].value, arg[0].extra_value );
con_printf( svarlang_str( 8, 31 ), arg[0].value,
arg[0].extra_value );
exit( 21 );
}
else {
/* NLS:Flag %d is not set to %d. */
con_printf( svarlang_str( 8, 32 ), arg[0].value, arg[0].extra_value );
con_printf( svarlang_str( 8, 32 ), arg[0].value,
arg[0].extra_value );
exit( 20 );
}
}
Expand All @@ -513,7 +515,6 @@ void Command_Line_Test_Flag( void )
}
}


/* Get the command line options */
int Get_Options( char *argv[], int argc )
{
Expand Down Expand Up @@ -550,7 +551,6 @@ int Get_Options( char *argv[], int argc )
if ( flags.using_default_drive_number ) {
flags.drive_number = ( argptr[0] - '0' ) + 127;
flags.using_default_drive_number = FALSE;

}
else if ( flags.drive_number != ( argptr[0] - '0' ) + 127 ) {
/* NLS:more than one drive specified; terminated */
Expand Down
1 change: 0 additions & 1 deletion source/fdisk/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ char *searchpath( char *fn )
#endif

#endif

3 changes: 1 addition & 2 deletions source/fdisk/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@ char *searchpath( char *fn );

#if defined( __GNUC__ )

extern char *_searchpath (const char *__file);
extern char *_searchpath( const char *__file );
#define searchpath _searchpath

#ifndef stricmp
#define stricmp strcasecmp
#endif


extern char **environ;

#endif
Expand Down
69 changes: 45 additions & 24 deletions source/fdisk/fdiskio.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,19 @@
#ifdef __GNUC__
#include <libi86/string.h>
#endif
#include "ansicon.h"
#include "compat.h"
#include "fdiskio.h"
#include "main.h"
#include "pcompute.h"
#include "pdiskio.h"
#include "ansicon.h"
#include "printf.h"
#include "svarlang/svarlang.h"


/* bootloader pointers */
/*extern char booteasy_code[];*/
extern char bootnormal_code[];


/* Automatically partition the selected hard drive */
int Automatically_Partition_Hard_Drive( void )
{
Expand Down Expand Up @@ -235,7 +233,6 @@ static int Create_BootNormal_MBR( void )
return Write_Physical_Sectors( flags.drive_number, 0, 0, 1, 1 );
}


#ifdef SMART_MBR
/* Create Normal MBR */
extern void __cdecl __far BootSmart_code();
Expand All @@ -245,8 +242,7 @@ int Create_BootSmart_IPL( void )
int error_code;

/* NLS:Creating Drive Smart MBR for disk %d */
con_printf( svarlang_str( 7, 6 ),
flags.drive_number - 0x7F );
con_printf( svarlang_str( 7, 6 ), flags.drive_number - 0x7F );

error_code = Read_Physical_Sectors( flags.drive_number, 0, 0, 1, 1 );
if ( error_code != 0 ) {
Expand Down Expand Up @@ -298,7 +294,6 @@ int Create_MBR_If_Not_Present( void )
}
*/


/* parse bool_text for "ON" or "OFF" and set integer var accordingly */
int bool_string_to_int( int *var, const char *bool_text )
{
Expand All @@ -314,7 +309,6 @@ int bool_string_to_int( int *var, const char *bool_text )
return 0;
}


/* Read and process the fdisk.ini file */
void Process_Fdiskini_File( void )
{
Expand Down Expand Up @@ -360,7 +354,7 @@ void Process_Fdiskini_File( void )
( end_of_file_marker_encountered == FALSE ) ) {

/* Clear the command_buffer and setting_buffer */
for (index = 0; index < 20; index++) {
for ( index = 0; index < 20; index++ ) {
command_buffer[index] = 0x00;
setting_buffer[index] = 0x00;
}
Expand Down Expand Up @@ -441,36 +435,44 @@ void Process_Fdiskini_File( void )

/* Align partitions to 4k */
if ( 0 == stricmp( command_buffer, "ALIGN_4K" ) ) {
if ( !bool_string_to_int( &flags.align_4k, setting_buffer) )
if ( !bool_string_to_int( &flags.align_4k, setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the ALLOW_4GB_FAT16 statement */
if ( 0 == stricmp( command_buffer, "ALLOW_4GB_FAT16" ) ) {
if ( !bool_string_to_int( &flags.allow_4gb_fat16, setting_buffer) )
if ( !bool_string_to_int( &flags.allow_4gb_fat16,
setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the ALLOW_ABORT statement */
if ( 0 == stricmp( command_buffer, "ALLOW_ABORT" ) ) {
if ( !bool_string_to_int( &flags.allow_abort, setting_buffer) )
if ( !bool_string_to_int( &flags.allow_abort,
setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the AMBR statement */
if ( 0 == stricmp( command_buffer, "AMBR" ) ) {
if ( !bool_string_to_int( &flags.use_ambr, setting_buffer) )
if ( !bool_string_to_int( &flags.use_ambr, setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the CHECKEXTRA statement */
if ( 0 == stricmp( command_buffer, "CHECKEXTRA" ) ) {
if ( !bool_string_to_int( &flags.check_for_extra_cylinder, setting_buffer) )
if ( !bool_string_to_int( &flags.check_for_extra_cylinder,
setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

Expand All @@ -481,14 +483,18 @@ void Process_Fdiskini_File( void )
if ( ( number >= 0 ) && ( number <= 127 ) ) {
flags.screen_color = number;
}
else goto parse_error;
else {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the DEL_ND_LOG statement */
if ( 0 == stricmp( command_buffer, "DEL_ND_LOG" ) ) {
if ( !bool_string_to_int( &flags.del_non_dos_log_drives, setting_buffer) )
if ( !bool_string_to_int( &flags.del_non_dos_log_drives,
setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

Expand Down Expand Up @@ -547,7 +553,9 @@ void Process_Fdiskini_File( void )
else if ( number == 256 ) {
flags.flag_sector = part_table[0].total_sect;
}
else goto parse_error;
else {
goto parse_error;
}
command_ok = TRUE;
}

Expand All @@ -558,29 +566,36 @@ void Process_Fdiskini_File( void )

/* Check for the LBA_MARKER statement */
if ( 0 == stricmp( command_buffer, "LBA_MARKER" ) ) {
if ( !bool_string_to_int( &flags.lba_marker, setting_buffer) )
if ( !bool_string_to_int( &flags.lba_marker,
setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the MONO statement */
if ( 0 == stricmp( command_buffer, "MONO" ) ) {
if ( !bool_string_to_int( &flags.monochrome, setting_buffer) )
if ( !bool_string_to_int( &flags.monochrome,
setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the REBOOT statement */
if ( 0 == stricmp( command_buffer, "REBOOT" ) ) {
if ( !bool_string_to_int( &flags.reboot, setting_buffer) )
if ( !bool_string_to_int( &flags.reboot, setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the SET_ANY_ACT statement */
if ( 0 == stricmp( command_buffer, "SET_ANY_ACT" ) ) {
if ( !bool_string_to_int( &flags.set_any_pri_part_active, setting_buffer) )
if ( !bool_string_to_int( &flags.set_any_pri_part_active,
setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

Expand All @@ -607,18 +622,24 @@ void Process_Fdiskini_File( void )
else if ( 0 == stricmp( setting_buffer, "FD" ) ) {
flags.version = COMP_FD;
}
else goto parse_error;
else {
goto parse_error;
}
command_ok = TRUE;
}

/* Check for the XO statement */
if ( 0 == stricmp( command_buffer, "XO" ) ) {
if ( !bool_string_to_int( &flags.extended_options_flag, setting_buffer) )
if ( !bool_string_to_int( &flags.extended_options_flag,
setting_buffer ) ) {
goto parse_error;
}
command_ok = TRUE;
}

if ( command_ok == FALSE ) goto parse_error;
if ( command_ok == FALSE ) {
goto parse_error;
}
}

if ( ( 0 == strncmp( line_buffer, "999", 3 ) ) &&
Expand Down
40 changes: 23 additions & 17 deletions source/fdisk/helpscr.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "pdiskio.h"
#include "userint0.h"

#include "helpscr.h"
#include "ansicon.h"
#include "helpscr.h"
#include "printf.h"

#include "svarlang/svarlang.h"
Expand Down Expand Up @@ -53,24 +53,30 @@ void Display_Help_Screen( void )
con_printf( "%-30s %30s\n", name, version );

/* dump the entire help on screen */
linestopause = screenh - 1; /* number of lines before screen is full */
for (i = 0; i < 250; i++) {
const char *s = svarlang_strid(i);
linestopause = screenh - 1; /* number of lines before screen is full */
for ( i = 0; i < 250; i++ ) {
const char *s = svarlang_strid( i );
#ifdef FDISKLITE
if (i == 1) continue; /* skip msg "no arg = launch interactive mode" */
if ( i == 1 ) {
continue; /* skip msg "no arg = launch interactive mode" */
}
#endif
if (*s == 0) continue;
if (i == 200) { /* special case: COPYLEFT needs to be inserted */
con_printf(s, COPYLEFT);
con_putc('\n');
} else {
con_puts(s);
}
if ( *s == 0 ) {
continue;
}
if ( i == 200 ) { /* special case: COPYLEFT needs to be inserted */
con_printf( s, COPYLEFT );
con_putc( '\n' );
}
else {
con_puts( s );
}

/* is it time for a pause? */
if ((flags.do_not_pause_help_information == FALSE) && (--linestopause <= 2)) {
linestopause = screenh;
Pause();
}
/* is it time for a pause? */
if ( ( flags.do_not_pause_help_information == FALSE ) &&
( --linestopause <= 2 ) ) {
linestopause = screenh;
Pause();
}
}
}
Loading

0 comments on commit ab00c0c

Please sign in to comment.