Add options to write to a log and be quiet.

This commit is contained in:
2021-03-14 22:55:55 +00:00
parent f4ebb40f33
commit d65be35f01
62 changed files with 1152 additions and 885 deletions

View File

@@ -30,9 +30,10 @@ Copyright (C) 2011-2021 Natalia Portillo
#include <stdlib.h>
#include <string.h>
#include "../os2.h"
#include "../../include/consts.h"
#include "../../include/defs.h"
#include "../../log.h"
#include "../os2.h"
void GetOsInfo()
{
@@ -46,7 +47,7 @@ void GetOsInfo()
if(rc)
{
printf("Error %d querying OS/2 version.\n", rc);
log_write("Error %d querying OS/2 version.\n", rc);
return;
}
@@ -59,10 +60,10 @@ void GetOsInfo()
MinorVer = 0;
}
printf("OS information:\n");
printf("\tRunning under OS/2 %d.%d\n", MajorVer, MinorVer);
log_write("OS information:\n");
log_write("\tRunning under OS/2 %d.%d\n", MajorVer, MinorVer);
rc = DosQSysInfo(0, (PBYTE)pathLen, sizeof(USHORT));
printf("\tMaximum path is %d bytes.\n", pathLen[0]);
log_write("\tMaximum path is %d bytes.\n", pathLen[0]);
}

View File

@@ -32,9 +32,10 @@ Copyright (C) 2011-2021 Natalia Portillo
#include "xattr.h"
#include "../os2.h"
#include "../../include/consts.h"
#include "../../include/defs.h"
#include "../../log.h"
#include "../os2.h"
void ExtendedAttributes(const char* path)
{
@@ -54,7 +55,7 @@ void ExtendedAttributes(const char* path)
if(rc)
{
printf("Cannot change to specified path, not continuing.\n");
log_write("Cannot change to specified path, not continuing.\n");
return;
}
@@ -62,13 +63,13 @@ void ExtendedAttributes(const char* path)
if(rc)
{
printf("Cannot create working directory.\n");
log_write("Cannot create working directory.\n");
return;
}
rc = DosChDir("XATTRS", 0);
printf("Creating files with extended attributes.\n");
log_write("Creating files with extended attributes.\n");
rc = DosOpen("COMMENTS",
&handle,
@@ -91,7 +92,7 @@ void ExtendedAttributes(const char* path)
cRc = DosClose(handle);
}
printf("\tFile with comments = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "COMMENTS", rc, wRc, cRc);
log_write("\tFile with comments = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "COMMENTS", rc, wRc, cRc);
rc = DosOpen("COMMENTS.CRT",
&handle,
@@ -114,7 +115,7 @@ void ExtendedAttributes(const char* path)
cRc = DosClose(handle);
}
printf("\tFile with comments = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "COMMENTS.CRT", rc, wRc, cRc);
log_write("\tFile with comments = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "COMMENTS.CRT", rc, wRc, cRc);
rc = DosOpen("ICON",
&handle,
@@ -137,5 +138,5 @@ void ExtendedAttributes(const char* path)
cRc = DosClose(handle);
}
printf("\tFile with icon = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "ICON", rc, wRc, cRc);
log_write("\tFile with icon = \"%s\", rc = %d, wRc = %d, cRc = %d\n", "ICON", rc, wRc, cRc);
}