Questions tagged [unix]
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs.
136 questions
11
votes
4
answers
1k
views
A simple server-client application in C
I am reading "The Linux Programming Interface" by Michael Kerrisk. I'm studying about sockets, and I made a simple application using sockets on the unix domain.
I want to know if I'm using ...
5
votes
3
answers
1k
views
bbcp (bare-bones file copy) in C
I have done very little systems programming, but I'm working through CS631 - Advanced Programming in the UNIX Environment on my own time (I am not actually a student in the class). This is my solution ...
7
votes
3
answers
315
views
Copy a file portably across UNIX and UNIX-like systems with POSIX API (modeled after Boost's copy_file())
Overview:
Following the POSIX API, there are 2 versions of the function: unix_copy_file(), and unix_fcopy_file(). One works with ...
8
votes
2
answers
786
views
Wrappers around write() and read() and a function to copy file permissions
Below follows wrappers around read() and write() that retry when interrupted by a signal (the case where the return value is -1 ...
3
votes
1
answer
116
views
Determining the value of PATH_MAX on UNIX-like systems
Below is the approach taken in the function allocpath() in the book "Advanced Programming in Unix Environment", which I have modified to simply determine ...
3
votes
2
answers
810
views
Get Terminal Size, Enable and Disable Terminal Raw Mode without NCURSES
I searched around and found these 7 ways to determine the width and height of the terminal:
...
3
votes
3
answers
383
views
Append Buffer for Buffering Small write(2) Calls
The purpose of this is written in the comment below (it is meant to be used in a text editor):
abuf.h:
...
5
votes
2
answers
140
views
Find the Size of a File in a Portable Manner (revision)
This is a follow up to Find the Size of a File in a Portable Manner.
What's new:
The fast version (POSIX stat()) does not change the position indicator of the ...
5
votes
2
answers
1k
views
An Implementation of UNIX wc shell utility
The implementation doesn't support the "-m" flag, and only works with ASCII, and has rather terrible output formatting in comparison with GNU's implementation of wc.
Code:
...
4
votes
1
answer
254
views
Find the Size of a File in a Portable Manner
There's no function in the Standard C Library to determine the size of a file. The POSIX Standard has stat()/fstat() which are ...
9
votes
3
answers
2k
views
Executing a shell command OS-independently
The goal of the code is to convert a Graphviz DOT file to an SVG file, and it achieves this by creating a child process and executing the "dot" command.
...
2
votes
1
answer
203
views
minitalk project using Rust | Communication between process using UNIX Signals
I am trying to build minitalk project from 42 school using Rust instead of C. This is a communication program between a client and a server. Both are process. To achieve this I am only allowed to use ...
2
votes
2
answers
215
views
Wait for child while polling file descriptor with self-pipe controlled by different threads
I am working on a personal project, and one of the things it does is to call a blocking operation on a file descriptor while a forked+exec'ed child process is running. It needs to know when the ...
3
votes
3
answers
184
views
Follow up: A chat server using the select() API
This is a follow up to my last question:
Multiperson chat server using the select() API
Changes:
After much fine critique, I made the following changes to the code:
Removed redundant casts and ...
11
votes
2
answers
1k
views
Multiperson chat server using the select() API
I followed the Beej's Guide to Network Programming. The program acts like a multi-user chat server. One connects and sends a message to the server, which is forwarded to all that are connected. There'...