[comp.os.minix] Recent format program patch

edwards@tisle.uucp (Colten Edwards) (06/14/91)

In the recently posted format program, a couple of small
things are needed to be patched. I run estdio v2.1 so
streams are not automtically flushed. Therefore either
a \n or a fflush(stdout) is needed to print the message
Are you sure.. Also, probably because of a small bug in 
bcc/386, a couple of extra brackets are needed in order
to select the right media count (??). Otherwise a disk 
of size 34k is created in place of a 1.2m disk. Anyways
here follows a small patch ... I hope I diffed the 
programs in the right order. (diff -c oldfile newfile)

				Colten Edwards

------------------------cut here ------------------------
*** format.c	Thu Jun 13 22:24:29 1991
--- format.new.c	Thu Jun 13 22:21:44 1991
***************
*** 218,224 ****
   * usize 1200    .   .    2    .
   * usize 1440    .   .    .    7
   */
! int dtype_map[4][4] = {1, 3, 5, 3, -1, 4, 6, 4, -1, -1, 2, -1, -1, -1, -1, 7};
  
  char *progname, *nname;
  int interrupt = FALSE;		/* If sigint or sigquit occurs	 */
--- 218,227 ----
   * usize 1200    .   .    2    .
   * usize 1440    .   .    .    7
   */
! int dtype_map[4][4] = {  1, 3, 5, 3,   
! 			-1, 4, 6, 4,   
! 			-1, -1, 2, -1,    
! 			-1, -1, -1, 7};
  
  char *progname, *nname;
  int interrupt = FALSE;		/* If sigint or sigquit occurs	 */
***************
*** 452,460 ****
    non_boot[0x0D] = sec_cluster[dtype];	/* sec/cluster */
    non_boot[0x11] = dir_size[dtype];
    non_boot[0x13] =
! 	(unsigned char) (msize * (BLOCK_SIZE / SEC_SIZE)) % 256;
!   non_boot[0x14] =
! 	(unsigned char) (msize * (BLOCK_SIZE / SEC_SIZE)) / 256;
    non_boot[0x15] = media_id[dtype];	/* media id. */
    non_boot[0x16] = sec_fat[dtype];	/* sec/fat */
    non_boot[0x18] = sector_table[dtype];	/* sec/cyl */
--- 455,463 ----
    non_boot[0x0D] = sec_cluster[dtype];	/* sec/cluster */
    non_boot[0x11] = dir_size[dtype];
    non_boot[0x13] =
! 	(unsigned char) ((msize * (BLOCK_SIZE / SEC_SIZE)) % 256);
!   non_boot[0x14] = 
!         (unsigned char) ((msize * (BLOCK_SIZE / SEC_SIZE)) / 256);
    non_boot[0x15] = media_id[dtype];	/* media id. */
    non_boot[0x16] = sec_fat[dtype];	/* sec/fat */
    non_boot[0x18] = sector_table[dtype];	/* sec/cyl */
***************
*** 855,860 ****
--- 858,864 ----
  
    if (interactive || !q_flag) {
  	printf("Are you sure (y/n) ? ");
+ 	fflush(stdout);
  	fgets(answer, 3, stdin);
  	if (answer[0] != 'y') {
  		unlink(nname);
***************
*** 878,883 ****
--- 882,888 ----
  	if (interactive || !q_flag) {
  		printf("\nAnother %s%d Kb on drive %d (y/n) ? ",
  		       dos_type ?

Don Chapman <DCHAPMAN@utkvx.utk.edu> (06/16/91)

In <910613137@tisle.uucp> Colten Edwards writes:

>In the recently posted format program, a couple of small
>things are needed to be patched. I run estdio v2.1 so
>streams are not automtically flushed. Therefore either
>a \n or a fflush(stdout) is needed to print the message
>Are you sure.. Also, probably because of a small bug in 
>bcc/386, a couple of extra brackets are needed in order

  I have compiled format with 16 bit bcc but do not have
the 32 bit version here.  I also don't use estdio v2.1.
Thanks for broadening the test base.
  I believe the suggested patches make it more transportable
among the many compilers and libraries that are in use.
There are a few other places where fflush() might be advisable.
The complete patches are below. (use uud, uncompress, patch)
The patches are relative to the format.c that Andy put on the
net on 6 Jun 91. and should give crc of:
44571  25969 format.c

  Hopefully the new ANSI standard compiler and library will
become available soon.  (Where do I send an order? :-)

Don Chapman <dchapman@utkvx.utk.edu || BF14@UTMarTN.bitnet>

table
 !"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
begin 644 format.cd.Z
M'YV-*@*">%%GCIP7=F+8>#'F39LV8=R0>>&FS)T79M[(@4C'Q1@0(,;(&=,Cz
M1@P<-&: E%$#APT8"8S(20-"21TW(&^ D"%#!XP9.DZ"B)$C1PP%+9*"R+@Qy
M3,>/(4?VH$&CQHT8*VODL)$CP12G-6\.K;$3AD\<.F3D&%KT:,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