diff options
author | Mark W. Eichin <eichin@mit.edu> | 1988-07-19 14:20:34 +0000 |
---|---|---|
committer | Mark W. Eichin <eichin@mit.edu> | 1988-07-19 14:20:34 +0000 |
commit | c900261ee02febf0e44d0fd48d9b5bd1d5736f85 (patch) | |
tree | 978d4098b577b65e02a4335dc9dcfd54147aa14f /clients/zlocate | |
parent | 358d6c46667a24ab1ef42019a4bffd803172335c (diff) |
Punted the print_pad stuff altogether, used "%-*s" to do the same
thing. Also enforced spaces between fields.
Diffstat (limited to 'clients/zlocate')
-rw-r--r-- | clients/zlocate/zlocate.c | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/clients/zlocate/zlocate.c b/clients/zlocate/zlocate.c index 342ed76..f994331 100644 --- a/clients/zlocate/zlocate.c +++ b/clients/zlocate/zlocate.c @@ -77,9 +77,13 @@ main(argc,argv) printf("%s: internal failure while getting location\n",whoami); exit(1); } - print_pad(locations.host,43); - print_pad(locations.tty,8); - printf("%s\n",locations.time); + /* just use printf; make the field widths one + * smaller to deal with the extra seperation space. + */ + printf("%-*s %-*s %s\n", + 42, locations.host, + 7, locations.tty, + locations.time); } if (argc) printf("\n"); @@ -87,20 +91,4 @@ main(argc,argv) } } -print_pad(s,n) - char *s; - int n; -{ - char bfr[81]; - int num; - - (void) strcpy(bfr," "); - - if (strlen(s) < n) - num = n-strlen(s); - else - num = 0; - bfr[num] = '\0'; - printf("%s%s",s,bfr); -} |