Skip to content

Commit

Permalink
MAJOR: Add minimal functionning usleep (+Makefile + PKGBUILD)
Browse files Browse the repository at this point in the history
Also add basic PKGBUILD, .SRCINFO and LICENSE for AUR publishing

Also add a .gitignore to ignore vim tmp files and generated files

By default, install it in /usr/bin/usleep
  • Loading branch information
Corentin Peuvrel committed Dec 15, 2015
0 parents commit e221f43
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .SRCINFO
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by mksrcinfo v8
# Tue Dec 15 18:43:37 UTC 2015
pkgbase = usleep
pkgdesc = A simple C wrapper of glibc's function
pkgver = 1.0
pkgrel = 1
url = http://linux.die.net/man/3/usleep
arch = x86_64
license = MIT
depends = glibc
source = usleep.c
source = Makefile
source = LICENSE
md5sums = 6da0cbdc5a41ad656fd843703936e636
md5sums = 2dcf21a9a6c4ef67e4e3edcbed189289
md5sums = 51766e6e3cd7960da32876585fe6aecd

pkgname = usleep

5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
usleep
*.swp
src/
pkg/
usleep-*.pkg.tar.xz
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright (c) 2015 Corentin Peuvrel <corentin at peuvrel dot net>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject
to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: clean, mrproper
CC = gcc
CFLAGS = -Wall -Wextra -O2
PREFIX = /usr/bin

usleep: usleep.c
$(CC) $(CFLAGS) -o $@ $+

install:
install -D -m755 usleep $(PREFIX)/usleep

clean:
rm -f usleep
24 changes: 24 additions & 0 deletions PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Maintainer: Corentin Peuvrel <corentin.peuvrel at gmail dot com>
pkgname=usleep
pkgver=1.0
pkgrel=1
pkgdesc="A simple C wrapper of glibc's function"
arch=(x86_64)
url=http://linux.die.net/man/3/usleep
license=('MIT')
depends=('glibc')
source=("usleep.c" "Makefile" "LICENSE")
md5sums=('6da0cbdc5a41ad656fd843703936e636'
'2dcf21a9a6c4ef67e4e3edcbed189289'
'51766e6e3cd7960da32876585fe6aecd')

build() {
make
}

package() {
make PREFIX="$pkgdir/usr/bin" install
install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

# vim:set ts=2 sw=2 et:
12 changes: 12 additions & 0 deletions usleep.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <stdlib.h>
#include <unistd.h>

int main(int argc, const char *argv[])
{
if (argc < 2)
return 0;

unsigned int usecs = atoi(argv[1]);
usleep(usecs);
return 0;
}

0 comments on commit e221f43

Please sign in to comment.