Information and documentation on building an embedded board test lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
502 B

  1. #!/bin/sh
  2. fname=$(mktemp foobar.XXXXX)
  3. cat > "$fname"
  4. awk '
  5. maxline == 1 {
  6. if (maxlength < length)
  7. maxlength = length
  8. }
  9. function printtop () {
  10. blank = sprintf("%*s", maxlength + 4, "")
  11. gsub(" ", "*", blank)
  12. printf("%s\n", blank)
  13. }
  14. output == 1 && FNR == 1 {
  15. printtop()
  16. printf("* %*s *\n", maxlength, "")
  17. }
  18. output == 1 {
  19. printf("* %s%*s *\n", $0, maxlength - length, "")
  20. }
  21. END {
  22. printf("* %*s *\n", maxlength, "")
  23. printtop()
  24. }
  25. ' maxline=1 "$fname" maxline=0 output=1 "$fname"
  26. rm "$fname"