JetCracker

Life-time learner's blog

Tag Archives: 2nd year

[Unix C] ID implementation

Hello.

Last time I posted my implementation of linux command echo. Now I’d like to introduce my implementation of id (which was another task from my IT teacher). This unix-shell command is rather simple and its task is to print real and effective user and group IDs.

Firstly, let’s see how to obtain current user’s ID and group ID. Take a look at the folowing code:

#include <stdio.h>
#include <unistd.h>

int uid, gid;

int main(){
    uid = getuid();
    gid = getgid();
    printf("UID: %d; GID: %d\n", uid, gid);
    return 0;
}

But functionality of ID command in Linux is way more complex! It took me almost 3 hours to implement all it’s features. Read more of this post

[Unix C] ECHO Implementation

When I was at my 2nd year, we studied architecture of operating systems. Our IT seminars were devoted to writing C applications for Linux. The first programme that we had to write was a simple terminal command “echo”. I’ve spend 2 hours to do it! Read more of this post