Make hexdump ACK-compilable and add it to the base system
This commit is contained in:
		
							parent
							
								
									9e4e26e0c8
								
							
						
					
					
						commit
						18ad0b52d3
					
				| @ -12,7 +12,7 @@ SUBDIR=	aal add_route adduser advent arp ash at autil awk \ | |||||||
| 	dhrystone diff dirname dis88 diskctl du dumpcore \
 | 	dhrystone diff dirname dis88 diskctl du dumpcore \
 | ||||||
| 	ed eject elle elvis env expand factor file \
 | 	ed eject elle elvis env expand factor file \
 | ||||||
| 	find finger fingerd fix fold format fortune fsck.mfs \
 | 	find finger fingerd fix fold format fortune fsck.mfs \
 | ||||||
| 	fsck1 ftp101 ftpd200 gcov-pull getty grep gomoku head host \
 | 	fsck1 ftp101 ftpd200 gcov-pull getty grep gomoku head hexdump host \
 | ||||||
| 	hostaddr id ifconfig ifdef indent install \
 | 	hostaddr id ifconfig ifdef indent install \
 | ||||||
| 	intr ipcrm ipcs irdpd isoread join kill last leave \
 | 	intr ipcrm ipcs irdpd isoread join kill last leave \
 | ||||||
| 	less lex life loadkeys loadramdisk logger login look lp \
 | 	less lex life loadkeys loadramdisk logger login look lp \
 | ||||||
| @ -41,9 +41,4 @@ SUBDIR+=	atnormalize dosread fdisk loadfont \ | |||||||
| SUBDIR+=	acd asmconv gas2ack | SUBDIR+=	acd asmconv gas2ack | ||||||
| .endif | .endif | ||||||
| 
 | 
 | ||||||
| # Build only with clang and GCC
 |  | ||||||
| .if ${COMPILER_TYPE} == "gnu" |  | ||||||
| SUBDIR+= hexdump |  | ||||||
| .endif |  | ||||||
| 
 |  | ||||||
| .include <bsd.subdir.mk> | .include <bsd.subdir.mk> | ||||||
|  | |||||||
| @ -128,10 +128,14 @@ print(PR *pr, u_char *bp) | |||||||
| 	    float f4; | 	    float f4; | ||||||
| 	  int16_t s2; | 	  int16_t s2; | ||||||
| 	  int32_t s4; | 	  int32_t s4; | ||||||
|  | #ifdef __LONG_LONG_SUPPORTED | ||||||
| 	  int64_t s8; | 	  int64_t s8; | ||||||
|  | #endif | ||||||
| 	 uint16_t u2; | 	 uint16_t u2; | ||||||
| 	 uint32_t u4; | 	 uint32_t u4; | ||||||
|  | #ifdef __LONG_LONG_SUPPORTED | ||||||
| 	 uint64_t u8; | 	 uint64_t u8; | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| 	switch(pr->flags) { | 	switch(pr->flags) { | ||||||
| 	case F_ADDRESS: | 	case F_ADDRESS: | ||||||
| @ -171,10 +175,12 @@ print(PR *pr, u_char *bp) | |||||||
| 			memmove(&s4, bp, sizeof(s4)); | 			memmove(&s4, bp, sizeof(s4)); | ||||||
| 			(void)printf(pr->fmt, (int64_t)s4); | 			(void)printf(pr->fmt, (int64_t)s4); | ||||||
| 			break; | 			break; | ||||||
|  | #ifdef __LONG_LONG_SUPPORTED | ||||||
| 		case 8: | 		case 8: | ||||||
| 			memmove(&s8, bp, sizeof(s8)); | 			memmove(&s8, bp, sizeof(s8)); | ||||||
| 			(void)printf(pr->fmt, (int64_t)s8); | 			(void)printf(pr->fmt, (int64_t)s8); | ||||||
| 			break; | 			break; | ||||||
|  | #endif | ||||||
| 		} | 		} | ||||||
| 		break; | 		break; | ||||||
| 	case F_P: | 	case F_P: | ||||||
| @ -202,10 +208,12 @@ print(PR *pr, u_char *bp) | |||||||
| 			memmove(&u4, bp, sizeof(u4)); | 			memmove(&u4, bp, sizeof(u4)); | ||||||
| 			(void)printf(pr->fmt, (uint64_t)u4); | 			(void)printf(pr->fmt, (uint64_t)u4); | ||||||
| 			break; | 			break; | ||||||
|  | #ifdef __LONG_LONG_SUPPORTED | ||||||
| 		case 8: | 		case 8: | ||||||
| 			memmove(&u8, bp, sizeof(u8)); | 			memmove(&u8, bp, sizeof(u8)); | ||||||
| 			(void)printf(pr->fmt, (uint64_t)u8); | 			(void)printf(pr->fmt, (uint64_t)u8); | ||||||
| 			break; | 			break; | ||||||
|  | #endif | ||||||
| 		} | 		} | ||||||
| 		break; | 		break; | ||||||
| 	} | 	} | ||||||
|  | |||||||
| @ -310,6 +310,10 @@ option. | |||||||
| .Pp | .Pp | ||||||
| .Nm | .Nm | ||||||
| exits 0 on success and \*[Gt]0 if an error occurred. | exits 0 on success and \*[Gt]0 if an error occurred. | ||||||
|  | .Sh MINIX-SPECIFIC notes | ||||||
|  | If hexdump is compiled on a compiler that does not support long long (that is, | ||||||
|  | ACK), 64-bit (8 byte) integer formats are not supported. Conversions where this | ||||||
|  | is the default are changed to use a 32-bit 4 byte) default instead. | ||||||
| .Sh EXAMPLES | .Sh EXAMPLES | ||||||
| Display the input in perusal format: | Display the input in perusal format: | ||||||
| .Bd -literal -offset indent | .Bd -literal -offset indent | ||||||
|  | |||||||
| @ -68,6 +68,17 @@ typedef struct _fs {			/* format strings */ | |||||||
| 	int bcnt; | 	int bcnt; | ||||||
| } FS; | } FS; | ||||||
| 
 | 
 | ||||||
|  | #ifdef __minix | ||||||
|  | #define inline | ||||||
|  | 
 | ||||||
|  | #ifndef __LONG_LONG_SUPPORTED | ||||||
|  | #include <minix/u64.h> | ||||||
|  | typedef long int64_t; | ||||||
|  | typedef unsigned long uint64_t; | ||||||
|  | #define PRId64 "ld" | ||||||
|  | #endif | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
| enum _vflag { ALL, DUP, FIRST, WAIT };	/* -v values */ | enum _vflag { ALL, DUP, FIRST, WAIT };	/* -v values */ | ||||||
| 
 | 
 | ||||||
| extern int blocksize;			/* data block size */ | extern int blocksize;			/* data block size */ | ||||||
|  | |||||||
| @ -194,7 +194,11 @@ size(FS *fs) | |||||||
| 				bcnt += 4; | 				bcnt += 4; | ||||||
| 				break; | 				break; | ||||||
| 			case 'e': case 'E': case 'f': case 'g': case 'G': | 			case 'e': case 'E': case 'f': case 'g': case 'G': | ||||||
|  | #ifdef __LONG_LONG_SUPPORTED | ||||||
| 				bcnt += 8; | 				bcnt += 8; | ||||||
|  | #else | ||||||
|  | 				bcnt += 4; | ||||||
|  | #endif | ||||||
| 				break; | 				break; | ||||||
| 			case 's': | 			case 's': | ||||||
| 				bcnt += prec; | 				bcnt += prec; | ||||||
| @ -320,9 +324,11 @@ isint: | |||||||
| 				case 2: | 				case 2: | ||||||
| 					pr->bcnt = 2; | 					pr->bcnt = 2; | ||||||
| 					break; | 					break; | ||||||
|  | #ifdef __LONG_LONG_SUPPORTED | ||||||
| 				case 8: | 				case 8: | ||||||
| 					pr->bcnt = 8; | 					pr->bcnt = 8; | ||||||
| 					break; | 					break; | ||||||
|  | #endif | ||||||
| 				default: | 				default: | ||||||
| 					p1[1] = '\0'; | 					p1[1] = '\0'; | ||||||
| 					badcnt(p1); | 					badcnt(p1); | ||||||
| @ -331,9 +337,13 @@ isint: | |||||||
| 			case 'e': case 'E': case 'f': case 'g': case 'G': | 			case 'e': case 'E': case 'f': case 'g': case 'G': | ||||||
| 				pr->flags = F_DBL; | 				pr->flags = F_DBL; | ||||||
| 				switch(fu->bcnt) { | 				switch(fu->bcnt) { | ||||||
|  | #ifdef __LONG_LONG_SUPPORTED | ||||||
| 				case 0: case 8: | 				case 0: case 8: | ||||||
| 					pr->bcnt = 8; | 					pr->bcnt = 8; | ||||||
| 					break; | 					break; | ||||||
|  | #else | ||||||
|  | 				case 0: | ||||||
|  | #endif | ||||||
| 				case 4: | 				case 4: | ||||||
| 					pr->bcnt = 4; | 					pr->bcnt = 4; | ||||||
| 					break; | 					break; | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Erik van der Kouwe
						Erik van der Kouwe