diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2024-04-28 09:37:47 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2024-04-28 09:37:47 +0000 |
commit | 9a4857fd017e81809f1547841051eb04c0dbd4b9 (patch) | |
tree | 8ff9d01f1bcd917def314cf9a62464f00488949d /app | |
parent | 6d7905a160ed77858fee4996960ed86f9f4e30d6 (diff) |
Update to bitmap 1.1.1
Diffstat (limited to 'app')
-rw-r--r-- | app/bitmap/BitEdit.c | 45 | ||||
-rw-r--r-- | app/bitmap/Bitmap.c | 4 | ||||
-rw-r--r-- | app/bitmap/ChangeLog | 62 | ||||
-rw-r--r-- | app/bitmap/CutPaste.c | 4 | ||||
-rw-r--r-- | app/bitmap/Dialog.c | 4 | ||||
-rw-r--r-- | app/bitmap/Handlers.c | 4 | ||||
-rw-r--r-- | app/bitmap/ReqMach.c | 4 | ||||
-rw-r--r-- | app/bitmap/atobm.c | 26 | ||||
-rw-r--r-- | app/bitmap/bmtoa.c | 25 | ||||
-rw-r--r-- | app/bitmap/compile | 13 | ||||
-rw-r--r-- | app/bitmap/configure.ac | 6 | ||||
-rw-r--r-- | app/bitmap/man/Makefile.am | 2 | ||||
-rw-r--r-- | app/bitmap/man/bitmap.man | 8 | ||||
-rw-r--r-- | app/bitmap/test-driver | 27 |
14 files changed, 196 insertions, 38 deletions
diff --git a/app/bitmap/BitEdit.c b/app/bitmap/BitEdit.c index a9ec29fa8..c098862ad 100644 --- a/app/bitmap/BitEdit.c +++ b/app/bitmap/BitEdit.c @@ -30,8 +30,9 @@ from The Open Group. * Author: Davor Matic, MIT X Consortium */ - - +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include <stdio.h> #include <stdlib.h> @@ -67,6 +68,8 @@ where options include all standard toolkit options plus:\n\ -stipple filename\n\ -hl color\n\ -fr color\n\ + -help\n\ + -version\n\ \n\ The default WIDTHxHEIGHT is 16x16.\n"; @@ -977,13 +980,41 @@ int main(int argc, char *argv[]) Widget w; Widget radio_group = NULL; XtPointer radio_data = NULL; + const char *filename = NULL; + + /* Handle args that don't require opening a display */ + for (int a = 1; a < argc; a++) { + const char *argn = argv[a]; + /* accept single or double dash for -help & -version */ + if (argn[0] == '-' && argn[1] == '-') { + argn++; + } + if (strcmp(argn, "-help") == 0) { + fprintf(stderr, "usage: %s %s", argv[0], usage); + exit(0); + } + if (strcmp(argn, "-version") == 0) { + puts(PACKAGE_STRING); + exit(0); + } + } top_widget = XtInitialize(NULL, "Bitmap", options, XtNumber(options), &argc, argv); - if (argc > 2) { - fputs(usage, stderr); - exit (0); + if (argc > 1) { + if ((argv[argc - 1][0] != '-') && (argv[argc - 1][0] != '+')) { + filename = argv[--argc]; + } + if (argc > 1) { + fputs("Unknown argument(s):", stderr); + for (int a = 1; a < argc; a++) { + fprintf(stderr, " %s", argv[a]); + } + fputs("\n\n", stderr); + fprintf(stderr, "usage: %s %s", argv[0], usage); + exit (1); + } } check_mark = XCreateBitmapFromData(XtDisplay(top_widget), @@ -1075,8 +1106,8 @@ int main(int argc, char *argv[]) bitmap_widget = XtCreateManagedWidget("bitmap", bitmapWidgetClass, pane_widget, NULL, 0); XtRealizeWidget(top_widget); - if (argc > 1) - if (BWReadFile(bitmap_widget, argv[1], NULL)) + if (filename != NULL) + BWReadFile(bitmap_widget, filename, NULL); wm_delete_window = XInternAtom(XtDisplay(top_widget), "WM_DELETE_WINDOW", False); diff --git a/app/bitmap/Bitmap.c b/app/bitmap/Bitmap.c index d074058e1..b7b1589c5 100644 --- a/app/bitmap/Bitmap.c +++ b/app/bitmap/Bitmap.c @@ -30,6 +30,10 @@ from The Open Group. * Author: Davor Matic, MIT X Consortium */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> #include <X11/Xaw/XawInit.h> diff --git a/app/bitmap/ChangeLog b/app/bitmap/ChangeLog index 070ef890b..b6f04b38d 100644 --- a/app/bitmap/ChangeLog +++ b/app/bitmap/ChangeLog @@ -1,3 +1,59 @@ +commit 8330c04c89b5983a4c8a32a78a812343dba8ac05 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Feb 3 09:55:48 2024 -0800 + + bitmap 1.1.1 + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit ab9f888fa8158ba9b930abc58ca1aa5ff57f6556 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sat Feb 25 08:53:46 2023 -0800 + + Remove "All rights reserved" from Oracle copyright notices + + Oracle no longer includes this term in our copyright & license notices. + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit 03579181022489d95b6a1361a1d3568a1d4b47e0 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Feb 5 18:52:45 2023 -0800 + + bitmap: Print which option was in error along with usage message + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit a53f6c680d78e41e17e1b6af05d588f5d0083f2d +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Feb 5 18:38:18 2023 -0800 + + atobm, bmtoa, bitmap: Add -help and -version options + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit da8af2618143577c36ba7fe7656bb6e296616438 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Sun Feb 5 18:01:35 2023 -0800 + + Ensure all *.c files include config.h before any other headers + + Makes sure that any flags set in config.h that affect system headers + are applied equally across all source files. + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + +commit af15f44aabf3fccf096e04d73f4e6e2fd8ca3771 +Author: Alan Coopersmith <alan.coopersmith@oracle.com> +Date: Wed Nov 23 10:29:44 2022 -0800 + + configure: Use AC_SYS_LARGEFILE to enable large file support + + While X bitmap files should never be more than 2gb in size, + they may be stored on filesystems with large inodes. + + Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> + commit b3e36bd9e5c72f4d8045b13ec066826545560361 Author: Alan Coopersmith <alan.coopersmith@oracle.com> Date: Sat Apr 30 13:22:09 2022 -0700 @@ -1071,7 +1127,7 @@ Date: Tue Oct 4 23:15:11 2005 +0000 Add bitmap.icon to EXTRA_DIST commit c3f282e1aa6176896089ea79be84b7250888a65c -Author: Kristian Høgsberg <krh@redhat.com> +Author: Kristian Høgsberg <krh@redhat.com> Date: Thu Sep 29 18:22:01 2005 +0000 Add Bitmap-nocase app default file to APPDEFAULTFILES. @@ -1124,13 +1180,13 @@ Date: Sat Jul 16 21:59:14 2005 +0000 against tempfile race conditions in many places) commit cc48a5df41c59071eab0f58818366e10cb1ff4ac -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Fri Jul 15 16:52:07 2005 +0000 Add dependency on xbitmaps commit c6129c090ad25cd2f8b191f503ac6e8cd452a31d -Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> +Author: Søren Sandmann Pedersen <sandmann@daimi.au.dk> Date: Wed Jul 6 15:47:38 2005 +0000 Build system for bitmap diff --git a/app/bitmap/CutPaste.c b/app/bitmap/CutPaste.c index 49d6f9c59..7bd92c767 100644 --- a/app/bitmap/CutPaste.c +++ b/app/bitmap/CutPaste.c @@ -30,6 +30,10 @@ from The Open Group. * Author: Davor Matic, MIT X Consortium */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> #include <X11/Xatom.h> diff --git a/app/bitmap/Dialog.c b/app/bitmap/Dialog.c index bf00b0569..b00553852 100644 --- a/app/bitmap/Dialog.c +++ b/app/bitmap/Dialog.c @@ -30,6 +30,10 @@ from The Open Group. * Author: Davor Matic, MIT X Consortium */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Shell.h> diff --git a/app/bitmap/Handlers.c b/app/bitmap/Handlers.c index c29c0b39e..02c20490d 100644 --- a/app/bitmap/Handlers.c +++ b/app/bitmap/Handlers.c @@ -30,6 +30,10 @@ from The Open Group. * Author: Davor Matic, MIT X Consortium */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> #include "BitmapP.h" diff --git a/app/bitmap/ReqMach.c b/app/bitmap/ReqMach.c index 1a27f0219..df2905daa 100644 --- a/app/bitmap/ReqMach.c +++ b/app/bitmap/ReqMach.c @@ -30,6 +30,10 @@ from The Open Group. * Author: Davor Matic, MIT X Consortium */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> #include <X11/Xfuncs.h> diff --git a/app/bitmap/atobm.c b/app/bitmap/atobm.c index 7d25906b4..198e04342 100644 --- a/app/bitmap/atobm.c +++ b/app/bitmap/atobm.c @@ -31,6 +31,10 @@ from The Open Group. * Author: Jim Fulton, MIT X Consortium */ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + #include <stdio.h> #include <ctype.h> #include <X11/Xos.h> @@ -43,7 +47,7 @@ static void doit(FILE *fp, const char *filename, const char *chars, int xhot, int yhot, const char *name); static void _X_NORETURN _X_COLD -usage (const char *msg) +usage (const char *msg, int exitval) { if (msg) fprintf(stderr, "%s: %s\n", ProgramName, msg); @@ -51,10 +55,12 @@ usage (const char *msg) ProgramName, "where options include:\n" " -chars cc chars to use for 0 and 1 bits, respectively\n" + " -help print this message\n" " -name variable name to use in bitmap file\n" + " -version print version info\n" " -xhot number x position of hotspot\n" " -yhot number y position of hotspot\n"); - exit (1); + exit(exitval); } static void _X_NORETURN _X_COLD @@ -63,7 +69,7 @@ missing_arg (const char *option) char msg[32]; snprintf(msg, sizeof(msg), "%s requires an argument", option); - usage(msg); + usage(msg, 1); } static char * @@ -119,10 +125,21 @@ main (int argc, char *argv[]) if (++i >= argc) missing_arg("-chars"); chars = argv[i]; continue; + case 'h': + if (strcmp(arg, "-help") == 0) { + usage(NULL, 0); + } + goto unknown; case 'n': if (++i >= argc) missing_arg("-name"); name = argv[i]; continue; + case 'v': + if (strcmp(arg, "-version") == 0) { + puts(PACKAGE_STRING); + exit(0); + } + goto unknown; case 'x': if (++i >= argc) missing_arg("-xhot"); xhot = atoi (argv[i]); @@ -132,9 +149,10 @@ main (int argc, char *argv[]) yhot = atoi (argv[i]); continue; default: + unknown: fprintf(stderr, "%s: unrecognized option '%s'\n", ProgramName, argv[i]); - usage (NULL); + usage(NULL, 1); } } else { filename = arg; diff --git a/app/bitmap/bmtoa.c b/app/bitmap/bmtoa.c index a9de61480..da5d0d2ad 100644 --- a/app/bitmap/bmtoa.c +++ b/app/bitmap/bmtoa.c @@ -54,13 +54,16 @@ static void print_scanline (unsigned int width, unsigned int height, unsigned const char *data, const char *chars); static void _X_NORETURN -usage (void) +usage (int exitval) { fprintf (stderr, "usage: %s [-options ...] [filename]\n\n%s\n", ProgramName, "where options include:\n" - " -chars cc chars to use for 0 and 1 bits, respectively\n"); - exit (1); + " -chars cc chars to use for 0 and 1 bits, respectively\n" + " -help print this usage message\n" + " -version print version information\n" + ); + exit (exitval); } static char * @@ -133,14 +136,26 @@ main (int argc, char *argv[]) if (++i >= argc) { fprintf(stderr, "%s: -chars requires an argument\n", ProgramName); - usage (); + usage(1); } chars = argv[i]; continue; + case 'h': + if (strcmp(arg, "-help") == 0) { + usage(0); + } + goto unknown; + case 'v': + if (strcmp(arg, "-version") == 0) { + puts(PACKAGE_STRING); + exit(0); + } + goto unknown; default: + unknown: fprintf(stderr, "%s: unrecognized option '%s'\n", ProgramName, argv[i]); - usage (); + usage(1); } } else { filename = arg; diff --git a/app/bitmap/compile b/app/bitmap/compile index 718dc6d0b..2c2299d13 100644 --- a/app/bitmap/compile +++ b/app/bitmap/compile @@ -17,7 +17,7 @@ scriptversion=2012-10-14.11; # UTC # 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/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -53,7 +53,7 @@ func_file_conv () MINGW*) file_conv=mingw ;; - CYGWIN*) + CYGWIN* | MSYS*) file_conv=cygwin ;; *) @@ -67,7 +67,7 @@ func_file_conv () mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; - cygwin/*) + cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) @@ -255,7 +255,8 @@ EOF echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff --git a/app/bitmap/configure.ac b/app/bitmap/configure.ac index 9f84e2294..a9157859b 100644 --- a/app/bitmap/configure.ac +++ b/app/bitmap/configure.ac @@ -23,7 +23,7 @@ dnl Process this file with autoconf to create configure. # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([bitmap], [1.1.0], +AC_INIT([bitmap], [1.1.1], [https://gitlab.freedesktop.org/xorg/app/bitmap/issues], [bitmap]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h]) @@ -39,6 +39,10 @@ XORG_DEFAULT_OPTIONS AM_PROG_CC_C_O +# Checks for typedefs, structures, and compiler characteristics. +AC_SYS_LARGEFILE + +# Checks for library functions. AC_CHECK_FUNCS([mkstemp]) # Math libraries & functions diff --git a/app/bitmap/man/Makefile.am b/app/bitmap/man/Makefile.am index 5bfcf117b..dd2599f71 100644 --- a/app/bitmap/man/Makefile.am +++ b/app/bitmap/man/Makefile.am @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, Oracle and/or its affiliates. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), diff --git a/app/bitmap/man/bitmap.man b/app/bitmap/man/bitmap.man index 924b8b3e5..992d551d6 100644 --- a/app/bitmap/man/bitmap.man +++ b/app/bitmap/man/bitmap.man @@ -152,6 +152,14 @@ are allowed. By default, no hotspot information is included. .B \-yhot \fInumber\fP This option specifies the Y coordinate of the hotspot. Only positive values are allowed. By default, no hotspot information is included. +.PP +All three commands also accept these options: +.TP 4 +.B \-help +Prints a usage message and exits. +.TP 4 +.B \-version +Prints version info and exits. .SH USAGE \fIBitmap\fP displays grid in which each square represents a single bit in the picture being edited. Actual size of the bitmap image, as diff --git a/app/bitmap/test-driver b/app/bitmap/test-driver index 8e575b017..be73b80ad 100644 --- a/app/bitmap/test-driver +++ b/app/bitmap/test-driver @@ -1,9 +1,9 @@ #! /bin/sh # test-driver - basic testsuite driver script. -scriptversion=2013-07-13.22; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# Copyright (C) 2011-2021 Free Software Foundation, Inc. # # 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 @@ -16,7 +16,7 @@ scriptversion=2013-07-13.22; # UTC # 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/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -42,11 +42,13 @@ print_usage () { cat <<END Usage: - test-driver --test-name=NAME --log-file=PATH --trs-file=PATH - [--expect-failure={yes|no}] [--color-tests={yes|no}] - [--enable-hard-errors={yes|no}] [--] + test-driver --test-name NAME --log-file PATH --trs-file PATH + [--expect-failure {yes|no}] [--color-tests {yes|no}] + [--enable-hard-errors {yes|no}] [--] TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS] + The '--test-name', '--log-file' and '--trs-file' options are mandatory. +See the GNU Automake documentation for information. END } @@ -103,8 +105,11 @@ trap "st=130; $do_exit" 2 trap "st=141; $do_exit" 13 trap "st=143; $do_exit" 15 -# Test script is run here. -"$@" >$log_file 2>&1 +# Test script is run here. We create the file first, then append to it, +# to ameliorate tests themselves also writing to the log file. Our tests +# don't, but others can (automake bug#35762). +: >"$log_file" +"$@" >>"$log_file" 2>&1 estatus=$? if test $enable_hard_errors = no && test $estatus -eq 99; then @@ -126,7 +131,7 @@ esac # know whether the test passed or failed simply by looking at the '.log' # file, without the need of also peaking into the corresponding '.trs' # file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file +echo "$res $test_name (exit status: $estatus)" >>"$log_file" # Report outcome to console. echo "${col}${res}${std}: $test_name" @@ -140,9 +145,9 @@ echo ":copy-in-global-log: $gcopy" >> $trs_file # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: |