RFE: Would like "hostname -s"

Review Request #191 — Created May 12, 2016 and submitted

lotheac
illumos-gate
general

https://www.illumos.org/issues/3758



  • 0
  • 0
  • 2
  • 1
  • 3
Description From Last Updated
gdamore
  1. 
      
  2. usr/src/cmd/hostname/hostname.c (Diff revision 1)
     
     

    Don't forget to update the usage message to describe -s.

  3. usr/src/man/man1/hostname.1 (Diff revision 1)
     
     

    No need for this te thing with madoc.

  4. 
      
jeffpc
  1. 
      
  2. usr/src/cmd/hostname/hostname.c (Diff revision 1)
     
     

    What happens if c_hostname does not contain any periods? Won't strcspn return 0 and therefore we end up printing an empty string? Should this print the whole string if there is no "domain" info?

    1. No, if there are no periods this will print the entire string. Using strcspn like this is a somewhat common idiom (it returns the length of the string, ie. the index of the null terminator, if it doesn't encounter any characters from s2)

    2. Sorry, I mixed up strcspn and strspn.

  3. 
      
lotheac
jeffpc
  1. Ship It!
  2. 
      
andy_js
  1. Does it make sense to ignore '-s' when setting the hostname?
    1. The other alternative is to give an error. I don't really have a strong opinion, but OpenBSD's hostname(1) works like this as well - '-s' becomes a no-op if you give an argument.

    2. We should probably do it the same way even though that seems wrong to me.

  2. 
      
lotheac
andy_js
  1. Ship It!
  2. 
      
lotheac
Review request changed

Status: Closed (submitted)

Loading...