1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-26 03:51:32 +00:00

Reformat all C source files with Clang-format in Google style w/ 100 col width.

This commit is contained in:
Nick Briggs
2017-05-28 18:08:18 -07:00
parent 691645d048
commit 156c3292f8
167 changed files with 40520 additions and 48069 deletions

315
src/ldeboot.c Executable file → Normal file
View File

@@ -1,11 +1,7 @@
/* $Id: ldeboot.c,v 1.3 1999/01/03 02:07:13 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved */
/* $Id: ldeboot.c,v 1.3 1999/01/03 02:07:13 sybalsky Exp $ (C) Copyright Venue, All Rights Reserved
*/
static char *id = "$Id: ldeboot.c,v 1.3 1999/01/03 02:07:13 sybalsky Exp $ Copyright (C) Venue";
/************************************************************************/
/* */
/* (C) Copyright 1989-98 Venue. All Rights Reserved. */
@@ -20,9 +16,7 @@ static char *id = "$Id: ldeboot.c,v 1.3 1999/01/03 02:07:13 sybalsky Exp $ Copyr
#include "version.h"
#if defined(sun) && !defined(OS5)
#if defined(sun) && !defined(OS5)
#define USESUNSCREEN
#else
#undef USESUNSCREEN
@@ -57,7 +51,6 @@ static char *id = "$Id: ldeboot.c,v 1.3 1999/01/03 02:07:13 sybalsky Exp $ Copyr
extern char *getenv();
#endif /* XWINDOW */
#define LDEMONO "ldesingle"
#define LDECOLOR "ldemulti"
#define LDETRUECOLOR "ldetruecolor"
@@ -66,8 +59,6 @@ extern char *getenv();
char filetorun[30];
/************************************************************************/
/* */
/* m a i n */
@@ -76,215 +67,169 @@ char filetorun[30];
/* */
/************************************************************************/
main(argc, argv)
int argc; char **argv;
{
char Earg[30], Ename[30], **newargv;
int i;
main(argc, argv) int argc;
char **argv;
{
char Earg[30], Ename[30], **newargv;
int i;
#ifdef USESUNSCREEN
struct fbtype my_screen;
struct fbtype my_screen;
#endif /* USESUNSCREEN */
int FrameBufferFd;
int FrameBufferFd;
#ifdef USESUNSCREEN
struct fbinfo FB_info;
struct fbgattr FBattr;
struct fbinfo FB_info;
struct fbgattr FBattr;
#endif /* USESUNSCREEN */
/* Kickstart program for the Lisp Development Environment (LDE).
Display Device emulator
CG3, CG6 lde.multi
BW2, CG2, CG4, CG9 lde.single
/* Kickstart program for the Lisp Development Environment (LDE).
Display Device emulator
CG3, CG6 lde.multi
BW2, CG2, CG4, CG9 lde.single
FB-TYPE REAL-TYPE
BW2 2 x
CG2 3 3
CG3 8 6
CG4 2 8
CG6 8 12
CG8 6 7
CG9(GP1) 4 4 ;gpconfig -f -b
CG9(GP1) 2 13 ;gpconfig gpone0 -f -b cgtwo0
;We assume This config for GXP model
*/
FB-TYPE REAL-TYPE
BW2 2 x
CG2 3 3
CG3 8 6
CG4 2 8
CG6 8 12
CG8 6 7
CG9(GP1) 4 4 ;gpconfig -f -b
CG9(GP1) 2 13 ;gpconfig gpone0 -f -b cgtwo0
;We assume This config for GXP model
*/
#ifdef XWINDOW
/* If X-Server exists on the host specified in -display option
or environment variable DISPLAY, ldex is started. Othewise
ldesingle or ldemulti.
*/
{
char *Display_Name = (char *)NULL ;
Display *Xdisplay = (Display *)NULL;
int i , option;
char *pos;
for( i=1; i<argc; i++ )
{
/* If X-Server exists on the host specified in -display option
or environment variable DISPLAY, ldex is started. Othewise
ldesingle or ldemulti.
*/
{
char *Display_Name = (char *)NULL;
Display *Xdisplay = (Display *)NULL;
int i, option;
char *pos;
for (i = 1; i < argc; i++) {
#ifdef XV11R1
pos = strchr( argv[i], ':' );
if(pos != NULL)
{
Display_Name = argv[i];
continue;
}
pos = strchr(argv[i], ':');
if (pos != NULL) {
Display_Name = argv[i];
continue;
}
#endif /* XV11R1 */
#ifndef XV11R1
if( (strcmp(argv[i], "-d") == 0 )
|| (strcmp(argv[i], "-display") == 0 ) )
{
if (i == argc) break;
pos = (char *)strchr( argv[++i], ':' );
if(pos != NULL)
{
Display_Name = argv[i];
}
continue;
}
if ((strcmp(argv[i], "-d") == 0) || (strcmp(argv[i], "-display") == 0)) {
if (i == argc) break;
pos = (char *)strchr(argv[++i], ':');
if (pos != NULL) { Display_Name = argv[i]; }
continue;
}
#endif /* XV11R1 */
} /*end for() */
} /*end for() */
if( (Xdisplay = XOpenDisplay( Display_Name )) != (Display *)NULL )
{
/* success to connect X-server */
XCloseDisplay( Xdisplay );
strcpy(filetorun, LDEX);
if ((Xdisplay = XOpenDisplay(Display_Name)) != (Display *)NULL) {
/* success to connect X-server */
XCloseDisplay(Xdisplay);
strcpy(filetorun, LDEX);
#ifdef FORKCOMM
/* JRB - call fork_Unix here, while we're REALLY small, unless -NF is
specified, of course... */
for(i=0; i<argc; i++)
if(!strcmp(argv[i], "-NF")) break;
if(i == argc) /* -NF not in arguments */
fork_Unix();
/* JRB - call fork_Unix here, while we're REALLY small, unless -NF is
specified, of course... */
for (i = 0; i < argc; i++)
if (!strcmp(argv[i], "-NF")) break;
if (i == argc) /* -NF not in arguments */
fork_Unix();
#endif /* FORKCOMM */
argv[0] = filetorun;
execvp(filetorun, argv);
perror(filetorun);
exit(1);
}
else
{ /* failed to connect X-server */
argv[0] = filetorun;
execvp(filetorun, argv);
perror(filetorun);
exit(1);
} else { /* failed to connect X-server */
#define NAME_LEN 100
char host_name[NAME_LEN];
gethostname( host_name, NAME_LEN );
if( Display_Name == NULL )
{
if( (Display_Name = getenv("DISPLAY")) != NULL )
{
if( strncmp( Display_Name
, host_name
, strlen( host_name )) == 0)
{
fprintf( stderr, "ldeboot: can't find X-Server\n" );
exit( -1 );
} /* end if */
}
/* end if */
}
else
{
fprintf( stderr, "ldeboot: can't find X-Server\n" );
exit( -1 );
} /* end if */
} /* end if */
}
char host_name[NAME_LEN];
gethostname(host_name, NAME_LEN);
if (Display_Name == NULL) {
if ((Display_Name = getenv("DISPLAY")) != NULL) {
if (strncmp(Display_Name, host_name, strlen(host_name)) == 0) {
fprintf(stderr, "ldeboot: can't find X-Server\n");
exit(-1);
} /* end if */
}
/* end if */
} else {
fprintf(stderr, "ldeboot: can't find X-Server\n");
exit(-1);
} /* end if */
} /* end if */
}
#endif /* XWINDOW */
#ifdef USESUNSCREEN
if( (FrameBufferFd = open( "/dev/fb", O_RDWR )) < 0)
{
fprintf( stderr, "ldeboot: can't open FrameBuffer\n");
exit( -1 );
}
if (ioctl(FrameBufferFd, FBIOGTYPE, &my_screen) <0)
{
perror("initdisplay0:");
exit( -1 );
}
if ((FrameBufferFd = open("/dev/fb", O_RDWR)) < 0) {
fprintf(stderr, "ldeboot: can't open FrameBuffer\n");
exit(-1);
}
if (ioctl(FrameBufferFd, FBIOGTYPE, &my_screen) < 0) {
perror("initdisplay0:");
exit(-1);
}
if( my_screen.fb_type == FBTYPE_SUN4COLOR )
{ /* cg3 or cg6 */
if(ioctl(FrameBufferFd,FBIOGATTR,&FBattr) >= 0)
{
if( FBattr.real_type == FBTYPE_SUN3COLOR || /* cg3 */
FBattr.real_type == FBTYPE_SUNFAST_COLOR ) /* cg6 */
{
strcpy(filetorun, LDECOLOR);
}
}
else
{ /* if( ioctl... */
perror("lde: This Display Model does not supported\n");
exit( -1 );
}
if (my_screen.fb_type == FBTYPE_SUN4COLOR) { /* cg3 or cg6 */
if (ioctl(FrameBufferFd, FBIOGATTR, &FBattr) >= 0) {
if (FBattr.real_type == FBTYPE_SUN3COLOR || /* cg3 */
FBattr.real_type == FBTYPE_SUNFAST_COLOR) /* cg6 */
{
strcpy(filetorun, LDECOLOR);
}
else if( my_screen.fb_type == FBTYPE_SUN2BW )
{ /* bw2, cg4 or cg9 */
strcpy(filetorun, LDEMONO);
} else { /* if( ioctl... */
perror("lde: This Display Model does not supported\n");
exit(-1);
}
} else if (my_screen.fb_type == FBTYPE_SUN2BW) { /* bw2, cg4 or cg9 */
strcpy(filetorun, LDEMONO);
} else if (my_screen.fb_type == FBTYPE_SUN3COLOR) {
if (ioctl(FrameBufferFd, FBIOGATTR, &FBattr) >= 0) {
if (FBattr.real_type == FBTYPE_MEMCOLOR) /* cg8 */
{
strcpy(filetorun, LDETRUECOLOR);
}
else if( my_screen.fb_type == FBTYPE_SUN3COLOR )
{
if(ioctl(FrameBufferFd,FBIOGATTR,&FBattr) >= 0)
{
if( FBattr.real_type == FBTYPE_MEMCOLOR ) /* cg8 */
{
strcpy(filetorun, LDETRUECOLOR);
}
}
else
{ /* if( ioctl... */
perror("lde: This Display Model does not supported\n");
exit( -1 );
}
}
else if( my_screen.fb_type == FBTYPE_SUN2COLOR )
{ /* cg2 */
strcpy(filetorun, LDEMONO);
}
else
{
perror("lde: This Display Model does not supported\n");
exit (-1);
}; /* endif( my_screen... */
} else { /* if( ioctl... */
perror("lde: This Display Model does not supported\n");
exit(-1);
}
close(FrameBufferFd);
} else if (my_screen.fb_type == FBTYPE_SUN2COLOR) { /* cg2 */
strcpy(filetorun, LDEMONO);
} else {
perror("lde: This Display Model does not supported\n");
exit(-1);
}; /* endif( my_screen... */
close(FrameBufferFd);
#endif /* USESUNSCREEN */
#ifdef FORKCOMM
/* JRB - call fork_Unix here, while we're REALLY small, unless -NF is
specified, of course... */
for(i=0; i<argc; i++)
if(!strcmp(argv[i], "-NF")) break;
if(i == argc) /* -NF not in arguments */
fork_Unix();
/* JRB - call fork_Unix here, while we're REALLY small, unless -NF is
specified, of course... */
for (i = 0; i < argc; i++)
if (!strcmp(argv[i], "-NF")) break;
if (i == argc) /* -NF not in arguments */
fork_Unix();
#endif
/* start ldemono or ldecolor */
argv[0] = filetorun; /* or whatever... */
/* start ldemono or ldecolor */
/* then execve the LDE executable */
execvp(filetorun, argv);
perror(filetorun);
argv[0] = filetorun; /* or whatever... */
/* then execve the LDE executable */
execvp(filetorun, argv);
perror(filetorun);
exit(1);
}
exit(1);
}