[7612] in Athena Bugs
Proposed bug fix for #1083
daemon@ATHENA.MIT.EDU (dskern@ATHENA.MIT.EDU)
Fri May 31 16:07:54 1991
From: dskern@ATHENA.MIT.EDU
Date: Fri, 31 May 91 15:52:02 -0400
To: bugs@ATHENA.MIT.EDU
Cc: dskern@ATHENA.MIT.EDU, jik@ATHENA.MIT.EDU
This bug fix eliminates the problems reported in #1083 - "Lsdel's
output is in columns, even when its stdout is not a tty" - by adding
2 new flags to lsdel, -1 and -C, and checking the stdout. If stdout is
not a tty, lsdel sets the -1 flag and outputs in a single column, unless
forced into multi-column output by -C. When stdout is a tty, the default
is still multi-column output.
*** /source/athena/bin.athena/delete/lsdel.c Mon Nov 19 00:13:55 1990
--- lsdel.c Fri May 31 15:03:19 1991
***************
*** 46,52 ****
extern int errno;
int block_total = 0;
! int dirsonly, recursive, yield, f_links, f_mounts;
time_t timev;
main(argc, argv)
--- 46,52 ----
extern int errno;
int block_total = 0;
! int dirsonly, recursive, yield, f_links, f_mounts, single, force;
time_t timev;
main(argc, argv)
***************
*** 59,66 ****
whoami = lastpart(argv[0]);
! dirsonly = recursive = timev = yield = f_links = f_mounts = 0;
! while ((arg = getopt(argc, argv, "drt:ysm")) != -1) {
switch (arg) {
case 'd':
dirsonly++;
--- 59,66 ----
whoami = lastpart(argv[0]);
! dirsonly = recursive = timev = yield = f_links = f_mounts = single = force = 0;
! while ((arg = getopt(argc, argv, "1Cdrt:ysm")) != -1) {
switch (arg) {
case 'd':
dirsonly++;
***************
*** 80,90 ****
--- 80,98 ----
case 'm':
f_mounts++;
break;
+ case '1':
+ single++;
+ break;
+ case 'C':
+ force++;
+ break;
default:
usage();
exit(1);
}
}
+ if ((!isatty(1)) && (!force))
+ single = 1;
if (optind == argc) {
char *cwd;
***************
*** 106,112 ****
usage()
{
! fprintf(stderr, "Usage: %s [ options ] [ filename [ ...]]\n", whoami);
fprintf(stderr, "Options are:\n");
fprintf(stderr, " -d list directory names, not contents\n");
fprintf(stderr, " -r recursive\n");
--- 114,120 ----
usage()
{
! fprintf(stderr, "Usage %s [ options ] [ filename [ ...]]\n", whoami);
fprintf(stderr, "Options are:\n");
fprintf(stderr, " -d list directory names, not contents\n");
fprintf(stderr, " -r recursive\n");
***************
*** 114,119 ****
--- 122,129 ----
fprintf(stderr, " -y report total space taken up by files\n");
fprintf(stderr, " -s follow symbolic links to directories\n");
fprintf(stderr, " -m follow mount points\n");
+ fprintf(stderr, " -1 force one entry per line output format\n");
+ fprintf(stderr, " -C force multi-column output\n");
}
***************
*** 292,298 ****
return retval;
}
! if (retval = column_array(strings, num, DEF_SCR_WIDTH, 0, 0, 2, 1, 0,
1, stdout)) {
error("column_array");
return retval;
--- 302,308 ----
return retval;
}
! if (retval = column_array(strings, num, DEF_SCR_WIDTH, 0, single, 2, 1, 0,
1, stdout)) {
error("column_array");
return retval;