Solar is a command line shared text editor built for the final project in Grinnell College's Operating Systems course. This program allows users to collaborate and make changes to the file in real time. This editor has a more stringent quality control and conflict-prevention mechanism than Google Docs/Microsoft Word, meaning users can only edit/create one line at a time and have exclusive control over that line for the length of their edit. This feature prevents conflicts from arising when multiple users edit a shared file simultaneously. The program is written in C and employs principles such as distributed systems, file systems, and thread synchronization to provide a shared editing system with a file-exporting function.
- C
- LINUX environment
- Terminal/Command line
Create a txt file manually in your folder or use the following command to create one using the terminal:
$ touch <filename>
Complie the program using the following command:
$ make
To start running the server, run the following command with a path to your file that you created in the first step:
$ ./server <filename>
To start editing, connect to the server created using the following commands:
$ ./client <server name> <port> <user name>
Insert your IP address in <servername>
if you are running this program on a machine that is different from the one that created the server. If you are using a Grinnell computer, type the name of the machine to connect instead. If you are running the program on the same computer as the one that created the server, type localhost
instead.
<port>
is a 5-digit number created by the server.
<user name>
is the name that will appear on the log when you make changes to the file. Note the maximum length of <user name>
is 20.
An example running the program:
$ ./client localhost 99999 student
The following are the available controls for users to edit the file:
ENTER
: Modify the current lineI
: Insert a new lineD
: Delete the current lineA
: Create a new line at the endX
: Overwrite the file contents to a new oneesc
: Exit session
Press control + c
to terminate the server.
message.c
,server.c
,socket.h
andclient.c
adapted from https://curtsinger.cs.grinnell.edu/teaching/2022F/CSC213/