Cover V05, I08
Article
Listing 1
Listing 2

aug96.tar


Listing 2: Setting headers on X11 windows

/* Copyright 1993 Bjorn Sadeva  */

#include <stdio.h>
#include <string.h>
#ifdef bsdi
#include <unistd.h>
#endif

extern  int gethostname();
extern void perror();
extern void exit();
extern char * strcpy();
#ifndef bsdi
extern  int printf();
#endif

#define XSTRING1 "\033]0;"
#define XSTRING2 "\007"


int
main(argc, argv)
int argc;
char **argv;
{
char HostName[1024];
register char *p;
int  i = 1;

if ( gethostname(HostName, sizeof(HostName)) != 0 ) {
perror( "GetHostName Fail" );
exit(1);
}

p = HostName;
while (*p != '.' && *p != '\0') p++;
*p = '\0';

printf( "%s%s", XSTRING1, HostName );
if ( argc > 1 ) {
printf( ":" );
while ( i < argc ) printf( " %s", argv[i++] );
}
printf( "%s", XSTRING2 );

return(0);
}

# End of File