Skip to content

Commit

Permalink
Rename sub-project dirs to their correct name.
Browse files Browse the repository at this point in the history
  • Loading branch information
uwehermann committed Dec 30, 2011
0 parents commit 43e5747
Show file tree
Hide file tree
Showing 11 changed files with 2,384 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sigrok-cli
674 changes: 674 additions & 0 deletions COPYING

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2010 Bert Vermeulen <[email protected]>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##

SUBDIRS = doc

bin_PROGRAMS = sigrok-cli

sigrok_cli_SOURCES = sigrok-cli.c sigrok-cli.h parsers.c anykey.c

85 changes: 85 additions & 0 deletions anykey.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* This file is part of the sigrok project.
*
* Copyright (C) 2011 Bert Vermeulen <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <termios.h>
#endif
#include <unistd.h>
#include <string.h>
#include <glib.h>
#include <sigrok.h>
#include "sigrok-cli.h"

#ifdef _WIN32
HANDLE stdin_handle;
DWORD stdin_mode;
#else
struct termios term_orig;
#endif

static int received_anykey(int fd, int revents, void *user_data)
{
/* Avoid compiler warnings. */
(void)fd;
(void)revents;
(void)user_data;

sr_session_stop();

return TRUE;
}

/* Turn off buffering on stdin. */
void add_anykey(void)
{
#ifdef _WIN32
stdin_handle = GetStdHandle(STD_INPUT_HANDLE);

if (!GetConsoleMode(stdin_handle, &stdin_mode)) {
/* TODO: Error handling. */
}

SetConsoleMode(stdin_handle, 0);
#else
struct termios term;

tcgetattr(STDIN_FILENO, &term);
memcpy(&term_orig, &term, sizeof(struct termios));
term.c_lflag &= ~(ECHO | ICANON | ISIG);
tcsetattr(STDIN_FILENO, TCSADRAIN, &term);
#endif

sr_session_source_add(STDIN_FILENO, G_IO_IN, -1, received_anykey, NULL);

printf("Press any key to stop acquisition.\n");
}

/* Restore stdin attributes. */
void clear_anykey(void)
{
#ifdef _WIN32
SetConsoleMode(stdin_handle, stdin_mode);
#else
tcflush(STDIN_FILENO, TCIFLUSH);
tcsetattr(STDIN_FILENO, TCSANOW, &term_orig);
#endif
}
50 changes: 50 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/sh
##
## This file is part of the sigrok project.
##
## Copyright (C) 2010 Bert Vermeulen <[email protected]>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##

OS=`uname`

LIBTOOLIZE=libtoolize
ACLOCAL_DIR=

if [ "x$OS" = "xDarwin" ]; then
LIBTOOLIZE=glibtoolize

if [ -d /sw/share/aclocal ]; then
# fink installs aclocal macros here
ACLOCAL_DIR="-I /sw/share/aclocal"
elif [ -d /opt/local/share/aclocal ]; then
# Macports installs aclocal macros here
ACLOCAL_DIR="-I /opt/local/share/aclocal"
elif [ -d /usr/share/aclocal ]; then
# Xcode installs aclocal macros here
ACLOCAL_DIR="-I /usr/share/aclocal"
fi

elif [ "x$OS" = "xMINGW32_NT-5.1" ]; then
ACLOCAL_DIR="-I /usr/local/share/aclocal"
fi

echo "Generating build system..."
${LIBTOOLIZE} --install --copy --quiet || exit 1
aclocal ${ACLOCAL_DIR} || exit 1
autoheader || exit 1
automake --add-missing --copy --foreign || exit 1
autoconf || exit 1

88 changes: 88 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2010 Bert Vermeulen <[email protected]>
##
## This program is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
##

AC_PREREQ(2.61)

AC_INIT([sigrok-cli], [0.1], [[email protected]],
[sigrok-cli], [http://www.sigrok.org])

AC_CONFIG_SRCDIR([sigrok-cli.c])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([-Wall -Werror foreign std-options])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])

AH_TOP([#ifndef SGIROK_CLI_CONFIG_H
#define SIGROK_CLI_CONFIG_H /* To stop multiple inclusions. */])
AH_BOTTOM([#endif /* SIGROK_CLI_CONFIG_H */])

CFLAGS="-g -Wall -Wextra"

# Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S

# Initialize libtool.
LT_INIT

# Initialize pkg-config.
# We require at least 0.22, as "Requires.private" behaviour changed there.
PKG_PROG_PKG_CONFIG([0.22])

# Checks for libraries.

PKG_CHECK_MODULES([libsigrok], [libsigrok],
[CFLAGS="$CFLAGS $libsigrok_CFLAGS";
LIBS="$LIBS $libsigrok_LIBS"])

PKG_CHECK_MODULES([libsigrokdecode], [libsigrokdecode],
[CFLAGS="$CFLAGS $libsigrokdecode_CFLAGS";
LIBS="$LIBS $libsigrokdecode_LIBS"])

# Checks for header files.
# These are already checked: inttypes.h stdint.h stdlib.h string.h unistd.h.
AC_CHECK_HEADERS([sys/time.h termios.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_SIZE_T

# Checks for library functions.
AC_CHECK_FUNCS([strcasecmp strchr strerror strstr strtol])

AC_SUBST(MAKEFLAGS, '--no-print-directory')
AC_SUBST(AM_LIBTOOLFLAGS, '--silent')

AC_CONFIG_FILES([Makefile
doc/Makefile])

AC_OUTPUT

22 changes: 22 additions & 0 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
##
## This file is part of the sigrok project.
##
## Copyright (C) 2010 Uwe Hermann <[email protected]>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##

dist_man_MANS = sigrok-cli.1

Loading

0 comments on commit 43e5747

Please sign in to comment.