aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/utils/cvt/cvt.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xfree86/utils/cvt/cvt.c')
-rw-r--r--xorg-server/hw/xfree86/utils/cvt/cvt.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/xorg-server/hw/xfree86/utils/cvt/cvt.c b/xorg-server/hw/xfree86/utils/cvt/cvt.c
index 0de5ffea4..9483964e0 100644
--- a/xorg-server/hw/xfree86/utils/cvt/cvt.c
+++ b/xorg-server/hw/xfree86/utils/cvt/cvt.c
@@ -30,6 +30,7 @@ void
FatalError(const char *f, ...)
{
va_list args;
+
va_start(args, f);
vfprintf(stderr, f, args);
va_end(args);
@@ -69,22 +70,21 @@ XNFcalloc(unsigned long n)
*/
static Bool
CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
- Bool Verbose)
+ Bool Verbose)
{
- Bool IsCVT = TRUE;
+ Bool IsCVT = TRUE;
if ((!(VDisplay % 3) && ((VDisplay * 4 / 3) == HDisplay)) ||
(!(VDisplay % 9) && ((VDisplay * 16 / 9) == HDisplay)) ||
(!(VDisplay % 10) && ((VDisplay * 16 / 10) == HDisplay)) ||
(!(VDisplay % 4) && ((VDisplay * 5 / 4) == HDisplay)) ||
- (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)))
- ;
+ (!(VDisplay % 9) && ((VDisplay * 15 / 9) == HDisplay)));
else {
if (Verbose)
fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n");
IsCVT = FALSE;
}
-
+
if ((VRefresh != 50.0) && (VRefresh != 60.0) &&
(VRefresh != 75.0) && (VRefresh != 85.0)) {
if (Verbose)
@@ -92,11 +92,10 @@ CVTCheckStandard(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
"(50, 60, 75 or 85Hz).\n");
IsCVT = FALSE;
}
-
+
return IsCVT;
}
-
/*
* I'm not documenting --interlaced for obvious reasons, even though I did
* implement it. I also can't deny having looked at gtf here.
@@ -113,20 +112,21 @@ PrintUsage(char *Name)
"(default: normal blanking).\n");
fprintf(stderr, " X : Desired horizontal resolution "
"(multiple of 8, required).\n");
- fprintf(stderr, " Y : Desired vertical resolution (required).\n");
- fprintf(stderr, " refresh : Desired refresh rate (default: 60.0Hz).\n");
+ fprintf(stderr,
+ " Y : Desired vertical resolution (required).\n");
+ fprintf(stderr,
+ " refresh : Desired refresh rate (default: 60.0Hz).\n");
fprintf(stderr, "\n");
fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines"
- " for use with X.\n");
+ " for use with X.\n");
}
-
/*
*
*/
static void
-PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
+PrintComment(DisplayModeRec * Mode, Bool CVT, Bool Reduced)
{
printf("# %dx%d %.2f Hz ", Mode->HDisplay, Mode->VDisplay, Mode->VRefresh);
@@ -154,16 +154,16 @@ PrintComment(DisplayModeRec *Mode, Bool CVT, Bool Reduced)
printf("-R");
printf(") ");
- } else
+ }
+ else
printf("(CVT) ");
printf("hsync: %.2f kHz; ", Mode->HSync);
- printf("pclk: %.2f MHz", ((float ) Mode->Clock) / 1000.0);
+ printf("pclk: %.2f MHz", ((float) Mode->Clock) / 1000.0);
printf("\n");
}
-
/*
* Originally grabbed from xf86Mode.c.
*
@@ -179,9 +179,9 @@ PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
else
printf("Modeline \"%dx%d_%.2f\" ", HDisplay, VDisplay, VRefresh);
- printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock/1000., Mode->HDisplay,
- Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal, Mode->VDisplay,
- Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
+ printf("%6.2f %i %i %i %i %i %i %i %i", Mode->Clock / 1000.,
+ Mode->HDisplay, Mode->HSyncStart, Mode->HSyncEnd, Mode->HTotal,
+ Mode->VDisplay, Mode->VSyncStart, Mode->VSyncEnd, Mode->VTotal);
if (Mode->Flags & V_INTERLACE)
printf(" interlace");
@@ -197,19 +197,18 @@ PrintModeline(DisplayModePtr Mode, int HDisplay, int VDisplay, float VRefresh,
printf("\n");
}
-
/*
*
*/
int
-main (int argc, char *argv[])
+main(int argc, char *argv[])
{
- DisplayModeRec *Mode;
- int HDisplay = 0, VDisplay = 0;
- float VRefresh = 0.0;
- Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
- Bool Interlaced = FALSE;
- int n;
+ DisplayModeRec *Mode;
+ int HDisplay = 0, VDisplay = 0;
+ float VRefresh = 0.0;
+ Bool Reduced = FALSE, Verbose = FALSE, IsCVT;
+ Bool Interlaced = FALSE;
+ int n;
if ((argc < 3) || (argc > 7)) {
PrintUsage(argv[0]);
@@ -230,27 +229,28 @@ main (int argc, char *argv[])
else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) {
PrintUsage(argv[0]);
return 0;
- } else if (!HDisplay) {
+ }
+ else if (!HDisplay) {
HDisplay = atoi(argv[n]);
- if (!HDisplay) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
+ if (!HDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
else if (!VDisplay) {
VDisplay = atoi(argv[n]);
- if (!VDisplay) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
+ if (!VDisplay) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
else if (!VRefresh) {
VRefresh = atof(argv[n]);
- if (!VRefresh) {
- PrintUsage(argv[0]);
- return 1;
- }
- }
+ if (!VRefresh) {
+ PrintUsage(argv[0]);
+ return 1;
+ }
+ }
else {
PrintUsage(argv[0]);
return 1;
@@ -273,13 +273,13 @@ main (int argc, char *argv[])
}
if (Reduced) {
- if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
- fprintf(stderr,
- "\nERROR: Multiple of 60Hz refresh rate required for "
- " reduced blanking.\n");
- PrintUsage(argv[0]);
- return 0;
- }
+ if ((VRefresh / 60.0) != floor(VRefresh / 60.0)) {
+ fprintf(stderr,
+ "\nERROR: Multiple of 60Hz refresh rate required for "
+ " reduced blanking.\n");
+ PrintUsage(argv[0]);
+ return 0;
+ }
}
IsCVT = CVTCheckStandard(HDisplay, VDisplay, VRefresh, Reduced, Verbose);
@@ -288,6 +288,6 @@ main (int argc, char *argv[])
PrintComment(Mode, IsCVT, Reduced);
PrintModeline(Mode, HDisplay, VDisplay, VRefresh, Reduced);
-
+
return 0;
}