Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 22 Oct 2018, 16:26
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
locking own thread
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 3 [36 Posts]   Goto page: Previous 1, 2, 3 Next
Author Message
nosystemdthanks

Joined: 03 May 2018
Posts: 333

PostPosted: Thu 07 Jun 2018, 14:22    Post subject:  

fredx181 wrote:
In my opinion, if someone says "No more correspondence here please. This thread is closed." it would be polite if that's respected.


i agree, thats why i didnt reply after that. and thats the thread i thought we were talking about.



Quote:
That way the OP can change his mind and could as he wish open it again at a later point of time.
When it's locked, then that is not possible. Big difference.


i get it, it would be far more practical for the thread to be unlocked. there are threads i too wish i would say "you know what? just b***** off" and people would comply, though ive never been to a forum polite enough to honour that request.

locking gives them no choice, and i actually suspected (whether naively or realistically) that the person who locked it was trying to help someone at least.

which makes it unnecessary to try to throw (implied) legal threats at them. i mean yes-- in practical terms, better to just leave it.

but then you wouldnt sue the fire department for water damage when they werent just putting the flames out, they were also preventing them from spreading to the neighbors.

considering that the topic is locked already, the most likely course of action that will give wiak what he wants is to copy his information to a site he has more control over (lets pretend for a moment im the best friend in the world, and actually trying to solve this despite all odds) and then request that the thread or his posts be deleted.

instead we are trying the accuse the moderators route. if that works, i will apologise for butting in.

its 7 pages-- a lot to moderate per-post.

im trying to think of a way to do what he wants that doesnt rely on staying on good terms with the moderator, though they all involve copying the data somewhere else first and then finding a way to delete the posts.

sure, i get that it was more ideal when the thread wasnt locked, but now it is. that changes a few things, like what to do.
Back to top
View user's profile Send private message Visit poster's website 
fredx181


Joined: 11 Dec 2013
Posts: 3485
Location: holland

PostPosted: Thu 07 Jun 2018, 14:54    Post subject:  

nosystemdthanks wrote:
locking gives them no choice, and i actually suspected (whether naively or realistically) that the person who locked it was trying to help someone at least.


Could be, anyway: Mr. Moderator, whoever you are, please at least say something !?

_________________
Dog Linux website
Back to top
View user's profile Send private message 
cousinFrancis

Joined: 06 Jun 2018
Posts: 10

PostPosted: Thu 07 Jun 2018, 16:33    Post subject:  

Hi wiak.

Look at it this way:
-- with a locked thread, your content is safe and your comments are safe;
-- if you absolutely want to edit or add a comment in that locked thread, you could create another thread about that, and say whatever you like with a reference to the post in the closed thread.

If you want to continue developing your script (it included some use of the dash shell, I believe), perhaps you can become a member on these specialiezd forums and work on it there:
https://www.unix.com/shell-programming-and-scripting/
http://bashscripts.org/forum/
Those forums have strict policies about outside interferences, IIRC.

Also did I not read in that closed thread that nosystemdthanks has offered you a place to work on and publish your script on his forum? I don't think there is a clique there (maybe go have a look to confirm?).

Just a few thoughts.

As the proverb says: "The bird on the branch does not fear the branch breaking because he can just open his wings."
Similarly, the support you thought you had was cut? Just "open" your talent, like wings, and let it fly.
Hopefully these thoughts can lift your mood?

Best regards.
Back to top
View user's profile Send private message 
Flash
Official Dog Handler


Joined: 04 May 2005
Posts: 13049
Location: Arizona USA

PostPosted: Thu 07 Jun 2018, 17:52    Post subject:  

*Sigh* I lock a thread that the originator labeled "abandoned," so that people don't keep posting to it pointlessly, and before the next time I see the forum the originator of that thread starts a new thread to complain about the old one being locked -- and the new thread is several pages long. Confused

Wiak, first of all, you don't really believe that anything you post to an all-Internet forum remains your exclusive intellectual property do you? Good luck trying to enforce your ownership "rights."

I didn't read very carefully every post in the thread before I locked it, but from my cursory examination Wiak seemed to imply that other approaches worked better than his and that's why he's abandoning his. I could have simply removed the thread rather than locking it, but failures have value so I left it for others to perhaps learn from.
Back to top
View user's profile Send private message 
ITSMERSH


Joined: 02 May 2018
Posts: 361

PostPosted: Thu 07 Jun 2018, 21:33    Post subject:  

Quote:
I lock a thread that the originator labeled "abandoned," so that people don't keep posting to it pointlessly

If I only had knew this, I would have made last posts in some of my topics saying they were "abandoned" instead of being "discontinued". Shocked

_________________
RSH
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 957
Location: not Bulgaria

PostPosted: Thu 07 Jun 2018, 21:58    Post subject:  

Let me just explain my dilemma once.

Quote:
DOWNLOAD LINKS: Absolutely non-official but apparently stable/working, prealpha, downloads intended only for anyone interested in testing (usual disclaimers apply concerning suitability of purpose). Note that though I have removed prealpha in the name this is only provided to allow interested parties to test functionality. It is not to be considered a general release at this stage in any way:


Whilst and if the project remains abandoned, this testing period is over and their is no general release. In that circumstance, I feel duty bound to clean up that thread. I had no intention, personally, of removing any of its technical written content whatsoever - people can read about how gtkwialog would work till the end of time if they wanted to. But... now that murga-forum has taken absolute control of that thread they are leaving the above mentioned prealpha, not for general release, testing binaries available longterm, against my directions in above quoted paragraph from the first post of the thread.

Over time that could be perceived as 'distribution' by murga-forum who cannot fulfill what would be the GPL license requirement resulting from official release, which I have never made. Outside of that defined not for "general release" period, the binaries ought, in my opinion, be removed.

The thread should not have been locked, and Flash's comment is insufficient - my threat regarding intellectual property rights can be safely ignored, however; I was just upset that I was placed in a position where I had no control over my own work, particularly when the abandonment was possibly to be temporary (though the apparently 'sacred' nature of gtkdialog ground may make the continuation of public gtkwialog development culturally difficult).

EDIT: The locking action is, aside from the utterly small scale of this one project, like Microsoft taking control of GitHub; an organisation using power to take control over an author's previous freedom and creation rights on that site/thread. Bad, bad, bad.

Flash wrote:
Wiak seemed to imply that other approaches worked better than his and that's why he's abandoning his. I could have simply removed the thread rather than locking it, but failures have value.

Don't be ridiculous. (gtkwialog is the best approach thus far by a mile and it's going to get even better too)


The solution, whatever I chose to later do, is simply to unlock the thread. End of comment.

wiak

Last edited by wiak on Thu 07 Jun 2018, 23:10; edited 1 time in total
Back to top
View user's profile Send private message 
phat7

Joined: 05 Jun 2015
Posts: 116

PostPosted: Thu 07 Jun 2018, 23:00    Post subject:  

Calm down. As Flash rightly wrote "failures have value". Your work is still valuable for other forum members and may encourage them to pick up where you left. I learned a lot. Unless your pre-alpha binaries are unsafe or malicious they should remain and the thread should be kept under lock.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 957
Location: not Bulgaria

PostPosted: Thu 07 Jun 2018, 23:19    Post subject:  

phat7 wrote:
Calm down. As Flash rightly wrote "failures have value". Your work is still valuable for other forum members and may encourage them to pick up where you left. I learned a lot. Unless your pre-alpha binaries are unsafe or malicious they should remain and the thread should be kept under lock.


What cupboard did you crawl out of sigh? Smile Someone else I've never heard of; what a nest of opinionated individuals this is. Mein Godt. EDIT: Oh yes, you asked for some gtkwialog usage help a while back and I helped you out with that...

Like I have already stated above:

Quote:
Don't be ridiculous. (gtkwialog is the best approach thus far by a mile and it's going to get even better too)


Anyway, 'thanks' for your concern; I am purrfectly calm thanks. In fact I am laughing.

But fact is, my gtkwialog dev project thread should be unlocked for the good of those interested in the project.

wiak
Back to top
View user's profile Send private message 
s243a

Joined: 02 Sep 2014
Posts: 1227

PostPosted: Thu 07 Jun 2018, 23:31    Post subject:  

wiak wrote:
But fact is, my gtkwialog dev project thread should be unlocked for the good of those interested in the project.

wiak


You could document it somewhere, and then once done create a thread referring people to the documentation. Such time spent documenting might give you time to reflect.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 957
Location: not Bulgaria

PostPosted: Thu 07 Jun 2018, 23:35    Post subject:  

s243a wrote:
wiak wrote:
But fact is, my gtkwialog dev project thread should be unlocked for the good of those interested in the project.

wiak


You could document it somewhere, and then once done create a thread referring people to the documentation. Such time spent documenting might give you time to reflect.


shouldn't be necessary
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 957
Location: not Bulgaria

PostPosted: Thu 07 Jun 2018, 23:42    Post subject:  

From gtkwialog dev thread:

Quote:
Hello wiak

I haven't used gtkwialog, but i read it adds improvements to gtkdialog

I think the changes can be safely added to gtkdialog. I was thinking of env variables.

For example, a script can be marked as GTKWIALOG by adding
Code:
Code:
#!/bin/sh
.
.
export GTKWIALOG=1
In gtkdialog itself, the code to determine if the new approach is to be used would be as simple as this:

Code:
Code:
#include <stdlib.h>

if (getenv("GTKWIALOG")) {
 GTKWIALOG=1;
}
This is just an idea i had..


@aaaaa: The following code is from an old (2007) C program of mine (wiak.c) that was published on this forum and elsewhere (at Freshmeat site back then, which is nowadays called Freecode), from which my alias wiak is taken:

Code:
    // if WIAKTMP environment variable is set use its value as the default path
    // for the storing the wfifo etc., or use the pre-defined default WIAKFIFOPATH.
    // WIAK also has a commandline argument --wiaktmp <arg> for altering this behaviour.
    getenv_ptr = getenv("WIAKTMP");
    if (getenv_ptr)
     ...


In other words, I am aware of the technique.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 957
Location: not Bulgaria

PostPosted: Fri 08 Jun 2018, 00:01    Post subject: wiak.c for people who love C pointers  

And since this is a programming thread, so as not to be at all off-topic, here it is (wiak.c) for code reading in full for anyone interested in some C-based IPC techniques - some of which may prove useful in my personal gtkwialog development. Maybe not optimum code selection, but worked well for what it was intended:

For those of us who love C pointers (to pointers to pointers...)

Code:
/* **************************************************************************
 Program: wiak (an IPC, non-interactive, shell)  Version: 2.3.0         
 Creation date (YMD): 2007/12/10
 Revision date (YMD): 2008/02/10 
 (C) Copyright 2007 William McEwan (wiakapps A_t wiak D_o_t org)
************************************************************************** */

// wiak
// is free software in the sense that 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.
// Refer to http://www.fsf.org/ for further license details.

// Revision history:
// 1.0.0  Original released version.
// 1.1.2  Added options --receive and --quit
// 2.0.0  Altered main data structures and added some bash script compatible
//        System V IPC message queue functionality.
// 2.1.0  Created tiny wiak family (twiak). Changed msgq option to msgqv.
// 2.2.0  Altered --length handling for various --send terminating options.
// 2.3.0  Removed --up logic and simplified channel name scheme etc.
// -------------------------------------------------------------------------

/* Additional Notes:

 WIAK is an extremely lightweight, non-interactive shell optimised for
 InterProcessCommunications. It is written in C, using standard libraries,
 for portability, high speed and resource usage efficiency. It does not
 require bash or any other underlying shell.
 Unlike most normal shells, wiak only runs for a fraction of a second. As soon
 as it has performed its assigned task it immediately closes, releasing all
 system resources it was using. It is thus a very efficient mechanism.
 WIAK was originally designed to provide a simpler event-driven mechanism for
 the likes of gtkdialog, but it is not restricted to that purpose at all.
 Refer to http://wiak.org/ for more details and/or examine the code of the
 available exemplar "wiakapps" to see how wiak is currently used.
 -----------------------------------------------------------------*/

#include "wiakappswiak.h"

void func_optionslong(int argc, char *argv[], int *ptr_fork_result, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st);

void func_wiak_fifo(int argc, char **argv, int *ptr_fork_result, struct wargv *ptr_wargv_st, int *ptr_server_fifo_fd, int *ptr_server_fifo_fd2, struct mbox_all *ptr_msg_st);

void func_wiak_msgqv(int argc, char **argv, int *ptr_fork_result, struct wargv *ptr_wargv_st, int *ptr_server_fifo_fd,  int *ptr_server_fifo_fd2, struct mbox_all *ptr_msg_st);

void func_up_fork_server(char **argv, int *ptr_fork_result, struct wargv *ptr_wargv_st);

void func_send_fifo(int *ptr_server_fifo_fd2, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st);

void func_receive_fifo(int *ptr_server_fifo_fd, int *ptr_server_fifo_fd2, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st);

void func_send_msgqv(int *ptr_msgid, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st);

void func_receive_msgqv(int *ptr_msgid, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st);


int main(int argc, char **argv)
{
    int fork_result = 0, *ptr_fork_result = &fork_result;
    int server_fifo_fd, *ptr_server_fifo_fd = &server_fifo_fd;
    int server_fifo_fd2, *ptr_server_fifo_fd2 = &server_fifo_fd2;
    struct wargv *ptr_wargv_st = &wargv_st;

    struct mbox_all msg_st = {};
    struct mbox_all *ptr_msg_st = &msg_st;

    // if WIAKTMP environment variable is set use its value as the default path
    // for the storing the wfifo etc., or use the pre-defined default WIAKFIFOPATH.
    // WIAK also has a commandline argument --wiaktmp <arg> for altering this behaviour.
    getenv_ptr = getenv("WIAKTMP");
    if (getenv_ptr)
        strcpy(wiak_tmp_path, getenv_ptr);
    else
        strcpy(wiak_tmp_path, WIAKFIFOPATH);

    func_optionslong(argc, argv, ptr_fork_result, ptr_wargv_st, ptr_msg_st);


    // make directory for wiak fifo(s)
    mkdir(wiak_tmp_path, FIFOPATHPERMS);

    // Check which IPC mode to use
    if (ptr_wargv_st->wiak_mode[1] != '\0')
    {
        if (strcmp(ptr_wargv_st->wiak_mode, "fifo") == 0)
        {  // named pipes IPC
            func_wiak_fifo(argc, argv, ptr_fork_result, ptr_wargv_st, ptr_server_fifo_fd, ptr_server_fifo_fd2, ptr_msg_st);   
        }
        if (strcmp(ptr_wargv_st->wiak_mode, "msgqv") == 0)
        {  // System V message queues IPC
            func_wiak_msgqv(argc, argv, ptr_fork_result, ptr_wargv_st, ptr_server_fifo_fd, ptr_server_fifo_fd2, ptr_msg_st);   
        }
        if (strcmp(ptr_wargv_st->wiak_mode, "inetsocket") == 0)
        {  // AF_UNIX and AF_INET future plans...
        // func_wiak_inetsocket(argv, ptr_fork_result, ptr_wargv_st, ptr_msg_st);   
        }
        // etc...
    }
    else
    { //default mode case is use fifo (i.e. named pipe)
        func_wiak_fifo(argc, argv, ptr_fork_result, ptr_wargv_st, ptr_server_fifo_fd, ptr_server_fifo_fd2, ptr_msg_st);
    }

    close(server_fifo_fd); // close the fifo for writing but don't remove it.
    exit(fork_result);     // fork_result contains either the process id of any [program_name]
                           // started up by wiak (i.e. if wiak is supplied with a non-optional
                           // cmdline argument wiak attempts to execute the argument name)
                           // or the value 0
} /* end_of_main */

void func_optionslong(int argc, char *argv[], int *ptr_fork_result, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st)
{
    char fgets_string[BUF0256_SIZE];
    FILE *fpin;
    int opt;
    struct option long_options[] = {
    {"init", no_argument, NULL, 'i'},          // To tell wiak to create named pipe (i.e. mkfifo)
    {"quit", no_argument, NULL, 'q'},          // To tell wiak to clean up msg box(es) (e.g. rm fifos)
    {"send", required_argument, NULL, 's'},    // arg is the data to send to the message box
    {"receive", required_argument, NULL, 'r'}, // arg is the data to receive from the message box
    {"mode", required_argument, NULL, 'm'},    // Required mode:
                                               // Currently, fifo (default) or msgqv (Sys V style).
    {"channel", required_argument, NULL, 'c'}, // msg box name, alphanumeric (has a default value).
    {"zid", required_argument, NULL, 'z'},     // msg box name, numeric (has a default value).
                                               // if none of above, will use default fifo name: wfifo
    {"file", required_argument, NULL, 'f'},    // RESERVED (provided as cmdline arg to backend server)
    {"dir", required_argument, NULL, 'd'},     // RESERVED (provided as cmdline arg to backend server)
    {"wiaktmp", required_argument, NULL, 'w'}, // Location of wfifo.
    {"type", required_argument, NULL, 't'},    // type of data to send.
                                               // Default is type CHARSTRDATA as defined in wiakappswiak.h
    {"length", required_argument, NULL, 'l'},  // string length to send; not including terminating \0
    {"perms", required_argument, NULL, 'p'},   // Message box permissions (e.g. for msg queues)
                                               // default is MBOXPERMS as defined in wiakappswiak.h
    {"help", no_argument, NULL, 'h'},
    {"version", no_argument, NULL, 'v'},
    {NULL,0,NULL,0}};

     while((opt = getopt_long(argc, argv, "+iqs:r:m:c:z:f:d:w:t:l:p:hv", long_options, NULL)) != -1)
     {
        switch(opt)
        {
          case 'i':
           ptr_wargv_st->wiak_init = TRUE;
            break;
          case 'q':
           ptr_wargv_st->wiak_quit = TRUE;
            break;
          case 's':
           ptr_wargv_st->wiak_send = TRUE;
            strcpy(ptr_msg_st->msgdata.msg_char_str.c_data, optarg);
            break;
          case 'r':
           strcpy(ptr_wargv_st->wiak_receive, optarg);
            break;
          case 'm':
            strcpy(ptr_wargv_st->wiak_mode, optarg);
            break;
          case 'c':
           strcpy(ptr_wargv_st->wiak_channel, optarg);
            break;
          case 'z':
           ptr_wargv_st->wiak_zid = atoi(optarg);
            break;
          case 'f':
           strcpy(ptr_wargv_st->wiak_file, optarg);
           break;
          case 'd':
           strcpy(ptr_wargv_st->wiak_dir, optarg);
           break;
          case 'w':
           sprintf(wiak_tmp_path, "%s%s", optarg, "/");
           break;
          case 't':
           ptr_wargv_st->wiak_type = atoi(optarg);
            break;
          case 'l':
           ptr_wargv_st->wiak_length = atoi(optarg);
            break;
          case 'p':
           ptr_wargv_st->wiak_perms = (int)strtol(optarg, NULL, 8);
            break;
          case 'h':
            printf("Usage: \n\n");
         if ((fpin = fopen("/usr/local/wiakapps/wiak/wiakusage.txt","r")) == NULL)
         {
            printf("Error: Can't find file %s\n", "/usr/local/wiakapps/wiak/wiakusage.txt");
            exit(1);
         }         
         while (fgets(fgets_string, sizeof fgets_string, fpin) != NULL)
           {
              fprintf(stderr, "%s", fgets_string);
           }
            exit(0);
            break;
          case 'v':
            printf("wiak version 2.3.0\n");
            exit(0);
            break;
          case ':':
            printf("option needs a value\n");
            exit(0);
            break;
          case '?':
            printf("unknown option: %c\n", optopt);
            printf("Try `wiak --help' for usage information.\n");
            exit(0);
            break;
        }
    }

    // process wiak_length to determine end chars to --send
    switch(ptr_wargv_st->wiak_length)
    {
      case 0: // zero extra terminating characters appended
        sprintf(ptr_msg_st->msgdata.msg_char_str.c_data, "%s", ptr_msg_st->msgdata.msg_char_str.c_data);
        ptr_wargv_st->wiak_length = strlen(ptr_msg_st->msgdata.msg_char_str.c_data);
        break;
      case 1: // ends with '\n' but no terminating '\0'; this is like default bash echo I think
        sprintf(ptr_msg_st->msgdata.msg_char_str.c_data, "%s%c", ptr_msg_st->msgdata.msg_char_str.c_data, '\n');
        ptr_wargv_st->wiak_length = strlen(ptr_msg_st->msgdata.msg_char_str.c_data);
        break;
      case 2: // ends with '\n' followed by a terminating '\0';
        sprintf(ptr_msg_st->msgdata.msg_char_str.c_data, "%s%c%c", ptr_msg_st->msgdata.msg_char_str.c_data, '\n', '\0');
        ptr_wargv_st->wiak_length = strlen(ptr_msg_st->msgdata.msg_char_str.c_data) + 1;
        break;
      case 3: // no '\n' but has terminating '\0';
        sprintf(ptr_msg_st->msgdata.msg_char_str.c_data, "%s%c", ptr_msg_st->msgdata.msg_char_str.c_data, '\0');
        ptr_wargv_st->wiak_length = strlen(ptr_msg_st->msgdata.msg_char_str.c_data) + 1;
        break;
      case 4: // ends with '\t' but no '\n' or terminating '\0';
        sprintf(ptr_msg_st->msgdata.msg_char_str.c_data, "%s%c", ptr_msg_st->msgdata.msg_char_str.c_data, '\t');
        ptr_wargv_st->wiak_length = strlen(ptr_msg_st->msgdata.msg_char_str.c_data);
        break;
      case 5: // no '\n', but ends with '\t' followed by a terminating '\0';
        sprintf(ptr_msg_st->msgdata.msg_char_str.c_data, "%s%c%c", ptr_msg_st->msgdata.msg_char_str.c_data, '\t', '\0');
        ptr_wargv_st->wiak_length = strlen(ptr_msg_st->msgdata.msg_char_str.c_data) + 1;
        break;
      case 6: // ends with '\t' followed by a '\n' but no terminating '\0';
        sprintf(ptr_msg_st->msgdata.msg_char_str.c_data, "%s%c%c", ptr_msg_st->msgdata.msg_char_str.c_data, '\t', '\n');
        ptr_wargv_st->wiak_length = strlen(ptr_msg_st->msgdata.msg_char_str.c_data) + 1;
        break;
      case 7:  // ends with '\t' followed by a '\n' and then a terminating '\0';
        sprintf(ptr_msg_st->msgdata.msg_char_str.c_data, "%s%c%c%c", ptr_msg_st->msgdata.msg_char_str.c_data, '\t', '\n', '\0');
        ptr_wargv_st->wiak_length = strlen(ptr_msg_st->msgdata.msg_char_str.c_data) + 1;
        break;
    }

    if (optind < argc) // only do this if there is a non--option process to also raise
    {
        *ptr_fork_result = fork();  // fork wiak so ready to overlay with new process
                                    // The parent fork_result contains the child process pid
        if (*ptr_fork_result == 0)  // The child process fork_result contains 0
        {                           // in child
                                    // this call wiak's (i.e. wakes) an optional process
                                    // it receives only those args following its name on the cmdline
          (void) execvp(argv[optind], &argv[optind]);
          exit(EXIT_FAILURE);
        }
    }
}

void func_wiak_fifo(int argc, char **argv, int *ptr_fork_result, struct wargv *ptr_wargv_st, int *ptr_server_fifo_fd,  int *ptr_server_fifo_fd2, struct mbox_all *ptr_msg_st)
{
    // First need to determine the wfifo name before opening it for writing
    // Note that if a backend program was started *ptr_fork_result contains its pid
    if (ptr_wargv_st->wiak_zid == -1234567890) // special case: if --zid value -1234567890
    {
        if (ptr_wargv_st->wiak_channel[0] == '\0')
        {  // use fifo name = backend server process_id
          (void)sprintf(fifo_name, "%s%d", wiak_tmp_path, *ptr_fork_result);
        }
        else
        { // use fifo name = channel value + backend server process_id
          (void)sprintf(fifo_name, "%s%s%d", wiak_tmp_path, ptr_wargv_st->wiak_channel, *ptr_fork_result);
        }
    }
    else if ((ptr_wargv_st->wiak_channel[0] != '\0') && (ptr_wargv_st->wiak_zid == 0))
           // use fifo name = channel value
           (void)sprintf(fifo_name, "%s%s", wiak_tmp_path, ptr_wargv_st->wiak_channel);
    else if ((ptr_wargv_st->wiak_channel[0] == '\0') && (ptr_wargv_st->wiak_zid == 0))
           // use fifo name = default value = wiakappwiak.h FIFO_DFLT_NAME
           (void)sprintf(fifo_name, "%s%s", wiak_tmp_path, FIFO_DFLT_NAME);
    else if ((ptr_wargv_st->wiak_channel[0] != '\0') && (ptr_wargv_st->wiak_zid != 0))
           // use fifo name = channel value + zid value
           (void)sprintf(fifo_name, "%s%s%d", wiak_tmp_path, ptr_wargv_st->wiak_channel, ptr_wargv_st->wiak_zid);
    else if ((ptr_wargv_st->wiak_channel[0] == '\0') && (ptr_wargv_st->wiak_zid != 0))
    {   // use fifo name = zid value
        (void)sprintf(fifo_name, "%s%d", wiak_tmp_path, ptr_wargv_st->wiak_zid);
    }
   
    if (ptr_wargv_st->wiak_init == TRUE)
    {
        if (access(fifo_name, F_OK) == -1)
        {
            if (mkfifo(fifo_name, ptr_wargv_st->wiak_perms) == -1) // create the fifo named: channelzid
            {
                fprintf(stderr, "Error: failed to create fifo %s\n", fifo_name);
                exit(EXIT_FAILURE);
            }
        }
    }

    if (ptr_wargv_st->wiak_send == TRUE)
        func_send_fifo(ptr_server_fifo_fd2, ptr_wargv_st, ptr_msg_st);
      
    if (ptr_wargv_st->wiak_receive[0] != '\0')
        func_receive_fifo(ptr_server_fifo_fd, ptr_server_fifo_fd2, ptr_wargv_st, ptr_msg_st);   

    if (ptr_wargv_st->wiak_quit == TRUE)
    {
        close(*ptr_server_fifo_fd);
        close(*ptr_server_fifo_fd2);
        unlink(fifo_name);   
    }
} // end func_wiak_fifo


void func_send_fifo(int *ptr_server_fifo_fd2, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st)
{
      if ((*ptr_server_fifo_fd2 = open(fifo_name, O_WRONLY)) == -1)
      {
          fprintf(stderr, "Error: failed to open zfifo %s for writing\n", fifo_name);
          exit(EXIT_FAILURE);
      }
      
    if (ptr_wargv_st->wiak_type < CHARDATA)
    {   // This is the default char_string data case
        write(*ptr_server_fifo_fd2, ptr_msg_st->msgdata.msg_char_str.c_data, (ptr_wargv_st->wiak_length < 0) ? -(ptr_wargv_st->wiak_length) : ptr_wargv_st->wiak_length);
    }
    else // assuming must be STRUCTDATA for the moment
    {
        write(*ptr_server_fifo_fd2, &(ptr_msg_st->msgdata), sizeof(ptr_msg_st->msgdata));
    }
} /* end_of_func_send_fifo */


void func_receive_fifo(int *ptr_server_fifo_fd, int *ptr_server_fifo_fd2, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st)
{
    if ((*ptr_server_fifo_fd = open(fifo_name, O_RDONLY)) == -1)
      {
          fprintf(stderr, "Error: failed to open zfifo %s for reading\n", fifo_name);
          exit(EXIT_FAILURE);
      }
      if ((*ptr_server_fifo_fd2 = open(fifo_name, O_WRONLY)) == -1)
      {
          fprintf(stderr, "Error: failed to open zfifo %s for writing\n", fifo_name);
          exit(EXIT_FAILURE);
      }
      
    if (ptr_wargv_st->wiak_type < CHARDATA)
    {   // This is the default char_string data case
        read(*ptr_server_fifo_fd, ptr_msg_st->msgdata.msg_char_str.c_data, (ptr_wargv_st->wiak_length < 0) ? -(ptr_wargv_st->wiak_length) : sizeof(ptr_msg_st->msgdata.msg_char_str.c_data));
        write(1, ptr_msg_st->msgdata.msg_char_str.c_data, strlen(ptr_msg_st->msgdata.msg_char_str.c_data));
    }
    else // assuming must be STRUCTDATA for the moment
    {
        read(*ptr_server_fifo_fd, &(ptr_msg_st->msgdata), (ptr_wargv_st->wiak_length == 0) ? sizeof(ptr_msg_st->msgdata) : ptr_wargv_st->wiak_length);

        write(1, ptr_msg_st->msgdata.msg_char_str.c_data, strlen(ptr_msg_st->msgdata.msg_char_str.c_data));
    }
} /* end_of_func_receive_fifo */


void func_wiak_msgqv(int argc, char **argv, int *ptr_fork_result, struct wargv *ptr_wargv_st, int *ptr_server_fifo_fd,  int *ptr_server_fifo_fd2, struct mbox_all *ptr_msg_st)
{
    int msgid, *ptr_msgid = &msgid;

    // First need to determine the msgqv numeric namekey before creating/using it.
    // Since a msgqv namekey is an integer (+ or -), the user is best to initialise
    // it with a unique --zid value or the special --zid value of -1234567890. The
    // latter results in a msgqv namekey being derived from the ptr_fork_result,
    // which can be arranged to be the backend server's process_id since
    // if a backend program was started, *ptr_fork_result contains its pid.

    if (ptr_wargv_st->wiak_zid == -1234567890) // special case: if --zid value -1234567890
                                         // use backend server process_id as msgqv namekey
        msgqv_namekey = *ptr_fork_result;
    else if ((ptr_wargv_st->wiak_channel[0] == '\0') && (ptr_wargv_st->wiak_zid != 0))
        msgqv_namekey = ptr_wargv_st->wiak_zid; // simply use cmdline --zid value
    else if ((ptr_wargv_st->wiak_channel[0] != '\0') && (ptr_wargv_st->wiak_zid != 0))
    {   // special case of dummy channel name and --zid value: combine server pid with zid   
        msgqv_namekey = *ptr_fork_result;
        msgqv_namekey = msgqv_namekey << 10;      // multiply server_pid by 1024
        msgqv_namekey += ptr_wargv_st->wiak_zid; // and add --zid value
    }
    // else use default value MSGQV_DFLT_NAMEKEY from wiakappswiak.h
   
    msgid = msgget((key_t)msgqv_namekey, ptr_wargv_st->wiak_perms | IPC_CREAT); // create the msgqv named: msgqv_namekey
    if (msgid == -1) {
        fprintf(stderr, "Error: failed to create SysV message queue %d\n", msgqv_namekey);
        exit(EXIT_FAILURE);
    }
 
    if (ptr_wargv_st->wiak_send == TRUE)
        func_send_msgqv(ptr_msgid, ptr_wargv_st, ptr_msg_st);
           
    if (ptr_wargv_st->wiak_receive[0] != '\0')
        func_receive_msgqv(ptr_msgid, ptr_wargv_st, ptr_msg_st);

    if (ptr_wargv_st->wiak_quit == TRUE)
    {
        if (msgctl(*ptr_msgid, IPC_RMID, 0) == -1) {
            fprintf(stderr, "Error: func_wiak_msgqv failed to clean up\n");
            exit(EXIT_FAILURE);
        };   
    }
} // end func_wiak_msgqv


void func_send_msgqv(int *ptr_msgid, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st)
{
    if (ptr_wargv_st->wiak_type < CHARDATA)
    {   // This is the default char_string data case
        ptr_msg_st->msgdata.msg_char_str.msgtype = ptr_wargv_st->wiak_type;
        if (msgsnd(*ptr_msgid, (void *) &(ptr_msg_st->msgdata.msg_char_str), (ptr_wargv_st->wiak_length < 0) ? -(ptr_wargv_st->wiak_length) : ptr_wargv_st->wiak_length, 0) == -1) {
            fprintf(stderr, "Error: func_send_msgqv failed to send data\n");
            exit(EXIT_FAILURE);
        };
    }
    else // assuming must be STRUCTDATA for the moment
    {
        if (msgsnd(*ptr_msgid, (void *)&ptr_msg_st, sizeof(ptr_msg_st->msgdata), 0) == -1) {
            fprintf(stderr, "Error: func_send_msgqv failed to send data\n");
            exit(EXIT_FAILURE);
        };
    }
} /* end_of_func_send_msgqv */


void func_receive_msgqv(int *ptr_msgid, struct wargv *ptr_wargv_st, struct mbox_all *ptr_msg_st)
{
    if (ptr_wargv_st->wiak_type < CHARDATA)
    {   // This is the default char_string data case
        if (msgrcv(*ptr_msgid, (void *)&(ptr_msg_st->msgdata.msg_char_str), sizeof(ptr_msg_st->msgdata.msg_char_str.c_data), ptr_wargv_st->wiak_type, 0) == -1) {
            fprintf(stderr, "Error: func_receive_msgqv failed to recv data\n");
            exit(EXIT_FAILURE);
        };

        write(1, ptr_msg_st->msgdata.msg_char_str.c_data, strlen(ptr_msg_st->msgdata.msg_char_str.c_data));

    }
    else // assuming must be STRUCTDATA for the moment
    {
        if (msgrcv(*ptr_msgid, (void *)&ptr_msg_st, sizeof(ptr_msg_st->msgdata), ptr_wargv_st->wiak_type, 0) == -1) {
            fprintf(stderr, "Error: func_receive_msgqv failed to recv data\n");
            exit(EXIT_FAILURE);
        };

        write(1, ptr_msg_st->msgdata.msg_char_str.c_data, strlen(ptr_msg_st->msgdata.msg_char_str.c_data));
    }
} /* end_of_func_receive_msgqv */
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 957
Location: not Bulgaria

PostPosted: Fri 08 Jun 2018, 06:11    Post subject:  

@Flash:

Why are you not unlocking the gtkwialog dev thread when requested?!

Do you have something personal against the Puppy Linux version of gtkdialog being forked for possible use on the Dogs or is there some other actually logical good reason? You haven't given a logically justifiable reason thus far, aside from a demonstration of power.

Otherwise, what is your problem with unlocking the thread exactly? Certainly I can continue discussions here or on another thread, but you would have to be some motive, surely, for forcing that fragmented situation when you can simply unlock?

wiak
Back to top
View user's profile Send private message 
Sailor Enceladus

Joined: 22 Feb 2016
Posts: 1547

PostPosted: Fri 08 Jun 2018, 06:28    Post subject:  

This thread should have been sent by PM (Inbox) to a moderator, and as a nice request, not a public outcry. That seems pretty obvious to me, not sure why wiak couldn't have possibly realized this... wiak has just exposed that he/she is a emotional unstable and fickle loose cannon to everyone. Entertaining? A bit. But more uncomfortable and awkward I think. Is jamesbond the only fatdog developer who isn't completely self-absorbed and hasn't completely lost their marbles? Where is that Semme image? Save the drama for your Momma!

Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 957
Location: not Bulgaria

PostPosted: Fri 08 Jun 2018, 06:36    Post subject:  

Sailor Enceladus wrote:
This thread should have been sent by PM (Inbox) to a moderator, and as a nice request, not a public outcry. That seems pretty obvious to me, not sure why wiak couldn't have possibly realized this... wiak has just exposed that he/she is a emotional unstable and fickle loose cannon to everyone. Entertaining? A bit. But more uncomfortable and awkward I think. Is jamesbond the only fatdog developer who isn't completely self-absorbed and hasn't completely lost their marbles? Where is that Semme image? Save the drama for your Momma!



Well, thankyou for that Sailor Enceladus... puppy enthusiast and faithful one. What you fail to recognise is that Flash did not have the courtesy to PM me before locking that development thread. Instead it was a public snub so public it is.

Sailor Enceladus wrote:
We could just delete every thread in Puppy Projects that does not fit with the idea mavrothal proposed. Better luck next time guys, should have posted your fork in Puppy Derivatives Twisted Evil Very Happy


Actually, from your trolling flame comments it is clearly you who is the emotionally insecure and "fickle loose cannon" who needs his mama Smile

But, were this not such a biased forum I expect it is you who would be banned for such non-technical attacks on a person like that.

Your issues are too sensitive to discuss further:

wikipedia wrote:
[Enceladus] shoot[s] geyser-like jets of water vapor, molecular hydrogen, other volatiles, and solid material, including sodium chloride crystals and ice particles, into space, totaling about 200 kg (440 lb) per second.[14][17][19] Over 100 geysers have been identified.


Smile

wiak
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 3 [36 Posts]   Goto page: Previous 1, 2, 3 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1323s ][ Queries: 13 (0.0114s) ][ GZIP on ]