Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Aug 1998 21:42:52 -0500
From:      Dave Glowacki <dglo@SSEC.WISC.EDU>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   bin/7583: indent(1) input file isn't really optional
Message-ID:  <199808120242.VAA21912@tick.ssec.wisc.edu>

next in thread | raw e-mail | index | archive | help

>Number:         7583
>Category:       bin
>Synopsis:       indent input file argument isn't really optional
>Confidential:   yes
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 11 19:50:01 PDT 1998
>Last-Modified:
>Originator:     Dave Glowacki
>Organization:
>Release:        FreeBSD 2.2.6-STABLE i386
>Environment:

	

>Description:

	The synopsis for indent(1) starts out:

		indent [input-file [output-file]] [-bad | -nbad] [-bap | -nbap]

	but when indent is run as 'indent < infile > outfile', it spits
	out

		usage: indent file [ outfile ] [ options ]

>How-To-Repeat:

	Run indent

>Fix:

	The CVS log didn't indicate any reason *not* to support input
	via standard input and I made the following patch without any
	apparent ill effects (though I didn't really test it exhaustively)

Index: indent.c
===================================================================
RCS file: /disk0/freebsd/src/usr.bin/indent/indent.c,v
retrieving revision 1.1.1.1.8.1
diff -c -r1.1.1.1.8.1 indent.c
*** indent.c	1997/07/16 06:41:29	1.1.1.1.8.1
--- indent.c	1998/08/11 23:16:50
***************
*** 209,218 ****
  	    set_option(argv[i]);
      }				/* end of for */
      if (input == 0) {
! 		usage();
      }
      if (output == 0)
! 	if (troff)
  	    output = stdout;
  	else {
  	    out_name = in_name;
--- 209,218 ----
  	    set_option(argv[i]);
      }				/* end of for */
      if (input == 0) {
! 	input = stdin;
      }
      if (output == 0)
! 	if (troff || input == stdin)
  	    output = stdout;
  	else {
  	    out_name = in_name;
***************
*** 1133,1139 ****
  static void
  usage()
  {
! 	fprintf(stderr, "usage: indent file [ outfile ] [ options ]\n");
  	exit(1);
  }
  
--- 1133,1139 ----
  static void
  usage()
  {
! 	fprintf(stderr, "usage: indent [ file [ outfile ] ] [ options ]\n");
  	exit(1);
  }
  
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808120242.VAA21912>