[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    bug#1084: [BusyBox] bug#1084: df does not allow -f
From:       Richard June <rjune () imagestream-is ! com>
Date:       2000-12-19 15:52:57
[Download RAW message or body]

Here's a patch that does what you asked for Tim, what does everyone think?
the binary is a bit bigger(32 bytes or so), but it was quick, easy, and 
I didn't have time to play with get_opt. :-)


["df.c.patch" (text/plain)]

65a66,67
> 	int i = 1;
> 
69c71,83
< 	if (argc > 1) {
---
> 	while(i < argc)
> 	{
> 		if(!strncmp("df", argv[i], 2)) {
> 		}
> 		else if(!strncmp("-k", argv[i], 2)) {
> 		}
> 		else if('-' != argv[i][0])
> 			goto exit_loop;
> 		i++;
> 	}
> 
> exit_loop:
> 	if (i < argc) {
73,78c87,89
< 		if (**(argv + 1) == '-') {
< 			usage(df_usage);
< 		}
< 		while (argc > 1) {
< 			if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
< 				errorMsg("%s: can't find mount point.\n", argv[1]);
---
> 		while (i < argc) {
> 			if ((mountEntry = findMountPoint(argv[i], mtab_file)) == 0) {
> 				errorMsg("%s: can't find mount point.\n", argv[i]);
84,85c95
< 			argc--;
< 			argv++;
---
> 			i++;

["df.c.patch" (text/plain)]

65a66,67
> 	int i = 1;
> 
69c71,83
< 	if (argc > 1) {
---
> 	while(i < argc)
> 	{
> 		if(!strncmp("df", argv[i], 2)) {
> 		}
> 		else if(!strncmp("-k", argv[i], 2)) {
> 		}
> 		else if('-' != argv[i][0])
> 			goto exit_loop;
> 		i++;
> 	}
> 
> exit_loop:
> 	if (i < argc) {
73,78c87,89
< 		if (**(argv + 1) == '-') {
< 			usage(df_usage);
< 		}
< 		while (argc > 1) {
< 			if ((mountEntry = findMountPoint(argv[1], mtab_file)) == 0) {
< 				errorMsg("%s: can't find mount point.\n", argv[1]);
---
> 		while (i < argc) {
> 			if ((mountEntry = findMountPoint(argv[i], mtab_file)) == 0) {
> 				errorMsg("%s: can't find mount point.\n", argv[i]);
84,85c95
< 			argc--;
< 			argv++;
---
> 			i++;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic