util  Diff

Differences From Artifact [c8163da01b]:

To Artifact [ef6aaa6ad1]:


     1      1   /* [ʞ] newtab.c
     2      2    *  ~ lexi hale <lexi@hale.su>
     3      3    *  $ cc -Ofast newtab.c -onewtab \
     4         - *      [-D_default_qutebrowser_location=/...]
            4  + *      [-D_default_qutebrowser_location=/...] \
            5  + *      [-D_enable_vblank]
     5      6    *  $ ./newtab [example.net]
     6      7    *  © AGPLv3
     7      8    *  ? may god have mercy on my soul.
     8      9    *    i wrote this because qutebrowser, being a python
     9     10    *    abomination, takes an absurdly fucking long time
    10     11    *    to load, even when there's already an instance
    11     12    *    running and i just want a new goddamn tab. it
................................................................................
    90     91   	} ; {
    91     92   		/* fuck this fuck this fuck this fuck this */
    92     93   		char* end = stpncpy(srv.sun_path, run, sizeof srv.sun_path);
    93     94   		end = stpncpy(end, ssz("/qutebrowser/"));
    94     95   		DIR* qb = opendir(srv.sun_path);
    95     96   		if (!qb) return start_instance;
    96     97   		struct dirent* ent;
    97         -		while (ent = readdir(qb)) {
           98  +		while ((ent = readdir(qb))) {
    98     99   			if (ent == NULL) return start_instance;
    99    100   			if (strncmp(ent -> d_name, "ipc-", 4) == 0) break;
   100    101   		}
   101    102   		if (ent == NULL) return start_instance;
   102    103   		end = stpncpy(end, ent->d_name,
   103    104   				(sizeof srv.sun_path) - (end - srv.sun_path));
   104    105   		closedir(qb);
................................................................................
   134    135   	if (argc > 2) {
   135    136   		printf("\x1b[1musage:\x1b[m %s [uri]\n", argv[0]);
   136    137   	} else {
   137    138   		const char* uri = argc < 2 ? NULL : argv[1];
   138    139   		enum status st = transmit(uri);
   139    140   		if (st == start_instance) {
   140    141   			if (!fork()) {
          142  +#				ifndef _enable_vblank
          143  +					setenv("vblank_mode","0",0);
          144  +#				endif
   141    145   				execl(dupl(_default_qutebrowser_location), uri, NULL);
   142    146   				execl(dupl("/usr/local/bin/qutebrowser"), uri, NULL);
   143    147   				execlp(dupl("qutebrowser"), uri, NULL);
   144    148   				st = fail_find;
   145    149   			} else {
   146    150   				return start_instance;
   147    151   			}
   148    152   		}
   149    153   		if (errors[st] != NULL) printf("\x1b[1;31m(error)\x1b[m %s\n", errors[st]);
   150    154   		return st;
   151    155   	}
   152    156   }