Skip to content
/ samples Public

Samples of using various techniques, language/stdlib features, libraries etc

License

Notifications You must be signed in to change notification settings

edomin/samples

Repository files navigation

This repository contain samples of using various things that I want to test before using in my projects. The samples are quick, dirty and probably buggy. So they are not recommended to use in any project as is without corrections, refactoring etc.

Samples:

  • awk - I learning awk. I found some exercises in the network and trying to complete it. Directory structure:
    • awk/numbers - simple exercises for processing 2d array of integer numbers.
    • awk/people - sample of parsing people data file
    • awk/exercism - exercises from exercism.io adapted from bash to awk
  • compound_literals - Test support of compound literals for initialization of struct members which are pointers.

         Usage:

         Compile with gcc and -std=c99 option:

        $ make c99

         Compile with gcc and -std=c89 option:

        $ make c89

         Compile with gcc and -std=c89 and -ansi options:

        $ make ansi

         Compile with gcc and -std=c99 and -Wpedantic options:

        $ make pedantic99

         Compile with gcc and -std=c89 and -Wpedantic options (must fail):

        $ make pedantic89

         Compile with tcc:

        $ make tcc
  • inih - attempt to inplement library-like API for working with ini files using inih library. Sample consist: Ini structure with sections containing key-value data, addition and deletion sections and keys, access to sections and keys by index, counting sections in ini and keys in sections, possibility to use custom i/o functions for save/load ini data (for example if you use PhysFS library).
  • ketopt - parsing commandline options with ketopt library.
  • libsir - logging with libsir library.
  • posix_signal_handling - attempt to implement signal handling with backtraces using addr2line utility. Based on tutorial by Job Vranish (Some code copypasted. Original code from that tutorial released to public domain). Also implemented correct (relatively) output of line numbers of function loaded from shared object via dlopen.
  • sockets/time_client - incomplete sample of getting time using various protocols. Currently implemented TIME and DAYTIME protocols. TODO NTP.
  • tasm - writing small programs with TASM while learning assembly for DOS. Not recommended for use as third-party code/snippet/library because writen by Assembly-noob. Directory structure:
    • tasm/scripts - some common scripts for building and running examples with DosBox
    • tasm/dos_input_hex - Example of input HEX byte in DL.
  • unix/shell - envoking unix utils by typing its name in stdin. It is not complete shell because it can not do piping and can not process shell syntax.
  • xlib - learning xlib. Currently incomplete sample.
  • xmempool - learning how to use xmempool library. Task - allocate memory for structure, then free memory and then check that structure freed.

Source code of samples released to public domain (license CC0).

About

Samples of using various techniques, language/stdlib features, libraries etc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published