CMSC 242 -- Lab 2

Lab 2

Getting Started

Log onto a computer science server making sure to change the port number.

Follow these instructions to get your files ready to start lab.
  • Use wget to download the file at
  • Uncompress the flib.tgz file by using tar -xvzf flib.tgz

The Problem

  1. use stat and string.h to gain information about files
  2. write a README
  3. list information about files
  4. use the getopt function


You have been given a file named flib.h containing function signatures. You should implement these functions in a file named flib.c.

  • Implement the functions from flib.h.
  • Implement a program to display information about the current directory
  • Your program should use the getopt function to parse command line arguments.
  • An example run of the program.
  3.6K  Mar 13 12:33            main.o
 15.6K  Mar 13 12:33    [exe]   feeble
 30.9M  Mar 13 12:33    [dir]   .
699.0B  Mar 13 12:33            main.c
 14.8K  Mar 13 12:29            flib.o
  1.4K  Mar 13 12:28            flib.h
  4.2K  Mar 13 12:26            flib.c
 15.4M  Mar 12 13:25    [dir]   test_dir
305.0B  Mar 12 13:25            Makefile
  9.8K  Mar 12 13:25    [dir]   test2_dir
 15.4M  Mar 12 13:25            242_is_best.txt
 31.1M  Mar 09 10:13    [dir]   ..

12 entries


If you have changed file names or directory names you will need to change to the directory which contains the directory you wish to hand in. We will use the handin cmsc242 assignment directory command. In this case you will type: handin cmsc242 lab2 your_directory_name

You lab is due at 11:59pm Mar. 23rd 2020.