README: mention also pkg-config as a build dependency
[xicursorset.git] / xicursorset.c
index 54c985c..37faf80 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include<stdio.h>
-#include<stdlib.h>
-#include<X11/Xcursor/Xcursor.h>
-#include<X11/extensions/XInput2.h>
-#include<assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <libgen.h>
+#include <X11/Xcursor/Xcursor.h>
+#include <X11/extensions/XInput2.h>
+#include <assert.h>
 
 int main(int argc, char *argv[])
 {
@@ -38,7 +39,8 @@ int main(int argc, char *argv[])
        Cursor cursor;
 
        if (argc < 3 || argc > 4) {
-               printf("usage: xicursor <ptrid> <shape> [<theme>]\n");
+               printf("usage: %s <ptrid> <shape> [<theme>]\n",
+                               basename(argv[0]));
                return 1;
        }
 
@@ -69,17 +71,17 @@ int main(int argc, char *argv[])
                return EXIT_FAILURE;
        }
 
-
-       if (argc == 4)
+       if (argc == 4) {
                theme = argv[3];
-       else
+       } else {
                theme = XcursorGetTheme(dpy);
                if (theme == NULL) {
                        fprintf(stderr, "Can't get cursor theme.\n");
                        return EXIT_FAILURE;
                }
+       }
 
-       image = XcursorShapeLoadImage(shape, theme, size);
+       image = XcursorShapeLoadImage((unsigned int)shape, theme, size);
        if (image == NULL) {
                fprintf(stderr, "Can't get cursor image, check <shape> or <theme>.\n");
                return EXIT_FAILURE;