| Revision: | 2.6 |
| Committed: | Tue Oct 21 02:02:31 2003 UTC (22 years ago) by schorsch |
| Content type: | text/plain |
| Branch: | MAIN |
| Changes since 2.5: | +6 -2 lines |
| Log Message: | winsocket.h include for gethostname() on Windows. |
| # | User | Rev | Content |
|---|---|---|---|
| 1 | greg | 2.1 | #ifndef lint |
| 2 | schorsch | 2.6 | static const char RCSid[] = "$Id: myhostname.c,v 2.5 2003/07/17 09:21:29 schorsch Exp $"; |
| 3 | greg | 2.1 | #endif |
| 4 | /* | ||
| 5 | * Query system for host name | ||
| 6 | greg | 2.2 | */ |
| 7 | |||
| 8 | greg | 2.3 | #include "copyright.h" |
| 9 | greg | 2.1 | |
| 10 | schorsch | 2.6 | #ifdef _WIN32 |
| 11 | #include <winsock.h> | ||
| 12 | #else | ||
| 13 | #include <unistd.h> | ||
| 14 | #endif | ||
| 15 | schorsch | 2.5 | |
| 16 | #include "rtmisc.h" | ||
| 17 | greg | 2.1 | |
| 18 | char * | ||
| 19 | myhostname() | ||
| 20 | { | ||
| 21 | static char hostname[65]; | ||
| 22 | |||
| 23 | if (!hostname[0]) | ||
| 24 | gethostname(hostname, sizeof(hostname)); | ||
| 25 | return(hostname); | ||
| 26 | } | ||
| 27 |