update ColumnLimit to match STYLE.md

This commit is contained in:
2026-03-07 16:49:21 -06:00
parent 5ca28bf334
commit 54ba2d8067
4 changed files with 19 additions and 30 deletions

View File

@@ -3,6 +3,7 @@
"UseTab": "Always",
"IndentWidth": 8,
"TabWidth": 8,
"ColumnLimit": 120,
"LineEnding": "LF",
"RemoveBracesLLVM": true,
"AlwaysBreakAfterReturnType": "AllDefinitions",

View File

@@ -3,6 +3,7 @@
"UseTab": "Always",
"IndentWidth": 8,
"TabWidth": 8,
"ColumnLimit": 120,
"LineEnding": "LF",
"RemoveBracesLLVM": true,
"AlwaysBreakAfterReturnType": "AllDefinitions",

View File

@@ -4,6 +4,7 @@ BasedOnStyle: LLVM # defaults
UseTab: Always
IndentWidth: 8
TabWidth: 8
ColumnLimit: 120
LineEnding: LF # unix
RemoveBracesLLVM: true # single-statement blocks

View File

@@ -86,10 +86,8 @@ displayFile(string path, int startLineNum = 0, int numLines = 10)
// print each line directly to the screen
int num = 0;
while (getline(file, line) &&
num <= numLines + startLineNum +
1) // while there is file content and the line
// number isn't too high
while (getline(file, line) && num <= numLines + startLineNum + 1) // while there is file content and the
// line number isn't too high
{
if (num >= startLineNum) {
move(lineNum, 0);
@@ -134,9 +132,7 @@ void *
waitForClient(void *argss)
{
waitClientArgs *args = static_cast<waitClientArgs *>(argss);
clientSocketDescriptor =
accept(serverSocketDescriptor, (sockaddr *)&args->newSockAddr,
&args->newSockAddrSize);
clientSocketDescriptor = accept(serverSocketDescriptor, (sockaddr *)&args->newSockAddr, &args->newSockAddrSize);
if (clientSocketDescriptor >= 0) {
writeToFile(logFileName, "client connected");
if (linesInFile(logFileName) > LOG_LENGTH)
@@ -155,8 +151,7 @@ pollForClient()
while (1) {
// receive a message from the client (listen)
memset(&msg, 0, sizeof(msg)); // clear the buffer
bytesRead +=
recv(clientSocketDescriptor, (char *)&msg, sizeof(msg), 0);
bytesRead += recv(clientSocketDescriptor, (char *)&msg, sizeof(msg), 0);
writeToFile(logFileName,
msg); // write the client's message to file
if (linesInFile(logFileName) > LOG_LENGTH)
@@ -189,8 +184,7 @@ setupServer(int port)
exit(0);
}
// bind the socket to its local address
int bindStatus = bind(serverSocketDescriptor,
(struct sockaddr *)&servAddr, sizeof(servAddr));
int bindStatus = bind(serverSocketDescriptor, (struct sockaddr *)&servAddr, sizeof(servAddr));
if (bindStatus < 0) {
// keeps from bricking the terminal if this happens
endwin();
@@ -210,8 +204,7 @@ setupServer(int port)
auto *aaa = new waitClientArgs{}; // it looks stupid but it works
aaa->newSockAddr = newSockAddr;
aaa->newSockAddrSize = newSockAddrSize;
int rc =
pthread_create(&client_wait_thread, nullptr, waitForClient, aaa);
int rc = pthread_create(&client_wait_thread, nullptr, waitForClient, aaa);
pthread_detach(client_wait_thread);
writeToFile(logFileName, "Server started sucessfully");
gettimeofday(&start1, NULL);
@@ -258,8 +251,7 @@ pollForSever(void *args)
char msg[1024];
while (1) {
memset(&msg, 0, sizeof(msg)); // clear the buffer
bytesRead +=
recv(socketDescriptor, (char *)&msg, sizeof(msg), 0);
bytesRead += recv(socketDescriptor, (char *)&msg, sizeof(msg), 0);
// not needed for proofs of concept testing
/*if(!strcmp(msg, "exit"))
@@ -292,13 +284,11 @@ setupClient()
sockaddr_in sendSockAddr;
bzero((char *)&sendSockAddr, sizeof(sendSockAddr));
sendSockAddr.sin_family = AF_INET;
sendSockAddr.sin_addr.s_addr =
inet_addr(inet_ntoa(*(struct in_addr *)*host->h_addr_list));
sendSockAddr.sin_addr.s_addr = inet_addr(inet_ntoa(*(struct in_addr *)*host->h_addr_list));
sendSockAddr.sin_port = htons(PORT_NUM);
clientSocketDescriptor = socket(AF_INET, SOCK_STREAM, 0);
// try to connect...
int status = connect(clientSocketDescriptor, (sockaddr *)&sendSockAddr,
sizeof(sendSockAddr));
int status = connect(clientSocketDescriptor, (sockaddr *)&sendSockAddr, sizeof(sendSockAddr));
if (status < 0)
writeToFile(logFileName, "Error connecting to socket!");
writeToFile(logFileName, "Connected to the server!");
@@ -307,8 +297,7 @@ setupClient()
gettimeofday(&start1, NULL);
auto *aaa = new waitClientArgs{}; // it looks stupid but it works
aaa->auxInt = clientSocketDescriptor;
int rc =
pthread_create(&client_wait_thread, nullptr, pollForSever, aaa);
int rc = pthread_create(&client_wait_thread, nullptr, pollForSever, aaa);
pthread_detach(client_wait_thread);
}
@@ -384,13 +373,10 @@ main(int argc, char *argv[])
printw("> ");
getstr(userInput);
writeToFile(logFileName, userInput);
if (mode == 1) {
send(clientSocketDescriptor, (char *)userInput,
strlen(userInput), 0);
} else {
send(clientSocketDescriptor, (char *)userInput,
strlen(userInput), 0);
}
if (mode == 1)
send(clientSocketDescriptor, (char *)userInput, strlen(userInput), 0);
else
send(clientSocketDescriptor, (char *)userInput, strlen(userInput), 0);
}
endwin();